@needle-tools/engine 4.13.1 → 4.14.0-beta
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/CHANGELOG.md +9 -0
- package/components.needle.json +1 -1
- package/dist/generateMeshBVH.worker-DiCnZlf3.js +21 -0
- package/dist/gltf-progressive-Bm_6aEi4.js +1528 -0
- package/dist/gltf-progressive-BttGBXw6.umd.cjs +10 -0
- package/dist/gltf-progressive-T5WKTux5.min.js +10 -0
- package/dist/loader.worker-BqODMeeW.js +23 -0
- package/dist/{materialx-B9ddsHcF.min.js → materialx-CJyQZtjt.min.js} +1 -1
- package/dist/{materialx-fkoFuRh3.js → materialx-DMs1E08Z.js} +2 -2
- package/dist/{materialx-BF23AVE8.umd.cjs → materialx-DaKKOoVk.umd.cjs} +1 -1
- package/dist/needle-engine.bundle-BW2VusZV.min.js +1646 -0
- package/dist/{needle-engine.bundle-tjI5Fq2c.umd.cjs → needle-engine.bundle-Cb5bKEqa.umd.cjs} +152 -159
- package/dist/{needle-engine.bundle-DauZUYl7.js → needle-engine.bundle-D9VPvp5o.js} +7798 -7497
- package/dist/needle-engine.d.ts +779 -42
- package/dist/needle-engine.js +416 -415
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-BVNrgYZK.min.js → postprocessing-CctM1XIO.min.js} +1 -1
- package/dist/{postprocessing-DdM-tz1j.js → postprocessing-DGm6qJ-I.js} +2 -2
- package/dist/{postprocessing-CI2TjWpu.umd.cjs → postprocessing-Dbl2PJpd.umd.cjs} +1 -1
- package/dist/{three-BW2s1Yl-.umd.cjs → three-BjYim-vL.umd.cjs} +4 -4
- package/dist/{three-VvRoMeIN.js → three-Bvk2VKbF.js} +4210 -4210
- package/dist/{three-I__hSXzr.min.js → three-IG2qPafA.min.js} +33 -33
- package/dist/{three-examples-Bpfu6ke_.umd.cjs → three-examples-BMmNgNCN.umd.cjs} +1 -1
- package/dist/{three-examples-BhfOE7NG.js → three-examples-CMYCd5nH.js} +1 -1
- package/dist/{three-examples-D8zAE_7t.min.js → three-examples-CQl1fFZp.min.js} +1 -1
- package/dist/{three-mesh-ui-C3QbemOV.min.js → three-mesh-ui-5HVE2RV-.min.js} +1 -1
- package/dist/{three-mesh-ui-CcMp-FQm.js → three-mesh-ui-BlakAItG.js} +1 -1
- package/dist/{three-mesh-ui-BU55xDxJ.umd.cjs → three-mesh-ui-D828VbQp.umd.cjs} +1 -1
- package/dist/{vendor-DW7zqjuT.min.js → vendor-BxK0WKmT.min.js} +1 -1
- package/dist/{vendor-COVQl0b8.umd.cjs → vendor-CIDkyBaO.umd.cjs} +1 -1
- package/dist/{vendor-BiyIZ61v.js → vendor-ixwD-vv2.js} +1 -1
- package/lib/engine/api.d.ts +1 -0
- package/lib/engine/api.js +1 -0
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/engine_context.js +12 -2
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_lightdata.js +8 -6
- package/lib/engine/engine_lightdata.js.map +1 -1
- package/lib/engine/engine_materialpropertyblock.d.ts +259 -0
- package/lib/engine/engine_materialpropertyblock.js +682 -0
- package/lib/engine/engine_materialpropertyblock.js.map +1 -0
- package/lib/engine/engine_utils.d.ts +1 -0
- package/lib/engine/engine_utils.js +1 -0
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/engine_utils_screenshot.d.ts +171 -14
- package/lib/engine/engine_utils_screenshot.js +65 -0
- package/lib/engine/engine_utils_screenshot.js.map +1 -1
- package/lib/engine/engine_utils_screenshot.xr.d.ts +1 -1
- package/lib/engine/engine_utils_screenshot.xr.js +1 -1
- package/lib/engine/extensions/NEEDLE_techniques_webgl.js +3 -0
- package/lib/engine/extensions/NEEDLE_techniques_webgl.js.map +1 -1
- package/lib/engine/xr/NeedleXRSession.d.ts +5 -0
- package/lib/engine/xr/NeedleXRSession.js +5 -0
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/DropListener.js.map +1 -1
- package/lib/engine-components/Duplicatable.js.map +1 -1
- package/lib/engine-components/GroundProjection.js.map +1 -1
- package/lib/engine-components/NeedleMenu.js.map +1 -1
- package/lib/engine-components/NestedGltf.js.map +1 -1
- package/lib/engine-components/ReflectionProbe.d.ts +32 -4
- package/lib/engine-components/ReflectionProbe.js +58 -88
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/Renderer.d.ts +2 -0
- package/lib/engine-components/Renderer.js +30 -6
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/RendererLightmap.d.ts +13 -9
- package/lib/engine-components/RendererLightmap.js +67 -81
- package/lib/engine-components/RendererLightmap.js.map +1 -1
- package/lib/engine-components/SeeThrough.d.ts +0 -2
- package/lib/engine-components/SeeThrough.js +114 -88
- package/lib/engine-components/SeeThrough.js.map +1 -1
- package/lib/engine-components/SmoothFollow.js.map +1 -1
- package/lib/engine-components/VideoPlayer.js +6 -0
- package/lib/engine-components/VideoPlayer.js.map +1 -1
- package/lib/engine-components/ui/Button.js.map +1 -1
- package/lib/engine-components/ui/Raycaster.js.map +1 -1
- package/lib/engine-components/utils/OpenURL.d.ts +1 -0
- package/lib/engine-components/utils/OpenURL.js +1 -0
- package/lib/engine-components/utils/OpenURL.js.map +1 -1
- package/lib/engine-components/web/CursorFollow.d.ts +1 -0
- package/lib/engine-components/web/CursorFollow.js +1 -0
- package/lib/engine-components/web/CursorFollow.js.map +1 -1
- package/lib/engine-components/web/ScrollFollow.d.ts +1 -0
- package/lib/engine-components/web/ScrollFollow.js +1 -0
- package/lib/engine-components/web/ScrollFollow.js.map +1 -1
- package/lib/engine-components/web/ViewBox.d.ts +2 -2
- package/lib/engine-components/web/ViewBox.js +2 -2
- package/lib/engine-components/web/ViewBox.js.map +1 -1
- package/lib/engine-components/webxr/WebARCameraBackground.d.ts +9 -0
- package/lib/engine-components/webxr/WebARCameraBackground.js +9 -0
- package/lib/engine-components/webxr/WebARCameraBackground.js.map +1 -1
- package/lib/engine-components/webxr/WebXR.d.ts +1 -0
- package/lib/engine-components/webxr/WebXR.js +1 -0
- package/lib/engine-components/webxr/WebXR.js.map +1 -1
- package/lib/engine-components/webxr/WebXRPlaneTracking.js.map +1 -1
- package/lib/engine-components/webxr/controllers/XRControllerFollow.js.map +1 -1
- package/lib/engine-components/webxr/controllers/XRControllerMovement.js.map +1 -1
- package/package.json +5 -5
- package/plugins/vite/build-pipeline.js +16 -2
- package/src/engine/api.ts +1 -0
- package/src/engine/engine_context.ts +17 -3
- package/src/engine/engine_lightdata.ts +8 -6
- package/src/engine/engine_materialpropertyblock.ts +866 -0
- package/src/engine/engine_utils.ts +1 -0
- package/src/engine/engine_utils_screenshot.ts +241 -17
- package/src/engine/engine_utils_screenshot.xr.ts +1 -1
- package/src/engine/extensions/NEEDLE_techniques_webgl.ts +3 -0
- package/src/engine/xr/NeedleXRSession.ts +5 -0
- package/src/engine-components/Camera.ts +2 -2
- package/src/engine-components/ContactShadows.ts +1 -1
- package/src/engine-components/DropListener.ts +1 -1
- package/src/engine-components/Duplicatable.ts +1 -1
- package/src/engine-components/GroundProjection.ts +3 -0
- package/src/engine-components/NeedleMenu.ts +3 -0
- package/src/engine-components/NestedGltf.ts +1 -1
- package/src/engine-components/ReflectionProbe.ts +64 -105
- package/src/engine-components/Renderer.ts +34 -6
- package/src/engine-components/RendererLightmap.ts +75 -87
- package/src/engine-components/SeeThrough.ts +124 -109
- package/src/engine-components/SmoothFollow.ts +2 -2
- package/src/engine-components/VideoPlayer.ts +6 -0
- package/src/engine-components/ui/Button.ts +1 -1
- package/src/engine-components/ui/Raycaster.ts +1 -1
- package/src/engine-components/utils/OpenURL.ts +1 -0
- package/src/engine-components/web/CursorFollow.ts +1 -0
- package/src/engine-components/web/ScrollFollow.ts +1 -0
- package/src/engine-components/web/ViewBox.ts +9 -2
- package/src/engine-components/webxr/WebARCameraBackground.ts +12 -3
- package/src/engine-components/webxr/WebXR.ts +1 -0
- package/src/engine-components/webxr/WebXRPlaneTracking.ts +3 -3
- package/src/engine-components/webxr/controllers/XRControllerFollow.ts +1 -1
- package/src/engine-components/webxr/controllers/XRControllerMovement.ts +4 -4
- package/dist/generateMeshBVH.worker-iyfPIK6R.js +0 -21
- package/dist/gltf-progressive-BURrJW0U.umd.cjs +0 -8
- package/dist/gltf-progressive-DHLDFNvQ.min.js +0 -8
- package/dist/gltf-progressive-eiJCrjLb.js +0 -1400
- package/dist/loader.worker-C1GG9A7C.js +0 -23
- package/dist/needle-engine.bundle-BNIUpreS.min.js +0 -1653
- package/src/include/three/DragControls.js +0 -232
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var go=typeof document<"u"?document.currentScript:null;const js="169",q_={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},$_={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Y_=0,af=1,Z_=2,rA=3,oA=0,Ff=1,Of=2,oi=3,gs=0,ln=1,Ji=2,Fi=0,Ls=1,lc=2,cf=3,lf=4,Vf=5,Js=100,J_=101,K_=102,j_=103,Bf=104,Q_=200,ey=201,ty=202,ny=203,zu=204,ku=205,iy=206,sy=207,ry=208,oy=209,ay=210,cy=211,ly=212,uy=213,hy=214,uc=0,hc=1,dc=2,ir=3,pc=4,fc=5,mc=6,gc=7,ma=0,zf=1,kf=2,Ti=0,Ch=1,Rh=2,Gf=3,Ih=4,dy=5,Ph=6,Lh=7,uf="attached",py="detached",Dh=300,wi=301,Vi=302,sr=303,rr=304,dr=306,or=1e3,Si=1001,ta=1002,Qt=1003,Uh=1004,fy=1004,Is=1005,aA=1005,Ut=1006,Qs=1007,cA=1007,Kn=1008,Hf=1008,es=1009,Wf=1010,Xf=1011,na=1012,ga=1013,Bi=1014,Gn=1015,Ln=1016,Fh=1017,Oh=1018,ar=1020,Vh=35902,Bh=35899,qf=1021,zh=1022,Rn=1023,$f=1024,Yf=1025,er=1026,cr=1027,Wc=1028,Xc=1029,ia=1030,kh=1031,lA=1032,Gh=1033,Yo=33776,Zo=33777,Jo=33778,Ko=33779,xc=35840,Gu=35841,_c=35842,Hu=35843,yc=36196,vc=37492,Mc=37496,Sc=37808,Wu=37809,Xu=37810,qu=37811,Tc=37812,$u=37813,Yu=37814,Zu=37815,Ju=37816,Ku=37817,ju=37818,Qu=37819,eh=37820,th=37821,jo=36492,nh=36494,bc=36495,Zf=36283,ih=36284,sh=36285,rh=36286,Jf=2200,Kf=2201,my=2202,sa=2300,wc=2301,Iu=2302,kr=2400,Gr=2401,Ac=2402,Hh=2500,jf=2501,gy=0,xy=1,_y=2,Qf=3200,em=3201,uA=3202,hA=3203,xs=0,tm=1,Li="",kn="srgb",li="srgb-linear",Wh="display-p3",qc="display-p3-linear",Nc="linear",Vt="srgb",Ec="rec709",Cc="p3",yy=0,Ys=7680,vy=7681,My=7682,Sy=7683,Ty=34055,by=34056,wy=5386,Ay=512,Ny=513,Ey=514,Cy=515,Ry=516,Iy=517,Py=518,oh=519,Ly=512,nm=513,Dy=514,im=515,Uy=516,Fy=517,Oy=518,Vy=519,ra=35044,Hr=35048,dA=35040,pA=35045,fA=35049,mA=35041,gA=35046,xA=35050,_A=35042,yA="100",ah="300 es",Di=2e3,eo=2001;class Ai{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let r=0,o=i.length;r<o;r++)i[r].call(this,e);e.target=null}}}const Vn=["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"];let S0=1234567;const Yr=Math.PI/180,oa=180/Math.PI;function bi(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Vn[s&255]+Vn[s>>8&255]+Vn[s>>16&255]+Vn[s>>24&255]+"-"+Vn[e&255]+Vn[e>>8&255]+"-"+Vn[e>>16&15|64]+Vn[e>>24&255]+"-"+Vn[t&63|128]+Vn[t>>8&255]+"-"+Vn[t>>16&255]+Vn[t>>24&255]+Vn[n&255]+Vn[n>>8&255]+Vn[n>>16&255]+Vn[n>>24&255]).toLowerCase()}function jt(s,e,t){return Math.max(e,Math.min(t,s))}function sm(s,e){return(s%e+e)%e}function vA(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function MA(s,e,t){return s!==e?(t-s)/(e-s):0}function ja(s,e,t){return(1-t)*s+t*e}function SA(s,e,t,n){return ja(s,e,1-Math.exp(-t*n))}function TA(s,e=1){return e-Math.abs(sm(s,e*2)-e)}function bA(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function wA(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function AA(s,e){return s+Math.floor(Math.random()*(e-s+1))}function NA(s,e){return s+Math.random()*(e-s)}function EA(s){return s*(.5-Math.random())}function CA(s){s!==void 0&&(S0=s);let e=S0+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function RA(s){return s*Yr}function IA(s){return s*oa}function PA(s){return(s&s-1)===0&&s!==0}function LA(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function DA(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function UA(s,e,t,n,i){const r=Math.cos,o=Math.sin,a=r(t/2),c=o(t/2),l=r((e+n)/2),u=o((e+n)/2),h=r((e-n)/2),d=o((e-n)/2),p=r((n-e)/2),f=o((n-e)/2);switch(i){case"XYX":s.set(a*u,c*h,c*d,a*l);break;case"YZY":s.set(c*d,a*u,c*h,a*l);break;case"ZXZ":s.set(c*h,c*d,a*u,a*l);break;case"XZX":s.set(a*u,c*f,c*p,a*l);break;case"YXY":s.set(c*p,a*u,c*f,a*l);break;case"ZYZ":s.set(c*f,c*p,a*u,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Zn(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function ut(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const Xh={DEG2RAD:Yr,RAD2DEG:oa,generateUUID:bi,clamp:jt,euclideanModulo:sm,mapLinear:vA,inverseLerp:MA,lerp:ja,damp:SA,pingpong:TA,smoothstep:bA,smootherstep:wA,randInt:AA,randFloat:NA,randFloatSpread:EA,seededRandom:CA,degToRad:RA,radToDeg:IA,isPowerOfTwo:PA,ceilPowerOfTwo:LA,floorPowerOfTwo:DA,setQuaternionFromProperEuler:UA,normalize:ut,denormalize:Zn};class J{constructor(e=0,t=0){J.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(jt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*n-o*i+e.x,this.y=r*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ke{constructor(e,t,n,i,r,o,a,c,l){Ke.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,o,a,c,l)}set(e,t,n,i,r,o,a,c,l){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=r,u[5]=c,u[6]=n,u[7]=o,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[3],c=n[6],l=n[1],u=n[4],h=n[7],d=n[2],p=n[5],f=n[8],x=i[0],m=i[3],g=i[6],y=i[1],_=i[4],v=i[7],I=i[2],T=i[5],w=i[8];return r[0]=o*x+a*y+c*I,r[3]=o*m+a*_+c*T,r[6]=o*g+a*v+c*w,r[1]=l*x+u*y+h*I,r[4]=l*m+u*_+h*T,r[7]=l*g+u*v+h*w,r[2]=d*x+p*y+f*I,r[5]=d*m+p*_+f*T,r[8]=d*g+p*v+f*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8];return t*o*u-t*a*l-n*r*u+n*a*c+i*r*l-i*o*c}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=u*o-a*l,d=a*c-u*r,p=l*r-o*c,f=t*h+n*d+i*p;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/f;return e[0]=h*x,e[1]=(i*l-u*n)*x,e[2]=(a*n-i*o)*x,e[3]=d*x,e[4]=(u*t-i*c)*x,e[5]=(i*r-a*t)*x,e[6]=p*x,e[7]=(n*c-l*t)*x,e[8]=(o*t-n*r)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,o,a){const c=Math.cos(r),l=Math.sin(r);return this.set(n*c,n*l,-n*(c*o+l*a)+o+e,-i*l,i*c,-i*(-l*o+c*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Zd.makeScale(e,t)),this}rotate(e){return this.premultiply(Zd.makeRotation(-e)),this}translate(e,t){return this.premultiply(Zd.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Zd=new Ke;function By(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}const FA={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Go(s,e){return new FA[s](e)}function Rc(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function zy(){const s=Rc("canvas");return s.style.display="block",s}const T0={};function Pu(s){s in T0||(T0[s]=!0,console.warn(s))}function OA(s,e,t){return new Promise(function(n,i){function r(){switch(s.clientWaitSync(e,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}function VA(s){const e=s.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function BA(s){const e=s.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const b0=new Ke().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),w0=new Ke().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Ra={[li]:{transfer:Nc,primaries:Ec,luminanceCoefficients:[.2126,.7152,.0722],toReference:s=>s,fromReference:s=>s},[kn]:{transfer:Vt,primaries:Ec,luminanceCoefficients:[.2126,.7152,.0722],toReference:s=>s.convertSRGBToLinear(),fromReference:s=>s.convertLinearToSRGB()},[qc]:{transfer:Nc,primaries:Cc,luminanceCoefficients:[.2289,.6917,.0793],toReference:s=>s.applyMatrix3(w0),fromReference:s=>s.applyMatrix3(b0)},[Wh]:{transfer:Vt,primaries:Cc,luminanceCoefficients:[.2289,.6917,.0793],toReference:s=>s.convertSRGBToLinear().applyMatrix3(w0),fromReference:s=>s.applyMatrix3(b0).convertLinearToSRGB()}},zA=new Set([li,qc]),gt={enabled:!0,_workingColorSpace:li,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(s){if(!zA.has(s))throw new Error(`Unsupported working color space, "${s}".`);this._workingColorSpace=s},convert:function(s,e,t){if(this.enabled===!1||e===t||!e||!t)return s;const n=Ra[e].toReference,i=Ra[t].fromReference;return i(n(s))},fromWorkingColorSpace:function(s,e){return this.convert(s,this._workingColorSpace,e)},toWorkingColorSpace:function(s,e){return this.convert(s,e,this._workingColorSpace)},getPrimaries:function(s){return Ra[s].primaries},getTransfer:function(s){return s===Li?Nc:Ra[s].transfer},getLuminanceCoefficients:function(s,e=this._workingColorSpace){return s.fromArray(Ra[e].luminanceCoefficients)}};function Qo(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function Jd(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}let xo;class ky{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{xo===void 0&&(xo=Rc("canvas")),xo.width=e.width,xo.height=e.height;const n=xo.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=xo}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Rc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let o=0;o<r.length;o++)r[o]=Qo(r[o]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Qo(t[n]/255)*255):t[n]=Qo(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let kA=0;class Ks{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:kA++}),this.uuid=bi(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?r.push(Kd(i[o].image)):r.push(Kd(i[o]))}else r=Kd(i);n.url=r}return t||(e.images[this.uuid]=n),n}}function Kd(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?ky.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let GA=0;class Xt extends Ai{constructor(e=Xt.DEFAULT_IMAGE,t=Xt.DEFAULT_MAPPING,n=Si,i=Si,r=Ut,o=Kn,a=Rn,c=es,l=Xt.DEFAULT_ANISOTROPY,u=Li){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:GA++}),this.uuid=bi(),this.name="",this.source=new Ks(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=c,this.offset=new J(0,0),this.repeat=new J(1,1),this.center=new J(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ke,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Dh)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case or:e.x=e.x-Math.floor(e.x);break;case Si:e.x=e.x<0?0:1;break;case ta:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case or:e.y=e.y-Math.floor(e.y);break;case Si:e.y=e.y<0?0:1;break;case ta:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Xt.DEFAULT_IMAGE=null;Xt.DEFAULT_MAPPING=Dh;Xt.DEFAULT_ANISOTROPY=4;class st{constructor(e=0,t=0,n=0,i=1){st.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const c=e.elements,l=c[0],u=c[4],h=c[8],d=c[1],p=c[5],f=c[9],x=c[2],m=c[6],g=c[10];if(Math.abs(u-d)<.01&&Math.abs(h-x)<.01&&Math.abs(f-m)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+x)<.1&&Math.abs(f+m)<.1&&Math.abs(l+p+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const _=(l+1)/2,v=(p+1)/2,I=(g+1)/2,T=(u+d)/4,w=(h+x)/4,C=(f+m)/4;return _>v&&_>I?_<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(_),i=T/n,r=w/n):v>I?v<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(v),n=T/i,r=C/i):I<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(I),n=w/r,i=C/r),this.set(n,i,r,t),this}let y=Math.sqrt((m-f)*(m-f)+(h-x)*(h-x)+(d-u)*(d-u));return Math.abs(y)<.001&&(y=1),this.x=(m-f)/y,this.y=(h-x)/y,this.z=(d-u)/y,this.w=Math.acos((l+p+g-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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 fn extends Ai{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new st(0,0,e,t),this.scissorTest=!1,this.viewport=new st(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ut,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new Xt(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const o=n.count;for(let a=0;a<o;a++)this.textures[a]=r.clone(),this.textures[a].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,i=e.textures.length;n<i;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Ks(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class zi extends fn{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class $c extends Xt{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Qt,this.minFilter=Qt,this.wrapR=Si,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class HA extends zi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new $c(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class qh extends Xt{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Qt,this.minFilter=Qt,this.wrapR=Si,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class WA extends zi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new qh(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Hn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,o,a){let c=n[i+0],l=n[i+1],u=n[i+2],h=n[i+3];const d=r[o+0],p=r[o+1],f=r[o+2],x=r[o+3];if(a===0){e[t+0]=c,e[t+1]=l,e[t+2]=u,e[t+3]=h;return}if(a===1){e[t+0]=d,e[t+1]=p,e[t+2]=f,e[t+3]=x;return}if(h!==x||c!==d||l!==p||u!==f){let m=1-a;const g=c*d+l*p+u*f+h*x,y=g>=0?1:-1,_=1-g*g;if(_>Number.EPSILON){const I=Math.sqrt(_),T=Math.atan2(I,g*y);m=Math.sin(m*T)/I,a=Math.sin(a*T)/I}const v=a*y;if(c=c*m+d*v,l=l*m+p*v,u=u*m+f*v,h=h*m+x*v,m===1-a){const I=1/Math.sqrt(c*c+l*l+u*u+h*h);c*=I,l*=I,u*=I,h*=I}}e[t]=c,e[t+1]=l,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,o){const a=n[i],c=n[i+1],l=n[i+2],u=n[i+3],h=r[o],d=r[o+1],p=r[o+2],f=r[o+3];return e[t]=a*f+u*h+c*p-l*d,e[t+1]=c*f+u*d+l*h-a*p,e[t+2]=l*f+u*p+a*d-c*h,e[t+3]=u*f-a*h-c*d-l*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,r=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(n/2),u=a(i/2),h=a(r/2),d=c(n/2),p=c(i/2),f=c(r/2);switch(o){case"XYZ":this._x=d*u*h+l*p*f,this._y=l*p*h-d*u*f,this._z=l*u*f+d*p*h,this._w=l*u*h-d*p*f;break;case"YXZ":this._x=d*u*h+l*p*f,this._y=l*p*h-d*u*f,this._z=l*u*f-d*p*h,this._w=l*u*h+d*p*f;break;case"ZXY":this._x=d*u*h-l*p*f,this._y=l*p*h+d*u*f,this._z=l*u*f+d*p*h,this._w=l*u*h-d*p*f;break;case"ZYX":this._x=d*u*h-l*p*f,this._y=l*p*h+d*u*f,this._z=l*u*f-d*p*h,this._w=l*u*h+d*p*f;break;case"YZX":this._x=d*u*h+l*p*f,this._y=l*p*h+d*u*f,this._z=l*u*f-d*p*h,this._w=l*u*h-d*p*f;break;case"XZY":this._x=d*u*h-l*p*f,this._y=l*p*h-d*u*f,this._z=l*u*f+d*p*h,this._w=l*u*h+d*p*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],o=t[1],a=t[5],c=t[9],l=t[2],u=t[6],h=t[10],d=n+a+h;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(u-c)*p,this._y=(r-l)*p,this._z=(o-i)*p}else if(n>a&&n>h){const p=2*Math.sqrt(1+n-a-h);this._w=(u-c)/p,this._x=.25*p,this._y=(i+o)/p,this._z=(r+l)/p}else if(a>h){const p=2*Math.sqrt(1+a-n-h);this._w=(r-l)/p,this._x=(i+o)/p,this._y=.25*p,this._z=(c+u)/p}else{const p=2*Math.sqrt(1+h-n-a);this._w=(o-i)/p,this._x=(r+l)/p,this._y=(c+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(jt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,o=e._w,a=t._x,c=t._y,l=t._z,u=t._w;return this._x=n*u+o*a+i*l-r*c,this._y=i*u+o*c+r*a-n*l,this._z=r*u+o*l+n*c-i*a,this._w=o*u-n*a-i*c-r*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,r=this._z,o=this._w;let a=o*e._w+n*e._x+i*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;const c=1-a*a;if(c<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*n+t*this._x,this._y=p*i+t*this._y,this._z=p*r+t*this._z,this.normalize(),this}const l=Math.sqrt(c),u=Math.atan2(l,a),h=Math.sin((1-t)*u)/l,d=Math.sin(t*u)/l;return this._w=o*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class E{constructor(e=0,t=0,n=0){E.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(A0.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(A0.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,o=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,o=e.y,a=e.z,c=e.w,l=2*(o*i-a*n),u=2*(a*t-r*i),h=2*(r*n-o*t);return this.x=t+c*l+o*h-a*u,this.y=n+c*u+a*l-r*h,this.z=i+c*h+r*u-o*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,o=t.x,a=t.y,c=t.z;return this.x=i*c-r*a,this.y=r*o-n*c,this.z=n*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return jd.copy(this).projectOnVector(e),this.sub(jd)}reflect(e){return this.sub(jd.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(jt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const jd=new E,A0=new Hn;class Wn{constructor(e=new E(1/0,1/0,1/0),t=new E(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(qi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(qi.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=qi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=r.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,qi):qi.fromBufferAttribute(r,o),qi.applyMatrix4(e.matrixWorld),this.expandByPoint(qi);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Al.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Al.copy(n.boundingBox)),Al.applyMatrix4(e.matrixWorld),this.union(Al)}const i=e.children;for(let r=0,o=i.length;r<o;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,qi),qi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ia),Nl.subVectors(this.max,Ia),_o.subVectors(e.a,Ia),yo.subVectors(e.b,Ia),vo.subVectors(e.c,Ia),zs.subVectors(yo,_o),ks.subVectors(vo,yo),Sr.subVectors(_o,vo);let t=[0,-zs.z,zs.y,0,-ks.z,ks.y,0,-Sr.z,Sr.y,zs.z,0,-zs.x,ks.z,0,-ks.x,Sr.z,0,-Sr.x,-zs.y,zs.x,0,-ks.y,ks.x,0,-Sr.y,Sr.x,0];return!Qd(t,_o,yo,vo,Nl)||(t=[1,0,0,0,1,0,0,0,1],!Qd(t,_o,yo,vo,Nl))?!1:(El.crossVectors(zs,ks),t=[El.x,El.y,El.z],Qd(t,_o,yo,vo,Nl))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(qi).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Ts[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ts[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ts[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ts[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ts[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ts[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ts[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ts[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ts),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Ts=[new E,new E,new E,new E,new E,new E,new E,new E],qi=new E,Al=new Wn,_o=new E,yo=new E,vo=new E,zs=new E,ks=new E,Sr=new E,Ia=new E,Nl=new E,El=new E,Tr=new E;function Qd(s,e,t,n,i){for(let r=0,o=s.length-3;r<=o;r+=3){Tr.fromArray(s,r);const a=i.x*Math.abs(Tr.x)+i.y*Math.abs(Tr.y)+i.z*Math.abs(Tr.z),c=e.dot(Tr),l=t.dot(Tr),u=n.dot(Tr);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>a)return!1}return!0}const XA=new Wn,Pa=new E,ep=new E;class Dn{constructor(e=new E,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):XA.setFromPoints(e).getCenter(n);let i=0;for(let r=0,o=e.length;r<o;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Pa.subVectors(e,this.center);const t=Pa.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Pa,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(ep.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Pa.copy(e.center).add(ep)),this.expandByPoint(Pa.copy(e.center).sub(ep))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const bs=new E,tp=new E,Cl=new E,Gs=new E,np=new E,Rl=new E,ip=new E;class so{constructor(e=new E,t=new E(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,bs)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=bs.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(bs.copy(this.origin).addScaledVector(this.direction,t),bs.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){tp.copy(e).add(t).multiplyScalar(.5),Cl.copy(t).sub(e).normalize(),Gs.copy(this.origin).sub(tp);const r=e.distanceTo(t)*.5,o=-this.direction.dot(Cl),a=Gs.dot(this.direction),c=-Gs.dot(Cl),l=Gs.lengthSq(),u=Math.abs(1-o*o);let h,d,p,f;if(u>0)if(h=o*c-a,d=o*a-c,f=r*u,h>=0)if(d>=-f)if(d<=f){const x=1/u;h*=x,d*=x,p=h*(h+o*d+2*a)+d*(o*h+d+2*c)+l}else d=r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*c)+l;else d=-r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*c)+l;else d<=-f?(h=Math.max(0,-(-o*r+a)),d=h>0?-r:Math.min(Math.max(-r,-c),r),p=-h*h+d*(d+2*c)+l):d<=f?(h=0,d=Math.min(Math.max(-r,-c),r),p=d*(d+2*c)+l):(h=Math.max(0,-(o*r+a)),d=h>0?r:Math.min(Math.max(-r,-c),r),p=-h*h+d*(d+2*c)+l);else d=o>0?-r:r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(tp).addScaledVector(Cl,d),p}intersectSphere(e,t){bs.subVectors(e.center,this.origin);const n=bs.dot(this.direction),i=bs.dot(bs)-n*n,r=e.radius*e.radius;if(i>r)return null;const o=Math.sqrt(r-i),a=n-o,c=n+o;return c<0?null:a<0?this.at(c,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,o,a,c;const l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),u>=0?(r=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(r=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||r>i||((r>n||isNaN(n))&&(n=r),(o<i||isNaN(i))&&(i=o),h>=0?(a=(e.min.z-d.z)*h,c=(e.max.z-d.z)*h):(a=(e.max.z-d.z)*h,c=(e.min.z-d.z)*h),n>c||a>i)||((a>n||n!==n)&&(n=a),(c<i||i!==i)&&(i=c),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,bs)!==null}intersectTriangle(e,t,n,i,r){np.subVectors(t,e),Rl.subVectors(n,e),ip.crossVectors(np,Rl);let o=this.direction.dot(ip),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Gs.subVectors(this.origin,e);const c=a*this.direction.dot(Rl.crossVectors(Gs,Rl));if(c<0)return null;const l=a*this.direction.dot(np.cross(Gs));if(l<0||c+l>o)return null;const u=-a*Gs.dot(ip);return u<0?null:this.at(u/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Fe{constructor(e,t,n,i,r,o,a,c,l,u,h,d,p,f,x,m){Fe.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,o,a,c,l,u,h,d,p,f,x,m)}set(e,t,n,i,r,o,a,c,l,u,h,d,p,f,x,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=a,g[13]=c,g[2]=l,g[6]=u,g[10]=h,g[14]=d,g[3]=p,g[7]=f,g[11]=x,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Fe().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Mo.setFromMatrixColumn(e,0).length(),r=1/Mo.setFromMatrixColumn(e,1).length(),o=1/Mo.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,o=Math.cos(n),a=Math.sin(n),c=Math.cos(i),l=Math.sin(i),u=Math.cos(r),h=Math.sin(r);if(e.order==="XYZ"){const d=o*u,p=o*h,f=a*u,x=a*h;t[0]=c*u,t[4]=-c*h,t[8]=l,t[1]=p+f*l,t[5]=d-x*l,t[9]=-a*c,t[2]=x-d*l,t[6]=f+p*l,t[10]=o*c}else if(e.order==="YXZ"){const d=c*u,p=c*h,f=l*u,x=l*h;t[0]=d+x*a,t[4]=f*a-p,t[8]=o*l,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=p*a-f,t[6]=x+d*a,t[10]=o*c}else if(e.order==="ZXY"){const d=c*u,p=c*h,f=l*u,x=l*h;t[0]=d-x*a,t[4]=-o*h,t[8]=f+p*a,t[1]=p+f*a,t[5]=o*u,t[9]=x-d*a,t[2]=-o*l,t[6]=a,t[10]=o*c}else if(e.order==="ZYX"){const d=o*u,p=o*h,f=a*u,x=a*h;t[0]=c*u,t[4]=f*l-p,t[8]=d*l+x,t[1]=c*h,t[5]=x*l+d,t[9]=p*l-f,t[2]=-l,t[6]=a*c,t[10]=o*c}else if(e.order==="YZX"){const d=o*c,p=o*l,f=a*c,x=a*l;t[0]=c*u,t[4]=x-d*h,t[8]=f*h+p,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-l*u,t[6]=p*h+f,t[10]=d-x*h}else if(e.order==="XZY"){const d=o*c,p=o*l,f=a*c,x=a*l;t[0]=c*u,t[4]=-h,t[8]=l*u,t[1]=d*h+x,t[5]=o*u,t[9]=p*h-f,t[2]=f*h-p,t[6]=a*u,t[10]=x*h+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(qA,e,$A)}lookAt(e,t,n){const i=this.elements;return gi.subVectors(e,t),gi.lengthSq()===0&&(gi.z=1),gi.normalize(),Hs.crossVectors(n,gi),Hs.lengthSq()===0&&(Math.abs(n.z)===1?gi.x+=1e-4:gi.z+=1e-4,gi.normalize(),Hs.crossVectors(n,gi)),Hs.normalize(),Il.crossVectors(gi,Hs),i[0]=Hs.x,i[4]=Il.x,i[8]=gi.x,i[1]=Hs.y,i[5]=Il.y,i[9]=gi.y,i[2]=Hs.z,i[6]=Il.z,i[10]=gi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[4],c=n[8],l=n[12],u=n[1],h=n[5],d=n[9],p=n[13],f=n[2],x=n[6],m=n[10],g=n[14],y=n[3],_=n[7],v=n[11],I=n[15],T=i[0],w=i[4],C=i[8],F=i[12],M=i[1],b=i[5],G=i[9],W=i[13],$=i[2],ie=i[6],q=i[10],he=i[14],Q=i[3],we=i[7],Ne=i[11],Ee=i[15];return r[0]=o*T+a*M+c*$+l*Q,r[4]=o*w+a*b+c*ie+l*we,r[8]=o*C+a*G+c*q+l*Ne,r[12]=o*F+a*W+c*he+l*Ee,r[1]=u*T+h*M+d*$+p*Q,r[5]=u*w+h*b+d*ie+p*we,r[9]=u*C+h*G+d*q+p*Ne,r[13]=u*F+h*W+d*he+p*Ee,r[2]=f*T+x*M+m*$+g*Q,r[6]=f*w+x*b+m*ie+g*we,r[10]=f*C+x*G+m*q+g*Ne,r[14]=f*F+x*W+m*he+g*Ee,r[3]=y*T+_*M+v*$+I*Q,r[7]=y*w+_*b+v*ie+I*we,r[11]=y*C+_*G+v*q+I*Ne,r[15]=y*F+_*W+v*he+I*Ee,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],o=e[1],a=e[5],c=e[9],l=e[13],u=e[2],h=e[6],d=e[10],p=e[14],f=e[3],x=e[7],m=e[11],g=e[15];return f*(+r*c*h-i*l*h-r*a*d+n*l*d+i*a*p-n*c*p)+x*(+t*c*p-t*l*d+r*o*d-i*o*p+i*l*u-r*c*u)+m*(+t*l*h-t*a*p-r*o*h+n*o*p+r*a*u-n*l*u)+g*(-i*a*u-t*c*h+t*a*d+i*o*h-n*o*d+n*c*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],d=e[10],p=e[11],f=e[12],x=e[13],m=e[14],g=e[15],y=h*m*l-x*d*l+x*c*p-a*m*p-h*c*g+a*d*g,_=f*d*l-u*m*l-f*c*p+o*m*p+u*c*g-o*d*g,v=u*x*l-f*h*l+f*a*p-o*x*p-u*a*g+o*h*g,I=f*h*c-u*x*c-f*a*d+o*x*d+u*a*m-o*h*m,T=t*y+n*_+i*v+r*I;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/T;return e[0]=y*w,e[1]=(x*d*r-h*m*r-x*i*p+n*m*p+h*i*g-n*d*g)*w,e[2]=(a*m*r-x*c*r+x*i*l-n*m*l-a*i*g+n*c*g)*w,e[3]=(h*c*r-a*d*r-h*i*l+n*d*l+a*i*p-n*c*p)*w,e[4]=_*w,e[5]=(u*m*r-f*d*r+f*i*p-t*m*p-u*i*g+t*d*g)*w,e[6]=(f*c*r-o*m*r-f*i*l+t*m*l+o*i*g-t*c*g)*w,e[7]=(o*d*r-u*c*r+u*i*l-t*d*l-o*i*p+t*c*p)*w,e[8]=v*w,e[9]=(f*h*r-u*x*r-f*n*p+t*x*p+u*n*g-t*h*g)*w,e[10]=(o*x*r-f*a*r+f*n*l-t*x*l-o*n*g+t*a*g)*w,e[11]=(u*a*r-o*h*r-u*n*l+t*h*l+o*n*p-t*a*p)*w,e[12]=I*w,e[13]=(u*x*i-f*h*i+f*n*d-t*x*d-u*n*m+t*h*m)*w,e[14]=(f*a*i-o*x*i-f*n*c+t*x*c+o*n*m-t*a*m)*w,e[15]=(o*h*i-u*a*i+u*n*c-t*h*c-o*n*d+t*a*d)*w,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,o=e.x,a=e.y,c=e.z,l=r*o,u=r*a;return this.set(l*o+n,l*a-i*c,l*c+i*a,0,l*a+i*c,u*a+n,u*c-i*o,0,l*c-i*a,u*c+i*o,r*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,o){return this.set(1,n,r,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,o=t._y,a=t._z,c=t._w,l=r+r,u=o+o,h=a+a,d=r*l,p=r*u,f=r*h,x=o*u,m=o*h,g=a*h,y=c*l,_=c*u,v=c*h,I=n.x,T=n.y,w=n.z;return i[0]=(1-(x+g))*I,i[1]=(p+v)*I,i[2]=(f-_)*I,i[3]=0,i[4]=(p-v)*T,i[5]=(1-(d+g))*T,i[6]=(m+y)*T,i[7]=0,i[8]=(f+_)*w,i[9]=(m-y)*w,i[10]=(1-(d+x))*w,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=Mo.set(i[0],i[1],i[2]).length();const o=Mo.set(i[4],i[5],i[6]).length(),a=Mo.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],$i.copy(this);const l=1/r,u=1/o,h=1/a;return $i.elements[0]*=l,$i.elements[1]*=l,$i.elements[2]*=l,$i.elements[4]*=u,$i.elements[5]*=u,$i.elements[6]*=u,$i.elements[8]*=h,$i.elements[9]*=h,$i.elements[10]*=h,t.setFromRotationMatrix($i),n.x=r,n.y=o,n.z=a,this}makePerspective(e,t,n,i,r,o,a=Di){const c=this.elements,l=2*r/(t-e),u=2*r/(n-i),h=(t+e)/(t-e),d=(n+i)/(n-i);let p,f;if(a===Di)p=-(o+r)/(o-r),f=-2*o*r/(o-r);else if(a===eo)p=-o/(o-r),f=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=l,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=u,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=f,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,r,o,a=Di){const c=this.elements,l=1/(t-e),u=1/(n-i),h=1/(o-r),d=(t+e)*l,p=(n+i)*u;let f,x;if(a===Di)f=(o+r)*h,x=-2*h;else if(a===eo)f=r*h,x=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=2*l,c[4]=0,c[8]=0,c[12]=-d,c[1]=0,c[5]=2*u,c[9]=0,c[13]=-p,c[2]=0,c[6]=0,c[10]=x,c[14]=-f,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Mo=new E,$i=new Fe,qA=new E(0,0,0),$A=new E(1,1,1),Hs=new E,Il=new E,gi=new E,N0=new Fe,E0=new Hn;class ui{constructor(e=0,t=0,n=0,i=ui.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],o=i[4],a=i[8],c=i[1],l=i[5],u=i[9],h=i[2],d=i[6],p=i[10];switch(t){case"XYZ":this._y=Math.asin(jt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-jt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(jt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-jt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(jt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-jt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return N0.makeRotationFromQuaternion(e),this.setFromRotationMatrix(N0,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return E0.setFromEuler(this),this.setFromQuaternion(E0,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ui.DEFAULT_ORDER="XYZ";class Yc{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let YA=0;const C0=new E,So=new Hn,ws=new Fe,Pl=new E,La=new E,ZA=new E,JA=new Hn,R0=new E(1,0,0),I0=new E(0,1,0),P0=new E(0,0,1),L0={type:"added"},KA={type:"removed"},To={type:"childadded",child:null},sp={type:"childremoved",child:null};class yt extends Ai{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:YA++}),this.uuid=bi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=yt.DEFAULT_UP.clone();const e=new E,t=new ui,n=new Hn,i=new E(1,1,1);function r(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Fe},normalMatrix:{value:new Ke}}),this.matrix=new Fe,this.matrixWorld=new Fe,this.matrixAutoUpdate=yt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=yt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Yc,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return So.setFromAxisAngle(e,t),this.quaternion.multiply(So),this}rotateOnWorldAxis(e,t){return So.setFromAxisAngle(e,t),this.quaternion.premultiply(So),this}rotateX(e){return this.rotateOnAxis(R0,e)}rotateY(e){return this.rotateOnAxis(I0,e)}rotateZ(e){return this.rotateOnAxis(P0,e)}translateOnAxis(e,t){return C0.copy(e).applyQuaternion(this.quaternion),this.position.add(C0.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(R0,e)}translateY(e){return this.translateOnAxis(I0,e)}translateZ(e){return this.translateOnAxis(P0,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ws.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Pl.copy(e):Pl.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),La.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ws.lookAt(La,Pl,this.up):ws.lookAt(Pl,La,this.up),this.quaternion.setFromRotationMatrix(ws),i&&(ws.extractRotation(i.matrixWorld),So.setFromRotationMatrix(ws),this.quaternion.premultiply(So.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(L0),To.child=e,this.dispatchEvent(To),To.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(KA),sp.child=e,this.dispatchEvent(sp),sp.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ws.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ws.multiply(e.parent.matrixWorld)),e.applyMatrix4(ws),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(L0),To.child=e,this.dispatchEvent(To),To.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,o=i.length;r<o;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(La,e,ZA),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(La,JA,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let r=0,o=i.length;r<o;r++)i[r].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function r(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const c=a.shapes;if(Array.isArray(c))for(let l=0,u=c.length;l<u;l++){const h=c[l];r(e.shapes,h)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let c=0,l=this.material.length;c<l;c++)a.push(r(e.materials,this.material[c]));i.material=a}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const c=this.animations[a];i.animations.push(r(e.animations,c))}}if(t){const a=o(e.geometries),c=o(e.materials),l=o(e.textures),u=o(e.images),h=o(e.shapes),d=o(e.skeletons),p=o(e.animations),f=o(e.nodes);a.length>0&&(n.geometries=a),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),d.length>0&&(n.skeletons=d),p.length>0&&(n.animations=p),f.length>0&&(n.nodes=f)}return n.object=i,n;function o(a){const c=[];for(const l in a){const u=a[l];delete u.metadata,c.push(u)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}yt.DEFAULT_UP=new E(0,1,0);yt.DEFAULT_MATRIX_AUTO_UPDATE=!0;yt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Yi=new E,As=new E,rp=new E,Ns=new E,bo=new E,wo=new E,D0=new E,op=new E,ap=new E,cp=new E,lp=new st,up=new st,hp=new st;class Jn{constructor(e=new E,t=new E,n=new E){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Yi.subVectors(e,t),i.cross(Yi);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Yi.subVectors(i,t),As.subVectors(n,t),rp.subVectors(e,t);const o=Yi.dot(Yi),a=Yi.dot(As),c=Yi.dot(rp),l=As.dot(As),u=As.dot(rp),h=o*l-a*a;if(h===0)return r.set(0,0,0),null;const d=1/h,p=(l*c-a*u)*d,f=(o*u-a*c)*d;return r.set(1-p-f,f,p)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Ns)===null?!1:Ns.x>=0&&Ns.y>=0&&Ns.x+Ns.y<=1}static getInterpolation(e,t,n,i,r,o,a,c){return this.getBarycoord(e,t,n,i,Ns)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(r,Ns.x),c.addScaledVector(o,Ns.y),c.addScaledVector(a,Ns.z),c)}static getInterpolatedAttribute(e,t,n,i,r,o){return lp.setScalar(0),up.setScalar(0),hp.setScalar(0),lp.fromBufferAttribute(e,t),up.fromBufferAttribute(e,n),hp.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(lp,r.x),o.addScaledVector(up,r.y),o.addScaledVector(hp,r.z),o}static isFrontFacing(e,t,n,i){return Yi.subVectors(n,t),As.subVectors(e,t),Yi.cross(As).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Yi.subVectors(this.c,this.b),As.subVectors(this.a,this.b),Yi.cross(As).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Jn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Jn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Jn.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Jn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Jn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let o,a;bo.subVectors(i,n),wo.subVectors(r,n),op.subVectors(e,n);const c=bo.dot(op),l=wo.dot(op);if(c<=0&&l<=0)return t.copy(n);ap.subVectors(e,i);const u=bo.dot(ap),h=wo.dot(ap);if(u>=0&&h<=u)return t.copy(i);const d=c*h-u*l;if(d<=0&&c>=0&&u<=0)return o=c/(c-u),t.copy(n).addScaledVector(bo,o);cp.subVectors(e,r);const p=bo.dot(cp),f=wo.dot(cp);if(f>=0&&p<=f)return t.copy(r);const x=p*l-c*f;if(x<=0&&l>=0&&f<=0)return a=l/(l-f),t.copy(n).addScaledVector(wo,a);const m=u*f-p*h;if(m<=0&&h-u>=0&&p-f>=0)return D0.subVectors(r,i),a=(h-u)/(h-u+(p-f)),t.copy(i).addScaledVector(D0,a);const g=1/(m+x+d);return o=x*g,a=d*g,t.copy(n).addScaledVector(bo,o).addScaledVector(wo,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Gy={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},Ws={h:0,s:0,l:0},Ll={h:0,s:0,l:0};function dp(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}class _e{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=kn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,gt.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=gt.workingColorSpace){return this.r=e,this.g=t,this.b=n,gt.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=gt.workingColorSpace){if(e=sm(e,1),t=jt(t,0,1),n=jt(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,o=2*n-r;this.r=dp(o,r,e+1/3),this.g=dp(o,r,e),this.b=dp(o,r,e-1/3)}return gt.toWorkingColorSpace(this,i),this}setStyle(e,t=kn){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=i[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=kn){const n=Gy[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Qo(e.r),this.g=Qo(e.g),this.b=Qo(e.b),this}copyLinearToSRGB(e){return this.r=Jd(e.r),this.g=Jd(e.g),this.b=Jd(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=kn){return gt.fromWorkingColorSpace(Bn.copy(this),e),Math.round(jt(Bn.r*255,0,255))*65536+Math.round(jt(Bn.g*255,0,255))*256+Math.round(jt(Bn.b*255,0,255))}getHexString(e=kn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=gt.workingColorSpace){gt.fromWorkingColorSpace(Bn.copy(this),t);const n=Bn.r,i=Bn.g,r=Bn.b,o=Math.max(n,i,r),a=Math.min(n,i,r);let c,l;const u=(a+o)/2;if(a===o)c=0,l=0;else{const h=o-a;switch(l=u<=.5?h/(o+a):h/(2-o-a),o){case n:c=(i-r)/h+(i<r?6:0);break;case i:c=(r-n)/h+2;break;case r:c=(n-i)/h+4;break}c/=6}return e.h=c,e.s=l,e.l=u,e}getRGB(e,t=gt.workingColorSpace){return gt.fromWorkingColorSpace(Bn.copy(this),t),e.r=Bn.r,e.g=Bn.g,e.b=Bn.b,e}getStyle(e=kn){gt.fromWorkingColorSpace(Bn.copy(this),e);const t=Bn.r,n=Bn.g,i=Bn.b;return e!==kn?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Ws),this.setHSL(Ws.h+e,Ws.s+t,Ws.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Ws),e.getHSL(Ll);const n=ja(Ws.h,Ll.h,t),i=ja(Ws.s,Ll.s,t),r=ja(Ws.l,Ll.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Bn=new _e;_e.NAMES=Gy;let jA=0;class mn extends Ai{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:jA++}),this.uuid=bi(),this.name="",this.type="Material",this.blending=Ls,this.side=gs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=zu,this.blendDst=ku,this.blendEquation=Js,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new _e(0,0,0),this.blendAlpha=0,this.depthFunc=ir,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=oh,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ys,this.stencilZFail=Ys,this.stencilZPass=Ys,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ls&&(n.blending=this.blending),this.side!==gs&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==zu&&(n.blendSrc=this.blendSrc),this.blendDst!==ku&&(n.blendDst=this.blendDst),this.blendEquation!==Js&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==ir&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==oh&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ys&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ys&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ys&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(r){const o=[];for(const a in r){const c=r[a];delete c.metadata,o.push(c)}return o}if(t){const r=i(e.textures),o=i(e.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class ss extends mn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new _e(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ui,this.combine=ma,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Rs=QA();function QA(){const s=new ArrayBuffer(4),e=new Float32Array(s),t=new Uint32Array(s),n=new Uint32Array(512),i=new Uint32Array(512);for(let c=0;c<256;++c){const l=c-127;l<-27?(n[c]=0,n[c|256]=32768,i[c]=24,i[c|256]=24):l<-14?(n[c]=1024>>-l-14,n[c|256]=1024>>-l-14|32768,i[c]=-l-1,i[c|256]=-l-1):l<=15?(n[c]=l+15<<10,n[c|256]=l+15<<10|32768,i[c]=13,i[c|256]=13):l<128?(n[c]=31744,n[c|256]=64512,i[c]=24,i[c|256]=24):(n[c]=31744,n[c|256]=64512,i[c]=13,i[c|256]=13)}const r=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let c=1;c<1024;++c){let l=c<<13,u=0;for(;(l&8388608)===0;)l<<=1,u-=8388608;l&=-8388609,u+=947912704,r[c]=l|u}for(let c=1024;c<2048;++c)r[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)o[c]=c<<23;o[31]=1199570944,o[32]=2147483648;for(let c=33;c<63;++c)o[c]=2147483648+(c-32<<23);o[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(a[c]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:r,exponentTable:o,offsetTable:a}}function si(s){Math.abs(s)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),s=jt(s,-65504,65504),Rs.floatView[0]=s;const e=Rs.uint32View[0],t=e>>23&511;return Rs.baseTable[t]+((e&8388607)>>Rs.shiftTable[t])}function Ja(s){const e=s>>10;return Rs.uint32View[0]=Rs.mantissaTable[Rs.offsetTable[e]+(s&1023)]+Rs.exponentTable[e],Rs.floatView[0]}const Hy={toHalfFloat:si,fromHalfFloat:Ja},an=new E,Dl=new J;class At{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ra,this.updateRanges=[],this.gpuType=Gn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Dl.fromBufferAttribute(this,t),Dl.applyMatrix3(e),this.setXY(t,Dl.x,Dl.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.applyMatrix3(e),this.setXYZ(t,an.x,an.y,an.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.applyMatrix4(e),this.setXYZ(t,an.x,an.y,an.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.applyNormalMatrix(e),this.setXYZ(t,an.x,an.y,an.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.transformDirection(e),this.setXYZ(t,an.x,an.y,an.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Zn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=ut(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Zn(t,this.array)),t}setX(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Zn(t,this.array)),t}setY(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Zn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Zn(t,this.array)),t}setW(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array),r=ut(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==ra&&(e.usage=this.usage),e}}class e1 extends At{constructor(e,t,n){super(new Int8Array(e),t,n)}}class t1 extends At{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class n1 extends At{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class i1 extends At{constructor(e,t,n){super(new Int16Array(e),t,n)}}class $h extends At{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class s1 extends At{constructor(e,t,n){super(new Int32Array(e),t,n)}}class rm extends At{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Wy extends At{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Ja(this.array[e*this.itemSize]);return this.normalized&&(t=Zn(t,this.array)),t}setX(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize]=si(t),this}getY(e){let t=Ja(this.array[e*this.itemSize+1]);return this.normalized&&(t=Zn(t,this.array)),t}setY(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize+1]=si(t),this}getZ(e){let t=Ja(this.array[e*this.itemSize+2]);return this.normalized&&(t=Zn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize+2]=si(t),this}getW(e){let t=Ja(this.array[e*this.itemSize+3]);return this.normalized&&(t=Zn(t,this.array)),t}setW(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize+3]=si(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array)),this.array[e+0]=si(t),this.array[e+1]=si(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array)),this.array[e+0]=si(t),this.array[e+1]=si(n),this.array[e+2]=si(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array),r=ut(r,this.array)),this.array[e+0]=si(t),this.array[e+1]=si(n),this.array[e+2]=si(i),this.array[e+3]=si(r),this}}class Ve extends At{constructor(e,t,n){super(new Float32Array(e),t,n)}}let r1=0;const Ei=new Fe,pp=new yt,Ao=new E,xi=new Wn,Da=new Wn,_n=new E;class at extends Ai{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:r1++}),this.uuid=bi(),this.name="",this.type="BufferGeometry",this.index=null,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(e){return Array.isArray(e)?this.index=new(By(e)?rm:$h)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const r=new Ke().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ei.makeRotationFromQuaternion(e),this.applyMatrix4(Ei),this}rotateX(e){return Ei.makeRotationX(e),this.applyMatrix4(Ei),this}rotateY(e){return Ei.makeRotationY(e),this.applyMatrix4(Ei),this}rotateZ(e){return Ei.makeRotationZ(e),this.applyMatrix4(Ei),this}translate(e,t,n){return Ei.makeTranslation(e,t,n),this.applyMatrix4(Ei),this}scale(e,t,n){return Ei.makeScale(e,t,n),this.applyMatrix4(Ei),this}lookAt(e){return pp.lookAt(e),pp.updateMatrix(),this.applyMatrix4(pp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ao).negate(),this.translate(Ao.x,Ao.y,Ao.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Ve(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Wn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new E(-1/0,-1/0,-1/0),new E(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const r=t[n];xi.setFromBufferAttribute(r),this.morphTargetsRelative?(_n.addVectors(this.boundingBox.min,xi.min),this.boundingBox.expandByPoint(_n),_n.addVectors(this.boundingBox.max,xi.max),this.boundingBox.expandByPoint(_n)):(this.boundingBox.expandByPoint(xi.min),this.boundingBox.expandByPoint(xi.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Dn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new E,1/0);return}if(e){const n=this.boundingSphere.center;if(xi.setFromBufferAttribute(e),t)for(let r=0,o=t.length;r<o;r++){const a=t[r];Da.setFromBufferAttribute(a),this.morphTargetsRelative?(_n.addVectors(xi.min,Da.min),xi.expandByPoint(_n),_n.addVectors(xi.max,Da.max),xi.expandByPoint(_n)):(xi.expandByPoint(Da.min),xi.expandByPoint(Da.max))}xi.getCenter(n);let i=0;for(let r=0,o=e.count;r<o;r++)_n.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(_n));if(t)for(let r=0,o=t.length;r<o;r++){const a=t[r],c=this.morphTargetsRelative;for(let l=0,u=a.count;l<u;l++)_n.fromBufferAttribute(a,l),c&&(Ao.fromBufferAttribute(e,l),_n.add(Ao)),i=Math.max(i,n.distanceToSquared(_n))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,r=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new At(new Float32Array(4*n.count),4));const o=this.getAttribute("tangent"),a=[],c=[];for(let C=0;C<n.count;C++)a[C]=new E,c[C]=new E;const l=new E,u=new E,h=new E,d=new J,p=new J,f=new J,x=new E,m=new E;function g(C,F,M){l.fromBufferAttribute(n,C),u.fromBufferAttribute(n,F),h.fromBufferAttribute(n,M),d.fromBufferAttribute(r,C),p.fromBufferAttribute(r,F),f.fromBufferAttribute(r,M),u.sub(l),h.sub(l),p.sub(d),f.sub(d);const b=1/(p.x*f.y-f.x*p.y);isFinite(b)&&(x.copy(u).multiplyScalar(f.y).addScaledVector(h,-p.y).multiplyScalar(b),m.copy(h).multiplyScalar(p.x).addScaledVector(u,-f.x).multiplyScalar(b),a[C].add(x),a[F].add(x),a[M].add(x),c[C].add(m),c[F].add(m),c[M].add(m))}let y=this.groups;y.length===0&&(y=[{start:0,count:e.count}]);for(let C=0,F=y.length;C<F;++C){const M=y[C],b=M.start,G=M.count;for(let W=b,$=b+G;W<$;W+=3)g(e.getX(W+0),e.getX(W+1),e.getX(W+2))}const _=new E,v=new E,I=new E,T=new E;function w(C){I.fromBufferAttribute(i,C),T.copy(I);const F=a[C];_.copy(F),_.sub(I.multiplyScalar(I.dot(F))).normalize(),v.crossVectors(T,F);const b=v.dot(c[C])<0?-1:1;o.setXYZW(C,_.x,_.y,_.z,b)}for(let C=0,F=y.length;C<F;++C){const M=y[C],b=M.start,G=M.count;for(let W=b,$=b+G;W<$;W+=3)w(e.getX(W+0)),w(e.getX(W+1)),w(e.getX(W+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new At(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,p=n.count;d<p;d++)n.setXYZ(d,0,0,0);const i=new E,r=new E,o=new E,a=new E,c=new E,l=new E,u=new E,h=new E;if(e)for(let d=0,p=e.count;d<p;d+=3){const f=e.getX(d+0),x=e.getX(d+1),m=e.getX(d+2);i.fromBufferAttribute(t,f),r.fromBufferAttribute(t,x),o.fromBufferAttribute(t,m),u.subVectors(o,r),h.subVectors(i,r),u.cross(h),a.fromBufferAttribute(n,f),c.fromBufferAttribute(n,x),l.fromBufferAttribute(n,m),a.add(u),c.add(u),l.add(u),n.setXYZ(f,a.x,a.y,a.z),n.setXYZ(x,c.x,c.y,c.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let d=0,p=t.count;d<p;d+=3)i.fromBufferAttribute(t,d+0),r.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),u.subVectors(o,r),h.subVectors(i,r),u.cross(h),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)_n.fromBufferAttribute(e,t),_n.normalize(),e.setXYZ(t,_n.x,_n.y,_n.z)}toNonIndexed(){function e(a,c){const l=a.array,u=a.itemSize,h=a.normalized,d=new l.constructor(c.length*u);let p=0,f=0;for(let x=0,m=c.length;x<m;x++){a.isInterleavedBufferAttribute?p=c[x]*a.data.stride+a.offset:p=c[x]*u;for(let g=0;g<u;g++)d[f++]=l[p++]}return new At(d,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new at,n=this.index.array,i=this.attributes;for(const a in i){const c=i[a],l=e(c,n);t.setAttribute(a,l)}const r=this.morphAttributes;for(const a in r){const c=[],l=r[a];for(let u=0,h=l.length;u<h;u++){const d=l[u],p=e(d,n);c.push(p)}t.morphAttributes[a]=c}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,c=o.length;a<c;a++){const l=o[a];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const i={};let r=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],u=[];for(let h=0,d=l.length;h<d;h++){const p=l[h];u.push(p.toJSON(e.data))}u.length>0&&(i[c]=u,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const l in i){const u=i[l];this.setAttribute(l,u.clone(t))}const r=e.morphAttributes;for(const l in r){const u=[],h=r[l];for(let d=0,p=h.length;d<p;d++)u.push(h[d].clone(t));this.morphAttributes[l]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let l=0,u=o.length;l<u;l++){const h=o[l];this.addGroup(h.start,h.count,h.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const U0=new Fe,br=new so,Ul=new Dn,F0=new E,Fl=new E,Ol=new E,Vl=new E,fp=new E,Bl=new E,O0=new E,zl=new E;class kt extends yt{constructor(e=new at,t=new ss){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(r&&a){Bl.set(0,0,0);for(let c=0,l=r.length;c<l;c++){const u=a[c],h=r[c];u!==0&&(fp.fromBufferAttribute(h,e),o?Bl.addScaledVector(fp,u):Bl.addScaledVector(fp.sub(t),u))}t.add(Bl)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Ul.copy(n.boundingSphere),Ul.applyMatrix4(r),br.copy(e.ray).recast(e.near),!(Ul.containsPoint(br.origin)===!1&&(br.intersectSphere(Ul,F0)===null||br.origin.distanceToSquared(F0)>(e.far-e.near)**2))&&(U0.copy(r).invert(),br.copy(e.ray).applyMatrix4(U0),!(n.boundingBox!==null&&br.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,br)))}_computeIntersections(e,t,n){let i;const r=this.geometry,o=this.material,a=r.index,c=r.attributes.position,l=r.attributes.uv,u=r.attributes.uv1,h=r.attributes.normal,d=r.groups,p=r.drawRange;if(a!==null)if(Array.isArray(o))for(let f=0,x=d.length;f<x;f++){const m=d[f],g=o[m.materialIndex],y=Math.max(m.start,p.start),_=Math.min(a.count,Math.min(m.start+m.count,p.start+p.count));for(let v=y,I=_;v<I;v+=3){const T=a.getX(v),w=a.getX(v+1),C=a.getX(v+2);i=kl(this,g,e,n,l,u,h,T,w,C),i&&(i.faceIndex=Math.floor(v/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const f=Math.max(0,p.start),x=Math.min(a.count,p.start+p.count);for(let m=f,g=x;m<g;m+=3){const y=a.getX(m),_=a.getX(m+1),v=a.getX(m+2);i=kl(this,o,e,n,l,u,h,y,_,v),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}else if(c!==void 0)if(Array.isArray(o))for(let f=0,x=d.length;f<x;f++){const m=d[f],g=o[m.materialIndex],y=Math.max(m.start,p.start),_=Math.min(c.count,Math.min(m.start+m.count,p.start+p.count));for(let v=y,I=_;v<I;v+=3){const T=v,w=v+1,C=v+2;i=kl(this,g,e,n,l,u,h,T,w,C),i&&(i.faceIndex=Math.floor(v/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const f=Math.max(0,p.start),x=Math.min(c.count,p.start+p.count);for(let m=f,g=x;m<g;m+=3){const y=m,_=m+1,v=m+2;i=kl(this,o,e,n,l,u,h,y,_,v),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}}}function o1(s,e,t,n,i,r,o,a){let c;if(e.side===ln?c=n.intersectTriangle(o,r,i,!0,a):c=n.intersectTriangle(i,r,o,e.side===gs,a),c===null)return null;zl.copy(a),zl.applyMatrix4(s.matrixWorld);const l=t.ray.origin.distanceTo(zl);return l<t.near||l>t.far?null:{distance:l,point:zl.clone(),object:s}}function kl(s,e,t,n,i,r,o,a,c,l){s.getVertexPosition(a,Fl),s.getVertexPosition(c,Ol),s.getVertexPosition(l,Vl);const u=o1(s,e,t,n,Fl,Ol,Vl,O0);if(u){const h=new E;Jn.getBarycoord(O0,Fl,Ol,Vl,h),i&&(u.uv=Jn.getInterpolatedAttribute(i,a,c,l,h,new J)),r&&(u.uv1=Jn.getInterpolatedAttribute(r,a,c,l,h,new J)),o&&(u.normal=Jn.getInterpolatedAttribute(o,a,c,l,h,new E),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const d={a,b:c,c:l,normal:new E,materialIndex:0};Jn.getNormal(Fl,Ol,Vl,d.normal),u.face=d,u.barycoord=h}return u}class vs extends at{constructor(e=1,t=1,n=1,i=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:o};const a=this;i=Math.floor(i),r=Math.floor(r),o=Math.floor(o);const c=[],l=[],u=[],h=[];let d=0,p=0;f("z","y","x",-1,-1,n,t,e,o,r,0),f("z","y","x",1,-1,n,t,-e,o,r,1),f("x","z","y",1,1,e,n,t,i,o,2),f("x","z","y",1,-1,e,n,-t,i,o,3),f("x","y","z",1,-1,e,t,n,i,r,4),f("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(c),this.setAttribute("position",new Ve(l,3)),this.setAttribute("normal",new Ve(u,3)),this.setAttribute("uv",new Ve(h,2));function f(x,m,g,y,_,v,I,T,w,C,F){const M=v/w,b=I/C,G=v/2,W=I/2,$=T/2,ie=w+1,q=C+1;let he=0,Q=0;const we=new E;for(let Ne=0;Ne<q;Ne++){const Ee=Ne*b-W;for(let Qe=0;Qe<ie;Qe++){const ht=Qe*M-G;we[x]=ht*y,we[m]=Ee*_,we[g]=$,l.push(we.x,we.y,we.z),we[x]=0,we[m]=0,we[g]=T>0?1:-1,u.push(we.x,we.y,we.z),h.push(Qe/w),h.push(1-Ne/C),he+=1}}for(let Ne=0;Ne<C;Ne++)for(let Ee=0;Ee<w;Ee++){const Qe=d+Ee+ie*Ne,ht=d+Ee+ie*(Ne+1),ne=d+(Ee+1)+ie*(Ne+1),ue=d+(Ee+1)+ie*Ne;c.push(Qe,ht,ue),c.push(ht,ne,ue),Q+=6}a.addGroup(p,Q,F),p+=Q,d+=he}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function aa(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Yn(s){const e={};for(let t=0;t<s.length;t++){const n=aa(s[t]);for(const i in n)e[i]=n[i]}return e}function a1(s){const e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function Xy(s){const e=s.getRenderTarget();return e===null?s.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:gt.workingColorSpace}const om={clone:aa,merge:Yn};var c1=`void main() {
|
|
1
|
+
"use strict";var go=typeof document<"u"?document.currentScript:null;const js="169.19",q_={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},$_={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Y_=0,af=1,Z_=2,rA=3,oA=0,Ff=1,Of=2,oi=3,gs=0,ln=1,Ji=2,Fi=0,Ls=1,lc=2,cf=3,lf=4,Vf=5,Js=100,J_=101,K_=102,j_=103,Bf=104,Q_=200,ey=201,ty=202,ny=203,zu=204,ku=205,iy=206,sy=207,ry=208,oy=209,ay=210,cy=211,ly=212,uy=213,hy=214,uc=0,hc=1,dc=2,ir=3,pc=4,fc=5,mc=6,gc=7,ma=0,zf=1,kf=2,Ti=0,Ch=1,Rh=2,Gf=3,Ih=4,dy=5,Ph=6,Lh=7,uf="attached",py="detached",Dh=300,wi=301,Vi=302,sr=303,rr=304,dr=306,or=1e3,Si=1001,ta=1002,Qt=1003,Uh=1004,fy=1004,Is=1005,aA=1005,Ut=1006,Qs=1007,cA=1007,Kn=1008,Hf=1008,es=1009,Wf=1010,Xf=1011,na=1012,ga=1013,Bi=1014,Gn=1015,Ln=1016,Fh=1017,Oh=1018,ar=1020,Vh=35902,Bh=35899,qf=1021,zh=1022,Rn=1023,$f=1024,Yf=1025,er=1026,cr=1027,Wc=1028,Xc=1029,ia=1030,kh=1031,lA=1032,Gh=1033,Yo=33776,Zo=33777,Jo=33778,Ko=33779,xc=35840,Gu=35841,_c=35842,Hu=35843,yc=36196,vc=37492,Mc=37496,Sc=37808,Wu=37809,Xu=37810,qu=37811,Tc=37812,$u=37813,Yu=37814,Zu=37815,Ju=37816,Ku=37817,ju=37818,Qu=37819,eh=37820,th=37821,jo=36492,nh=36494,bc=36495,Zf=36283,ih=36284,sh=36285,rh=36286,Jf=2200,Kf=2201,my=2202,sa=2300,wc=2301,Iu=2302,kr=2400,Gr=2401,Ac=2402,Hh=2500,jf=2501,gy=0,xy=1,_y=2,Qf=3200,em=3201,uA=3202,hA=3203,xs=0,tm=1,Li="",kn="srgb",li="srgb-linear",Wh="display-p3",qc="display-p3-linear",Nc="linear",Vt="srgb",Ec="rec709",Cc="p3",yy=0,Ys=7680,vy=7681,My=7682,Sy=7683,Ty=34055,by=34056,wy=5386,Ay=512,Ny=513,Ey=514,Cy=515,Ry=516,Iy=517,Py=518,oh=519,Ly=512,nm=513,Dy=514,im=515,Uy=516,Fy=517,Oy=518,Vy=519,ra=35044,Hr=35048,dA=35040,pA=35045,fA=35049,mA=35041,gA=35046,xA=35050,_A=35042,yA="100",ah="300 es",Di=2e3,eo=2001;class Ai{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let r=0,o=i.length;r<o;r++)i[r].call(this,e);e.target=null}}}const Vn=["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"];let S0=1234567;const Yr=Math.PI/180,oa=180/Math.PI;function bi(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Vn[s&255]+Vn[s>>8&255]+Vn[s>>16&255]+Vn[s>>24&255]+"-"+Vn[e&255]+Vn[e>>8&255]+"-"+Vn[e>>16&15|64]+Vn[e>>24&255]+"-"+Vn[t&63|128]+Vn[t>>8&255]+"-"+Vn[t>>16&255]+Vn[t>>24&255]+Vn[n&255]+Vn[n>>8&255]+Vn[n>>16&255]+Vn[n>>24&255]).toLowerCase()}function jt(s,e,t){return Math.max(e,Math.min(t,s))}function sm(s,e){return(s%e+e)%e}function vA(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function MA(s,e,t){return s!==e?(t-s)/(e-s):0}function ja(s,e,t){return(1-t)*s+t*e}function SA(s,e,t,n){return ja(s,e,1-Math.exp(-t*n))}function TA(s,e=1){return e-Math.abs(sm(s,e*2)-e)}function bA(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function wA(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function AA(s,e){return s+Math.floor(Math.random()*(e-s+1))}function NA(s,e){return s+Math.random()*(e-s)}function EA(s){return s*(.5-Math.random())}function CA(s){s!==void 0&&(S0=s);let e=S0+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function RA(s){return s*Yr}function IA(s){return s*oa}function PA(s){return(s&s-1)===0&&s!==0}function LA(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function DA(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function UA(s,e,t,n,i){const r=Math.cos,o=Math.sin,a=r(t/2),c=o(t/2),l=r((e+n)/2),u=o((e+n)/2),h=r((e-n)/2),d=o((e-n)/2),p=r((n-e)/2),f=o((n-e)/2);switch(i){case"XYX":s.set(a*u,c*h,c*d,a*l);break;case"YZY":s.set(c*d,a*u,c*h,a*l);break;case"ZXZ":s.set(c*h,c*d,a*u,a*l);break;case"XZX":s.set(a*u,c*f,c*p,a*l);break;case"YXY":s.set(c*p,a*u,c*f,a*l);break;case"ZYZ":s.set(c*f,c*p,a*u,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Zn(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function ut(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const Xh={DEG2RAD:Yr,RAD2DEG:oa,generateUUID:bi,clamp:jt,euclideanModulo:sm,mapLinear:vA,inverseLerp:MA,lerp:ja,damp:SA,pingpong:TA,smoothstep:bA,smootherstep:wA,randInt:AA,randFloat:NA,randFloatSpread:EA,seededRandom:CA,degToRad:RA,radToDeg:IA,isPowerOfTwo:PA,ceilPowerOfTwo:LA,floorPowerOfTwo:DA,setQuaternionFromProperEuler:UA,normalize:ut,denormalize:Zn};class J{constructor(e=0,t=0){J.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(jt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*n-o*i+e.x,this.y=r*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ke{constructor(e,t,n,i,r,o,a,c,l){Ke.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,o,a,c,l)}set(e,t,n,i,r,o,a,c,l){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=r,u[5]=c,u[6]=n,u[7]=o,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[3],c=n[6],l=n[1],u=n[4],h=n[7],d=n[2],p=n[5],f=n[8],x=i[0],m=i[3],g=i[6],y=i[1],_=i[4],v=i[7],I=i[2],T=i[5],w=i[8];return r[0]=o*x+a*y+c*I,r[3]=o*m+a*_+c*T,r[6]=o*g+a*v+c*w,r[1]=l*x+u*y+h*I,r[4]=l*m+u*_+h*T,r[7]=l*g+u*v+h*w,r[2]=d*x+p*y+f*I,r[5]=d*m+p*_+f*T,r[8]=d*g+p*v+f*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8];return t*o*u-t*a*l-n*r*u+n*a*c+i*r*l-i*o*c}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=u*o-a*l,d=a*c-u*r,p=l*r-o*c,f=t*h+n*d+i*p;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/f;return e[0]=h*x,e[1]=(i*l-u*n)*x,e[2]=(a*n-i*o)*x,e[3]=d*x,e[4]=(u*t-i*c)*x,e[5]=(i*r-a*t)*x,e[6]=p*x,e[7]=(n*c-l*t)*x,e[8]=(o*t-n*r)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,o,a){const c=Math.cos(r),l=Math.sin(r);return this.set(n*c,n*l,-n*(c*o+l*a)+o+e,-i*l,i*c,-i*(-l*o+c*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Zd.makeScale(e,t)),this}rotate(e){return this.premultiply(Zd.makeRotation(-e)),this}translate(e,t){return this.premultiply(Zd.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Zd=new Ke;function By(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}const FA={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Go(s,e){return new FA[s](e)}function Rc(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function zy(){const s=Rc("canvas");return s.style.display="block",s}const T0={};function Pu(s){s in T0||(T0[s]=!0,console.warn(s))}function OA(s,e,t){return new Promise(function(n,i){function r(){switch(s.clientWaitSync(e,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}function VA(s){const e=s.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function BA(s){const e=s.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const b0=new Ke().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),w0=new Ke().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Ra={[li]:{transfer:Nc,primaries:Ec,luminanceCoefficients:[.2126,.7152,.0722],toReference:s=>s,fromReference:s=>s},[kn]:{transfer:Vt,primaries:Ec,luminanceCoefficients:[.2126,.7152,.0722],toReference:s=>s.convertSRGBToLinear(),fromReference:s=>s.convertLinearToSRGB()},[qc]:{transfer:Nc,primaries:Cc,luminanceCoefficients:[.2289,.6917,.0793],toReference:s=>s.applyMatrix3(w0),fromReference:s=>s.applyMatrix3(b0)},[Wh]:{transfer:Vt,primaries:Cc,luminanceCoefficients:[.2289,.6917,.0793],toReference:s=>s.convertSRGBToLinear().applyMatrix3(w0),fromReference:s=>s.applyMatrix3(b0).convertLinearToSRGB()}},zA=new Set([li,qc]),gt={enabled:!0,_workingColorSpace:li,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(s){if(!zA.has(s))throw new Error(`Unsupported working color space, "${s}".`);this._workingColorSpace=s},convert:function(s,e,t){if(this.enabled===!1||e===t||!e||!t)return s;const n=Ra[e].toReference,i=Ra[t].fromReference;return i(n(s))},fromWorkingColorSpace:function(s,e){return this.convert(s,this._workingColorSpace,e)},toWorkingColorSpace:function(s,e){return this.convert(s,e,this._workingColorSpace)},getPrimaries:function(s){return Ra[s].primaries},getTransfer:function(s){return s===Li?Nc:Ra[s].transfer},getLuminanceCoefficients:function(s,e=this._workingColorSpace){return s.fromArray(Ra[e].luminanceCoefficients)}};function Qo(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function Jd(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}let xo;class ky{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{xo===void 0&&(xo=Rc("canvas")),xo.width=e.width,xo.height=e.height;const n=xo.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=xo}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Rc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let o=0;o<r.length;o++)r[o]=Qo(r[o]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Qo(t[n]/255)*255):t[n]=Qo(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let kA=0;class Ks{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:kA++}),this.uuid=bi(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?r.push(Kd(i[o].image)):r.push(Kd(i[o]))}else r=Kd(i);n.url=r}return t||(e.images[this.uuid]=n),n}}function Kd(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?ky.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let GA=0;class Xt extends Ai{constructor(e=Xt.DEFAULT_IMAGE,t=Xt.DEFAULT_MAPPING,n=Si,i=Si,r=Ut,o=Kn,a=Rn,c=es,l=Xt.DEFAULT_ANISOTROPY,u=Li){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:GA++}),this.uuid=bi(),this.name="",this.source=new Ks(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=c,this.offset=new J(0,0),this.repeat=new J(1,1),this.center=new J(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ke,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Dh)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case or:e.x=e.x-Math.floor(e.x);break;case Si:e.x=e.x<0?0:1;break;case ta:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case or:e.y=e.y-Math.floor(e.y);break;case Si:e.y=e.y<0?0:1;break;case ta:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Xt.DEFAULT_IMAGE=null;Xt.DEFAULT_MAPPING=Dh;Xt.DEFAULT_ANISOTROPY=4;class st{constructor(e=0,t=0,n=0,i=1){st.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const c=e.elements,l=c[0],u=c[4],h=c[8],d=c[1],p=c[5],f=c[9],x=c[2],m=c[6],g=c[10];if(Math.abs(u-d)<.01&&Math.abs(h-x)<.01&&Math.abs(f-m)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+x)<.1&&Math.abs(f+m)<.1&&Math.abs(l+p+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const _=(l+1)/2,v=(p+1)/2,I=(g+1)/2,T=(u+d)/4,w=(h+x)/4,C=(f+m)/4;return _>v&&_>I?_<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(_),i=T/n,r=w/n):v>I?v<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(v),n=T/i,r=C/i):I<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(I),n=w/r,i=C/r),this.set(n,i,r,t),this}let y=Math.sqrt((m-f)*(m-f)+(h-x)*(h-x)+(d-u)*(d-u));return Math.abs(y)<.001&&(y=1),this.x=(m-f)/y,this.y=(h-x)/y,this.z=(d-u)/y,this.w=Math.acos((l+p+g-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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 fn extends Ai{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new st(0,0,e,t),this.scissorTest=!1,this.viewport=new st(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ut,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new Xt(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const o=n.count;for(let a=0;a<o;a++)this.textures[a]=r.clone(),this.textures[a].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,i=e.textures.length;n<i;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Ks(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class zi extends fn{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class $c extends Xt{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Qt,this.minFilter=Qt,this.wrapR=Si,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class HA extends zi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new $c(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class qh extends Xt{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Qt,this.minFilter=Qt,this.wrapR=Si,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class WA extends zi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new qh(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Hn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,o,a){let c=n[i+0],l=n[i+1],u=n[i+2],h=n[i+3];const d=r[o+0],p=r[o+1],f=r[o+2],x=r[o+3];if(a===0){e[t+0]=c,e[t+1]=l,e[t+2]=u,e[t+3]=h;return}if(a===1){e[t+0]=d,e[t+1]=p,e[t+2]=f,e[t+3]=x;return}if(h!==x||c!==d||l!==p||u!==f){let m=1-a;const g=c*d+l*p+u*f+h*x,y=g>=0?1:-1,_=1-g*g;if(_>Number.EPSILON){const I=Math.sqrt(_),T=Math.atan2(I,g*y);m=Math.sin(m*T)/I,a=Math.sin(a*T)/I}const v=a*y;if(c=c*m+d*v,l=l*m+p*v,u=u*m+f*v,h=h*m+x*v,m===1-a){const I=1/Math.sqrt(c*c+l*l+u*u+h*h);c*=I,l*=I,u*=I,h*=I}}e[t]=c,e[t+1]=l,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,o){const a=n[i],c=n[i+1],l=n[i+2],u=n[i+3],h=r[o],d=r[o+1],p=r[o+2],f=r[o+3];return e[t]=a*f+u*h+c*p-l*d,e[t+1]=c*f+u*d+l*h-a*p,e[t+2]=l*f+u*p+a*d-c*h,e[t+3]=u*f-a*h-c*d-l*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,r=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(n/2),u=a(i/2),h=a(r/2),d=c(n/2),p=c(i/2),f=c(r/2);switch(o){case"XYZ":this._x=d*u*h+l*p*f,this._y=l*p*h-d*u*f,this._z=l*u*f+d*p*h,this._w=l*u*h-d*p*f;break;case"YXZ":this._x=d*u*h+l*p*f,this._y=l*p*h-d*u*f,this._z=l*u*f-d*p*h,this._w=l*u*h+d*p*f;break;case"ZXY":this._x=d*u*h-l*p*f,this._y=l*p*h+d*u*f,this._z=l*u*f+d*p*h,this._w=l*u*h-d*p*f;break;case"ZYX":this._x=d*u*h-l*p*f,this._y=l*p*h+d*u*f,this._z=l*u*f-d*p*h,this._w=l*u*h+d*p*f;break;case"YZX":this._x=d*u*h+l*p*f,this._y=l*p*h+d*u*f,this._z=l*u*f-d*p*h,this._w=l*u*h-d*p*f;break;case"XZY":this._x=d*u*h-l*p*f,this._y=l*p*h-d*u*f,this._z=l*u*f+d*p*h,this._w=l*u*h+d*p*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],o=t[1],a=t[5],c=t[9],l=t[2],u=t[6],h=t[10],d=n+a+h;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(u-c)*p,this._y=(r-l)*p,this._z=(o-i)*p}else if(n>a&&n>h){const p=2*Math.sqrt(1+n-a-h);this._w=(u-c)/p,this._x=.25*p,this._y=(i+o)/p,this._z=(r+l)/p}else if(a>h){const p=2*Math.sqrt(1+a-n-h);this._w=(r-l)/p,this._x=(i+o)/p,this._y=.25*p,this._z=(c+u)/p}else{const p=2*Math.sqrt(1+h-n-a);this._w=(o-i)/p,this._x=(r+l)/p,this._y=(c+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(jt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,o=e._w,a=t._x,c=t._y,l=t._z,u=t._w;return this._x=n*u+o*a+i*l-r*c,this._y=i*u+o*c+r*a-n*l,this._z=r*u+o*l+n*c-i*a,this._w=o*u-n*a-i*c-r*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,r=this._z,o=this._w;let a=o*e._w+n*e._x+i*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;const c=1-a*a;if(c<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*n+t*this._x,this._y=p*i+t*this._y,this._z=p*r+t*this._z,this.normalize(),this}const l=Math.sqrt(c),u=Math.atan2(l,a),h=Math.sin((1-t)*u)/l,d=Math.sin(t*u)/l;return this._w=o*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class E{constructor(e=0,t=0,n=0){E.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(A0.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(A0.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,o=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,o=e.y,a=e.z,c=e.w,l=2*(o*i-a*n),u=2*(a*t-r*i),h=2*(r*n-o*t);return this.x=t+c*l+o*h-a*u,this.y=n+c*u+a*l-r*h,this.z=i+c*h+r*u-o*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,o=t.x,a=t.y,c=t.z;return this.x=i*c-r*a,this.y=r*o-n*c,this.z=n*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return jd.copy(this).projectOnVector(e),this.sub(jd)}reflect(e){return this.sub(jd.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(jt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const jd=new E,A0=new Hn;class Wn{constructor(e=new E(1/0,1/0,1/0),t=new E(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(qi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(qi.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=qi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=r.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,qi):qi.fromBufferAttribute(r,o),qi.applyMatrix4(e.matrixWorld),this.expandByPoint(qi);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Al.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Al.copy(n.boundingBox)),Al.applyMatrix4(e.matrixWorld),this.union(Al)}const i=e.children;for(let r=0,o=i.length;r<o;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,qi),qi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ia),Nl.subVectors(this.max,Ia),_o.subVectors(e.a,Ia),yo.subVectors(e.b,Ia),vo.subVectors(e.c,Ia),zs.subVectors(yo,_o),ks.subVectors(vo,yo),Sr.subVectors(_o,vo);let t=[0,-zs.z,zs.y,0,-ks.z,ks.y,0,-Sr.z,Sr.y,zs.z,0,-zs.x,ks.z,0,-ks.x,Sr.z,0,-Sr.x,-zs.y,zs.x,0,-ks.y,ks.x,0,-Sr.y,Sr.x,0];return!Qd(t,_o,yo,vo,Nl)||(t=[1,0,0,0,1,0,0,0,1],!Qd(t,_o,yo,vo,Nl))?!1:(El.crossVectors(zs,ks),t=[El.x,El.y,El.z],Qd(t,_o,yo,vo,Nl))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(qi).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Ts[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ts[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ts[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ts[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ts[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ts[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ts[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ts[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ts),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Ts=[new E,new E,new E,new E,new E,new E,new E,new E],qi=new E,Al=new Wn,_o=new E,yo=new E,vo=new E,zs=new E,ks=new E,Sr=new E,Ia=new E,Nl=new E,El=new E,Tr=new E;function Qd(s,e,t,n,i){for(let r=0,o=s.length-3;r<=o;r+=3){Tr.fromArray(s,r);const a=i.x*Math.abs(Tr.x)+i.y*Math.abs(Tr.y)+i.z*Math.abs(Tr.z),c=e.dot(Tr),l=t.dot(Tr),u=n.dot(Tr);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>a)return!1}return!0}const XA=new Wn,Pa=new E,ep=new E;class Dn{constructor(e=new E,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):XA.setFromPoints(e).getCenter(n);let i=0;for(let r=0,o=e.length;r<o;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Pa.subVectors(e,this.center);const t=Pa.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Pa,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(ep.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Pa.copy(e.center).add(ep)),this.expandByPoint(Pa.copy(e.center).sub(ep))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const bs=new E,tp=new E,Cl=new E,Gs=new E,np=new E,Rl=new E,ip=new E;class so{constructor(e=new E,t=new E(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,bs)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=bs.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(bs.copy(this.origin).addScaledVector(this.direction,t),bs.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){tp.copy(e).add(t).multiplyScalar(.5),Cl.copy(t).sub(e).normalize(),Gs.copy(this.origin).sub(tp);const r=e.distanceTo(t)*.5,o=-this.direction.dot(Cl),a=Gs.dot(this.direction),c=-Gs.dot(Cl),l=Gs.lengthSq(),u=Math.abs(1-o*o);let h,d,p,f;if(u>0)if(h=o*c-a,d=o*a-c,f=r*u,h>=0)if(d>=-f)if(d<=f){const x=1/u;h*=x,d*=x,p=h*(h+o*d+2*a)+d*(o*h+d+2*c)+l}else d=r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*c)+l;else d=-r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*c)+l;else d<=-f?(h=Math.max(0,-(-o*r+a)),d=h>0?-r:Math.min(Math.max(-r,-c),r),p=-h*h+d*(d+2*c)+l):d<=f?(h=0,d=Math.min(Math.max(-r,-c),r),p=d*(d+2*c)+l):(h=Math.max(0,-(o*r+a)),d=h>0?r:Math.min(Math.max(-r,-c),r),p=-h*h+d*(d+2*c)+l);else d=o>0?-r:r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(tp).addScaledVector(Cl,d),p}intersectSphere(e,t){bs.subVectors(e.center,this.origin);const n=bs.dot(this.direction),i=bs.dot(bs)-n*n,r=e.radius*e.radius;if(i>r)return null;const o=Math.sqrt(r-i),a=n-o,c=n+o;return c<0?null:a<0?this.at(c,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,o,a,c;const l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),u>=0?(r=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(r=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||r>i||((r>n||isNaN(n))&&(n=r),(o<i||isNaN(i))&&(i=o),h>=0?(a=(e.min.z-d.z)*h,c=(e.max.z-d.z)*h):(a=(e.max.z-d.z)*h,c=(e.min.z-d.z)*h),n>c||a>i)||((a>n||n!==n)&&(n=a),(c<i||i!==i)&&(i=c),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,bs)!==null}intersectTriangle(e,t,n,i,r){np.subVectors(t,e),Rl.subVectors(n,e),ip.crossVectors(np,Rl);let o=this.direction.dot(ip),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Gs.subVectors(this.origin,e);const c=a*this.direction.dot(Rl.crossVectors(Gs,Rl));if(c<0)return null;const l=a*this.direction.dot(np.cross(Gs));if(l<0||c+l>o)return null;const u=-a*Gs.dot(ip);return u<0?null:this.at(u/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Fe{constructor(e,t,n,i,r,o,a,c,l,u,h,d,p,f,x,m){Fe.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,o,a,c,l,u,h,d,p,f,x,m)}set(e,t,n,i,r,o,a,c,l,u,h,d,p,f,x,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=a,g[13]=c,g[2]=l,g[6]=u,g[10]=h,g[14]=d,g[3]=p,g[7]=f,g[11]=x,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Fe().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Mo.setFromMatrixColumn(e,0).length(),r=1/Mo.setFromMatrixColumn(e,1).length(),o=1/Mo.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,o=Math.cos(n),a=Math.sin(n),c=Math.cos(i),l=Math.sin(i),u=Math.cos(r),h=Math.sin(r);if(e.order==="XYZ"){const d=o*u,p=o*h,f=a*u,x=a*h;t[0]=c*u,t[4]=-c*h,t[8]=l,t[1]=p+f*l,t[5]=d-x*l,t[9]=-a*c,t[2]=x-d*l,t[6]=f+p*l,t[10]=o*c}else if(e.order==="YXZ"){const d=c*u,p=c*h,f=l*u,x=l*h;t[0]=d+x*a,t[4]=f*a-p,t[8]=o*l,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=p*a-f,t[6]=x+d*a,t[10]=o*c}else if(e.order==="ZXY"){const d=c*u,p=c*h,f=l*u,x=l*h;t[0]=d-x*a,t[4]=-o*h,t[8]=f+p*a,t[1]=p+f*a,t[5]=o*u,t[9]=x-d*a,t[2]=-o*l,t[6]=a,t[10]=o*c}else if(e.order==="ZYX"){const d=o*u,p=o*h,f=a*u,x=a*h;t[0]=c*u,t[4]=f*l-p,t[8]=d*l+x,t[1]=c*h,t[5]=x*l+d,t[9]=p*l-f,t[2]=-l,t[6]=a*c,t[10]=o*c}else if(e.order==="YZX"){const d=o*c,p=o*l,f=a*c,x=a*l;t[0]=c*u,t[4]=x-d*h,t[8]=f*h+p,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-l*u,t[6]=p*h+f,t[10]=d-x*h}else if(e.order==="XZY"){const d=o*c,p=o*l,f=a*c,x=a*l;t[0]=c*u,t[4]=-h,t[8]=l*u,t[1]=d*h+x,t[5]=o*u,t[9]=p*h-f,t[2]=f*h-p,t[6]=a*u,t[10]=x*h+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(qA,e,$A)}lookAt(e,t,n){const i=this.elements;return gi.subVectors(e,t),gi.lengthSq()===0&&(gi.z=1),gi.normalize(),Hs.crossVectors(n,gi),Hs.lengthSq()===0&&(Math.abs(n.z)===1?gi.x+=1e-4:gi.z+=1e-4,gi.normalize(),Hs.crossVectors(n,gi)),Hs.normalize(),Il.crossVectors(gi,Hs),i[0]=Hs.x,i[4]=Il.x,i[8]=gi.x,i[1]=Hs.y,i[5]=Il.y,i[9]=gi.y,i[2]=Hs.z,i[6]=Il.z,i[10]=gi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[4],c=n[8],l=n[12],u=n[1],h=n[5],d=n[9],p=n[13],f=n[2],x=n[6],m=n[10],g=n[14],y=n[3],_=n[7],v=n[11],I=n[15],T=i[0],w=i[4],C=i[8],F=i[12],M=i[1],b=i[5],G=i[9],W=i[13],$=i[2],ie=i[6],q=i[10],he=i[14],Q=i[3],we=i[7],Ne=i[11],Ee=i[15];return r[0]=o*T+a*M+c*$+l*Q,r[4]=o*w+a*b+c*ie+l*we,r[8]=o*C+a*G+c*q+l*Ne,r[12]=o*F+a*W+c*he+l*Ee,r[1]=u*T+h*M+d*$+p*Q,r[5]=u*w+h*b+d*ie+p*we,r[9]=u*C+h*G+d*q+p*Ne,r[13]=u*F+h*W+d*he+p*Ee,r[2]=f*T+x*M+m*$+g*Q,r[6]=f*w+x*b+m*ie+g*we,r[10]=f*C+x*G+m*q+g*Ne,r[14]=f*F+x*W+m*he+g*Ee,r[3]=y*T+_*M+v*$+I*Q,r[7]=y*w+_*b+v*ie+I*we,r[11]=y*C+_*G+v*q+I*Ne,r[15]=y*F+_*W+v*he+I*Ee,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],o=e[1],a=e[5],c=e[9],l=e[13],u=e[2],h=e[6],d=e[10],p=e[14],f=e[3],x=e[7],m=e[11],g=e[15];return f*(+r*c*h-i*l*h-r*a*d+n*l*d+i*a*p-n*c*p)+x*(+t*c*p-t*l*d+r*o*d-i*o*p+i*l*u-r*c*u)+m*(+t*l*h-t*a*p-r*o*h+n*o*p+r*a*u-n*l*u)+g*(-i*a*u-t*c*h+t*a*d+i*o*h-n*o*d+n*c*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],d=e[10],p=e[11],f=e[12],x=e[13],m=e[14],g=e[15],y=h*m*l-x*d*l+x*c*p-a*m*p-h*c*g+a*d*g,_=f*d*l-u*m*l-f*c*p+o*m*p+u*c*g-o*d*g,v=u*x*l-f*h*l+f*a*p-o*x*p-u*a*g+o*h*g,I=f*h*c-u*x*c-f*a*d+o*x*d+u*a*m-o*h*m,T=t*y+n*_+i*v+r*I;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/T;return e[0]=y*w,e[1]=(x*d*r-h*m*r-x*i*p+n*m*p+h*i*g-n*d*g)*w,e[2]=(a*m*r-x*c*r+x*i*l-n*m*l-a*i*g+n*c*g)*w,e[3]=(h*c*r-a*d*r-h*i*l+n*d*l+a*i*p-n*c*p)*w,e[4]=_*w,e[5]=(u*m*r-f*d*r+f*i*p-t*m*p-u*i*g+t*d*g)*w,e[6]=(f*c*r-o*m*r-f*i*l+t*m*l+o*i*g-t*c*g)*w,e[7]=(o*d*r-u*c*r+u*i*l-t*d*l-o*i*p+t*c*p)*w,e[8]=v*w,e[9]=(f*h*r-u*x*r-f*n*p+t*x*p+u*n*g-t*h*g)*w,e[10]=(o*x*r-f*a*r+f*n*l-t*x*l-o*n*g+t*a*g)*w,e[11]=(u*a*r-o*h*r-u*n*l+t*h*l+o*n*p-t*a*p)*w,e[12]=I*w,e[13]=(u*x*i-f*h*i+f*n*d-t*x*d-u*n*m+t*h*m)*w,e[14]=(f*a*i-o*x*i-f*n*c+t*x*c+o*n*m-t*a*m)*w,e[15]=(o*h*i-u*a*i+u*n*c-t*h*c-o*n*d+t*a*d)*w,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,o=e.x,a=e.y,c=e.z,l=r*o,u=r*a;return this.set(l*o+n,l*a-i*c,l*c+i*a,0,l*a+i*c,u*a+n,u*c-i*o,0,l*c-i*a,u*c+i*o,r*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,o){return this.set(1,n,r,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,o=t._y,a=t._z,c=t._w,l=r+r,u=o+o,h=a+a,d=r*l,p=r*u,f=r*h,x=o*u,m=o*h,g=a*h,y=c*l,_=c*u,v=c*h,I=n.x,T=n.y,w=n.z;return i[0]=(1-(x+g))*I,i[1]=(p+v)*I,i[2]=(f-_)*I,i[3]=0,i[4]=(p-v)*T,i[5]=(1-(d+g))*T,i[6]=(m+y)*T,i[7]=0,i[8]=(f+_)*w,i[9]=(m-y)*w,i[10]=(1-(d+x))*w,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=Mo.set(i[0],i[1],i[2]).length();const o=Mo.set(i[4],i[5],i[6]).length(),a=Mo.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],$i.copy(this);const l=1/r,u=1/o,h=1/a;return $i.elements[0]*=l,$i.elements[1]*=l,$i.elements[2]*=l,$i.elements[4]*=u,$i.elements[5]*=u,$i.elements[6]*=u,$i.elements[8]*=h,$i.elements[9]*=h,$i.elements[10]*=h,t.setFromRotationMatrix($i),n.x=r,n.y=o,n.z=a,this}makePerspective(e,t,n,i,r,o,a=Di){const c=this.elements,l=2*r/(t-e),u=2*r/(n-i),h=(t+e)/(t-e),d=(n+i)/(n-i);let p,f;if(a===Di)p=-(o+r)/(o-r),f=-2*o*r/(o-r);else if(a===eo)p=-o/(o-r),f=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=l,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=u,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=f,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,r,o,a=Di){const c=this.elements,l=1/(t-e),u=1/(n-i),h=1/(o-r),d=(t+e)*l,p=(n+i)*u;let f,x;if(a===Di)f=(o+r)*h,x=-2*h;else if(a===eo)f=r*h,x=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=2*l,c[4]=0,c[8]=0,c[12]=-d,c[1]=0,c[5]=2*u,c[9]=0,c[13]=-p,c[2]=0,c[6]=0,c[10]=x,c[14]=-f,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Mo=new E,$i=new Fe,qA=new E(0,0,0),$A=new E(1,1,1),Hs=new E,Il=new E,gi=new E,N0=new Fe,E0=new Hn;class ui{constructor(e=0,t=0,n=0,i=ui.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],o=i[4],a=i[8],c=i[1],l=i[5],u=i[9],h=i[2],d=i[6],p=i[10];switch(t){case"XYZ":this._y=Math.asin(jt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-jt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(jt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-jt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(jt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-jt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return N0.makeRotationFromQuaternion(e),this.setFromRotationMatrix(N0,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return E0.setFromEuler(this),this.setFromQuaternion(E0,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ui.DEFAULT_ORDER="XYZ";class Yc{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let YA=0;const C0=new E,So=new Hn,ws=new Fe,Pl=new E,La=new E,ZA=new E,JA=new Hn,R0=new E(1,0,0),I0=new E(0,1,0),P0=new E(0,0,1),L0={type:"added"},KA={type:"removed"},To={type:"childadded",child:null},sp={type:"childremoved",child:null};class yt extends Ai{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:YA++}),this.uuid=bi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=yt.DEFAULT_UP.clone();const e=new E,t=new ui,n=new Hn,i=new E(1,1,1);function r(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Fe},normalMatrix:{value:new Ke}}),this.matrix=new Fe,this.matrixWorld=new Fe,this.matrixAutoUpdate=yt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=yt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Yc,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return So.setFromAxisAngle(e,t),this.quaternion.multiply(So),this}rotateOnWorldAxis(e,t){return So.setFromAxisAngle(e,t),this.quaternion.premultiply(So),this}rotateX(e){return this.rotateOnAxis(R0,e)}rotateY(e){return this.rotateOnAxis(I0,e)}rotateZ(e){return this.rotateOnAxis(P0,e)}translateOnAxis(e,t){return C0.copy(e).applyQuaternion(this.quaternion),this.position.add(C0.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(R0,e)}translateY(e){return this.translateOnAxis(I0,e)}translateZ(e){return this.translateOnAxis(P0,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ws.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Pl.copy(e):Pl.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),La.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ws.lookAt(La,Pl,this.up):ws.lookAt(Pl,La,this.up),this.quaternion.setFromRotationMatrix(ws),i&&(ws.extractRotation(i.matrixWorld),So.setFromRotationMatrix(ws),this.quaternion.premultiply(So.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(L0),To.child=e,this.dispatchEvent(To),To.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(KA),sp.child=e,this.dispatchEvent(sp),sp.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ws.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ws.multiply(e.parent.matrixWorld)),e.applyMatrix4(ws),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(L0),To.child=e,this.dispatchEvent(To),To.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,o=i.length;r<o;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(La,e,ZA),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(La,JA,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let r=0,o=i.length;r<o;r++)i[r].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function r(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const c=a.shapes;if(Array.isArray(c))for(let l=0,u=c.length;l<u;l++){const h=c[l];r(e.shapes,h)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let c=0,l=this.material.length;c<l;c++)a.push(r(e.materials,this.material[c]));i.material=a}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const c=this.animations[a];i.animations.push(r(e.animations,c))}}if(t){const a=o(e.geometries),c=o(e.materials),l=o(e.textures),u=o(e.images),h=o(e.shapes),d=o(e.skeletons),p=o(e.animations),f=o(e.nodes);a.length>0&&(n.geometries=a),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),d.length>0&&(n.skeletons=d),p.length>0&&(n.animations=p),f.length>0&&(n.nodes=f)}return n.object=i,n;function o(a){const c=[];for(const l in a){const u=a[l];delete u.metadata,c.push(u)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}yt.DEFAULT_UP=new E(0,1,0);yt.DEFAULT_MATRIX_AUTO_UPDATE=!0;yt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Yi=new E,As=new E,rp=new E,Ns=new E,bo=new E,wo=new E,D0=new E,op=new E,ap=new E,cp=new E,lp=new st,up=new st,hp=new st;class Jn{constructor(e=new E,t=new E,n=new E){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Yi.subVectors(e,t),i.cross(Yi);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Yi.subVectors(i,t),As.subVectors(n,t),rp.subVectors(e,t);const o=Yi.dot(Yi),a=Yi.dot(As),c=Yi.dot(rp),l=As.dot(As),u=As.dot(rp),h=o*l-a*a;if(h===0)return r.set(0,0,0),null;const d=1/h,p=(l*c-a*u)*d,f=(o*u-a*c)*d;return r.set(1-p-f,f,p)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Ns)===null?!1:Ns.x>=0&&Ns.y>=0&&Ns.x+Ns.y<=1}static getInterpolation(e,t,n,i,r,o,a,c){return this.getBarycoord(e,t,n,i,Ns)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(r,Ns.x),c.addScaledVector(o,Ns.y),c.addScaledVector(a,Ns.z),c)}static getInterpolatedAttribute(e,t,n,i,r,o){return lp.setScalar(0),up.setScalar(0),hp.setScalar(0),lp.fromBufferAttribute(e,t),up.fromBufferAttribute(e,n),hp.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(lp,r.x),o.addScaledVector(up,r.y),o.addScaledVector(hp,r.z),o}static isFrontFacing(e,t,n,i){return Yi.subVectors(n,t),As.subVectors(e,t),Yi.cross(As).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Yi.subVectors(this.c,this.b),As.subVectors(this.a,this.b),Yi.cross(As).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Jn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Jn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Jn.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Jn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Jn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let o,a;bo.subVectors(i,n),wo.subVectors(r,n),op.subVectors(e,n);const c=bo.dot(op),l=wo.dot(op);if(c<=0&&l<=0)return t.copy(n);ap.subVectors(e,i);const u=bo.dot(ap),h=wo.dot(ap);if(u>=0&&h<=u)return t.copy(i);const d=c*h-u*l;if(d<=0&&c>=0&&u<=0)return o=c/(c-u),t.copy(n).addScaledVector(bo,o);cp.subVectors(e,r);const p=bo.dot(cp),f=wo.dot(cp);if(f>=0&&p<=f)return t.copy(r);const x=p*l-c*f;if(x<=0&&l>=0&&f<=0)return a=l/(l-f),t.copy(n).addScaledVector(wo,a);const m=u*f-p*h;if(m<=0&&h-u>=0&&p-f>=0)return D0.subVectors(r,i),a=(h-u)/(h-u+(p-f)),t.copy(i).addScaledVector(D0,a);const g=1/(m+x+d);return o=x*g,a=d*g,t.copy(n).addScaledVector(bo,o).addScaledVector(wo,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Gy={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},Ws={h:0,s:0,l:0},Ll={h:0,s:0,l:0};function dp(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}class _e{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=kn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,gt.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=gt.workingColorSpace){return this.r=e,this.g=t,this.b=n,gt.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=gt.workingColorSpace){if(e=sm(e,1),t=jt(t,0,1),n=jt(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,o=2*n-r;this.r=dp(o,r,e+1/3),this.g=dp(o,r,e),this.b=dp(o,r,e-1/3)}return gt.toWorkingColorSpace(this,i),this}setStyle(e,t=kn){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=i[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=kn){const n=Gy[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Qo(e.r),this.g=Qo(e.g),this.b=Qo(e.b),this}copyLinearToSRGB(e){return this.r=Jd(e.r),this.g=Jd(e.g),this.b=Jd(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=kn){return gt.fromWorkingColorSpace(Bn.copy(this),e),Math.round(jt(Bn.r*255,0,255))*65536+Math.round(jt(Bn.g*255,0,255))*256+Math.round(jt(Bn.b*255,0,255))}getHexString(e=kn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=gt.workingColorSpace){gt.fromWorkingColorSpace(Bn.copy(this),t);const n=Bn.r,i=Bn.g,r=Bn.b,o=Math.max(n,i,r),a=Math.min(n,i,r);let c,l;const u=(a+o)/2;if(a===o)c=0,l=0;else{const h=o-a;switch(l=u<=.5?h/(o+a):h/(2-o-a),o){case n:c=(i-r)/h+(i<r?6:0);break;case i:c=(r-n)/h+2;break;case r:c=(n-i)/h+4;break}c/=6}return e.h=c,e.s=l,e.l=u,e}getRGB(e,t=gt.workingColorSpace){return gt.fromWorkingColorSpace(Bn.copy(this),t),e.r=Bn.r,e.g=Bn.g,e.b=Bn.b,e}getStyle(e=kn){gt.fromWorkingColorSpace(Bn.copy(this),e);const t=Bn.r,n=Bn.g,i=Bn.b;return e!==kn?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Ws),this.setHSL(Ws.h+e,Ws.s+t,Ws.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Ws),e.getHSL(Ll);const n=ja(Ws.h,Ll.h,t),i=ja(Ws.s,Ll.s,t),r=ja(Ws.l,Ll.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Bn=new _e;_e.NAMES=Gy;let jA=0;class mn extends Ai{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:jA++}),this.uuid=bi(),this.name="",this.type="Material",this.blending=Ls,this.side=gs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=zu,this.blendDst=ku,this.blendEquation=Js,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new _e(0,0,0),this.blendAlpha=0,this.depthFunc=ir,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=oh,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ys,this.stencilZFail=Ys,this.stencilZPass=Ys,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ls&&(n.blending=this.blending),this.side!==gs&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==zu&&(n.blendSrc=this.blendSrc),this.blendDst!==ku&&(n.blendDst=this.blendDst),this.blendEquation!==Js&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==ir&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==oh&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ys&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ys&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ys&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(r){const o=[];for(const a in r){const c=r[a];delete c.metadata,o.push(c)}return o}if(t){const r=i(e.textures),o=i(e.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class ss extends mn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new _e(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ui,this.combine=ma,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Rs=QA();function QA(){const s=new ArrayBuffer(4),e=new Float32Array(s),t=new Uint32Array(s),n=new Uint32Array(512),i=new Uint32Array(512);for(let c=0;c<256;++c){const l=c-127;l<-27?(n[c]=0,n[c|256]=32768,i[c]=24,i[c|256]=24):l<-14?(n[c]=1024>>-l-14,n[c|256]=1024>>-l-14|32768,i[c]=-l-1,i[c|256]=-l-1):l<=15?(n[c]=l+15<<10,n[c|256]=l+15<<10|32768,i[c]=13,i[c|256]=13):l<128?(n[c]=31744,n[c|256]=64512,i[c]=24,i[c|256]=24):(n[c]=31744,n[c|256]=64512,i[c]=13,i[c|256]=13)}const r=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let c=1;c<1024;++c){let l=c<<13,u=0;for(;(l&8388608)===0;)l<<=1,u-=8388608;l&=-8388609,u+=947912704,r[c]=l|u}for(let c=1024;c<2048;++c)r[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)o[c]=c<<23;o[31]=1199570944,o[32]=2147483648;for(let c=33;c<63;++c)o[c]=2147483648+(c-32<<23);o[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(a[c]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:r,exponentTable:o,offsetTable:a}}function si(s){Math.abs(s)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),s=jt(s,-65504,65504),Rs.floatView[0]=s;const e=Rs.uint32View[0],t=e>>23&511;return Rs.baseTable[t]+((e&8388607)>>Rs.shiftTable[t])}function Ja(s){const e=s>>10;return Rs.uint32View[0]=Rs.mantissaTable[Rs.offsetTable[e]+(s&1023)]+Rs.exponentTable[e],Rs.floatView[0]}const Hy={toHalfFloat:si,fromHalfFloat:Ja},an=new E,Dl=new J;class At{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ra,this.updateRanges=[],this.gpuType=Gn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Dl.fromBufferAttribute(this,t),Dl.applyMatrix3(e),this.setXY(t,Dl.x,Dl.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.applyMatrix3(e),this.setXYZ(t,an.x,an.y,an.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.applyMatrix4(e),this.setXYZ(t,an.x,an.y,an.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.applyNormalMatrix(e),this.setXYZ(t,an.x,an.y,an.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.transformDirection(e),this.setXYZ(t,an.x,an.y,an.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Zn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=ut(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Zn(t,this.array)),t}setX(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Zn(t,this.array)),t}setY(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Zn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Zn(t,this.array)),t}setW(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array),r=ut(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==ra&&(e.usage=this.usage),e}}class e1 extends At{constructor(e,t,n){super(new Int8Array(e),t,n)}}class t1 extends At{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class n1 extends At{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class i1 extends At{constructor(e,t,n){super(new Int16Array(e),t,n)}}class $h extends At{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class s1 extends At{constructor(e,t,n){super(new Int32Array(e),t,n)}}class rm extends At{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Wy extends At{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Ja(this.array[e*this.itemSize]);return this.normalized&&(t=Zn(t,this.array)),t}setX(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize]=si(t),this}getY(e){let t=Ja(this.array[e*this.itemSize+1]);return this.normalized&&(t=Zn(t,this.array)),t}setY(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize+1]=si(t),this}getZ(e){let t=Ja(this.array[e*this.itemSize+2]);return this.normalized&&(t=Zn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize+2]=si(t),this}getW(e){let t=Ja(this.array[e*this.itemSize+3]);return this.normalized&&(t=Zn(t,this.array)),t}setW(e,t){return this.normalized&&(t=ut(t,this.array)),this.array[e*this.itemSize+3]=si(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array)),this.array[e+0]=si(t),this.array[e+1]=si(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array)),this.array[e+0]=si(t),this.array[e+1]=si(n),this.array[e+2]=si(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array),r=ut(r,this.array)),this.array[e+0]=si(t),this.array[e+1]=si(n),this.array[e+2]=si(i),this.array[e+3]=si(r),this}}class Ve extends At{constructor(e,t,n){super(new Float32Array(e),t,n)}}let r1=0;const Ei=new Fe,pp=new yt,Ao=new E,xi=new Wn,Da=new Wn,_n=new E;class at extends Ai{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:r1++}),this.uuid=bi(),this.name="",this.type="BufferGeometry",this.index=null,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(e){return Array.isArray(e)?this.index=new(By(e)?rm:$h)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const r=new Ke().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ei.makeRotationFromQuaternion(e),this.applyMatrix4(Ei),this}rotateX(e){return Ei.makeRotationX(e),this.applyMatrix4(Ei),this}rotateY(e){return Ei.makeRotationY(e),this.applyMatrix4(Ei),this}rotateZ(e){return Ei.makeRotationZ(e),this.applyMatrix4(Ei),this}translate(e,t,n){return Ei.makeTranslation(e,t,n),this.applyMatrix4(Ei),this}scale(e,t,n){return Ei.makeScale(e,t,n),this.applyMatrix4(Ei),this}lookAt(e){return pp.lookAt(e),pp.updateMatrix(),this.applyMatrix4(pp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ao).negate(),this.translate(Ao.x,Ao.y,Ao.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Ve(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Wn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new E(-1/0,-1/0,-1/0),new E(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const r=t[n];xi.setFromBufferAttribute(r),this.morphTargetsRelative?(_n.addVectors(this.boundingBox.min,xi.min),this.boundingBox.expandByPoint(_n),_n.addVectors(this.boundingBox.max,xi.max),this.boundingBox.expandByPoint(_n)):(this.boundingBox.expandByPoint(xi.min),this.boundingBox.expandByPoint(xi.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Dn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new E,1/0);return}if(e){const n=this.boundingSphere.center;if(xi.setFromBufferAttribute(e),t)for(let r=0,o=t.length;r<o;r++){const a=t[r];Da.setFromBufferAttribute(a),this.morphTargetsRelative?(_n.addVectors(xi.min,Da.min),xi.expandByPoint(_n),_n.addVectors(xi.max,Da.max),xi.expandByPoint(_n)):(xi.expandByPoint(Da.min),xi.expandByPoint(Da.max))}xi.getCenter(n);let i=0;for(let r=0,o=e.count;r<o;r++)_n.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(_n));if(t)for(let r=0,o=t.length;r<o;r++){const a=t[r],c=this.morphTargetsRelative;for(let l=0,u=a.count;l<u;l++)_n.fromBufferAttribute(a,l),c&&(Ao.fromBufferAttribute(e,l),_n.add(Ao)),i=Math.max(i,n.distanceToSquared(_n))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,r=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new At(new Float32Array(4*n.count),4));const o=this.getAttribute("tangent"),a=[],c=[];for(let C=0;C<n.count;C++)a[C]=new E,c[C]=new E;const l=new E,u=new E,h=new E,d=new J,p=new J,f=new J,x=new E,m=new E;function g(C,F,M){l.fromBufferAttribute(n,C),u.fromBufferAttribute(n,F),h.fromBufferAttribute(n,M),d.fromBufferAttribute(r,C),p.fromBufferAttribute(r,F),f.fromBufferAttribute(r,M),u.sub(l),h.sub(l),p.sub(d),f.sub(d);const b=1/(p.x*f.y-f.x*p.y);isFinite(b)&&(x.copy(u).multiplyScalar(f.y).addScaledVector(h,-p.y).multiplyScalar(b),m.copy(h).multiplyScalar(p.x).addScaledVector(u,-f.x).multiplyScalar(b),a[C].add(x),a[F].add(x),a[M].add(x),c[C].add(m),c[F].add(m),c[M].add(m))}let y=this.groups;y.length===0&&(y=[{start:0,count:e.count}]);for(let C=0,F=y.length;C<F;++C){const M=y[C],b=M.start,G=M.count;for(let W=b,$=b+G;W<$;W+=3)g(e.getX(W+0),e.getX(W+1),e.getX(W+2))}const _=new E,v=new E,I=new E,T=new E;function w(C){I.fromBufferAttribute(i,C),T.copy(I);const F=a[C];_.copy(F),_.sub(I.multiplyScalar(I.dot(F))).normalize(),v.crossVectors(T,F);const b=v.dot(c[C])<0?-1:1;o.setXYZW(C,_.x,_.y,_.z,b)}for(let C=0,F=y.length;C<F;++C){const M=y[C],b=M.start,G=M.count;for(let W=b,$=b+G;W<$;W+=3)w(e.getX(W+0)),w(e.getX(W+1)),w(e.getX(W+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new At(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,p=n.count;d<p;d++)n.setXYZ(d,0,0,0);const i=new E,r=new E,o=new E,a=new E,c=new E,l=new E,u=new E,h=new E;if(e)for(let d=0,p=e.count;d<p;d+=3){const f=e.getX(d+0),x=e.getX(d+1),m=e.getX(d+2);i.fromBufferAttribute(t,f),r.fromBufferAttribute(t,x),o.fromBufferAttribute(t,m),u.subVectors(o,r),h.subVectors(i,r),u.cross(h),a.fromBufferAttribute(n,f),c.fromBufferAttribute(n,x),l.fromBufferAttribute(n,m),a.add(u),c.add(u),l.add(u),n.setXYZ(f,a.x,a.y,a.z),n.setXYZ(x,c.x,c.y,c.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let d=0,p=t.count;d<p;d+=3)i.fromBufferAttribute(t,d+0),r.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),u.subVectors(o,r),h.subVectors(i,r),u.cross(h),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)_n.fromBufferAttribute(e,t),_n.normalize(),e.setXYZ(t,_n.x,_n.y,_n.z)}toNonIndexed(){function e(a,c){const l=a.array,u=a.itemSize,h=a.normalized,d=new l.constructor(c.length*u);let p=0,f=0;for(let x=0,m=c.length;x<m;x++){a.isInterleavedBufferAttribute?p=c[x]*a.data.stride+a.offset:p=c[x]*u;for(let g=0;g<u;g++)d[f++]=l[p++]}return new At(d,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new at,n=this.index.array,i=this.attributes;for(const a in i){const c=i[a],l=e(c,n);t.setAttribute(a,l)}const r=this.morphAttributes;for(const a in r){const c=[],l=r[a];for(let u=0,h=l.length;u<h;u++){const d=l[u],p=e(d,n);c.push(p)}t.morphAttributes[a]=c}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,c=o.length;a<c;a++){const l=o[a];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const i={};let r=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],u=[];for(let h=0,d=l.length;h<d;h++){const p=l[h];u.push(p.toJSON(e.data))}u.length>0&&(i[c]=u,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const l in i){const u=i[l];this.setAttribute(l,u.clone(t))}const r=e.morphAttributes;for(const l in r){const u=[],h=r[l];for(let d=0,p=h.length;d<p;d++)u.push(h[d].clone(t));this.morphAttributes[l]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let l=0,u=o.length;l<u;l++){const h=o[l];this.addGroup(h.start,h.count,h.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const U0=new Fe,br=new so,Ul=new Dn,F0=new E,Fl=new E,Ol=new E,Vl=new E,fp=new E,Bl=new E,O0=new E,zl=new E;class kt extends yt{constructor(e=new at,t=new ss){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(r&&a){Bl.set(0,0,0);for(let c=0,l=r.length;c<l;c++){const u=a[c],h=r[c];u!==0&&(fp.fromBufferAttribute(h,e),o?Bl.addScaledVector(fp,u):Bl.addScaledVector(fp.sub(t),u))}t.add(Bl)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Ul.copy(n.boundingSphere),Ul.applyMatrix4(r),br.copy(e.ray).recast(e.near),!(Ul.containsPoint(br.origin)===!1&&(br.intersectSphere(Ul,F0)===null||br.origin.distanceToSquared(F0)>(e.far-e.near)**2))&&(U0.copy(r).invert(),br.copy(e.ray).applyMatrix4(U0),!(n.boundingBox!==null&&br.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,br)))}_computeIntersections(e,t,n){let i;const r=this.geometry,o=this.material,a=r.index,c=r.attributes.position,l=r.attributes.uv,u=r.attributes.uv1,h=r.attributes.normal,d=r.groups,p=r.drawRange;if(a!==null)if(Array.isArray(o))for(let f=0,x=d.length;f<x;f++){const m=d[f],g=o[m.materialIndex],y=Math.max(m.start,p.start),_=Math.min(a.count,Math.min(m.start+m.count,p.start+p.count));for(let v=y,I=_;v<I;v+=3){const T=a.getX(v),w=a.getX(v+1),C=a.getX(v+2);i=kl(this,g,e,n,l,u,h,T,w,C),i&&(i.faceIndex=Math.floor(v/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const f=Math.max(0,p.start),x=Math.min(a.count,p.start+p.count);for(let m=f,g=x;m<g;m+=3){const y=a.getX(m),_=a.getX(m+1),v=a.getX(m+2);i=kl(this,o,e,n,l,u,h,y,_,v),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}else if(c!==void 0)if(Array.isArray(o))for(let f=0,x=d.length;f<x;f++){const m=d[f],g=o[m.materialIndex],y=Math.max(m.start,p.start),_=Math.min(c.count,Math.min(m.start+m.count,p.start+p.count));for(let v=y,I=_;v<I;v+=3){const T=v,w=v+1,C=v+2;i=kl(this,g,e,n,l,u,h,T,w,C),i&&(i.faceIndex=Math.floor(v/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const f=Math.max(0,p.start),x=Math.min(c.count,p.start+p.count);for(let m=f,g=x;m<g;m+=3){const y=m,_=m+1,v=m+2;i=kl(this,o,e,n,l,u,h,y,_,v),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}}}function o1(s,e,t,n,i,r,o,a){let c;if(e.side===ln?c=n.intersectTriangle(o,r,i,!0,a):c=n.intersectTriangle(i,r,o,e.side===gs,a),c===null)return null;zl.copy(a),zl.applyMatrix4(s.matrixWorld);const l=t.ray.origin.distanceTo(zl);return l<t.near||l>t.far?null:{distance:l,point:zl.clone(),object:s}}function kl(s,e,t,n,i,r,o,a,c,l){s.getVertexPosition(a,Fl),s.getVertexPosition(c,Ol),s.getVertexPosition(l,Vl);const u=o1(s,e,t,n,Fl,Ol,Vl,O0);if(u){const h=new E;Jn.getBarycoord(O0,Fl,Ol,Vl,h),i&&(u.uv=Jn.getInterpolatedAttribute(i,a,c,l,h,new J)),r&&(u.uv1=Jn.getInterpolatedAttribute(r,a,c,l,h,new J)),o&&(u.normal=Jn.getInterpolatedAttribute(o,a,c,l,h,new E),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const d={a,b:c,c:l,normal:new E,materialIndex:0};Jn.getNormal(Fl,Ol,Vl,d.normal),u.face=d,u.barycoord=h}return u}class vs extends at{constructor(e=1,t=1,n=1,i=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:o};const a=this;i=Math.floor(i),r=Math.floor(r),o=Math.floor(o);const c=[],l=[],u=[],h=[];let d=0,p=0;f("z","y","x",-1,-1,n,t,e,o,r,0),f("z","y","x",1,-1,n,t,-e,o,r,1),f("x","z","y",1,1,e,n,t,i,o,2),f("x","z","y",1,-1,e,n,-t,i,o,3),f("x","y","z",1,-1,e,t,n,i,r,4),f("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(c),this.setAttribute("position",new Ve(l,3)),this.setAttribute("normal",new Ve(u,3)),this.setAttribute("uv",new Ve(h,2));function f(x,m,g,y,_,v,I,T,w,C,F){const M=v/w,b=I/C,G=v/2,W=I/2,$=T/2,ie=w+1,q=C+1;let he=0,Q=0;const we=new E;for(let Ne=0;Ne<q;Ne++){const Ee=Ne*b-W;for(let Qe=0;Qe<ie;Qe++){const ht=Qe*M-G;we[x]=ht*y,we[m]=Ee*_,we[g]=$,l.push(we.x,we.y,we.z),we[x]=0,we[m]=0,we[g]=T>0?1:-1,u.push(we.x,we.y,we.z),h.push(Qe/w),h.push(1-Ne/C),he+=1}}for(let Ne=0;Ne<C;Ne++)for(let Ee=0;Ee<w;Ee++){const Qe=d+Ee+ie*Ne,ht=d+Ee+ie*(Ne+1),ne=d+(Ee+1)+ie*(Ne+1),ue=d+(Ee+1)+ie*Ne;c.push(Qe,ht,ue),c.push(ht,ne,ue),Q+=6}a.addGroup(p,Q,F),p+=Q,d+=he}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function aa(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Yn(s){const e={};for(let t=0;t<s.length;t++){const n=aa(s[t]);for(const i in n)e[i]=n[i]}return e}function a1(s){const e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function Xy(s){const e=s.getRenderTarget();return e===null?s.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:gt.workingColorSpace}const om={clone:aa,merge:Yn};var c1=`void main() {
|
|
2
2
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
3
3
|
}`,l1=`void main() {
|
|
4
4
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
@@ -3788,7 +3788,7 @@ Material Type: `+b.type+`
|
|
|
3788
3788
|
|
|
3789
3789
|
Program Info Log: `+G+`
|
|
3790
3790
|
`+he+`
|
|
3791
|
-
`+Q)}else G!==""?console.warn("THREE.WebGLProgram: Program Info Log:",G):(W===""||$==="")&&(q=!1);q&&(b.diagnostics={runnable:ie,programLog:G,vertexShader:{log:W,prefix:m},fragmentShader:{log:$,prefix:g}})}i.deleteShader(I),i.deleteShader(T),C=new Lu(i,x),F=oR(i,x)}let C;this.getUniforms=function(){return C===void 0&&w(this),C};let F;this.getAttributes=function(){return F===void 0&&w(this),F};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=i.getProgramParameter(x,KC)),M},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=jC++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=I,this.fragmentShader=T,this}let _R=0;class yR{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new vR(e),t.set(e,n)),n}}class vR{constructor(e){this.id=_R++,this.code=e,this.usedTimes=0}}function MR(s,e,t,n,i,r,o){const a=new Yc,c=new yR,l=new Set,u=[],h=i.logarithmicDepthBuffer,d=i.reverseDepthBuffer,p=i.vertexTextures;let f=i.precision;const x={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(M){return l.add(M),M===0?"uv":`uv${M}`}function g(M,b,G,W,$){const ie=W.fog,q=$.geometry,he=M.isMeshStandardMaterial?W.environment:null,Q=(M.isMeshStandardMaterial?t:e).get(M.envMap||he),we=Q&&Q.mapping===dr?Q.image.height:null,Ne=x[M.type];M.precision!==null&&(f=i.getMaxPrecision(M.precision),f!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",f,"instead."));const Ee=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,Qe=Ee!==void 0?Ee.length:0;let ht=0;q.morphAttributes.position!==void 0&&(ht=1),q.morphAttributes.normal!==void 0&&(ht=2),q.morphAttributes.color!==void 0&&(ht=3);let ne,ue,Ae,ge;if(Ne){const ii=Pi[Ne];ne=ii.vertexShader,ue=ii.fragmentShader}else ne=M.vertexShader,ue=M.fragmentShader,c.update(M),Ae=c.getVertexShaderID(M),ge=c.getFragmentShaderID(M);const Ze=s.getRenderTarget(),Xe=$.isInstancedMesh===!0,Je=$.isBatchedMesh===!0,dt=!!M.map,ae=!!M.matcap,P=!!Q,Me=!!M.aoMap,ye=!!M.lightMap,de=!!M.bumpMap,Te=!!M.normalMap,qe=!!M.displacementMap,Ie=!!M.emissiveMap,R=!!M.metalnessMap,S=!!M.roughnessMap,X=M.anisotropy>0,re=M.clearcoat>0,ce=M.dispersion>0,se=M.iridescence>0,ke=M.sheen>0,be=M.transmission>0,De=X&&!!M.anisotropyMap,vt=re&&!!M.clearcoatMap,me=re&&!!M.clearcoatNormalMap,Ue=re&&!!M.clearcoatRoughnessMap,tt=se&&!!M.iridescenceMap,nt=se&&!!M.iridescenceThicknessMap,Be=ke&&!!M.sheenColorMap,Mt=ke&&!!M.sheenRoughnessMap,ct=!!M.specularMap,Ot=!!M.specularColorMap,O=!!M.specularIntensityMap,Pe=be&&!!M.transmissionMap,ee=be&&!!M.thicknessMap,le=!!M.gradientMap,Ce=!!M.alphaMap,Le=M.alphaTest>0,bt=!!M.alphaHash,on=!!M.extensions;let ni=Ti;M.toneMapped&&(Ze===null||Ze.isXRRenderTarget===!0)&&(ni=s.toneMapping);const Et={shaderID:Ne,shaderType:M.type,shaderName:M.name,vertexShader:ne,fragmentShader:ue,defines:M.defines,customVertexShaderID:Ae,customFragmentShaderID:ge,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:f,batching:Je,batchingColor:Je&&$._colorsTexture!==null,instancing:Xe,instancingColor:Xe&&$.instanceColor!==null,instancingMorph:Xe&&$.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:Ze===null?s.outputColorSpace:Ze.isXRRenderTarget===!0?Ze.texture.colorSpace:li,alphaToCoverage:!!M.alphaToCoverage,map:dt,matcap:ae,envMap:P,envMapMode:P&&Q.mapping,envMapCubeUVHeight:we,aoMap:Me,lightMap:ye,bumpMap:de,normalMap:Te,displacementMap:p&&qe,emissiveMap:Ie,normalMapObjectSpace:Te&&M.normalMapType===tm,normalMapTangentSpace:Te&&M.normalMapType===xs,metalnessMap:R,roughnessMap:S,anisotropy:X,anisotropyMap:De,clearcoat:re,clearcoatMap:vt,clearcoatNormalMap:me,clearcoatRoughnessMap:Ue,dispersion:ce,iridescence:se,iridescenceMap:tt,iridescenceThicknessMap:nt,sheen:ke,sheenColorMap:Be,sheenRoughnessMap:Mt,specularMap:ct,specularColorMap:Ot,specularIntensityMap:O,transmission:be,transmissionMap:Pe,thicknessMap:ee,gradientMap:le,opaque:M.transparent===!1&&M.blending===Ls&&M.alphaToCoverage===!1,alphaMap:Ce,alphaTest:Le,alphaHash:bt,combine:M.combine,mapUv:dt&&m(M.map.channel),aoMapUv:Me&&m(M.aoMap.channel),lightMapUv:ye&&m(M.lightMap.channel),bumpMapUv:de&&m(M.bumpMap.channel),normalMapUv:Te&&m(M.normalMap.channel),displacementMapUv:qe&&m(M.displacementMap.channel),emissiveMapUv:Ie&&m(M.emissiveMap.channel),metalnessMapUv:R&&m(M.metalnessMap.channel),roughnessMapUv:S&&m(M.roughnessMap.channel),anisotropyMapUv:De&&m(M.anisotropyMap.channel),clearcoatMapUv:vt&&m(M.clearcoatMap.channel),clearcoatNormalMapUv:me&&m(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ue&&m(M.clearcoatRoughnessMap.channel),iridescenceMapUv:tt&&m(M.iridescenceMap.channel),iridescenceThicknessMapUv:nt&&m(M.iridescenceThicknessMap.channel),sheenColorMapUv:Be&&m(M.sheenColorMap.channel),sheenRoughnessMapUv:Mt&&m(M.sheenRoughnessMap.channel),specularMapUv:ct&&m(M.specularMap.channel),specularColorMapUv:Ot&&m(M.specularColorMap.channel),specularIntensityMapUv:O&&m(M.specularIntensityMap.channel),transmissionMapUv:Pe&&m(M.transmissionMap.channel),thicknessMapUv:ee&&m(M.thicknessMap.channel),alphaMapUv:Ce&&m(M.alphaMap.channel),vertexTangents:!!q.attributes.tangent&&(Te||X),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,pointsUvs:$.isPoints===!0&&!!q.attributes.uv&&(dt||Ce),fog:!!ie,useFog:M.fog===!0,fogExp2:!!ie&&ie.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:h,reverseDepthBuffer:d,skinning:$.isSkinnedMesh===!0,morphTargets:q.morphAttributes.position!==void 0,morphNormals:q.morphAttributes.normal!==void 0,morphColors:q.morphAttributes.color!==void 0,morphTargetsCount:Qe,morphTextureStride:ht,numDirLights:b.directional.length,numPointLights:b.point.length,numSpotLights:b.spot.length,numSpotLightMaps:b.spotLightMap.length,numRectAreaLights:b.rectArea.length,numHemiLights:b.hemi.length,numDirLightShadows:b.directionalShadowMap.length,numPointLightShadows:b.pointShadowMap.length,numSpotLightShadows:b.spotShadowMap.length,numSpotLightShadowsWithMaps:b.numSpotLightShadowsWithMaps,numLightProbes:b.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:M.dithering,shadowMapEnabled:s.shadowMap.enabled&&G.length>0,shadowMapType:s.shadowMap.type,toneMapping:ni,decodeVideoTexture:dt&&M.map.isVideoTexture===!0&>.getTransfer(M.map.colorSpace)===Vt,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===Ji,flipSided:M.side===ln,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:on&&M.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(on&&M.extensions.multiDraw===!0||Je)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return Et.vertexUv1s=l.has(1),Et.vertexUv2s=l.has(2),Et.vertexUv3s=l.has(3),l.clear(),Et}function y(M){const b=[];if(M.shaderID?b.push(M.shaderID):(b.push(M.customVertexShaderID),b.push(M.customFragmentShaderID)),M.defines!==void 0)for(const G in M.defines)b.push(G),b.push(M.defines[G]);return M.isRawShaderMaterial===!1&&(_(b,M),v(b,M),b.push(s.outputColorSpace)),b.push(M.customProgramCacheKey),b.join()}function _(M,b){M.push(b.precision),M.push(b.outputColorSpace),M.push(b.envMapMode),M.push(b.envMapCubeUVHeight),M.push(b.mapUv),M.push(b.alphaMapUv),M.push(b.lightMapUv),M.push(b.aoMapUv),M.push(b.bumpMapUv),M.push(b.normalMapUv),M.push(b.displacementMapUv),M.push(b.emissiveMapUv),M.push(b.metalnessMapUv),M.push(b.roughnessMapUv),M.push(b.anisotropyMapUv),M.push(b.clearcoatMapUv),M.push(b.clearcoatNormalMapUv),M.push(b.clearcoatRoughnessMapUv),M.push(b.iridescenceMapUv),M.push(b.iridescenceThicknessMapUv),M.push(b.sheenColorMapUv),M.push(b.sheenRoughnessMapUv),M.push(b.specularMapUv),M.push(b.specularColorMapUv),M.push(b.specularIntensityMapUv),M.push(b.transmissionMapUv),M.push(b.thicknessMapUv),M.push(b.combine),M.push(b.fogExp2),M.push(b.sizeAttenuation),M.push(b.morphTargetsCount),M.push(b.morphAttributeCount),M.push(b.numDirLights),M.push(b.numPointLights),M.push(b.numSpotLights),M.push(b.numSpotLightMaps),M.push(b.numHemiLights),M.push(b.numRectAreaLights),M.push(b.numDirLightShadows),M.push(b.numPointLightShadows),M.push(b.numSpotLightShadows),M.push(b.numSpotLightShadowsWithMaps),M.push(b.numLightProbes),M.push(b.shadowMapType),M.push(b.toneMapping),M.push(b.numClippingPlanes),M.push(b.numClipIntersection),M.push(b.depthPacking)}function v(M,b){a.disableAll(),b.supportsVertexTextures&&a.enable(0),b.instancing&&a.enable(1),b.instancingColor&&a.enable(2),b.instancingMorph&&a.enable(3),b.matcap&&a.enable(4),b.envMap&&a.enable(5),b.normalMapObjectSpace&&a.enable(6),b.normalMapTangentSpace&&a.enable(7),b.clearcoat&&a.enable(8),b.iridescence&&a.enable(9),b.alphaTest&&a.enable(10),b.vertexColors&&a.enable(11),b.vertexAlphas&&a.enable(12),b.vertexUv1s&&a.enable(13),b.vertexUv2s&&a.enable(14),b.vertexUv3s&&a.enable(15),b.vertexTangents&&a.enable(16),b.anisotropy&&a.enable(17),b.alphaHash&&a.enable(18),b.batching&&a.enable(19),b.dispersion&&a.enable(20),b.batchingColor&&a.enable(21),M.push(a.mask),a.disableAll(),b.fog&&a.enable(0),b.useFog&&a.enable(1),b.flatShading&&a.enable(2),b.logarithmicDepthBuffer&&a.enable(3),b.reverseDepthBuffer&&a.enable(4),b.skinning&&a.enable(5),b.morphTargets&&a.enable(6),b.morphNormals&&a.enable(7),b.morphColors&&a.enable(8),b.premultipliedAlpha&&a.enable(9),b.shadowMapEnabled&&a.enable(10),b.doubleSided&&a.enable(11),b.flipSided&&a.enable(12),b.useDepthPacking&&a.enable(13),b.dithering&&a.enable(14),b.transmission&&a.enable(15),b.sheen&&a.enable(16),b.opaque&&a.enable(17),b.pointsUvs&&a.enable(18),b.decodeVideoTexture&&a.enable(19),b.alphaToCoverage&&a.enable(20),M.push(a.mask)}function I(M){const b=x[M.type];let G;if(b){const W=Pi[b];G=om.clone(W.uniforms)}else G=M.uniforms;return G}function T(M,b){let G;for(let W=0,$=u.length;W<$;W++){const ie=u[W];if(ie.cacheKey===b){G=ie,++G.usedTimes;break}}return G===void 0&&(G=new xR(s,b,M,r),u.push(G)),G}function w(M){if(--M.usedTimes===0){const b=u.indexOf(M);u[b]=u[u.length-1],u.pop(),M.destroy()}}function C(M){c.remove(M)}function F(){c.dispose()}return{getParameters:g,getProgramCacheKey:y,getUniforms:I,acquireProgram:T,releaseProgram:w,releaseShaderCache:C,programs:u,dispose:F}}function SR(){let s=new WeakMap;function e(o){return s.has(o)}function t(o){let a=s.get(o);return a===void 0&&(a={},s.set(o,a)),a}function n(o){s.delete(o)}function i(o,a,c){s.get(o)[a]=c}function r(){s=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:r}}function TR(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.z!==e.z?s.z-e.z:s.id-e.id}function ox(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function ax(){const s=[];let e=0;const t=[],n=[],i=[];function r(){e=0,t.length=0,n.length=0,i.length=0}function o(h,d,p,f,x,m){let g=s[e];return g===void 0?(g={id:h.id,object:h,geometry:d,material:p,groupOrder:f,renderOrder:h.renderOrder,z:x,group:m},s[e]=g):(g.id=h.id,g.object=h,g.geometry=d,g.material=p,g.groupOrder=f,g.renderOrder=h.renderOrder,g.z=x,g.group=m),e++,g}function a(h,d,p,f,x,m){const g=o(h,d,p,f,x,m);p.transmission>0?n.push(g):p.transparent===!0?i.push(g):t.push(g)}function c(h,d,p,f,x,m){const g=o(h,d,p,f,x,m);p.transmission>0?n.unshift(g):p.transparent===!0?i.unshift(g):t.unshift(g)}function l(h,d){t.length>1&&t.sort(h||TR),n.length>1&&n.sort(d||ox),i.length>1&&i.sort(d||ox)}function u(){for(let h=e,d=s.length;h<d;h++){const p=s[h];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:n,transparent:i,init:r,push:a,unshift:c,finish:u,sort:l}}function bR(){let s=new WeakMap;function e(n,i){const r=s.get(n);let o;return r===void 0?(o=new ax,s.set(n,[o])):i>=r.length?(o=new ax,r.push(o)):o=r[i],o}function t(){s=new WeakMap}return{get:e,dispose:t}}function wR(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new E,color:new _e};break;case"SpotLight":t={position:new E,direction:new E,color:new _e,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new E,color:new _e,distance:0,decay:0};break;case"HemisphereLight":t={direction:new E,skyColor:new _e,groundColor:new _e};break;case"RectAreaLight":t={color:new _e,position:new E,halfWidth:new E,halfHeight:new E};break}return s[e.id]=t,t}}}function AR(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new J};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new J};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new J,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}let NR=0;function ER(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function CR(s){const e=new wR,t=AR(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let l=0;l<9;l++)n.probe.push(new E);const i=new E,r=new Fe,o=new Fe;function a(l){let u=0,h=0,d=0;for(let F=0;F<9;F++)n.probe[F].set(0,0,0);let p=0,f=0,x=0,m=0,g=0,y=0,_=0,v=0,I=0,T=0,w=0;l.sort(ER);for(let F=0,M=l.length;F<M;F++){const b=l[F],G=b.color,W=b.intensity,$=b.distance,ie=b.shadow&&b.shadow.map?b.shadow.map.texture:null;if(b.isAmbientLight)u+=G.r*W,h+=G.g*W,d+=G.b*W;else if(b.isLightProbe){for(let q=0;q<9;q++)n.probe[q].addScaledVector(b.sh.coefficients[q],W);w++}else if(b.isDirectionalLight){const q=e.get(b);if(q.color.copy(b.color).multiplyScalar(b.intensity),b.castShadow){const he=b.shadow,Q=t.get(b);Q.shadowIntensity=he.intensity,Q.shadowBias=he.bias,Q.shadowNormalBias=he.normalBias,Q.shadowRadius=he.radius,Q.shadowMapSize=he.mapSize,n.directionalShadow[p]=Q,n.directionalShadowMap[p]=ie,n.directionalShadowMatrix[p]=b.shadow.matrix,y++}n.directional[p]=q,p++}else if(b.isSpotLight){const q=e.get(b);q.position.setFromMatrixPosition(b.matrixWorld),q.color.copy(G).multiplyScalar(W),q.distance=$,q.coneCos=Math.cos(b.angle),q.penumbraCos=Math.cos(b.angle*(1-b.penumbra)),q.decay=b.decay,n.spot[x]=q;const he=b.shadow;if(b.map&&(n.spotLightMap[I]=b.map,I++,he.updateMatrices(b),b.castShadow&&T++),n.spotLightMatrix[x]=he.matrix,b.castShadow){const Q=t.get(b);Q.shadowIntensity=he.intensity,Q.shadowBias=he.bias,Q.shadowNormalBias=he.normalBias,Q.shadowRadius=he.radius,Q.shadowMapSize=he.mapSize,n.spotShadow[x]=Q,n.spotShadowMap[x]=ie,v++}x++}else if(b.isRectAreaLight){const q=e.get(b);q.color.copy(G).multiplyScalar(W),q.halfWidth.set(b.width*.5,0,0),q.halfHeight.set(0,b.height*.5,0),n.rectArea[m]=q,m++}else if(b.isPointLight){const q=e.get(b);if(q.color.copy(b.color).multiplyScalar(b.intensity),q.distance=b.distance,q.decay=b.decay,b.castShadow){const he=b.shadow,Q=t.get(b);Q.shadowIntensity=he.intensity,Q.shadowBias=he.bias,Q.shadowNormalBias=he.normalBias,Q.shadowRadius=he.radius,Q.shadowMapSize=he.mapSize,Q.shadowCameraNear=he.camera.near,Q.shadowCameraFar=he.camera.far,n.pointShadow[f]=Q,n.pointShadowMap[f]=ie,n.pointShadowMatrix[f]=b.shadow.matrix,_++}n.point[f]=q,f++}else if(b.isHemisphereLight){const q=e.get(b);q.skyColor.copy(b.color).multiplyScalar(W),q.groundColor.copy(b.groundColor).multiplyScalar(W),n.hemi[g]=q,g++}}m>0&&(s.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Se.LTC_FLOAT_1,n.rectAreaLTC2=Se.LTC_FLOAT_2):(n.rectAreaLTC1=Se.LTC_HALF_1,n.rectAreaLTC2=Se.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=d;const C=n.hash;(C.directionalLength!==p||C.pointLength!==f||C.spotLength!==x||C.rectAreaLength!==m||C.hemiLength!==g||C.numDirectionalShadows!==y||C.numPointShadows!==_||C.numSpotShadows!==v||C.numSpotMaps!==I||C.numLightProbes!==w)&&(n.directional.length=p,n.spot.length=x,n.rectArea.length=m,n.point.length=f,n.hemi.length=g,n.directionalShadow.length=y,n.directionalShadowMap.length=y,n.pointShadow.length=_,n.pointShadowMap.length=_,n.spotShadow.length=v,n.spotShadowMap.length=v,n.directionalShadowMatrix.length=y,n.pointShadowMatrix.length=_,n.spotLightMatrix.length=v+I-T,n.spotLightMap.length=I,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=w,C.directionalLength=p,C.pointLength=f,C.spotLength=x,C.rectAreaLength=m,C.hemiLength=g,C.numDirectionalShadows=y,C.numPointShadows=_,C.numSpotShadows=v,C.numSpotMaps=I,C.numLightProbes=w,n.version=NR++)}function c(l,u){let h=0,d=0,p=0,f=0,x=0;const m=u.matrixWorldInverse;for(let g=0,y=l.length;g<y;g++){const _=l[g];if(_.isDirectionalLight){const v=n.directional[h];v.direction.setFromMatrixPosition(_.matrixWorld),i.setFromMatrixPosition(_.target.matrixWorld),v.direction.sub(i),v.direction.transformDirection(m),h++}else if(_.isSpotLight){const v=n.spot[p];v.position.setFromMatrixPosition(_.matrixWorld),v.position.applyMatrix4(m),v.direction.setFromMatrixPosition(_.matrixWorld),i.setFromMatrixPosition(_.target.matrixWorld),v.direction.sub(i),v.direction.transformDirection(m),p++}else if(_.isRectAreaLight){const v=n.rectArea[f];v.position.setFromMatrixPosition(_.matrixWorld),v.position.applyMatrix4(m),o.identity(),r.copy(_.matrixWorld),r.premultiply(m),o.extractRotation(r),v.halfWidth.set(_.width*.5,0,0),v.halfHeight.set(0,_.height*.5,0),v.halfWidth.applyMatrix4(o),v.halfHeight.applyMatrix4(o),f++}else if(_.isPointLight){const v=n.point[d];v.position.setFromMatrixPosition(_.matrixWorld),v.position.applyMatrix4(m),d++}else if(_.isHemisphereLight){const v=n.hemi[x];v.direction.setFromMatrixPosition(_.matrixWorld),v.direction.transformDirection(m),x++}}}return{setup:a,setupView:c,state:n}}function cx(s){const e=new CR(s),t=[],n=[];function i(u){l.camera=u,t.length=0,n.length=0}function r(u){t.push(u)}function o(u){n.push(u)}function a(){e.setup(t)}function c(u){e.setupView(t,u)}const l={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:l,setupLights:a,setupLightsView:c,pushLight:r,pushShadow:o}}function RR(s){let e=new WeakMap;function t(i,r=0){const o=e.get(i);let a;return o===void 0?(a=new cx(s),e.set(i,[a])):r>=o.length?(a=new cx(s),o.push(a)):a=o[r],a}function n(){e=new WeakMap}return{get:t,dispose:n}}class Kh extends mn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Qf,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class cm extends mn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const IR=`void main() {
|
|
3791
|
+
`+Q)}else G!==""?console.warn("THREE.WebGLProgram: Program Info Log:",G):(W===""||$==="")&&(q=!1);q&&(b.diagnostics={runnable:ie,programLog:G,vertexShader:{log:W,prefix:m},fragmentShader:{log:$,prefix:g}})}i.deleteShader(I),i.deleteShader(T),C=new Lu(i,x),F=oR(i,x)}let C;this.getUniforms=function(){return C===void 0&&w(this),C};let F;this.getAttributes=function(){return F===void 0&&w(this),F};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=i.getProgramParameter(x,KC)),M},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=jC++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=I,this.fragmentShader=T,this}let _R=0;class yR{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new vR(e),t.set(e,n)),n}}class vR{constructor(e){this.id=_R++,this.code=e,this.usedTimes=0}}function MR(s,e,t,n,i,r,o){const a=new Yc,c=new yR,l=new Set,u=[],h=i.logarithmicDepthBuffer,d=i.reverseDepthBuffer,p=i.vertexTextures;let f=i.precision;const x={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(M){return l.add(M),M===0?"uv":`uv${M}`}function g(M,b,G,W,$){const ie=W.fog,q=$.geometry,he=M.isMeshStandardMaterial?W.environment:null,Q=(M.isMeshStandardMaterial?t:e).get(M.envMap||he),we=Q&&Q.mapping===dr?Q.image.height:null,Ne=x[M.type];M.precision!==null&&(f=i.getMaxPrecision(M.precision),f!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",f,"instead."));const Ee=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,Qe=Ee!==void 0?Ee.length:0;let ht=0;q.morphAttributes.position!==void 0&&(ht=1),q.morphAttributes.normal!==void 0&&(ht=2),q.morphAttributes.color!==void 0&&(ht=3);let ne,ue,Ae,ge;if(Ne){const ii=Pi[Ne];ne=ii.vertexShader,ue=ii.fragmentShader}else ne=M.vertexShader,ue=M.fragmentShader,c.update(M),Ae=c.getVertexShaderID(M),ge=c.getFragmentShaderID(M);const Ze=s.getRenderTarget(),Xe=$.isInstancedMesh===!0,Je=$.isBatchedMesh===!0,dt=!!M.map,ae=!!M.matcap,P=!!Q,Me=!!M.aoMap,ye=!!M.lightMap,de=!!M.bumpMap,Te=!!M.normalMap,qe=!!M.displacementMap,Ie=!!M.emissiveMap,R=!!M.metalnessMap,S=!!M.roughnessMap,X=M.anisotropy>0,re=M.clearcoat>0,ce=M.dispersion>0,se=M.iridescence>0,ke=M.sheen>0,be=M.transmission>0,De=X&&!!M.anisotropyMap,vt=re&&!!M.clearcoatMap,me=re&&!!M.clearcoatNormalMap,Ue=re&&!!M.clearcoatRoughnessMap,tt=se&&!!M.iridescenceMap,nt=se&&!!M.iridescenceThicknessMap,Be=ke&&!!M.sheenColorMap,Mt=ke&&!!M.sheenRoughnessMap,ct=!!M.specularMap,Ot=!!M.specularColorMap,O=!!M.specularIntensityMap,Pe=be&&!!M.transmissionMap,ee=be&&!!M.thicknessMap,le=!!M.gradientMap,Ce=!!M.alphaMap,Le=M.alphaTest>0,bt=!!M.alphaHash,on=!!M.extensions;let ni=Ti;M.toneMapped&&(Ze===null||Ze.isXRRenderTarget===!0)&&(ni=s.toneMapping);const Et={shaderID:Ne,shaderType:M.type,shaderName:M.name,vertexShader:ne,fragmentShader:ue,defines:M.defines,customVertexShaderID:Ae,customFragmentShaderID:ge,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:f,batching:Je,batchingColor:Je&&$._colorsTexture!==null,instancing:Xe,instancingColor:Xe&&$.instanceColor!==null,instancingMorph:Xe&&$.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:Ze===null?s.outputColorSpace:Ze.isXRRenderTarget===!0?Ze.texture.colorSpace:li,alphaToCoverage:!!M.alphaToCoverage,map:dt,matcap:ae,envMap:P,envMapMode:P&&Q.mapping,envMapCubeUVHeight:we,aoMap:Me,lightMap:ye,bumpMap:de,normalMap:Te,displacementMap:p&&qe,emissiveMap:Ie,normalMapObjectSpace:Te&&M.normalMapType===tm,normalMapTangentSpace:Te&&M.normalMapType===xs,metalnessMap:R,roughnessMap:S,anisotropy:X,anisotropyMap:De,clearcoat:re,clearcoatMap:vt,clearcoatNormalMap:me,clearcoatRoughnessMap:Ue,dispersion:ce,iridescence:se,iridescenceMap:tt,iridescenceThicknessMap:nt,sheen:ke,sheenColorMap:Be,sheenRoughnessMap:Mt,specularMap:ct,specularColorMap:Ot,specularIntensityMap:O,transmission:be,transmissionMap:Pe,thicknessMap:ee,gradientMap:le,opaque:M.transparent===!1&&M.blending===Ls&&M.alphaToCoverage===!1,alphaMap:Ce,alphaTest:Le,alphaHash:bt,combine:M.combine,mapUv:dt&&m(M.map.channel),aoMapUv:Me&&m(M.aoMap.channel),lightMapUv:ye&&m(M.lightMap.channel),bumpMapUv:de&&m(M.bumpMap.channel),normalMapUv:Te&&m(M.normalMap.channel),displacementMapUv:qe&&m(M.displacementMap.channel),emissiveMapUv:Ie&&m(M.emissiveMap.channel),metalnessMapUv:R&&m(M.metalnessMap.channel),roughnessMapUv:S&&m(M.roughnessMap.channel),anisotropyMapUv:De&&m(M.anisotropyMap.channel),clearcoatMapUv:vt&&m(M.clearcoatMap.channel),clearcoatNormalMapUv:me&&m(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ue&&m(M.clearcoatRoughnessMap.channel),iridescenceMapUv:tt&&m(M.iridescenceMap.channel),iridescenceThicknessMapUv:nt&&m(M.iridescenceThicknessMap.channel),sheenColorMapUv:Be&&m(M.sheenColorMap.channel),sheenRoughnessMapUv:Mt&&m(M.sheenRoughnessMap.channel),specularMapUv:ct&&m(M.specularMap.channel),specularColorMapUv:Ot&&m(M.specularColorMap.channel),specularIntensityMapUv:O&&m(M.specularIntensityMap.channel),transmissionMapUv:Pe&&m(M.transmissionMap.channel),thicknessMapUv:ee&&m(M.thicknessMap.channel),alphaMapUv:Ce&&m(M.alphaMap.channel),vertexTangents:!!q.attributes.tangent&&(Te||X),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,pointsUvs:$.isPoints===!0&&!!q.attributes.uv&&(dt||Ce),fog:!!ie,useFog:M.fog===!0,fogExp2:!!ie&&ie.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:h,reverseDepthBuffer:d,skinning:$.isSkinnedMesh===!0,morphTargets:q.morphAttributes.position!==void 0,morphNormals:q.morphAttributes.normal!==void 0,morphColors:q.morphAttributes.color!==void 0,morphTargetsCount:Qe,morphTextureStride:ht,numDirLights:b.directional.length,numPointLights:b.point.length,numSpotLights:b.spot.length,numSpotLightMaps:b.spotLightMap.length,numRectAreaLights:b.rectArea.length,numHemiLights:b.hemi.length,numDirLightShadows:b.directionalShadowMap.length,numPointLightShadows:b.pointShadowMap.length,numSpotLightShadows:b.spotShadowMap.length,numSpotLightShadowsWithMaps:b.numSpotLightShadowsWithMaps,numLightProbes:b.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:M.dithering,shadowMapEnabled:s.shadowMap.enabled&&G.length>0,shadowMapType:s.shadowMap.type,toneMapping:ni,decodeVideoTexture:dt&&M.map.isVideoTexture===!0&>.getTransfer(M.map.colorSpace)===Vt,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===Ji,flipSided:M.side===ln,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:on&&M.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(on&&M.extensions.multiDraw===!0||Je)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return Et.vertexUv1s=l.has(1),Et.vertexUv2s=l.has(2),Et.vertexUv3s=l.has(3),l.clear(),Et}function y(M){const b=[];if(M.shaderID?b.push(M.shaderID):(b.push(M.customVertexShaderID),b.push(M.customFragmentShaderID)),M.defines!==void 0)for(const G in M.defines)b.push(G),b.push(M.defines[G]);return M.isRawShaderMaterial===!1&&(_(b,M),v(b,M),b.push(s.outputColorSpace)),b.push(M.customProgramCacheKey),b.join()}function _(M,b){M.push(b.precision),M.push(b.outputColorSpace),M.push(b.envMapMode),M.push(b.envMapCubeUVHeight),M.push(b.mapUv),M.push(b.alphaMapUv),M.push(b.lightMapUv),M.push(b.aoMapUv),M.push(b.bumpMapUv),M.push(b.normalMapUv),M.push(b.displacementMapUv),M.push(b.emissiveMapUv),M.push(b.metalnessMapUv),M.push(b.roughnessMapUv),M.push(b.anisotropyMapUv),M.push(b.clearcoatMapUv),M.push(b.clearcoatNormalMapUv),M.push(b.clearcoatRoughnessMapUv),M.push(b.iridescenceMapUv),M.push(b.iridescenceThicknessMapUv),M.push(b.sheenColorMapUv),M.push(b.sheenRoughnessMapUv),M.push(b.specularMapUv),M.push(b.specularColorMapUv),M.push(b.specularIntensityMapUv),M.push(b.transmissionMapUv),M.push(b.thicknessMapUv),M.push(b.combine),M.push(b.fogExp2),M.push(b.sizeAttenuation),M.push(b.morphTargetsCount),M.push(b.morphAttributeCount),M.push(b.numDirLights),M.push(b.numPointLights),M.push(b.numSpotLights),M.push(b.numSpotLightMaps),M.push(b.numHemiLights),M.push(b.numRectAreaLights),M.push(b.numDirLightShadows),M.push(b.numPointLightShadows),M.push(b.numSpotLightShadows),M.push(b.numSpotLightShadowsWithMaps),M.push(b.numLightProbes),M.push(b.shadowMapType),M.push(b.toneMapping),M.push(b.numClippingPlanes),M.push(b.numClipIntersection),M.push(b.depthPacking)}function v(M,b){a.disableAll(),b.supportsVertexTextures&&a.enable(0),b.instancing&&a.enable(1),b.instancingColor&&a.enable(2),b.instancingMorph&&a.enable(3),b.matcap&&a.enable(4),b.envMap&&a.enable(5),b.normalMapObjectSpace&&a.enable(6),b.normalMapTangentSpace&&a.enable(7),b.clearcoat&&a.enable(8),b.iridescence&&a.enable(9),b.alphaTest&&a.enable(10),b.vertexColors&&a.enable(11),b.vertexAlphas&&a.enable(12),b.vertexUv1s&&a.enable(13),b.vertexUv2s&&a.enable(14),b.vertexUv3s&&a.enable(15),b.vertexTangents&&a.enable(16),b.anisotropy&&a.enable(17),b.alphaHash&&a.enable(18),b.batching&&a.enable(19),b.dispersion&&a.enable(20),b.batchingColor&&a.enable(21),M.push(a.mask),a.disableAll(),b.fog&&a.enable(0),b.useFog&&a.enable(1),b.flatShading&&a.enable(2),b.logarithmicDepthBuffer&&a.enable(3),b.reverseDepthBuffer&&a.enable(4),b.skinning&&a.enable(5),b.morphTargets&&a.enable(6),b.morphNormals&&a.enable(7),b.morphColors&&a.enable(8),b.premultipliedAlpha&&a.enable(9),b.shadowMapEnabled&&a.enable(10),b.doubleSided&&a.enable(11),b.flipSided&&a.enable(12),b.useDepthPacking&&a.enable(13),b.dithering&&a.enable(14),b.transmission&&a.enable(15),b.sheen&&a.enable(16),b.opaque&&a.enable(17),b.pointsUvs&&a.enable(18),b.decodeVideoTexture&&a.enable(19),b.alphaToCoverage&&a.enable(20),M.push(a.mask)}function I(M){const b=x[M.type];let G;if(b){const W=Pi[b];G=om.clone(W.uniforms)}else G=M.uniforms;return G}function T(M,b){let G;for(let W=0,$=u.length;W<$;W++){const ie=u[W];if(ie.cacheKey===b){G=ie,++G.usedTimes;break}}return G===void 0&&(G=new xR(s,b,M,r),u.push(G)),G}function w(M){if(--M.usedTimes===0){const b=u.indexOf(M);u[b]=u[u.length-1],u.pop(),M.destroy()}}function C(M){c.remove(M)}function F(){c.dispose()}return{getParameters:g,getProgramCacheKey:y,getUniforms:I,acquireProgram:T,releaseProgram:w,releaseShaderCache:C,programs:u,dispose:F}}function SR(){let s=new WeakMap;function e(o){return s.has(o)}function t(o){let a=s.get(o);return a===void 0&&(a={},s.set(o,a)),a}function n(o){s.delete(o)}function i(o,a,c){s.get(o)[a]=c}function r(){s=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:r}}function TR(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.z!==e.z?s.z-e.z:s.id-e.id}function ox(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function ax(){const s=[];let e=0;const t=[],n=[],i=[];function r(){e=0,t.length=0,n.length=0,i.length=0}function o(h,d,p,f,x,m){let g=s[e];return g===void 0?(g={id:h.id,object:h,geometry:d,material:p,groupOrder:f,renderOrder:h.renderOrder,z:x,group:m},s[e]=g):(g.id=h.id,g.object=h,g.geometry=d,g.material=p,g.groupOrder=f,g.renderOrder=h.renderOrder,g.z=x,g.group=m),e++,g}function a(h,d,p,f,x,m){const g=o(h,d,p,f,x,m);h.onBeforeRenderListPush?.(h,d,p,m),p.transmission>0?n.push(g):p.transparent===!0?i.push(g):t.push(g),h.onAfterRenderListPush?.(h,d,p,m)}function c(h,d,p,f,x,m){const g=o(h,d,p,f,x,m);p.transmission>0?n.unshift(g):p.transparent===!0?i.unshift(g):t.unshift(g)}function l(h,d){t.length>1&&t.sort(h||TR),n.length>1&&n.sort(d||ox),i.length>1&&i.sort(d||ox)}function u(){for(let h=e,d=s.length;h<d;h++){const p=s[h];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:n,transparent:i,init:r,push:a,unshift:c,finish:u,sort:l}}function bR(){let s=new WeakMap;function e(n,i){const r=s.get(n);let o;return r===void 0?(o=new ax,s.set(n,[o])):i>=r.length?(o=new ax,r.push(o)):o=r[i],o}function t(){s=new WeakMap}return{get:e,dispose:t}}function wR(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new E,color:new _e};break;case"SpotLight":t={position:new E,direction:new E,color:new _e,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new E,color:new _e,distance:0,decay:0};break;case"HemisphereLight":t={direction:new E,skyColor:new _e,groundColor:new _e};break;case"RectAreaLight":t={color:new _e,position:new E,halfWidth:new E,halfHeight:new E};break}return s[e.id]=t,t}}}function AR(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new J};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new J};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new J,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}let NR=0;function ER(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function CR(s){const e=new wR,t=AR(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let l=0;l<9;l++)n.probe.push(new E);const i=new E,r=new Fe,o=new Fe;function a(l){let u=0,h=0,d=0;for(let F=0;F<9;F++)n.probe[F].set(0,0,0);let p=0,f=0,x=0,m=0,g=0,y=0,_=0,v=0,I=0,T=0,w=0;l.sort(ER);for(let F=0,M=l.length;F<M;F++){const b=l[F],G=b.color,W=b.intensity,$=b.distance,ie=b.shadow&&b.shadow.map?b.shadow.map.texture:null;if(b.isAmbientLight)u+=G.r*W,h+=G.g*W,d+=G.b*W;else if(b.isLightProbe){for(let q=0;q<9;q++)n.probe[q].addScaledVector(b.sh.coefficients[q],W);w++}else if(b.isDirectionalLight){const q=e.get(b);if(q.color.copy(b.color).multiplyScalar(b.intensity),b.castShadow){const he=b.shadow,Q=t.get(b);Q.shadowIntensity=he.intensity,Q.shadowBias=he.bias,Q.shadowNormalBias=he.normalBias,Q.shadowRadius=he.radius,Q.shadowMapSize=he.mapSize,n.directionalShadow[p]=Q,n.directionalShadowMap[p]=ie,n.directionalShadowMatrix[p]=b.shadow.matrix,y++}n.directional[p]=q,p++}else if(b.isSpotLight){const q=e.get(b);q.position.setFromMatrixPosition(b.matrixWorld),q.color.copy(G).multiplyScalar(W),q.distance=$,q.coneCos=Math.cos(b.angle),q.penumbraCos=Math.cos(b.angle*(1-b.penumbra)),q.decay=b.decay,n.spot[x]=q;const he=b.shadow;if(b.map&&(n.spotLightMap[I]=b.map,I++,he.updateMatrices(b),b.castShadow&&T++),n.spotLightMatrix[x]=he.matrix,b.castShadow){const Q=t.get(b);Q.shadowIntensity=he.intensity,Q.shadowBias=he.bias,Q.shadowNormalBias=he.normalBias,Q.shadowRadius=he.radius,Q.shadowMapSize=he.mapSize,n.spotShadow[x]=Q,n.spotShadowMap[x]=ie,v++}x++}else if(b.isRectAreaLight){const q=e.get(b);q.color.copy(G).multiplyScalar(W),q.halfWidth.set(b.width*.5,0,0),q.halfHeight.set(0,b.height*.5,0),n.rectArea[m]=q,m++}else if(b.isPointLight){const q=e.get(b);if(q.color.copy(b.color).multiplyScalar(b.intensity),q.distance=b.distance,q.decay=b.decay,b.castShadow){const he=b.shadow,Q=t.get(b);Q.shadowIntensity=he.intensity,Q.shadowBias=he.bias,Q.shadowNormalBias=he.normalBias,Q.shadowRadius=he.radius,Q.shadowMapSize=he.mapSize,Q.shadowCameraNear=he.camera.near,Q.shadowCameraFar=he.camera.far,n.pointShadow[f]=Q,n.pointShadowMap[f]=ie,n.pointShadowMatrix[f]=b.shadow.matrix,_++}n.point[f]=q,f++}else if(b.isHemisphereLight){const q=e.get(b);q.skyColor.copy(b.color).multiplyScalar(W),q.groundColor.copy(b.groundColor).multiplyScalar(W),n.hemi[g]=q,g++}}m>0&&(s.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Se.LTC_FLOAT_1,n.rectAreaLTC2=Se.LTC_FLOAT_2):(n.rectAreaLTC1=Se.LTC_HALF_1,n.rectAreaLTC2=Se.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=d;const C=n.hash;(C.directionalLength!==p||C.pointLength!==f||C.spotLength!==x||C.rectAreaLength!==m||C.hemiLength!==g||C.numDirectionalShadows!==y||C.numPointShadows!==_||C.numSpotShadows!==v||C.numSpotMaps!==I||C.numLightProbes!==w)&&(n.directional.length=p,n.spot.length=x,n.rectArea.length=m,n.point.length=f,n.hemi.length=g,n.directionalShadow.length=y,n.directionalShadowMap.length=y,n.pointShadow.length=_,n.pointShadowMap.length=_,n.spotShadow.length=v,n.spotShadowMap.length=v,n.directionalShadowMatrix.length=y,n.pointShadowMatrix.length=_,n.spotLightMatrix.length=v+I-T,n.spotLightMap.length=I,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=w,C.directionalLength=p,C.pointLength=f,C.spotLength=x,C.rectAreaLength=m,C.hemiLength=g,C.numDirectionalShadows=y,C.numPointShadows=_,C.numSpotShadows=v,C.numSpotMaps=I,C.numLightProbes=w,n.version=NR++)}function c(l,u){let h=0,d=0,p=0,f=0,x=0;const m=u.matrixWorldInverse;for(let g=0,y=l.length;g<y;g++){const _=l[g];if(_.isDirectionalLight){const v=n.directional[h];v.direction.setFromMatrixPosition(_.matrixWorld),i.setFromMatrixPosition(_.target.matrixWorld),v.direction.sub(i),v.direction.transformDirection(m),h++}else if(_.isSpotLight){const v=n.spot[p];v.position.setFromMatrixPosition(_.matrixWorld),v.position.applyMatrix4(m),v.direction.setFromMatrixPosition(_.matrixWorld),i.setFromMatrixPosition(_.target.matrixWorld),v.direction.sub(i),v.direction.transformDirection(m),p++}else if(_.isRectAreaLight){const v=n.rectArea[f];v.position.setFromMatrixPosition(_.matrixWorld),v.position.applyMatrix4(m),o.identity(),r.copy(_.matrixWorld),r.premultiply(m),o.extractRotation(r),v.halfWidth.set(_.width*.5,0,0),v.halfHeight.set(0,_.height*.5,0),v.halfWidth.applyMatrix4(o),v.halfHeight.applyMatrix4(o),f++}else if(_.isPointLight){const v=n.point[d];v.position.setFromMatrixPosition(_.matrixWorld),v.position.applyMatrix4(m),d++}else if(_.isHemisphereLight){const v=n.hemi[x];v.direction.setFromMatrixPosition(_.matrixWorld),v.direction.transformDirection(m),x++}}}return{setup:a,setupView:c,state:n}}function cx(s){const e=new CR(s),t=[],n=[];function i(u){l.camera=u,t.length=0,n.length=0}function r(u){t.push(u)}function o(u){n.push(u)}function a(){e.setup(t)}function c(u){e.setupView(t,u)}const l={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:l,setupLights:a,setupLightsView:c,pushLight:r,pushShadow:o}}function RR(s){let e=new WeakMap;function t(i,r=0){const o=e.get(i);let a;return o===void 0?(a=new cx(s),e.set(i,[a])):r>=o.length?(a=new cx(s),o.push(a)):a=o[r],a}function n(){e=new WeakMap}return{get:t,dispose:n}}class Kh extends mn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Qf,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class cm extends mn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const IR=`void main() {
|
|
3792
3792
|
gl_Position = vec4( position, 1.0 );
|
|
3793
3793
|
}`,PR=`uniform sampler2D shadow_pass;
|
|
3794
3794
|
uniform vec2 resolution;
|
|
@@ -3840,7 +3840,7 @@ void main() {
|
|
|
3840
3840
|
|
|
3841
3841
|
}
|
|
3842
3842
|
|
|
3843
|
-
}`;class XR{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new Xt,r=e.properties.get(i);r.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new ki({vertexShader:HR,fragmentShader:WR,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new kt(new oo(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class qR extends Ai{constructor(e,t){super();const n=this;let i=null,r=1,o=null,a="local-floor",c=1,l=null,u=null,h=null,d=null,p=null,f=null;const x=new XR,m=t.getContextAttributes();let g=null,y=null;const _=[],v=[],I=new J;let T=null;const w=new hn;w.layers.enable(1),w.viewport=new st;const C=new hn;C.layers.enable(2),C.viewport=new st;const F=[w,C],M=new lm;M.layers.enable(1),M.layers.enable(2);let b=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.controllerAutoUpdate=!0,this.getController=function(ne){let ue=_[ne];return ue===void 0&&(ue=new Sp,_[ne]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function(ne){let ue=_[ne];return ue===void 0&&(ue=new Sp,_[ne]=ue),ue.getGripSpace()},this.getHand=function(ne){let ue=_[ne];return ue===void 0&&(ue=new Sp,_[ne]=ue),ue.getHandSpace()};function W(ne){const ue=v.indexOf(ne.inputSource);if(ue===-1)return;const Ae=_[ue];Ae!==void 0&&(Ae.update(ne.inputSource,ne.frame,l||o),Ae.dispatchEvent({type:ne.type,data:ne.inputSource}))}function $(){i.removeEventListener("select",W),i.removeEventListener("selectstart",W),i.removeEventListener("selectend",W),i.removeEventListener("squeeze",W),i.removeEventListener("squeezestart",W),i.removeEventListener("squeezeend",W),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",ie);for(let ne=0;ne<_.length;ne++){const ue=v[ne];ue!==null&&(v[ne]=null,_[ne]&&_[ne].disconnect(ue))}b=null,G=null,x.reset(),e.setRenderTarget(g),p=null,d=null,h=null,i=null,y=null,ht.stop(),n.isPresenting=!1,e.setPixelRatio(T),e.setSize(I.width,I.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ne){r=ne,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ne){a=ne,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(ne){l=ne},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return h},this.getFrame=function(){return f},this.getSession=function(){return i},this.setSession=async function(ne){if(i=ne,i!==null){if(g=e.getRenderTarget(),i.addEventListener("select",W),i.addEventListener("selectstart",W),i.addEventListener("selectend",W),i.addEventListener("squeeze",W),i.addEventListener("squeezestart",W),i.addEventListener("squeezeend",W),i.addEventListener("end",$),i.addEventListener("inputsourceschange",ie),m.xrCompatible!==!0&&await t.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(I),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let Ae=null,ge=null,Ze=null;m.depth&&(Ze=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Ae=m.stencil?cr:er,ge=m.stencil?ar:Bi);const Xe={colorFormat:t.RGBA8,depthFormat:Ze,scaleFactor:r};h=new XRWebGLBinding(i,t),d=h.createProjectionLayer(Xe),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),y=new zi(d.textureWidth,d.textureHeight,{format:Rn,type:es,depthTexture:new co(d.textureWidth,d.textureHeight,ge,void 0,void 0,void 0,void 0,void 0,void 0,Ae),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1})}else{const Ae={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};p=new XRWebGLLayer(i,t,Ae),i.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),y=new zi(p.framebufferWidth,p.framebufferHeight,{format:Rn,type:es,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}y.isXRRenderTarget=!0,this.setFoveation(c),l=null,o=await i.requestReferenceSpace(a),ht.setContext(i),ht.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function ie(ne){for(let ue=0;ue<ne.removed.length;ue++){const Ae=ne.removed[ue],ge=v.indexOf(Ae);ge>=0&&(v[ge]=null,_[ge]&&_[ge].disconnect(Ae))}for(let ue=0;ue<ne.added.length;ue++){const Ae=ne.added[ue];let ge=v.indexOf(Ae);if(ge===-1){for(let Xe=0;Xe<_.length;Xe++)if(Xe>=v.length){v.push(Ae),ge=Xe;break}else if(v[Xe]===null){v[Xe]=Ae,ge=Xe;break}if(ge===-1)break}const Ze=_[ge];Ze&&Ze.connect(Ae)}}const q=new E,he=new E;function Q(ne,ue,Ae){q.setFromMatrixPosition(ue.matrixWorld),he.setFromMatrixPosition(Ae.matrixWorld);const ge=q.distanceTo(he),Ze=ue.projectionMatrix.elements,Xe=Ae.projectionMatrix.elements,Je=Ze[14]/(Ze[10]-1),dt=Ze[14]/(Ze[10]+1),ae=(Ze[9]+1)/Ze[5],P=(Ze[9]-1)/Ze[5],Me=(Ze[8]-1)/Ze[0],ye=(Xe[8]+1)/Xe[0],de=Je*Me,Te=Je*ye,qe=ge/(-Me+ye),Ie=qe*-Me;if(ue.matrixWorld.decompose(ne.position,ne.quaternion,ne.scale),ne.translateX(Ie),ne.translateZ(qe),ne.matrixWorld.compose(ne.position,ne.quaternion,ne.scale),ne.matrixWorldInverse.copy(ne.matrixWorld).invert(),Ze[10]===-1)ne.projectionMatrix.copy(ue.projectionMatrix),ne.projectionMatrixInverse.copy(ue.projectionMatrixInverse);else{const R=Je+qe,S=dt+qe,X=de-Ie,re=Te+(ge-Ie),ce=ae*dt/S*R,se=P*dt/S*R;ne.projectionMatrix.makePerspective(X,re,ce,se,R,S),ne.projectionMatrixInverse.copy(ne.projectionMatrix).invert()}}function we(ne,ue){ue===null?ne.matrixWorld.copy(ne.matrix):ne.matrixWorld.multiplyMatrices(ue.matrixWorld,ne.matrix),ne.matrixWorldInverse.copy(ne.matrixWorld).invert()}this.updateCamera=function(ne){if(i===null)return;let ue=ne.near,Ae=ne.far;x.texture!==null&&(x.depthNear>0&&(ue=x.depthNear),x.depthFar>0&&(Ae=x.depthFar)),M.near=C.near=w.near=ue,M.far=C.far=w.far=Ae,(b!==M.near||G!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),b=M.near,G=M.far);const ge=ne.parent,Ze=M.cameras;we(M,ge);for(let Xe=0;Xe<Ze.length;Xe++)we(Ze[Xe],ge);Ze.length===2?Q(M,w,C):M.projectionMatrix.copy(w.projectionMatrix),Ne(ne,M,ge)};function Ne(ne,ue,Ae){Ae===null?ne.matrix.copy(ue.matrixWorld):(ne.matrix.copy(Ae.matrixWorld),ne.matrix.invert(),ne.matrix.multiply(ue.matrixWorld)),ne.matrix.decompose(ne.position,ne.quaternion,ne.scale),ne.updateMatrixWorld(!0),ne.projectionMatrix.copy(ue.projectionMatrix),ne.projectionMatrixInverse.copy(ue.projectionMatrixInverse),ne.isPerspectiveCamera&&(ne.fov=oa*2*Math.atan(1/ne.projectionMatrix.elements[5]),ne.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(d===null&&p===null))return c},this.setFoveation=function(ne){c=ne,d!==null&&(d.fixedFoveation=ne),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=ne)},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(M)};let Ee=null;function Qe(ne,ue){if(u=ue.getViewerPose(l||o),f=ue,u!==null){const Ae=u.views;p!==null&&(e.setRenderTargetFramebuffer(y,p.framebuffer),e.setRenderTarget(y));let ge=!1;Ae.length!==M.cameras.length&&(M.cameras.length=0,ge=!0);for(let Xe=0;Xe<Ae.length;Xe++){const Je=Ae[Xe];let dt=null;if(p!==null)dt=p.getViewport(Je);else{const P=h.getViewSubImage(d,Je);dt=P.viewport,Xe===0&&(e.setRenderTargetTextures(y,P.colorTexture,d.ignoreDepthValues?void 0:P.depthStencilTexture),e.setRenderTarget(y))}let ae=F[Xe];ae===void 0&&(ae=new hn,ae.layers.enable(Xe),ae.viewport=new st,F[Xe]=ae),ae.matrix.fromArray(Je.transform.matrix),ae.matrix.decompose(ae.position,ae.quaternion,ae.scale),ae.projectionMatrix.fromArray(Je.projectionMatrix),ae.projectionMatrixInverse.copy(ae.projectionMatrix).invert(),ae.viewport.set(dt.x,dt.y,dt.width,dt.height),Xe===0&&(M.matrix.copy(ae.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),ge===!0&&M.cameras.push(ae)}const Ze=i.enabledFeatures;if(Ze&&Ze.includes("depth-sensing")){const Xe=h.getDepthInformation(Ae[0]);Xe&&Xe.isValid&&Xe.texture&&x.init(e,Xe,i.renderState)}}if(n.controllerAutoUpdate)for(let Ae=0;Ae<_.length;Ae++){const ge=v[Ae],Ze=_[Ae];ge!==null&&Ze!==void 0&&Ze.update(ge,ue,l||o)}Ee&&Ee(ne,ue),ue.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ue}),f=null}const ht=new qy;ht.setAnimationLoop(Qe),this.setAnimationLoop=function(ne){Ee=ne},this.dispose=function(){}}}const Nr=new ui,$R=new Fe;function YR(s,e){function t(m,g){m.matrixAutoUpdate===!0&&m.updateMatrix(),g.value.copy(m.matrix)}function n(m,g){g.color.getRGB(m.fogColor.value,Xy(s)),g.isFog?(m.fogNear.value=g.near,m.fogFar.value=g.far):g.isFogExp2&&(m.fogDensity.value=g.density)}function i(m,g,y,_,v){g.isMeshBasicMaterial||g.isMeshLambertMaterial?r(m,g):g.isMeshToonMaterial?(r(m,g),h(m,g)):g.isMeshPhongMaterial?(r(m,g),u(m,g)):g.isMeshStandardMaterial?(r(m,g),d(m,g),g.isMeshPhysicalMaterial&&p(m,g,v)):g.isMeshMatcapMaterial?(r(m,g),f(m,g)):g.isMeshDepthMaterial?r(m,g):g.isMeshDistanceMaterial?(r(m,g),x(m,g)):g.isMeshNormalMaterial?r(m,g):g.isLineBasicMaterial?(o(m,g),g.isLineDashedMaterial&&a(m,g)):g.isPointsMaterial?c(m,g,y,_):g.isSpriteMaterial?l(m,g):g.isShadowMaterial?(m.color.value.copy(g.color),m.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function r(m,g){m.opacity.value=g.opacity,g.color&&m.diffuse.value.copy(g.color),g.emissive&&m.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(m.map.value=g.map,t(g.map,m.mapTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,t(g.alphaMap,m.alphaMapTransform)),g.bumpMap&&(m.bumpMap.value=g.bumpMap,t(g.bumpMap,m.bumpMapTransform),m.bumpScale.value=g.bumpScale,g.side===ln&&(m.bumpScale.value*=-1)),g.normalMap&&(m.normalMap.value=g.normalMap,t(g.normalMap,m.normalMapTransform),m.normalScale.value.copy(g.normalScale),g.side===ln&&m.normalScale.value.negate()),g.displacementMap&&(m.displacementMap.value=g.displacementMap,t(g.displacementMap,m.displacementMapTransform),m.displacementScale.value=g.displacementScale,m.displacementBias.value=g.displacementBias),g.emissiveMap&&(m.emissiveMap.value=g.emissiveMap,t(g.emissiveMap,m.emissiveMapTransform)),g.specularMap&&(m.specularMap.value=g.specularMap,t(g.specularMap,m.specularMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);const y=e.get(g),_=y.envMap,v=y.envMapRotation;_&&(m.envMap.value=_,Nr.copy(v),Nr.x*=-1,Nr.y*=-1,Nr.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(Nr.y*=-1,Nr.z*=-1),m.envMapRotation.value.setFromMatrix4($R.makeRotationFromEuler(Nr)),m.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=g.reflectivity,m.ior.value=g.ior,m.refractionRatio.value=g.refractionRatio),g.lightMap&&(m.lightMap.value=g.lightMap,m.lightMapIntensity.value=g.lightMapIntensity,t(g.lightMap,m.lightMapTransform)),g.aoMap&&(m.aoMap.value=g.aoMap,m.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,m.aoMapTransform))}function o(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,g.map&&(m.map.value=g.map,t(g.map,m.mapTransform))}function a(m,g){m.dashSize.value=g.dashSize,m.totalSize.value=g.dashSize+g.gapSize,m.scale.value=g.scale}function c(m,g,y,_){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.size.value=g.size*y,m.scale.value=_*.5,g.map&&(m.map.value=g.map,t(g.map,m.uvTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,t(g.alphaMap,m.alphaMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest)}function l(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.rotation.value=g.rotation,g.map&&(m.map.value=g.map,t(g.map,m.mapTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,t(g.alphaMap,m.alphaMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest)}function u(m,g){m.specular.value.copy(g.specular),m.shininess.value=Math.max(g.shininess,1e-4)}function h(m,g){g.gradientMap&&(m.gradientMap.value=g.gradientMap)}function d(m,g){m.metalness.value=g.metalness,g.metalnessMap&&(m.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,m.metalnessMapTransform)),m.roughness.value=g.roughness,g.roughnessMap&&(m.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,m.roughnessMapTransform)),g.envMap&&(m.envMapIntensity.value=g.envMapIntensity)}function p(m,g,y){m.ior.value=g.ior,g.sheen>0&&(m.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),m.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(m.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,m.sheenColorMapTransform)),g.sheenRoughnessMap&&(m.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,m.sheenRoughnessMapTransform))),g.clearcoat>0&&(m.clearcoat.value=g.clearcoat,m.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(m.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,m.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(m.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===ln&&m.clearcoatNormalScale.value.negate())),g.dispersion>0&&(m.dispersion.value=g.dispersion),g.iridescence>0&&(m.iridescence.value=g.iridescence,m.iridescenceIOR.value=g.iridescenceIOR,m.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(m.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,m.iridescenceMapTransform)),g.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),g.transmission>0&&(m.transmission.value=g.transmission,m.transmissionSamplerMap.value=y.texture,m.transmissionSamplerSize.value.set(y.width,y.height),g.transmissionMap&&(m.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,m.transmissionMapTransform)),m.thickness.value=g.thickness,g.thicknessMap&&(m.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=g.attenuationDistance,m.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(m.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(m.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=g.specularIntensity,m.specularColor.value.copy(g.specularColor),g.specularColorMap&&(m.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,m.specularColorMapTransform)),g.specularIntensityMap&&(m.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,m.specularIntensityMapTransform))}function f(m,g){g.matcap&&(m.matcap.value=g.matcap)}function x(m,g){const y=e.get(g).light;m.referencePosition.value.setFromMatrixPosition(y.matrixWorld),m.nearDistance.value=y.shadow.camera.near,m.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function ZR(s,e,t,n){let i={},r={},o=[];const a=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function c(y,_){const v=_.program;n.uniformBlockBinding(y,v)}function l(y,_){let v=i[y.id];v===void 0&&(f(y),v=u(y),i[y.id]=v,y.addEventListener("dispose",m));const I=_.program;n.updateUBOMapping(y,I);const T=e.render.frame;r[y.id]!==T&&(d(y),r[y.id]=T)}function u(y){const _=h();y.__bindingPointIndex=_;const v=s.createBuffer(),I=y.__size,T=y.usage;return s.bindBuffer(s.UNIFORM_BUFFER,v),s.bufferData(s.UNIFORM_BUFFER,I,T),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,_,v),v}function h(){for(let y=0;y<a;y++)if(o.indexOf(y)===-1)return o.push(y),y;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(y){const _=i[y.id],v=y.uniforms,I=y.__cache;s.bindBuffer(s.UNIFORM_BUFFER,_);for(let T=0,w=v.length;T<w;T++){const C=Array.isArray(v[T])?v[T]:[v[T]];for(let F=0,M=C.length;F<M;F++){const b=C[F];if(p(b,T,F,I)===!0){const G=b.__offset,W=Array.isArray(b.value)?b.value:[b.value];let $=0;for(let ie=0;ie<W.length;ie++){const q=W[ie],he=x(q);typeof q=="number"||typeof q=="boolean"?(b.__data[0]=q,s.bufferSubData(s.UNIFORM_BUFFER,G+$,b.__data)):q.isMatrix3?(b.__data[0]=q.elements[0],b.__data[1]=q.elements[1],b.__data[2]=q.elements[2],b.__data[3]=0,b.__data[4]=q.elements[3],b.__data[5]=q.elements[4],b.__data[6]=q.elements[5],b.__data[7]=0,b.__data[8]=q.elements[6],b.__data[9]=q.elements[7],b.__data[10]=q.elements[8],b.__data[11]=0):(q.toArray(b.__data,$),$+=he.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,G,b.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function p(y,_,v,I){const T=y.value,w=_+"_"+v;if(I[w]===void 0)return typeof T=="number"||typeof T=="boolean"?I[w]=T:I[w]=T.clone(),!0;{const C=I[w];if(typeof T=="number"||typeof T=="boolean"){if(C!==T)return I[w]=T,!0}else if(C.equals(T)===!1)return C.copy(T),!0}return!1}function f(y){const _=y.uniforms;let v=0;const I=16;for(let w=0,C=_.length;w<C;w++){const F=Array.isArray(_[w])?_[w]:[_[w]];for(let M=0,b=F.length;M<b;M++){const G=F[M],W=Array.isArray(G.value)?G.value:[G.value];for(let $=0,ie=W.length;$<ie;$++){const q=W[$],he=x(q),Q=v%I,we=Q%he.boundary,Ne=Q+we;v+=we,Ne!==0&&I-Ne<he.storage&&(v+=I-Ne),G.__data=new Float32Array(he.storage/Float32Array.BYTES_PER_ELEMENT),G.__offset=v,v+=he.storage}}}const T=v%I;return T>0&&(v+=I-T),y.__size=v,y.__cache={},this}function x(y){const _={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(_.boundary=4,_.storage=4):y.isVector2?(_.boundary=8,_.storage=8):y.isVector3||y.isColor?(_.boundary=16,_.storage=12):y.isVector4?(_.boundary=16,_.storage=16):y.isMatrix3?(_.boundary=48,_.storage=48):y.isMatrix4?(_.boundary=64,_.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),_}function m(y){const _=y.target;_.removeEventListener("dispose",m);const v=o.indexOf(_.__bindingPointIndex);o.splice(v,1),s.deleteBuffer(i[_.id]),delete i[_.id],delete r[_.id]}function g(){for(const y in i)s.deleteBuffer(i[y]);o=[],i={},r={}}return{bind:c,update:l,dispose:g}}class jy{constructor(e={}){const{canvas:t=zy(),context:n=null,depth:i=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=o;const p=new Uint32Array(4),f=new Int32Array(4);let x=null,m=null;const g=[],y=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=kn,this.toneMapping=Ti,this.toneMappingExposure=1;const _=this;let v=!1,I=0,T=0,w=null,C=-1,F=null;const M=new st,b=new st;let G=null;const W=new _e(0);let $=0,ie=t.width,q=t.height,he=1,Q=null,we=null;const Ne=new st(0,0,ie,q),Ee=new st(0,0,ie,q);let Qe=!1;const ht=new xa;let ne=!1,ue=!1;const Ae=new Fe,ge=new Fe,Ze=new E,Xe=new st,Je={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let dt=!1;function ae(){return w===null?he:1}let P=n;function Me(N,B){return t.getContext(N,B)}try{const N={alpha:!0,depth:i,stencil:r,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${js}`),t.addEventListener("webglcontextlost",le,!1),t.addEventListener("webglcontextrestored",Ce,!1),t.addEventListener("webglcontextcreationerror",Le,!1),P===null){const B="webgl2";if(P=Me(B,N),P===null)throw Me(B)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(N){throw console.error("THREE.WebGLRenderer: "+N.message),N}let ye,de,Te,qe,Ie,R,S,X,re,ce,se,ke,be,De,vt,me,Ue,tt,nt,Be,Mt,ct,Ot,O;function Pe(){ye=new tC(P),ye.init(),ct=new Ky(P,ye),de=new JE(P,ye,e,ct),Te=new UR(P),de.reverseDepthBuffer&&Te.buffers.depth.setReversed(!0),qe=new sC(P),Ie=new SR,R=new kR(P,ye,Te,Ie,de,ct,qe),S=new jE(_),X=new eC(_),re=new d1(P),Ot=new YE(P,re),ce=new nC(P,re,qe,Ot),se=new oC(P,ce,re,qe),nt=new rC(P,de,R),me=new KE(Ie),ke=new MR(_,S,X,ye,de,Ot,me),be=new YR(_,Ie),De=new bR,vt=new RR(ye),tt=new $E(_,S,X,Te,se,d,c),Ue=new LR(_,se,de),O=new ZR(P,qe,de,Te),Be=new ZE(P,ye,qe),Mt=new iC(P,ye,qe),qe.programs=ke.programs,_.capabilities=de,_.extensions=ye,_.properties=Ie,_.renderLists=De,_.shadowMap=Ue,_.state=Te,_.info=qe}Pe();const ee=new qR(_,P);this.xr=ee,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const N=ye.get("WEBGL_lose_context");N&&N.loseContext()},this.forceContextRestore=function(){const N=ye.get("WEBGL_lose_context");N&&N.restoreContext()},this.getPixelRatio=function(){return he},this.setPixelRatio=function(N){N!==void 0&&(he=N,this.setSize(ie,q,!1))},this.getSize=function(N){return N.set(ie,q)},this.setSize=function(N,B,Y=!0){if(ee.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}ie=N,q=B,t.width=Math.floor(N*he),t.height=Math.floor(B*he),Y===!0&&(t.style.width=N+"px",t.style.height=B+"px"),this.setViewport(0,0,N,B)},this.getDrawingBufferSize=function(N){return N.set(ie*he,q*he).floor()},this.setDrawingBufferSize=function(N,B,Y){ie=N,q=B,he=Y,t.width=Math.floor(N*Y),t.height=Math.floor(B*Y),this.setViewport(0,0,N,B)},this.getCurrentViewport=function(N){return N.copy(M)},this.getViewport=function(N){return N.copy(Ne)},this.setViewport=function(N,B,Y,Z){N.isVector4?Ne.set(N.x,N.y,N.z,N.w):Ne.set(N,B,Y,Z),Te.viewport(M.copy(Ne).multiplyScalar(he).round())},this.getScissor=function(N){return N.copy(Ee)},this.setScissor=function(N,B,Y,Z){N.isVector4?Ee.set(N.x,N.y,N.z,N.w):Ee.set(N,B,Y,Z),Te.scissor(b.copy(Ee).multiplyScalar(he).round())},this.getScissorTest=function(){return Qe},this.setScissorTest=function(N){Te.setScissorTest(Qe=N)},this.setOpaqueSort=function(N){Q=N},this.setTransparentSort=function(N){we=N},this.getClearColor=function(N){return N.copy(tt.getClearColor())},this.setClearColor=function(){tt.setClearColor.apply(tt,arguments)},this.getClearAlpha=function(){return tt.getClearAlpha()},this.setClearAlpha=function(){tt.setClearAlpha.apply(tt,arguments)},this.clear=function(N=!0,B=!0,Y=!0){let Z=0;if(N){let k=!1;if(w!==null){const xe=w.texture.format;k=xe===Gh||xe===kh||xe===Xc}if(k){const xe=w.texture.type,Re=xe===es||xe===Bi||xe===na||xe===ar||xe===Fh||xe===Oh,ze=tt.getClearColor(),Ge=tt.getClearAlpha(),je=ze.r,et=ze.g,He=ze.b;Re?(p[0]=je,p[1]=et,p[2]=He,p[3]=Ge,P.clearBufferuiv(P.COLOR,0,p)):(f[0]=je,f[1]=et,f[2]=He,f[3]=Ge,P.clearBufferiv(P.COLOR,0,f))}else Z|=P.COLOR_BUFFER_BIT}B&&(Z|=P.DEPTH_BUFFER_BIT,P.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Y&&(Z|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),P.clear(Z)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",le,!1),t.removeEventListener("webglcontextrestored",Ce,!1),t.removeEventListener("webglcontextcreationerror",Le,!1),De.dispose(),vt.dispose(),Ie.dispose(),S.dispose(),X.dispose(),se.dispose(),Ot.dispose(),O.dispose(),ke.dispose(),ee.dispose(),ee.removeEventListener("sessionstart",f0),ee.removeEventListener("sessionend",m0),Mr.stop()};function le(N){N.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function Ce(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;const N=qe.autoReset,B=Ue.enabled,Y=Ue.autoUpdate,Z=Ue.needsUpdate,k=Ue.type;Pe(),qe.autoReset=N,Ue.enabled=B,Ue.autoUpdate=Y,Ue.needsUpdate=Z,Ue.type=k}function Le(N){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",N.statusMessage)}function bt(N){const B=N.target;B.removeEventListener("dispose",bt),on(B)}function on(N){ni(N),Ie.remove(N)}function ni(N){const B=Ie.get(N).programs;B!==void 0&&(B.forEach(function(Y){ke.releaseProgram(Y)}),N.isShaderMaterial&&ke.releaseShaderCache(N))}this.renderBufferDirect=function(N,B,Y,Z,k,xe){B===null&&(B=Je);const Re=k.isMesh&&k.matrixWorld.determinant()<0,ze=tA(N,B,Y,Z,k);Te.setMaterial(Z,Re);let Ge=Y.index,je=1;if(Z.wireframe===!0){if(Ge=ce.getWireframeAttribute(Y),Ge===void 0)return;je=2}const et=Y.drawRange,He=Y.attributes.position;let Lt=et.start*je,Gt=(et.start+et.count)*je;xe!==null&&(Lt=Math.max(Lt,xe.start*je),Gt=Math.min(Gt,(xe.start+xe.count)*je)),Ge!==null?(Lt=Math.max(Lt,0),Gt=Math.min(Gt,Ge.count)):He!=null&&(Lt=Math.max(Lt,0),Gt=Math.min(Gt,He.count));const Jt=Gt-Lt;if(Jt<0||Jt===1/0)return;Ot.setup(k,Z,ze,Y,Ge);let fi,Rt=Be;if(Ge!==null&&(fi=re.get(Ge),Rt=Mt,Rt.setIndex(fi)),k.isMesh)Z.wireframe===!0?(Te.setLineWidth(Z.wireframeLinewidth*ae()),Rt.setMode(P.LINES)):Rt.setMode(P.TRIANGLES);else if(k.isLine){let $e=Z.linewidth;$e===void 0&&($e=1),Te.setLineWidth($e*ae()),k.isLineSegments?Rt.setMode(P.LINES):k.isLineLoop?Rt.setMode(P.LINE_LOOP):Rt.setMode(P.LINE_STRIP)}else k.isPoints?Rt.setMode(P.POINTS):k.isSprite&&Rt.setMode(P.TRIANGLES);if(k.isBatchedMesh)if(k._multiDrawInstances!==null)Rt.renderMultiDrawInstances(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount,k._multiDrawInstances);else if(ye.get("WEBGL_multi_draw"))Rt.renderMultiDraw(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount);else{const $e=k._multiDrawStarts,An=k._multiDrawCounts,It=k._multiDrawCount,Xi=Ge?re.get(Ge).bytesPerElement:1,mo=Ie.get(Z).currentProgram.getUniforms();for(let mi=0;mi<It;mi++)mo.setValue(P,"_gl_DrawID",mi),Rt.render($e[mi]/Xi,An[mi])}else if(k.isInstancedMesh)Rt.renderInstances(Lt,Jt,k.count);else if(Y.isInstancedBufferGeometry){const $e=Y._maxInstanceCount!==void 0?Y._maxInstanceCount:1/0,An=Math.min(Y.instanceCount,$e);Rt.renderInstances(Lt,Jt,An)}else Rt.render(Lt,Jt)};function Et(N,B,Y){N.transparent===!0&&N.side===Ji&&N.forceSinglePass===!1?(N.side=ln,N.needsUpdate=!0,wl(N,B,Y),N.side=gs,N.needsUpdate=!0,wl(N,B,Y),N.side=Ji):wl(N,B,Y)}this.compile=function(N,B,Y=null){Y===null&&(Y=N),m=vt.get(Y),m.init(B),y.push(m),Y.traverseVisible(function(k){k.isLight&&k.layers.test(B.layers)&&(m.pushLight(k),k.castShadow&&m.pushShadow(k))}),N!==Y&&N.traverseVisible(function(k){k.isLight&&k.layers.test(B.layers)&&(m.pushLight(k),k.castShadow&&m.pushShadow(k))}),m.setupLights();const Z=new Set;return N.traverse(function(k){if(!(k.isMesh||k.isPoints||k.isLine||k.isSprite))return;const xe=k.material;if(xe)if(Array.isArray(xe))for(let Re=0;Re<xe.length;Re++){const ze=xe[Re];Et(ze,Y,k),Z.add(ze)}else Et(xe,Y,k),Z.add(xe)}),y.pop(),m=null,Z},this.compileAsync=function(N,B,Y=null){const Z=this.compile(N,B,Y);return new Promise(k=>{function xe(){if(Z.forEach(function(Re){Ie.get(Re).currentProgram.isReady()&&Z.delete(Re)}),Z.size===0){k(N);return}setTimeout(xe,10)}ye.get("KHR_parallel_shader_compile")!==null?xe():setTimeout(xe,10)})};let ii=null;function Ss(N){ii&&ii(N)}function f0(){Mr.stop()}function m0(){Mr.start()}const Mr=new qy;Mr.setAnimationLoop(Ss),typeof self<"u"&&Mr.setContext(self),this.setAnimationLoop=function(N){ii=N,ee.setAnimationLoop(N),N===null?Mr.stop():Mr.start()},ee.addEventListener("sessionstart",f0),ee.addEventListener("sessionend",m0),this.render=function(N,B){if(B!==void 0&&B.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;if(N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),B.parent===null&&B.matrixWorldAutoUpdate===!0&&B.updateMatrixWorld(),ee.enabled===!0&&ee.isPresenting===!0&&(ee.cameraAutoUpdate===!0&&ee.updateCamera(B),B=ee.getCamera()),N.isScene===!0&&N.onBeforeRender(_,N,B,w),m=vt.get(N,y.length),m.init(B),y.push(m),ge.multiplyMatrices(B.projectionMatrix,B.matrixWorldInverse),ht.setFromProjectionMatrix(ge),ue=this.localClippingEnabled,ne=me.init(this.clippingPlanes,ue),x=De.get(N,g.length),x.init(),g.push(x),ee.enabled===!0&&ee.isPresenting===!0){const xe=_.xr.getDepthSensingMesh();xe!==null&&Xd(xe,B,-1/0,_.sortObjects)}Xd(N,B,0,_.sortObjects),x.finish(),_.sortObjects===!0&&x.sort(Q,we),dt=ee.enabled===!1||ee.isPresenting===!1||ee.hasDepthSensing()===!1,dt&&tt.addToRenderList(x,N),this.info.render.frame++,ne===!0&&me.beginShadows();const Y=m.state.shadowsArray;Ue.render(Y,N,B),ne===!0&&me.endShadows(),this.info.autoReset===!0&&this.info.reset();const Z=x.opaque,k=x.transmissive;if(m.setupLights(),B.isArrayCamera){const xe=B.cameras;if(k.length>0)for(let Re=0,ze=xe.length;Re<ze;Re++){const Ge=xe[Re];x0(Z,k,N,Ge)}dt&&tt.render(N);for(let Re=0,ze=xe.length;Re<ze;Re++){const Ge=xe[Re];g0(x,N,Ge,Ge.viewport)}}else k.length>0&&x0(Z,k,N,B),dt&&tt.render(N),g0(x,N,B);w!==null&&(R.updateMultisampleRenderTarget(w),R.updateRenderTargetMipmap(w)),N.isScene===!0&&N.onAfterRender(_,N,B),Ot.resetDefaultState(),C=-1,F=null,y.pop(),y.length>0?(m=y[y.length-1],ne===!0&&me.setGlobalState(_.clippingPlanes,m.state.camera)):m=null,g.pop(),g.length>0?x=g[g.length-1]:x=null};function Xd(N,B,Y,Z){if(N.visible===!1)return;if(N.layers.test(B.layers)){if(N.isGroup)Y=N.renderOrder;else if(N.isLOD)N.autoUpdate===!0&&N.update(B);else if(N.isLight)m.pushLight(N),N.castShadow&&m.pushShadow(N);else if(N.isSprite){if(!N.frustumCulled||ht.intersectsSprite(N)){Z&&Xe.setFromMatrixPosition(N.matrixWorld).applyMatrix4(ge);const Re=se.update(N),ze=N.material;ze.visible&&x.push(N,Re,ze,Y,Xe.z,null)}}else if((N.isMesh||N.isLine||N.isPoints)&&(!N.frustumCulled||ht.intersectsObject(N))){const Re=se.update(N),ze=N.material;if(Z&&(N.boundingSphere!==void 0?(N.boundingSphere===null&&N.computeBoundingSphere(),Xe.copy(N.boundingSphere.center)):(Re.boundingSphere===null&&Re.computeBoundingSphere(),Xe.copy(Re.boundingSphere.center)),Xe.applyMatrix4(N.matrixWorld).applyMatrix4(ge)),Array.isArray(ze)){const Ge=Re.groups;for(let je=0,et=Ge.length;je<et;je++){const He=Ge[je],Lt=ze[He.materialIndex];Lt&&Lt.visible&&x.push(N,Re,Lt,Y,Xe.z,He)}}else ze.visible&&x.push(N,Re,ze,Y,Xe.z,null)}}const xe=N.children;for(let Re=0,ze=xe.length;Re<ze;Re++)Xd(xe[Re],B,Y,Z)}function g0(N,B,Y,Z){const k=N.opaque,xe=N.transmissive,Re=N.transparent;m.setupLightsView(Y),ne===!0&&me.setGlobalState(_.clippingPlanes,Y),Z&&Te.viewport(M.copy(Z)),k.length>0&&bl(k,B,Y),xe.length>0&&bl(xe,B,Y),Re.length>0&&bl(Re,B,Y),Te.buffers.depth.setTest(!0),Te.buffers.depth.setMask(!0),Te.buffers.color.setMask(!0),Te.setPolygonOffset(!1)}function x0(N,B,Y,Z){if((Y.isScene===!0?Y.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[Z.id]===void 0&&(m.state.transmissionRenderTarget[Z.id]=new zi(1,1,{generateMipmaps:!0,type:ye.has("EXT_color_buffer_half_float")||ye.has("EXT_color_buffer_float")?Ln:es,minFilter:Kn,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:gt.workingColorSpace}));const xe=m.state.transmissionRenderTarget[Z.id],Re=Z.viewport||M;xe.setSize(Re.z,Re.w);const ze=_.getRenderTarget();_.setRenderTarget(xe),_.getClearColor(W),$=_.getClearAlpha(),$<1&&_.setClearColor(16777215,.5),_.clear(),dt&&tt.render(Y);const Ge=_.toneMapping;_.toneMapping=Ti;const je=Z.viewport;if(Z.viewport!==void 0&&(Z.viewport=void 0),m.setupLightsView(Z),ne===!0&&me.setGlobalState(_.clippingPlanes,Z),bl(N,Y,Z),R.updateMultisampleRenderTarget(xe),R.updateRenderTargetMipmap(xe),ye.has("WEBGL_multisampled_render_to_texture")===!1){let et=!1;for(let He=0,Lt=B.length;He<Lt;He++){const Gt=B[He],Jt=Gt.object,fi=Gt.geometry,Rt=Gt.material,$e=Gt.group;if(Rt.side===Ji&&Jt.layers.test(Z.layers)){const An=Rt.side;Rt.side=ln,Rt.needsUpdate=!0,_0(Jt,Y,Z,fi,Rt,$e),Rt.side=An,Rt.needsUpdate=!0,et=!0}}et===!0&&(R.updateMultisampleRenderTarget(xe),R.updateRenderTargetMipmap(xe))}_.setRenderTarget(ze),_.setClearColor(W,$),je!==void 0&&(Z.viewport=je),_.toneMapping=Ge}function bl(N,B,Y){const Z=B.isScene===!0?B.overrideMaterial:null;for(let k=0,xe=N.length;k<xe;k++){const Re=N[k],ze=Re.object,Ge=Re.geometry,je=Z===null?Re.material:Z,et=Re.group;ze.layers.test(Y.layers)&&_0(ze,B,Y,Ge,je,et)}}function _0(N,B,Y,Z,k,xe){N.onBeforeRender(_,B,Y,Z,k,xe),N.modelViewMatrix.multiplyMatrices(Y.matrixWorldInverse,N.matrixWorld),N.normalMatrix.getNormalMatrix(N.modelViewMatrix),k.onBeforeRender(_,B,Y,Z,N,xe),k.transparent===!0&&k.side===Ji&&k.forceSinglePass===!1?(k.side=ln,k.needsUpdate=!0,_.renderBufferDirect(Y,B,Z,k,N,xe),k.side=gs,k.needsUpdate=!0,_.renderBufferDirect(Y,B,Z,k,N,xe),k.side=Ji):_.renderBufferDirect(Y,B,Z,k,N,xe),N.onAfterRender(_,B,Y,Z,k,xe)}function wl(N,B,Y){B.isScene!==!0&&(B=Je);const Z=Ie.get(N),k=m.state.lights,xe=m.state.shadowsArray,Re=k.state.version,ze=ke.getParameters(N,k.state,xe,B,Y),Ge=ke.getProgramCacheKey(ze);let je=Z.programs;Z.environment=N.isMeshStandardMaterial?B.environment:null,Z.fog=B.fog,Z.envMap=(N.isMeshStandardMaterial?X:S).get(N.envMap||Z.environment),Z.envMapRotation=Z.environment!==null&&N.envMap===null?B.environmentRotation:N.envMapRotation,je===void 0&&(N.addEventListener("dispose",bt),je=new Map,Z.programs=je);let et=je.get(Ge);if(et!==void 0){if(Z.currentProgram===et&&Z.lightsStateVersion===Re)return v0(N,ze),et}else ze.uniforms=ke.getUniforms(N),N.onBuild(Y,ze,_),N.onBeforeCompile(ze,_),et=ke.acquireProgram(ze,Ge),je.set(Ge,et),Z.uniforms=ze.uniforms;const He=Z.uniforms;return(!N.isShaderMaterial&&!N.isRawShaderMaterial||N.clipping===!0)&&(He.clippingPlanes=me.uniform),v0(N,ze),Z.needsLights=iA(N),Z.lightsStateVersion=Re,Z.needsLights&&(He.ambientLightColor.value=k.state.ambient,He.lightProbe.value=k.state.probe,He.directionalLights.value=k.state.directional,He.directionalLightShadows.value=k.state.directionalShadow,He.spotLights.value=k.state.spot,He.spotLightShadows.value=k.state.spotShadow,He.rectAreaLights.value=k.state.rectArea,He.ltc_1.value=k.state.rectAreaLTC1,He.ltc_2.value=k.state.rectAreaLTC2,He.pointLights.value=k.state.point,He.pointLightShadows.value=k.state.pointShadow,He.hemisphereLights.value=k.state.hemi,He.directionalShadowMap.value=k.state.directionalShadowMap,He.directionalShadowMatrix.value=k.state.directionalShadowMatrix,He.spotShadowMap.value=k.state.spotShadowMap,He.spotLightMatrix.value=k.state.spotLightMatrix,He.spotLightMap.value=k.state.spotLightMap,He.pointShadowMap.value=k.state.pointShadowMap,He.pointShadowMatrix.value=k.state.pointShadowMatrix),Z.currentProgram=et,Z.uniformsList=null,et}function y0(N){if(N.uniformsList===null){const B=N.currentProgram.getUniforms();N.uniformsList=Lu.seqWithValue(B.seq,N.uniforms)}return N.uniformsList}function v0(N,B){const Y=Ie.get(N);Y.outputColorSpace=B.outputColorSpace,Y.batching=B.batching,Y.batchingColor=B.batchingColor,Y.instancing=B.instancing,Y.instancingColor=B.instancingColor,Y.instancingMorph=B.instancingMorph,Y.skinning=B.skinning,Y.morphTargets=B.morphTargets,Y.morphNormals=B.morphNormals,Y.morphColors=B.morphColors,Y.morphTargetsCount=B.morphTargetsCount,Y.numClippingPlanes=B.numClippingPlanes,Y.numIntersection=B.numClipIntersection,Y.vertexAlphas=B.vertexAlphas,Y.vertexTangents=B.vertexTangents,Y.toneMapping=B.toneMapping}function tA(N,B,Y,Z,k){B.isScene!==!0&&(B=Je),R.resetTextureUnits();const xe=B.fog,Re=Z.isMeshStandardMaterial?B.environment:null,ze=w===null?_.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:li,Ge=(Z.isMeshStandardMaterial?X:S).get(Z.envMap||Re),je=Z.vertexColors===!0&&!!Y.attributes.color&&Y.attributes.color.itemSize===4,et=!!Y.attributes.tangent&&(!!Z.normalMap||Z.anisotropy>0),He=!!Y.morphAttributes.position,Lt=!!Y.morphAttributes.normal,Gt=!!Y.morphAttributes.color;let Jt=Ti;Z.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&(Jt=_.toneMapping);const fi=Y.morphAttributes.position||Y.morphAttributes.normal||Y.morphAttributes.color,Rt=fi!==void 0?fi.length:0,$e=Ie.get(Z),An=m.state.lights;if(ne===!0&&(ue===!0||N!==F)){const Ni=N===F&&Z.id===C;me.setState(Z,N,Ni)}let It=!1;Z.version===$e.__version?($e.needsLights&&$e.lightsStateVersion!==An.state.version||$e.outputColorSpace!==ze||k.isBatchedMesh&&$e.batching===!1||!k.isBatchedMesh&&$e.batching===!0||k.isBatchedMesh&&$e.batchingColor===!0&&k.colorTexture===null||k.isBatchedMesh&&$e.batchingColor===!1&&k.colorTexture!==null||k.isInstancedMesh&&$e.instancing===!1||!k.isInstancedMesh&&$e.instancing===!0||k.isSkinnedMesh&&$e.skinning===!1||!k.isSkinnedMesh&&$e.skinning===!0||k.isInstancedMesh&&$e.instancingColor===!0&&k.instanceColor===null||k.isInstancedMesh&&$e.instancingColor===!1&&k.instanceColor!==null||k.isInstancedMesh&&$e.instancingMorph===!0&&k.morphTexture===null||k.isInstancedMesh&&$e.instancingMorph===!1&&k.morphTexture!==null||$e.envMap!==Ge||Z.fog===!0&&$e.fog!==xe||$e.numClippingPlanes!==void 0&&($e.numClippingPlanes!==me.numPlanes||$e.numIntersection!==me.numIntersection)||$e.vertexAlphas!==je||$e.vertexTangents!==et||$e.morphTargets!==He||$e.morphNormals!==Lt||$e.morphColors!==Gt||$e.toneMapping!==Jt||$e.morphTargetsCount!==Rt)&&(It=!0):(It=!0,$e.__version=Z.version);let Xi=$e.currentProgram;It===!0&&(Xi=wl(Z,B,k));let mo=!1,mi=!1,qd=!1;const tn=Xi.getUniforms(),Bs=$e.uniforms;if(Te.useProgram(Xi.program)&&(mo=!0,mi=!0,qd=!0),Z.id!==C&&(C=Z.id,mi=!0),mo||F!==N){de.reverseDepthBuffer?(Ae.copy(N.projectionMatrix),VA(Ae),BA(Ae),tn.setValue(P,"projectionMatrix",Ae)):tn.setValue(P,"projectionMatrix",N.projectionMatrix),tn.setValue(P,"viewMatrix",N.matrixWorldInverse);const Ni=tn.map.cameraPosition;Ni!==void 0&&Ni.setValue(P,Ze.setFromMatrixPosition(N.matrixWorld)),de.logarithmicDepthBuffer&&tn.setValue(P,"logDepthBufFC",2/(Math.log(N.far+1)/Math.LN2)),(Z.isMeshPhongMaterial||Z.isMeshToonMaterial||Z.isMeshLambertMaterial||Z.isMeshBasicMaterial||Z.isMeshStandardMaterial||Z.isShaderMaterial)&&tn.setValue(P,"isOrthographic",N.isOrthographicCamera===!0),F!==N&&(F=N,mi=!0,qd=!0)}if(k.isSkinnedMesh){tn.setOptional(P,k,"bindMatrix"),tn.setOptional(P,k,"bindMatrixInverse");const Ni=k.skeleton;Ni&&(Ni.boneTexture===null&&Ni.computeBoneTexture(),tn.setValue(P,"boneTexture",Ni.boneTexture,R))}k.isBatchedMesh&&(tn.setOptional(P,k,"batchingTexture"),tn.setValue(P,"batchingTexture",k._matricesTexture,R),tn.setOptional(P,k,"batchingIdTexture"),tn.setValue(P,"batchingIdTexture",k._indirectTexture,R),tn.setOptional(P,k,"batchingColorTexture"),k._colorsTexture!==null&&tn.setValue(P,"batchingColorTexture",k._colorsTexture,R));const $d=Y.morphAttributes;if(($d.position!==void 0||$d.normal!==void 0||$d.color!==void 0)&&nt.update(k,Y,Xi),(mi||$e.receiveShadow!==k.receiveShadow)&&($e.receiveShadow=k.receiveShadow,tn.setValue(P,"receiveShadow",k.receiveShadow)),Z.isMeshGouraudMaterial&&Z.envMap!==null&&(Bs.envMap.value=Ge,Bs.flipEnvMap.value=Ge.isCubeTexture&&Ge.isRenderTargetTexture===!1?-1:1),Z.isMeshStandardMaterial&&Z.envMap===null&&B.environment!==null&&(Bs.envMapIntensity.value=B.environmentIntensity),mi&&(tn.setValue(P,"toneMappingExposure",_.toneMappingExposure),$e.needsLights&&nA(Bs,qd),xe&&Z.fog===!0&&be.refreshFogUniforms(Bs,xe),be.refreshMaterialUniforms(Bs,Z,he,q,m.state.transmissionRenderTarget[N.id]),Lu.upload(P,y0($e),Bs,R)),Z.isShaderMaterial&&Z.uniformsNeedUpdate===!0&&(Lu.upload(P,y0($e),Bs,R),Z.uniformsNeedUpdate=!1),Z.isSpriteMaterial&&tn.setValue(P,"center",k.center),tn.setValue(P,"modelViewMatrix",k.modelViewMatrix),tn.setValue(P,"normalMatrix",k.normalMatrix),tn.setValue(P,"modelMatrix",k.matrixWorld),Z.isShaderMaterial||Z.isRawShaderMaterial){const Ni=Z.uniformsGroups;for(let Yd=0,sA=Ni.length;Yd<sA;Yd++){const M0=Ni[Yd];O.update(M0,Xi),O.bind(M0,Xi)}}return Xi}function nA(N,B){N.ambientLightColor.needsUpdate=B,N.lightProbe.needsUpdate=B,N.directionalLights.needsUpdate=B,N.directionalLightShadows.needsUpdate=B,N.pointLights.needsUpdate=B,N.pointLightShadows.needsUpdate=B,N.spotLights.needsUpdate=B,N.spotLightShadows.needsUpdate=B,N.rectAreaLights.needsUpdate=B,N.hemisphereLights.needsUpdate=B}function iA(N){return N.isMeshLambertMaterial||N.isMeshToonMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isShadowMaterial||N.isShaderMaterial&&N.lights===!0}this.getActiveCubeFace=function(){return I},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(N,B,Y){Ie.get(N.texture).__webglTexture=B,Ie.get(N.depthTexture).__webglTexture=Y;const Z=Ie.get(N);Z.__hasExternalTextures=!0,Z.__autoAllocateDepthBuffer=Y===void 0,Z.__autoAllocateDepthBuffer||ye.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),Z.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(N,B){const Y=Ie.get(N);Y.__webglFramebuffer=B,Y.__useDefaultFramebuffer=B===void 0},this.setRenderTarget=function(N,B=0,Y=0){w=N,I=B,T=Y;let Z=!0,k=null,xe=!1,Re=!1;if(N){const Ge=Ie.get(N);if(Ge.__useDefaultFramebuffer!==void 0)Te.bindFramebuffer(P.FRAMEBUFFER,null),Z=!1;else if(Ge.__webglFramebuffer===void 0)R.setupRenderTarget(N);else if(Ge.__hasExternalTextures)R.rebindTextures(N,Ie.get(N.texture).__webglTexture,Ie.get(N.depthTexture).__webglTexture);else if(N.depthBuffer){const He=N.depthTexture;if(Ge.__boundDepthTexture!==He){if(He!==null&&Ie.has(He)&&(N.width!==He.image.width||N.height!==He.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");R.setupDepthRenderbuffer(N)}}const je=N.texture;(je.isData3DTexture||je.isDataArrayTexture||je.isCompressedArrayTexture)&&(Re=!0);const et=Ie.get(N).__webglFramebuffer;N.isWebGLCubeRenderTarget?(Array.isArray(et[B])?k=et[B][Y]:k=et[B],xe=!0):N.samples>0&&R.useMultisampledRTT(N)===!1?k=Ie.get(N).__webglMultisampledFramebuffer:Array.isArray(et)?k=et[Y]:k=et,M.copy(N.viewport),b.copy(N.scissor),G=N.scissorTest}else M.copy(Ne).multiplyScalar(he).floor(),b.copy(Ee).multiplyScalar(he).floor(),G=Qe;if(Te.bindFramebuffer(P.FRAMEBUFFER,k)&&Z&&Te.drawBuffers(N,k),Te.viewport(M),Te.scissor(b),Te.setScissorTest(G),xe){const Ge=Ie.get(N.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+B,Ge.__webglTexture,Y)}else if(Re){const Ge=Ie.get(N.texture),je=B||0;P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,Ge.__webglTexture,Y||0,je)}C=-1},this.readRenderTargetPixels=function(N,B,Y,Z,k,xe,Re){if(!(N&&N.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ze=Ie.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&Re!==void 0&&(ze=ze[Re]),ze){Te.bindFramebuffer(P.FRAMEBUFFER,ze);try{const Ge=N.texture,je=Ge.format,et=Ge.type;if(!de.textureFormatReadable(je)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!de.textureTypeReadable(et)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}B>=0&&B<=N.width-Z&&Y>=0&&Y<=N.height-k&&P.readPixels(B,Y,Z,k,ct.convert(je),ct.convert(et),xe)}finally{const Ge=w!==null?Ie.get(w).__webglFramebuffer:null;Te.bindFramebuffer(P.FRAMEBUFFER,Ge)}}},this.readRenderTargetPixelsAsync=async function(N,B,Y,Z,k,xe,Re){if(!(N&&N.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ze=Ie.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&Re!==void 0&&(ze=ze[Re]),ze){const Ge=N.texture,je=Ge.format,et=Ge.type;if(!de.textureFormatReadable(je))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!de.textureTypeReadable(et))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(B>=0&&B<=N.width-Z&&Y>=0&&Y<=N.height-k){Te.bindFramebuffer(P.FRAMEBUFFER,ze);const He=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,He),P.bufferData(P.PIXEL_PACK_BUFFER,xe.byteLength,P.STREAM_READ),P.readPixels(B,Y,Z,k,ct.convert(je),ct.convert(et),0);const Lt=w!==null?Ie.get(w).__webglFramebuffer:null;Te.bindFramebuffer(P.FRAMEBUFFER,Lt);const Gt=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await OA(P,Gt,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,He),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,xe),P.deleteBuffer(He),P.deleteSync(Gt),xe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(N,B=null,Y=0){N.isTexture!==!0&&(Pu("WebGLRenderer: copyFramebufferToTexture function signature has changed."),B=arguments[0]||null,N=arguments[1]);const Z=Math.pow(2,-Y),k=Math.floor(N.image.width*Z),xe=Math.floor(N.image.height*Z),Re=B!==null?B.x:0,ze=B!==null?B.y:0;R.setTexture2D(N,0),P.copyTexSubImage2D(P.TEXTURE_2D,Y,0,0,Re,ze,k,xe),Te.unbindTexture()},this.copyTextureToTexture=function(N,B,Y=null,Z=null,k=0){N.isTexture!==!0&&(Pu("WebGLRenderer: copyTextureToTexture function signature has changed."),Z=arguments[0]||null,N=arguments[1],B=arguments[2],k=arguments[3]||0,Y=null);let xe,Re,ze,Ge,je,et;Y!==null?(xe=Y.max.x-Y.min.x,Re=Y.max.y-Y.min.y,ze=Y.min.x,Ge=Y.min.y):(xe=N.image.width,Re=N.image.height,ze=0,Ge=0),Z!==null?(je=Z.x,et=Z.y):(je=0,et=0);const He=ct.convert(B.format),Lt=ct.convert(B.type);R.setTexture2D(B,0),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,B.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,B.unpackAlignment);const Gt=P.getParameter(P.UNPACK_ROW_LENGTH),Jt=P.getParameter(P.UNPACK_IMAGE_HEIGHT),fi=P.getParameter(P.UNPACK_SKIP_PIXELS),Rt=P.getParameter(P.UNPACK_SKIP_ROWS),$e=P.getParameter(P.UNPACK_SKIP_IMAGES),An=N.isCompressedTexture?N.mipmaps[k]:N.image;P.pixelStorei(P.UNPACK_ROW_LENGTH,An.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,An.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,ze),P.pixelStorei(P.UNPACK_SKIP_ROWS,Ge),N.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,k,je,et,xe,Re,He,Lt,An.data):N.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,k,je,et,An.width,An.height,He,An.data):P.texSubImage2D(P.TEXTURE_2D,k,je,et,xe,Re,He,Lt,An),P.pixelStorei(P.UNPACK_ROW_LENGTH,Gt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Jt),P.pixelStorei(P.UNPACK_SKIP_PIXELS,fi),P.pixelStorei(P.UNPACK_SKIP_ROWS,Rt),P.pixelStorei(P.UNPACK_SKIP_IMAGES,$e),k===0&&B.generateMipmaps&&P.generateMipmap(P.TEXTURE_2D),Te.unbindTexture()},this.copyTextureToTexture3D=function(N,B,Y=null,Z=null,k=0){N.isTexture!==!0&&(Pu("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Y=arguments[0]||null,Z=arguments[1]||null,N=arguments[2],B=arguments[3],k=arguments[4]||0);let xe,Re,ze,Ge,je,et,He,Lt,Gt;const Jt=N.isCompressedTexture?N.mipmaps[k]:N.image;Y!==null?(xe=Y.max.x-Y.min.x,Re=Y.max.y-Y.min.y,ze=Y.max.z-Y.min.z,Ge=Y.min.x,je=Y.min.y,et=Y.min.z):(xe=Jt.width,Re=Jt.height,ze=Jt.depth,Ge=0,je=0,et=0),Z!==null?(He=Z.x,Lt=Z.y,Gt=Z.z):(He=0,Lt=0,Gt=0);const fi=ct.convert(B.format),Rt=ct.convert(B.type);let $e;if(B.isData3DTexture)R.setTexture3D(B,0),$e=P.TEXTURE_3D;else if(B.isDataArrayTexture||B.isCompressedArrayTexture)R.setTexture2DArray(B,0),$e=P.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,B.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,B.unpackAlignment);const An=P.getParameter(P.UNPACK_ROW_LENGTH),It=P.getParameter(P.UNPACK_IMAGE_HEIGHT),Xi=P.getParameter(P.UNPACK_SKIP_PIXELS),mo=P.getParameter(P.UNPACK_SKIP_ROWS),mi=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,Jt.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Jt.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Ge),P.pixelStorei(P.UNPACK_SKIP_ROWS,je),P.pixelStorei(P.UNPACK_SKIP_IMAGES,et),N.isDataTexture||N.isData3DTexture?P.texSubImage3D($e,k,He,Lt,Gt,xe,Re,ze,fi,Rt,Jt.data):B.isCompressedArrayTexture?P.compressedTexSubImage3D($e,k,He,Lt,Gt,xe,Re,ze,fi,Jt.data):P.texSubImage3D($e,k,He,Lt,Gt,xe,Re,ze,fi,Rt,Jt),P.pixelStorei(P.UNPACK_ROW_LENGTH,An),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,It),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Xi),P.pixelStorei(P.UNPACK_SKIP_ROWS,mo),P.pixelStorei(P.UNPACK_SKIP_IMAGES,mi),k===0&&B.generateMipmaps&&P.generateMipmap($e),Te.unbindTexture()},this.initRenderTarget=function(N){Ie.get(N).__webglFramebuffer===void 0&&R.setupRenderTarget(N)},this.initTexture=function(N){N.isCubeTexture?R.setTextureCube(N,0):N.isData3DTexture?R.setTexture3D(N,0):N.isDataArrayTexture||N.isCompressedArrayTexture?R.setTexture2DArray(N,0):R.setTexture2D(N,0),Te.unbindTexture()},this.resetState=function(){I=0,T=0,w=null,Te.reset(),Ot.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Di}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Wh?"display-p3":"srgb",t.unpackColorSpace=gt.workingColorSpace===qc?"display-p3":"srgb"}}class jh{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new _e(e),this.density=t}clone(){return new jh(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}let um=class Qy{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new _e(e),this.near=t,this.far=n}clone(){return new Qy(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}};class Qh extends yt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ui,this.environmentIntensity=1,this.environmentRotation=new ui,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class ya{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ra,this.updateRanges=[],this.version=0,this.uuid=bi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=bi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=bi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const $n=new E;class Us{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)$n.fromBufferAttribute(this,t),$n.applyMatrix4(e),this.setXYZ(t,$n.x,$n.y,$n.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)$n.fromBufferAttribute(this,t),$n.applyNormalMatrix(e),this.setXYZ(t,$n.x,$n.y,$n.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)$n.fromBufferAttribute(this,t),$n.transformDirection(e),this.setXYZ(t,$n.x,$n.y,$n.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Zn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=ut(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Zn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Zn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Zn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Zn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array),r=ut(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new At(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Us(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Jc extends mn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new _e(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Ro;const Ua=new E,Io=new E,Po=new E,Lo=new J,Fa=new J,ev=new Fe,Yl=new E,Oa=new E,Zl=new E,lx=new J,Tp=new J,ux=new J;class hm extends yt{constructor(e=new Jc){if(super(),this.isSprite=!0,this.type="Sprite",Ro===void 0){Ro=new at;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new ya(t,5);Ro.setIndex([0,1,2,0,2,3]),Ro.setAttribute("position",new Us(n,3,0,!1)),Ro.setAttribute("uv",new Us(n,2,3,!1))}this.geometry=Ro,this.material=e,this.center=new J(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Io.setFromMatrixScale(this.matrixWorld),ev.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Po.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Io.multiplyScalar(-Po.z);const n=this.material.rotation;let i,r;n!==0&&(r=Math.cos(n),i=Math.sin(n));const o=this.center;Jl(Yl.set(-.5,-.5,0),Po,o,Io,i,r),Jl(Oa.set(.5,-.5,0),Po,o,Io,i,r),Jl(Zl.set(.5,.5,0),Po,o,Io,i,r),lx.set(0,0),Tp.set(1,0),ux.set(1,1);let a=e.ray.intersectTriangle(Yl,Oa,Zl,!1,Ua);if(a===null&&(Jl(Oa.set(-.5,.5,0),Po,o,Io,i,r),Tp.set(0,1),a=e.ray.intersectTriangle(Yl,Zl,Oa,!1,Ua),a===null))return;const c=e.ray.origin.distanceTo(Ua);c<e.near||c>e.far||t.push({distance:c,point:Ua.clone(),uv:Jn.getInterpolation(Ua,Yl,Oa,Zl,lx,Tp,ux,new J),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Jl(s,e,t,n,i,r){Lo.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(Fa.x=r*Lo.x-i*Lo.y,Fa.y=i*Lo.x+r*Lo.y):Fa.copy(Lo),s.copy(e),s.x+=Fa.x,s.y+=Fa.y,s.applyMatrix4(ev)}const Kl=new E,hx=new E;class dm extends yt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const r=t[n];this.addLevel(r.object.clone(),r.distance,r.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let r;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let r=t[n].distance;if(t[n].object.visible&&(r-=r*t[n].hysteresis),e<r)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Kl.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Kl);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Kl.setFromMatrixPosition(e.matrixWorld),hx.setFromMatrixPosition(this.matrixWorld);const n=Kl.distanceTo(hx)/e.zoom;t[0].object.visible=!0;let i,r;for(i=1,r=t.length;i<r;i++){let o=t[i].distance;if(t[i].object.visible&&(o-=o*t[i].hysteresis),n>=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,r=n.length;i<r;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const dx=new E,px=new st,fx=new st,JR=new E,mx=new Fe,jl=new E,bp=new Dn,gx=new Fe,wp=new so;class pm extends kt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=uf,this.bindMatrix=new Fe,this.bindMatrixInverse=new Fe,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Wn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,jl),this.boundingBox.expandByPoint(jl)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Dn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,jl),this.boundingSphere.expandByPoint(jl)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),bp.copy(this.boundingSphere),bp.applyMatrix4(i),e.ray.intersectsSphere(bp)!==!1&&(gx.copy(i).invert(),wp.copy(e.ray).applyMatrix4(gx),!(this.boundingBox!==null&&wp.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,wp)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new st,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===uf?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===py?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;px.fromBufferAttribute(i.attributes.skinIndex,e),fx.fromBufferAttribute(i.attributes.skinWeight,e),dx.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const o=fx.getComponent(r);if(o!==0){const a=px.getComponent(r);mx.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(JR.copy(dx).applyMatrix4(mx),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class ed extends yt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Oi extends Xt{constructor(e=null,t=1,n=1,i,r,o,a,c,l=Qt,u=Qt,h,d){super(null,o,a,c,l,u,i,r,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const xx=new Fe,KR=new Fe;class Kc{constructor(e=[],t=[]){this.uuid=bi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Fe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Fe;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,o=e.length;r<o;r++){const a=e[r]?e[r].matrixWorld:KR;xx.multiplyMatrices(a,t[r]),xx.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Kc(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Oi(t,e,e,Rn,Gn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const r=e.bones[n];let o=t[r];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),o=new ed),this.bones.push(o),this.boneInverses.push(new Fe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const o=t[i];e.bones.push(o.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class Fs extends At{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Do=new Fe,_x=new Fe,Ql=[],yx=new Wn,jR=new Fe,Va=new kt,Ba=new Dn;class fm extends kt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Fs(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,jR)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Wn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Do),yx.copy(e.boundingBox).applyMatrix4(Do),this.boundingBox.union(yx)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Dn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Do),Ba.copy(e.boundingSphere).applyMatrix4(Do),this.boundingSphere.union(Ba)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,o=e*r+1;for(let a=0;a<n.length;a++)n[a]=i[o+a]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Va.geometry=this.geometry,Va.material=this.material,Va.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ba.copy(this.boundingSphere),Ba.applyMatrix4(n),e.ray.intersectsSphere(Ba)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,Do),_x.multiplyMatrices(n,Do),Va.matrixWorld=_x,Va.raycast(e,Ql);for(let o=0,a=Ql.length;o<a;o++){const c=Ql[o];c.instanceId=r,c.object=this,t.push(c)}Ql.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Fs(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Oi(new Float32Array(i*this.count),i,this.count,Wc,Gn));const r=this.morphTexture.source.data.data;let o=0;for(let l=0;l<n.length;l++)o+=n[l];const a=this.geometry.morphTargetsRelative?1:1-o,c=i*e;r[c]=a,r.set(n,c+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function QR(s,e){return s.z-e.z}function eI(s,e){return e.z-s.z}class tI{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n){const i=this.pool,r=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const o=i[this.index];r.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=t,o.index=n}reset(){this.list.length=0,this.index=0}}const qs=new Fe,Ap=new Fe,nI=new Fe,iI=new _e(1,1,1),vx=new Fe,Np=new xa,eu=new Wn,Er=new Dn,za=new E,Mx=new E,sI=new E,Ep=new tI,zn=new kt,tu=[];function rI(s,e,t=0){const n=e.itemSize;if(s.isInterleavedBufferAttribute||s.array.constructor!==e.array.constructor){const i=s.count;for(let r=0;r<i;r++)for(let o=0;o<n;o++)e.setComponent(r+t,o,s.getComponent(r,o))}else e.array.set(s.array,t*n);e.needsUpdate=!0}class mm extends kt{get maxInstanceCount(){return this._maxInstanceCount}constructor(e,t,n=t*2,i){super(new at,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawInfo=[],this._availableInstanceIds=[],this._drawRanges=[],this._reservedRanges=[],this._bounds=[],this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._visibilityChanged=!0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Oi(t,e,e,Rn,Gn);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Oi(t,e,e,Xc,Bi);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new Oi(t,e,e,Rn,Gn);n.colorSpace=gt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const r in e.attributes){const o=e.getAttribute(r),{array:a,itemSize:c,normalized:l}=o,u=new a.constructor(n*c),h=new At(u,c,l);t.setAttribute(r,h)}if(e.getIndex()!==null){const r=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new At(r,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Wn);const e=this.boundingBox,t=this._drawInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const r=t[n].geometryIndex;this.getMatrixAt(n,qs),this.getBoundingBoxAt(r,eu).applyMatrix4(qs),e.union(eu)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Dn);const e=this.boundingSphere,t=this._drawInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const r=t[n].geometryIndex;this.getMatrixAt(n,qs),this.getBoundingSphereAt(r,Er).applyMatrix4(qs),e.union(Er)}}addInstance(e){if(this._drawInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(i=this._availableInstanceIds.pop(),this._drawInfo[i]=n):(i=this._drawInfo.length,this._drawInfo.push(n));const r=this._matricesTexture,o=r.image.data;nI.toArray(o,i*16),r.needsUpdate=!0;const a=this._colorsTexture;return a&&(iI.toArray(a.image.data,i*4),a.needsUpdate=!0),i}addGeometry(e,t=-1,n=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let r=null;const o=this._reservedRanges,a=this._drawRanges,c=this._bounds;this._geometryCount!==0&&(r=o[o.length-1]),t===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=t,r===null?i.vertexStart=0:i.vertexStart=r.vertexStart+r.vertexCount;const l=e.getIndex(),u=l!==null;if(u&&(n===-1?i.indexCount=l.count:i.indexCount=n,r===null?i.indexStart=0:i.indexStart=r.indexStart+r.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._geometryCount;return this._geometryCount++,o.push(i),a.push({start:u?i.indexStart:i.vertexStart,count:-1}),c.push({boxInitialized:!1,box:new Wn,sphereInitialized:!1,sphere:new Dn}),this.setGeometryAt(h,e),h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,r=n.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const c=a.vertexStart,l=a.vertexCount;for(const p in n.attributes){const f=t.getAttribute(p),x=n.getAttribute(p);rI(f,x,c);const m=f.itemSize;for(let g=f.count,y=l;g<y;g++){const _=c+g;for(let v=0;v<m;v++)x.setComponent(_,v,0)}x.needsUpdate=!0,x.addUpdateRange(c*m,l*m)}if(i){const p=a.indexStart;for(let f=0;f<o.count;f++)r.setX(p+f,c+o.getX(f));for(let f=o.count,x=a.indexCount;f<x;f++)r.setX(p+f,c);r.needsUpdate=!0,r.addUpdateRange(p,a.indexCount)}const u=this._bounds[e];t.boundingBox!==null?(u.box.copy(t.boundingBox),u.boxInitialized=!0):u.boxInitialized=!1,t.boundingSphere!==null?(u.sphere.copy(t.boundingSphere),u.sphereInitialized=!0):u.sphereInitialized=!1;const h=this._drawRanges[e],d=t.getAttribute("position");return h.count=i?o.count:d.count,this._visibilityChanged=!0,e}deleteInstance(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?this:(t[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this._bounds[e],i=n.box,r=this.geometry;if(n.boxInitialized===!1){i.makeEmpty();const o=r.index,a=r.attributes.position,c=this._drawRanges[e];for(let l=c.start,u=c.start+c.count;l<u;l++){let h=l;o&&(h=o.getX(h)),i.expandByPoint(za.fromBufferAttribute(a,h))}n.boxInitialized=!0}return t.copy(i),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this._bounds[e],i=n.sphere,r=this.geometry;if(n.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,eu),eu.getCenter(i.center);const o=r.index,a=r.attributes.position,c=this._drawRanges[e];let l=0;for(let u=c.start,h=c.start+c.count;u<h;u++){let d=u;o&&(d=o.getX(d)),za.fromBufferAttribute(a,d),l=Math.max(l,i.center.distanceToSquared(za))}i.radius=Math.sqrt(l),n.sphereInitialized=!0}return t.copy(i),t}setMatrixAt(e,t){const n=this._drawInfo,i=this._matricesTexture,r=this._matricesTexture.image.data;return e>=n.length||n[e].active===!1?this:(t.toArray(r,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,t){const n=this._drawInfo,i=this._matricesTexture.image.data;return e>=n.length||n[e].active===!1?null:t.fromArray(i,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const n=this._colorsTexture,i=this._colorsTexture.image.data,r=this._drawInfo;return e>=r.length||r[e].active===!1?this:(t.toArray(i,e*4),n.needsUpdate=!0,this)}getColorAt(e,t){const n=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||i[e].active===!1?null:t.fromArray(n,e*4)}setVisibleAt(e,t){const n=this._drawInfo;return e>=n.length||n[e].active===!1||n[e].visible===t?this:(n[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}setGeometryIdAt(e,t){const n=this._drawInfo;return e>=n.length||n[e].active===!1||t<0||t>=this._geometryCount?null:(n[e].geometryIndex=t,this)}getGeometryIdAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?-1:t[e].geometryIndex}getGeometryRangeAt(e,t={}){if(e<0||e>=this._geometryCount)return null;const n=this._drawRanges[e];return t.start=n.start,t.count=n.count,t}raycast(e,t){const n=this._drawInfo,i=this._drawRanges,r=this.matrixWorld,o=this.geometry;zn.material=this.material,zn.geometry.index=o.index,zn.geometry.attributes=o.attributes,zn.geometry.boundingBox===null&&(zn.geometry.boundingBox=new Wn),zn.geometry.boundingSphere===null&&(zn.geometry.boundingSphere=new Dn);for(let a=0,c=n.length;a<c;a++){if(!n[a].visible||!n[a].active)continue;const l=n[a].geometryIndex,u=i[l];zn.geometry.setDrawRange(u.start,u.count),this.getMatrixAt(a,zn.matrixWorld).premultiply(r),this.getBoundingBoxAt(l,zn.geometry.boundingBox),this.getBoundingSphereAt(l,zn.geometry.boundingSphere),zn.raycast(e,tu);for(let h=0,d=tu.length;h<d;h++){const p=tu[h];p.object=this,p.batchId=a,t.push(p)}tu.length=0}zn.material=null,zn.geometry.index=null,zn.geometry.attributes={},zn.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(t=>({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._drawInfo=e._drawInfo.map(t=>({...t})),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,c=this._drawInfo,l=this._multiDrawStarts,u=this._multiDrawCounts,h=this._drawRanges,d=this.perObjectFrustumCulled,p=this._indirectTexture,f=p.image.data;d&&(vx.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Np.setFromProjectionMatrix(vx,e.coordinateSystem));let x=0;if(this.sortObjects){Ap.copy(this.matrixWorld).invert(),za.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Ap),Mx.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Ap);for(let y=0,_=c.length;y<_;y++)if(c[y].visible&&c[y].active){const v=c[y].geometryIndex;this.getMatrixAt(y,qs),this.getBoundingSphereAt(v,Er).applyMatrix4(qs);let I=!1;if(d&&(I=!Np.intersectsSphere(Er)),!I){const T=sI.subVectors(Er.center,za).dot(Mx);Ep.push(h[v],T,y)}}const m=Ep.list,g=this.customSort;g===null?m.sort(r.transparent?eI:QR):g.call(this,m,n);for(let y=0,_=m.length;y<_;y++){const v=m[y];l[x]=v.start*a,u[x]=v.count,f[x]=v.index,x++}Ep.reset()}else for(let m=0,g=c.length;m<g;m++)if(c[m].visible&&c[m].active){const y=c[m].geometryIndex;let _=!1;if(d&&(this.getMatrixAt(m,qs),this.getBoundingSphereAt(y,Er).applyMatrix4(qs),_=!Np.intersectsSphere(Er)),!_){const v=h[y];l[x]=v.start*a,u[x]=v.count,f[x]=m,x++}}p.needsUpdate=!0,this._multiDrawCount=x,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,r,o){this.onBeforeRender(e,null,i,r,o)}}class Fn extends mn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new _e(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const lh=new E,uh=new E,Sx=new Fe,ka=new so,nu=new Dn,Cp=new E,Tx=new E;class Os extends yt{constructor(e=new at,t=new Fn){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)lh.fromBufferAttribute(t,i-1),uh.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=lh.distanceTo(uh);e.setAttribute("lineDistance",new Ve(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),nu.copy(n.boundingSphere),nu.applyMatrix4(i),nu.radius+=r,e.ray.intersectsSphere(nu)===!1)return;Sx.copy(i).invert(),ka.copy(e.ray).applyMatrix4(Sx);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=this.isLineSegments?2:1,u=n.index,d=n.attributes.position;if(u!==null){const p=Math.max(0,o.start),f=Math.min(u.count,o.start+o.count);for(let x=p,m=f-1;x<m;x+=l){const g=u.getX(x),y=u.getX(x+1),_=iu(this,e,ka,c,g,y);_&&t.push(_)}if(this.isLineLoop){const x=u.getX(f-1),m=u.getX(p),g=iu(this,e,ka,c,x,m);g&&t.push(g)}}else{const p=Math.max(0,o.start),f=Math.min(d.count,o.start+o.count);for(let x=p,m=f-1;x<m;x+=l){const g=iu(this,e,ka,c,x,x+1);g&&t.push(g)}if(this.isLineLoop){const x=iu(this,e,ka,c,f-1,p);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}function iu(s,e,t,n,i,r){const o=s.geometry.attributes.position;if(lh.fromBufferAttribute(o,i),uh.fromBufferAttribute(o,r),t.distanceSqToSegment(lh,uh,Cp,Tx)>n)return;Cp.applyMatrix4(s.matrixWorld);const c=e.ray.origin.distanceTo(Cp);if(!(c<e.near||c>e.far))return{distance:c,point:Tx.clone().applyMatrix4(s.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:s}}const bx=new E,wx=new E;class rs extends Os{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,r=t.count;i<r;i+=2)bx.fromBufferAttribute(t,i),wx.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+bx.distanceTo(wx);e.setAttribute("lineDistance",new Ve(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class gm extends Os{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class va extends mn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new _e(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Ax=new Fe,pf=new so,su=new Dn,ru=new E;class xm extends yt{constructor(e=new at,t=new va){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),su.copy(n.boundingSphere),su.applyMatrix4(i),su.radius+=r,e.ray.intersectsSphere(su)===!1)return;Ax.copy(i).invert(),pf.copy(e.ray).applyMatrix4(Ax);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=n.index,h=n.attributes.position;if(l!==null){const d=Math.max(0,o.start),p=Math.min(l.count,o.start+o.count);for(let f=d,x=p;f<x;f++){const m=l.getX(f);ru.fromBufferAttribute(h,m),Nx(ru,m,c,i,e,t,this)}}else{const d=Math.max(0,o.start),p=Math.min(h.count,o.start+o.count);for(let f=d,x=p;f<x;f++)ru.fromBufferAttribute(h,f),Nx(ru,f,c,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}function Nx(s,e,t,n,i,r,o){const a=pf.distanceSqToPoint(s);if(a<t){const c=new E;pf.closestPointToPoint(s,c),c.applyMatrix4(n);const l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;r.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class tv extends Xt{constructor(e,t,n,i,r,o,a,c,l){super(e,t,n,i,r,o,a,c,l),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Ut,this.magFilter=r!==void 0?r:Ut,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class _m extends Xt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Qt,this.minFilter=Qt,this.generateMipmaps=!1,this.needsUpdate=!0}}class jc extends Xt{constructor(e,t,n,i,r,o,a,c,l,u,h,d){super(null,o,a,c,l,u,i,r,h,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class nv extends jc{constructor(e,t,n,i,r,o){super(e,t,n,r,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Si,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class iv extends jc{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,wi),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class sv extends Xt{constructor(e,t,n,i,r,o,a,c,l){super(e,t,n,i,r,o,a,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Gi{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let o;t?o=t:o=e*n[r-1];let a=0,c=r-1,l;for(;a<=c;)if(i=Math.floor(a+(c-a)/2),l=n[i]-o,l<0)a=i+1;else if(l>0)c=i-1;else{c=i;break}if(i=c,n[i]===o)return i/(r-1);const u=n[i],d=n[i+1]-u,p=(o-u)/d;return(i+p)/(r-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);const o=this.getPoint(i),a=this.getPoint(r),c=t||(o.isVector2?new J:new E);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new E,i=[],r=[],o=[],a=new E,c=new Fe;for(let p=0;p<=e;p++){const f=p/e;i[p]=this.getTangentAt(f,new E)}r[0]=new E,o[0]=new E;let l=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);u<=l&&(l=u,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),d<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),o[0].crossVectors(i[0],r[0]);for(let p=1;p<=e;p++){if(r[p]=r[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(i[p-1],i[p]),a.length()>Number.EPSILON){a.normalize();const f=Math.acos(jt(i[p-1].dot(i[p]),-1,1));r[p].applyMatrix4(c.makeRotationAxis(a,f))}o[p].crossVectors(i[p],r[p])}if(t===!0){let p=Math.acos(jt(r[0].dot(r[e]),-1,1));p/=e,i[0].dot(a.crossVectors(r[0],r[e]))>0&&(p=-p);for(let f=1;f<=e;f++)r[f].applyMatrix4(c.makeRotationAxis(i[f],p*f)),o[f].crossVectors(i[f],r[f])}return{tangents:i,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class td extends Gi{constructor(e=0,t=0,n=1,i=1,r=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t=new J){const n=t,i=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(o?r=0:r=i),this.aClockwise===!0&&!o&&(r===i?r=-i:r=r-i);const a=this.aStartAngle+e*r;let c=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=c-this.aX,p=l-this.aY;c=d*u-p*h+this.aX,l=d*h+p*u+this.aY}return n.set(c,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class rv extends td{constructor(e,t,n,i,r,o){super(e,t,n,n,i,r,o),this.isArcCurve=!0,this.type="ArcCurve"}}function ym(){let s=0,e=0,t=0,n=0;function i(r,o,a,c){s=r,e=a,t=-3*r+3*o-2*a-c,n=2*r-2*o+a+c}return{initCatmullRom:function(r,o,a,c,l){i(o,a,l*(a-r),l*(c-o))},initNonuniformCatmullRom:function(r,o,a,c,l,u,h){let d=(o-r)/l-(a-r)/(l+u)+(a-o)/u,p=(a-o)/u-(c-o)/(u+h)+(c-a)/h;d*=u,p*=u,i(o,a,d,p)},calc:function(r){const o=r*r,a=o*r;return s+e*r+t*o+n*a}}}const ou=new E,Rp=new ym,Ip=new ym,Pp=new ym;class vm extends Gi{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new E){const n=t,i=this.points,r=i.length,o=(r-(this.closed?0:1))*e;let a=Math.floor(o),c=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/r)+1)*r:c===0&&a===r-1&&(a=r-2,c=1);let l,u;this.closed||a>0?l=i[(a-1)%r]:(ou.subVectors(i[0],i[1]).add(i[0]),l=ou);const h=i[a%r],d=i[(a+1)%r];if(this.closed||a+2<r?u=i[(a+2)%r]:(ou.subVectors(i[r-1],i[r-2]).add(i[r-1]),u=ou),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let f=Math.pow(l.distanceToSquared(h),p),x=Math.pow(h.distanceToSquared(d),p),m=Math.pow(d.distanceToSquared(u),p);x<1e-4&&(x=1),f<1e-4&&(f=x),m<1e-4&&(m=x),Rp.initNonuniformCatmullRom(l.x,h.x,d.x,u.x,f,x,m),Ip.initNonuniformCatmullRom(l.y,h.y,d.y,u.y,f,x,m),Pp.initNonuniformCatmullRom(l.z,h.z,d.z,u.z,f,x,m)}else this.curveType==="catmullrom"&&(Rp.initCatmullRom(l.x,h.x,d.x,u.x,this.tension),Ip.initCatmullRom(l.y,h.y,d.y,u.y,this.tension),Pp.initCatmullRom(l.z,h.z,d.z,u.z,this.tension));return n.set(Rp.calc(c),Ip.calc(c),Pp.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new E().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Ex(s,e,t,n,i){const r=(n-e)*.5,o=(i-t)*.5,a=s*s,c=s*a;return(2*t-2*n+r+o)*c+(-3*t+3*n-2*r-o)*a+r*s+t}function oI(s,e){const t=1-s;return t*t*e}function aI(s,e){return 2*(1-s)*s*e}function cI(s,e){return s*s*e}function Qa(s,e,t,n){return oI(s,e)+aI(s,t)+cI(s,n)}function lI(s,e){const t=1-s;return t*t*t*e}function uI(s,e){const t=1-s;return 3*t*t*s*e}function hI(s,e){return 3*(1-s)*s*s*e}function dI(s,e){return s*s*s*e}function ec(s,e,t,n,i){return lI(s,e)+uI(s,t)+hI(s,n)+dI(s,i)}class Mm extends Gi{constructor(e=new J,t=new J,n=new J,i=new J){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new J){const n=t,i=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(ec(e,i.x,r.x,o.x,a.x),ec(e,i.y,r.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class ov extends Gi{constructor(e=new E,t=new E,n=new E,i=new E){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new E){const n=t,i=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(ec(e,i.x,r.x,o.x,a.x),ec(e,i.y,r.y,o.y,a.y),ec(e,i.z,r.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Sm extends Gi{constructor(e=new J,t=new J){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new J){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new J){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class av extends Gi{constructor(e=new E,t=new E){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new E){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new E){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Tm extends Gi{constructor(e=new J,t=new J,n=new J){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new J){const n=t,i=this.v0,r=this.v1,o=this.v2;return n.set(Qa(e,i.x,r.x,o.x),Qa(e,i.y,r.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class bm extends Gi{constructor(e=new E,t=new E,n=new E){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new E){const n=t,i=this.v0,r=this.v1,o=this.v2;return n.set(Qa(e,i.x,r.x,o.x),Qa(e,i.y,r.y,o.y),Qa(e,i.z,r.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class wm extends Gi{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new J){const n=t,i=this.points,r=(i.length-1)*e,o=Math.floor(r),a=r-o,c=i[o===0?o:o-1],l=i[o],u=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(Ex(a,c.x,l.x,u.x,h.x),Ex(a,c.y,l.y,u.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new J().fromArray(i))}return this}}var hh=Object.freeze({__proto__:null,ArcCurve:rv,CatmullRomCurve3:vm,CubicBezierCurve:Mm,CubicBezierCurve3:ov,EllipseCurve:td,LineCurve:Sm,LineCurve3:av,QuadraticBezierCurve:Tm,QuadraticBezierCurve3:bm,SplineCurve:wm});class cv extends Gi{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new hh[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const o=i[r]-n,a=this.curves[r],c=a.getLength(),l=c===0?0:1-o/c;return a.getPointAt(l,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const o=r[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,c=o.getPoints(a);for(let l=0;l<c.length;l++){const u=c[l];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new hh[i.type]().fromJSON(i))}return this}}class Ic extends cv{constructor(e){super(),this.type="Path",this.currentPoint=new J,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Sm(this.currentPoint.clone(),new J(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new Tm(this.currentPoint.clone(),new J(e,t),new J(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,o){const a=new Mm(this.currentPoint.clone(),new J(e,t),new J(n,i),new J(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new wm(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,o){const a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,n,i,r,o),this}absarc(e,t,n,i,r,o){return this.absellipse(e,t,n,n,i,r,o),this}ellipse(e,t,n,i,r,o,a,c){const l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,n,i,r,o,a,c),this}absellipse(e,t,n,i,r,o,a,c){const l=new td(e,t,n,i,r,o,a,c);if(this.curves.length>0){const h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);const u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Qc extends at{constructor(e=[new J(0,-.5),new J(.5,0),new J(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=jt(i,0,Math.PI*2);const r=[],o=[],a=[],c=[],l=[],u=1/t,h=new E,d=new J,p=new E,f=new E,x=new E;let m=0,g=0;for(let y=0;y<=e.length-1;y++)switch(y){case 0:m=e[y+1].x-e[y].x,g=e[y+1].y-e[y].y,p.x=g*1,p.y=-m,p.z=g*0,x.copy(p),p.normalize(),c.push(p.x,p.y,p.z);break;case e.length-1:c.push(x.x,x.y,x.z);break;default:m=e[y+1].x-e[y].x,g=e[y+1].y-e[y].y,p.x=g*1,p.y=-m,p.z=g*0,f.copy(p),p.x+=x.x,p.y+=x.y,p.z+=x.z,p.normalize(),c.push(p.x,p.y,p.z),x.copy(f)}for(let y=0;y<=t;y++){const _=n+y*u*i,v=Math.sin(_),I=Math.cos(_);for(let T=0;T<=e.length-1;T++){h.x=e[T].x*v,h.y=e[T].y,h.z=e[T].x*I,o.push(h.x,h.y,h.z),d.x=y/t,d.y=T/(e.length-1),a.push(d.x,d.y);const w=c[3*T+0]*v,C=c[3*T+1],F=c[3*T+0]*I;l.push(w,C,F)}}for(let y=0;y<t;y++)for(let _=0;_<e.length-1;_++){const v=_+y*e.length,I=v,T=v+e.length,w=v+e.length+1,C=v+1;r.push(I,T,C),r.push(w,C,T)}this.setIndex(r),this.setAttribute("position",new Ve(o,3)),this.setAttribute("uv",new Ve(a,2)),this.setAttribute("normal",new Ve(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Qc(e.points,e.segments,e.phiStart,e.phiLength)}}class nd extends Qc{constructor(e=1,t=1,n=4,i=8){const r=new Ic;r.absarc(0,-t/2,e,Math.PI*1.5,0),r.absarc(0,t/2,e,0,Math.PI*.5),super(r.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new nd(e.radius,e.length,e.capSegments,e.radialSegments)}}class id extends at{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const r=[],o=[],a=[],c=[],l=new E,u=new J;o.push(0,0,0),a.push(0,0,1),c.push(.5,.5);for(let h=0,d=3;h<=t;h++,d+=3){const p=n+h/t*i;l.x=e*Math.cos(p),l.y=e*Math.sin(p),o.push(l.x,l.y,l.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+1]/e+1)/2,c.push(u.x,u.y)}for(let h=1;h<=t;h++)r.push(h,h+1,0);this.setIndex(r),this.setAttribute("position",new Ve(o,3)),this.setAttribute("normal",new Ve(a,3)),this.setAttribute("uv",new Ve(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new id(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class lo extends at{constructor(e=1,t=1,n=1,i=32,r=1,o=!1,a=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:c};const l=this;i=Math.floor(i),r=Math.floor(r);const u=[],h=[],d=[],p=[];let f=0;const x=[],m=n/2;let g=0;y(),o===!1&&(e>0&&_(!0),t>0&&_(!1)),this.setIndex(u),this.setAttribute("position",new Ve(h,3)),this.setAttribute("normal",new Ve(d,3)),this.setAttribute("uv",new Ve(p,2));function y(){const v=new E,I=new E;let T=0;const w=(t-e)/n;for(let C=0;C<=r;C++){const F=[],M=C/r,b=M*(t-e)+e;for(let G=0;G<=i;G++){const W=G/i,$=W*c+a,ie=Math.sin($),q=Math.cos($);I.x=b*ie,I.y=-M*n+m,I.z=b*q,h.push(I.x,I.y,I.z),v.set(ie,w,q).normalize(),d.push(v.x,v.y,v.z),p.push(W,1-M),F.push(f++)}x.push(F)}for(let C=0;C<i;C++)for(let F=0;F<r;F++){const M=x[F][C],b=x[F+1][C],G=x[F+1][C+1],W=x[F][C+1];e>0&&(u.push(M,b,W),T+=3),t>0&&(u.push(b,G,W),T+=3)}l.addGroup(g,T,0),g+=T}function _(v){const I=f,T=new J,w=new E;let C=0;const F=v===!0?e:t,M=v===!0?1:-1;for(let G=1;G<=i;G++)h.push(0,m*M,0),d.push(0,M,0),p.push(.5,.5),f++;const b=f;for(let G=0;G<=i;G++){const $=G/i*c+a,ie=Math.cos($),q=Math.sin($);w.x=F*q,w.y=m*M,w.z=F*ie,h.push(w.x,w.y,w.z),d.push(0,M,0),T.x=ie*.5+.5,T.y=q*.5*M+.5,p.push(T.x,T.y),f++}for(let G=0;G<i;G++){const W=I+G,$=b+G;v===!0?u.push($,$+1,W):u.push($+1,$,W),C+=3}l.addGroup(g,C,v===!0?1:2),g+=C}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new lo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class sd extends lo{constructor(e=1,t=1,n=32,i=1,r=!1,o=0,a=Math.PI*2){super(0,e,t,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}static fromJSON(e){return new sd(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class pr extends at{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],o=[];a(i),l(n),u(),this.setAttribute("position",new Ve(r,3)),this.setAttribute("normal",new Ve(r.slice(),3)),this.setAttribute("uv",new Ve(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(y){const _=new E,v=new E,I=new E;for(let T=0;T<t.length;T+=3)p(t[T+0],_),p(t[T+1],v),p(t[T+2],I),c(_,v,I,y)}function c(y,_,v,I){const T=I+1,w=[];for(let C=0;C<=T;C++){w[C]=[];const F=y.clone().lerp(v,C/T),M=_.clone().lerp(v,C/T),b=T-C;for(let G=0;G<=b;G++)G===0&&C===T?w[C][G]=F:w[C][G]=F.clone().lerp(M,G/b)}for(let C=0;C<T;C++)for(let F=0;F<2*(T-C)-1;F++){const M=Math.floor(F/2);F%2===0?(d(w[C][M+1]),d(w[C+1][M]),d(w[C][M])):(d(w[C][M+1]),d(w[C+1][M+1]),d(w[C+1][M]))}}function l(y){const _=new E;for(let v=0;v<r.length;v+=3)_.x=r[v+0],_.y=r[v+1],_.z=r[v+2],_.normalize().multiplyScalar(y),r[v+0]=_.x,r[v+1]=_.y,r[v+2]=_.z}function u(){const y=new E;for(let _=0;_<r.length;_+=3){y.x=r[_+0],y.y=r[_+1],y.z=r[_+2];const v=m(y)/2/Math.PI+.5,I=g(y)/Math.PI+.5;o.push(v,1-I)}f(),h()}function h(){for(let y=0;y<o.length;y+=6){const _=o[y+0],v=o[y+2],I=o[y+4],T=Math.max(_,v,I),w=Math.min(_,v,I);T>.9&&w<.1&&(_<.2&&(o[y+0]+=1),v<.2&&(o[y+2]+=1),I<.2&&(o[y+4]+=1))}}function d(y){r.push(y.x,y.y,y.z)}function p(y,_){const v=y*3;_.x=e[v+0],_.y=e[v+1],_.z=e[v+2]}function f(){const y=new E,_=new E,v=new E,I=new E,T=new J,w=new J,C=new J;for(let F=0,M=0;F<r.length;F+=9,M+=6){y.set(r[F+0],r[F+1],r[F+2]),_.set(r[F+3],r[F+4],r[F+5]),v.set(r[F+6],r[F+7],r[F+8]),T.set(o[M+0],o[M+1]),w.set(o[M+2],o[M+3]),C.set(o[M+4],o[M+5]),I.copy(y).add(_).add(v).divideScalar(3);const b=m(I);x(T,M+0,y,b),x(w,M+2,_,b),x(C,M+4,v,b)}}function x(y,_,v,I){I<0&&y.x===1&&(o[_]=y.x-1),v.x===0&&v.z===0&&(o[_]=I/2/Math.PI+.5)}function m(y){return Math.atan2(y.z,-y.x)}function g(y){return Math.atan2(-y.y,Math.sqrt(y.x*y.x+y.z*y.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new pr(e.vertices,e.indices,e.radius,e.details)}}class rd extends pr{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(r,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new rd(e.radius,e.detail)}}const au=new E,cu=new E,Lp=new E,lu=new Jn;class Am extends at{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),r=Math.cos(Yr*t),o=e.getIndex(),a=e.getAttribute("position"),c=o?o.count:a.count,l=[0,0,0],u=["a","b","c"],h=new Array(3),d={},p=[];for(let f=0;f<c;f+=3){o?(l[0]=o.getX(f),l[1]=o.getX(f+1),l[2]=o.getX(f+2)):(l[0]=f,l[1]=f+1,l[2]=f+2);const{a:x,b:m,c:g}=lu;if(x.fromBufferAttribute(a,l[0]),m.fromBufferAttribute(a,l[1]),g.fromBufferAttribute(a,l[2]),lu.getNormal(Lp),h[0]=`${Math.round(x.x*i)},${Math.round(x.y*i)},${Math.round(x.z*i)}`,h[1]=`${Math.round(m.x*i)},${Math.round(m.y*i)},${Math.round(m.z*i)}`,h[2]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let y=0;y<3;y++){const _=(y+1)%3,v=h[y],I=h[_],T=lu[u[y]],w=lu[u[_]],C=`${v}_${I}`,F=`${I}_${v}`;F in d&&d[F]?(Lp.dot(d[F].normal)<=r&&(p.push(T.x,T.y,T.z),p.push(w.x,w.y,w.z)),d[F]=null):C in d||(d[C]={index0:l[y],index1:l[_],normal:Lp.clone()})}}for(const f in d)if(d[f]){const{index0:x,index1:m}=d[f];au.fromBufferAttribute(a,x),cu.fromBufferAttribute(a,m),p.push(au.x,au.y,au.z),p.push(cu.x,cu.y,cu.z)}this.setAttribute("position",new Ve(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class tr extends Ic{constructor(e){super(e),this.uuid=bi(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new Ic().fromJSON(i))}return this}}const pI={triangulate:function(s,e,t=2){const n=e&&e.length,i=n?e[0]*t:s.length;let r=lv(s,0,i,t,!0);const o=[];if(!r||r.next===r.prev)return o;let a,c,l,u,h,d,p;if(n&&(r=_I(s,e,r,t)),s.length>80*t){a=l=s[0],c=u=s[1];for(let f=t;f<i;f+=t)h=s[f],d=s[f+1],h<a&&(a=h),d<c&&(c=d),h>l&&(l=h),d>u&&(u=d);p=Math.max(l-a,u-c),p=p!==0?32767/p:0}return Pc(r,o,t,a,c,p,0),o}};function lv(s,e,t,n,i){let r,o;if(i===CI(s,e,t,n)>0)for(r=e;r<t;r+=n)o=Cx(r,s[r],s[r+1],o);else for(r=t-n;r>=e;r-=n)o=Cx(r,s[r],s[r+1],o);return o&&od(o,o.next)&&(Dc(o),o=o.next),o}function to(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(od(t,t.next)||Zt(t.prev,t,t.next)===0)){if(Dc(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Pc(s,e,t,n,i,r,o){if(!s)return;!o&&r&&TI(s,n,i,r);let a=s,c,l;for(;s.prev!==s.next;){if(c=s.prev,l=s.next,r?mI(s,n,i,r):fI(s)){e.push(c.i/t|0),e.push(s.i/t|0),e.push(l.i/t|0),Dc(s),s=l.next,a=l.next;continue}if(s=l,s===a){o?o===1?(s=gI(to(s),e,t),Pc(s,e,t,n,i,r,2)):o===2&&xI(s,e,t,n,i,r):Pc(to(s),e,t,n,i,r,1);break}}}function fI(s){const e=s.prev,t=s,n=s.next;if(Zt(e,t,n)>=0)return!1;const i=e.x,r=t.x,o=n.x,a=e.y,c=t.y,l=n.y,u=i<r?i<o?i:o:r<o?r:o,h=a<c?a<l?a:l:c<l?c:l,d=i>r?i>o?i:o:r>o?r:o,p=a>c?a>l?a:l:c>l?c:l;let f=n.next;for(;f!==e;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&Wo(i,a,r,c,o,l,f.x,f.y)&&Zt(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function mI(s,e,t,n){const i=s.prev,r=s,o=s.next;if(Zt(i,r,o)>=0)return!1;const a=i.x,c=r.x,l=o.x,u=i.y,h=r.y,d=o.y,p=a<c?a<l?a:l:c<l?c:l,f=u<h?u<d?u:d:h<d?h:d,x=a>c?a>l?a:l:c>l?c:l,m=u>h?u>d?u:d:h>d?h:d,g=ff(p,f,e,t,n),y=ff(x,m,e,t,n);let _=s.prevZ,v=s.nextZ;for(;_&&_.z>=g&&v&&v.z<=y;){if(_.x>=p&&_.x<=x&&_.y>=f&&_.y<=m&&_!==i&&_!==o&&Wo(a,u,c,h,l,d,_.x,_.y)&&Zt(_.prev,_,_.next)>=0||(_=_.prevZ,v.x>=p&&v.x<=x&&v.y>=f&&v.y<=m&&v!==i&&v!==o&&Wo(a,u,c,h,l,d,v.x,v.y)&&Zt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;_&&_.z>=g;){if(_.x>=p&&_.x<=x&&_.y>=f&&_.y<=m&&_!==i&&_!==o&&Wo(a,u,c,h,l,d,_.x,_.y)&&Zt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=x&&v.y>=f&&v.y<=m&&v!==i&&v!==o&&Wo(a,u,c,h,l,d,v.x,v.y)&&Zt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function gI(s,e,t){let n=s;do{const i=n.prev,r=n.next.next;!od(i,r)&&uv(i,n,n.next,r)&&Lc(i,r)&&Lc(r,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(r.i/t|0),Dc(n),Dc(n.next),n=s=r),n=n.next}while(n!==s);return to(n)}function xI(s,e,t,n,i,r){let o=s;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&AI(o,a)){let c=hv(o,a);o=to(o,o.next),c=to(c,c.next),Pc(o,e,t,n,i,r,0),Pc(c,e,t,n,i,r,0);return}a=a.next}o=o.next}while(o!==s)}function _I(s,e,t,n){const i=[];let r,o,a,c,l;for(r=0,o=e.length;r<o;r++)a=e[r]*n,c=r<o-1?e[r+1]*n:s.length,l=lv(s,a,c,n,!1),l===l.next&&(l.steiner=!0),i.push(wI(l));for(i.sort(yI),r=0;r<i.length;r++)t=vI(i[r],t);return t}function yI(s,e){return s.x-e.x}function vI(s,e){const t=MI(s,e);if(!t)return e;const n=hv(t,s);return to(n,n.next),to(t,t.next)}function MI(s,e){let t=e,n=-1/0,i;const r=s.x,o=s.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){const d=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=r&&d>n&&(n=d,i=t.x<t.next.x?t:t.next,d===r))return i}t=t.next}while(t!==e);if(!i)return null;const a=i,c=i.x,l=i.y;let u=1/0,h;t=i;do r>=t.x&&t.x>=c&&r!==t.x&&Wo(o<l?r:n,o,c,l,o<l?n:r,o,t.x,t.y)&&(h=Math.abs(o-t.y)/(r-t.x),Lc(t,s)&&(h<u||h===u&&(t.x>i.x||t.x===i.x&&SI(i,t)))&&(i=t,u=h)),t=t.next;while(t!==a);return i}function SI(s,e){return Zt(s.prev,s,e.prev)<0&&Zt(e.next,s,s.next)<0}function TI(s,e,t,n){let i=s;do i.z===0&&(i.z=ff(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,bI(i)}function bI(s){let e,t,n,i,r,o,a,c,l=1;do{for(t=s,s=null,r=null,o=0;t;){for(o++,n=t,a=0,e=0;e<l&&(a++,n=n.nextZ,!!n);e++);for(c=l;a>0||c>0&&n;)a!==0&&(c===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,c--),r?r.nextZ=i:s=i,i.prevZ=r,r=i;t=n}r.nextZ=null,l*=2}while(o>1);return s}function ff(s,e,t,n,i){return s=(s-t)*i|0,e=(e-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function wI(s){let e=s,t=s;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==s);return t}function Wo(s,e,t,n,i,r,o,a){return(i-o)*(e-a)>=(s-o)*(r-a)&&(s-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(r-a)>=(i-o)*(n-a)}function AI(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!NI(s,e)&&(Lc(s,e)&&Lc(e,s)&&EI(s,e)&&(Zt(s.prev,s,e.prev)||Zt(s,e.prev,e))||od(s,e)&&Zt(s.prev,s,s.next)>0&&Zt(e.prev,e,e.next)>0)}function Zt(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function od(s,e){return s.x===e.x&&s.y===e.y}function uv(s,e,t,n){const i=hu(Zt(s,e,t)),r=hu(Zt(s,e,n)),o=hu(Zt(t,n,s)),a=hu(Zt(t,n,e));return!!(i!==r&&o!==a||i===0&&uu(s,t,e)||r===0&&uu(s,n,e)||o===0&&uu(t,s,n)||a===0&&uu(t,e,n))}function uu(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function hu(s){return s>0?1:s<0?-1:0}function NI(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&uv(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function Lc(s,e){return Zt(s.prev,s,s.next)<0?Zt(s,e,s.next)>=0&&Zt(s,s.prev,e)>=0:Zt(s,e,s.prev)<0||Zt(s,s.next,e)<0}function EI(s,e){let t=s,n=!1;const i=(s.x+e.x)/2,r=(s.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&i<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function hv(s,e){const t=new mf(s.i,s.x,s.y),n=new mf(e.i,e.x,e.y),i=s.next,r=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function Cx(s,e,t,n){const i=new mf(s,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Dc(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function mf(s,e,t){this.i=s,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function CI(s,e,t,n){let i=0;for(let r=e,o=t-n;r<t;r+=n)i+=(s[o]-s[r])*(s[r+1]+s[o+1]),o=r;return i}class ji{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return n*.5}static isClockWise(e){return ji.area(e)<0}static triangulateShape(e,t){const n=[],i=[],r=[];Rx(e),Ix(n,e);let o=e.length;t.forEach(Rx);for(let c=0;c<t.length;c++)i.push(o),o+=t[c].length,Ix(n,t[c]);const a=pI.triangulate(n,i);for(let c=0;c<a.length;c+=3)r.push(a.slice(c,c+3));return r}}function Rx(s){const e=s.length;e>2&&s[e-1].equals(s[0])&&s.pop()}function Ix(s,e){for(let t=0;t<e.length;t++)s.push(e[t].x),s.push(e[t].y)}class el extends at{constructor(e=new tr([new J(.5,.5),new J(-.5,.5),new J(-.5,-.5),new J(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let a=0,c=e.length;a<c;a++){const l=e[a];o(l)}this.setAttribute("position",new Ve(i,3)),this.setAttribute("uv",new Ve(r,2)),this.computeVertexNormals();function o(a){const c=[],l=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1;let d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,p=t.bevelThickness!==void 0?t.bevelThickness:.2,f=t.bevelSize!==void 0?t.bevelSize:p-.1,x=t.bevelOffset!==void 0?t.bevelOffset:0,m=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,y=t.UVGenerator!==void 0?t.UVGenerator:RI;let _,v=!1,I,T,w,C;g&&(_=g.getSpacedPoints(u),v=!0,d=!1,I=g.computeFrenetFrames(u,!1),T=new E,w=new E,C=new E),d||(m=0,p=0,f=0,x=0);const F=a.extractPoints(l);let M=F.shape;const b=F.holes;if(!ji.isClockWise(M)){M=M.reverse();for(let ae=0,P=b.length;ae<P;ae++){const Me=b[ae];ji.isClockWise(Me)&&(b[ae]=Me.reverse())}}const W=ji.triangulateShape(M,b),$=M;for(let ae=0,P=b.length;ae<P;ae++){const Me=b[ae];M=M.concat(Me)}function ie(ae,P,Me){return P||console.error("THREE.ExtrudeGeometry: vec does not exist"),ae.clone().addScaledVector(P,Me)}const q=M.length,he=W.length;function Q(ae,P,Me){let ye,de,Te;const qe=ae.x-P.x,Ie=ae.y-P.y,R=Me.x-ae.x,S=Me.y-ae.y,X=qe*qe+Ie*Ie,re=qe*S-Ie*R;if(Math.abs(re)>Number.EPSILON){const ce=Math.sqrt(X),se=Math.sqrt(R*R+S*S),ke=P.x-Ie/ce,be=P.y+qe/ce,De=Me.x-S/se,vt=Me.y+R/se,me=((De-ke)*S-(vt-be)*R)/(qe*S-Ie*R);ye=ke+qe*me-ae.x,de=be+Ie*me-ae.y;const Ue=ye*ye+de*de;if(Ue<=2)return new J(ye,de);Te=Math.sqrt(Ue/2)}else{let ce=!1;qe>Number.EPSILON?R>Number.EPSILON&&(ce=!0):qe<-Number.EPSILON?R<-Number.EPSILON&&(ce=!0):Math.sign(Ie)===Math.sign(S)&&(ce=!0),ce?(ye=-Ie,de=qe,Te=Math.sqrt(X)):(ye=qe,de=Ie,Te=Math.sqrt(X/2))}return new J(ye/Te,de/Te)}const we=[];for(let ae=0,P=$.length,Me=P-1,ye=ae+1;ae<P;ae++,Me++,ye++)Me===P&&(Me=0),ye===P&&(ye=0),we[ae]=Q($[ae],$[Me],$[ye]);const Ne=[];let Ee,Qe=we.concat();for(let ae=0,P=b.length;ae<P;ae++){const Me=b[ae];Ee=[];for(let ye=0,de=Me.length,Te=de-1,qe=ye+1;ye<de;ye++,Te++,qe++)Te===de&&(Te=0),qe===de&&(qe=0),Ee[ye]=Q(Me[ye],Me[Te],Me[qe]);Ne.push(Ee),Qe=Qe.concat(Ee)}for(let ae=0;ae<m;ae++){const P=ae/m,Me=p*Math.cos(P*Math.PI/2),ye=f*Math.sin(P*Math.PI/2)+x;for(let de=0,Te=$.length;de<Te;de++){const qe=ie($[de],we[de],ye);ge(qe.x,qe.y,-Me)}for(let de=0,Te=b.length;de<Te;de++){const qe=b[de];Ee=Ne[de];for(let Ie=0,R=qe.length;Ie<R;Ie++){const S=ie(qe[Ie],Ee[Ie],ye);ge(S.x,S.y,-Me)}}}const ht=f+x;for(let ae=0;ae<q;ae++){const P=d?ie(M[ae],Qe[ae],ht):M[ae];v?(w.copy(I.normals[0]).multiplyScalar(P.x),T.copy(I.binormals[0]).multiplyScalar(P.y),C.copy(_[0]).add(w).add(T),ge(C.x,C.y,C.z)):ge(P.x,P.y,0)}for(let ae=1;ae<=u;ae++)for(let P=0;P<q;P++){const Me=d?ie(M[P],Qe[P],ht):M[P];v?(w.copy(I.normals[ae]).multiplyScalar(Me.x),T.copy(I.binormals[ae]).multiplyScalar(Me.y),C.copy(_[ae]).add(w).add(T),ge(C.x,C.y,C.z)):ge(Me.x,Me.y,h/u*ae)}for(let ae=m-1;ae>=0;ae--){const P=ae/m,Me=p*Math.cos(P*Math.PI/2),ye=f*Math.sin(P*Math.PI/2)+x;for(let de=0,Te=$.length;de<Te;de++){const qe=ie($[de],we[de],ye);ge(qe.x,qe.y,h+Me)}for(let de=0,Te=b.length;de<Te;de++){const qe=b[de];Ee=Ne[de];for(let Ie=0,R=qe.length;Ie<R;Ie++){const S=ie(qe[Ie],Ee[Ie],ye);v?ge(S.x,S.y+_[u-1].y,_[u-1].x+Me):ge(S.x,S.y,h+Me)}}}ne(),ue();function ne(){const ae=i.length/3;if(d){let P=0,Me=q*P;for(let ye=0;ye<he;ye++){const de=W[ye];Ze(de[2]+Me,de[1]+Me,de[0]+Me)}P=u+m*2,Me=q*P;for(let ye=0;ye<he;ye++){const de=W[ye];Ze(de[0]+Me,de[1]+Me,de[2]+Me)}}else{for(let P=0;P<he;P++){const Me=W[P];Ze(Me[2],Me[1],Me[0])}for(let P=0;P<he;P++){const Me=W[P];Ze(Me[0]+q*u,Me[1]+q*u,Me[2]+q*u)}}n.addGroup(ae,i.length/3-ae,0)}function ue(){const ae=i.length/3;let P=0;Ae($,P),P+=$.length;for(let Me=0,ye=b.length;Me<ye;Me++){const de=b[Me];Ae(de,P),P+=de.length}n.addGroup(ae,i.length/3-ae,1)}function Ae(ae,P){let Me=ae.length;for(;--Me>=0;){const ye=Me;let de=Me-1;de<0&&(de=ae.length-1);for(let Te=0,qe=u+m*2;Te<qe;Te++){const Ie=q*Te,R=q*(Te+1),S=P+ye+Ie,X=P+de+Ie,re=P+de+R,ce=P+ye+R;Xe(S,X,re,ce)}}}function ge(ae,P,Me){c.push(ae),c.push(P),c.push(Me)}function Ze(ae,P,Me){Je(ae),Je(P),Je(Me);const ye=i.length/3,de=y.generateTopUV(n,i,ye-3,ye-2,ye-1);dt(de[0]),dt(de[1]),dt(de[2])}function Xe(ae,P,Me,ye){Je(ae),Je(P),Je(ye),Je(P),Je(Me),Je(ye);const de=i.length/3,Te=y.generateSideWallUV(n,i,de-6,de-3,de-2,de-1);dt(Te[0]),dt(Te[1]),dt(Te[3]),dt(Te[1]),dt(Te[2]),dt(Te[3])}function Je(ae){i.push(c[ae*3+0]),i.push(c[ae*3+1]),i.push(c[ae*3+2])}function dt(ae){r.push(ae.x),r.push(ae.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return II(t,n,e)}static fromJSON(e,t){const n=[];for(let r=0,o=e.shapes.length;r<o;r++){const a=t[e.shapes[r]];n.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new hh[i.type]().fromJSON(i)),new el(n,e.options)}}const RI={generateTopUV:function(s,e,t,n,i){const r=e[t*3],o=e[t*3+1],a=e[n*3],c=e[n*3+1],l=e[i*3],u=e[i*3+1];return[new J(r,o),new J(a,c),new J(l,u)]},generateSideWallUV:function(s,e,t,n,i,r){const o=e[t*3],a=e[t*3+1],c=e[t*3+2],l=e[n*3],u=e[n*3+1],h=e[n*3+2],d=e[i*3],p=e[i*3+1],f=e[i*3+2],x=e[r*3],m=e[r*3+1],g=e[r*3+2];return Math.abs(a-u)<Math.abs(o-l)?[new J(o,1-c),new J(l,1-h),new J(d,1-f),new J(x,1-g)]:[new J(a,1-c),new J(u,1-h),new J(p,1-f),new J(m,1-g)]}};function II(s,e,t){if(t.shapes=[],Array.isArray(s))for(let n=0,i=s.length;n<i;n++){const r=s[n];t.shapes.push(r.uuid)}else t.shapes.push(s.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class ad extends pr{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,r,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ad(e.radius,e.detail)}}class Ma extends pr{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ma(e.radius,e.detail)}}class tl extends at{constructor(e=.5,t=1,n=32,i=1,r=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const a=[],c=[],l=[],u=[];let h=e;const d=(t-e)/i,p=new E,f=new J;for(let x=0;x<=i;x++){for(let m=0;m<=n;m++){const g=r+m/n*o;p.x=h*Math.cos(g),p.y=h*Math.sin(g),c.push(p.x,p.y,p.z),l.push(0,0,1),f.x=(p.x/t+1)/2,f.y=(p.y/t+1)/2,u.push(f.x,f.y)}h+=d}for(let x=0;x<i;x++){const m=x*(n+1);for(let g=0;g<n;g++){const y=g+m,_=y,v=y+n+1,I=y+n+2,T=y+1;a.push(_,v,T),a.push(v,I,T)}}this.setIndex(a),this.setAttribute("position",new Ve(c,3)),this.setAttribute("normal",new Ve(l,3)),this.setAttribute("uv",new Ve(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tl(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class cd extends at{constructor(e=new tr([new J(0,.5),new J(-.5,-.5),new J(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],o=[];let a=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let u=0;u<e.length;u++)l(e[u]),this.addGroup(a,c,u),a+=c,c=0;this.setIndex(n),this.setAttribute("position",new Ve(i,3)),this.setAttribute("normal",new Ve(r,3)),this.setAttribute("uv",new Ve(o,2));function l(u){const h=i.length/3,d=u.extractPoints(t);let p=d.shape;const f=d.holes;ji.isClockWise(p)===!1&&(p=p.reverse());for(let m=0,g=f.length;m<g;m++){const y=f[m];ji.isClockWise(y)===!0&&(f[m]=y.reverse())}const x=ji.triangulateShape(p,f);for(let m=0,g=f.length;m<g;m++){const y=f[m];p=p.concat(y)}for(let m=0,g=p.length;m<g;m++){const y=p[m];i.push(y.x,y.y,0),r.push(0,0,1),o.push(y.x,y.y)}for(let m=0,g=x.length;m<g;m++){const y=x[m],_=y[0]+h,v=y[1]+h,I=y[2]+h;n.push(_,v,I),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return PI(t,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const o=t[e.shapes[i]];n.push(o)}return new cd(n,e.curveSegments)}}function PI(s,e){if(e.shapes=[],Array.isArray(s))for(let t=0,n=s.length;t<n;t++){const i=s[t];e.shapes.push(i.uuid)}else e.shapes.push(s.uuid);return e}class Sa extends at{constructor(e=1,t=32,n=16,i=0,r=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const c=Math.min(o+a,Math.PI);let l=0;const u=[],h=new E,d=new E,p=[],f=[],x=[],m=[];for(let g=0;g<=n;g++){const y=[],_=g/n;let v=0;g===0&&o===0?v=.5/t:g===n&&c===Math.PI&&(v=-.5/t);for(let I=0;I<=t;I++){const T=I/t;h.x=-e*Math.cos(i+T*r)*Math.sin(o+_*a),h.y=e*Math.cos(o+_*a),h.z=e*Math.sin(i+T*r)*Math.sin(o+_*a),f.push(h.x,h.y,h.z),d.copy(h).normalize(),x.push(d.x,d.y,d.z),m.push(T+v,1-_),y.push(l++)}u.push(y)}for(let g=0;g<n;g++)for(let y=0;y<t;y++){const _=u[g][y+1],v=u[g][y],I=u[g+1][y],T=u[g+1][y+1];(g!==0||o>0)&&p.push(_,v,T),(g!==n-1||c<Math.PI)&&p.push(v,I,T)}this.setIndex(p),this.setAttribute("position",new Ve(f,3)),this.setAttribute("normal",new Ve(x,3)),this.setAttribute("uv",new Ve(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sa(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class ld extends pr{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ld(e.radius,e.detail)}}class nl extends at{constructor(e=1,t=.4,n=12,i=48,r=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],c=[],l=[],u=new E,h=new E,d=new E;for(let p=0;p<=n;p++)for(let f=0;f<=i;f++){const x=f/i*r,m=p/n*Math.PI*2;h.x=(e+t*Math.cos(m))*Math.cos(x),h.y=(e+t*Math.cos(m))*Math.sin(x),h.z=t*Math.sin(m),a.push(h.x,h.y,h.z),u.x=e*Math.cos(x),u.y=e*Math.sin(x),d.subVectors(h,u).normalize(),c.push(d.x,d.y,d.z),l.push(f/i),l.push(p/n)}for(let p=1;p<=n;p++)for(let f=1;f<=i;f++){const x=(i+1)*p+f-1,m=(i+1)*(p-1)+f-1,g=(i+1)*(p-1)+f,y=(i+1)*p+f;o.push(x,m,y),o.push(m,g,y)}this.setIndex(o),this.setAttribute("position",new Ve(a,3)),this.setAttribute("normal",new Ve(c,3)),this.setAttribute("uv",new Ve(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nl(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class ud extends at{constructor(e=1,t=.4,n=64,i=8,r=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:o},n=Math.floor(n),i=Math.floor(i);const a=[],c=[],l=[],u=[],h=new E,d=new E,p=new E,f=new E,x=new E,m=new E,g=new E;for(let _=0;_<=n;++_){const v=_/n*r*Math.PI*2;y(v,r,o,e,p),y(v+.01,r,o,e,f),m.subVectors(f,p),g.addVectors(f,p),x.crossVectors(m,g),g.crossVectors(x,m),x.normalize(),g.normalize();for(let I=0;I<=i;++I){const T=I/i*Math.PI*2,w=-t*Math.cos(T),C=t*Math.sin(T);h.x=p.x+(w*g.x+C*x.x),h.y=p.y+(w*g.y+C*x.y),h.z=p.z+(w*g.z+C*x.z),c.push(h.x,h.y,h.z),d.subVectors(h,p).normalize(),l.push(d.x,d.y,d.z),u.push(_/n),u.push(I/i)}}for(let _=1;_<=n;_++)for(let v=1;v<=i;v++){const I=(i+1)*(_-1)+(v-1),T=(i+1)*_+(v-1),w=(i+1)*_+v,C=(i+1)*(_-1)+v;a.push(I,T,C),a.push(T,w,C)}this.setIndex(a),this.setAttribute("position",new Ve(c,3)),this.setAttribute("normal",new Ve(l,3)),this.setAttribute("uv",new Ve(u,2));function y(_,v,I,T,w){const C=Math.cos(_),F=Math.sin(_),M=I/v*_,b=Math.cos(M);w.x=T*(2+b)*.5*C,w.y=T*(2+b)*F*.5,w.z=T*Math.sin(M)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ud(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class hd extends at{constructor(e=new bm(new E(-1,-1,0),new E(-1,1,0),new E(1,1,0)),t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const o=e.computeFrenetFrames(t,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new E,c=new E,l=new J;let u=new E;const h=[],d=[],p=[],f=[];x(),this.setIndex(f),this.setAttribute("position",new Ve(h,3)),this.setAttribute("normal",new Ve(d,3)),this.setAttribute("uv",new Ve(p,2));function x(){for(let _=0;_<t;_++)m(_);m(r===!1?t:0),y(),g()}function m(_){u=e.getPointAt(_/t,u);const v=o.normals[_],I=o.binormals[_];for(let T=0;T<=i;T++){const w=T/i*Math.PI*2,C=Math.sin(w),F=-Math.cos(w);c.x=F*v.x+C*I.x,c.y=F*v.y+C*I.y,c.z=F*v.z+C*I.z,c.normalize(),d.push(c.x,c.y,c.z),a.x=u.x+n*c.x,a.y=u.y+n*c.y,a.z=u.z+n*c.z,h.push(a.x,a.y,a.z)}}function g(){for(let _=1;_<=t;_++)for(let v=1;v<=i;v++){const I=(i+1)*(_-1)+(v-1),T=(i+1)*_+(v-1),w=(i+1)*_+v,C=(i+1)*(_-1)+v;f.push(I,T,C),f.push(T,w,C)}}function y(){for(let _=0;_<=t;_++)for(let v=0;v<=i;v++)l.x=_/t,l.y=v/i,p.push(l.x,l.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new hd(new hh[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Nm extends at{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new E,r=new E;if(e.index!==null){const o=e.attributes.position,a=e.index;let c=e.groups;c.length===0&&(c=[{start:0,count:a.count,materialIndex:0}]);for(let l=0,u=c.length;l<u;++l){const h=c[l],d=h.start,p=h.count;for(let f=d,x=d+p;f<x;f+=3)for(let m=0;m<3;m++){const g=a.getX(f+m),y=a.getX(f+(m+1)%3);i.fromBufferAttribute(o,g),r.fromBufferAttribute(o,y),Px(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}}else{const o=e.attributes.position;for(let a=0,c=o.count/3;a<c;a++)for(let l=0;l<3;l++){const u=3*a+l,h=3*a+(l+1)%3;i.fromBufferAttribute(o,u),r.fromBufferAttribute(o,h),Px(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new Ve(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Px(s,e,t){const n=`${s.x},${s.y},${s.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${s.x},${s.y},${s.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var Lx=Object.freeze({__proto__:null,BoxGeometry:vs,CapsuleGeometry:nd,CircleGeometry:id,ConeGeometry:sd,CylinderGeometry:lo,DodecahedronGeometry:rd,EdgesGeometry:Am,ExtrudeGeometry:el,IcosahedronGeometry:ad,LatheGeometry:Qc,OctahedronGeometry:Ma,PlaneGeometry:oo,PolyhedronGeometry:pr,RingGeometry:tl,ShapeGeometry:cd,SphereGeometry:Sa,TetrahedronGeometry:ld,TorusGeometry:nl,TorusKnotGeometry:ud,TubeGeometry:hd,WireframeGeometry:Nm});class dd extends mn{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new _e(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class Em extends ki{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class il extends mn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new _e(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xs,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ui,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class pd extends il{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new J(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return jt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new _e(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new _e(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new _e(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class fd extends mn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new _e(16777215),this.specular=new _e(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xs,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ui,this.combine=ma,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Cm extends mn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new _e(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xs,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class md extends mn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xs,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class gd extends mn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new _e(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xs,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ui,this.combine=ma,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Rm extends mn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new _e(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xs,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class xd extends Fn{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Xr(s,e,t){return!s||!t&&s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function dv(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function pv(s){function e(i,r){return s[i]-s[r]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function gf(s,e,t){const n=s.length,i=new s.constructor(n);for(let r=0,o=0;o!==n;++r){const a=t[r]*e;for(let c=0;c!==e;++c)i[o++]=s[a+c]}return i}function Im(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let o=r[n];if(o!==void 0)if(Array.isArray(o))do o=r[n],o!==void 0&&(e.push(r.time),t.push.apply(t,o)),r=s[i++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[n],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do o=r[n],o!==void 0&&(e.push(r.time),t.push(o)),r=s[i++];while(r!==void 0)}function LI(s,e,t,n,i=30){const r=s.clone();r.name=e;const o=[];for(let c=0;c<r.tracks.length;++c){const l=r.tracks[c],u=l.getValueSize(),h=[],d=[];for(let p=0;p<l.times.length;++p){const f=l.times[p]*i;if(!(f<t||f>=n)){h.push(l.times[p]);for(let x=0;x<u;++x)d.push(l.values[p*u+x])}}h.length!==0&&(l.times=Xr(h,l.times.constructor),l.values=Xr(d,l.values.constructor),o.push(l))}r.tracks=o;let a=1/0;for(let c=0;c<r.tracks.length;++c)a>r.tracks[c].times[0]&&(a=r.tracks[c].times[0]);for(let c=0;c<r.tracks.length;++c)r.tracks[c].shift(-1*a);return r.resetDuration(),r}function DI(s,e=0,t=s,n=30){n<=0&&(n=30);const i=t.tracks.length,r=e/n;for(let o=0;o<i;++o){const a=t.tracks[o],c=a.ValueTypeName;if(c==="bool"||c==="string")continue;const l=s.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===c});if(l===void 0)continue;let u=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let d=0;const p=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=p/3);const f=a.times.length-1;let x;if(r<=a.times[0]){const g=u,y=h-u;x=a.values.slice(g,y)}else if(r>=a.times[f]){const g=f*h+u,y=g+h-u;x=a.values.slice(g,y)}else{const g=a.createInterpolant(),y=u,_=h-u;g.evaluate(r),x=g.resultBuffer.slice(y,_)}c==="quaternion"&&new Hn().fromArray(x).normalize().conjugate().toArray(x);const m=l.times.length;for(let g=0;g<m;++g){const y=g*p+d;if(c==="quaternion")Hn.multiplyQuaternionsFlat(l.values,y,x,0,l.values,y);else{const _=p-d*2;for(let v=0;v<_;++v)l.values[y+v]-=x[v]}}}return s.blendMode=jf,s}const UI={convertArray:Xr,isTypedArray:dv,getKeyframeOrder:pv,sortedArray:gf,flattenJSON:Im,subclip:LI,makeClipAdditive:DI};class Ta{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=r)){const a=t[1];e<a&&(n=2,r=a);for(let c=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=r,r=t[--n-1],e>=r)break t}o=n,n=0;break n}break e}for(;n<o;){const a=n+o>>>1;e<t[a]?o=a:n=a+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let o=0;o!==i;++o)t[o]=n[r+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class fv extends Ta{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:kr,endingEnd:kr}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,o=e+1,a=i[r],c=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case Gr:r=e,a=2*t-n;break;case Ac:r=i.length-2,a=t+i[r]-i[r+1];break;default:r=e,a=n}if(c===void 0)switch(this.getSettings_().endingEnd){case Gr:o=e,c=2*n-t;break;case Ac:o=1,c=n+i[1]-i[0];break;default:o=e-1,c=t}const l=(n-t)*.5,u=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(c-n),this._offsetPrev=r*u,this._offsetNext=o*u}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,p=this._weightNext,f=(n-t)/(i-t),x=f*f,m=x*f,g=-d*m+2*d*x-d*f,y=(1+d)*m+(-1.5-2*d)*x+(-.5+d)*f+1,_=(-1-p)*m+(1.5+p)*x+.5*f,v=p*m-p*x;for(let I=0;I!==a;++I)r[I]=g*o[u+I]+y*o[l+I]+_*o[c+I]+v*o[h+I];return r}}class Pm extends Ta{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=(n-t)/(i-t),h=1-u;for(let d=0;d!==a;++d)r[d]=o[l+d]*h+o[c+d]*u;return r}}class mv extends Ta{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Hi{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Xr(t,this.TimeBufferType),this.values=Xr(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Xr(e.times,Array),values:Xr(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new mv(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Pm(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new fv(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case sa:t=this.InterpolantFactoryMethodDiscrete;break;case wc:t=this.InterpolantFactoryMethodLinear;break;case Iu:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return sa;case this.InterpolantFactoryMethodLinear:return wc;case this.InterpolantFactoryMethodSmooth:return Iu}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,o=i-1;for(;r!==i&&n[r]<e;)++r;for(;o!==-1&&n[o]>t;)--o;if(++o,r!==0||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=n.slice(r,o),this.values=this.values.slice(r*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const c=n[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(i!==void 0&&dv(i))for(let a=0,c=i.length;a!==c;++a){const l=i[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Iu,r=e.length-1;let o=1;for(let a=1;a<r;++a){let c=!1;const l=e[a],u=e[a+1];if(l!==u&&(a!==1||l!==e[0]))if(i)c=!0;else{const h=a*n,d=h-n,p=h+n;for(let f=0;f!==n;++f){const x=t[h+f];if(x!==t[d+f]||x!==t[p+f]){c=!0;break}}}if(c){if(a!==o){e[o]=e[a];const h=a*n,d=o*n;for(let p=0;p!==n;++p)t[d+p]=t[h+p]}++o}}if(r>0){e[o]=e[r];for(let a=r*n,c=o*n,l=0;l!==n;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Hi.prototype.TimeBufferType=Float32Array;Hi.prototype.ValueBufferType=Float32Array;Hi.prototype.DefaultInterpolation=wc;class fr extends Hi{constructor(e,t,n){super(e,t,n)}}fr.prototype.ValueTypeName="bool";fr.prototype.ValueBufferType=Array;fr.prototype.DefaultInterpolation=sa;fr.prototype.InterpolantFactoryMethodLinear=void 0;fr.prototype.InterpolantFactoryMethodSmooth=void 0;class _d extends Hi{}_d.prototype.ValueTypeName="color";class ca extends Hi{}ca.prototype.ValueTypeName="number";class gv extends Ta{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(n-t)/(i-t);let l=e*a;for(let u=l+a;l!==u;l+=4)Hn.slerpFlat(r,0,o,l-a,o,l,c);return r}}class ba extends Hi{InterpolantFactoryMethodLinear(e){return new gv(this.times,this.values,this.getValueSize(),e)}}ba.prototype.ValueTypeName="quaternion";ba.prototype.InterpolantFactoryMethodSmooth=void 0;class uo extends Hi{constructor(e,t,n){super(e,t,n)}}uo.prototype.ValueTypeName="string";uo.prototype.ValueBufferType=Array;uo.prototype.DefaultInterpolation=sa;uo.prototype.InterpolantFactoryMethodLinear=void 0;uo.prototype.InterpolantFactoryMethodSmooth=void 0;class la extends Hi{}la.prototype.ValueTypeName="vector";class ua{constructor(e="",t=-1,n=[],i=Hh){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=bi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(OI(n[o]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=n.length;r!==o;++r)t.push(Hi.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,o=[];for(let a=0;a<r;a++){let c=[],l=[];c.push((a+r-1)%r,a,(a+1)%r),l.push(0,1,0);const u=pv(c);c=gf(c,1,u),l=gf(l,1,u),!i&&c[0]===0&&(c.push(r),l.push(l[0])),o.push(new ca(".morphTargetInfluences["+t[a].name+"]",c,l).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let a=0,c=e.length;a<c;a++){const l=e[a],u=l.name.match(r);if(u&&u.length>1){const h=u[1];let d=i[h];d||(i[h]=d=[]),d.push(l)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,d,p,f,x){if(p.length!==0){const m=[],g=[];Im(p,m,g,f),m.length!==0&&x.push(new h(d,m,g))}},i=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let h=0;h<l.length;h++){const d=l[h].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const p={};let f;for(f=0;f<d.length;f++)if(d[f].morphTargets)for(let x=0;x<d[f].morphTargets.length;x++)p[d[f].morphTargets[x]]=-1;for(const x in p){const m=[],g=[];for(let y=0;y!==d[f].morphTargets.length;++y){const _=d[f];m.push(_.time),g.push(_.morphTarget===x?1:0)}i.push(new ca(".morphTargetInfluence["+x+"]",m,g))}c=p.length*o}else{const p=".bones["+t[h].name+"]";n(la,p+".position",d,"pos",i),n(ba,p+".quaternion",d,"rot",i),n(la,p+".scale",d,"scl",i)}}return i.length===0?null:new this(r,c,i,a)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function FI(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ca;case"vector":case"vector2":case"vector3":case"vector4":return la;case"color":return _d;case"quaternion":return ba;case"bool":case"boolean":return fr;case"string":return uo}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function OI(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=FI(s.type);if(s.times===void 0){const t=[],n=[];Im(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const ps={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(this.files[s]=e)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class yd{constructor(e,t,n){const i=this;let r=!1,o=0,a=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){a++,r===!1&&i.onStart!==void 0&&i.onStart(u,o,a),r=!0},this.itemEnd=function(u){o++,i.onProgress!==void 0&&i.onProgress(u,o,a),o===a&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return c?c(u):u},this.setURLModifier=function(u){return c=u,this},this.addHandler=function(u,h){return l.push(u,h),this},this.removeHandler=function(u){const h=l.indexOf(u);return h!==-1&&l.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=l.length;h<d;h+=2){const p=l[h],f=l[h+1];if(p.global&&(p.lastIndex=0),p.test(u))return f}return null}}}const Lm=new yd;class qn{constructor(e){this.manager=e!==void 0?e:Lm,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}qn.DEFAULT_MATERIAL_NAME="__DEFAULT";const Es={};class VI extends Error{constructor(e,t){super(e),this.response=t}}class ts extends qn{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=ps.get(e);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(Es[e]!==void 0){Es[e].push({onLoad:t,onProgress:n,onError:i});return}Es[e]=[],Es[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,c=this.responseType;fetch(o).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const u=Es[e],h=l.body.getReader(),d=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),p=d?parseInt(d):0,f=p!==0;let x=0;const m=new ReadableStream({start(g){y();function y(){h.read().then(({done:_,value:v})=>{if(_)g.close();else{x+=v.byteLength;const I=new ProgressEvent("progress",{lengthComputable:f,loaded:x,total:p});for(let T=0,w=u.length;T<w;T++){const C=u[T];C.onProgress&&C.onProgress(I)}g.enqueue(v),y()}},_=>{g.error(_)})}}});return new Response(m)}else throw new VI(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return l.json();default:if(a===void 0)return l.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),d=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(d);return l.arrayBuffer().then(f=>p.decode(f))}}}).then(l=>{ps.add(e,l);const u=Es[e];delete Es[e];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onLoad&&p.onLoad(l)}}).catch(l=>{const u=Es[e];if(u===void 0)throw this.manager.itemError(e),l;delete Es[e];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onError&&p.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class BI extends qn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new ts(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=ua.parse(e[n]);t.push(i)}return t}}class zI extends qn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=[],a=new jc,c=new ts(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(r.withCredentials);let l=0;function u(h){c.load(e[h],function(d){const p=r.parse(d,!0);o[h]={width:p.width,height:p.height,format:p.format,mipmaps:p.mipmaps},l+=1,l===6&&(p.mipmapCount===1&&(a.minFilter=Ut),a.image=o,a.format=p.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let h=0,d=e.length;h<d;++h)u(h);else c.load(e,function(h){const d=r.parse(h,!0);if(d.isCubemap){const p=d.mipmaps.length/d.mipmapCount;for(let f=0;f<p;f++){o[f]={mipmaps:[]};for(let x=0;x<d.mipmapCount;x++)o[f].mipmaps.push(d.mipmaps[f*d.mipmapCount+x]),o[f].format=d.format,o[f].width=d.width,o[f].height=d.height}a.image=o}else a.image.width=d.width,a.image.height=d.height,a.mipmaps=d.mipmaps;d.mipmapCount===1&&(a.minFilter=Ut),a.format=d.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}}class Uc extends qn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=ps.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a=Rc("img");function c(){u(),ps.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(h){u(),i&&i(h),r.manager.itemError(e),r.manager.itemEnd(e)}function u(){a.removeEventListener("load",c,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",c,!1),a.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class kI extends qn{constructor(e){super(e)}load(e,t,n,i){const r=new ro;r.colorSpace=kn;const o=new Uc(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function c(l){o.load(e[l],function(u){r.images[l]=u,a++,a===6&&(r.needsUpdate=!0,t&&t(r))},void 0,i)}for(let l=0;l<e.length;++l)c(l);return r}}class xv extends qn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new Oi,a=new ts(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(e,function(c){let l;try{l=r.parse(c)}catch(u){if(i!==void 0)i(u);else{console.error(u);return}}l.image!==void 0?o.image=l.image:l.data!==void 0&&(o.image.width=l.width,o.image.height=l.height,o.image.data=l.data),o.wrapS=l.wrapS!==void 0?l.wrapS:Si,o.wrapT=l.wrapT!==void 0?l.wrapT:Si,o.magFilter=l.magFilter!==void 0?l.magFilter:Ut,o.minFilter=l.minFilter!==void 0?l.minFilter:Ut,o.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.colorSpace!==void 0&&(o.colorSpace=l.colorSpace),l.flipY!==void 0&&(o.flipY=l.flipY),l.format!==void 0&&(o.format=l.format),l.type!==void 0&&(o.type=l.type),l.mipmaps!==void 0&&(o.mipmaps=l.mipmaps,o.minFilter=Kn),l.mipmapCount===1&&(o.minFilter=Ut),l.generateMipmaps!==void 0&&(o.generateMipmaps=l.generateMipmaps),o.needsUpdate=!0,t&&t(o,l)},n,i),o}}class _v extends qn{constructor(e){super(e)}load(e,t,n,i){const r=new Xt,o=new Uc(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){r.image=a,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}}class mr extends yt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new _e(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class vd extends mr{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(yt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new _e(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Dp=new Fe,Dx=new E,Ux=new E;class Dm{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new J(512,512),this.map=null,this.mapPass=null,this.matrix=new Fe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new xa,this._frameExtents=new J(1,1),this._viewportCount=1,this._viewports=[new st(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Dx.setFromMatrixPosition(e.matrixWorld),t.position.copy(Dx),Ux.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Ux),t.updateMatrixWorld(),Dp.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Dp),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Dp)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class GI extends Dm{constructor(){super(new hn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=oa*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class sl extends mr{constructor(e,t,n=0,i=Math.PI/3,r=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(yt.DEFAULT_UP),this.updateMatrix(),this.target=new yt,this.distance=n,this.angle=i,this.penumbra=r,this.decay=o,this.map=null,this.shadow=new GI}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const Fx=new Fe,Ga=new E,Up=new E;class HI extends Dm{constructor(){super(new hn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new J(4,2),this._viewportCount=6,this._viewports=[new st(2,1,1,1),new st(0,1,1,1),new st(3,1,1,1),new st(1,1,1,1),new st(3,0,1,1),new st(1,0,1,1)],this._cubeDirections=[new E(1,0,0),new E(-1,0,0),new E(0,0,1),new E(0,0,-1),new E(0,1,0),new E(0,-1,0)],this._cubeUps=[new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,0,1),new E(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Ga.setFromMatrixPosition(e.matrixWorld),n.position.copy(Ga),Up.copy(n.position),Up.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Up),n.updateMatrixWorld(),i.makeTranslation(-Ga.x,-Ga.y,-Ga.z),Fx.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Fx)}}class Md extends mr{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new HI}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class WI extends Dm{constructor(){super(new ao(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Sd extends mr{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(yt.DEFAULT_UP),this.updateMatrix(),this.target=new yt,this.shadow=new WI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Td extends mr{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Um extends mr{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class yv{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new E)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*r),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*r)),t.addScaledVector(o[6],.315392*(3*r*r-1)),t.addScaledVector(o[7],1.092548*(n*r)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*r),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*r),t.addScaledVector(o[6],.743125*r*r-.247708),t.addScaledVector(o[7],2*.429043*n*r),t.addScaledVector(o[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}class Fm extends mr{constructor(e=new yv,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class rl extends qn{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,o=new ts(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(r){return t[r]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",r),t[r]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new _e().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const r in e.uniforms){const o=e.uniforms[r];switch(i.uniforms[r]={},o.type){case"t":i.uniforms[r].value=n(o.value);break;case"c":i.uniforms[r].value=new _e().setHex(o.value);break;case"v2":i.uniforms[r].value=new J().fromArray(o.value);break;case"v3":i.uniforms[r].value=new E().fromArray(o.value);break;case"v4":i.uniforms[r].value=new st().fromArray(o.value);break;case"m3":i.uniforms[r].value=new Ke().fromArray(o.value);break;case"m4":i.uniforms[r].value=new Fe().fromArray(o.value);break;default:i.uniforms[r].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const r in e.extensions)i.extensions[r]=e.extensions[r];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),i.normalScale=new J().fromArray(r)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new J().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return rl.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:dd,SpriteMaterial:Jc,RawShaderMaterial:Em,ShaderMaterial:ki,PointsMaterial:va,MeshPhysicalMaterial:pd,MeshStandardMaterial:il,MeshPhongMaterial:fd,MeshToonMaterial:Cm,MeshNormalMaterial:md,MeshLambertMaterial:gd,MeshDepthMaterial:Kh,MeshDistanceMaterial:cm,MeshBasicMaterial:ss,MeshMatcapMaterial:Rm,LineDashedMaterial:xd,LineBasicMaterial:Fn,Material:mn};return new t[e]}}class dh{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Om extends at{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class vv extends qn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new ts(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(p,f){if(t[f]!==void 0)return t[f];const m=p.interleavedBuffers[f],g=r(p,m.buffer),y=Go(m.type,g),_=new ya(y,m.stride);return _.uuid=m.uuid,t[f]=_,_}function r(p,f){if(n[f]!==void 0)return n[f];const m=p.arrayBuffers[f],g=new Uint32Array(m).buffer;return n[f]=g,g}const o=e.isInstancedBufferGeometry?new Om:new at,a=e.data.index;if(a!==void 0){const p=Go(a.type,a.array);o.setIndex(new At(p,1))}const c=e.data.attributes;for(const p in c){const f=c[p];let x;if(f.isInterleavedBufferAttribute){const m=i(e.data,f.data);x=new Us(m,f.itemSize,f.offset,f.normalized)}else{const m=Go(f.type,f.array),g=f.isInstancedBufferAttribute?Fs:At;x=new g(m,f.itemSize,f.normalized)}f.name!==void 0&&(x.name=f.name),f.usage!==void 0&&x.setUsage(f.usage),o.setAttribute(p,x)}const l=e.data.morphAttributes;if(l)for(const p in l){const f=l[p],x=[];for(let m=0,g=f.length;m<g;m++){const y=f[m];let _;if(y.isInterleavedBufferAttribute){const v=i(e.data,y.data);_=new Us(v,y.itemSize,y.offset,y.normalized)}else{const v=Go(y.type,y.array);_=new At(v,y.itemSize,y.normalized)}y.name!==void 0&&(_.name=y.name),x.push(_)}o.morphAttributes[p]=x}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let p=0,f=h.length;p!==f;++p){const x=h[p];o.addGroup(x.start,x.count,x.materialIndex)}const d=e.data.boundingSphere;if(d!==void 0){const p=new E;d.center!==void 0&&p.fromArray(d.center),o.boundingSphere=new Dn(p,d.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class Mv extends qn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=this.path===""?dh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new ts(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){let l=null;try{l=JSON.parse(c)}catch(h){i!==void 0&&i(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const u=l.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}r.parse(l,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?dh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const r=new ts(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const o=await r.loadAsync(e,t),a=JSON.parse(o),c=a.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(a)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(l)}),a=this.parseTextures(e.textures,o),c=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,r,c,a,n),u=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,u),this.bindLightTargets(l),t!==void 0){let h=!1;for(const d in o)if(o[d].data instanceof HTMLImageElement){h=!0;break}h===!1&&t(l)}return l}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),r=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,r),a=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,i,a,o,t),l=this.parseSkeletons(e.skeletons,c);return this.bindSkeletons(c,l),this.bindLightTargets(c),c}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const r=new tr().fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(r){r.isBone&&(i[r.uuid]=r)}),e!==void 0)for(let r=0,o=e.length;r<o;r++){const a=new Kc().fromJSON(e[r],i);n[a.uuid]=a}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new vv;for(let r=0,o=e.length;r<o;r++){let a;const c=e[r];switch(c.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(c);break;default:c.type in Lx?a=Lx[c.type].fromJSON(c,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`)}a.uuid=c.uuid,c.name!==void 0&&(a.name=c.name),c.userData!==void 0&&(a.userData=c.userData),n[c.uuid]=a}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const r=new rl;r.setTextures(t);for(let o=0,a=e.length;o<a;o++){const c=e[o];n[c.uuid]===void 0&&(n[c.uuid]=r.parse(c)),i[c.uuid]=n[c.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],r=ua.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function o(c){return n.manager.itemStart(c),r.load(c,function(){n.manager.itemEnd(c)},void 0,function(){n.manager.itemError(c),n.manager.itemEnd(c)})}function a(c){if(typeof c=="string"){const l=c,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l)?l:n.resourcePath+l;return o(u)}else return c.data?{data:Go(c.type,c.data),width:c.width,height:c.height}:null}if(e!==void 0&&e.length>0){const c=new yd(t);r=new Uc(c),r.setCrossOrigin(this.crossOrigin);for(let l=0,u=e.length;l<u;l++){const h=e[l],d=h.url;if(Array.isArray(d)){const p=[];for(let f=0,x=d.length;f<x;f++){const m=d[f],g=a(m);g!==null&&(g instanceof HTMLImageElement?p.push(g):p.push(new Oi(g.data,g.width,g.height)))}i[h.uuid]=new Ks(p)}else{const p=a(h.url);i[h.uuid]=new Ks(p)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function r(o){if(typeof o=="string"){const a=o,c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await i.loadAsync(c)}else return o.data?{data:Go(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new Uc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const c=e[o],l=c.url;if(Array.isArray(l)){const u=[];for(let h=0,d=l.length;h<d;h++){const p=l[h],f=await r(p);f!==null&&(f instanceof HTMLImageElement?u.push(f):u.push(new Oi(f.data,f.width,f.height)))}n[c.uuid]=new Ks(u)}else{const u=await r(c.url);n[c.uuid]=new Ks(u)}}}return n}parseTextures(e,t){function n(r,o){return typeof r=="number"?r:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",r),o[r])}const i={};if(e!==void 0)for(let r=0,o=e.length;r<o;r++){const a=e[r];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const c=t[a.image],l=c.data;let u;Array.isArray(l)?(u=new ro,l.length===6&&(u.needsUpdate=!0)):(l&&l.data?u=new Oi:u=new Xt,l&&(u.needsUpdate=!0)),u.source=c,u.uuid=a.uuid,a.name!==void 0&&(u.name=a.name),a.mapping!==void 0&&(u.mapping=n(a.mapping,XI)),a.channel!==void 0&&(u.channel=a.channel),a.offset!==void 0&&u.offset.fromArray(a.offset),a.repeat!==void 0&&u.repeat.fromArray(a.repeat),a.center!==void 0&&u.center.fromArray(a.center),a.rotation!==void 0&&(u.rotation=a.rotation),a.wrap!==void 0&&(u.wrapS=n(a.wrap[0],Ox),u.wrapT=n(a.wrap[1],Ox)),a.format!==void 0&&(u.format=a.format),a.internalFormat!==void 0&&(u.internalFormat=a.internalFormat),a.type!==void 0&&(u.type=a.type),a.colorSpace!==void 0&&(u.colorSpace=a.colorSpace),a.minFilter!==void 0&&(u.minFilter=n(a.minFilter,Vx)),a.magFilter!==void 0&&(u.magFilter=n(a.magFilter,Vx)),a.anisotropy!==void 0&&(u.anisotropy=a.anisotropy),a.flipY!==void 0&&(u.flipY=a.flipY),a.generateMipmaps!==void 0&&(u.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(u.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(u.compareFunction=a.compareFunction),a.userData!==void 0&&(u.userData=a.userData),i[a.uuid]=u}return i}parseObject(e,t,n,i,r){let o;function a(d){return t[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),t[d]}function c(d){if(d!==void 0){if(Array.isArray(d)){const p=[];for(let f=0,x=d.length;f<x;f++){const m=d[f];n[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",m),p.push(n[m])}return p}return n[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),n[d]}}function l(d){return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",d),i[d]}let u,h;switch(e.type){case"Scene":o=new Qh,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new _e(e.background):o.background=l(e.background)),e.environment!==void 0&&(o.environment=l(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new um(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new jh(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new hn(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new ao(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new Td(e.color,e.intensity);break;case"DirectionalLight":o=new Sd(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new Md(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new Um(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new sl(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new vd(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new Fm().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),h=c(e.material),o=new pm(u,h),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":u=a(e.geometry),h=c(e.material),o=new kt(u,h);break;case"InstancedMesh":u=a(e.geometry),h=c(e.material);const d=e.count,p=e.instanceMatrix,f=e.instanceColor;o=new fm(u,h,d),o.instanceMatrix=new Fs(new Float32Array(p.array),16),f!==void 0&&(o.instanceColor=new Fs(new Float32Array(f.array),f.itemSize));break;case"BatchedMesh":u=a(e.geometry),h=c(e.material),o=new mm(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,h),o.geometry=u,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._visibility=e.visibility,o._active=e.active,o._bounds=e.bounds.map(x=>{const m=new Wn;m.min.fromArray(x.boxMin),m.max.fromArray(x.boxMax);const g=new Dn;return g.radius=x.sphereRadius,g.center.fromArray(x.sphereCenter),{boxInitialized:x.boxInitialized,box:m,sphereInitialized:x.sphereInitialized,sphere:g}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=l(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=l(e.colorsTexture.uuid));break;case"LOD":o=new dm;break;case"Line":o=new Os(a(e.geometry),c(e.material));break;case"LineLoop":o=new gm(a(e.geometry),c(e.material));break;case"LineSegments":o=new rs(a(e.geometry),c(e.material));break;case"PointCloud":case"Points":o=new xm(a(e.geometry),c(e.material));break;case"Sprite":o=new hm(c(e.material));break;case"Group":o=new Wr;break;case"Bone":o=new ed;break;default:o=new yt}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const d=e.children;for(let p=0;p<d.length;p++)o.add(this.parseObject(d[p],t,n,i,r))}if(e.animations!==void 0){const d=e.animations;for(let p=0;p<d.length;p++){const f=d[p];o.animations.push(r[f])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const d=e.levels;for(let p=0;p<d.length;p++){const f=d[p],x=o.getObjectByProperty("uuid",f.object);x!==void 0&&o.addLevel(x,f.distance,f.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new yt}})}}const XI={UVMapping:Dh,CubeReflectionMapping:wi,CubeRefractionMapping:Vi,EquirectangularReflectionMapping:sr,EquirectangularRefractionMapping:rr,CubeUVReflectionMapping:dr},Ox={RepeatWrapping:or,ClampToEdgeWrapping:Si,MirroredRepeatWrapping:ta},Vx={NearestFilter:Qt,NearestMipmapNearestFilter:Uh,NearestMipmapLinearFilter:Is,LinearFilter:Ut,LinearMipmapNearestFilter:Qs,LinearMipmapLinearFilter:Kn};class Sv extends qn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=ps.get(e);if(o!==void 0){if(r.manager.itemStart(e),o.then){o.then(l=>{t&&t(l),r.manager.itemEnd(e)}).catch(l=>{i&&i(l)});return}return setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const c=fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(l){return ps.add(e,l),t&&t(l),r.manager.itemEnd(e),l}).catch(function(l){i&&i(l),ps.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});ps.add(e,c),r.manager.itemStart(e)}}let du;class bd{static getContext(){return du===void 0&&(du=new(window.AudioContext||window.webkitAudioContext)),du}static setContext(e){du=e}}class Tv extends qn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new ts(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(c){try{const l=c.slice(0);bd.getContext().decodeAudioData(l,function(h){t(h)}).catch(a)}catch(l){a(l)}},n,i);function a(c){i?i(c):console.error(c),r.manager.itemError(e)}}}const Bx=new Fe,zx=new Fe,Cr=new Fe;class Vm{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new hn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new hn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Cr.copy(e.projectionMatrix);const i=t.eyeSep/2,r=i*t.near/t.focus,o=t.near*Math.tan(Yr*t.fov*.5)/t.zoom;let a,c;zx.elements[12]=-i,Bx.elements[12]=i,a=-o*t.aspect+r,c=o*t.aspect+r,Cr.elements[0]=2*t.near/(c-a),Cr.elements[8]=(c+a)/(c-a),this.cameraL.projectionMatrix.copy(Cr),a=-o*t.aspect-r,c=o*t.aspect-r,Cr.elements[0]=2*t.near/(c-a),Cr.elements[8]=(c+a)/(c-a),this.cameraR.projectionMatrix.copy(Cr)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(zx),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Bx)}}class Bm{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=kx(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=kx();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function kx(){return performance.now()}const cs=new E,Gx=new Hn,qI=new E,Rr=new E;let bv=class extends yt{constructor(){super(),this.type="AudioListener",this.context=bd.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Bm}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(cs,Gx,qI),!(!Number.isFinite(cs.x)||!Number.isFinite(cs.y)||!Number.isFinite(cs.z)))if(Rr.set(0,0,-1).applyQuaternion(Gx),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(cs.x,i),t.positionY.linearRampToValueAtTime(cs.y,i),t.positionZ.linearRampToValueAtTime(cs.z,i),t.forwardX.linearRampToValueAtTime(Rr.x,i),t.forwardY.linearRampToValueAtTime(Rr.y,i),t.forwardZ.linearRampToValueAtTime(Rr.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(cs.x,cs.y,cs.z),t.setOrientation(Rr.x,Rr.y,Rr.z,n.x,n.y,n.z)}};class zm extends yt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||(this.buffer?this.buffer.duration:Number.MAX_VALUE))),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const Ir=new E,Hx=new Hn,$I=new E,Pr=new E;class wv extends zm{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Ir,Hx,$I),Pr.set(0,0,1).applyQuaternion(Hx);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Ir.x,n),t.positionY.linearRampToValueAtTime(Ir.y,n),t.positionZ.linearRampToValueAtTime(Ir.z,n),t.orientationX.linearRampToValueAtTime(Pr.x,n),t.orientationY.linearRampToValueAtTime(Pr.y,n),t.orientationZ.linearRampToValueAtTime(Pr.z,n)}else t.setPosition(Ir.x,Ir.y,Ir.z),t.setOrientation(Pr.x,Pr.y,Pr.z)}}class YI{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class Av{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,o;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,r=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)n[r+a]=n[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(n,r,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-r,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,o=i;r!==o;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let o=0;o!==r;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){Hn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const o=this._workIndex*r;Hn.multiplyQuaternionsFlat(e,o,e,t,e,n),Hn.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,r){const o=1-i;for(let a=0;a!==r;++a){const c=t+a;e[c]=e[c]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,r){for(let o=0;o!==r;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const km="\\[\\]\\.:\\/",ZI=new RegExp("["+km+"]","g"),Gm="[^"+km+"]",JI="[^"+km.replace("\\.","")+"]",KI=/((?:WC+[\/:])*)/.source.replace("WC",Gm),jI=/(WCOD+)?/.source.replace("WCOD",JI),QI=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Gm),eP=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Gm),tP=new RegExp("^"+KI+jI+QI+eP+"$"),nP=["material","materials","bones","map"];class iP{constructor(e,t,n){const i=n||St.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class St{constructor(e,t,n){this.path=t,this.parsedPath=n||St.parseTrackName(t),this.node=St.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new St.Composite(e,t,n):new St(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(ZI,"")}static parseTrackName(e){const t=tP.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const r=n.nodeName.substring(i+1);nP.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(r,o){for(let a=0;a<r.length;a++){const c=r[a];if(!o&&(c.name===t||c.uuid===t))return c;if(o&&c.userData&&c.userData.name===t)return c;const l=n(c.children,o);if(l)return l}return null},i=n(e.children);if(i)return i;{const r=n(e.children,!0);if(r)return r}}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=St.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===l){l=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}const o=e[i];if(o===void 0){const l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}St.Composite=iP;St.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};St.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};St.prototype.GetterByBindingType=[St.prototype._getValue_direct,St.prototype._getValue_array,St.prototype._getValue_arrayElement,St.prototype._getValue_toArray];St.prototype.SetterByBindingTypeAndVersioning=[[St.prototype._setValue_direct,St.prototype._setValue_direct_setNeedsUpdate,St.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[St.prototype._setValue_array,St.prototype._setValue_array_setNeedsUpdate,St.prototype._setValue_array_setMatrixWorldNeedsUpdate],[St.prototype._setValue_arrayElement,St.prototype._setValue_arrayElement_setNeedsUpdate,St.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[St.prototype._setValue_fromArray,St.prototype._setValue_fromArray_setNeedsUpdate,St.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class sP{constructor(){this.isAnimationObjectGroup=!0,this.uuid=bi(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,o=r.length;let a,c=e.length,l=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const d=arguments[u],p=d.uuid;let f=t[p];if(f===void 0){f=c++,t[p]=f,e.push(d);for(let x=0,m=o;x!==m;++x)r[x].push(new St(d,n[x],i[x]))}else if(f<l){a=e[f];const x=--l,m=e[x];t[m.uuid]=f,e[f]=m,t[p]=x,e[x]=d;for(let g=0,y=o;g!==y;++g){const _=r[g],v=_[x];let I=_[f];_[f]=v,I===void 0&&(I=new St(d,n[g],i[g])),_[x]=I}}else e[f]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const c=arguments[o],l=c.uuid,u=t[l];if(u!==void 0&&u>=r){const h=r++,d=e[h];t[d.uuid]=u,e[u]=d,t[l]=h,e[h]=c;for(let p=0,f=i;p!==f;++p){const x=n[p],m=x[h],g=x[u];x[u]=m,x[h]=g}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,o=e.length;for(let a=0,c=arguments.length;a!==c;++a){const l=arguments[a],u=l.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<r){const d=--r,p=e[d],f=--o,x=e[f];t[p.uuid]=h,e[h]=p,t[x.uuid]=d,e[d]=x,e.pop();for(let m=0,g=i;m!==g;++m){const y=n[m],_=y[d],v=y[f];y[h]=_,y[d]=v,y.pop()}}else{const d=--o,p=e[d];d>0&&(t[p.uuid]=h),e[h]=p,e.pop();for(let f=0,x=i;f!==x;++f){const m=n[f];m[h]=m[d],m.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(i!==void 0)return r[i];const o=this._paths,a=this._parsedPaths,c=this._objects,l=c.length,u=this.nCachedObjects_,h=new Array(l);i=r.length,n[e]=i,o.push(e),a.push(t),r.push(h);for(let d=u,p=c.length;d!==p;++d){const f=c[d];h[d]=new St(f,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,c=o[a],l=e[a];t[l]=n,o[n]=c,o.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}class Nv{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,o=r.length,a=new Array(o),c={endingStart:kr,endingEnd:kr};for(let l=0;l!==o;++l){const u=r[l].createInterpolant(null);a[l]=u,u.settings=c}this._interpolantSettings=c,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Kf,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,r=e._clip.duration,o=r/i,a=i/r;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const c=a.parameterPositions,l=a.sampleValues;return c[0]=r,c[1]=r+n,l[0]=e/o,l[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const c=(e-r)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case jf:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulateAdditive(a);break;case Hh:default:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const o=n===my;if(e===0)return r===-1?i:o&&(r&1)===1?t-i:i;if(n===Jf){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,r+=Math.abs(a);const c=this.repetitions-r;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const l=e<0;this._setEndings(l,!l,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Gr,i.endingEnd=Gr):(e?i.endingStart=this.zeroSlopeAtStart?Gr:kr:i.endingStart=Ac,t?i.endingEnd=this.zeroSlopeAtEnd?Gr:kr:i.endingEnd=Ac)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,c=o.sampleValues;return a[0]=r,c[0]=t,a[1]=r+e,c[1]=n,this}}const rP=new Float32Array(1);class Ev extends Ai{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,o=e._propertyBindings,a=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName;let u=l[c];u===void 0&&(u={},l[c]=u);for(let h=0;h!==r;++h){const d=i[h],p=d.name;let f=u[p];if(f!==void 0)++f.referenceCount,o[h]=f;else{if(f=o[h],f!==void 0){f._cacheIndex===null&&(++f.referenceCount,this._addInactiveBinding(f,c,p));continue}const x=t&&t._propertyBindings[h].binding.parsedPath;f=new Av(St.create(n,p,x),d.ValueTypeName,d.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,c,p),o[h]=f}a[h].resultBuffer=f.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,r=this._actionsByClip;let o=r[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,o=this._actionsByClip,a=o[r],c=a.knownActions,l=c[c.length-1],u=e._byClipCacheIndex;l._byClipCacheIndex=u,c[u]=l,c.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,d=(e._localRoot||this._root).uuid;delete h[d],c.length===0&&delete o[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,a=o[i],c=t[t.length-1],l=e._cacheIndex;c._cacheIndex=l,t[l]=c,t.pop(),delete a[r],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Pm(new Float32Array(2),new Float32Array(2),1,rP),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let o=typeof e=="string"?ua.findByName(i,e):e;const a=o!==null?o.uuid:e,c=this._actionsByClip[a];let l=null;if(n===void 0&&(o!==null?n=o.blendMode:n=Hh),c!==void 0){const h=c.actionByRoot[r];if(h!==void 0&&h.blendMode===n)return h;l=c.knownActions[0],o===null&&(o=l._clip)}if(o===null)return null;const u=new Nv(this,o,t,n);return this._bindAction(u,l),this._addInactiveAction(u,a,r),u}existingAction(e,t){const n=t||this._root,i=n.uuid,r=typeof e=="string"?ua.findByName(n,e):e,o=r?r.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,r,o);const a=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)a[l].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){const o=r.knownActions;for(let a=0,c=o.length;a!==c;++a){const l=o[a];this._deactivateAction(l);const u=l._cacheIndex,h=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const a=n[o].actionByRoot,c=a[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(const o in r){const a=r[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}let Cv=class Rv{constructor(e){this.value=e}clone(){return new Rv(this.value.clone===void 0?this.value:this.value.clone())}},oP=0;class aP extends Ai{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:oP++}),this.name="",this.usage=ra,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const r=Array.isArray(t[n])?t[n]:[t[n]];for(let o=0;o<r.length;o++)this.uniforms.push(r[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class Hm extends ya{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class cP{constructor(e,t,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Wx=new Fe;class Iv{constructor(e,t,n=0,i=1/0){this.ray=new so(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Yc,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Wx.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Wx),this}intersectObject(e,t=!0,n=[]){return xf(e,this,n,t),n.sort(Xx),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)xf(e[i],this,n,t);return n.sort(Xx),n}}function Xx(s,e){return s.distance-e.distance}function xf(s,e,t,n){let i=!0;if(s.layers.test(e.layers)&&s.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const r=s.children;for(let o=0,a=r.length;o<a;o++)xf(r[o],e,t,!0)}}class Pv{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(jt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class lP{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class Wm{constructor(e,t,n,i){Wm.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}const qx=new J;class uP{constructor(e=new J(1/0,1/0),t=new J(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=qx.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const $x=new E,pu=new E;class Lv{constructor(e=new E,t=new E){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){$x.subVectors(e,this.start),pu.subVectors(this.end,this.start);const n=pu.dot(pu);let r=pu.dot($x)/n;return t&&(r=jt(r,0,1)),r}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Yx=new E;class hP extends yt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new at,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,c=32;o<c;o++,a++){const l=o/c*Math.PI*2,u=a/c*Math.PI*2;i.push(Math.cos(l),Math.sin(l),1,Math.cos(u),Math.sin(u),1)}n.setAttribute("position",new Ve(i,3));const r=new Fn({fog:!1,toneMapped:!1});this.cone=new rs(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Yx.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Yx),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const $s=new E,fu=new Fe,Fp=new Fe;class dP extends rs{constructor(e){const t=Dv(e),n=new at,i=[],r=[],o=new _e(0,0,1),a=new _e(0,1,0);for(let l=0;l<t.length;l++){const u=t[l];u.parent&&u.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(o.r,o.g,o.b),r.push(a.r,a.g,a.b))}n.setAttribute("position",new Ve(i,3)),n.setAttribute("color",new Ve(r,3));const c=new Fn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,c),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Fp.copy(this.root.matrixWorld).invert();for(let r=0,o=0;r<t.length;r++){const a=t[r];a.parent&&a.parent.isBone&&(fu.multiplyMatrices(Fp,a.matrixWorld),$s.setFromMatrixPosition(fu),i.setXYZ(o,$s.x,$s.y,$s.z),fu.multiplyMatrices(Fp,a.parent.matrixWorld),$s.setFromMatrixPosition(fu),i.setXYZ(o+1,$s.x,$s.y,$s.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Dv(s){const e=[];s.isBone===!0&&e.push(s);for(let t=0;t<s.children.length;t++)e.push.apply(e,Dv(s.children[t]));return e}class pP extends kt{constructor(e,t,n){const i=new Sa(t,4,2),r=new ss({wireframe:!0,fog:!1,toneMapped:!1});super(i,r),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const fP=new E,Zx=new _e,Jx=new _e;class mP extends yt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Ma(t);i.rotateY(Math.PI*.5),this.material=new ss({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),o=new Float32Array(r.count*3);i.setAttribute("color",new At(o,3)),this.add(new kt(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Zx.copy(this.light.color),Jx.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const r=n<i/2?Zx:Jx;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(fP.setFromMatrixPosition(this.light.matrixWorld).negate())}}let Uv=class extends rs{constructor(e=10,t=10,n=4473924,i=8947848){n=new _e(n),i=new _e(i);const r=t/2,o=e/t,a=e/2,c=[],l=[];for(let d=0,p=0,f=-a;d<=t;d++,f+=o){c.push(-a,0,f,a,0,f),c.push(f,0,-a,f,0,a);const x=d===r?n:i;x.toArray(l,p),p+=3,x.toArray(l,p),p+=3,x.toArray(l,p),p+=3,x.toArray(l,p),p+=3}const u=new at;u.setAttribute("position",new Ve(c,3)),u.setAttribute("color",new Ve(l,3));const h=new Fn({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}};class gP extends rs{constructor(e=10,t=16,n=8,i=64,r=4473924,o=8947848){r=new _e(r),o=new _e(o);const a=[],c=[];if(t>1)for(let h=0;h<t;h++){const d=h/t*(Math.PI*2),p=Math.sin(d)*e,f=Math.cos(d)*e;a.push(0,0,0),a.push(p,0,f);const x=h&1?r:o;c.push(x.r,x.g,x.b),c.push(x.r,x.g,x.b)}for(let h=0;h<n;h++){const d=h&1?r:o,p=e-e/n*h;for(let f=0;f<i;f++){let x=f/i*(Math.PI*2),m=Math.sin(x)*p,g=Math.cos(x)*p;a.push(m,0,g),c.push(d.r,d.g,d.b),x=(f+1)/i*(Math.PI*2),m=Math.sin(x)*p,g=Math.cos(x)*p,a.push(m,0,g),c.push(d.r,d.g,d.b)}}const l=new at;l.setAttribute("position",new Ve(a,3)),l.setAttribute("color",new Ve(c,3));const u=new Fn({vertexColors:!0,toneMapped:!1});super(l,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Kx=new E,mu=new E,jx=new E;class Fv extends yt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new at;i.setAttribute("position",new Ve([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new Fn({fog:!1,toneMapped:!1});this.lightPlane=new Os(i,r),this.add(this.lightPlane),i=new at,i.setAttribute("position",new Ve([0,0,0,0,0,1],3)),this.targetLine=new Os(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Kx.setFromMatrixPosition(this.light.matrixWorld),mu.setFromMatrixPosition(this.light.target.matrixWorld),jx.subVectors(mu,Kx),this.lightPlane.lookAt(mu),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(mu),this.targetLine.scale.z=jx.length()}}const gu=new E,Kt=new Zc;class Ov extends rs{constructor(e){const t=new at,n=new Fn({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(f,x){c(f),c(x)}function c(f){i.push(0,0,0),r.push(0,0,0),o[f]===void 0&&(o[f]=[]),o[f].push(i.length/3-1)}t.setAttribute("position",new Ve(i,3)),t.setAttribute("color",new Ve(r,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const l=new _e(16755200),u=new _e(16711680),h=new _e(43775),d=new _e(16777215),p=new _e(3355443);this.setColors(l,u,h,d,p)}setColors(e,t,n,i,r){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,r.r,r.g,r.b),a.setXYZ(41,r.r,r.g,r.b),a.setXYZ(42,r.r,r.g,r.b),a.setXYZ(43,r.r,r.g,r.b),a.setXYZ(44,r.r,r.g,r.b),a.setXYZ(45,r.r,r.g,r.b),a.setXYZ(46,r.r,r.g,r.b),a.setXYZ(47,r.r,r.g,r.b),a.setXYZ(48,r.r,r.g,r.b),a.setXYZ(49,r.r,r.g,r.b),a.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;Kt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),nn("c",t,e,Kt,0,0,-1),nn("t",t,e,Kt,0,0,1),nn("n1",t,e,Kt,-n,-i,-1),nn("n2",t,e,Kt,n,-i,-1),nn("n3",t,e,Kt,-n,i,-1),nn("n4",t,e,Kt,n,i,-1),nn("f1",t,e,Kt,-n,-i,1),nn("f2",t,e,Kt,n,-i,1),nn("f3",t,e,Kt,-n,i,1),nn("f4",t,e,Kt,n,i,1),nn("u1",t,e,Kt,n*.7,i*1.1,-1),nn("u2",t,e,Kt,-n*.7,i*1.1,-1),nn("u3",t,e,Kt,0,i*2,-1),nn("cf1",t,e,Kt,-n,0,1),nn("cf2",t,e,Kt,n,0,1),nn("cf3",t,e,Kt,0,-i,1),nn("cf4",t,e,Kt,0,i,1),nn("cn1",t,e,Kt,-n,0,-1),nn("cn2",t,e,Kt,n,0,-1),nn("cn3",t,e,Kt,0,-i,-1),nn("cn4",t,e,Kt,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function nn(s,e,t,n,i,r,o){gu.set(i,r,o).unproject(n);const a=e[s];if(a!==void 0){const c=t.getAttribute("position");for(let l=0,u=a.length;l<u;l++)c.setXYZ(a[l],gu.x,gu.y,gu.z)}}const xu=new Wn;class Vv extends rs{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new at;r.setIndex(new At(n,1)),r.setAttribute("position",new At(i,3)),super(r,new Fn({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&xu.setFromObject(this.object),xu.isEmpty())return;const t=xu.min,n=xu.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Bv extends rs{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],r=new at;r.setIndex(new At(n,1)),r.setAttribute("position",new Ve(i,3)),super(r,new Fn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class xP extends Os{constructor(e,t=1,n=16776960){const i=n,r=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new at;o.setAttribute("position",new Ve(r,3)),o.computeBoundingSphere(),super(o,new Fn({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],c=new at;c.setAttribute("position",new Ve(a,3)),c.computeBoundingSphere(),this.add(new kt(c,new ss({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Qx=new E;let _u,Op;class _P extends yt{constructor(e=new E(0,0,1),t=new E(0,0,0),n=1,i=16776960,r=n*.2,o=r*.2){super(),this.type="ArrowHelper",_u===void 0&&(_u=new at,_u.setAttribute("position",new Ve([0,0,0,0,1,0],3)),Op=new lo(0,.5,1,5,1),Op.translate(0,-.5,0)),this.position.copy(t),this.line=new Os(_u,new Fn({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new kt(Op,new ss({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Qx.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Qx,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}let zv=class extends rs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new at;i.setAttribute("position",new Ve(t,3)),i.setAttribute("color",new Ve(n,3));const r=new Fn({vertexColors:!0,toneMapped:!1});super(i,r),this.type="AxesHelper"}setColors(e,t,n){const i=new _e,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}};class kv{constructor(){this.type="ShapePath",this.color=new _e,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Ic,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,o){return this.currentPath.bezierCurveTo(e,t,n,i,r,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(g){const y=[];for(let _=0,v=g.length;_<v;_++){const I=g[_],T=new tr;T.curves=I.curves,y.push(T)}return y}function n(g,y){const _=y.length;let v=!1;for(let I=_-1,T=0;T<_;I=T++){let w=y[I],C=y[T],F=C.x-w.x,M=C.y-w.y;if(Math.abs(M)>Number.EPSILON){if(M<0&&(w=y[T],F=-F,C=y[I],M=-M),g.y<w.y||g.y>C.y)continue;if(g.y===w.y){if(g.x===w.x)return!0}else{const b=M*(g.x-w.x)-F*(g.y-w.y);if(b===0)return!0;if(b<0)continue;v=!v}}else{if(g.y!==w.y)continue;if(C.x<=g.x&&g.x<=w.x||w.x<=g.x&&g.x<=C.x)return!0}}return v}const i=ji.isClockWise,r=this.subPaths;if(r.length===0)return[];let o,a,c;const l=[];if(r.length===1)return a=r[0],c=new tr,c.curves=a.curves,l.push(c),l;let u=!i(r[0].getPoints());u=e?!u:u;const h=[],d=[];let p=[],f=0,x;d[f]=void 0,p[f]=[];for(let g=0,y=r.length;g<y;g++)a=r[g],x=a.getPoints(),o=i(x),o=e?!o:o,o?(!u&&d[f]&&f++,d[f]={s:new tr,p:x},d[f].s.curves=a.curves,u&&f++,p[f]=[]):p[f].push({h:a,p:x[0]});if(!d[0])return t(r);if(d.length>1){let g=!1,y=0;for(let _=0,v=d.length;_<v;_++)h[_]=[];for(let _=0,v=d.length;_<v;_++){const I=p[_];for(let T=0;T<I.length;T++){const w=I[T];let C=!0;for(let F=0;F<d.length;F++)n(w.p,d[F].p)&&(_!==F&&y++,C?(C=!1,h[F].push(w)):g=!0);C&&h[_].push(w)}}y>0&&g===!1&&(p=h)}let m;for(let g=0,y=d.length;g<y;g++){c=d[g].s,l.push(c),m=p[g];for(let _=0,v=m.length;_<v;_++)c.holes.push(m[_].h)}return l}}class Gv extends Ai{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}class yP extends zi{constructor(e=1,t=1,n=1,i={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,t,{...i,count:n}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}const vP=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveMap","envMap","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"];class Hv{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=vP,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}getRenderObjectData(e){let t=this.renderObjects.get(e);return t===void 0&&(t={material:this.getMaterialData(e.material),worldMatrix:e.object.matrixWorld.clone()},e.object.center&&(t.center=e.object.center.clone()),e.object.morphTargetInfluences&&(t.morphTargetInfluences=e.object.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),this.renderObjects.set(e,t)),t}containsNode(e){const t=e.material;for(const n in t)if(t[n]&&t[n].isNode)return!0;return e.renderer.nodes.modelViewMatrix!==null||e.renderer.nodes.modelNormalViewMatrix!==null}getMaterialData(e){const t={};for(const n of this.refreshUniforms){const i=e[n];i!=null&&(typeof i=="object"&&i.clone!==void 0?i.isTexture===!0?t[n]={id:i.id,version:i.version}:t[n]=i.clone():t[n]=i)}return t}equals(e){const{object:t,material:n}=e,i=this.getRenderObjectData(e);if(i.worldMatrix.equals(t.matrixWorld)!==!0)return i.worldMatrix.copy(t.matrixWorld),!1;const r=i.material;for(const o in r){const a=r[o],c=n[o];if(a.equals!==void 0){if(a.equals(c)===!1)return a.copy(c),!1}else if(c.isTexture===!0){if(a.id!==c.id||a.version!==c.version)return a.id=c.id,a.version=c.version,!1}else if(a!==c)return r[o]=c,!1}if(i.morphTargetInfluences){let o=!1;for(let a=0;a<i.morphTargetInfluences.length;a++)i.morphTargetInfluences[a]!==t.morphTargetInfluences[a]&&(o=!0);if(o)return!0}return i.center&&i.center.equals(t.center)===!1?(i.center.copy(t.center),!0):(e.bundle!==null&&(i.version=e.bundle.version),!0)}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e))return!0;const{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;const i=e.object.static===!0,r=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;return i||r?!1:this.equals(e)!==!0}}function Fc(s,e=0){let t=3735928559^e,n=1103547991^e;if(s instanceof Array)for(let i=0,r;i<s.length;i++)r=s[i],t=Math.imul(t^r,2654435761),n=Math.imul(n^r,1597334677);else for(let i=0,r;i<s.length;i++)r=s.charCodeAt(i),t=Math.imul(t^r,2654435761),n=Math.imul(n^r,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}const Wv=s=>Fc(s),Xv=s=>Fc(s),Xm=(...s)=>Fc(s);function qm(s,e=!1){const t=[];s.isNode===!0&&(t.push(s.id),s=s.getSelf());for(const{property:n,childNode:i}of Oc(s))t.push(t,Fc(n.slice(0,-4)),i.getCacheKey(e));return Fc(t)}function*Oc(s,e=!1){for(const t in s){if(t.startsWith("_")===!0)continue;const n=s[t];if(Array.isArray(n)===!0)for(let i=0;i<n.length;i++){const r=n[i];r&&(r.isNode===!0||e&&typeof r.toJSON=="function")&&(yield{property:t,index:i,childNode:r})}else if(n&&n.isNode===!0)yield{property:t,childNode:n};else if(typeof n=="object")for(const i in n){const r=n[i];r&&(r.isNode===!0||e&&typeof r.toJSON=="function")&&(yield{property:t,index:i,childNode:r})}}}function Ps(s){if(s==null)return null;const e=typeof s;return s.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":s.isVector2===!0?"vec2":s.isVector3===!0?"vec3":s.isVector4===!0?"vec4":s.isMatrix3===!0?"mat3":s.isMatrix4===!0?"mat4":s.isColor===!0?"color":s instanceof ArrayBuffer?"ArrayBuffer":null}function $m(s,...e){const t=s?s.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),s==="color"?new _e(...e):t==="vec2"?new J(...e):t==="vec3"?new E(...e):t==="vec4"?new st(...e):t==="mat3"?new Ke(...e):t==="mat4"?new Fe(...e):s==="bool"?e[0]||!1:s==="float"||s==="int"||s==="uint"?e[0]||0:s==="string"?e[0]||"":s==="ArrayBuffer"?Zm(e[0]):null}function Ym(s){let e="";const t=new Uint8Array(s);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function Zm(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0)).buffer}var MP=Object.freeze({__proto__:null,arrayBufferToBase64:Ym,base64ToArrayBuffer:Zm,getCacheKey:qm,getNodeChildren:Oc,getValueFromType:$m,getValueType:Ps,hash:Xm,hashArray:Xv,hashString:Wv});const _f={VERTEX:"vertex",FRAGMENT:"fragment"},We={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},SP={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Jm=["fragment","vertex"],yf=["setup","analyze","generate"],vf=[...Jm,"compute"],wa=["x","y","z","w"];let TP=0;class Ye extends Ai{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=We.NONE,this.updateBeforeType=We.NONE,this.updateAfterType=We.NONE,this.uuid=Xh.generateUUID(),this.version=0,this._cacheKey=null,this._cacheKeyVersion=0,this.global=!1,this.isNode=!0,Object.defineProperty(this,"id",{value:TP++})}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this.getSelf()),this}onFrameUpdate(e){return this.onUpdate(e,We.FRAME)}onRenderUpdate(e){return this.onUpdate(e,We.RENDER)}onObjectUpdate(e){return this.onUpdate(e,We.OBJECT)}onReference(e){return this.updateReference=e.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of Oc(this))yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return e=e||this.version!==this._cacheKeyVersion,(e===!0||this._cacheKey===null)&&(this._cacheKey=qm(this,e),this._cacheKeyVersion=this.version),this._cacheKey}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){const t=this.getNodeType(e);return e.getElementType(t)}getNodeType(e){const t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){const t=this.getHash(e);return e.getNodeFromHash(t)||this}setup(e){const t=e.getNodeProperties(this);let n=0;for(const i of this.getChildren())t["node"+n++]=i;return null}analyze(e){if(e.increaseUsage(this)===1){const n=e.getNodeProperties(this);for(const i of Object.values(n))i&&i.isNode===!0&&i.build(e)}}generate(e,t){const{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){console.warn("Abstract function.")}updateAfter(){console.warn("Abstract function.")}update(){console.warn("Abstract function.")}build(e,t=null){const n=this.getShared(e);if(this!==n)return n.build(e,t);e.addNode(this),e.addChain(this);let i=null;const r=e.getBuildStage();if(r==="setup"){this.updateReference(e);const o=e.getNodeProperties(this);if(o.initialized!==!0){const a=e.stack.nodes.length;o.initialized=!0,o.outputNode=this.setup(e),o.outputNode!==null&&e.stack.nodes.length;for(const c of Object.values(o))c&&c.isNode===!0&&c.build(e)}}else if(r==="analyze")this.analyze(e);else if(r==="generate")if(this.generate.length===1){const a=this.getNodeType(e),c=e.getDataFromNode(this);i=c.snippet,i===void 0?(i=this.generate(e)||"",c.snippet=i):c.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),i=e.format(i,a,t)}else i=this.generate(e,t)||"";return e.removeChain(this),i}getSerializeChildren(){return Oc(this)}serialize(e){const t=this.getSerializeChildren(),n={};for(const{property:i,index:r,childNode:o}of t)r!==void 0?(n[i]===void 0&&(n[i]=Number.isInteger(r)?[]:{}),n[i][r]=o.toJSON(e.meta).uuid):n[i]=o.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){const t=e.meta.nodes;for(const n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){const i=[];for(const r of e.inputNodes[n])i.push(t[r]);this[n]=i}else if(typeof e.inputNodes[n]=="object"){const i={};for(const r in e.inputNodes[n]){const o=e.inputNodes[n][r];i[r]=t[o]}this[n]=i}else{const i=e.inputNodes[n];this[n]=t[i]}}}toJSON(e){const{uuid:t,type:n}=this,i=e===void 0||typeof e=="string";i&&(e={textures:{},images:{},nodes:{}});let r=e.nodes[t];r===void 0&&(r={uuid:t,type:n,meta:e,metadata:{version:4.6,type:"Node",generator:"Node.toJSON"}},i!==!0&&(e.nodes[r.uuid]=r),this.serialize(r),delete r.meta);function o(a){const c=[];for(const l in a){const u=a[l];delete u.metadata,c.push(u)}return c}if(i){const a=o(e.textures),c=o(e.images),l=o(e.nodes);a.length>0&&(r.textures=a),c.length>0&&(r.images=c),l.length>0&&(r.nodes=l)}return r}}class gr extends Ye{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){const t=this.node.build(e),n=this.indexNode.build(e,"uint");return`${t}[ ${n} ]`}}class Km extends Ye{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){const t=this.node.getNodeType(e);let n=null;for(const i of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(i))&&(n=i);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const n=this.node,i=this.getNodeType(e),r=n.build(e,i);return e.format(r,i,t)}}class pt extends Ye{static get type(){return"TempNode"}constructor(e){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){const i=e.getVectorType(this.getNodeType(e,t)),r=e.getDataFromNode(this);if(r.propertyName!==void 0)return e.format(r.propertyName,i,t);if(i!=="void"&&t!=="void"&&this.hasDependencies(e)){const o=super.build(e,i),a=e.getVarFromNode(this,null,i),c=e.getPropertyName(a);return e.addLineFlowCode(`${c} = ${o}`,this),r.snippet=o,r.propertyName=c,e.format(r.propertyName,i,t)}}return super.build(e,t)}}class qv extends pt{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){const n=this.getNodeType(e),i=this.nodes,r=e.getComponentType(n),o=[];for(const c of i){let l=c.build(e);const u=e.getComponentType(c.getNodeType(e));u!==r&&(l=e.format(l,u,r)),o.push(l)}const a=`${e.getType(n)}( ${o.join(", ")} )`;return e.format(a,n,t)}}const bP=wa.join("");class ph extends Ye{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(wa.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}generate(e,t){const n=this.node,i=e.getTypeLength(n.getNodeType(e));let r=null;if(i>1){let o=null;this.getVectorLength()>=i&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const c=n.build(e,o);this.components.length===i&&this.components===bP.slice(0,this.components.length)?r=e.format(c,o,t):r=e.format(`${c}.${this.components}`,this.getNodeType(e),t)}else r=n.build(e,t);return r}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class $v extends pt{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:n,targetNode:i}=this,r=this.getNodeType(e),o=e.getTypeFromLength(n.length,i.getNodeType(e)),a=i.build(e,o),c=t.build(e,r),l=e.getTypeLength(r),u=[];for(let h=0;h<l;h++){const d=wa[h];d===n[0]?(u.push(a),h+=n.length-1):u.push(c+"."+d)}return`${e.getType(r)}( ${u.join(", ")} )`}}class wP extends pt{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{components:t,sourceNode:n}=this,i=this.getNodeType(e),r=n.build(e),o=e.getVarFromNode(this),a=e.getPropertyName(o);e.addLineFlowCode(a+" = "+r,this);const c=e.getTypeLength(i),l=[];let u=0;for(let h=0;h<c;h++){const d=wa[h];d===t[u]?(l.push("1.0 - "+(a+"."+d)),u++):l.push(a+"."+d)}return`${e.getType(i)}( ${l.join(", ")} )`}}class jm extends Ye{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return this.nodeType===null?Ps(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=Ps(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=Ym(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?$m(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){console.warn("Abstract function.")}}class Wi extends jm{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){const n=this.getNodeType(e);return e.format(this.generateConst(e),n,t)}}let ha=null;const Xo=new Map;function te(s,e){if(Xo.has(s)){console.warn(`Redefinition of method chaining ${s}`);return}if(typeof e!="function")throw new Error(`Node element ${s} is not a function`);Xo.set(s,e)}const Yv=s=>s.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),e_=s=>Yv(s).split("").sort().join(""),Zv={setup(s,e){const t=e.shift();return s(ol(t),...e)},get(s,e,t){if(typeof e=="string"&&s[e]===void 0){if(s.isStackNode!==!0&&e==="assign")return(...n)=>(ha.assign(t,...n),t);if(Xo.has(e)){const n=Xo.get(e);return s.isStackNode?(...i)=>t.add(n(...i)):(...i)=>n(t,...i)}else{if(e==="self")return s;if(e.endsWith("Assign")&&Xo.has(e.slice(0,e.length-6))){const n=Xo.get(e.slice(0,e.length-6));return s.isStackNode?(...i)=>t.assign(i[0],n(...i)):(...i)=>t.assign(n(t,...i))}else{if(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0)return e=Yv(e),H(new ph(t,e));if(/^set[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=e_(e.slice(3).toLowerCase()),n=>H(new $v(s,e,n));if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=e_(e.slice(4).toLowerCase()),()=>H(new wP(H(s),e));if(e==="width"||e==="height"||e==="depth")return e==="width"?e="x":e==="height"?e="y":e==="depth"&&(e="z"),H(new ph(s,e));if(/^\d+$/.test(e)===!0)return H(new gr(t,new Wi(Number(e),"uint")))}}}return Reflect.get(s,e,t)},set(s,e,t,n){return typeof e=="string"&&s[e]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0||e==="width"||e==="height"||e==="depth"||/^\d+$/.test(e)===!0)?(n[e].assign(t),!0):Reflect.set(s,e,t,n)}},Vp=new WeakMap,t_=new WeakMap,AP=function(s,e=null){const t=Ps(s);if(t==="node"){let n=Vp.get(s);return n===void 0&&(n=new Proxy(s,Zv),Vp.set(s,n),Vp.set(n,n)),n}else{if(e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string")return H(Mf(s,e));if(t==="shader")return U(s)}return s},NP=function(s,e=null){for(const t in s)s[t]=H(s[t],e);return s},EP=function(s,e=null){const t=s.length;for(let n=0;n<t;n++)s[n]=H(s[n],e);return s},CP=function(s,e=null,t=null,n=null){const i=r=>H(n!==null?Object.assign(r,n):r);return e===null?(...r)=>i(new s(...Zr(r))):t!==null?(t=H(t),(...r)=>i(new s(e,...Zr(r),t))):(...r)=>i(new s(e,...Zr(r)))},RP=function(s,...e){return H(new s(...Zr(e)))};class IP extends Ye{constructor(e,t){super(),this.shaderNode=e,this.inputNodes=t}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}call(e){const{shaderNode:t,inputNodes:n}=this,i=e.getNodeProperties(t);if(i.onceOutput)return i.onceOutput;let r=null;if(t.layout){let o=t_.get(e.constructor);o===void 0&&(o=new WeakMap,t_.set(e.constructor,o));let a=o.get(t);a===void 0&&(a=H(e.buildFunctionNode(t)),o.set(t,a)),e.currentFunctionNode!==null&&e.currentFunctionNode.includes.push(a),r=H(a.call(n))}else{const o=t.jsFunc,a=n!==null?o(n,e):o(e);r=H(a)}return t.once&&(i.onceOutput=r),r}getOutputNode(e){const t=e.getNodeProperties(this);return t.outputNode===null&&(t.outputNode=this.setupOutput(e)),t.outputNode}setup(e){return this.getOutputNode(e)}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}generate(e,t){return this.getOutputNode(e).build(e,t)}}class PP extends Ye{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}call(e=null){return ol(e),H(new IP(this,e))}setup(){return this.call()}}const LP=[!1,!0],DP=[0,1,2,3],UP=[-1,-2],Jv=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],Qm=new Map;for(const s of LP)Qm.set(s,new Wi(s));const eg=new Map;for(const s of DP)eg.set(s,new Wi(s,"uint"));const tg=new Map([...eg].map(s=>new Wi(s.value,"int")));for(const s of UP)tg.set(s,new Wi(s,"int"));const wd=new Map([...tg].map(s=>new Wi(s.value)));for(const s of Jv)wd.set(s,new Wi(s));for(const s of Jv)wd.set(-s,new Wi(-s));const Ad={bool:Qm,uint:eg,ints:tg,float:wd},n_=new Map([...Qm,...wd]),Mf=(s,e)=>n_.has(s)?n_.get(s):s.isNode===!0?s:new Wi(s,e),FP=s=>{try{return s.getNodeType()}catch{return}},un=function(s,e=null){return(...t)=>{if((t.length===0||!["bool","float","int","uint"].includes(s)&&t.every(i=>typeof i!="object"))&&(t=[$m(s,...t)]),t.length===1&&e!==null&&e.has(t[0]))return H(e.get(t[0]));if(t.length===1){const i=Mf(t[0],s);return FP(i)===s?H(i):H(new Km(i,s))}const n=t.map(i=>Mf(i));return H(new qv(n,s))}},Vc=s=>typeof s=="object"&&s!==null?s.value:s,Kv=s=>s!=null?s.nodeType||s.convertTo||(typeof s=="string"?s:null):null;function tc(s,e){return new Proxy(new PP(s,e),Zv)}const H=(s,e=null)=>AP(s,e),ol=(s,e=null)=>new NP(s,e),Zr=(s,e=null)=>new EP(s,e),K=(...s)=>new CP(...s),fe=(...s)=>new RP(...s),U=(s,e)=>{const t=new tc(s,e),n=(...i)=>{let r;return ol(i),i[0]&&i[0].isNode?r=[...i]:r=i[0],t.call(r)};return n.shaderNode=t,n.setLayout=i=>(t.setLayout(i),n),n.once=()=>(t.once=!0,n),n},OP=(...s)=>(console.warn("TSL.ShaderNode: tslFn() has been renamed to Fn()."),U(...s));te("toGlobal",s=>(s.global=!0,s));const Bc=s=>{ha=s},ng=()=>ha,Oe=(...s)=>ha.If(...s);function jv(s){return ha&&ha.add(s),s}te("append",jv);const Qv=new un("color"),A=new un("float",Ad.float),L=new un("int",Ad.ints),ve=new un("uint",Ad.uint),lr=new un("bool",Ad.bool),z=new un("vec2"),us=new un("ivec2"),eM=new un("uvec2"),tM=new un("bvec2"),D=new un("vec3"),nM=new un("ivec3"),Aa=new un("uvec3"),ig=new un("bvec3"),oe=new un("vec4"),iM=new un("ivec4"),sM=new un("uvec4"),rM=new un("bvec4"),al=new un("mat2"),Tn=new un("mat3"),Jr=new un("mat4"),VP=(s="")=>H(new Wi(s,"string")),BP=s=>H(new Wi(s,"ArrayBuffer"));te("toColor",Qv);te("toFloat",A);te("toInt",L);te("toUint",ve);te("toBool",lr);te("toVec2",z);te("toIVec2",us);te("toUVec2",eM);te("toBVec2",tM);te("toVec3",D);te("toIVec3",nM);te("toUVec3",Aa);te("toBVec3",ig);te("toVec4",oe);te("toIVec4",iM);te("toUVec4",sM);te("toBVec4",rM);te("toMat2",al);te("toMat3",Tn);te("toMat4",Jr);const oM=K(gr),aM=(s,e)=>H(new Km(H(s),e)),zP=(s,e)=>H(new ph(H(s),e));te("element",oM);te("convert",aM);class sg extends Ye{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1){super("string"),this.name=e,this.version=0,this.shared=t,this.order=n,this.isUniformGroup=!0}set needsUpdate(e){e===!0&&this.version++}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const cM=s=>new sg(s),rg=(s,e=0)=>new sg(s,!0,e),kP=rg("frame"),_t=rg("render"),lM=cM("object");class ho extends jm{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=lM}label(e){return this.name=e,this}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){const n=this.getSelf();return e=e.bind(n),super.onUpdate(i=>{const r=e(i,n);r!==void 0&&(this.value=r)},t)}generate(e,t){const n=this.getNodeType(e),i=this.getUniformHash(e);let r=e.getNodeFromHash(i);r===void 0&&(e.setHashNode(this,i),r=this);const o=r.getInputType(e),a=e.getUniformFromNode(r,o,e.shaderStage,this.name||e.context.label),c=e.getPropertyName(a);return e.context.label!==void 0&&delete e.context.label,e.format(c,n,t)}}const pe=(s,e)=>{const t=Kv(e||s),n=s&&s.isNode===!0?s.node&&s.node.value||s.value:s;return H(new ho(n,t))};class Nt extends Ye{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1){super(e),this.name=t,this.varying=n,this.isPropertyNode=!0}getHash(e){return this.name||super.getHash(e)}isGlobal(){return!0}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const ai=(s,e)=>H(new Nt(s,e)),Zi=(s,e)=>H(new Nt(s,e,!0)),Ct=fe(Nt,"vec4","DiffuseColor"),Sf=fe(Nt,"vec3","EmissiveColor"),ds=fe(Nt,"float","Roughness"),zc=fe(Nt,"float","Metalness"),fh=fe(Nt,"float","Clearcoat"),kc=fe(Nt,"float","ClearcoatRoughness"),qr=fe(Nt,"vec3","Sheen"),Nd=fe(Nt,"float","SheenRoughness"),Ed=fe(Nt,"float","Iridescence"),og=fe(Nt,"float","IridescenceIOR"),ag=fe(Nt,"float","IridescenceThickness"),mh=fe(Nt,"float","AlphaT"),Zs=fe(Nt,"float","Anisotropy"),nc=fe(Nt,"vec3","AnisotropyT"),Kr=fe(Nt,"vec3","AnisotropyB"),ri=fe(Nt,"color","SpecularColor"),Gc=fe(Nt,"float","SpecularF90"),gh=fe(Nt,"float","Shininess"),cg=fe(Nt,"vec4","Output"),jr=fe(Nt,"float","dashSize"),Hc=fe(Nt,"float","gapSize"),GP=fe(Nt,"float","pointWidth"),ic=fe(Nt,"float","IOR"),xh=fe(Nt,"float","Transmission"),lg=fe(Nt,"float","Thickness"),ug=fe(Nt,"float","AttenuationDistance"),hg=fe(Nt,"color","AttenuationColor"),dg=fe(Nt,"float","Dispersion");class uM extends pt{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t}hasDependencies(){return!1}getNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){const n=e.getTypeLength(t.node.getNodeType(e));return wa.join("").slice(0,n)!==t.components}return!1}generate(e,t){const{targetNode:n,sourceNode:i}=this,r=this.needsSplitAssign(e),o=n.getNodeType(e),a=n.context({assign:!0}).build(e),c=i.build(e,o),l=i.getNodeType(e),u=e.getDataFromNode(this);let h;if(u.initialized===!0)t!=="void"&&(h=a);else if(r){const d=e.getVarFromNode(this,null,o),p=e.getPropertyName(d);e.addLineFlowCode(`${p} = ${c}`,this);const f=n.node.context({assign:!0}).build(e);for(let x=0;x<n.components.length;x++){const m=n.components[x];e.addLineFlowCode(`${f}.${m} = ${p}[ ${x} ]`,this)}t!=="void"&&(h=a)}else h=`${a} = ${c}`,(t==="void"||l==="void")&&(e.addLineFlowCode(h,this),t!=="void"&&(h=a));return u.initialized=!0,e.format(h,o,t)}}const hM=K(uM);te("assign",hM);class dM extends pt{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}generate(e){const t=[],n=this.functionNode,i=n.getInputs(e),r=this.parameters;if(Array.isArray(r))for(let a=0;a<r.length;a++){const c=i[a],l=r[a];t.push(l.build(e,c.type))}else for(const a of i){const c=r[a.name];if(c!==void 0)t.push(c.build(e,a.type));else throw new Error(`FunctionCallNode: Input '${a.name}' not found in FunctionNode.`)}return`${n.build(e,"property")}( ${t.join(", ")} )`}}const pM=(s,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?Zr(e):ol(e[0]),H(new dM(H(s),e)));te("call",pM);class qt extends pt{static get type(){return"OperatorNode"}constructor(e,t,n,...i){if(super(),i.length>0){let r=new qt(e,t,n);for(let o=0;o<i.length-1;o++)r=new qt(e,r,i[o]);t=r,n=i[i.length-1]}this.op=e,this.aNode=t,this.bNode=n}getNodeType(e,t){const n=this.op,i=this.aNode,r=this.bNode,o=i.getNodeType(e),a=typeof r<"u"?r.getNodeType(e):null;if(o==="void"||a==="void")return"void";if(n==="%")return o;if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(o);if(n==="!"||n==="=="||n==="&&"||n==="||"||n==="^^")return"bool";if(n==="<"||n===">"||n==="<="||n===">="){const c=t?e.getTypeLength(t):Math.max(e.getTypeLength(o),e.getTypeLength(a));return c>1?`bvec${c}`:"bool"}else return o==="float"&&e.isMatrix(a)?a:e.isMatrix(o)&&e.isVector(a)?e.getVectorFromMatrix(o):e.isVector(o)&&e.isMatrix(a)?e.getVectorFromMatrix(a):e.getTypeLength(a)>e.getTypeLength(o)?a:o}generate(e,t){const n=this.op,i=this.aNode,r=this.bNode,o=this.getNodeType(e,t);let a=null,c=null;o!=="void"?(a=i.getNodeType(e),c=typeof r<"u"?r.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="?e.isVector(a)?c=a:a!==c&&(a=c="float"):n===">>"||n==="<<"?(a=o,c=e.changeComponentType(c,"uint")):e.isMatrix(a)&&e.isVector(c)?c=e.getVectorFromMatrix(a):e.isVector(a)&&e.isMatrix(c)?a=e.getVectorFromMatrix(c):a=c=o):a=c=o;const l=i.build(e,a),u=typeof r<"u"?r.build(e,c):null,h=e.getTypeLength(t),d=e.getFunctionOperator(n);if(t!=="void")return n==="<"&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThan",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} < ${u} )`,o,t):n==="<="&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThanEqual",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} <= ${u} )`,o,t):n===">"&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThan",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} > ${u} )`,o,t):n===">="&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThanEqual",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} >= ${u} )`,o,t):n==="!"||n==="~"?e.format(`(${n}${l})`,a,t):d?e.format(`${d}( ${l}, ${u} )`,o,t):e.format(`( ${l} ${n} ${u} )`,o,t);if(a!=="void")return d?e.format(`${d}( ${l}, ${u} )`,o,t):e.format(`${l} ${n} ${u}`,o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const Wt=K(qt,"+"),Ft=K(qt,"-"),ot=K(qt,"*"),ns=K(qt,"/"),pg=K(qt,"%"),fM=K(qt,"=="),mM=K(qt,"!="),gM=K(qt,"<"),fg=K(qt,">"),xM=K(qt,"<="),_M=K(qt,">="),yM=K(qt,"&&"),vM=K(qt,"||"),MM=K(qt,"!"),SM=K(qt,"^^"),TM=K(qt,"&"),bM=K(qt,"~"),wM=K(qt,"|"),AM=K(qt,"^"),NM=K(qt,"<<"),EM=K(qt,">>");te("add",Wt);te("sub",Ft);te("mul",ot);te("div",ns);te("modInt",pg);te("equal",fM);te("notEqual",mM);te("lessThan",gM);te("greaterThan",fg);te("lessThanEqual",xM);te("greaterThanEqual",_M);te("and",yM);te("or",vM);te("not",MM);te("xor",SM);te("bitAnd",TM);te("bitNot",bM);te("bitOr",wM);te("bitXor",AM);te("shiftLeft",NM);te("shiftRight",EM);const CM=(...s)=>(console.warn("TSL.OperatorNode: .remainder() has been renamed to .modInt()."),pg(...s));te("remainder",CM);class V extends pt{static get type(){return"MathNode"}constructor(e,t,n=null,i=null){super(),this.method=e,this.aNode=t,this.bNode=n,this.cNode=i}getInputType(e){const t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,i=this.cNode?this.cNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(n)?0:e.getTypeLength(n),a=e.isMatrix(i)?0:e.getTypeLength(i);return r>o&&r>a?t:o>a?n:a>r?i:t}getNodeType(e){const t=this.method;return t===V.LENGTH||t===V.DISTANCE||t===V.DOT?"float":t===V.CROSS?"vec3":t===V.ALL?"bool":t===V.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):t===V.MOD?this.aNode.getNodeType(e):this.getInputType(e)}generate(e,t){const n=this.method,i=this.getNodeType(e),r=this.getInputType(e),o=this.aNode,a=this.bNode,c=this.cNode,l=e.renderer.isWebGLRenderer===!0;if(n===V.TRANSFORM_DIRECTION){let u=o,h=a;e.isMatrix(u.getNodeType(e))?h=oe(D(h),0):u=oe(D(u),0);const d=ot(u,h).xyz;return vi(d).build(e,t)}else{if(n===V.NEGATE)return e.format("( - "+o.build(e,r)+" )",i,t);if(n===V.ONE_MINUS)return Ft(1,o).build(e,t);if(n===V.RECIPROCAL)return ns(1,o).build(e,t);if(n===V.DIFFERENCE)return Dt(Ft(o,a)).build(e,t);{const u=[];return n===V.CROSS||n===V.MOD?u.push(o.build(e,i),a.build(e,i)):l&&n===V.STEP?u.push(o.build(e,e.getTypeLength(o.getNodeType(e))===1?"float":r),a.build(e,r)):l&&(n===V.MIN||n===V.MAX)||n===V.MOD?u.push(o.build(e,r),a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":r)):n===V.REFRACT?u.push(o.build(e,r),a.build(e,r),c.build(e,"float")):n===V.MIX?u.push(o.build(e,r),a.build(e,r),c.build(e,e.getTypeLength(c.getNodeType(e))===1?"float":r)):(u.push(o.build(e,r)),a!==null&&u.push(a.build(e,r)),c!==null&&u.push(c.build(e,r))),e.format(`${e.getMethod(n,i)}( ${u.join(", ")} )`,i,t)}}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}V.ALL="all";V.ANY="any";V.EQUALS="equals";V.RADIANS="radians";V.DEGREES="degrees";V.EXP="exp";V.EXP2="exp2";V.LOG="log";V.LOG2="log2";V.SQRT="sqrt";V.INVERSE_SQRT="inversesqrt";V.FLOOR="floor";V.CEIL="ceil";V.NORMALIZE="normalize";V.FRACT="fract";V.SIN="sin";V.COS="cos";V.TAN="tan";V.ASIN="asin";V.ACOS="acos";V.ATAN="atan";V.ABS="abs";V.SIGN="sign";V.LENGTH="length";V.NEGATE="negate";V.ONE_MINUS="oneMinus";V.DFDX="dFdx";V.DFDY="dFdy";V.ROUND="round";V.RECIPROCAL="reciprocal";V.TRUNC="trunc";V.FWIDTH="fwidth";V.BITCAST="bitcast";V.TRANSPOSE="transpose";V.ATAN2="atan2";V.MIN="min";V.MAX="max";V.MOD="mod";V.STEP="step";V.REFLECT="reflect";V.DISTANCE="distance";V.DIFFERENCE="difference";V.DOT="dot";V.CROSS="cross";V.POW="pow";V.TRANSFORM_DIRECTION="transformDirection";V.MIX="mix";V.CLAMP="clamp";V.REFRACT="refract";V.SMOOTHSTEP="smoothstep";V.FACEFORWARD="faceforward";const RM=A(1e-6),HP=A(1e6),no=A(Math.PI),WP=A(Math.PI*2),mg=K(V,V.ALL),IM=K(V,V.ANY),PM=K(V,V.EQUALS),LM=K(V,V.RADIANS),DM=K(V,V.DEGREES),gg=K(V,V.EXP),_h=K(V,V.EXP2),xg=K(V,V.LOG),cl=K(V,V.LOG2),os=K(V,V.SQRT),UM=K(V,V.INVERSE_SQRT),xr=K(V,V.FLOOR),_g=K(V,V.CEIL),vi=K(V,V.NORMALIZE),_r=K(V,V.FRACT),Cn=K(V,V.SIN),Mi=K(V,V.COS),FM=K(V,V.TAN),OM=K(V,V.ASIN),yh=K(V,V.ACOS),VM=K(V,V.ATAN),Dt=K(V,V.ABS),ll=K(V,V.SIGN),Qr=K(V,V.LENGTH),BM=K(V,V.NEGATE),zM=K(V,V.ONE_MINUS),kM=K(V,V.DFDX),GM=K(V,V.DFDY),HM=K(V,V.ROUND),WM=K(V,V.RECIPROCAL),yg=K(V,V.TRUNC),XM=K(V,V.FWIDTH),XP=K(V,V.BITCAST),qM=K(V,V.TRANSPOSE),$M=K(V,V.ATAN2),Mn=K(V,V.MIN),ft=K(V,V.MAX),Cd=K(V,V.MOD),ul=K(V,V.STEP),YM=K(V,V.REFLECT),ZM=K(V,V.DISTANCE),JM=K(V,V.DIFFERENCE),$t=K(V,V.DOT),ea=K(V,V.CROSS),jn=K(V,V.POW),vg=K(V,V.POW,2),KM=K(V,V.POW,3),jM=K(V,V.POW,4),QM=K(V,V.TRANSFORM_DIRECTION),eS=s=>ot(ll(s),jn(Dt(s),1/3)),Mg=s=>$t(s,s),it=K(V,V.MIX),cn=(s,e=0,t=1)=>H(new V(V.CLAMP,H(s),H(e),H(t))),tS=s=>cn(s),Sg=K(V,V.REFRACT),ti=K(V,V.SMOOTHSTEP),nS=K(V,V.FACEFORWARD),Tg=U(([s])=>{const n=43758.5453,i=$t(s.xy,z(12.9898,78.233)),r=Cd(i,no);return _r(Cn(r).mul(n))}),iS=(s,e,t)=>it(e,t,s),sS=(s,e,t)=>ti(e,t,s);te("all",mg);te("any",IM);te("equals",PM);te("radians",LM);te("degrees",DM);te("exp",gg);te("exp2",_h);te("log",xg);te("log2",cl);te("sqrt",os);te("inverseSqrt",UM);te("floor",xr);te("ceil",_g);te("normalize",vi);te("fract",_r);te("sin",Cn);te("cos",Mi);te("tan",FM);te("asin",OM);te("acos",yh);te("atan",VM);te("abs",Dt);te("sign",ll);te("length",Qr);te("lengthSq",Mg);te("negate",BM);te("oneMinus",zM);te("dFdx",kM);te("dFdy",GM);te("round",HM);te("reciprocal",WM);te("trunc",yg);te("fwidth",XM);te("atan2",$M);te("min",Mn);te("max",ft);te("mod",Cd);te("step",ul);te("reflect",YM);te("distance",ZM);te("dot",$t);te("cross",ea);te("pow",jn);te("pow2",vg);te("pow3",KM);te("pow4",jM);te("transformDirection",QM);te("mix",iS);te("clamp",cn);te("refract",Sg);te("smoothstep",sS);te("faceForward",nS);te("difference",JM);te("saturate",tS);te("cbrt",eS);te("transpose",qM);te("rand",Tg);class qP extends Ye{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}getNodeType(e){const t=this.ifNode.getNodeType(e);if(this.elseNode!==null){const n=this.elseNode.getNodeType(e);if(e.getTypeLength(n)>e.getTypeLength(t))return n}return t}setup(e){const t=this.condNode.cache(),n=this.ifNode.cache(),i=this.elseNode?this.elseNode.cache():null,r=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=r,i!==null&&(e.getDataFromNode(i).parentNodeBlock=r);const o=e.getNodeProperties(this);o.condNode=t,o.ifNode=n.context({nodeBlock:n}),o.elseNode=i?i.context({nodeBlock:i}):null}generate(e,t){const n=this.getNodeType(e),i=e.getDataFromNode(this);if(i.nodeProperty!==void 0)return i.nodeProperty;const{condNode:r,ifNode:o,elseNode:a}=e.getNodeProperties(this),c=t!=="void",l=c?ai(n).build(e):"";i.nodeProperty=l;const u=r.build(e,"bool");e.addFlowCode(`
|
|
3843
|
+
}`;class XR{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new Xt,r=e.properties.get(i);r.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new ki({vertexShader:HR,fragmentShader:WR,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new kt(new oo(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class qR extends Ai{constructor(e,t){super();const n=this;let i=null,r=1,o=null,a="local-floor",c=1,l=null,u=null,h=null,d=null,p=null,f=null;const x=new XR,m=t.getContextAttributes();let g=null,y=null;const _=[],v=[],I=new J;let T=null;const w=new hn;w.layers.enable(1),w.viewport=new st;const C=new hn;C.layers.enable(2),C.viewport=new st;const F=[w,C],M=new lm;M.layers.enable(1),M.layers.enable(2);let b=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.controllerAutoUpdate=!0,this.getController=function(ne){let ue=_[ne];return ue===void 0&&(ue=new Sp,_[ne]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function(ne){let ue=_[ne];return ue===void 0&&(ue=new Sp,_[ne]=ue),ue.getGripSpace()},this.getHand=function(ne){let ue=_[ne];return ue===void 0&&(ue=new Sp,_[ne]=ue),ue.getHandSpace()};function W(ne){const ue=v.indexOf(ne.inputSource);if(ue===-1)return;const Ae=_[ue];Ae!==void 0&&(Ae.update(ne.inputSource,ne.frame,l||o),Ae.dispatchEvent({type:ne.type,data:ne.inputSource}))}function $(){i.removeEventListener("select",W),i.removeEventListener("selectstart",W),i.removeEventListener("selectend",W),i.removeEventListener("squeeze",W),i.removeEventListener("squeezestart",W),i.removeEventListener("squeezeend",W),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",ie);for(let ne=0;ne<_.length;ne++){const ue=v[ne];ue!==null&&(v[ne]=null,_[ne]&&_[ne].disconnect(ue))}b=null,G=null,x.reset(),e.setRenderTarget(g),p=null,d=null,h=null,i=null,y=null,ht.stop(),n.isPresenting=!1,e.setPixelRatio(T),e.setSize(I.width,I.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ne){r=ne,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ne){a=ne,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(ne){l=ne},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return h},this.getFrame=function(){return f},this.getSession=function(){return i},this.setSession=async function(ne){if(i=ne,i!==null){if(g=e.getRenderTarget(),i.addEventListener("select",W),i.addEventListener("selectstart",W),i.addEventListener("selectend",W),i.addEventListener("squeeze",W),i.addEventListener("squeezestart",W),i.addEventListener("squeezeend",W),i.addEventListener("end",$),i.addEventListener("inputsourceschange",ie),m.xrCompatible!==!0&&await t.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(I),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let Ae=null,ge=null,Ze=null;m.depth&&(Ze=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Ae=m.stencil?cr:er,ge=m.stencil?ar:Bi);const Xe={colorFormat:t.RGBA8,depthFormat:Ze,scaleFactor:r};h=new XRWebGLBinding(i,t),d=h.createProjectionLayer(Xe),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),y=new zi(d.textureWidth,d.textureHeight,{format:Rn,type:es,depthTexture:new co(d.textureWidth,d.textureHeight,ge,void 0,void 0,void 0,void 0,void 0,void 0,Ae),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1})}else{const Ae={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};p=new XRWebGLLayer(i,t,Ae),i.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),y=new zi(p.framebufferWidth,p.framebufferHeight,{format:Rn,type:es,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}y.isXRRenderTarget=!0,this.setFoveation(c),l=null,o=await i.requestReferenceSpace(a),ht.setContext(i),ht.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function ie(ne){for(let ue=0;ue<ne.removed.length;ue++){const Ae=ne.removed[ue],ge=v.indexOf(Ae);ge>=0&&(v[ge]=null,_[ge]&&_[ge].disconnect(Ae))}for(let ue=0;ue<ne.added.length;ue++){const Ae=ne.added[ue];let ge=v.indexOf(Ae);if(ge===-1){for(let Xe=0;Xe<_.length;Xe++)if(Xe>=v.length){v.push(Ae),ge=Xe;break}else if(v[Xe]===null){v[Xe]=Ae,ge=Xe;break}if(ge===-1)break}const Ze=_[ge];Ze&&Ze.connect(Ae)}}const q=new E,he=new E;function Q(ne,ue,Ae){q.setFromMatrixPosition(ue.matrixWorld),he.setFromMatrixPosition(Ae.matrixWorld);const ge=q.distanceTo(he),Ze=ue.projectionMatrix.elements,Xe=Ae.projectionMatrix.elements,Je=Ze[14]/(Ze[10]-1),dt=Ze[14]/(Ze[10]+1),ae=(Ze[9]+1)/Ze[5],P=(Ze[9]-1)/Ze[5],Me=(Ze[8]-1)/Ze[0],ye=(Xe[8]+1)/Xe[0],de=Je*Me,Te=Je*ye,qe=ge/(-Me+ye),Ie=qe*-Me;if(ue.matrixWorld.decompose(ne.position,ne.quaternion,ne.scale),ne.translateX(Ie),ne.translateZ(qe),ne.matrixWorld.compose(ne.position,ne.quaternion,ne.scale),ne.matrixWorldInverse.copy(ne.matrixWorld).invert(),Ze[10]===-1)ne.projectionMatrix.copy(ue.projectionMatrix),ne.projectionMatrixInverse.copy(ue.projectionMatrixInverse);else{const R=Je+qe,S=dt+qe,X=de-Ie,re=Te+(ge-Ie),ce=ae*dt/S*R,se=P*dt/S*R;ne.projectionMatrix.makePerspective(X,re,ce,se,R,S),ne.projectionMatrixInverse.copy(ne.projectionMatrix).invert()}}function we(ne,ue){ue===null?ne.matrixWorld.copy(ne.matrix):ne.matrixWorld.multiplyMatrices(ue.matrixWorld,ne.matrix),ne.matrixWorldInverse.copy(ne.matrixWorld).invert()}this.updateCamera=function(ne){if(i===null)return;let ue=ne.near,Ae=ne.far;x.texture!==null&&(x.depthNear>0&&(ue=x.depthNear),x.depthFar>0&&(Ae=x.depthFar)),M.near=C.near=w.near=ue,M.far=C.far=w.far=Ae,(b!==M.near||G!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),b=M.near,G=M.far);const ge=ne.parent,Ze=M.cameras;we(M,ge);for(let Xe=0;Xe<Ze.length;Xe++)we(Ze[Xe],ge);Ze.length===2?Q(M,w,C):M.projectionMatrix.copy(w.projectionMatrix),Ne(ne,M,ge)};function Ne(ne,ue,Ae){Ae===null?ne.matrix.copy(ue.matrixWorld):(ne.matrix.copy(Ae.matrixWorld),ne.matrix.invert(),ne.matrix.multiply(ue.matrixWorld)),ne.matrix.decompose(ne.position,ne.quaternion,ne.scale),ne.updateMatrixWorld(!0),ne.projectionMatrix.copy(ue.projectionMatrix),ne.projectionMatrixInverse.copy(ue.projectionMatrixInverse),ne.isPerspectiveCamera&&(ne.fov=oa*2*Math.atan(1/ne.projectionMatrix.elements[5]),ne.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(d===null&&p===null))return c},this.setFoveation=function(ne){c=ne,d!==null&&(d.fixedFoveation=ne),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=ne)},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(M)};let Ee=null;function Qe(ne,ue){if(u=ue.getViewerPose(l||o),f=ue,u!==null){const Ae=u.views;p!==null&&(e.setRenderTargetFramebuffer(y,p.framebuffer),e.setRenderTarget(y));let ge=!1;Ae.length!==M.cameras.length&&(M.cameras.length=0,ge=!0);for(let Xe=0;Xe<Ae.length;Xe++){const Je=Ae[Xe];let dt=null;if(p!==null)dt=p.getViewport(Je);else{const P=h.getViewSubImage(d,Je);dt=P.viewport,Xe===0&&(e.setRenderTargetTextures(y,P.colorTexture,d.ignoreDepthValues?void 0:P.depthStencilTexture),e.setRenderTarget(y))}let ae=F[Xe];ae===void 0&&(ae=new hn,ae.layers.enable(Xe),ae.viewport=new st,F[Xe]=ae),ae.matrix.fromArray(Je.transform.matrix),ae.matrix.decompose(ae.position,ae.quaternion,ae.scale),ae.projectionMatrix.fromArray(Je.projectionMatrix),ae.projectionMatrixInverse.copy(ae.projectionMatrix).invert(),ae.viewport.set(dt.x,dt.y,dt.width,dt.height),Xe===0&&(M.matrix.copy(ae.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),ge===!0&&M.cameras.push(ae)}const Ze=i.enabledFeatures;if(Ze&&Ze.includes("depth-sensing")){const Xe=h.getDepthInformation(Ae[0]);Xe&&Xe.isValid&&Xe.texture&&x.init(e,Xe,i.renderState)}}if(n.controllerAutoUpdate)for(let Ae=0;Ae<_.length;Ae++){const ge=v[Ae],Ze=_[Ae];ge!==null&&Ze!==void 0&&Ze.update(ge,ue,l||o)}Ee&&Ee(ne,ue),ue.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ue}),f=null}const ht=new qy;ht.setAnimationLoop(Qe),this.setAnimationLoop=function(ne){Ee=ne},this.dispose=function(){}}}const Nr=new ui,$R=new Fe;function YR(s,e){function t(m,g){m.matrixAutoUpdate===!0&&m.updateMatrix(),g.value.copy(m.matrix)}function n(m,g){g.color.getRGB(m.fogColor.value,Xy(s)),g.isFog?(m.fogNear.value=g.near,m.fogFar.value=g.far):g.isFogExp2&&(m.fogDensity.value=g.density)}function i(m,g,y,_,v){g.isMeshBasicMaterial||g.isMeshLambertMaterial?r(m,g):g.isMeshToonMaterial?(r(m,g),h(m,g)):g.isMeshPhongMaterial?(r(m,g),u(m,g)):g.isMeshStandardMaterial?(r(m,g),d(m,g),g.isMeshPhysicalMaterial&&p(m,g,v)):g.isMeshMatcapMaterial?(r(m,g),f(m,g)):g.isMeshDepthMaterial?r(m,g):g.isMeshDistanceMaterial?(r(m,g),x(m,g)):g.isMeshNormalMaterial?r(m,g):g.isLineBasicMaterial?(o(m,g),g.isLineDashedMaterial&&a(m,g)):g.isPointsMaterial?c(m,g,y,_):g.isSpriteMaterial?l(m,g):g.isShadowMaterial?(m.color.value.copy(g.color),m.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function r(m,g){m.opacity.value=g.opacity,g.color&&m.diffuse.value.copy(g.color),g.emissive&&m.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(m.map.value=g.map,t(g.map,m.mapTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,t(g.alphaMap,m.alphaMapTransform)),g.bumpMap&&(m.bumpMap.value=g.bumpMap,t(g.bumpMap,m.bumpMapTransform),m.bumpScale.value=g.bumpScale,g.side===ln&&(m.bumpScale.value*=-1)),g.normalMap&&(m.normalMap.value=g.normalMap,t(g.normalMap,m.normalMapTransform),m.normalScale.value.copy(g.normalScale),g.side===ln&&m.normalScale.value.negate()),g.displacementMap&&(m.displacementMap.value=g.displacementMap,t(g.displacementMap,m.displacementMapTransform),m.displacementScale.value=g.displacementScale,m.displacementBias.value=g.displacementBias),g.emissiveMap&&(m.emissiveMap.value=g.emissiveMap,t(g.emissiveMap,m.emissiveMapTransform)),g.specularMap&&(m.specularMap.value=g.specularMap,t(g.specularMap,m.specularMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);const y=e.get(g),_=y.envMap,v=y.envMapRotation;_&&(m.envMap.value=_,Nr.copy(v),Nr.x*=-1,Nr.y*=-1,Nr.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(Nr.y*=-1,Nr.z*=-1),m.envMapRotation.value.setFromMatrix4($R.makeRotationFromEuler(Nr)),m.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=g.reflectivity,m.ior.value=g.ior,m.refractionRatio.value=g.refractionRatio),g.lightMap&&(m.lightMap.value=g.lightMap,m.lightMapIntensity.value=g.lightMapIntensity,t(g.lightMap,m.lightMapTransform)),g.aoMap&&(m.aoMap.value=g.aoMap,m.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,m.aoMapTransform))}function o(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,g.map&&(m.map.value=g.map,t(g.map,m.mapTransform))}function a(m,g){m.dashSize.value=g.dashSize,m.totalSize.value=g.dashSize+g.gapSize,m.scale.value=g.scale}function c(m,g,y,_){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.size.value=g.size*y,m.scale.value=_*.5,g.map&&(m.map.value=g.map,t(g.map,m.uvTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,t(g.alphaMap,m.alphaMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest)}function l(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.rotation.value=g.rotation,g.map&&(m.map.value=g.map,t(g.map,m.mapTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,t(g.alphaMap,m.alphaMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest)}function u(m,g){m.specular.value.copy(g.specular),m.shininess.value=Math.max(g.shininess,1e-4)}function h(m,g){g.gradientMap&&(m.gradientMap.value=g.gradientMap)}function d(m,g){m.metalness.value=g.metalness,g.metalnessMap&&(m.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,m.metalnessMapTransform)),m.roughness.value=g.roughness,g.roughnessMap&&(m.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,m.roughnessMapTransform)),g.envMap&&(m.envMapIntensity.value=g.envMapIntensity)}function p(m,g,y){m.ior.value=g.ior,g.sheen>0&&(m.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),m.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(m.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,m.sheenColorMapTransform)),g.sheenRoughnessMap&&(m.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,m.sheenRoughnessMapTransform))),g.clearcoat>0&&(m.clearcoat.value=g.clearcoat,m.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(m.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,m.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(m.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===ln&&m.clearcoatNormalScale.value.negate())),g.dispersion>0&&(m.dispersion.value=g.dispersion),g.iridescence>0&&(m.iridescence.value=g.iridescence,m.iridescenceIOR.value=g.iridescenceIOR,m.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(m.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,m.iridescenceMapTransform)),g.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),g.transmission>0&&(m.transmission.value=g.transmission,m.transmissionSamplerMap.value=y.texture,m.transmissionSamplerSize.value.set(y.width,y.height),g.transmissionMap&&(m.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,m.transmissionMapTransform)),m.thickness.value=g.thickness,g.thicknessMap&&(m.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=g.attenuationDistance,m.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(m.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(m.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=g.specularIntensity,m.specularColor.value.copy(g.specularColor),g.specularColorMap&&(m.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,m.specularColorMapTransform)),g.specularIntensityMap&&(m.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,m.specularIntensityMapTransform))}function f(m,g){g.matcap&&(m.matcap.value=g.matcap)}function x(m,g){const y=e.get(g).light;m.referencePosition.value.setFromMatrixPosition(y.matrixWorld),m.nearDistance.value=y.shadow.camera.near,m.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function ZR(s,e,t,n){let i={},r={},o=[];const a=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function c(y,_){const v=_.program;n.uniformBlockBinding(y,v)}function l(y,_){let v=i[y.id];v===void 0&&(f(y),v=u(y),i[y.id]=v,y.addEventListener("dispose",m));const I=_.program;n.updateUBOMapping(y,I);const T=e.render.frame;r[y.id]!==T&&(d(y),r[y.id]=T)}function u(y){const _=h();y.__bindingPointIndex=_;const v=s.createBuffer(),I=y.__size,T=y.usage;return s.bindBuffer(s.UNIFORM_BUFFER,v),s.bufferData(s.UNIFORM_BUFFER,I,T),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,_,v),v}function h(){for(let y=0;y<a;y++)if(o.indexOf(y)===-1)return o.push(y),y;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(y){const _=i[y.id],v=y.uniforms,I=y.__cache;s.bindBuffer(s.UNIFORM_BUFFER,_);for(let T=0,w=v.length;T<w;T++){const C=Array.isArray(v[T])?v[T]:[v[T]];for(let F=0,M=C.length;F<M;F++){const b=C[F];if(p(b,T,F,I)===!0){const G=b.__offset,W=Array.isArray(b.value)?b.value:[b.value];let $=0;for(let ie=0;ie<W.length;ie++){const q=W[ie],he=x(q);typeof q=="number"||typeof q=="boolean"?(b.__data[0]=q,s.bufferSubData(s.UNIFORM_BUFFER,G+$,b.__data)):q.isMatrix3?(b.__data[0]=q.elements[0],b.__data[1]=q.elements[1],b.__data[2]=q.elements[2],b.__data[3]=0,b.__data[4]=q.elements[3],b.__data[5]=q.elements[4],b.__data[6]=q.elements[5],b.__data[7]=0,b.__data[8]=q.elements[6],b.__data[9]=q.elements[7],b.__data[10]=q.elements[8],b.__data[11]=0):(q.toArray(b.__data,$),$+=he.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,G,b.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function p(y,_,v,I){const T=y.value,w=_+"_"+v;if(I[w]===void 0)return typeof T=="number"||typeof T=="boolean"?I[w]=T:I[w]=T.clone(),!0;{const C=I[w];if(typeof T=="number"||typeof T=="boolean"){if(C!==T)return I[w]=T,!0}else if(C.equals(T)===!1)return C.copy(T),!0}return!1}function f(y){const _=y.uniforms;let v=0;const I=16;for(let w=0,C=_.length;w<C;w++){const F=Array.isArray(_[w])?_[w]:[_[w]];for(let M=0,b=F.length;M<b;M++){const G=F[M],W=Array.isArray(G.value)?G.value:[G.value];for(let $=0,ie=W.length;$<ie;$++){const q=W[$],he=x(q),Q=v%I,we=Q%he.boundary,Ne=Q+we;v+=we,Ne!==0&&I-Ne<he.storage&&(v+=I-Ne),G.__data=new Float32Array(he.storage/Float32Array.BYTES_PER_ELEMENT),G.__offset=v,v+=he.storage}}}const T=v%I;return T>0&&(v+=I-T),y.__size=v,y.__cache={},this}function x(y){const _={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(_.boundary=4,_.storage=4):y.isVector2?(_.boundary=8,_.storage=8):y.isVector3||y.isColor?(_.boundary=16,_.storage=12):y.isVector4?(_.boundary=16,_.storage=16):y.isMatrix3?(_.boundary=48,_.storage=48):y.isMatrix4?(_.boundary=64,_.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),_}function m(y){const _=y.target;_.removeEventListener("dispose",m);const v=o.indexOf(_.__bindingPointIndex);o.splice(v,1),s.deleteBuffer(i[_.id]),delete i[_.id],delete r[_.id]}function g(){for(const y in i)s.deleteBuffer(i[y]);o=[],i={},r={}}return{bind:c,update:l,dispose:g}}class jy{constructor(e={}){const{canvas:t=zy(),context:n=null,depth:i=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=o;const p=new Uint32Array(4),f=new Int32Array(4);let x=null,m=null;const g=[],y=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=kn,this.toneMapping=Ti,this.toneMappingExposure=1;const _=this;let v=!1,I=0,T=0,w=null,C=-1,F=null;const M=new st,b=new st;let G=null;const W=new _e(0);let $=0,ie=t.width,q=t.height,he=1,Q=null,we=null;const Ne=new st(0,0,ie,q),Ee=new st(0,0,ie,q);let Qe=!1;const ht=new xa;let ne=!1,ue=!1;const Ae=new Fe,ge=new Fe,Ze=new E,Xe=new st,Je={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let dt=!1;function ae(){return w===null?he:1}let P=n;function Me(N,B){return t.getContext(N,B)}try{const N={alpha:!0,depth:i,stencil:r,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${js}`),t.addEventListener("webglcontextlost",le,!1),t.addEventListener("webglcontextrestored",Ce,!1),t.addEventListener("webglcontextcreationerror",Le,!1),P===null){const B="webgl2";if(P=Me(B,N),P===null)throw Me(B)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(N){throw console.error("THREE.WebGLRenderer: "+N.message),N}let ye,de,Te,qe,Ie,R,S,X,re,ce,se,ke,be,De,vt,me,Ue,tt,nt,Be,Mt,ct,Ot,O;function Pe(){ye=new tC(P),ye.init(),ct=new Ky(P,ye),de=new JE(P,ye,e,ct),Te=new UR(P),de.reverseDepthBuffer&&Te.buffers.depth.setReversed(!0),qe=new sC(P),Ie=new SR,R=new kR(P,ye,Te,Ie,de,ct,qe),S=new jE(_),X=new eC(_),re=new d1(P),Ot=new YE(P,re),ce=new nC(P,re,qe,Ot),se=new oC(P,ce,re,qe),nt=new rC(P,de,R),me=new KE(Ie),ke=new MR(_,S,X,ye,de,Ot,me),be=new YR(_,Ie),De=new bR,vt=new RR(ye),tt=new $E(_,S,X,Te,se,d,c),Ue=new LR(_,se,de),O=new ZR(P,qe,de,Te),Be=new ZE(P,ye,qe),Mt=new iC(P,ye,qe),qe.programs=ke.programs,_.capabilities=de,_.extensions=ye,_.properties=Ie,_.renderLists=De,_.shadowMap=Ue,_.state=Te,_.info=qe}Pe();const ee=new qR(_,P);this.xr=ee,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const N=ye.get("WEBGL_lose_context");N&&N.loseContext()},this.forceContextRestore=function(){const N=ye.get("WEBGL_lose_context");N&&N.restoreContext()},this.getPixelRatio=function(){return he},this.setPixelRatio=function(N){N!==void 0&&(he=N,this.setSize(ie,q,!1))},this.getSize=function(N){return N.set(ie,q)},this.setSize=function(N,B,Y=!0){if(ee.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}ie=N,q=B,t.width=Math.floor(N*he),t.height=Math.floor(B*he),Y===!0&&(t.style.width=N+"px",t.style.height=B+"px"),this.setViewport(0,0,N,B)},this.getDrawingBufferSize=function(N){return N.set(ie*he,q*he).floor()},this.setDrawingBufferSize=function(N,B,Y){ie=N,q=B,he=Y,t.width=Math.floor(N*Y),t.height=Math.floor(B*Y),this.setViewport(0,0,N,B)},this.getCurrentViewport=function(N){return N.copy(M)},this.getViewport=function(N){return N.copy(Ne)},this.setViewport=function(N,B,Y,Z){N.isVector4?Ne.set(N.x,N.y,N.z,N.w):Ne.set(N,B,Y,Z),Te.viewport(M.copy(Ne).multiplyScalar(he).round())},this.getScissor=function(N){return N.copy(Ee)},this.setScissor=function(N,B,Y,Z){N.isVector4?Ee.set(N.x,N.y,N.z,N.w):Ee.set(N,B,Y,Z),Te.scissor(b.copy(Ee).multiplyScalar(he).round())},this.getScissorTest=function(){return Qe},this.setScissorTest=function(N){Te.setScissorTest(Qe=N)},this.setOpaqueSort=function(N){Q=N},this.setTransparentSort=function(N){we=N},this.getClearColor=function(N){return N.copy(tt.getClearColor())},this.setClearColor=function(){tt.setClearColor.apply(tt,arguments)},this.getClearAlpha=function(){return tt.getClearAlpha()},this.setClearAlpha=function(){tt.setClearAlpha.apply(tt,arguments)},this.clear=function(N=!0,B=!0,Y=!0){let Z=0;if(N){let k=!1;if(w!==null){const xe=w.texture.format;k=xe===Gh||xe===kh||xe===Xc}if(k){const xe=w.texture.type,Re=xe===es||xe===Bi||xe===na||xe===ar||xe===Fh||xe===Oh,ze=tt.getClearColor(),Ge=tt.getClearAlpha(),je=ze.r,et=ze.g,He=ze.b;Re?(p[0]=je,p[1]=et,p[2]=He,p[3]=Ge,P.clearBufferuiv(P.COLOR,0,p)):(f[0]=je,f[1]=et,f[2]=He,f[3]=Ge,P.clearBufferiv(P.COLOR,0,f))}else Z|=P.COLOR_BUFFER_BIT}B&&(Z|=P.DEPTH_BUFFER_BIT,P.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Y&&(Z|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),P.clear(Z)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",le,!1),t.removeEventListener("webglcontextrestored",Ce,!1),t.removeEventListener("webglcontextcreationerror",Le,!1),De.dispose(),vt.dispose(),Ie.dispose(),S.dispose(),X.dispose(),se.dispose(),Ot.dispose(),O.dispose(),ke.dispose(),ee.dispose(),ee.removeEventListener("sessionstart",f0),ee.removeEventListener("sessionend",m0),Mr.stop()};function le(N){N.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function Ce(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;const N=qe.autoReset,B=Ue.enabled,Y=Ue.autoUpdate,Z=Ue.needsUpdate,k=Ue.type;Pe(),qe.autoReset=N,Ue.enabled=B,Ue.autoUpdate=Y,Ue.needsUpdate=Z,Ue.type=k}function Le(N){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",N.statusMessage)}function bt(N){const B=N.target;B.removeEventListener("dispose",bt),on(B)}function on(N){ni(N),Ie.remove(N)}function ni(N){const B=Ie.get(N).programs;B!==void 0&&(B.forEach(function(Y){ke.releaseProgram(Y)}),N.isShaderMaterial&&ke.releaseShaderCache(N))}this.renderBufferDirect=function(N,B,Y,Z,k,xe){B===null&&(B=Je);const Re=k.isMesh&&k.matrixWorld.determinant()<0,ze=tA(N,B,Y,Z,k);Te.setMaterial(Z,Re);let Ge=Y.index,je=1;if(Z.wireframe===!0){if(Ge=ce.getWireframeAttribute(Y),Ge===void 0)return;je=2}const et=Y.drawRange,He=Y.attributes.position;let Lt=et.start*je,Gt=(et.start+et.count)*je;xe!==null&&(Lt=Math.max(Lt,xe.start*je),Gt=Math.min(Gt,(xe.start+xe.count)*je)),Ge!==null?(Lt=Math.max(Lt,0),Gt=Math.min(Gt,Ge.count)):He!=null&&(Lt=Math.max(Lt,0),Gt=Math.min(Gt,He.count));const Jt=Gt-Lt;if(Jt<0||Jt===1/0)return;Ot.setup(k,Z,ze,Y,Ge);let fi,Rt=Be;if(Ge!==null&&(fi=re.get(Ge),Rt=Mt,Rt.setIndex(fi)),k.isMesh)Z.wireframe===!0?(Te.setLineWidth(Z.wireframeLinewidth*ae()),Rt.setMode(P.LINES)):Rt.setMode(P.TRIANGLES);else if(k.isLine){let $e=Z.linewidth;$e===void 0&&($e=1),Te.setLineWidth($e*ae()),k.isLineSegments?Rt.setMode(P.LINES):k.isLineLoop?Rt.setMode(P.LINE_LOOP):Rt.setMode(P.LINE_STRIP)}else k.isPoints?Rt.setMode(P.POINTS):k.isSprite&&Rt.setMode(P.TRIANGLES);if(k.isBatchedMesh)if(k._multiDrawInstances!==null)Rt.renderMultiDrawInstances(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount,k._multiDrawInstances);else if(ye.get("WEBGL_multi_draw"))Rt.renderMultiDraw(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount);else{const $e=k._multiDrawStarts,An=k._multiDrawCounts,It=k._multiDrawCount,Xi=Ge?re.get(Ge).bytesPerElement:1,mo=Ie.get(Z).currentProgram.getUniforms();for(let mi=0;mi<It;mi++)mo.setValue(P,"_gl_DrawID",mi),Rt.render($e[mi]/Xi,An[mi])}else if(k.isInstancedMesh)Rt.renderInstances(Lt,Jt,k.count);else if(Y.isInstancedBufferGeometry){const $e=Y._maxInstanceCount!==void 0?Y._maxInstanceCount:1/0,An=Math.min(Y.instanceCount,$e);Rt.renderInstances(Lt,Jt,An)}else Rt.render(Lt,Jt)};function Et(N,B,Y){N.transparent===!0&&N.side===Ji&&N.forceSinglePass===!1?(N.side=ln,N.needsUpdate=!0,wl(N,B,Y),N.side=gs,N.needsUpdate=!0,wl(N,B,Y),N.side=Ji):wl(N,B,Y)}this.compile=function(N,B,Y=null){Y===null&&(Y=N),m=vt.get(Y),m.init(B),y.push(m),Y.traverseVisible(function(k){k.isLight&&k.layers.test(B.layers)&&(m.pushLight(k),k.castShadow&&m.pushShadow(k))}),N!==Y&&N.traverseVisible(function(k){k.isLight&&k.layers.test(B.layers)&&(m.pushLight(k),k.castShadow&&m.pushShadow(k))}),m.setupLights();const Z=new Set;return N.traverse(function(k){if(!(k.isMesh||k.isPoints||k.isLine||k.isSprite))return;const xe=k.material;if(xe)if(Array.isArray(xe))for(let Re=0;Re<xe.length;Re++){const ze=xe[Re];Et(ze,Y,k),Z.add(ze)}else Et(xe,Y,k),Z.add(xe)}),y.pop(),m=null,Z},this.compileAsync=function(N,B,Y=null){const Z=this.compile(N,B,Y);return new Promise(k=>{function xe(){if(Z.forEach(function(Re){Ie.get(Re).currentProgram.isReady()&&Z.delete(Re)}),Z.size===0){k(N);return}setTimeout(xe,10)}ye.get("KHR_parallel_shader_compile")!==null?xe():setTimeout(xe,10)})};let ii=null;function Ss(N){ii&&ii(N)}function f0(){Mr.stop()}function m0(){Mr.start()}const Mr=new qy;Mr.setAnimationLoop(Ss),typeof self<"u"&&Mr.setContext(self),this.setAnimationLoop=function(N){ii=N,ee.setAnimationLoop(N),N===null?Mr.stop():Mr.start()},ee.addEventListener("sessionstart",f0),ee.addEventListener("sessionend",m0),this.render=function(N,B){if(B!==void 0&&B.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;if(N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),B.parent===null&&B.matrixWorldAutoUpdate===!0&&B.updateMatrixWorld(),ee.enabled===!0&&ee.isPresenting===!0&&(ee.cameraAutoUpdate===!0&&ee.updateCamera(B),B=ee.getCamera()),N.isScene===!0&&N.onBeforeRender(_,N,B,w),m=vt.get(N,y.length),m.init(B),y.push(m),ge.multiplyMatrices(B.projectionMatrix,B.matrixWorldInverse),ht.setFromProjectionMatrix(ge),ue=this.localClippingEnabled,ne=me.init(this.clippingPlanes,ue),x=De.get(N,g.length),x.init(),g.push(x),ee.enabled===!0&&ee.isPresenting===!0){const xe=_.xr.getDepthSensingMesh();xe!==null&&Xd(xe,B,-1/0,_.sortObjects)}Xd(N,B,0,_.sortObjects),x.finish(),_.sortObjects===!0&&x.sort(Q,we),dt=ee.enabled===!1||ee.isPresenting===!1||ee.hasDepthSensing()===!1,dt&&tt.addToRenderList(x,N),this.info.render.frame++,ne===!0&&me.beginShadows();const Y=m.state.shadowsArray;Ue.render(Y,N,B),ne===!0&&me.endShadows(),this.info.autoReset===!0&&this.info.reset();const Z=x.opaque,k=x.transmissive;if(m.setupLights(),B.isArrayCamera){const xe=B.cameras;if(k.length>0)for(let Re=0,ze=xe.length;Re<ze;Re++){const Ge=xe[Re];x0(Z,k,N,Ge)}dt&&tt.render(N);for(let Re=0,ze=xe.length;Re<ze;Re++){const Ge=xe[Re];g0(x,N,Ge,Ge.viewport)}}else k.length>0&&x0(Z,k,N,B),dt&&tt.render(N),g0(x,N,B);w!==null&&(R.updateMultisampleRenderTarget(w),R.updateRenderTargetMipmap(w)),N.isScene===!0&&N.onAfterRender(_,N,B),Ot.resetDefaultState(),C=-1,F=null,y.pop(),y.length>0?(m=y[y.length-1],ne===!0&&me.setGlobalState(_.clippingPlanes,m.state.camera)):m=null,g.pop(),g.length>0?x=g[g.length-1]:x=null};function Xd(N,B,Y,Z){if(N.visible===!1)return;if(N.layers.test(B.layers)){if(N.isGroup)Y=N.renderOrder;else if(N.isLOD)N.autoUpdate===!0&&N.update(B);else if(N.isLight)m.pushLight(N),N.castShadow&&m.pushShadow(N);else if(N.isSprite){if(!N.frustumCulled||ht.intersectsSprite(N)){Z&&Xe.setFromMatrixPosition(N.matrixWorld).applyMatrix4(ge);const Re=se.update(N),ze=N.material;ze.visible&&x.push(N,Re,ze,Y,Xe.z,null)}}else if((N.isMesh||N.isLine||N.isPoints)&&(!N.frustumCulled||ht.intersectsObject(N))){const Re=se.update(N),ze=N.material;if(Z&&(N.boundingSphere!==void 0?(N.boundingSphere===null&&N.computeBoundingSphere(),Xe.copy(N.boundingSphere.center)):(Re.boundingSphere===null&&Re.computeBoundingSphere(),Xe.copy(Re.boundingSphere.center)),Xe.applyMatrix4(N.matrixWorld).applyMatrix4(ge)),Array.isArray(ze)){const Ge=Re.groups;for(let je=0,et=Ge.length;je<et;je++){const He=Ge[je],Lt=ze[He.materialIndex];Lt&&Lt.visible&&x.push(N,Re,Lt,Y,Xe.z,He)}}else ze.visible&&x.push(N,Re,ze,Y,Xe.z,null)}}const xe=N.children;for(let Re=0,ze=xe.length;Re<ze;Re++)Xd(xe[Re],B,Y,Z)}function g0(N,B,Y,Z){const k=N.opaque,xe=N.transmissive,Re=N.transparent;m.setupLightsView(Y),ne===!0&&me.setGlobalState(_.clippingPlanes,Y),Z&&Te.viewport(M.copy(Z)),k.length>0&&bl(k,B,Y),xe.length>0&&bl(xe,B,Y),Re.length>0&&bl(Re,B,Y),Te.buffers.depth.setTest(!0),Te.buffers.depth.setMask(!0),Te.buffers.color.setMask(!0),Te.setPolygonOffset(!1)}function x0(N,B,Y,Z){if((Y.isScene===!0?Y.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[Z.id]===void 0&&(m.state.transmissionRenderTarget[Z.id]=new zi(1,1,{generateMipmaps:!0,type:ye.has("EXT_color_buffer_half_float")||ye.has("EXT_color_buffer_float")?Ln:es,minFilter:Kn,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:gt.workingColorSpace}));const xe=m.state.transmissionRenderTarget[Z.id],Re=Z.viewport||M;xe.setSize(Re.z,Re.w);const ze=_.getRenderTarget();_.setRenderTarget(xe),_.getClearColor(W),$=_.getClearAlpha(),$<1&&_.setClearColor(16777215,.5),_.clear(),dt&&tt.render(Y);const Ge=_.toneMapping;_.toneMapping=Ti;const je=Z.viewport;if(Z.viewport!==void 0&&(Z.viewport=void 0),m.setupLightsView(Z),ne===!0&&me.setGlobalState(_.clippingPlanes,Z),bl(N,Y,Z),R.updateMultisampleRenderTarget(xe),R.updateRenderTargetMipmap(xe),ye.has("WEBGL_multisampled_render_to_texture")===!1){let et=!1;for(let He=0,Lt=B.length;He<Lt;He++){const Gt=B[He],Jt=Gt.object,fi=Gt.geometry,Rt=Gt.material,$e=Gt.group;if(Rt.side===Ji&&Jt.layers.test(Z.layers)){const An=Rt.side;Rt.side=ln,Rt.needsUpdate=!0,_0(Jt,Y,Z,fi,Rt,$e),Rt.side=An,Rt.needsUpdate=!0,et=!0}}et===!0&&(R.updateMultisampleRenderTarget(xe),R.updateRenderTargetMipmap(xe))}_.setRenderTarget(ze),_.setClearColor(W,$),je!==void 0&&(Z.viewport=je),_.toneMapping=Ge}function bl(N,B,Y){const Z=B.isScene===!0?B.overrideMaterial:null;for(let k=0,xe=N.length;k<xe;k++){const Re=N[k],ze=Re.object,Ge=Re.geometry,je=Z===null?Re.material:Z,et=Re.group;ze.layers.test(Y.layers)&&_0(ze,B,Y,Ge,je,et)}}function _0(N,B,Y,Z,k,xe){N.onBeforeRender(_,B,Y,Z,k,xe),N.modelViewMatrix.multiplyMatrices(Y.matrixWorldInverse,N.matrixWorld),N.normalMatrix.getNormalMatrix(N.modelViewMatrix),k.onBeforeRender(_,B,Y,Z,N,xe),k.transparent===!0&&k.side===Ji&&k.forceSinglePass===!1?(k.side=ln,k.needsUpdate=!0,_.renderBufferDirect(Y,B,Z,k,N,xe),k.side=gs,k.needsUpdate=!0,_.renderBufferDirect(Y,B,Z,k,N,xe),k.side=Ji):_.renderBufferDirect(Y,B,Z,k,N,xe),N.onAfterRender(_,B,Y,Z,k,xe)}function wl(N,B,Y){B.isScene!==!0&&(B=Je);const Z=Ie.get(N),k=m.state.lights,xe=m.state.shadowsArray,Re=k.state.version,ze=ke.getParameters(N,k.state,xe,B,Y),Ge=ke.getProgramCacheKey(ze);let je=Z.programs;Z.environment=N.isMeshStandardMaterial?B.environment:null,Z.fog=B.fog,Z.envMap=(N.isMeshStandardMaterial?X:S).get(N.envMap||Z.environment),Z.envMapRotation=Z.environment!==null&&N.envMap===null?B.environmentRotation:N.envMapRotation,je===void 0&&(N.addEventListener("dispose",bt),je=new Map,Z.programs=je);let et=je.get(Ge);if(et!==void 0){if(Z.currentProgram===et&&Z.lightsStateVersion===Re)return v0(N,ze),et}else ze.uniforms=ke.getUniforms(N),N.onBuild(Y,ze,_),N.onBeforeCompile(ze,_),et=ke.acquireProgram(ze,Ge),je.set(Ge,et),Z.uniforms=ze.uniforms;const He=Z.uniforms;return(!N.isShaderMaterial&&!N.isRawShaderMaterial||N.clipping===!0)&&(He.clippingPlanes=me.uniform),v0(N,ze),Z.needsLights=iA(N),Z.lightsStateVersion=Re,Z.needsLights&&(He.ambientLightColor.value=k.state.ambient,He.lightProbe.value=k.state.probe,He.directionalLights.value=k.state.directional,He.directionalLightShadows.value=k.state.directionalShadow,He.spotLights.value=k.state.spot,He.spotLightShadows.value=k.state.spotShadow,He.rectAreaLights.value=k.state.rectArea,He.ltc_1.value=k.state.rectAreaLTC1,He.ltc_2.value=k.state.rectAreaLTC2,He.pointLights.value=k.state.point,He.pointLightShadows.value=k.state.pointShadow,He.hemisphereLights.value=k.state.hemi,He.directionalShadowMap.value=k.state.directionalShadowMap,He.directionalShadowMatrix.value=k.state.directionalShadowMatrix,He.spotShadowMap.value=k.state.spotShadowMap,He.spotLightMatrix.value=k.state.spotLightMatrix,He.spotLightMap.value=k.state.spotLightMap,He.pointShadowMap.value=k.state.pointShadowMap,He.pointShadowMatrix.value=k.state.pointShadowMatrix),Z.currentProgram=et,Z.uniformsList=null,et}function y0(N){if(N.uniformsList===null){const B=N.currentProgram.getUniforms();N.uniformsList=Lu.seqWithValue(B.seq,N.uniforms)}return N.uniformsList}function v0(N,B){const Y=Ie.get(N);Y.outputColorSpace=B.outputColorSpace,Y.batching=B.batching,Y.batchingColor=B.batchingColor,Y.instancing=B.instancing,Y.instancingColor=B.instancingColor,Y.instancingMorph=B.instancingMorph,Y.skinning=B.skinning,Y.morphTargets=B.morphTargets,Y.morphNormals=B.morphNormals,Y.morphColors=B.morphColors,Y.morphTargetsCount=B.morphTargetsCount,Y.numClippingPlanes=B.numClippingPlanes,Y.numIntersection=B.numClipIntersection,Y.vertexAlphas=B.vertexAlphas,Y.vertexTangents=B.vertexTangents,Y.toneMapping=B.toneMapping}function tA(N,B,Y,Z,k){B.isScene!==!0&&(B=Je),R.resetTextureUnits();const xe=B.fog,Re=Z.isMeshStandardMaterial?B.environment:null,ze=w===null?_.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:li,Ge=(Z.isMeshStandardMaterial?X:S).get(Z.envMap||Re),je=Z.vertexColors===!0&&!!Y.attributes.color&&Y.attributes.color.itemSize===4,et=!!Y.attributes.tangent&&(!!Z.normalMap||Z.anisotropy>0),He=!!Y.morphAttributes.position,Lt=!!Y.morphAttributes.normal,Gt=!!Y.morphAttributes.color;let Jt=Ti;Z.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&(Jt=_.toneMapping);const fi=Y.morphAttributes.position||Y.morphAttributes.normal||Y.morphAttributes.color,Rt=fi!==void 0?fi.length:0,$e=Ie.get(Z),An=m.state.lights;if(ne===!0&&(ue===!0||N!==F)){const Ni=N===F&&Z.id===C;me.setState(Z,N,Ni)}let It=!1;Z.version===$e.__version?($e.needsLights&&$e.lightsStateVersion!==An.state.version||$e.outputColorSpace!==ze||k.isBatchedMesh&&$e.batching===!1||!k.isBatchedMesh&&$e.batching===!0||k.isBatchedMesh&&$e.batchingColor===!0&&k.colorTexture===null||k.isBatchedMesh&&$e.batchingColor===!1&&k.colorTexture!==null||k.isInstancedMesh&&$e.instancing===!1||!k.isInstancedMesh&&$e.instancing===!0||k.isSkinnedMesh&&$e.skinning===!1||!k.isSkinnedMesh&&$e.skinning===!0||k.isInstancedMesh&&$e.instancingColor===!0&&k.instanceColor===null||k.isInstancedMesh&&$e.instancingColor===!1&&k.instanceColor!==null||k.isInstancedMesh&&$e.instancingMorph===!0&&k.morphTexture===null||k.isInstancedMesh&&$e.instancingMorph===!1&&k.morphTexture!==null||$e.envMap!==Ge||Z.fog===!0&&$e.fog!==xe||$e.numClippingPlanes!==void 0&&($e.numClippingPlanes!==me.numPlanes||$e.numIntersection!==me.numIntersection)||$e.vertexAlphas!==je||$e.vertexTangents!==et||$e.morphTargets!==He||$e.morphNormals!==Lt||$e.morphColors!==Gt||$e.toneMapping!==Jt||$e.morphTargetsCount!==Rt)&&(It=!0):(It=!0,$e.__version=Z.version);let Xi=$e.currentProgram;It===!0&&(Xi=wl(Z,B,k));let mo=!1,mi=!1,qd=!1;const tn=Xi.getUniforms(),Bs=$e.uniforms;if(Te.useProgram(Xi.program)&&(mo=!0,mi=!0,qd=!0),(Z.id!==C||Z._forceRefresh)&&(C=Z.id,mi=!0,Z._forceRefresh=!1),mo||F!==N){de.reverseDepthBuffer?(Ae.copy(N.projectionMatrix),VA(Ae),BA(Ae),tn.setValue(P,"projectionMatrix",Ae)):tn.setValue(P,"projectionMatrix",N.projectionMatrix),tn.setValue(P,"viewMatrix",N.matrixWorldInverse);const Ni=tn.map.cameraPosition;Ni!==void 0&&Ni.setValue(P,Ze.setFromMatrixPosition(N.matrixWorld)),de.logarithmicDepthBuffer&&tn.setValue(P,"logDepthBufFC",2/(Math.log(N.far+1)/Math.LN2)),(Z.isMeshPhongMaterial||Z.isMeshToonMaterial||Z.isMeshLambertMaterial||Z.isMeshBasicMaterial||Z.isMeshStandardMaterial||Z.isShaderMaterial)&&tn.setValue(P,"isOrthographic",N.isOrthographicCamera===!0),F!==N&&(F=N,mi=!0,qd=!0)}if(k.isSkinnedMesh){tn.setOptional(P,k,"bindMatrix"),tn.setOptional(P,k,"bindMatrixInverse");const Ni=k.skeleton;Ni&&(Ni.boneTexture===null&&Ni.computeBoneTexture(),tn.setValue(P,"boneTexture",Ni.boneTexture,R))}k.isBatchedMesh&&(tn.setOptional(P,k,"batchingTexture"),tn.setValue(P,"batchingTexture",k._matricesTexture,R),tn.setOptional(P,k,"batchingIdTexture"),tn.setValue(P,"batchingIdTexture",k._indirectTexture,R),tn.setOptional(P,k,"batchingColorTexture"),k._colorsTexture!==null&&tn.setValue(P,"batchingColorTexture",k._colorsTexture,R));const $d=Y.morphAttributes;if(($d.position!==void 0||$d.normal!==void 0||$d.color!==void 0)&&nt.update(k,Y,Xi),(mi||$e.receiveShadow!==k.receiveShadow)&&($e.receiveShadow=k.receiveShadow,tn.setValue(P,"receiveShadow",k.receiveShadow)),Z.isMeshGouraudMaterial&&Z.envMap!==null&&(Bs.envMap.value=Ge,Bs.flipEnvMap.value=Ge.isCubeTexture&&Ge.isRenderTargetTexture===!1?-1:1),Z.isMeshStandardMaterial&&Z.envMap===null&&B.environment!==null&&(Bs.envMapIntensity.value=B.environmentIntensity),mi&&(tn.setValue(P,"toneMappingExposure",_.toneMappingExposure),$e.needsLights&&nA(Bs,qd),xe&&Z.fog===!0&&be.refreshFogUniforms(Bs,xe),be.refreshMaterialUniforms(Bs,Z,he,q,m.state.transmissionRenderTarget[N.id]),Lu.upload(P,y0($e),Bs,R)),Z.isShaderMaterial&&Z.uniformsNeedUpdate===!0&&(Lu.upload(P,y0($e),Bs,R),Z.uniformsNeedUpdate=!1),Z.isSpriteMaterial&&tn.setValue(P,"center",k.center),tn.setValue(P,"modelViewMatrix",k.modelViewMatrix),tn.setValue(P,"normalMatrix",k.normalMatrix),tn.setValue(P,"modelMatrix",k.matrixWorld),Z.isShaderMaterial||Z.isRawShaderMaterial){const Ni=Z.uniformsGroups;for(let Yd=0,sA=Ni.length;Yd<sA;Yd++){const M0=Ni[Yd];O.update(M0,Xi),O.bind(M0,Xi)}}return Xi}function nA(N,B){N.ambientLightColor.needsUpdate=B,N.lightProbe.needsUpdate=B,N.directionalLights.needsUpdate=B,N.directionalLightShadows.needsUpdate=B,N.pointLights.needsUpdate=B,N.pointLightShadows.needsUpdate=B,N.spotLights.needsUpdate=B,N.spotLightShadows.needsUpdate=B,N.rectAreaLights.needsUpdate=B,N.hemisphereLights.needsUpdate=B}function iA(N){return N.isMeshLambertMaterial||N.isMeshToonMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isShadowMaterial||N.isShaderMaterial&&N.lights===!0}this.getActiveCubeFace=function(){return I},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(N,B,Y){Ie.get(N.texture).__webglTexture=B,Ie.get(N.depthTexture).__webglTexture=Y;const Z=Ie.get(N);Z.__hasExternalTextures=!0,Z.__autoAllocateDepthBuffer=Y===void 0,Z.__autoAllocateDepthBuffer||ye.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),Z.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(N,B){const Y=Ie.get(N);Y.__webglFramebuffer=B,Y.__useDefaultFramebuffer=B===void 0},this.setRenderTarget=function(N,B=0,Y=0){w=N,I=B,T=Y;let Z=!0,k=null,xe=!1,Re=!1;if(N){const Ge=Ie.get(N);if(Ge.__useDefaultFramebuffer!==void 0)Te.bindFramebuffer(P.FRAMEBUFFER,null),Z=!1;else if(Ge.__webglFramebuffer===void 0)R.setupRenderTarget(N);else if(Ge.__hasExternalTextures)R.rebindTextures(N,Ie.get(N.texture).__webglTexture,Ie.get(N.depthTexture).__webglTexture);else if(N.depthBuffer){const He=N.depthTexture;if(Ge.__boundDepthTexture!==He){if(He!==null&&Ie.has(He)&&(N.width!==He.image.width||N.height!==He.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");R.setupDepthRenderbuffer(N)}}const je=N.texture;(je.isData3DTexture||je.isDataArrayTexture||je.isCompressedArrayTexture)&&(Re=!0);const et=Ie.get(N).__webglFramebuffer;N.isWebGLCubeRenderTarget?(Array.isArray(et[B])?k=et[B][Y]:k=et[B],xe=!0):N.samples>0&&R.useMultisampledRTT(N)===!1?k=Ie.get(N).__webglMultisampledFramebuffer:Array.isArray(et)?k=et[Y]:k=et,M.copy(N.viewport),b.copy(N.scissor),G=N.scissorTest}else M.copy(Ne).multiplyScalar(he).floor(),b.copy(Ee).multiplyScalar(he).floor(),G=Qe;if(Te.bindFramebuffer(P.FRAMEBUFFER,k)&&Z&&Te.drawBuffers(N,k),Te.viewport(M),Te.scissor(b),Te.setScissorTest(G),xe){const Ge=Ie.get(N.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+B,Ge.__webglTexture,Y)}else if(Re){const Ge=Ie.get(N.texture),je=B||0;P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,Ge.__webglTexture,Y||0,je)}C=-1},this.readRenderTargetPixels=function(N,B,Y,Z,k,xe,Re){if(!(N&&N.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ze=Ie.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&Re!==void 0&&(ze=ze[Re]),ze){Te.bindFramebuffer(P.FRAMEBUFFER,ze);try{const Ge=N.texture,je=Ge.format,et=Ge.type;if(!de.textureFormatReadable(je)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!de.textureTypeReadable(et)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}B>=0&&B<=N.width-Z&&Y>=0&&Y<=N.height-k&&P.readPixels(B,Y,Z,k,ct.convert(je),ct.convert(et),xe)}finally{const Ge=w!==null?Ie.get(w).__webglFramebuffer:null;Te.bindFramebuffer(P.FRAMEBUFFER,Ge)}}},this.readRenderTargetPixelsAsync=async function(N,B,Y,Z,k,xe,Re){if(!(N&&N.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ze=Ie.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&Re!==void 0&&(ze=ze[Re]),ze){const Ge=N.texture,je=Ge.format,et=Ge.type;if(!de.textureFormatReadable(je))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!de.textureTypeReadable(et))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(B>=0&&B<=N.width-Z&&Y>=0&&Y<=N.height-k){Te.bindFramebuffer(P.FRAMEBUFFER,ze);const He=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,He),P.bufferData(P.PIXEL_PACK_BUFFER,xe.byteLength,P.STREAM_READ),P.readPixels(B,Y,Z,k,ct.convert(je),ct.convert(et),0);const Lt=w!==null?Ie.get(w).__webglFramebuffer:null;Te.bindFramebuffer(P.FRAMEBUFFER,Lt);const Gt=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await OA(P,Gt,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,He),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,xe),P.deleteBuffer(He),P.deleteSync(Gt),xe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(N,B=null,Y=0){N.isTexture!==!0&&(Pu("WebGLRenderer: copyFramebufferToTexture function signature has changed."),B=arguments[0]||null,N=arguments[1]);const Z=Math.pow(2,-Y),k=Math.floor(N.image.width*Z),xe=Math.floor(N.image.height*Z),Re=B!==null?B.x:0,ze=B!==null?B.y:0;R.setTexture2D(N,0),P.copyTexSubImage2D(P.TEXTURE_2D,Y,0,0,Re,ze,k,xe),Te.unbindTexture()},this.copyTextureToTexture=function(N,B,Y=null,Z=null,k=0){N.isTexture!==!0&&(Pu("WebGLRenderer: copyTextureToTexture function signature has changed."),Z=arguments[0]||null,N=arguments[1],B=arguments[2],k=arguments[3]||0,Y=null);let xe,Re,ze,Ge,je,et;Y!==null?(xe=Y.max.x-Y.min.x,Re=Y.max.y-Y.min.y,ze=Y.min.x,Ge=Y.min.y):(xe=N.image.width,Re=N.image.height,ze=0,Ge=0),Z!==null?(je=Z.x,et=Z.y):(je=0,et=0);const He=ct.convert(B.format),Lt=ct.convert(B.type);R.setTexture2D(B,0),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,B.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,B.unpackAlignment);const Gt=P.getParameter(P.UNPACK_ROW_LENGTH),Jt=P.getParameter(P.UNPACK_IMAGE_HEIGHT),fi=P.getParameter(P.UNPACK_SKIP_PIXELS),Rt=P.getParameter(P.UNPACK_SKIP_ROWS),$e=P.getParameter(P.UNPACK_SKIP_IMAGES),An=N.isCompressedTexture?N.mipmaps[k]:N.image;P.pixelStorei(P.UNPACK_ROW_LENGTH,An.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,An.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,ze),P.pixelStorei(P.UNPACK_SKIP_ROWS,Ge),N.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,k,je,et,xe,Re,He,Lt,An.data):N.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,k,je,et,An.width,An.height,He,An.data):P.texSubImage2D(P.TEXTURE_2D,k,je,et,xe,Re,He,Lt,An),P.pixelStorei(P.UNPACK_ROW_LENGTH,Gt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Jt),P.pixelStorei(P.UNPACK_SKIP_PIXELS,fi),P.pixelStorei(P.UNPACK_SKIP_ROWS,Rt),P.pixelStorei(P.UNPACK_SKIP_IMAGES,$e),k===0&&B.generateMipmaps&&P.generateMipmap(P.TEXTURE_2D),Te.unbindTexture()},this.copyTextureToTexture3D=function(N,B,Y=null,Z=null,k=0){N.isTexture!==!0&&(Pu("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Y=arguments[0]||null,Z=arguments[1]||null,N=arguments[2],B=arguments[3],k=arguments[4]||0);let xe,Re,ze,Ge,je,et,He,Lt,Gt;const Jt=N.isCompressedTexture?N.mipmaps[k]:N.image;Y!==null?(xe=Y.max.x-Y.min.x,Re=Y.max.y-Y.min.y,ze=Y.max.z-Y.min.z,Ge=Y.min.x,je=Y.min.y,et=Y.min.z):(xe=Jt.width,Re=Jt.height,ze=Jt.depth,Ge=0,je=0,et=0),Z!==null?(He=Z.x,Lt=Z.y,Gt=Z.z):(He=0,Lt=0,Gt=0);const fi=ct.convert(B.format),Rt=ct.convert(B.type);let $e;if(B.isData3DTexture)R.setTexture3D(B,0),$e=P.TEXTURE_3D;else if(B.isDataArrayTexture||B.isCompressedArrayTexture)R.setTexture2DArray(B,0),$e=P.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,B.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,B.unpackAlignment);const An=P.getParameter(P.UNPACK_ROW_LENGTH),It=P.getParameter(P.UNPACK_IMAGE_HEIGHT),Xi=P.getParameter(P.UNPACK_SKIP_PIXELS),mo=P.getParameter(P.UNPACK_SKIP_ROWS),mi=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,Jt.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Jt.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Ge),P.pixelStorei(P.UNPACK_SKIP_ROWS,je),P.pixelStorei(P.UNPACK_SKIP_IMAGES,et),N.isDataTexture||N.isData3DTexture?P.texSubImage3D($e,k,He,Lt,Gt,xe,Re,ze,fi,Rt,Jt.data):B.isCompressedArrayTexture?P.compressedTexSubImage3D($e,k,He,Lt,Gt,xe,Re,ze,fi,Jt.data):P.texSubImage3D($e,k,He,Lt,Gt,xe,Re,ze,fi,Rt,Jt),P.pixelStorei(P.UNPACK_ROW_LENGTH,An),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,It),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Xi),P.pixelStorei(P.UNPACK_SKIP_ROWS,mo),P.pixelStorei(P.UNPACK_SKIP_IMAGES,mi),k===0&&B.generateMipmaps&&P.generateMipmap($e),Te.unbindTexture()},this.initRenderTarget=function(N){Ie.get(N).__webglFramebuffer===void 0&&R.setupRenderTarget(N)},this.initTexture=function(N){N.isCubeTexture?R.setTextureCube(N,0):N.isData3DTexture?R.setTexture3D(N,0):N.isDataArrayTexture||N.isCompressedArrayTexture?R.setTexture2DArray(N,0):R.setTexture2D(N,0),Te.unbindTexture()},this.resetState=function(){I=0,T=0,w=null,Te.reset(),Ot.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Di}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Wh?"display-p3":"srgb",t.unpackColorSpace=gt.workingColorSpace===qc?"display-p3":"srgb"}}class jh{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new _e(e),this.density=t}clone(){return new jh(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}let um=class Qy{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new _e(e),this.near=t,this.far=n}clone(){return new Qy(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}};class Qh extends yt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ui,this.environmentIntensity=1,this.environmentRotation=new ui,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class ya{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ra,this.updateRanges=[],this.version=0,this.uuid=bi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=bi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=bi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const $n=new E;class Us{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)$n.fromBufferAttribute(this,t),$n.applyMatrix4(e),this.setXYZ(t,$n.x,$n.y,$n.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)$n.fromBufferAttribute(this,t),$n.applyNormalMatrix(e),this.setXYZ(t,$n.x,$n.y,$n.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)$n.fromBufferAttribute(this,t),$n.transformDirection(e),this.setXYZ(t,$n.x,$n.y,$n.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Zn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=ut(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Zn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Zn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Zn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Zn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array),r=ut(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new At(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Us(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Jc extends mn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new _e(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Ro;const Ua=new E,Io=new E,Po=new E,Lo=new J,Fa=new J,ev=new Fe,Yl=new E,Oa=new E,Zl=new E,lx=new J,Tp=new J,ux=new J;class hm extends yt{constructor(e=new Jc){if(super(),this.isSprite=!0,this.type="Sprite",Ro===void 0){Ro=new at;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new ya(t,5);Ro.setIndex([0,1,2,0,2,3]),Ro.setAttribute("position",new Us(n,3,0,!1)),Ro.setAttribute("uv",new Us(n,2,3,!1))}this.geometry=Ro,this.material=e,this.center=new J(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Io.setFromMatrixScale(this.matrixWorld),ev.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Po.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Io.multiplyScalar(-Po.z);const n=this.material.rotation;let i,r;n!==0&&(r=Math.cos(n),i=Math.sin(n));const o=this.center;Jl(Yl.set(-.5,-.5,0),Po,o,Io,i,r),Jl(Oa.set(.5,-.5,0),Po,o,Io,i,r),Jl(Zl.set(.5,.5,0),Po,o,Io,i,r),lx.set(0,0),Tp.set(1,0),ux.set(1,1);let a=e.ray.intersectTriangle(Yl,Oa,Zl,!1,Ua);if(a===null&&(Jl(Oa.set(-.5,.5,0),Po,o,Io,i,r),Tp.set(0,1),a=e.ray.intersectTriangle(Yl,Zl,Oa,!1,Ua),a===null))return;const c=e.ray.origin.distanceTo(Ua);c<e.near||c>e.far||t.push({distance:c,point:Ua.clone(),uv:Jn.getInterpolation(Ua,Yl,Oa,Zl,lx,Tp,ux,new J),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Jl(s,e,t,n,i,r){Lo.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(Fa.x=r*Lo.x-i*Lo.y,Fa.y=i*Lo.x+r*Lo.y):Fa.copy(Lo),s.copy(e),s.x+=Fa.x,s.y+=Fa.y,s.applyMatrix4(ev)}const Kl=new E,hx=new E;class dm extends yt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const r=t[n];this.addLevel(r.object.clone(),r.distance,r.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let r;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let r=t[n].distance;if(t[n].object.visible&&(r-=r*t[n].hysteresis),e<r)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Kl.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Kl);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Kl.setFromMatrixPosition(e.matrixWorld),hx.setFromMatrixPosition(this.matrixWorld);const n=Kl.distanceTo(hx)/e.zoom;t[0].object.visible=!0;let i,r;for(i=1,r=t.length;i<r;i++){let o=t[i].distance;if(t[i].object.visible&&(o-=o*t[i].hysteresis),n>=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,r=n.length;i<r;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const dx=new E,px=new st,fx=new st,JR=new E,mx=new Fe,jl=new E,bp=new Dn,gx=new Fe,wp=new so;class pm extends kt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=uf,this.bindMatrix=new Fe,this.bindMatrixInverse=new Fe,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Wn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,jl),this.boundingBox.expandByPoint(jl)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Dn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,jl),this.boundingSphere.expandByPoint(jl)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),bp.copy(this.boundingSphere),bp.applyMatrix4(i),e.ray.intersectsSphere(bp)!==!1&&(gx.copy(i).invert(),wp.copy(e.ray).applyMatrix4(gx),!(this.boundingBox!==null&&wp.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,wp)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new st,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===uf?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===py?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;px.fromBufferAttribute(i.attributes.skinIndex,e),fx.fromBufferAttribute(i.attributes.skinWeight,e),dx.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const o=fx.getComponent(r);if(o!==0){const a=px.getComponent(r);mx.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(JR.copy(dx).applyMatrix4(mx),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class ed extends yt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Oi extends Xt{constructor(e=null,t=1,n=1,i,r,o,a,c,l=Qt,u=Qt,h,d){super(null,o,a,c,l,u,i,r,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const xx=new Fe,KR=new Fe;class Kc{constructor(e=[],t=[]){this.uuid=bi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Fe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Fe;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,o=e.length;r<o;r++){const a=e[r]?e[r].matrixWorld:KR;xx.multiplyMatrices(a,t[r]),xx.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Kc(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Oi(t,e,e,Rn,Gn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const r=e.bones[n];let o=t[r];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),o=new ed),this.bones.push(o),this.boneInverses.push(new Fe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const o=t[i];e.bones.push(o.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class Fs extends At{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Do=new Fe,_x=new Fe,Ql=[],yx=new Wn,jR=new Fe,Va=new kt,Ba=new Dn;class fm extends kt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Fs(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,jR)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Wn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Do),yx.copy(e.boundingBox).applyMatrix4(Do),this.boundingBox.union(yx)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Dn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Do),Ba.copy(e.boundingSphere).applyMatrix4(Do),this.boundingSphere.union(Ba)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,o=e*r+1;for(let a=0;a<n.length;a++)n[a]=i[o+a]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Va.geometry=this.geometry,Va.material=this.material,Va.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ba.copy(this.boundingSphere),Ba.applyMatrix4(n),e.ray.intersectsSphere(Ba)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,Do),_x.multiplyMatrices(n,Do),Va.matrixWorld=_x,Va.raycast(e,Ql);for(let o=0,a=Ql.length;o<a;o++){const c=Ql[o];c.instanceId=r,c.object=this,t.push(c)}Ql.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Fs(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Oi(new Float32Array(i*this.count),i,this.count,Wc,Gn));const r=this.morphTexture.source.data.data;let o=0;for(let l=0;l<n.length;l++)o+=n[l];const a=this.geometry.morphTargetsRelative?1:1-o,c=i*e;r[c]=a,r.set(n,c+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function QR(s,e){return s.z-e.z}function eI(s,e){return e.z-s.z}class tI{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n){const i=this.pool,r=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const o=i[this.index];r.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=t,o.index=n}reset(){this.list.length=0,this.index=0}}const qs=new Fe,Ap=new Fe,nI=new Fe,iI=new _e(1,1,1),vx=new Fe,Np=new xa,eu=new Wn,Er=new Dn,za=new E,Mx=new E,sI=new E,Ep=new tI,zn=new kt,tu=[];function rI(s,e,t=0){const n=e.itemSize;if(s.isInterleavedBufferAttribute||s.array.constructor!==e.array.constructor){const i=s.count;for(let r=0;r<i;r++)for(let o=0;o<n;o++)e.setComponent(r+t,o,s.getComponent(r,o))}else e.array.set(s.array,t*n);e.needsUpdate=!0}class mm extends kt{get maxInstanceCount(){return this._maxInstanceCount}constructor(e,t,n=t*2,i){super(new at,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawInfo=[],this._availableInstanceIds=[],this._drawRanges=[],this._reservedRanges=[],this._bounds=[],this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._visibilityChanged=!0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Oi(t,e,e,Rn,Gn);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Oi(t,e,e,Xc,Bi);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new Oi(t,e,e,Rn,Gn);n.colorSpace=gt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const r in e.attributes){const o=e.getAttribute(r),{array:a,itemSize:c,normalized:l}=o,u=new a.constructor(n*c),h=new At(u,c,l);t.setAttribute(r,h)}if(e.getIndex()!==null){const r=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new At(r,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Wn);const e=this.boundingBox,t=this._drawInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const r=t[n].geometryIndex;this.getMatrixAt(n,qs),this.getBoundingBoxAt(r,eu).applyMatrix4(qs),e.union(eu)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Dn);const e=this.boundingSphere,t=this._drawInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const r=t[n].geometryIndex;this.getMatrixAt(n,qs),this.getBoundingSphereAt(r,Er).applyMatrix4(qs),e.union(Er)}}addInstance(e){if(this._drawInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(i=this._availableInstanceIds.pop(),this._drawInfo[i]=n):(i=this._drawInfo.length,this._drawInfo.push(n));const r=this._matricesTexture,o=r.image.data;nI.toArray(o,i*16),r.needsUpdate=!0;const a=this._colorsTexture;return a&&(iI.toArray(a.image.data,i*4),a.needsUpdate=!0),i}addGeometry(e,t=-1,n=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let r=null;const o=this._reservedRanges,a=this._drawRanges,c=this._bounds;this._geometryCount!==0&&(r=o[o.length-1]),t===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=t,r===null?i.vertexStart=0:i.vertexStart=r.vertexStart+r.vertexCount;const l=e.getIndex(),u=l!==null;if(u&&(n===-1?i.indexCount=l.count:i.indexCount=n,r===null?i.indexStart=0:i.indexStart=r.indexStart+r.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._geometryCount;return this._geometryCount++,o.push(i),a.push({start:u?i.indexStart:i.vertexStart,count:-1}),c.push({boxInitialized:!1,box:new Wn,sphereInitialized:!1,sphere:new Dn}),this.setGeometryAt(h,e),h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,r=n.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const c=a.vertexStart,l=a.vertexCount;for(const p in n.attributes){const f=t.getAttribute(p),x=n.getAttribute(p);rI(f,x,c);const m=f.itemSize;for(let g=f.count,y=l;g<y;g++){const _=c+g;for(let v=0;v<m;v++)x.setComponent(_,v,0)}x.needsUpdate=!0,x.addUpdateRange(c*m,l*m)}if(i){const p=a.indexStart;for(let f=0;f<o.count;f++)r.setX(p+f,c+o.getX(f));for(let f=o.count,x=a.indexCount;f<x;f++)r.setX(p+f,c);r.needsUpdate=!0,r.addUpdateRange(p,a.indexCount)}const u=this._bounds[e];t.boundingBox!==null?(u.box.copy(t.boundingBox),u.boxInitialized=!0):u.boxInitialized=!1,t.boundingSphere!==null?(u.sphere.copy(t.boundingSphere),u.sphereInitialized=!0):u.sphereInitialized=!1;const h=this._drawRanges[e],d=t.getAttribute("position");return h.count=i?o.count:d.count,this._visibilityChanged=!0,e}deleteInstance(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?this:(t[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this._bounds[e],i=n.box,r=this.geometry;if(n.boxInitialized===!1){i.makeEmpty();const o=r.index,a=r.attributes.position,c=this._drawRanges[e];for(let l=c.start,u=c.start+c.count;l<u;l++){let h=l;o&&(h=o.getX(h)),i.expandByPoint(za.fromBufferAttribute(a,h))}n.boxInitialized=!0}return t.copy(i),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this._bounds[e],i=n.sphere,r=this.geometry;if(n.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,eu),eu.getCenter(i.center);const o=r.index,a=r.attributes.position,c=this._drawRanges[e];let l=0;for(let u=c.start,h=c.start+c.count;u<h;u++){let d=u;o&&(d=o.getX(d)),za.fromBufferAttribute(a,d),l=Math.max(l,i.center.distanceToSquared(za))}i.radius=Math.sqrt(l),n.sphereInitialized=!0}return t.copy(i),t}setMatrixAt(e,t){const n=this._drawInfo,i=this._matricesTexture,r=this._matricesTexture.image.data;return e>=n.length||n[e].active===!1?this:(t.toArray(r,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,t){const n=this._drawInfo,i=this._matricesTexture.image.data;return e>=n.length||n[e].active===!1?null:t.fromArray(i,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const n=this._colorsTexture,i=this._colorsTexture.image.data,r=this._drawInfo;return e>=r.length||r[e].active===!1?this:(t.toArray(i,e*4),n.needsUpdate=!0,this)}getColorAt(e,t){const n=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||i[e].active===!1?null:t.fromArray(n,e*4)}setVisibleAt(e,t){const n=this._drawInfo;return e>=n.length||n[e].active===!1||n[e].visible===t?this:(n[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}setGeometryIdAt(e,t){const n=this._drawInfo;return e>=n.length||n[e].active===!1||t<0||t>=this._geometryCount?null:(n[e].geometryIndex=t,this)}getGeometryIdAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?-1:t[e].geometryIndex}getGeometryRangeAt(e,t={}){if(e<0||e>=this._geometryCount)return null;const n=this._drawRanges[e];return t.start=n.start,t.count=n.count,t}raycast(e,t){const n=this._drawInfo,i=this._drawRanges,r=this.matrixWorld,o=this.geometry;zn.material=this.material,zn.geometry.index=o.index,zn.geometry.attributes=o.attributes,zn.geometry.boundingBox===null&&(zn.geometry.boundingBox=new Wn),zn.geometry.boundingSphere===null&&(zn.geometry.boundingSphere=new Dn);for(let a=0,c=n.length;a<c;a++){if(!n[a].visible||!n[a].active)continue;const l=n[a].geometryIndex,u=i[l];zn.geometry.setDrawRange(u.start,u.count),this.getMatrixAt(a,zn.matrixWorld).premultiply(r),this.getBoundingBoxAt(l,zn.geometry.boundingBox),this.getBoundingSphereAt(l,zn.geometry.boundingSphere),zn.raycast(e,tu);for(let h=0,d=tu.length;h<d;h++){const p=tu[h];p.object=this,p.batchId=a,t.push(p)}tu.length=0}zn.material=null,zn.geometry.index=null,zn.geometry.attributes={},zn.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(t=>({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._drawInfo=e._drawInfo.map(t=>({...t})),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,c=this._drawInfo,l=this._multiDrawStarts,u=this._multiDrawCounts,h=this._drawRanges,d=this.perObjectFrustumCulled,p=this._indirectTexture,f=p.image.data;d&&(vx.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Np.setFromProjectionMatrix(vx,e.coordinateSystem));let x=0;if(this.sortObjects){Ap.copy(this.matrixWorld).invert(),za.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Ap),Mx.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Ap);for(let y=0,_=c.length;y<_;y++)if(c[y].visible&&c[y].active){const v=c[y].geometryIndex;this.getMatrixAt(y,qs),this.getBoundingSphereAt(v,Er).applyMatrix4(qs);let I=!1;if(d&&(I=!Np.intersectsSphere(Er)),!I){const T=sI.subVectors(Er.center,za).dot(Mx);Ep.push(h[v],T,y)}}const m=Ep.list,g=this.customSort;g===null?m.sort(r.transparent?eI:QR):g.call(this,m,n);for(let y=0,_=m.length;y<_;y++){const v=m[y];l[x]=v.start*a,u[x]=v.count,f[x]=v.index,x++}Ep.reset()}else for(let m=0,g=c.length;m<g;m++)if(c[m].visible&&c[m].active){const y=c[m].geometryIndex;let _=!1;if(d&&(this.getMatrixAt(m,qs),this.getBoundingSphereAt(y,Er).applyMatrix4(qs),_=!Np.intersectsSphere(Er)),!_){const v=h[y];l[x]=v.start*a,u[x]=v.count,f[x]=m,x++}}p.needsUpdate=!0,this._multiDrawCount=x,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,r,o){this.onBeforeRender(e,null,i,r,o)}}class Fn extends mn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new _e(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const lh=new E,uh=new E,Sx=new Fe,ka=new so,nu=new Dn,Cp=new E,Tx=new E;class Os extends yt{constructor(e=new at,t=new Fn){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)lh.fromBufferAttribute(t,i-1),uh.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=lh.distanceTo(uh);e.setAttribute("lineDistance",new Ve(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),nu.copy(n.boundingSphere),nu.applyMatrix4(i),nu.radius+=r,e.ray.intersectsSphere(nu)===!1)return;Sx.copy(i).invert(),ka.copy(e.ray).applyMatrix4(Sx);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=this.isLineSegments?2:1,u=n.index,d=n.attributes.position;if(u!==null){const p=Math.max(0,o.start),f=Math.min(u.count,o.start+o.count);for(let x=p,m=f-1;x<m;x+=l){const g=u.getX(x),y=u.getX(x+1),_=iu(this,e,ka,c,g,y);_&&t.push(_)}if(this.isLineLoop){const x=u.getX(f-1),m=u.getX(p),g=iu(this,e,ka,c,x,m);g&&t.push(g)}}else{const p=Math.max(0,o.start),f=Math.min(d.count,o.start+o.count);for(let x=p,m=f-1;x<m;x+=l){const g=iu(this,e,ka,c,x,x+1);g&&t.push(g)}if(this.isLineLoop){const x=iu(this,e,ka,c,f-1,p);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}function iu(s,e,t,n,i,r){const o=s.geometry.attributes.position;if(lh.fromBufferAttribute(o,i),uh.fromBufferAttribute(o,r),t.distanceSqToSegment(lh,uh,Cp,Tx)>n)return;Cp.applyMatrix4(s.matrixWorld);const c=e.ray.origin.distanceTo(Cp);if(!(c<e.near||c>e.far))return{distance:c,point:Tx.clone().applyMatrix4(s.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:s}}const bx=new E,wx=new E;class rs extends Os{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,r=t.count;i<r;i+=2)bx.fromBufferAttribute(t,i),wx.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+bx.distanceTo(wx);e.setAttribute("lineDistance",new Ve(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class gm extends Os{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class va extends mn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new _e(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Ax=new Fe,pf=new so,su=new Dn,ru=new E;class xm extends yt{constructor(e=new at,t=new va){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),su.copy(n.boundingSphere),su.applyMatrix4(i),su.radius+=r,e.ray.intersectsSphere(su)===!1)return;Ax.copy(i).invert(),pf.copy(e.ray).applyMatrix4(Ax);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=n.index,h=n.attributes.position;if(l!==null){const d=Math.max(0,o.start),p=Math.min(l.count,o.start+o.count);for(let f=d,x=p;f<x;f++){const m=l.getX(f);ru.fromBufferAttribute(h,m),Nx(ru,m,c,i,e,t,this)}}else{const d=Math.max(0,o.start),p=Math.min(h.count,o.start+o.count);for(let f=d,x=p;f<x;f++)ru.fromBufferAttribute(h,f),Nx(ru,f,c,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}function Nx(s,e,t,n,i,r,o){const a=pf.distanceSqToPoint(s);if(a<t){const c=new E;pf.closestPointToPoint(s,c),c.applyMatrix4(n);const l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;r.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class tv extends Xt{constructor(e,t,n,i,r,o,a,c,l){super(e,t,n,i,r,o,a,c,l),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Ut,this.magFilter=r!==void 0?r:Ut,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class _m extends Xt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Qt,this.minFilter=Qt,this.generateMipmaps=!1,this.needsUpdate=!0}}class jc extends Xt{constructor(e,t,n,i,r,o,a,c,l,u,h,d){super(null,o,a,c,l,u,i,r,h,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class nv extends jc{constructor(e,t,n,i,r,o){super(e,t,n,r,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Si,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class iv extends jc{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,wi),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class sv extends Xt{constructor(e,t,n,i,r,o,a,c,l){super(e,t,n,i,r,o,a,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Gi{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let o;t?o=t:o=e*n[r-1];let a=0,c=r-1,l;for(;a<=c;)if(i=Math.floor(a+(c-a)/2),l=n[i]-o,l<0)a=i+1;else if(l>0)c=i-1;else{c=i;break}if(i=c,n[i]===o)return i/(r-1);const u=n[i],d=n[i+1]-u,p=(o-u)/d;return(i+p)/(r-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);const o=this.getPoint(i),a=this.getPoint(r),c=t||(o.isVector2?new J:new E);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new E,i=[],r=[],o=[],a=new E,c=new Fe;for(let p=0;p<=e;p++){const f=p/e;i[p]=this.getTangentAt(f,new E)}r[0]=new E,o[0]=new E;let l=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);u<=l&&(l=u,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),d<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),o[0].crossVectors(i[0],r[0]);for(let p=1;p<=e;p++){if(r[p]=r[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(i[p-1],i[p]),a.length()>Number.EPSILON){a.normalize();const f=Math.acos(jt(i[p-1].dot(i[p]),-1,1));r[p].applyMatrix4(c.makeRotationAxis(a,f))}o[p].crossVectors(i[p],r[p])}if(t===!0){let p=Math.acos(jt(r[0].dot(r[e]),-1,1));p/=e,i[0].dot(a.crossVectors(r[0],r[e]))>0&&(p=-p);for(let f=1;f<=e;f++)r[f].applyMatrix4(c.makeRotationAxis(i[f],p*f)),o[f].crossVectors(i[f],r[f])}return{tangents:i,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class td extends Gi{constructor(e=0,t=0,n=1,i=1,r=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t=new J){const n=t,i=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(o?r=0:r=i),this.aClockwise===!0&&!o&&(r===i?r=-i:r=r-i);const a=this.aStartAngle+e*r;let c=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=c-this.aX,p=l-this.aY;c=d*u-p*h+this.aX,l=d*h+p*u+this.aY}return n.set(c,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class rv extends td{constructor(e,t,n,i,r,o){super(e,t,n,n,i,r,o),this.isArcCurve=!0,this.type="ArcCurve"}}function ym(){let s=0,e=0,t=0,n=0;function i(r,o,a,c){s=r,e=a,t=-3*r+3*o-2*a-c,n=2*r-2*o+a+c}return{initCatmullRom:function(r,o,a,c,l){i(o,a,l*(a-r),l*(c-o))},initNonuniformCatmullRom:function(r,o,a,c,l,u,h){let d=(o-r)/l-(a-r)/(l+u)+(a-o)/u,p=(a-o)/u-(c-o)/(u+h)+(c-a)/h;d*=u,p*=u,i(o,a,d,p)},calc:function(r){const o=r*r,a=o*r;return s+e*r+t*o+n*a}}}const ou=new E,Rp=new ym,Ip=new ym,Pp=new ym;class vm extends Gi{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new E){const n=t,i=this.points,r=i.length,o=(r-(this.closed?0:1))*e;let a=Math.floor(o),c=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/r)+1)*r:c===0&&a===r-1&&(a=r-2,c=1);let l,u;this.closed||a>0?l=i[(a-1)%r]:(ou.subVectors(i[0],i[1]).add(i[0]),l=ou);const h=i[a%r],d=i[(a+1)%r];if(this.closed||a+2<r?u=i[(a+2)%r]:(ou.subVectors(i[r-1],i[r-2]).add(i[r-1]),u=ou),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let f=Math.pow(l.distanceToSquared(h),p),x=Math.pow(h.distanceToSquared(d),p),m=Math.pow(d.distanceToSquared(u),p);x<1e-4&&(x=1),f<1e-4&&(f=x),m<1e-4&&(m=x),Rp.initNonuniformCatmullRom(l.x,h.x,d.x,u.x,f,x,m),Ip.initNonuniformCatmullRom(l.y,h.y,d.y,u.y,f,x,m),Pp.initNonuniformCatmullRom(l.z,h.z,d.z,u.z,f,x,m)}else this.curveType==="catmullrom"&&(Rp.initCatmullRom(l.x,h.x,d.x,u.x,this.tension),Ip.initCatmullRom(l.y,h.y,d.y,u.y,this.tension),Pp.initCatmullRom(l.z,h.z,d.z,u.z,this.tension));return n.set(Rp.calc(c),Ip.calc(c),Pp.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new E().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Ex(s,e,t,n,i){const r=(n-e)*.5,o=(i-t)*.5,a=s*s,c=s*a;return(2*t-2*n+r+o)*c+(-3*t+3*n-2*r-o)*a+r*s+t}function oI(s,e){const t=1-s;return t*t*e}function aI(s,e){return 2*(1-s)*s*e}function cI(s,e){return s*s*e}function Qa(s,e,t,n){return oI(s,e)+aI(s,t)+cI(s,n)}function lI(s,e){const t=1-s;return t*t*t*e}function uI(s,e){const t=1-s;return 3*t*t*s*e}function hI(s,e){return 3*(1-s)*s*s*e}function dI(s,e){return s*s*s*e}function ec(s,e,t,n,i){return lI(s,e)+uI(s,t)+hI(s,n)+dI(s,i)}class Mm extends Gi{constructor(e=new J,t=new J,n=new J,i=new J){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new J){const n=t,i=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(ec(e,i.x,r.x,o.x,a.x),ec(e,i.y,r.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class ov extends Gi{constructor(e=new E,t=new E,n=new E,i=new E){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new E){const n=t,i=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(ec(e,i.x,r.x,o.x,a.x),ec(e,i.y,r.y,o.y,a.y),ec(e,i.z,r.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Sm extends Gi{constructor(e=new J,t=new J){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new J){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new J){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class av extends Gi{constructor(e=new E,t=new E){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new E){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new E){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Tm extends Gi{constructor(e=new J,t=new J,n=new J){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new J){const n=t,i=this.v0,r=this.v1,o=this.v2;return n.set(Qa(e,i.x,r.x,o.x),Qa(e,i.y,r.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class bm extends Gi{constructor(e=new E,t=new E,n=new E){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new E){const n=t,i=this.v0,r=this.v1,o=this.v2;return n.set(Qa(e,i.x,r.x,o.x),Qa(e,i.y,r.y,o.y),Qa(e,i.z,r.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class wm extends Gi{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new J){const n=t,i=this.points,r=(i.length-1)*e,o=Math.floor(r),a=r-o,c=i[o===0?o:o-1],l=i[o],u=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(Ex(a,c.x,l.x,u.x,h.x),Ex(a,c.y,l.y,u.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new J().fromArray(i))}return this}}var hh=Object.freeze({__proto__:null,ArcCurve:rv,CatmullRomCurve3:vm,CubicBezierCurve:Mm,CubicBezierCurve3:ov,EllipseCurve:td,LineCurve:Sm,LineCurve3:av,QuadraticBezierCurve:Tm,QuadraticBezierCurve3:bm,SplineCurve:wm});class cv extends Gi{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new hh[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const o=i[r]-n,a=this.curves[r],c=a.getLength(),l=c===0?0:1-o/c;return a.getPointAt(l,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const o=r[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,c=o.getPoints(a);for(let l=0;l<c.length;l++){const u=c[l];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new hh[i.type]().fromJSON(i))}return this}}class Ic extends cv{constructor(e){super(),this.type="Path",this.currentPoint=new J,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Sm(this.currentPoint.clone(),new J(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new Tm(this.currentPoint.clone(),new J(e,t),new J(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,o){const a=new Mm(this.currentPoint.clone(),new J(e,t),new J(n,i),new J(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new wm(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,o){const a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,n,i,r,o),this}absarc(e,t,n,i,r,o){return this.absellipse(e,t,n,n,i,r,o),this}ellipse(e,t,n,i,r,o,a,c){const l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,n,i,r,o,a,c),this}absellipse(e,t,n,i,r,o,a,c){const l=new td(e,t,n,i,r,o,a,c);if(this.curves.length>0){const h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);const u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Qc extends at{constructor(e=[new J(0,-.5),new J(.5,0),new J(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=jt(i,0,Math.PI*2);const r=[],o=[],a=[],c=[],l=[],u=1/t,h=new E,d=new J,p=new E,f=new E,x=new E;let m=0,g=0;for(let y=0;y<=e.length-1;y++)switch(y){case 0:m=e[y+1].x-e[y].x,g=e[y+1].y-e[y].y,p.x=g*1,p.y=-m,p.z=g*0,x.copy(p),p.normalize(),c.push(p.x,p.y,p.z);break;case e.length-1:c.push(x.x,x.y,x.z);break;default:m=e[y+1].x-e[y].x,g=e[y+1].y-e[y].y,p.x=g*1,p.y=-m,p.z=g*0,f.copy(p),p.x+=x.x,p.y+=x.y,p.z+=x.z,p.normalize(),c.push(p.x,p.y,p.z),x.copy(f)}for(let y=0;y<=t;y++){const _=n+y*u*i,v=Math.sin(_),I=Math.cos(_);for(let T=0;T<=e.length-1;T++){h.x=e[T].x*v,h.y=e[T].y,h.z=e[T].x*I,o.push(h.x,h.y,h.z),d.x=y/t,d.y=T/(e.length-1),a.push(d.x,d.y);const w=c[3*T+0]*v,C=c[3*T+1],F=c[3*T+0]*I;l.push(w,C,F)}}for(let y=0;y<t;y++)for(let _=0;_<e.length-1;_++){const v=_+y*e.length,I=v,T=v+e.length,w=v+e.length+1,C=v+1;r.push(I,T,C),r.push(w,C,T)}this.setIndex(r),this.setAttribute("position",new Ve(o,3)),this.setAttribute("uv",new Ve(a,2)),this.setAttribute("normal",new Ve(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Qc(e.points,e.segments,e.phiStart,e.phiLength)}}class nd extends Qc{constructor(e=1,t=1,n=4,i=8){const r=new Ic;r.absarc(0,-t/2,e,Math.PI*1.5,0),r.absarc(0,t/2,e,0,Math.PI*.5),super(r.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new nd(e.radius,e.length,e.capSegments,e.radialSegments)}}class id extends at{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const r=[],o=[],a=[],c=[],l=new E,u=new J;o.push(0,0,0),a.push(0,0,1),c.push(.5,.5);for(let h=0,d=3;h<=t;h++,d+=3){const p=n+h/t*i;l.x=e*Math.cos(p),l.y=e*Math.sin(p),o.push(l.x,l.y,l.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+1]/e+1)/2,c.push(u.x,u.y)}for(let h=1;h<=t;h++)r.push(h,h+1,0);this.setIndex(r),this.setAttribute("position",new Ve(o,3)),this.setAttribute("normal",new Ve(a,3)),this.setAttribute("uv",new Ve(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new id(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class lo extends at{constructor(e=1,t=1,n=1,i=32,r=1,o=!1,a=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:c};const l=this;i=Math.floor(i),r=Math.floor(r);const u=[],h=[],d=[],p=[];let f=0;const x=[],m=n/2;let g=0;y(),o===!1&&(e>0&&_(!0),t>0&&_(!1)),this.setIndex(u),this.setAttribute("position",new Ve(h,3)),this.setAttribute("normal",new Ve(d,3)),this.setAttribute("uv",new Ve(p,2));function y(){const v=new E,I=new E;let T=0;const w=(t-e)/n;for(let C=0;C<=r;C++){const F=[],M=C/r,b=M*(t-e)+e;for(let G=0;G<=i;G++){const W=G/i,$=W*c+a,ie=Math.sin($),q=Math.cos($);I.x=b*ie,I.y=-M*n+m,I.z=b*q,h.push(I.x,I.y,I.z),v.set(ie,w,q).normalize(),d.push(v.x,v.y,v.z),p.push(W,1-M),F.push(f++)}x.push(F)}for(let C=0;C<i;C++)for(let F=0;F<r;F++){const M=x[F][C],b=x[F+1][C],G=x[F+1][C+1],W=x[F][C+1];e>0&&(u.push(M,b,W),T+=3),t>0&&(u.push(b,G,W),T+=3)}l.addGroup(g,T,0),g+=T}function _(v){const I=f,T=new J,w=new E;let C=0;const F=v===!0?e:t,M=v===!0?1:-1;for(let G=1;G<=i;G++)h.push(0,m*M,0),d.push(0,M,0),p.push(.5,.5),f++;const b=f;for(let G=0;G<=i;G++){const $=G/i*c+a,ie=Math.cos($),q=Math.sin($);w.x=F*q,w.y=m*M,w.z=F*ie,h.push(w.x,w.y,w.z),d.push(0,M,0),T.x=ie*.5+.5,T.y=q*.5*M+.5,p.push(T.x,T.y),f++}for(let G=0;G<i;G++){const W=I+G,$=b+G;v===!0?u.push($,$+1,W):u.push($+1,$,W),C+=3}l.addGroup(g,C,v===!0?1:2),g+=C}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new lo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class sd extends lo{constructor(e=1,t=1,n=32,i=1,r=!1,o=0,a=Math.PI*2){super(0,e,t,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}static fromJSON(e){return new sd(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class pr extends at{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],o=[];a(i),l(n),u(),this.setAttribute("position",new Ve(r,3)),this.setAttribute("normal",new Ve(r.slice(),3)),this.setAttribute("uv",new Ve(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(y){const _=new E,v=new E,I=new E;for(let T=0;T<t.length;T+=3)p(t[T+0],_),p(t[T+1],v),p(t[T+2],I),c(_,v,I,y)}function c(y,_,v,I){const T=I+1,w=[];for(let C=0;C<=T;C++){w[C]=[];const F=y.clone().lerp(v,C/T),M=_.clone().lerp(v,C/T),b=T-C;for(let G=0;G<=b;G++)G===0&&C===T?w[C][G]=F:w[C][G]=F.clone().lerp(M,G/b)}for(let C=0;C<T;C++)for(let F=0;F<2*(T-C)-1;F++){const M=Math.floor(F/2);F%2===0?(d(w[C][M+1]),d(w[C+1][M]),d(w[C][M])):(d(w[C][M+1]),d(w[C+1][M+1]),d(w[C+1][M]))}}function l(y){const _=new E;for(let v=0;v<r.length;v+=3)_.x=r[v+0],_.y=r[v+1],_.z=r[v+2],_.normalize().multiplyScalar(y),r[v+0]=_.x,r[v+1]=_.y,r[v+2]=_.z}function u(){const y=new E;for(let _=0;_<r.length;_+=3){y.x=r[_+0],y.y=r[_+1],y.z=r[_+2];const v=m(y)/2/Math.PI+.5,I=g(y)/Math.PI+.5;o.push(v,1-I)}f(),h()}function h(){for(let y=0;y<o.length;y+=6){const _=o[y+0],v=o[y+2],I=o[y+4],T=Math.max(_,v,I),w=Math.min(_,v,I);T>.9&&w<.1&&(_<.2&&(o[y+0]+=1),v<.2&&(o[y+2]+=1),I<.2&&(o[y+4]+=1))}}function d(y){r.push(y.x,y.y,y.z)}function p(y,_){const v=y*3;_.x=e[v+0],_.y=e[v+1],_.z=e[v+2]}function f(){const y=new E,_=new E,v=new E,I=new E,T=new J,w=new J,C=new J;for(let F=0,M=0;F<r.length;F+=9,M+=6){y.set(r[F+0],r[F+1],r[F+2]),_.set(r[F+3],r[F+4],r[F+5]),v.set(r[F+6],r[F+7],r[F+8]),T.set(o[M+0],o[M+1]),w.set(o[M+2],o[M+3]),C.set(o[M+4],o[M+5]),I.copy(y).add(_).add(v).divideScalar(3);const b=m(I);x(T,M+0,y,b),x(w,M+2,_,b),x(C,M+4,v,b)}}function x(y,_,v,I){I<0&&y.x===1&&(o[_]=y.x-1),v.x===0&&v.z===0&&(o[_]=I/2/Math.PI+.5)}function m(y){return Math.atan2(y.z,-y.x)}function g(y){return Math.atan2(-y.y,Math.sqrt(y.x*y.x+y.z*y.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new pr(e.vertices,e.indices,e.radius,e.details)}}class rd extends pr{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(r,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new rd(e.radius,e.detail)}}const au=new E,cu=new E,Lp=new E,lu=new Jn;class Am extends at{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),r=Math.cos(Yr*t),o=e.getIndex(),a=e.getAttribute("position"),c=o?o.count:a.count,l=[0,0,0],u=["a","b","c"],h=new Array(3),d={},p=[];for(let f=0;f<c;f+=3){o?(l[0]=o.getX(f),l[1]=o.getX(f+1),l[2]=o.getX(f+2)):(l[0]=f,l[1]=f+1,l[2]=f+2);const{a:x,b:m,c:g}=lu;if(x.fromBufferAttribute(a,l[0]),m.fromBufferAttribute(a,l[1]),g.fromBufferAttribute(a,l[2]),lu.getNormal(Lp),h[0]=`${Math.round(x.x*i)},${Math.round(x.y*i)},${Math.round(x.z*i)}`,h[1]=`${Math.round(m.x*i)},${Math.round(m.y*i)},${Math.round(m.z*i)}`,h[2]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let y=0;y<3;y++){const _=(y+1)%3,v=h[y],I=h[_],T=lu[u[y]],w=lu[u[_]],C=`${v}_${I}`,F=`${I}_${v}`;F in d&&d[F]?(Lp.dot(d[F].normal)<=r&&(p.push(T.x,T.y,T.z),p.push(w.x,w.y,w.z)),d[F]=null):C in d||(d[C]={index0:l[y],index1:l[_],normal:Lp.clone()})}}for(const f in d)if(d[f]){const{index0:x,index1:m}=d[f];au.fromBufferAttribute(a,x),cu.fromBufferAttribute(a,m),p.push(au.x,au.y,au.z),p.push(cu.x,cu.y,cu.z)}this.setAttribute("position",new Ve(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class tr extends Ic{constructor(e){super(e),this.uuid=bi(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new Ic().fromJSON(i))}return this}}const pI={triangulate:function(s,e,t=2){const n=e&&e.length,i=n?e[0]*t:s.length;let r=lv(s,0,i,t,!0);const o=[];if(!r||r.next===r.prev)return o;let a,c,l,u,h,d,p;if(n&&(r=_I(s,e,r,t)),s.length>80*t){a=l=s[0],c=u=s[1];for(let f=t;f<i;f+=t)h=s[f],d=s[f+1],h<a&&(a=h),d<c&&(c=d),h>l&&(l=h),d>u&&(u=d);p=Math.max(l-a,u-c),p=p!==0?32767/p:0}return Pc(r,o,t,a,c,p,0),o}};function lv(s,e,t,n,i){let r,o;if(i===CI(s,e,t,n)>0)for(r=e;r<t;r+=n)o=Cx(r,s[r],s[r+1],o);else for(r=t-n;r>=e;r-=n)o=Cx(r,s[r],s[r+1],o);return o&&od(o,o.next)&&(Dc(o),o=o.next),o}function to(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(od(t,t.next)||Zt(t.prev,t,t.next)===0)){if(Dc(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Pc(s,e,t,n,i,r,o){if(!s)return;!o&&r&&TI(s,n,i,r);let a=s,c,l;for(;s.prev!==s.next;){if(c=s.prev,l=s.next,r?mI(s,n,i,r):fI(s)){e.push(c.i/t|0),e.push(s.i/t|0),e.push(l.i/t|0),Dc(s),s=l.next,a=l.next;continue}if(s=l,s===a){o?o===1?(s=gI(to(s),e,t),Pc(s,e,t,n,i,r,2)):o===2&&xI(s,e,t,n,i,r):Pc(to(s),e,t,n,i,r,1);break}}}function fI(s){const e=s.prev,t=s,n=s.next;if(Zt(e,t,n)>=0)return!1;const i=e.x,r=t.x,o=n.x,a=e.y,c=t.y,l=n.y,u=i<r?i<o?i:o:r<o?r:o,h=a<c?a<l?a:l:c<l?c:l,d=i>r?i>o?i:o:r>o?r:o,p=a>c?a>l?a:l:c>l?c:l;let f=n.next;for(;f!==e;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&Wo(i,a,r,c,o,l,f.x,f.y)&&Zt(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function mI(s,e,t,n){const i=s.prev,r=s,o=s.next;if(Zt(i,r,o)>=0)return!1;const a=i.x,c=r.x,l=o.x,u=i.y,h=r.y,d=o.y,p=a<c?a<l?a:l:c<l?c:l,f=u<h?u<d?u:d:h<d?h:d,x=a>c?a>l?a:l:c>l?c:l,m=u>h?u>d?u:d:h>d?h:d,g=ff(p,f,e,t,n),y=ff(x,m,e,t,n);let _=s.prevZ,v=s.nextZ;for(;_&&_.z>=g&&v&&v.z<=y;){if(_.x>=p&&_.x<=x&&_.y>=f&&_.y<=m&&_!==i&&_!==o&&Wo(a,u,c,h,l,d,_.x,_.y)&&Zt(_.prev,_,_.next)>=0||(_=_.prevZ,v.x>=p&&v.x<=x&&v.y>=f&&v.y<=m&&v!==i&&v!==o&&Wo(a,u,c,h,l,d,v.x,v.y)&&Zt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;_&&_.z>=g;){if(_.x>=p&&_.x<=x&&_.y>=f&&_.y<=m&&_!==i&&_!==o&&Wo(a,u,c,h,l,d,_.x,_.y)&&Zt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=x&&v.y>=f&&v.y<=m&&v!==i&&v!==o&&Wo(a,u,c,h,l,d,v.x,v.y)&&Zt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function gI(s,e,t){let n=s;do{const i=n.prev,r=n.next.next;!od(i,r)&&uv(i,n,n.next,r)&&Lc(i,r)&&Lc(r,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(r.i/t|0),Dc(n),Dc(n.next),n=s=r),n=n.next}while(n!==s);return to(n)}function xI(s,e,t,n,i,r){let o=s;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&AI(o,a)){let c=hv(o,a);o=to(o,o.next),c=to(c,c.next),Pc(o,e,t,n,i,r,0),Pc(c,e,t,n,i,r,0);return}a=a.next}o=o.next}while(o!==s)}function _I(s,e,t,n){const i=[];let r,o,a,c,l;for(r=0,o=e.length;r<o;r++)a=e[r]*n,c=r<o-1?e[r+1]*n:s.length,l=lv(s,a,c,n,!1),l===l.next&&(l.steiner=!0),i.push(wI(l));for(i.sort(yI),r=0;r<i.length;r++)t=vI(i[r],t);return t}function yI(s,e){return s.x-e.x}function vI(s,e){const t=MI(s,e);if(!t)return e;const n=hv(t,s);return to(n,n.next),to(t,t.next)}function MI(s,e){let t=e,n=-1/0,i;const r=s.x,o=s.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){const d=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=r&&d>n&&(n=d,i=t.x<t.next.x?t:t.next,d===r))return i}t=t.next}while(t!==e);if(!i)return null;const a=i,c=i.x,l=i.y;let u=1/0,h;t=i;do r>=t.x&&t.x>=c&&r!==t.x&&Wo(o<l?r:n,o,c,l,o<l?n:r,o,t.x,t.y)&&(h=Math.abs(o-t.y)/(r-t.x),Lc(t,s)&&(h<u||h===u&&(t.x>i.x||t.x===i.x&&SI(i,t)))&&(i=t,u=h)),t=t.next;while(t!==a);return i}function SI(s,e){return Zt(s.prev,s,e.prev)<0&&Zt(e.next,s,s.next)<0}function TI(s,e,t,n){let i=s;do i.z===0&&(i.z=ff(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,bI(i)}function bI(s){let e,t,n,i,r,o,a,c,l=1;do{for(t=s,s=null,r=null,o=0;t;){for(o++,n=t,a=0,e=0;e<l&&(a++,n=n.nextZ,!!n);e++);for(c=l;a>0||c>0&&n;)a!==0&&(c===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,c--),r?r.nextZ=i:s=i,i.prevZ=r,r=i;t=n}r.nextZ=null,l*=2}while(o>1);return s}function ff(s,e,t,n,i){return s=(s-t)*i|0,e=(e-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function wI(s){let e=s,t=s;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==s);return t}function Wo(s,e,t,n,i,r,o,a){return(i-o)*(e-a)>=(s-o)*(r-a)&&(s-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(r-a)>=(i-o)*(n-a)}function AI(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!NI(s,e)&&(Lc(s,e)&&Lc(e,s)&&EI(s,e)&&(Zt(s.prev,s,e.prev)||Zt(s,e.prev,e))||od(s,e)&&Zt(s.prev,s,s.next)>0&&Zt(e.prev,e,e.next)>0)}function Zt(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function od(s,e){return s.x===e.x&&s.y===e.y}function uv(s,e,t,n){const i=hu(Zt(s,e,t)),r=hu(Zt(s,e,n)),o=hu(Zt(t,n,s)),a=hu(Zt(t,n,e));return!!(i!==r&&o!==a||i===0&&uu(s,t,e)||r===0&&uu(s,n,e)||o===0&&uu(t,s,n)||a===0&&uu(t,e,n))}function uu(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function hu(s){return s>0?1:s<0?-1:0}function NI(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&uv(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function Lc(s,e){return Zt(s.prev,s,s.next)<0?Zt(s,e,s.next)>=0&&Zt(s,s.prev,e)>=0:Zt(s,e,s.prev)<0||Zt(s,s.next,e)<0}function EI(s,e){let t=s,n=!1;const i=(s.x+e.x)/2,r=(s.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&i<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function hv(s,e){const t=new mf(s.i,s.x,s.y),n=new mf(e.i,e.x,e.y),i=s.next,r=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function Cx(s,e,t,n){const i=new mf(s,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Dc(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function mf(s,e,t){this.i=s,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function CI(s,e,t,n){let i=0;for(let r=e,o=t-n;r<t;r+=n)i+=(s[o]-s[r])*(s[r+1]+s[o+1]),o=r;return i}class ji{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return n*.5}static isClockWise(e){return ji.area(e)<0}static triangulateShape(e,t){const n=[],i=[],r=[];Rx(e),Ix(n,e);let o=e.length;t.forEach(Rx);for(let c=0;c<t.length;c++)i.push(o),o+=t[c].length,Ix(n,t[c]);const a=pI.triangulate(n,i);for(let c=0;c<a.length;c+=3)r.push(a.slice(c,c+3));return r}}function Rx(s){const e=s.length;e>2&&s[e-1].equals(s[0])&&s.pop()}function Ix(s,e){for(let t=0;t<e.length;t++)s.push(e[t].x),s.push(e[t].y)}class el extends at{constructor(e=new tr([new J(.5,.5),new J(-.5,.5),new J(-.5,-.5),new J(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let a=0,c=e.length;a<c;a++){const l=e[a];o(l)}this.setAttribute("position",new Ve(i,3)),this.setAttribute("uv",new Ve(r,2)),this.computeVertexNormals();function o(a){const c=[],l=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1;let d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,p=t.bevelThickness!==void 0?t.bevelThickness:.2,f=t.bevelSize!==void 0?t.bevelSize:p-.1,x=t.bevelOffset!==void 0?t.bevelOffset:0,m=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,y=t.UVGenerator!==void 0?t.UVGenerator:RI;let _,v=!1,I,T,w,C;g&&(_=g.getSpacedPoints(u),v=!0,d=!1,I=g.computeFrenetFrames(u,!1),T=new E,w=new E,C=new E),d||(m=0,p=0,f=0,x=0);const F=a.extractPoints(l);let M=F.shape;const b=F.holes;if(!ji.isClockWise(M)){M=M.reverse();for(let ae=0,P=b.length;ae<P;ae++){const Me=b[ae];ji.isClockWise(Me)&&(b[ae]=Me.reverse())}}const W=ji.triangulateShape(M,b),$=M;for(let ae=0,P=b.length;ae<P;ae++){const Me=b[ae];M=M.concat(Me)}function ie(ae,P,Me){return P||console.error("THREE.ExtrudeGeometry: vec does not exist"),ae.clone().addScaledVector(P,Me)}const q=M.length,he=W.length;function Q(ae,P,Me){let ye,de,Te;const qe=ae.x-P.x,Ie=ae.y-P.y,R=Me.x-ae.x,S=Me.y-ae.y,X=qe*qe+Ie*Ie,re=qe*S-Ie*R;if(Math.abs(re)>Number.EPSILON){const ce=Math.sqrt(X),se=Math.sqrt(R*R+S*S),ke=P.x-Ie/ce,be=P.y+qe/ce,De=Me.x-S/se,vt=Me.y+R/se,me=((De-ke)*S-(vt-be)*R)/(qe*S-Ie*R);ye=ke+qe*me-ae.x,de=be+Ie*me-ae.y;const Ue=ye*ye+de*de;if(Ue<=2)return new J(ye,de);Te=Math.sqrt(Ue/2)}else{let ce=!1;qe>Number.EPSILON?R>Number.EPSILON&&(ce=!0):qe<-Number.EPSILON?R<-Number.EPSILON&&(ce=!0):Math.sign(Ie)===Math.sign(S)&&(ce=!0),ce?(ye=-Ie,de=qe,Te=Math.sqrt(X)):(ye=qe,de=Ie,Te=Math.sqrt(X/2))}return new J(ye/Te,de/Te)}const we=[];for(let ae=0,P=$.length,Me=P-1,ye=ae+1;ae<P;ae++,Me++,ye++)Me===P&&(Me=0),ye===P&&(ye=0),we[ae]=Q($[ae],$[Me],$[ye]);const Ne=[];let Ee,Qe=we.concat();for(let ae=0,P=b.length;ae<P;ae++){const Me=b[ae];Ee=[];for(let ye=0,de=Me.length,Te=de-1,qe=ye+1;ye<de;ye++,Te++,qe++)Te===de&&(Te=0),qe===de&&(qe=0),Ee[ye]=Q(Me[ye],Me[Te],Me[qe]);Ne.push(Ee),Qe=Qe.concat(Ee)}for(let ae=0;ae<m;ae++){const P=ae/m,Me=p*Math.cos(P*Math.PI/2),ye=f*Math.sin(P*Math.PI/2)+x;for(let de=0,Te=$.length;de<Te;de++){const qe=ie($[de],we[de],ye);ge(qe.x,qe.y,-Me)}for(let de=0,Te=b.length;de<Te;de++){const qe=b[de];Ee=Ne[de];for(let Ie=0,R=qe.length;Ie<R;Ie++){const S=ie(qe[Ie],Ee[Ie],ye);ge(S.x,S.y,-Me)}}}const ht=f+x;for(let ae=0;ae<q;ae++){const P=d?ie(M[ae],Qe[ae],ht):M[ae];v?(w.copy(I.normals[0]).multiplyScalar(P.x),T.copy(I.binormals[0]).multiplyScalar(P.y),C.copy(_[0]).add(w).add(T),ge(C.x,C.y,C.z)):ge(P.x,P.y,0)}for(let ae=1;ae<=u;ae++)for(let P=0;P<q;P++){const Me=d?ie(M[P],Qe[P],ht):M[P];v?(w.copy(I.normals[ae]).multiplyScalar(Me.x),T.copy(I.binormals[ae]).multiplyScalar(Me.y),C.copy(_[ae]).add(w).add(T),ge(C.x,C.y,C.z)):ge(Me.x,Me.y,h/u*ae)}for(let ae=m-1;ae>=0;ae--){const P=ae/m,Me=p*Math.cos(P*Math.PI/2),ye=f*Math.sin(P*Math.PI/2)+x;for(let de=0,Te=$.length;de<Te;de++){const qe=ie($[de],we[de],ye);ge(qe.x,qe.y,h+Me)}for(let de=0,Te=b.length;de<Te;de++){const qe=b[de];Ee=Ne[de];for(let Ie=0,R=qe.length;Ie<R;Ie++){const S=ie(qe[Ie],Ee[Ie],ye);v?ge(S.x,S.y+_[u-1].y,_[u-1].x+Me):ge(S.x,S.y,h+Me)}}}ne(),ue();function ne(){const ae=i.length/3;if(d){let P=0,Me=q*P;for(let ye=0;ye<he;ye++){const de=W[ye];Ze(de[2]+Me,de[1]+Me,de[0]+Me)}P=u+m*2,Me=q*P;for(let ye=0;ye<he;ye++){const de=W[ye];Ze(de[0]+Me,de[1]+Me,de[2]+Me)}}else{for(let P=0;P<he;P++){const Me=W[P];Ze(Me[2],Me[1],Me[0])}for(let P=0;P<he;P++){const Me=W[P];Ze(Me[0]+q*u,Me[1]+q*u,Me[2]+q*u)}}n.addGroup(ae,i.length/3-ae,0)}function ue(){const ae=i.length/3;let P=0;Ae($,P),P+=$.length;for(let Me=0,ye=b.length;Me<ye;Me++){const de=b[Me];Ae(de,P),P+=de.length}n.addGroup(ae,i.length/3-ae,1)}function Ae(ae,P){let Me=ae.length;for(;--Me>=0;){const ye=Me;let de=Me-1;de<0&&(de=ae.length-1);for(let Te=0,qe=u+m*2;Te<qe;Te++){const Ie=q*Te,R=q*(Te+1),S=P+ye+Ie,X=P+de+Ie,re=P+de+R,ce=P+ye+R;Xe(S,X,re,ce)}}}function ge(ae,P,Me){c.push(ae),c.push(P),c.push(Me)}function Ze(ae,P,Me){Je(ae),Je(P),Je(Me);const ye=i.length/3,de=y.generateTopUV(n,i,ye-3,ye-2,ye-1);dt(de[0]),dt(de[1]),dt(de[2])}function Xe(ae,P,Me,ye){Je(ae),Je(P),Je(ye),Je(P),Je(Me),Je(ye);const de=i.length/3,Te=y.generateSideWallUV(n,i,de-6,de-3,de-2,de-1);dt(Te[0]),dt(Te[1]),dt(Te[3]),dt(Te[1]),dt(Te[2]),dt(Te[3])}function Je(ae){i.push(c[ae*3+0]),i.push(c[ae*3+1]),i.push(c[ae*3+2])}function dt(ae){r.push(ae.x),r.push(ae.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return II(t,n,e)}static fromJSON(e,t){const n=[];for(let r=0,o=e.shapes.length;r<o;r++){const a=t[e.shapes[r]];n.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new hh[i.type]().fromJSON(i)),new el(n,e.options)}}const RI={generateTopUV:function(s,e,t,n,i){const r=e[t*3],o=e[t*3+1],a=e[n*3],c=e[n*3+1],l=e[i*3],u=e[i*3+1];return[new J(r,o),new J(a,c),new J(l,u)]},generateSideWallUV:function(s,e,t,n,i,r){const o=e[t*3],a=e[t*3+1],c=e[t*3+2],l=e[n*3],u=e[n*3+1],h=e[n*3+2],d=e[i*3],p=e[i*3+1],f=e[i*3+2],x=e[r*3],m=e[r*3+1],g=e[r*3+2];return Math.abs(a-u)<Math.abs(o-l)?[new J(o,1-c),new J(l,1-h),new J(d,1-f),new J(x,1-g)]:[new J(a,1-c),new J(u,1-h),new J(p,1-f),new J(m,1-g)]}};function II(s,e,t){if(t.shapes=[],Array.isArray(s))for(let n=0,i=s.length;n<i;n++){const r=s[n];t.shapes.push(r.uuid)}else t.shapes.push(s.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class ad extends pr{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,r,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ad(e.radius,e.detail)}}class Ma extends pr{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ma(e.radius,e.detail)}}class tl extends at{constructor(e=.5,t=1,n=32,i=1,r=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const a=[],c=[],l=[],u=[];let h=e;const d=(t-e)/i,p=new E,f=new J;for(let x=0;x<=i;x++){for(let m=0;m<=n;m++){const g=r+m/n*o;p.x=h*Math.cos(g),p.y=h*Math.sin(g),c.push(p.x,p.y,p.z),l.push(0,0,1),f.x=(p.x/t+1)/2,f.y=(p.y/t+1)/2,u.push(f.x,f.y)}h+=d}for(let x=0;x<i;x++){const m=x*(n+1);for(let g=0;g<n;g++){const y=g+m,_=y,v=y+n+1,I=y+n+2,T=y+1;a.push(_,v,T),a.push(v,I,T)}}this.setIndex(a),this.setAttribute("position",new Ve(c,3)),this.setAttribute("normal",new Ve(l,3)),this.setAttribute("uv",new Ve(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tl(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class cd extends at{constructor(e=new tr([new J(0,.5),new J(-.5,-.5),new J(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],o=[];let a=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let u=0;u<e.length;u++)l(e[u]),this.addGroup(a,c,u),a+=c,c=0;this.setIndex(n),this.setAttribute("position",new Ve(i,3)),this.setAttribute("normal",new Ve(r,3)),this.setAttribute("uv",new Ve(o,2));function l(u){const h=i.length/3,d=u.extractPoints(t);let p=d.shape;const f=d.holes;ji.isClockWise(p)===!1&&(p=p.reverse());for(let m=0,g=f.length;m<g;m++){const y=f[m];ji.isClockWise(y)===!0&&(f[m]=y.reverse())}const x=ji.triangulateShape(p,f);for(let m=0,g=f.length;m<g;m++){const y=f[m];p=p.concat(y)}for(let m=0,g=p.length;m<g;m++){const y=p[m];i.push(y.x,y.y,0),r.push(0,0,1),o.push(y.x,y.y)}for(let m=0,g=x.length;m<g;m++){const y=x[m],_=y[0]+h,v=y[1]+h,I=y[2]+h;n.push(_,v,I),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return PI(t,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const o=t[e.shapes[i]];n.push(o)}return new cd(n,e.curveSegments)}}function PI(s,e){if(e.shapes=[],Array.isArray(s))for(let t=0,n=s.length;t<n;t++){const i=s[t];e.shapes.push(i.uuid)}else e.shapes.push(s.uuid);return e}class Sa extends at{constructor(e=1,t=32,n=16,i=0,r=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const c=Math.min(o+a,Math.PI);let l=0;const u=[],h=new E,d=new E,p=[],f=[],x=[],m=[];for(let g=0;g<=n;g++){const y=[],_=g/n;let v=0;g===0&&o===0?v=.5/t:g===n&&c===Math.PI&&(v=-.5/t);for(let I=0;I<=t;I++){const T=I/t;h.x=-e*Math.cos(i+T*r)*Math.sin(o+_*a),h.y=e*Math.cos(o+_*a),h.z=e*Math.sin(i+T*r)*Math.sin(o+_*a),f.push(h.x,h.y,h.z),d.copy(h).normalize(),x.push(d.x,d.y,d.z),m.push(T+v,1-_),y.push(l++)}u.push(y)}for(let g=0;g<n;g++)for(let y=0;y<t;y++){const _=u[g][y+1],v=u[g][y],I=u[g+1][y],T=u[g+1][y+1];(g!==0||o>0)&&p.push(_,v,T),(g!==n-1||c<Math.PI)&&p.push(v,I,T)}this.setIndex(p),this.setAttribute("position",new Ve(f,3)),this.setAttribute("normal",new Ve(x,3)),this.setAttribute("uv",new Ve(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sa(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class ld extends pr{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ld(e.radius,e.detail)}}class nl extends at{constructor(e=1,t=.4,n=12,i=48,r=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],c=[],l=[],u=new E,h=new E,d=new E;for(let p=0;p<=n;p++)for(let f=0;f<=i;f++){const x=f/i*r,m=p/n*Math.PI*2;h.x=(e+t*Math.cos(m))*Math.cos(x),h.y=(e+t*Math.cos(m))*Math.sin(x),h.z=t*Math.sin(m),a.push(h.x,h.y,h.z),u.x=e*Math.cos(x),u.y=e*Math.sin(x),d.subVectors(h,u).normalize(),c.push(d.x,d.y,d.z),l.push(f/i),l.push(p/n)}for(let p=1;p<=n;p++)for(let f=1;f<=i;f++){const x=(i+1)*p+f-1,m=(i+1)*(p-1)+f-1,g=(i+1)*(p-1)+f,y=(i+1)*p+f;o.push(x,m,y),o.push(m,g,y)}this.setIndex(o),this.setAttribute("position",new Ve(a,3)),this.setAttribute("normal",new Ve(c,3)),this.setAttribute("uv",new Ve(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nl(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class ud extends at{constructor(e=1,t=.4,n=64,i=8,r=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:o},n=Math.floor(n),i=Math.floor(i);const a=[],c=[],l=[],u=[],h=new E,d=new E,p=new E,f=new E,x=new E,m=new E,g=new E;for(let _=0;_<=n;++_){const v=_/n*r*Math.PI*2;y(v,r,o,e,p),y(v+.01,r,o,e,f),m.subVectors(f,p),g.addVectors(f,p),x.crossVectors(m,g),g.crossVectors(x,m),x.normalize(),g.normalize();for(let I=0;I<=i;++I){const T=I/i*Math.PI*2,w=-t*Math.cos(T),C=t*Math.sin(T);h.x=p.x+(w*g.x+C*x.x),h.y=p.y+(w*g.y+C*x.y),h.z=p.z+(w*g.z+C*x.z),c.push(h.x,h.y,h.z),d.subVectors(h,p).normalize(),l.push(d.x,d.y,d.z),u.push(_/n),u.push(I/i)}}for(let _=1;_<=n;_++)for(let v=1;v<=i;v++){const I=(i+1)*(_-1)+(v-1),T=(i+1)*_+(v-1),w=(i+1)*_+v,C=(i+1)*(_-1)+v;a.push(I,T,C),a.push(T,w,C)}this.setIndex(a),this.setAttribute("position",new Ve(c,3)),this.setAttribute("normal",new Ve(l,3)),this.setAttribute("uv",new Ve(u,2));function y(_,v,I,T,w){const C=Math.cos(_),F=Math.sin(_),M=I/v*_,b=Math.cos(M);w.x=T*(2+b)*.5*C,w.y=T*(2+b)*F*.5,w.z=T*Math.sin(M)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ud(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class hd extends at{constructor(e=new bm(new E(-1,-1,0),new E(-1,1,0),new E(1,1,0)),t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const o=e.computeFrenetFrames(t,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new E,c=new E,l=new J;let u=new E;const h=[],d=[],p=[],f=[];x(),this.setIndex(f),this.setAttribute("position",new Ve(h,3)),this.setAttribute("normal",new Ve(d,3)),this.setAttribute("uv",new Ve(p,2));function x(){for(let _=0;_<t;_++)m(_);m(r===!1?t:0),y(),g()}function m(_){u=e.getPointAt(_/t,u);const v=o.normals[_],I=o.binormals[_];for(let T=0;T<=i;T++){const w=T/i*Math.PI*2,C=Math.sin(w),F=-Math.cos(w);c.x=F*v.x+C*I.x,c.y=F*v.y+C*I.y,c.z=F*v.z+C*I.z,c.normalize(),d.push(c.x,c.y,c.z),a.x=u.x+n*c.x,a.y=u.y+n*c.y,a.z=u.z+n*c.z,h.push(a.x,a.y,a.z)}}function g(){for(let _=1;_<=t;_++)for(let v=1;v<=i;v++){const I=(i+1)*(_-1)+(v-1),T=(i+1)*_+(v-1),w=(i+1)*_+v,C=(i+1)*(_-1)+v;f.push(I,T,C),f.push(T,w,C)}}function y(){for(let _=0;_<=t;_++)for(let v=0;v<=i;v++)l.x=_/t,l.y=v/i,p.push(l.x,l.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new hd(new hh[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Nm extends at{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new E,r=new E;if(e.index!==null){const o=e.attributes.position,a=e.index;let c=e.groups;c.length===0&&(c=[{start:0,count:a.count,materialIndex:0}]);for(let l=0,u=c.length;l<u;++l){const h=c[l],d=h.start,p=h.count;for(let f=d,x=d+p;f<x;f+=3)for(let m=0;m<3;m++){const g=a.getX(f+m),y=a.getX(f+(m+1)%3);i.fromBufferAttribute(o,g),r.fromBufferAttribute(o,y),Px(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}}else{const o=e.attributes.position;for(let a=0,c=o.count/3;a<c;a++)for(let l=0;l<3;l++){const u=3*a+l,h=3*a+(l+1)%3;i.fromBufferAttribute(o,u),r.fromBufferAttribute(o,h),Px(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new Ve(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Px(s,e,t){const n=`${s.x},${s.y},${s.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${s.x},${s.y},${s.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var Lx=Object.freeze({__proto__:null,BoxGeometry:vs,CapsuleGeometry:nd,CircleGeometry:id,ConeGeometry:sd,CylinderGeometry:lo,DodecahedronGeometry:rd,EdgesGeometry:Am,ExtrudeGeometry:el,IcosahedronGeometry:ad,LatheGeometry:Qc,OctahedronGeometry:Ma,PlaneGeometry:oo,PolyhedronGeometry:pr,RingGeometry:tl,ShapeGeometry:cd,SphereGeometry:Sa,TetrahedronGeometry:ld,TorusGeometry:nl,TorusKnotGeometry:ud,TubeGeometry:hd,WireframeGeometry:Nm});class dd extends mn{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new _e(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class Em extends ki{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class il extends mn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new _e(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xs,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ui,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class pd extends il{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new J(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return jt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new _e(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new _e(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new _e(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class fd extends mn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new _e(16777215),this.specular=new _e(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xs,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ui,this.combine=ma,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Cm extends mn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new _e(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xs,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class md extends mn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xs,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class gd extends mn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new _e(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xs,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ui,this.combine=ma,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Rm extends mn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new _e(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xs,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class xd extends Fn{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Xr(s,e,t){return!s||!t&&s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function dv(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function pv(s){function e(i,r){return s[i]-s[r]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function gf(s,e,t){const n=s.length,i=new s.constructor(n);for(let r=0,o=0;o!==n;++r){const a=t[r]*e;for(let c=0;c!==e;++c)i[o++]=s[a+c]}return i}function Im(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let o=r[n];if(o!==void 0)if(Array.isArray(o))do o=r[n],o!==void 0&&(e.push(r.time),t.push.apply(t,o)),r=s[i++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[n],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do o=r[n],o!==void 0&&(e.push(r.time),t.push(o)),r=s[i++];while(r!==void 0)}function LI(s,e,t,n,i=30){const r=s.clone();r.name=e;const o=[];for(let c=0;c<r.tracks.length;++c){const l=r.tracks[c],u=l.getValueSize(),h=[],d=[];for(let p=0;p<l.times.length;++p){const f=l.times[p]*i;if(!(f<t||f>=n)){h.push(l.times[p]);for(let x=0;x<u;++x)d.push(l.values[p*u+x])}}h.length!==0&&(l.times=Xr(h,l.times.constructor),l.values=Xr(d,l.values.constructor),o.push(l))}r.tracks=o;let a=1/0;for(let c=0;c<r.tracks.length;++c)a>r.tracks[c].times[0]&&(a=r.tracks[c].times[0]);for(let c=0;c<r.tracks.length;++c)r.tracks[c].shift(-1*a);return r.resetDuration(),r}function DI(s,e=0,t=s,n=30){n<=0&&(n=30);const i=t.tracks.length,r=e/n;for(let o=0;o<i;++o){const a=t.tracks[o],c=a.ValueTypeName;if(c==="bool"||c==="string")continue;const l=s.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===c});if(l===void 0)continue;let u=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let d=0;const p=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=p/3);const f=a.times.length-1;let x;if(r<=a.times[0]){const g=u,y=h-u;x=a.values.slice(g,y)}else if(r>=a.times[f]){const g=f*h+u,y=g+h-u;x=a.values.slice(g,y)}else{const g=a.createInterpolant(),y=u,_=h-u;g.evaluate(r),x=g.resultBuffer.slice(y,_)}c==="quaternion"&&new Hn().fromArray(x).normalize().conjugate().toArray(x);const m=l.times.length;for(let g=0;g<m;++g){const y=g*p+d;if(c==="quaternion")Hn.multiplyQuaternionsFlat(l.values,y,x,0,l.values,y);else{const _=p-d*2;for(let v=0;v<_;++v)l.values[y+v]-=x[v]}}}return s.blendMode=jf,s}const UI={convertArray:Xr,isTypedArray:dv,getKeyframeOrder:pv,sortedArray:gf,flattenJSON:Im,subclip:LI,makeClipAdditive:DI};class Ta{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=r)){const a=t[1];e<a&&(n=2,r=a);for(let c=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=r,r=t[--n-1],e>=r)break t}o=n,n=0;break n}break e}for(;n<o;){const a=n+o>>>1;e<t[a]?o=a:n=a+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let o=0;o!==i;++o)t[o]=n[r+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class fv extends Ta{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:kr,endingEnd:kr}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,o=e+1,a=i[r],c=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case Gr:r=e,a=2*t-n;break;case Ac:r=i.length-2,a=t+i[r]-i[r+1];break;default:r=e,a=n}if(c===void 0)switch(this.getSettings_().endingEnd){case Gr:o=e,c=2*n-t;break;case Ac:o=1,c=n+i[1]-i[0];break;default:o=e-1,c=t}const l=(n-t)*.5,u=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(c-n),this._offsetPrev=r*u,this._offsetNext=o*u}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,p=this._weightNext,f=(n-t)/(i-t),x=f*f,m=x*f,g=-d*m+2*d*x-d*f,y=(1+d)*m+(-1.5-2*d)*x+(-.5+d)*f+1,_=(-1-p)*m+(1.5+p)*x+.5*f,v=p*m-p*x;for(let I=0;I!==a;++I)r[I]=g*o[u+I]+y*o[l+I]+_*o[c+I]+v*o[h+I];return r}}class Pm extends Ta{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=(n-t)/(i-t),h=1-u;for(let d=0;d!==a;++d)r[d]=o[l+d]*h+o[c+d]*u;return r}}class mv extends Ta{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Hi{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Xr(t,this.TimeBufferType),this.values=Xr(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Xr(e.times,Array),values:Xr(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new mv(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Pm(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new fv(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case sa:t=this.InterpolantFactoryMethodDiscrete;break;case wc:t=this.InterpolantFactoryMethodLinear;break;case Iu:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return sa;case this.InterpolantFactoryMethodLinear:return wc;case this.InterpolantFactoryMethodSmooth:return Iu}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,o=i-1;for(;r!==i&&n[r]<e;)++r;for(;o!==-1&&n[o]>t;)--o;if(++o,r!==0||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=n.slice(r,o),this.values=this.values.slice(r*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const c=n[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(i!==void 0&&dv(i))for(let a=0,c=i.length;a!==c;++a){const l=i[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Iu,r=e.length-1;let o=1;for(let a=1;a<r;++a){let c=!1;const l=e[a],u=e[a+1];if(l!==u&&(a!==1||l!==e[0]))if(i)c=!0;else{const h=a*n,d=h-n,p=h+n;for(let f=0;f!==n;++f){const x=t[h+f];if(x!==t[d+f]||x!==t[p+f]){c=!0;break}}}if(c){if(a!==o){e[o]=e[a];const h=a*n,d=o*n;for(let p=0;p!==n;++p)t[d+p]=t[h+p]}++o}}if(r>0){e[o]=e[r];for(let a=r*n,c=o*n,l=0;l!==n;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Hi.prototype.TimeBufferType=Float32Array;Hi.prototype.ValueBufferType=Float32Array;Hi.prototype.DefaultInterpolation=wc;class fr extends Hi{constructor(e,t,n){super(e,t,n)}}fr.prototype.ValueTypeName="bool";fr.prototype.ValueBufferType=Array;fr.prototype.DefaultInterpolation=sa;fr.prototype.InterpolantFactoryMethodLinear=void 0;fr.prototype.InterpolantFactoryMethodSmooth=void 0;class _d extends Hi{}_d.prototype.ValueTypeName="color";class ca extends Hi{}ca.prototype.ValueTypeName="number";class gv extends Ta{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(n-t)/(i-t);let l=e*a;for(let u=l+a;l!==u;l+=4)Hn.slerpFlat(r,0,o,l-a,o,l,c);return r}}class ba extends Hi{InterpolantFactoryMethodLinear(e){return new gv(this.times,this.values,this.getValueSize(),e)}}ba.prototype.ValueTypeName="quaternion";ba.prototype.InterpolantFactoryMethodSmooth=void 0;class uo extends Hi{constructor(e,t,n){super(e,t,n)}}uo.prototype.ValueTypeName="string";uo.prototype.ValueBufferType=Array;uo.prototype.DefaultInterpolation=sa;uo.prototype.InterpolantFactoryMethodLinear=void 0;uo.prototype.InterpolantFactoryMethodSmooth=void 0;class la extends Hi{}la.prototype.ValueTypeName="vector";class ua{constructor(e="",t=-1,n=[],i=Hh){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=bi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(OI(n[o]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=n.length;r!==o;++r)t.push(Hi.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,o=[];for(let a=0;a<r;a++){let c=[],l=[];c.push((a+r-1)%r,a,(a+1)%r),l.push(0,1,0);const u=pv(c);c=gf(c,1,u),l=gf(l,1,u),!i&&c[0]===0&&(c.push(r),l.push(l[0])),o.push(new ca(".morphTargetInfluences["+t[a].name+"]",c,l).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let a=0,c=e.length;a<c;a++){const l=e[a],u=l.name.match(r);if(u&&u.length>1){const h=u[1];let d=i[h];d||(i[h]=d=[]),d.push(l)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,d,p,f,x){if(p.length!==0){const m=[],g=[];Im(p,m,g,f),m.length!==0&&x.push(new h(d,m,g))}},i=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let h=0;h<l.length;h++){const d=l[h].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const p={};let f;for(f=0;f<d.length;f++)if(d[f].morphTargets)for(let x=0;x<d[f].morphTargets.length;x++)p[d[f].morphTargets[x]]=-1;for(const x in p){const m=[],g=[];for(let y=0;y!==d[f].morphTargets.length;++y){const _=d[f];m.push(_.time),g.push(_.morphTarget===x?1:0)}i.push(new ca(".morphTargetInfluence["+x+"]",m,g))}c=p.length*o}else{const p=".bones["+t[h].name+"]";n(la,p+".position",d,"pos",i),n(ba,p+".quaternion",d,"rot",i),n(la,p+".scale",d,"scl",i)}}return i.length===0?null:new this(r,c,i,a)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function FI(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ca;case"vector":case"vector2":case"vector3":case"vector4":return la;case"color":return _d;case"quaternion":return ba;case"bool":case"boolean":return fr;case"string":return uo}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function OI(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=FI(s.type);if(s.times===void 0){const t=[],n=[];Im(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const ps={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(this.files[s]=e)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class yd{constructor(e,t,n){const i=this;let r=!1,o=0,a=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){a++,r===!1&&i.onStart!==void 0&&i.onStart(u,o,a),r=!0},this.itemEnd=function(u){o++,i.onProgress!==void 0&&i.onProgress(u,o,a),o===a&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return c?c(u):u},this.setURLModifier=function(u){return c=u,this},this.addHandler=function(u,h){return l.push(u,h),this},this.removeHandler=function(u){const h=l.indexOf(u);return h!==-1&&l.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=l.length;h<d;h+=2){const p=l[h],f=l[h+1];if(p.global&&(p.lastIndex=0),p.test(u))return f}return null}}}const Lm=new yd;class qn{constructor(e){this.manager=e!==void 0?e:Lm,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}qn.DEFAULT_MATERIAL_NAME="__DEFAULT";const Es={};class VI extends Error{constructor(e,t){super(e),this.response=t}}class ts extends qn{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=ps.get(e);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(Es[e]!==void 0){Es[e].push({onLoad:t,onProgress:n,onError:i});return}Es[e]=[],Es[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,c=this.responseType;fetch(o).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const u=Es[e],h=l.body.getReader(),d=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),p=d?parseInt(d):0,f=p!==0;let x=0;const m=new ReadableStream({start(g){y();function y(){h.read().then(({done:_,value:v})=>{if(_)g.close();else{x+=v.byteLength;const I=new ProgressEvent("progress",{lengthComputable:f,loaded:x,total:p});for(let T=0,w=u.length;T<w;T++){const C=u[T];C.onProgress&&C.onProgress(I)}g.enqueue(v),y()}},_=>{g.error(_)})}}});return new Response(m)}else throw new VI(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return l.json();default:if(a===void 0)return l.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),d=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(d);return l.arrayBuffer().then(f=>p.decode(f))}}}).then(l=>{ps.add(e,l);const u=Es[e];delete Es[e];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onLoad&&p.onLoad(l)}}).catch(l=>{const u=Es[e];if(u===void 0)throw this.manager.itemError(e),l;delete Es[e];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onError&&p.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class BI extends qn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new ts(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=ua.parse(e[n]);t.push(i)}return t}}class zI extends qn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=[],a=new jc,c=new ts(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(r.withCredentials);let l=0;function u(h){c.load(e[h],function(d){const p=r.parse(d,!0);o[h]={width:p.width,height:p.height,format:p.format,mipmaps:p.mipmaps},l+=1,l===6&&(p.mipmapCount===1&&(a.minFilter=Ut),a.image=o,a.format=p.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let h=0,d=e.length;h<d;++h)u(h);else c.load(e,function(h){const d=r.parse(h,!0);if(d.isCubemap){const p=d.mipmaps.length/d.mipmapCount;for(let f=0;f<p;f++){o[f]={mipmaps:[]};for(let x=0;x<d.mipmapCount;x++)o[f].mipmaps.push(d.mipmaps[f*d.mipmapCount+x]),o[f].format=d.format,o[f].width=d.width,o[f].height=d.height}a.image=o}else a.image.width=d.width,a.image.height=d.height,a.mipmaps=d.mipmaps;d.mipmapCount===1&&(a.minFilter=Ut),a.format=d.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}}class Uc extends qn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=ps.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a=Rc("img");function c(){u(),ps.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(h){u(),i&&i(h),r.manager.itemError(e),r.manager.itemEnd(e)}function u(){a.removeEventListener("load",c,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",c,!1),a.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class kI extends qn{constructor(e){super(e)}load(e,t,n,i){const r=new ro;r.colorSpace=kn;const o=new Uc(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function c(l){o.load(e[l],function(u){r.images[l]=u,a++,a===6&&(r.needsUpdate=!0,t&&t(r))},void 0,i)}for(let l=0;l<e.length;++l)c(l);return r}}class xv extends qn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new Oi,a=new ts(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(e,function(c){let l;try{l=r.parse(c)}catch(u){if(i!==void 0)i(u);else{console.error(u);return}}l.image!==void 0?o.image=l.image:l.data!==void 0&&(o.image.width=l.width,o.image.height=l.height,o.image.data=l.data),o.wrapS=l.wrapS!==void 0?l.wrapS:Si,o.wrapT=l.wrapT!==void 0?l.wrapT:Si,o.magFilter=l.magFilter!==void 0?l.magFilter:Ut,o.minFilter=l.minFilter!==void 0?l.minFilter:Ut,o.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.colorSpace!==void 0&&(o.colorSpace=l.colorSpace),l.flipY!==void 0&&(o.flipY=l.flipY),l.format!==void 0&&(o.format=l.format),l.type!==void 0&&(o.type=l.type),l.mipmaps!==void 0&&(o.mipmaps=l.mipmaps,o.minFilter=Kn),l.mipmapCount===1&&(o.minFilter=Ut),l.generateMipmaps!==void 0&&(o.generateMipmaps=l.generateMipmaps),o.needsUpdate=!0,t&&t(o,l)},n,i),o}}class _v extends qn{constructor(e){super(e)}load(e,t,n,i){const r=new Xt,o=new Uc(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){r.image=a,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}}class mr extends yt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new _e(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class vd extends mr{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(yt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new _e(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Dp=new Fe,Dx=new E,Ux=new E;class Dm{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new J(512,512),this.map=null,this.mapPass=null,this.matrix=new Fe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new xa,this._frameExtents=new J(1,1),this._viewportCount=1,this._viewports=[new st(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Dx.setFromMatrixPosition(e.matrixWorld),t.position.copy(Dx),Ux.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Ux),t.updateMatrixWorld(),Dp.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Dp),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Dp)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class GI extends Dm{constructor(){super(new hn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=oa*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class sl extends mr{constructor(e,t,n=0,i=Math.PI/3,r=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(yt.DEFAULT_UP),this.updateMatrix(),this.target=new yt,this.distance=n,this.angle=i,this.penumbra=r,this.decay=o,this.map=null,this.shadow=new GI}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const Fx=new Fe,Ga=new E,Up=new E;class HI extends Dm{constructor(){super(new hn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new J(4,2),this._viewportCount=6,this._viewports=[new st(2,1,1,1),new st(0,1,1,1),new st(3,1,1,1),new st(1,1,1,1),new st(3,0,1,1),new st(1,0,1,1)],this._cubeDirections=[new E(1,0,0),new E(-1,0,0),new E(0,0,1),new E(0,0,-1),new E(0,1,0),new E(0,-1,0)],this._cubeUps=[new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,0,1),new E(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Ga.setFromMatrixPosition(e.matrixWorld),n.position.copy(Ga),Up.copy(n.position),Up.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Up),n.updateMatrixWorld(),i.makeTranslation(-Ga.x,-Ga.y,-Ga.z),Fx.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Fx)}}class Md extends mr{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new HI}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class WI extends Dm{constructor(){super(new ao(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Sd extends mr{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(yt.DEFAULT_UP),this.updateMatrix(),this.target=new yt,this.shadow=new WI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Td extends mr{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Um extends mr{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class yv{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new E)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*r),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*r)),t.addScaledVector(o[6],.315392*(3*r*r-1)),t.addScaledVector(o[7],1.092548*(n*r)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*r),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*r),t.addScaledVector(o[6],.743125*r*r-.247708),t.addScaledVector(o[7],2*.429043*n*r),t.addScaledVector(o[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}class Fm extends mr{constructor(e=new yv,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class rl extends qn{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,o=new ts(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(r){return t[r]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",r),t[r]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new _e().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const r in e.uniforms){const o=e.uniforms[r];switch(i.uniforms[r]={},o.type){case"t":i.uniforms[r].value=n(o.value);break;case"c":i.uniforms[r].value=new _e().setHex(o.value);break;case"v2":i.uniforms[r].value=new J().fromArray(o.value);break;case"v3":i.uniforms[r].value=new E().fromArray(o.value);break;case"v4":i.uniforms[r].value=new st().fromArray(o.value);break;case"m3":i.uniforms[r].value=new Ke().fromArray(o.value);break;case"m4":i.uniforms[r].value=new Fe().fromArray(o.value);break;default:i.uniforms[r].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const r in e.extensions)i.extensions[r]=e.extensions[r];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),i.normalScale=new J().fromArray(r)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new J().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return rl.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:dd,SpriteMaterial:Jc,RawShaderMaterial:Em,ShaderMaterial:ki,PointsMaterial:va,MeshPhysicalMaterial:pd,MeshStandardMaterial:il,MeshPhongMaterial:fd,MeshToonMaterial:Cm,MeshNormalMaterial:md,MeshLambertMaterial:gd,MeshDepthMaterial:Kh,MeshDistanceMaterial:cm,MeshBasicMaterial:ss,MeshMatcapMaterial:Rm,LineDashedMaterial:xd,LineBasicMaterial:Fn,Material:mn};return new t[e]}}class dh{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Om extends at{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class vv extends qn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new ts(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(p,f){if(t[f]!==void 0)return t[f];const m=p.interleavedBuffers[f],g=r(p,m.buffer),y=Go(m.type,g),_=new ya(y,m.stride);return _.uuid=m.uuid,t[f]=_,_}function r(p,f){if(n[f]!==void 0)return n[f];const m=p.arrayBuffers[f],g=new Uint32Array(m).buffer;return n[f]=g,g}const o=e.isInstancedBufferGeometry?new Om:new at,a=e.data.index;if(a!==void 0){const p=Go(a.type,a.array);o.setIndex(new At(p,1))}const c=e.data.attributes;for(const p in c){const f=c[p];let x;if(f.isInterleavedBufferAttribute){const m=i(e.data,f.data);x=new Us(m,f.itemSize,f.offset,f.normalized)}else{const m=Go(f.type,f.array),g=f.isInstancedBufferAttribute?Fs:At;x=new g(m,f.itemSize,f.normalized)}f.name!==void 0&&(x.name=f.name),f.usage!==void 0&&x.setUsage(f.usage),o.setAttribute(p,x)}const l=e.data.morphAttributes;if(l)for(const p in l){const f=l[p],x=[];for(let m=0,g=f.length;m<g;m++){const y=f[m];let _;if(y.isInterleavedBufferAttribute){const v=i(e.data,y.data);_=new Us(v,y.itemSize,y.offset,y.normalized)}else{const v=Go(y.type,y.array);_=new At(v,y.itemSize,y.normalized)}y.name!==void 0&&(_.name=y.name),x.push(_)}o.morphAttributes[p]=x}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let p=0,f=h.length;p!==f;++p){const x=h[p];o.addGroup(x.start,x.count,x.materialIndex)}const d=e.data.boundingSphere;if(d!==void 0){const p=new E;d.center!==void 0&&p.fromArray(d.center),o.boundingSphere=new Dn(p,d.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class Mv extends qn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=this.path===""?dh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new ts(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){let l=null;try{l=JSON.parse(c)}catch(h){i!==void 0&&i(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const u=l.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}r.parse(l,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?dh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const r=new ts(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const o=await r.loadAsync(e,t),a=JSON.parse(o),c=a.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(a)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(l)}),a=this.parseTextures(e.textures,o),c=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,r,c,a,n),u=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,u),this.bindLightTargets(l),t!==void 0){let h=!1;for(const d in o)if(o[d].data instanceof HTMLImageElement){h=!0;break}h===!1&&t(l)}return l}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),r=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,r),a=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,i,a,o,t),l=this.parseSkeletons(e.skeletons,c);return this.bindSkeletons(c,l),this.bindLightTargets(c),c}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const r=new tr().fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(r){r.isBone&&(i[r.uuid]=r)}),e!==void 0)for(let r=0,o=e.length;r<o;r++){const a=new Kc().fromJSON(e[r],i);n[a.uuid]=a}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new vv;for(let r=0,o=e.length;r<o;r++){let a;const c=e[r];switch(c.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(c);break;default:c.type in Lx?a=Lx[c.type].fromJSON(c,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`)}a.uuid=c.uuid,c.name!==void 0&&(a.name=c.name),c.userData!==void 0&&(a.userData=c.userData),n[c.uuid]=a}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const r=new rl;r.setTextures(t);for(let o=0,a=e.length;o<a;o++){const c=e[o];n[c.uuid]===void 0&&(n[c.uuid]=r.parse(c)),i[c.uuid]=n[c.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],r=ua.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function o(c){return n.manager.itemStart(c),r.load(c,function(){n.manager.itemEnd(c)},void 0,function(){n.manager.itemError(c),n.manager.itemEnd(c)})}function a(c){if(typeof c=="string"){const l=c,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l)?l:n.resourcePath+l;return o(u)}else return c.data?{data:Go(c.type,c.data),width:c.width,height:c.height}:null}if(e!==void 0&&e.length>0){const c=new yd(t);r=new Uc(c),r.setCrossOrigin(this.crossOrigin);for(let l=0,u=e.length;l<u;l++){const h=e[l],d=h.url;if(Array.isArray(d)){const p=[];for(let f=0,x=d.length;f<x;f++){const m=d[f],g=a(m);g!==null&&(g instanceof HTMLImageElement?p.push(g):p.push(new Oi(g.data,g.width,g.height)))}i[h.uuid]=new Ks(p)}else{const p=a(h.url);i[h.uuid]=new Ks(p)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function r(o){if(typeof o=="string"){const a=o,c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await i.loadAsync(c)}else return o.data?{data:Go(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new Uc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const c=e[o],l=c.url;if(Array.isArray(l)){const u=[];for(let h=0,d=l.length;h<d;h++){const p=l[h],f=await r(p);f!==null&&(f instanceof HTMLImageElement?u.push(f):u.push(new Oi(f.data,f.width,f.height)))}n[c.uuid]=new Ks(u)}else{const u=await r(c.url);n[c.uuid]=new Ks(u)}}}return n}parseTextures(e,t){function n(r,o){return typeof r=="number"?r:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",r),o[r])}const i={};if(e!==void 0)for(let r=0,o=e.length;r<o;r++){const a=e[r];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const c=t[a.image],l=c.data;let u;Array.isArray(l)?(u=new ro,l.length===6&&(u.needsUpdate=!0)):(l&&l.data?u=new Oi:u=new Xt,l&&(u.needsUpdate=!0)),u.source=c,u.uuid=a.uuid,a.name!==void 0&&(u.name=a.name),a.mapping!==void 0&&(u.mapping=n(a.mapping,XI)),a.channel!==void 0&&(u.channel=a.channel),a.offset!==void 0&&u.offset.fromArray(a.offset),a.repeat!==void 0&&u.repeat.fromArray(a.repeat),a.center!==void 0&&u.center.fromArray(a.center),a.rotation!==void 0&&(u.rotation=a.rotation),a.wrap!==void 0&&(u.wrapS=n(a.wrap[0],Ox),u.wrapT=n(a.wrap[1],Ox)),a.format!==void 0&&(u.format=a.format),a.internalFormat!==void 0&&(u.internalFormat=a.internalFormat),a.type!==void 0&&(u.type=a.type),a.colorSpace!==void 0&&(u.colorSpace=a.colorSpace),a.minFilter!==void 0&&(u.minFilter=n(a.minFilter,Vx)),a.magFilter!==void 0&&(u.magFilter=n(a.magFilter,Vx)),a.anisotropy!==void 0&&(u.anisotropy=a.anisotropy),a.flipY!==void 0&&(u.flipY=a.flipY),a.generateMipmaps!==void 0&&(u.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(u.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(u.compareFunction=a.compareFunction),a.userData!==void 0&&(u.userData=a.userData),i[a.uuid]=u}return i}parseObject(e,t,n,i,r){let o;function a(d){return t[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),t[d]}function c(d){if(d!==void 0){if(Array.isArray(d)){const p=[];for(let f=0,x=d.length;f<x;f++){const m=d[f];n[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",m),p.push(n[m])}return p}return n[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),n[d]}}function l(d){return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",d),i[d]}let u,h;switch(e.type){case"Scene":o=new Qh,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new _e(e.background):o.background=l(e.background)),e.environment!==void 0&&(o.environment=l(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new um(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new jh(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new hn(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new ao(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new Td(e.color,e.intensity);break;case"DirectionalLight":o=new Sd(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new Md(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new Um(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new sl(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new vd(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new Fm().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),h=c(e.material),o=new pm(u,h),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":u=a(e.geometry),h=c(e.material),o=new kt(u,h);break;case"InstancedMesh":u=a(e.geometry),h=c(e.material);const d=e.count,p=e.instanceMatrix,f=e.instanceColor;o=new fm(u,h,d),o.instanceMatrix=new Fs(new Float32Array(p.array),16),f!==void 0&&(o.instanceColor=new Fs(new Float32Array(f.array),f.itemSize));break;case"BatchedMesh":u=a(e.geometry),h=c(e.material),o=new mm(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,h),o.geometry=u,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._visibility=e.visibility,o._active=e.active,o._bounds=e.bounds.map(x=>{const m=new Wn;m.min.fromArray(x.boxMin),m.max.fromArray(x.boxMax);const g=new Dn;return g.radius=x.sphereRadius,g.center.fromArray(x.sphereCenter),{boxInitialized:x.boxInitialized,box:m,sphereInitialized:x.sphereInitialized,sphere:g}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=l(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=l(e.colorsTexture.uuid));break;case"LOD":o=new dm;break;case"Line":o=new Os(a(e.geometry),c(e.material));break;case"LineLoop":o=new gm(a(e.geometry),c(e.material));break;case"LineSegments":o=new rs(a(e.geometry),c(e.material));break;case"PointCloud":case"Points":o=new xm(a(e.geometry),c(e.material));break;case"Sprite":o=new hm(c(e.material));break;case"Group":o=new Wr;break;case"Bone":o=new ed;break;default:o=new yt}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const d=e.children;for(let p=0;p<d.length;p++)o.add(this.parseObject(d[p],t,n,i,r))}if(e.animations!==void 0){const d=e.animations;for(let p=0;p<d.length;p++){const f=d[p];o.animations.push(r[f])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const d=e.levels;for(let p=0;p<d.length;p++){const f=d[p],x=o.getObjectByProperty("uuid",f.object);x!==void 0&&o.addLevel(x,f.distance,f.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new yt}})}}const XI={UVMapping:Dh,CubeReflectionMapping:wi,CubeRefractionMapping:Vi,EquirectangularReflectionMapping:sr,EquirectangularRefractionMapping:rr,CubeUVReflectionMapping:dr},Ox={RepeatWrapping:or,ClampToEdgeWrapping:Si,MirroredRepeatWrapping:ta},Vx={NearestFilter:Qt,NearestMipmapNearestFilter:Uh,NearestMipmapLinearFilter:Is,LinearFilter:Ut,LinearMipmapNearestFilter:Qs,LinearMipmapLinearFilter:Kn};class Sv extends qn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=ps.get(e);if(o!==void 0){if(r.manager.itemStart(e),o.then){o.then(l=>{t&&t(l),r.manager.itemEnd(e)}).catch(l=>{i&&i(l)});return}return setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const c=fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(l){return ps.add(e,l),t&&t(l),r.manager.itemEnd(e),l}).catch(function(l){i&&i(l),ps.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});ps.add(e,c),r.manager.itemStart(e)}}let du;class bd{static getContext(){return du===void 0&&(du=new(window.AudioContext||window.webkitAudioContext)),du}static setContext(e){du=e}}class Tv extends qn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new ts(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(c){try{const l=c.slice(0);bd.getContext().decodeAudioData(l,function(h){t(h)}).catch(a)}catch(l){a(l)}},n,i);function a(c){i?i(c):console.error(c),r.manager.itemError(e)}}}const Bx=new Fe,zx=new Fe,Cr=new Fe;class Vm{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new hn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new hn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Cr.copy(e.projectionMatrix);const i=t.eyeSep/2,r=i*t.near/t.focus,o=t.near*Math.tan(Yr*t.fov*.5)/t.zoom;let a,c;zx.elements[12]=-i,Bx.elements[12]=i,a=-o*t.aspect+r,c=o*t.aspect+r,Cr.elements[0]=2*t.near/(c-a),Cr.elements[8]=(c+a)/(c-a),this.cameraL.projectionMatrix.copy(Cr),a=-o*t.aspect-r,c=o*t.aspect-r,Cr.elements[0]=2*t.near/(c-a),Cr.elements[8]=(c+a)/(c-a),this.cameraR.projectionMatrix.copy(Cr)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(zx),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Bx)}}class Bm{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=kx(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=kx();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function kx(){return performance.now()}const cs=new E,Gx=new Hn,qI=new E,Rr=new E;let bv=class extends yt{constructor(){super(),this.type="AudioListener",this.context=bd.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Bm}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(cs,Gx,qI),!(!Number.isFinite(cs.x)||!Number.isFinite(cs.y)||!Number.isFinite(cs.z)))if(Rr.set(0,0,-1).applyQuaternion(Gx),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(cs.x,i),t.positionY.linearRampToValueAtTime(cs.y,i),t.positionZ.linearRampToValueAtTime(cs.z,i),t.forwardX.linearRampToValueAtTime(Rr.x,i),t.forwardY.linearRampToValueAtTime(Rr.y,i),t.forwardZ.linearRampToValueAtTime(Rr.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(cs.x,cs.y,cs.z),t.setOrientation(Rr.x,Rr.y,Rr.z,n.x,n.y,n.z)}};class zm extends yt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||(this.buffer?this.buffer.duration:Number.MAX_VALUE))),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const Ir=new E,Hx=new Hn,$I=new E,Pr=new E;class wv extends zm{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Ir,Hx,$I),Pr.set(0,0,1).applyQuaternion(Hx);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Ir.x,n),t.positionY.linearRampToValueAtTime(Ir.y,n),t.positionZ.linearRampToValueAtTime(Ir.z,n),t.orientationX.linearRampToValueAtTime(Pr.x,n),t.orientationY.linearRampToValueAtTime(Pr.y,n),t.orientationZ.linearRampToValueAtTime(Pr.z,n)}else t.setPosition(Ir.x,Ir.y,Ir.z),t.setOrientation(Pr.x,Pr.y,Pr.z)}}class YI{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class Av{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,o;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,r=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)n[r+a]=n[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(n,r,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-r,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,o=i;r!==o;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let o=0;o!==r;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){Hn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const o=this._workIndex*r;Hn.multiplyQuaternionsFlat(e,o,e,t,e,n),Hn.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,r){const o=1-i;for(let a=0;a!==r;++a){const c=t+a;e[c]=e[c]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,r){for(let o=0;o!==r;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const km="\\[\\]\\.:\\/",ZI=new RegExp("["+km+"]","g"),Gm="[^"+km+"]",JI="[^"+km.replace("\\.","")+"]",KI=/((?:WC+[\/:])*)/.source.replace("WC",Gm),jI=/(WCOD+)?/.source.replace("WCOD",JI),QI=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Gm),eP=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Gm),tP=new RegExp("^"+KI+jI+QI+eP+"$"),nP=["material","materials","bones","map"];class iP{constructor(e,t,n){const i=n||St.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class St{constructor(e,t,n){this.path=t,this.parsedPath=n||St.parseTrackName(t),this.node=St.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new St.Composite(e,t,n):new St(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(ZI,"")}static parseTrackName(e){const t=tP.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const r=n.nodeName.substring(i+1);nP.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(r,o){for(let a=0;a<r.length;a++){const c=r[a];if(!o&&(c.name===t||c.uuid===t))return c;if(o&&c.userData&&c.userData.name===t)return c;const l=n(c.children,o);if(l)return l}return null},i=n(e.children);if(i)return i;{const r=n(e.children,!0);if(r)return r}}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=St.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===l){l=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}const o=e[i];if(o===void 0){const l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}St.Composite=iP;St.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};St.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};St.prototype.GetterByBindingType=[St.prototype._getValue_direct,St.prototype._getValue_array,St.prototype._getValue_arrayElement,St.prototype._getValue_toArray];St.prototype.SetterByBindingTypeAndVersioning=[[St.prototype._setValue_direct,St.prototype._setValue_direct_setNeedsUpdate,St.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[St.prototype._setValue_array,St.prototype._setValue_array_setNeedsUpdate,St.prototype._setValue_array_setMatrixWorldNeedsUpdate],[St.prototype._setValue_arrayElement,St.prototype._setValue_arrayElement_setNeedsUpdate,St.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[St.prototype._setValue_fromArray,St.prototype._setValue_fromArray_setNeedsUpdate,St.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class sP{constructor(){this.isAnimationObjectGroup=!0,this.uuid=bi(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,o=r.length;let a,c=e.length,l=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const d=arguments[u],p=d.uuid;let f=t[p];if(f===void 0){f=c++,t[p]=f,e.push(d);for(let x=0,m=o;x!==m;++x)r[x].push(new St(d,n[x],i[x]))}else if(f<l){a=e[f];const x=--l,m=e[x];t[m.uuid]=f,e[f]=m,t[p]=x,e[x]=d;for(let g=0,y=o;g!==y;++g){const _=r[g],v=_[x];let I=_[f];_[f]=v,I===void 0&&(I=new St(d,n[g],i[g])),_[x]=I}}else e[f]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const c=arguments[o],l=c.uuid,u=t[l];if(u!==void 0&&u>=r){const h=r++,d=e[h];t[d.uuid]=u,e[u]=d,t[l]=h,e[h]=c;for(let p=0,f=i;p!==f;++p){const x=n[p],m=x[h],g=x[u];x[u]=m,x[h]=g}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,o=e.length;for(let a=0,c=arguments.length;a!==c;++a){const l=arguments[a],u=l.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<r){const d=--r,p=e[d],f=--o,x=e[f];t[p.uuid]=h,e[h]=p,t[x.uuid]=d,e[d]=x,e.pop();for(let m=0,g=i;m!==g;++m){const y=n[m],_=y[d],v=y[f];y[h]=_,y[d]=v,y.pop()}}else{const d=--o,p=e[d];d>0&&(t[p.uuid]=h),e[h]=p,e.pop();for(let f=0,x=i;f!==x;++f){const m=n[f];m[h]=m[d],m.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(i!==void 0)return r[i];const o=this._paths,a=this._parsedPaths,c=this._objects,l=c.length,u=this.nCachedObjects_,h=new Array(l);i=r.length,n[e]=i,o.push(e),a.push(t),r.push(h);for(let d=u,p=c.length;d!==p;++d){const f=c[d];h[d]=new St(f,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,c=o[a],l=e[a];t[l]=n,o[n]=c,o.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}class Nv{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,o=r.length,a=new Array(o),c={endingStart:kr,endingEnd:kr};for(let l=0;l!==o;++l){const u=r[l].createInterpolant(null);a[l]=u,u.settings=c}this._interpolantSettings=c,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Kf,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,r=e._clip.duration,o=r/i,a=i/r;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const c=a.parameterPositions,l=a.sampleValues;return c[0]=r,c[1]=r+n,l[0]=e/o,l[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const c=(e-r)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case jf:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulateAdditive(a);break;case Hh:default:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const o=n===my;if(e===0)return r===-1?i:o&&(r&1)===1?t-i:i;if(n===Jf){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,r+=Math.abs(a);const c=this.repetitions-r;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const l=e<0;this._setEndings(l,!l,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Gr,i.endingEnd=Gr):(e?i.endingStart=this.zeroSlopeAtStart?Gr:kr:i.endingStart=Ac,t?i.endingEnd=this.zeroSlopeAtEnd?Gr:kr:i.endingEnd=Ac)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,c=o.sampleValues;return a[0]=r,c[0]=t,a[1]=r+e,c[1]=n,this}}const rP=new Float32Array(1);class Ev extends Ai{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,o=e._propertyBindings,a=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName;let u=l[c];u===void 0&&(u={},l[c]=u);for(let h=0;h!==r;++h){const d=i[h],p=d.name;let f=u[p];if(f!==void 0)++f.referenceCount,o[h]=f;else{if(f=o[h],f!==void 0){f._cacheIndex===null&&(++f.referenceCount,this._addInactiveBinding(f,c,p));continue}const x=t&&t._propertyBindings[h].binding.parsedPath;f=new Av(St.create(n,p,x),d.ValueTypeName,d.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,c,p),o[h]=f}a[h].resultBuffer=f.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,r=this._actionsByClip;let o=r[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,o=this._actionsByClip,a=o[r],c=a.knownActions,l=c[c.length-1],u=e._byClipCacheIndex;l._byClipCacheIndex=u,c[u]=l,c.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,d=(e._localRoot||this._root).uuid;delete h[d],c.length===0&&delete o[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,a=o[i],c=t[t.length-1],l=e._cacheIndex;c._cacheIndex=l,t[l]=c,t.pop(),delete a[r],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Pm(new Float32Array(2),new Float32Array(2),1,rP),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let o=typeof e=="string"?ua.findByName(i,e):e;const a=o!==null?o.uuid:e,c=this._actionsByClip[a];let l=null;if(n===void 0&&(o!==null?n=o.blendMode:n=Hh),c!==void 0){const h=c.actionByRoot[r];if(h!==void 0&&h.blendMode===n)return h;l=c.knownActions[0],o===null&&(o=l._clip)}if(o===null)return null;const u=new Nv(this,o,t,n);return this._bindAction(u,l),this._addInactiveAction(u,a,r),u}existingAction(e,t){const n=t||this._root,i=n.uuid,r=typeof e=="string"?ua.findByName(n,e):e,o=r?r.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,r,o);const a=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)a[l].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){const o=r.knownActions;for(let a=0,c=o.length;a!==c;++a){const l=o[a];this._deactivateAction(l);const u=l._cacheIndex,h=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const a=n[o].actionByRoot,c=a[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(const o in r){const a=r[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}let Cv=class Rv{constructor(e){this.value=e}clone(){return new Rv(this.value.clone===void 0?this.value:this.value.clone())}},oP=0;class aP extends Ai{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:oP++}),this.name="",this.usage=ra,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const r=Array.isArray(t[n])?t[n]:[t[n]];for(let o=0;o<r.length;o++)this.uniforms.push(r[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class Hm extends ya{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class cP{constructor(e,t,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Wx=new Fe;class Iv{constructor(e,t,n=0,i=1/0){this.ray=new so(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Yc,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Wx.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Wx),this}intersectObject(e,t=!0,n=[]){return xf(e,this,n,t),n.sort(Xx),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)xf(e[i],this,n,t);return n.sort(Xx),n}}function Xx(s,e){return s.distance-e.distance}function xf(s,e,t,n){let i=!0;if(s.layers.test(e.layers)&&s.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const r=s.children;for(let o=0,a=r.length;o<a;o++)xf(r[o],e,t,!0)}}class Pv{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(jt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class lP{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class Wm{constructor(e,t,n,i){Wm.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}const qx=new J;class uP{constructor(e=new J(1/0,1/0),t=new J(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=qx.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const $x=new E,pu=new E;class Lv{constructor(e=new E,t=new E){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){$x.subVectors(e,this.start),pu.subVectors(this.end,this.start);const n=pu.dot(pu);let r=pu.dot($x)/n;return t&&(r=jt(r,0,1)),r}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Yx=new E;class hP extends yt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new at,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,c=32;o<c;o++,a++){const l=o/c*Math.PI*2,u=a/c*Math.PI*2;i.push(Math.cos(l),Math.sin(l),1,Math.cos(u),Math.sin(u),1)}n.setAttribute("position",new Ve(i,3));const r=new Fn({fog:!1,toneMapped:!1});this.cone=new rs(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Yx.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Yx),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const $s=new E,fu=new Fe,Fp=new Fe;class dP extends rs{constructor(e){const t=Dv(e),n=new at,i=[],r=[],o=new _e(0,0,1),a=new _e(0,1,0);for(let l=0;l<t.length;l++){const u=t[l];u.parent&&u.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(o.r,o.g,o.b),r.push(a.r,a.g,a.b))}n.setAttribute("position",new Ve(i,3)),n.setAttribute("color",new Ve(r,3));const c=new Fn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,c),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Fp.copy(this.root.matrixWorld).invert();for(let r=0,o=0;r<t.length;r++){const a=t[r];a.parent&&a.parent.isBone&&(fu.multiplyMatrices(Fp,a.matrixWorld),$s.setFromMatrixPosition(fu),i.setXYZ(o,$s.x,$s.y,$s.z),fu.multiplyMatrices(Fp,a.parent.matrixWorld),$s.setFromMatrixPosition(fu),i.setXYZ(o+1,$s.x,$s.y,$s.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Dv(s){const e=[];s.isBone===!0&&e.push(s);for(let t=0;t<s.children.length;t++)e.push.apply(e,Dv(s.children[t]));return e}class pP extends kt{constructor(e,t,n){const i=new Sa(t,4,2),r=new ss({wireframe:!0,fog:!1,toneMapped:!1});super(i,r),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const fP=new E,Zx=new _e,Jx=new _e;class mP extends yt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Ma(t);i.rotateY(Math.PI*.5),this.material=new ss({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),o=new Float32Array(r.count*3);i.setAttribute("color",new At(o,3)),this.add(new kt(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Zx.copy(this.light.color),Jx.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const r=n<i/2?Zx:Jx;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(fP.setFromMatrixPosition(this.light.matrixWorld).negate())}}let Uv=class extends rs{constructor(e=10,t=10,n=4473924,i=8947848){n=new _e(n),i=new _e(i);const r=t/2,o=e/t,a=e/2,c=[],l=[];for(let d=0,p=0,f=-a;d<=t;d++,f+=o){c.push(-a,0,f,a,0,f),c.push(f,0,-a,f,0,a);const x=d===r?n:i;x.toArray(l,p),p+=3,x.toArray(l,p),p+=3,x.toArray(l,p),p+=3,x.toArray(l,p),p+=3}const u=new at;u.setAttribute("position",new Ve(c,3)),u.setAttribute("color",new Ve(l,3));const h=new Fn({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}};class gP extends rs{constructor(e=10,t=16,n=8,i=64,r=4473924,o=8947848){r=new _e(r),o=new _e(o);const a=[],c=[];if(t>1)for(let h=0;h<t;h++){const d=h/t*(Math.PI*2),p=Math.sin(d)*e,f=Math.cos(d)*e;a.push(0,0,0),a.push(p,0,f);const x=h&1?r:o;c.push(x.r,x.g,x.b),c.push(x.r,x.g,x.b)}for(let h=0;h<n;h++){const d=h&1?r:o,p=e-e/n*h;for(let f=0;f<i;f++){let x=f/i*(Math.PI*2),m=Math.sin(x)*p,g=Math.cos(x)*p;a.push(m,0,g),c.push(d.r,d.g,d.b),x=(f+1)/i*(Math.PI*2),m=Math.sin(x)*p,g=Math.cos(x)*p,a.push(m,0,g),c.push(d.r,d.g,d.b)}}const l=new at;l.setAttribute("position",new Ve(a,3)),l.setAttribute("color",new Ve(c,3));const u=new Fn({vertexColors:!0,toneMapped:!1});super(l,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Kx=new E,mu=new E,jx=new E;class Fv extends yt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new at;i.setAttribute("position",new Ve([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new Fn({fog:!1,toneMapped:!1});this.lightPlane=new Os(i,r),this.add(this.lightPlane),i=new at,i.setAttribute("position",new Ve([0,0,0,0,0,1],3)),this.targetLine=new Os(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Kx.setFromMatrixPosition(this.light.matrixWorld),mu.setFromMatrixPosition(this.light.target.matrixWorld),jx.subVectors(mu,Kx),this.lightPlane.lookAt(mu),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(mu),this.targetLine.scale.z=jx.length()}}const gu=new E,Kt=new Zc;class Ov extends rs{constructor(e){const t=new at,n=new Fn({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(f,x){c(f),c(x)}function c(f){i.push(0,0,0),r.push(0,0,0),o[f]===void 0&&(o[f]=[]),o[f].push(i.length/3-1)}t.setAttribute("position",new Ve(i,3)),t.setAttribute("color",new Ve(r,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const l=new _e(16755200),u=new _e(16711680),h=new _e(43775),d=new _e(16777215),p=new _e(3355443);this.setColors(l,u,h,d,p)}setColors(e,t,n,i,r){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,r.r,r.g,r.b),a.setXYZ(41,r.r,r.g,r.b),a.setXYZ(42,r.r,r.g,r.b),a.setXYZ(43,r.r,r.g,r.b),a.setXYZ(44,r.r,r.g,r.b),a.setXYZ(45,r.r,r.g,r.b),a.setXYZ(46,r.r,r.g,r.b),a.setXYZ(47,r.r,r.g,r.b),a.setXYZ(48,r.r,r.g,r.b),a.setXYZ(49,r.r,r.g,r.b),a.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;Kt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),nn("c",t,e,Kt,0,0,-1),nn("t",t,e,Kt,0,0,1),nn("n1",t,e,Kt,-n,-i,-1),nn("n2",t,e,Kt,n,-i,-1),nn("n3",t,e,Kt,-n,i,-1),nn("n4",t,e,Kt,n,i,-1),nn("f1",t,e,Kt,-n,-i,1),nn("f2",t,e,Kt,n,-i,1),nn("f3",t,e,Kt,-n,i,1),nn("f4",t,e,Kt,n,i,1),nn("u1",t,e,Kt,n*.7,i*1.1,-1),nn("u2",t,e,Kt,-n*.7,i*1.1,-1),nn("u3",t,e,Kt,0,i*2,-1),nn("cf1",t,e,Kt,-n,0,1),nn("cf2",t,e,Kt,n,0,1),nn("cf3",t,e,Kt,0,-i,1),nn("cf4",t,e,Kt,0,i,1),nn("cn1",t,e,Kt,-n,0,-1),nn("cn2",t,e,Kt,n,0,-1),nn("cn3",t,e,Kt,0,-i,-1),nn("cn4",t,e,Kt,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function nn(s,e,t,n,i,r,o){gu.set(i,r,o).unproject(n);const a=e[s];if(a!==void 0){const c=t.getAttribute("position");for(let l=0,u=a.length;l<u;l++)c.setXYZ(a[l],gu.x,gu.y,gu.z)}}const xu=new Wn;class Vv extends rs{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new at;r.setIndex(new At(n,1)),r.setAttribute("position",new At(i,3)),super(r,new Fn({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&xu.setFromObject(this.object),xu.isEmpty())return;const t=xu.min,n=xu.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Bv extends rs{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],r=new at;r.setIndex(new At(n,1)),r.setAttribute("position",new Ve(i,3)),super(r,new Fn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class xP extends Os{constructor(e,t=1,n=16776960){const i=n,r=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new at;o.setAttribute("position",new Ve(r,3)),o.computeBoundingSphere(),super(o,new Fn({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],c=new at;c.setAttribute("position",new Ve(a,3)),c.computeBoundingSphere(),this.add(new kt(c,new ss({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Qx=new E;let _u,Op;class _P extends yt{constructor(e=new E(0,0,1),t=new E(0,0,0),n=1,i=16776960,r=n*.2,o=r*.2){super(),this.type="ArrowHelper",_u===void 0&&(_u=new at,_u.setAttribute("position",new Ve([0,0,0,0,1,0],3)),Op=new lo(0,.5,1,5,1),Op.translate(0,-.5,0)),this.position.copy(t),this.line=new Os(_u,new Fn({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new kt(Op,new ss({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Qx.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Qx,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}let zv=class extends rs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new at;i.setAttribute("position",new Ve(t,3)),i.setAttribute("color",new Ve(n,3));const r=new Fn({vertexColors:!0,toneMapped:!1});super(i,r),this.type="AxesHelper"}setColors(e,t,n){const i=new _e,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}};class kv{constructor(){this.type="ShapePath",this.color=new _e,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Ic,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,o){return this.currentPath.bezierCurveTo(e,t,n,i,r,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(g){const y=[];for(let _=0,v=g.length;_<v;_++){const I=g[_],T=new tr;T.curves=I.curves,y.push(T)}return y}function n(g,y){const _=y.length;let v=!1;for(let I=_-1,T=0;T<_;I=T++){let w=y[I],C=y[T],F=C.x-w.x,M=C.y-w.y;if(Math.abs(M)>Number.EPSILON){if(M<0&&(w=y[T],F=-F,C=y[I],M=-M),g.y<w.y||g.y>C.y)continue;if(g.y===w.y){if(g.x===w.x)return!0}else{const b=M*(g.x-w.x)-F*(g.y-w.y);if(b===0)return!0;if(b<0)continue;v=!v}}else{if(g.y!==w.y)continue;if(C.x<=g.x&&g.x<=w.x||w.x<=g.x&&g.x<=C.x)return!0}}return v}const i=ji.isClockWise,r=this.subPaths;if(r.length===0)return[];let o,a,c;const l=[];if(r.length===1)return a=r[0],c=new tr,c.curves=a.curves,l.push(c),l;let u=!i(r[0].getPoints());u=e?!u:u;const h=[],d=[];let p=[],f=0,x;d[f]=void 0,p[f]=[];for(let g=0,y=r.length;g<y;g++)a=r[g],x=a.getPoints(),o=i(x),o=e?!o:o,o?(!u&&d[f]&&f++,d[f]={s:new tr,p:x},d[f].s.curves=a.curves,u&&f++,p[f]=[]):p[f].push({h:a,p:x[0]});if(!d[0])return t(r);if(d.length>1){let g=!1,y=0;for(let _=0,v=d.length;_<v;_++)h[_]=[];for(let _=0,v=d.length;_<v;_++){const I=p[_];for(let T=0;T<I.length;T++){const w=I[T];let C=!0;for(let F=0;F<d.length;F++)n(w.p,d[F].p)&&(_!==F&&y++,C?(C=!1,h[F].push(w)):g=!0);C&&h[_].push(w)}}y>0&&g===!1&&(p=h)}let m;for(let g=0,y=d.length;g<y;g++){c=d[g].s,l.push(c),m=p[g];for(let _=0,v=m.length;_<v;_++)c.holes.push(m[_].h)}return l}}class Gv extends Ai{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}class yP extends zi{constructor(e=1,t=1,n=1,i={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,t,{...i,count:n}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}const vP=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveMap","envMap","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"];class Hv{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=vP,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}getRenderObjectData(e){let t=this.renderObjects.get(e);return t===void 0&&(t={material:this.getMaterialData(e.material),worldMatrix:e.object.matrixWorld.clone()},e.object.center&&(t.center=e.object.center.clone()),e.object.morphTargetInfluences&&(t.morphTargetInfluences=e.object.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),this.renderObjects.set(e,t)),t}containsNode(e){const t=e.material;for(const n in t)if(t[n]&&t[n].isNode)return!0;return e.renderer.nodes.modelViewMatrix!==null||e.renderer.nodes.modelNormalViewMatrix!==null}getMaterialData(e){const t={};for(const n of this.refreshUniforms){const i=e[n];i!=null&&(typeof i=="object"&&i.clone!==void 0?i.isTexture===!0?t[n]={id:i.id,version:i.version}:t[n]=i.clone():t[n]=i)}return t}equals(e){const{object:t,material:n}=e,i=this.getRenderObjectData(e);if(i.worldMatrix.equals(t.matrixWorld)!==!0)return i.worldMatrix.copy(t.matrixWorld),!1;const r=i.material;for(const o in r){const a=r[o],c=n[o];if(a.equals!==void 0){if(a.equals(c)===!1)return a.copy(c),!1}else if(c.isTexture===!0){if(a.id!==c.id||a.version!==c.version)return a.id=c.id,a.version=c.version,!1}else if(a!==c)return r[o]=c,!1}if(i.morphTargetInfluences){let o=!1;for(let a=0;a<i.morphTargetInfluences.length;a++)i.morphTargetInfluences[a]!==t.morphTargetInfluences[a]&&(o=!0);if(o)return!0}return i.center&&i.center.equals(t.center)===!1?(i.center.copy(t.center),!0):(e.bundle!==null&&(i.version=e.bundle.version),!0)}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e))return!0;const{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;const i=e.object.static===!0,r=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;return i||r?!1:this.equals(e)!==!0}}function Fc(s,e=0){let t=3735928559^e,n=1103547991^e;if(s instanceof Array)for(let i=0,r;i<s.length;i++)r=s[i],t=Math.imul(t^r,2654435761),n=Math.imul(n^r,1597334677);else for(let i=0,r;i<s.length;i++)r=s.charCodeAt(i),t=Math.imul(t^r,2654435761),n=Math.imul(n^r,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}const Wv=s=>Fc(s),Xv=s=>Fc(s),Xm=(...s)=>Fc(s);function qm(s,e=!1){const t=[];s.isNode===!0&&(t.push(s.id),s=s.getSelf());for(const{property:n,childNode:i}of Oc(s))t.push(t,Fc(n.slice(0,-4)),i.getCacheKey(e));return Fc(t)}function*Oc(s,e=!1){for(const t in s){if(t.startsWith("_")===!0)continue;const n=s[t];if(Array.isArray(n)===!0)for(let i=0;i<n.length;i++){const r=n[i];r&&(r.isNode===!0||e&&typeof r.toJSON=="function")&&(yield{property:t,index:i,childNode:r})}else if(n&&n.isNode===!0)yield{property:t,childNode:n};else if(typeof n=="object")for(const i in n){const r=n[i];r&&(r.isNode===!0||e&&typeof r.toJSON=="function")&&(yield{property:t,index:i,childNode:r})}}}function Ps(s){if(s==null)return null;const e=typeof s;return s.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":s.isVector2===!0?"vec2":s.isVector3===!0?"vec3":s.isVector4===!0?"vec4":s.isMatrix3===!0?"mat3":s.isMatrix4===!0?"mat4":s.isColor===!0?"color":s instanceof ArrayBuffer?"ArrayBuffer":null}function $m(s,...e){const t=s?s.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),s==="color"?new _e(...e):t==="vec2"?new J(...e):t==="vec3"?new E(...e):t==="vec4"?new st(...e):t==="mat3"?new Ke(...e):t==="mat4"?new Fe(...e):s==="bool"?e[0]||!1:s==="float"||s==="int"||s==="uint"?e[0]||0:s==="string"?e[0]||"":s==="ArrayBuffer"?Zm(e[0]):null}function Ym(s){let e="";const t=new Uint8Array(s);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function Zm(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0)).buffer}var MP=Object.freeze({__proto__:null,arrayBufferToBase64:Ym,base64ToArrayBuffer:Zm,getCacheKey:qm,getNodeChildren:Oc,getValueFromType:$m,getValueType:Ps,hash:Xm,hashArray:Xv,hashString:Wv});const _f={VERTEX:"vertex",FRAGMENT:"fragment"},We={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},SP={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Jm=["fragment","vertex"],yf=["setup","analyze","generate"],vf=[...Jm,"compute"],wa=["x","y","z","w"];let TP=0;class Ye extends Ai{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=We.NONE,this.updateBeforeType=We.NONE,this.updateAfterType=We.NONE,this.uuid=Xh.generateUUID(),this.version=0,this._cacheKey=null,this._cacheKeyVersion=0,this.global=!1,this.isNode=!0,Object.defineProperty(this,"id",{value:TP++})}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this.getSelf()),this}onFrameUpdate(e){return this.onUpdate(e,We.FRAME)}onRenderUpdate(e){return this.onUpdate(e,We.RENDER)}onObjectUpdate(e){return this.onUpdate(e,We.OBJECT)}onReference(e){return this.updateReference=e.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of Oc(this))yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return e=e||this.version!==this._cacheKeyVersion,(e===!0||this._cacheKey===null)&&(this._cacheKey=qm(this,e),this._cacheKeyVersion=this.version),this._cacheKey}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){const t=this.getNodeType(e);return e.getElementType(t)}getNodeType(e){const t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){const t=this.getHash(e);return e.getNodeFromHash(t)||this}setup(e){const t=e.getNodeProperties(this);let n=0;for(const i of this.getChildren())t["node"+n++]=i;return null}analyze(e){if(e.increaseUsage(this)===1){const n=e.getNodeProperties(this);for(const i of Object.values(n))i&&i.isNode===!0&&i.build(e)}}generate(e,t){const{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){console.warn("Abstract function.")}updateAfter(){console.warn("Abstract function.")}update(){console.warn("Abstract function.")}build(e,t=null){const n=this.getShared(e);if(this!==n)return n.build(e,t);e.addNode(this),e.addChain(this);let i=null;const r=e.getBuildStage();if(r==="setup"){this.updateReference(e);const o=e.getNodeProperties(this);if(o.initialized!==!0){const a=e.stack.nodes.length;o.initialized=!0,o.outputNode=this.setup(e),o.outputNode!==null&&e.stack.nodes.length;for(const c of Object.values(o))c&&c.isNode===!0&&c.build(e)}}else if(r==="analyze")this.analyze(e);else if(r==="generate")if(this.generate.length===1){const a=this.getNodeType(e),c=e.getDataFromNode(this);i=c.snippet,i===void 0?(i=this.generate(e)||"",c.snippet=i):c.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),i=e.format(i,a,t)}else i=this.generate(e,t)||"";return e.removeChain(this),i}getSerializeChildren(){return Oc(this)}serialize(e){const t=this.getSerializeChildren(),n={};for(const{property:i,index:r,childNode:o}of t)r!==void 0?(n[i]===void 0&&(n[i]=Number.isInteger(r)?[]:{}),n[i][r]=o.toJSON(e.meta).uuid):n[i]=o.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){const t=e.meta.nodes;for(const n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){const i=[];for(const r of e.inputNodes[n])i.push(t[r]);this[n]=i}else if(typeof e.inputNodes[n]=="object"){const i={};for(const r in e.inputNodes[n]){const o=e.inputNodes[n][r];i[r]=t[o]}this[n]=i}else{const i=e.inputNodes[n];this[n]=t[i]}}}toJSON(e){const{uuid:t,type:n}=this,i=e===void 0||typeof e=="string";i&&(e={textures:{},images:{},nodes:{}});let r=e.nodes[t];r===void 0&&(r={uuid:t,type:n,meta:e,metadata:{version:4.6,type:"Node",generator:"Node.toJSON"}},i!==!0&&(e.nodes[r.uuid]=r),this.serialize(r),delete r.meta);function o(a){const c=[];for(const l in a){const u=a[l];delete u.metadata,c.push(u)}return c}if(i){const a=o(e.textures),c=o(e.images),l=o(e.nodes);a.length>0&&(r.textures=a),c.length>0&&(r.images=c),l.length>0&&(r.nodes=l)}return r}}class gr extends Ye{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){const t=this.node.build(e),n=this.indexNode.build(e,"uint");return`${t}[ ${n} ]`}}class Km extends Ye{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){const t=this.node.getNodeType(e);let n=null;for(const i of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(i))&&(n=i);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const n=this.node,i=this.getNodeType(e),r=n.build(e,i);return e.format(r,i,t)}}class pt extends Ye{static get type(){return"TempNode"}constructor(e){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){const i=e.getVectorType(this.getNodeType(e,t)),r=e.getDataFromNode(this);if(r.propertyName!==void 0)return e.format(r.propertyName,i,t);if(i!=="void"&&t!=="void"&&this.hasDependencies(e)){const o=super.build(e,i),a=e.getVarFromNode(this,null,i),c=e.getPropertyName(a);return e.addLineFlowCode(`${c} = ${o}`,this),r.snippet=o,r.propertyName=c,e.format(r.propertyName,i,t)}}return super.build(e,t)}}class qv extends pt{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){const n=this.getNodeType(e),i=this.nodes,r=e.getComponentType(n),o=[];for(const c of i){let l=c.build(e);const u=e.getComponentType(c.getNodeType(e));u!==r&&(l=e.format(l,u,r)),o.push(l)}const a=`${e.getType(n)}( ${o.join(", ")} )`;return e.format(a,n,t)}}const bP=wa.join("");class ph extends Ye{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(wa.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}generate(e,t){const n=this.node,i=e.getTypeLength(n.getNodeType(e));let r=null;if(i>1){let o=null;this.getVectorLength()>=i&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const c=n.build(e,o);this.components.length===i&&this.components===bP.slice(0,this.components.length)?r=e.format(c,o,t):r=e.format(`${c}.${this.components}`,this.getNodeType(e),t)}else r=n.build(e,t);return r}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class $v extends pt{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:n,targetNode:i}=this,r=this.getNodeType(e),o=e.getTypeFromLength(n.length,i.getNodeType(e)),a=i.build(e,o),c=t.build(e,r),l=e.getTypeLength(r),u=[];for(let h=0;h<l;h++){const d=wa[h];d===n[0]?(u.push(a),h+=n.length-1):u.push(c+"."+d)}return`${e.getType(r)}( ${u.join(", ")} )`}}class wP extends pt{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{components:t,sourceNode:n}=this,i=this.getNodeType(e),r=n.build(e),o=e.getVarFromNode(this),a=e.getPropertyName(o);e.addLineFlowCode(a+" = "+r,this);const c=e.getTypeLength(i),l=[];let u=0;for(let h=0;h<c;h++){const d=wa[h];d===t[u]?(l.push("1.0 - "+(a+"."+d)),u++):l.push(a+"."+d)}return`${e.getType(i)}( ${l.join(", ")} )`}}class jm extends Ye{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return this.nodeType===null?Ps(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=Ps(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=Ym(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?$m(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){console.warn("Abstract function.")}}class Wi extends jm{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){const n=this.getNodeType(e);return e.format(this.generateConst(e),n,t)}}let ha=null;const Xo=new Map;function te(s,e){if(Xo.has(s)){console.warn(`Redefinition of method chaining ${s}`);return}if(typeof e!="function")throw new Error(`Node element ${s} is not a function`);Xo.set(s,e)}const Yv=s=>s.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),e_=s=>Yv(s).split("").sort().join(""),Zv={setup(s,e){const t=e.shift();return s(ol(t),...e)},get(s,e,t){if(typeof e=="string"&&s[e]===void 0){if(s.isStackNode!==!0&&e==="assign")return(...n)=>(ha.assign(t,...n),t);if(Xo.has(e)){const n=Xo.get(e);return s.isStackNode?(...i)=>t.add(n(...i)):(...i)=>n(t,...i)}else{if(e==="self")return s;if(e.endsWith("Assign")&&Xo.has(e.slice(0,e.length-6))){const n=Xo.get(e.slice(0,e.length-6));return s.isStackNode?(...i)=>t.assign(i[0],n(...i)):(...i)=>t.assign(n(t,...i))}else{if(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0)return e=Yv(e),H(new ph(t,e));if(/^set[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=e_(e.slice(3).toLowerCase()),n=>H(new $v(s,e,n));if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=e_(e.slice(4).toLowerCase()),()=>H(new wP(H(s),e));if(e==="width"||e==="height"||e==="depth")return e==="width"?e="x":e==="height"?e="y":e==="depth"&&(e="z"),H(new ph(s,e));if(/^\d+$/.test(e)===!0)return H(new gr(t,new Wi(Number(e),"uint")))}}}return Reflect.get(s,e,t)},set(s,e,t,n){return typeof e=="string"&&s[e]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0||e==="width"||e==="height"||e==="depth"||/^\d+$/.test(e)===!0)?(n[e].assign(t),!0):Reflect.set(s,e,t,n)}},Vp=new WeakMap,t_=new WeakMap,AP=function(s,e=null){const t=Ps(s);if(t==="node"){let n=Vp.get(s);return n===void 0&&(n=new Proxy(s,Zv),Vp.set(s,n),Vp.set(n,n)),n}else{if(e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string")return H(Mf(s,e));if(t==="shader")return U(s)}return s},NP=function(s,e=null){for(const t in s)s[t]=H(s[t],e);return s},EP=function(s,e=null){const t=s.length;for(let n=0;n<t;n++)s[n]=H(s[n],e);return s},CP=function(s,e=null,t=null,n=null){const i=r=>H(n!==null?Object.assign(r,n):r);return e===null?(...r)=>i(new s(...Zr(r))):t!==null?(t=H(t),(...r)=>i(new s(e,...Zr(r),t))):(...r)=>i(new s(e,...Zr(r)))},RP=function(s,...e){return H(new s(...Zr(e)))};class IP extends Ye{constructor(e,t){super(),this.shaderNode=e,this.inputNodes=t}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}call(e){const{shaderNode:t,inputNodes:n}=this,i=e.getNodeProperties(t);if(i.onceOutput)return i.onceOutput;let r=null;if(t.layout){let o=t_.get(e.constructor);o===void 0&&(o=new WeakMap,t_.set(e.constructor,o));let a=o.get(t);a===void 0&&(a=H(e.buildFunctionNode(t)),o.set(t,a)),e.currentFunctionNode!==null&&e.currentFunctionNode.includes.push(a),r=H(a.call(n))}else{const o=t.jsFunc,a=n!==null?o(n,e):o(e);r=H(a)}return t.once&&(i.onceOutput=r),r}getOutputNode(e){const t=e.getNodeProperties(this);return t.outputNode===null&&(t.outputNode=this.setupOutput(e)),t.outputNode}setup(e){return this.getOutputNode(e)}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}generate(e,t){return this.getOutputNode(e).build(e,t)}}class PP extends Ye{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}call(e=null){return ol(e),H(new IP(this,e))}setup(){return this.call()}}const LP=[!1,!0],DP=[0,1,2,3],UP=[-1,-2],Jv=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],Qm=new Map;for(const s of LP)Qm.set(s,new Wi(s));const eg=new Map;for(const s of DP)eg.set(s,new Wi(s,"uint"));const tg=new Map([...eg].map(s=>new Wi(s.value,"int")));for(const s of UP)tg.set(s,new Wi(s,"int"));const wd=new Map([...tg].map(s=>new Wi(s.value)));for(const s of Jv)wd.set(s,new Wi(s));for(const s of Jv)wd.set(-s,new Wi(-s));const Ad={bool:Qm,uint:eg,ints:tg,float:wd},n_=new Map([...Qm,...wd]),Mf=(s,e)=>n_.has(s)?n_.get(s):s.isNode===!0?s:new Wi(s,e),FP=s=>{try{return s.getNodeType()}catch{return}},un=function(s,e=null){return(...t)=>{if((t.length===0||!["bool","float","int","uint"].includes(s)&&t.every(i=>typeof i!="object"))&&(t=[$m(s,...t)]),t.length===1&&e!==null&&e.has(t[0]))return H(e.get(t[0]));if(t.length===1){const i=Mf(t[0],s);return FP(i)===s?H(i):H(new Km(i,s))}const n=t.map(i=>Mf(i));return H(new qv(n,s))}},Vc=s=>typeof s=="object"&&s!==null?s.value:s,Kv=s=>s!=null?s.nodeType||s.convertTo||(typeof s=="string"?s:null):null;function tc(s,e){return new Proxy(new PP(s,e),Zv)}const H=(s,e=null)=>AP(s,e),ol=(s,e=null)=>new NP(s,e),Zr=(s,e=null)=>new EP(s,e),K=(...s)=>new CP(...s),fe=(...s)=>new RP(...s),U=(s,e)=>{const t=new tc(s,e),n=(...i)=>{let r;return ol(i),i[0]&&i[0].isNode?r=[...i]:r=i[0],t.call(r)};return n.shaderNode=t,n.setLayout=i=>(t.setLayout(i),n),n.once=()=>(t.once=!0,n),n},OP=(...s)=>(console.warn("TSL.ShaderNode: tslFn() has been renamed to Fn()."),U(...s));te("toGlobal",s=>(s.global=!0,s));const Bc=s=>{ha=s},ng=()=>ha,Oe=(...s)=>ha.If(...s);function jv(s){return ha&&ha.add(s),s}te("append",jv);const Qv=new un("color"),A=new un("float",Ad.float),L=new un("int",Ad.ints),ve=new un("uint",Ad.uint),lr=new un("bool",Ad.bool),z=new un("vec2"),us=new un("ivec2"),eM=new un("uvec2"),tM=new un("bvec2"),D=new un("vec3"),nM=new un("ivec3"),Aa=new un("uvec3"),ig=new un("bvec3"),oe=new un("vec4"),iM=new un("ivec4"),sM=new un("uvec4"),rM=new un("bvec4"),al=new un("mat2"),Tn=new un("mat3"),Jr=new un("mat4"),VP=(s="")=>H(new Wi(s,"string")),BP=s=>H(new Wi(s,"ArrayBuffer"));te("toColor",Qv);te("toFloat",A);te("toInt",L);te("toUint",ve);te("toBool",lr);te("toVec2",z);te("toIVec2",us);te("toUVec2",eM);te("toBVec2",tM);te("toVec3",D);te("toIVec3",nM);te("toUVec3",Aa);te("toBVec3",ig);te("toVec4",oe);te("toIVec4",iM);te("toUVec4",sM);te("toBVec4",rM);te("toMat2",al);te("toMat3",Tn);te("toMat4",Jr);const oM=K(gr),aM=(s,e)=>H(new Km(H(s),e)),zP=(s,e)=>H(new ph(H(s),e));te("element",oM);te("convert",aM);class sg extends Ye{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1){super("string"),this.name=e,this.version=0,this.shared=t,this.order=n,this.isUniformGroup=!0}set needsUpdate(e){e===!0&&this.version++}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const cM=s=>new sg(s),rg=(s,e=0)=>new sg(s,!0,e),kP=rg("frame"),_t=rg("render"),lM=cM("object");class ho extends jm{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=lM}label(e){return this.name=e,this}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){const n=this.getSelf();return e=e.bind(n),super.onUpdate(i=>{const r=e(i,n);r!==void 0&&(this.value=r)},t)}generate(e,t){const n=this.getNodeType(e),i=this.getUniformHash(e);let r=e.getNodeFromHash(i);r===void 0&&(e.setHashNode(this,i),r=this);const o=r.getInputType(e),a=e.getUniformFromNode(r,o,e.shaderStage,this.name||e.context.label),c=e.getPropertyName(a);return e.context.label!==void 0&&delete e.context.label,e.format(c,n,t)}}const pe=(s,e)=>{const t=Kv(e||s),n=s&&s.isNode===!0?s.node&&s.node.value||s.value:s;return H(new ho(n,t))};class Nt extends Ye{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1){super(e),this.name=t,this.varying=n,this.isPropertyNode=!0}getHash(e){return this.name||super.getHash(e)}isGlobal(){return!0}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const ai=(s,e)=>H(new Nt(s,e)),Zi=(s,e)=>H(new Nt(s,e,!0)),Ct=fe(Nt,"vec4","DiffuseColor"),Sf=fe(Nt,"vec3","EmissiveColor"),ds=fe(Nt,"float","Roughness"),zc=fe(Nt,"float","Metalness"),fh=fe(Nt,"float","Clearcoat"),kc=fe(Nt,"float","ClearcoatRoughness"),qr=fe(Nt,"vec3","Sheen"),Nd=fe(Nt,"float","SheenRoughness"),Ed=fe(Nt,"float","Iridescence"),og=fe(Nt,"float","IridescenceIOR"),ag=fe(Nt,"float","IridescenceThickness"),mh=fe(Nt,"float","AlphaT"),Zs=fe(Nt,"float","Anisotropy"),nc=fe(Nt,"vec3","AnisotropyT"),Kr=fe(Nt,"vec3","AnisotropyB"),ri=fe(Nt,"color","SpecularColor"),Gc=fe(Nt,"float","SpecularF90"),gh=fe(Nt,"float","Shininess"),cg=fe(Nt,"vec4","Output"),jr=fe(Nt,"float","dashSize"),Hc=fe(Nt,"float","gapSize"),GP=fe(Nt,"float","pointWidth"),ic=fe(Nt,"float","IOR"),xh=fe(Nt,"float","Transmission"),lg=fe(Nt,"float","Thickness"),ug=fe(Nt,"float","AttenuationDistance"),hg=fe(Nt,"color","AttenuationColor"),dg=fe(Nt,"float","Dispersion");class uM extends pt{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t}hasDependencies(){return!1}getNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){const n=e.getTypeLength(t.node.getNodeType(e));return wa.join("").slice(0,n)!==t.components}return!1}generate(e,t){const{targetNode:n,sourceNode:i}=this,r=this.needsSplitAssign(e),o=n.getNodeType(e),a=n.context({assign:!0}).build(e),c=i.build(e,o),l=i.getNodeType(e),u=e.getDataFromNode(this);let h;if(u.initialized===!0)t!=="void"&&(h=a);else if(r){const d=e.getVarFromNode(this,null,o),p=e.getPropertyName(d);e.addLineFlowCode(`${p} = ${c}`,this);const f=n.node.context({assign:!0}).build(e);for(let x=0;x<n.components.length;x++){const m=n.components[x];e.addLineFlowCode(`${f}.${m} = ${p}[ ${x} ]`,this)}t!=="void"&&(h=a)}else h=`${a} = ${c}`,(t==="void"||l==="void")&&(e.addLineFlowCode(h,this),t!=="void"&&(h=a));return u.initialized=!0,e.format(h,o,t)}}const hM=K(uM);te("assign",hM);class dM extends pt{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}generate(e){const t=[],n=this.functionNode,i=n.getInputs(e),r=this.parameters;if(Array.isArray(r))for(let a=0;a<r.length;a++){const c=i[a],l=r[a];t.push(l.build(e,c.type))}else for(const a of i){const c=r[a.name];if(c!==void 0)t.push(c.build(e,a.type));else throw new Error(`FunctionCallNode: Input '${a.name}' not found in FunctionNode.`)}return`${n.build(e,"property")}( ${t.join(", ")} )`}}const pM=(s,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?Zr(e):ol(e[0]),H(new dM(H(s),e)));te("call",pM);class qt extends pt{static get type(){return"OperatorNode"}constructor(e,t,n,...i){if(super(),i.length>0){let r=new qt(e,t,n);for(let o=0;o<i.length-1;o++)r=new qt(e,r,i[o]);t=r,n=i[i.length-1]}this.op=e,this.aNode=t,this.bNode=n}getNodeType(e,t){const n=this.op,i=this.aNode,r=this.bNode,o=i.getNodeType(e),a=typeof r<"u"?r.getNodeType(e):null;if(o==="void"||a==="void")return"void";if(n==="%")return o;if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(o);if(n==="!"||n==="=="||n==="&&"||n==="||"||n==="^^")return"bool";if(n==="<"||n===">"||n==="<="||n===">="){const c=t?e.getTypeLength(t):Math.max(e.getTypeLength(o),e.getTypeLength(a));return c>1?`bvec${c}`:"bool"}else return o==="float"&&e.isMatrix(a)?a:e.isMatrix(o)&&e.isVector(a)?e.getVectorFromMatrix(o):e.isVector(o)&&e.isMatrix(a)?e.getVectorFromMatrix(a):e.getTypeLength(a)>e.getTypeLength(o)?a:o}generate(e,t){const n=this.op,i=this.aNode,r=this.bNode,o=this.getNodeType(e,t);let a=null,c=null;o!=="void"?(a=i.getNodeType(e),c=typeof r<"u"?r.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="?e.isVector(a)?c=a:a!==c&&(a=c="float"):n===">>"||n==="<<"?(a=o,c=e.changeComponentType(c,"uint")):e.isMatrix(a)&&e.isVector(c)?c=e.getVectorFromMatrix(a):e.isVector(a)&&e.isMatrix(c)?a=e.getVectorFromMatrix(c):a=c=o):a=c=o;const l=i.build(e,a),u=typeof r<"u"?r.build(e,c):null,h=e.getTypeLength(t),d=e.getFunctionOperator(n);if(t!=="void")return n==="<"&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThan",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} < ${u} )`,o,t):n==="<="&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThanEqual",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} <= ${u} )`,o,t):n===">"&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThan",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} > ${u} )`,o,t):n===">="&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThanEqual",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} >= ${u} )`,o,t):n==="!"||n==="~"?e.format(`(${n}${l})`,a,t):d?e.format(`${d}( ${l}, ${u} )`,o,t):e.format(`( ${l} ${n} ${u} )`,o,t);if(a!=="void")return d?e.format(`${d}( ${l}, ${u} )`,o,t):e.format(`${l} ${n} ${u}`,o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const Wt=K(qt,"+"),Ft=K(qt,"-"),ot=K(qt,"*"),ns=K(qt,"/"),pg=K(qt,"%"),fM=K(qt,"=="),mM=K(qt,"!="),gM=K(qt,"<"),fg=K(qt,">"),xM=K(qt,"<="),_M=K(qt,">="),yM=K(qt,"&&"),vM=K(qt,"||"),MM=K(qt,"!"),SM=K(qt,"^^"),TM=K(qt,"&"),bM=K(qt,"~"),wM=K(qt,"|"),AM=K(qt,"^"),NM=K(qt,"<<"),EM=K(qt,">>");te("add",Wt);te("sub",Ft);te("mul",ot);te("div",ns);te("modInt",pg);te("equal",fM);te("notEqual",mM);te("lessThan",gM);te("greaterThan",fg);te("lessThanEqual",xM);te("greaterThanEqual",_M);te("and",yM);te("or",vM);te("not",MM);te("xor",SM);te("bitAnd",TM);te("bitNot",bM);te("bitOr",wM);te("bitXor",AM);te("shiftLeft",NM);te("shiftRight",EM);const CM=(...s)=>(console.warn("TSL.OperatorNode: .remainder() has been renamed to .modInt()."),pg(...s));te("remainder",CM);class V extends pt{static get type(){return"MathNode"}constructor(e,t,n=null,i=null){super(),this.method=e,this.aNode=t,this.bNode=n,this.cNode=i}getInputType(e){const t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,i=this.cNode?this.cNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(n)?0:e.getTypeLength(n),a=e.isMatrix(i)?0:e.getTypeLength(i);return r>o&&r>a?t:o>a?n:a>r?i:t}getNodeType(e){const t=this.method;return t===V.LENGTH||t===V.DISTANCE||t===V.DOT?"float":t===V.CROSS?"vec3":t===V.ALL?"bool":t===V.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):t===V.MOD?this.aNode.getNodeType(e):this.getInputType(e)}generate(e,t){const n=this.method,i=this.getNodeType(e),r=this.getInputType(e),o=this.aNode,a=this.bNode,c=this.cNode,l=e.renderer.isWebGLRenderer===!0;if(n===V.TRANSFORM_DIRECTION){let u=o,h=a;e.isMatrix(u.getNodeType(e))?h=oe(D(h),0):u=oe(D(u),0);const d=ot(u,h).xyz;return vi(d).build(e,t)}else{if(n===V.NEGATE)return e.format("( - "+o.build(e,r)+" )",i,t);if(n===V.ONE_MINUS)return Ft(1,o).build(e,t);if(n===V.RECIPROCAL)return ns(1,o).build(e,t);if(n===V.DIFFERENCE)return Dt(Ft(o,a)).build(e,t);{const u=[];return n===V.CROSS||n===V.MOD?u.push(o.build(e,i),a.build(e,i)):l&&n===V.STEP?u.push(o.build(e,e.getTypeLength(o.getNodeType(e))===1?"float":r),a.build(e,r)):l&&(n===V.MIN||n===V.MAX)||n===V.MOD?u.push(o.build(e,r),a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":r)):n===V.REFRACT?u.push(o.build(e,r),a.build(e,r),c.build(e,"float")):n===V.MIX?u.push(o.build(e,r),a.build(e,r),c.build(e,e.getTypeLength(c.getNodeType(e))===1?"float":r)):(u.push(o.build(e,r)),a!==null&&u.push(a.build(e,r)),c!==null&&u.push(c.build(e,r))),e.format(`${e.getMethod(n,i)}( ${u.join(", ")} )`,i,t)}}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}V.ALL="all";V.ANY="any";V.EQUALS="equals";V.RADIANS="radians";V.DEGREES="degrees";V.EXP="exp";V.EXP2="exp2";V.LOG="log";V.LOG2="log2";V.SQRT="sqrt";V.INVERSE_SQRT="inversesqrt";V.FLOOR="floor";V.CEIL="ceil";V.NORMALIZE="normalize";V.FRACT="fract";V.SIN="sin";V.COS="cos";V.TAN="tan";V.ASIN="asin";V.ACOS="acos";V.ATAN="atan";V.ABS="abs";V.SIGN="sign";V.LENGTH="length";V.NEGATE="negate";V.ONE_MINUS="oneMinus";V.DFDX="dFdx";V.DFDY="dFdy";V.ROUND="round";V.RECIPROCAL="reciprocal";V.TRUNC="trunc";V.FWIDTH="fwidth";V.BITCAST="bitcast";V.TRANSPOSE="transpose";V.ATAN2="atan2";V.MIN="min";V.MAX="max";V.MOD="mod";V.STEP="step";V.REFLECT="reflect";V.DISTANCE="distance";V.DIFFERENCE="difference";V.DOT="dot";V.CROSS="cross";V.POW="pow";V.TRANSFORM_DIRECTION="transformDirection";V.MIX="mix";V.CLAMP="clamp";V.REFRACT="refract";V.SMOOTHSTEP="smoothstep";V.FACEFORWARD="faceforward";const RM=A(1e-6),HP=A(1e6),no=A(Math.PI),WP=A(Math.PI*2),mg=K(V,V.ALL),IM=K(V,V.ANY),PM=K(V,V.EQUALS),LM=K(V,V.RADIANS),DM=K(V,V.DEGREES),gg=K(V,V.EXP),_h=K(V,V.EXP2),xg=K(V,V.LOG),cl=K(V,V.LOG2),os=K(V,V.SQRT),UM=K(V,V.INVERSE_SQRT),xr=K(V,V.FLOOR),_g=K(V,V.CEIL),vi=K(V,V.NORMALIZE),_r=K(V,V.FRACT),Cn=K(V,V.SIN),Mi=K(V,V.COS),FM=K(V,V.TAN),OM=K(V,V.ASIN),yh=K(V,V.ACOS),VM=K(V,V.ATAN),Dt=K(V,V.ABS),ll=K(V,V.SIGN),Qr=K(V,V.LENGTH),BM=K(V,V.NEGATE),zM=K(V,V.ONE_MINUS),kM=K(V,V.DFDX),GM=K(V,V.DFDY),HM=K(V,V.ROUND),WM=K(V,V.RECIPROCAL),yg=K(V,V.TRUNC),XM=K(V,V.FWIDTH),XP=K(V,V.BITCAST),qM=K(V,V.TRANSPOSE),$M=K(V,V.ATAN2),Mn=K(V,V.MIN),ft=K(V,V.MAX),Cd=K(V,V.MOD),ul=K(V,V.STEP),YM=K(V,V.REFLECT),ZM=K(V,V.DISTANCE),JM=K(V,V.DIFFERENCE),$t=K(V,V.DOT),ea=K(V,V.CROSS),jn=K(V,V.POW),vg=K(V,V.POW,2),KM=K(V,V.POW,3),jM=K(V,V.POW,4),QM=K(V,V.TRANSFORM_DIRECTION),eS=s=>ot(ll(s),jn(Dt(s),1/3)),Mg=s=>$t(s,s),it=K(V,V.MIX),cn=(s,e=0,t=1)=>H(new V(V.CLAMP,H(s),H(e),H(t))),tS=s=>cn(s),Sg=K(V,V.REFRACT),ti=K(V,V.SMOOTHSTEP),nS=K(V,V.FACEFORWARD),Tg=U(([s])=>{const n=43758.5453,i=$t(s.xy,z(12.9898,78.233)),r=Cd(i,no);return _r(Cn(r).mul(n))}),iS=(s,e,t)=>it(e,t,s),sS=(s,e,t)=>ti(e,t,s);te("all",mg);te("any",IM);te("equals",PM);te("radians",LM);te("degrees",DM);te("exp",gg);te("exp2",_h);te("log",xg);te("log2",cl);te("sqrt",os);te("inverseSqrt",UM);te("floor",xr);te("ceil",_g);te("normalize",vi);te("fract",_r);te("sin",Cn);te("cos",Mi);te("tan",FM);te("asin",OM);te("acos",yh);te("atan",VM);te("abs",Dt);te("sign",ll);te("length",Qr);te("lengthSq",Mg);te("negate",BM);te("oneMinus",zM);te("dFdx",kM);te("dFdy",GM);te("round",HM);te("reciprocal",WM);te("trunc",yg);te("fwidth",XM);te("atan2",$M);te("min",Mn);te("max",ft);te("mod",Cd);te("step",ul);te("reflect",YM);te("distance",ZM);te("dot",$t);te("cross",ea);te("pow",jn);te("pow2",vg);te("pow3",KM);te("pow4",jM);te("transformDirection",QM);te("mix",iS);te("clamp",cn);te("refract",Sg);te("smoothstep",sS);te("faceForward",nS);te("difference",JM);te("saturate",tS);te("cbrt",eS);te("transpose",qM);te("rand",Tg);class qP extends Ye{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}getNodeType(e){const t=this.ifNode.getNodeType(e);if(this.elseNode!==null){const n=this.elseNode.getNodeType(e);if(e.getTypeLength(n)>e.getTypeLength(t))return n}return t}setup(e){const t=this.condNode.cache(),n=this.ifNode.cache(),i=this.elseNode?this.elseNode.cache():null,r=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=r,i!==null&&(e.getDataFromNode(i).parentNodeBlock=r);const o=e.getNodeProperties(this);o.condNode=t,o.ifNode=n.context({nodeBlock:n}),o.elseNode=i?i.context({nodeBlock:i}):null}generate(e,t){const n=this.getNodeType(e),i=e.getDataFromNode(this);if(i.nodeProperty!==void 0)return i.nodeProperty;const{condNode:r,ifNode:o,elseNode:a}=e.getNodeProperties(this),c=t!=="void",l=c?ai(n).build(e):"";i.nodeProperty=l;const u=r.build(e,"bool");e.addFlowCode(`
|
|
3844
3844
|
${e.tab}if ( ${u} ) {
|
|
3845
3845
|
|
|
3846
3846
|
`).addFlowTab();let h=o.build(e,n);if(h&&(c?h=l+" = "+h+";":h="return "+h+";"),e.removeFlowTab().addFlowCode(e.tab+" "+h+`
|
|
@@ -3867,4 +3867,4 @@ ${e.tab}if ( ${u} ) {
|
|
|
3867
3867
|
`}}class Ib{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.startTime=null,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return n===void 0&&(n={renderMap:new WeakMap,frameMap:new WeakMap},e.set(t,n)),n}updateBeforeNode(e){const t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===We.FRAME){const{frameMap:i}=this._getMaps(this.updateBeforeMap,n);i.get(n)!==this.frameId&&e.updateBefore(this)!==!1&&i.set(n,this.frameId)}else if(t===We.RENDER){const{renderMap:i}=this._getMaps(this.updateBeforeMap,n);i.get(n)!==this.renderId&&e.updateBefore(this)!==!1&&i.set(n,this.renderId)}else t===We.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===We.FRAME){const{frameMap:i}=this._getMaps(this.updateAfterMap,n);i.get(n)!==this.frameId&&e.updateAfter(this)!==!1&&i.set(n,this.frameId)}else if(t===We.RENDER){const{renderMap:i}=this._getMaps(this.updateAfterMap,n);i.get(n)!==this.renderId&&e.updateAfter(this)!==!1&&i.set(n,this.renderId)}else t===We.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),n=e.updateReference(this);if(t===We.FRAME){const{frameMap:i}=this._getMaps(this.updateMap,n);i.get(n)!==this.frameId&&e.update(this)!==!1&&i.set(n,this.frameId)}else if(t===We.RENDER){const{renderMap:i}=this._getMaps(this.updateMap,n);i.get(n)!==this.renderId&&e.update(this)!==!1&&i.set(n,this.renderId)}else t===We.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class t0{constructor(e,t,n=null,i="",r=!1){this.type=e,this.name=t,this.count=n,this.qualifier=i,this.isConst=r}}t0.isNodeFunctionInput=!0;class D3 extends Ye{static get type(){return"StructTypeNode"}constructor(e){super(),this.types=e,this.isStructTypeNode=!0}getMemberTypes(){return this.types}}class n0 extends Ye{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}setup(e){super.setup(e);const t=this.members,n=[];for(let i=0;i<t.length;i++)n.push(t[i].getNodeType(e));this.nodeType=e.getStructTypeFromNode(new D3(n)).name}generate(e,t){const n=e.getOutputStructName(),i=this.members,r=n!==""?n+".":"";for(let o=0;o<i.length;o++){const a=i[o].build(e,t);e.addLineFlowCode(`${r}m${o} = ${a}`,this)}return n}}const U3=K(n0);function i0(s,e){for(let t=0;t<s.length;t++)if(s[t].name===e)return t;return-1}class Pb extends n0{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.isMRTNode=!0}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){const t={...this.outputNodes,...e.outputNodes};return kd(t)}setup(e){const t=this.outputNodes,n=e.renderer.getRenderTarget(),i=[],r=n.textures;for(const o in t){const a=i0(r,o);i[a]=oe(t[o])}return this.members=i,super.setup(e)}}const kd=K(Pb);class Lb extends Ye{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFnCall=null,this.global=!0}getNodeType(){return this.functionNodes[0].shaderNode.layout.type}setup(e){const t=this.parametersNodes;let n=this._candidateFnCall;if(n===null){let i=null,r=-1;for(const o of this.functionNodes){const c=o.shaderNode.layout;if(c===null)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const l=c.inputs;if(t.length===l.length){let u=0;for(let h=0;h<t.length;h++){const d=t[h],p=l[h];d.getNodeType(e)===p.type?u++:u=0}u>r&&(i=o,r=u)}}this._candidateFnCall=n=i(...t)}return n}}const F3=K(Lb),On=s=>(...e)=>F3(s,...e);class Sn extends ho{static get type(){return"TimerNode"}constructor(e=Sn.LOCAL,t=1,n=0){super(n),this.scope=e,this.scale=t,this.updateType=We.FRAME}update(e){const t=this.scope,n=this.scale;t===Sn.LOCAL?this.value+=e.deltaTime*n:t===Sn.DELTA?this.value=e.deltaTime*n:t===Sn.FRAME?this.value=e.frameId:this.value=e.time*n}serialize(e){super.serialize(e),e.scope=this.scope,e.scale=this.scale}deserialize(e){super.deserialize(e),this.scope=e.scope,this.scale=e.scale}}Sn.LOCAL="local";Sn.GLOBAL="global";Sn.DELTA="delta";Sn.FRAME="frame";const s0=(s,e=0)=>H(new Sn(Sn.LOCAL,s,e)),O3=(s,e=0)=>H(new Sn(Sn.GLOBAL,s,e)),V3=(s,e=0)=>H(new Sn(Sn.DELTA,s,e)),B3=fe(Sn,Sn.FRAME).toUint();class pn extends Ye{static get type(){return"OscNode"}constructor(e=pn.SINE,t=s0()){super(),this.method=e,this.timeNode=t}getNodeType(e){return this.timeNode.getNodeType(e)}setup(){const e=this.method,t=H(this.timeNode);let n=null;return e===pn.SINE?n=t.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5):e===pn.SQUARE?n=t.fract().round():e===pn.TRIANGLE?n=t.add(.5).fract().mul(2).sub(1).abs():e===pn.SAWTOOTH&&(n=t.fract()),n}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}pn.SINE="sine";pn.SQUARE="square";pn.TRIANGLE="triangle";pn.SAWTOOTH="sawtooth";const z3=K(pn,pn.SINE),k3=K(pn,pn.SQUARE),G3=K(pn,pn.TRIANGLE),H3=K(pn,pn.SAWTOOTH);class Db extends Ye{static get type(){return"SpriteSheetUVNode"}constructor(e,t=rt(),n=A(0)){super("vec2"),this.countNode=e,this.uvNode=t,this.frameNode=n}setup(){const{frameNode:e,uvNode:t,countNode:n}=this,{width:i,height:r}=n,o=e.mod(i.mul(r)).floor(),a=o.mod(i),c=r.sub(o.add(1).div(i).ceil()),l=n.reciprocal(),u=z(a,c);return t.add(u).mul(l)}}const W3=K(Db);class Ub extends gr{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.bufferObject===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n;const i=e.context.assign;if(e.isAvailable("storageBuffer")===!1?this.node.bufferObject===!0&&i!==!0?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),i!==!0){const r=this.getNodeType(e);n=e.format(n,r,t)}return n}}const X3=K(Ub);class Fb extends Ye{static get type(){return"TriplanarTexturesNode"}constructor(e,t=null,n=null,i=A(1),r=en,o=hi){super("vec4"),this.textureXNode=e,this.textureYNode=t,this.textureZNode=n,this.scaleNode=i,this.positionNode=r,this.normalNode=o}setup(){const{textureXNode:e,textureYNode:t,textureZNode:n,scaleNode:i,positionNode:r,normalNode:o}=this;let a=o.abs().normalize();a=a.div(a.dot(D(1)));const c=r.yz.mul(i),l=r.zx.mul(i),u=r.xy.mul(i),h=e.value,d=t!==null?t.value:h,p=n!==null?n.value:h,f=xt(h,c).mul(a.x),x=xt(d,l).mul(a.y),m=xt(p,u).mul(a.z);return Wt(f,x,m)}}const Ob=K(Fb),q3=(...s)=>Ob(...s),Fo=new ls,Lr=new E,Oo=new E,Qp=new E,qa=new Fe,wu=new E(0,0,-1),Cs=new st,$a=new E,Au=new E,Ya=new st,Nu=new J,P_=new fn,$3=yr.flipX();let ef=!1;class Vb extends _s{static get type(){return"ReflectorNode"}constructor(e={}){super(P_.texture,$3);const{target:t=new yt,resolution:n=1,generateMipmaps:i=!1,bounces:r=!0}=e;this.target=t,this.resolution=n,this.generateMipmaps=i,this.bounces=r,this.updateBeforeType=r?We.RENDER:We.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new WeakMap}_updateResolution(e,t){const n=this.resolution;t.getDrawingBufferSize(Nu),e.setSize(Math.round(Nu.width*n),Math.round(Nu.height*n))}setup(e){return this._updateResolution(P_,e.renderer),super.setup(e)}getTextureNode(){return this.textureNode}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new fn(0,0,{type:Ln}),this.generateMipmaps===!0&&(t.texture.minFilter=Hf,t.texture.generateMipmaps=!0),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&ef)return!1;ef=!0;const{scene:t,camera:n,renderer:i,material:r}=e,{target:o}=this,a=this.getVirtualCamera(n),c=this.getRenderTarget(a);if(i.getDrawingBufferSize(Nu),this._updateResolution(c,i),Oo.setFromMatrixPosition(o.matrixWorld),Qp.setFromMatrixPosition(n.matrixWorld),qa.extractRotation(o.matrixWorld),Lr.set(0,0,1),Lr.applyMatrix4(qa),$a.subVectors(Oo,Qp),$a.dot(Lr)>0)return;$a.reflect(Lr).negate(),$a.add(Oo),qa.extractRotation(n.matrixWorld),wu.set(0,0,-1),wu.applyMatrix4(qa),wu.add(Qp),Au.subVectors(Oo,wu),Au.reflect(Lr).negate(),Au.add(Oo),a.coordinateSystem=n.coordinateSystem,a.position.copy($a),a.up.set(0,1,0),a.up.applyMatrix4(qa),a.up.reflect(Lr),a.lookAt(Au),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),Fo.setFromNormalAndCoplanarPoint(Lr,Oo),Fo.applyMatrix4(a.matrixWorldInverse),Cs.set(Fo.normal.x,Fo.normal.y,Fo.normal.z,Fo.constant);const l=a.projectionMatrix;Ya.x=(Math.sign(Cs.x)+l.elements[8])/l.elements[0],Ya.y=(Math.sign(Cs.y)+l.elements[9])/l.elements[5],Ya.z=-1,Ya.w=(1+l.elements[10])/l.elements[14],Cs.multiplyScalar(1/Cs.dot(Ya));const u=0;l.elements[2]=Cs.x,l.elements[6]=Cs.y,l.elements[10]=Cs.z-u,l.elements[14]=Cs.w,this.value=c.texture,r.visible=!1;const h=i.getRenderTarget(),d=i.getMRT();i.setMRT(null),i.setRenderTarget(c),i.render(t,a),i.setMRT(d),i.setRenderTarget(h),r.visible=!0,ef=!1}}const Y3=s=>H(new Vb(s)),tf=new ao(-1,1,1,-1,0,1);class Z3 extends at{constructor(e=!1){super();const t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Ve([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ve(t,2))}}const J3=new Z3;class Ms extends kt{constructor(e=null){super(J3,e),this.camera=tf,this.isQuadMesh=!0}renderAsync(e){return e.renderAsync(this,tf)}render(e){e.render(this,tf)}}const K3=new J;class Bb extends _s{static get type(){return"RTTNode"}constructor(e,t=null,n=null,i={type:Ln}){const r=new fn(t,n,i);super(r.texture,rt()),this.node=e,this.width=t,this.height=n,this.renderTarget=r,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this.updateMap=new WeakMap,this._rttNode=null,this._quadMesh=new Ms(new Tt),this.updateBeforeType=We.RENDER}get autoSize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;const n=e*this.pixelRatio,i=t*this.pixelRatio;this.renderTarget.setSize(n,i),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;if(this.textureNeedsUpdate=!1,this.autoSize===!0){this.pixelRatio=e.getPixelRatio();const n=e.getSize(K3);this.setSize(n.width,n.height)}this._quadMesh.material.fragmentNode=this._rttNode;const t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){const e=new _s(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const zb=(s,...e)=>H(new Bb(H(s),...e)),ei=(s,...e)=>s.isTextureNode?s:zb(s,...e);class kb extends Rg{static get type(){return"VertexColorNode"}constructor(e=0){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){const e=this.index;return"color"+(e>0?e:"")}generate(e){const t=this.getAttributeName(e),n=e.hasGeometryAttribute(t);let i;return n===!0?i=super.generate(e):i=e.generateConst(this.nodeType,new st(1,1,1,1)),i}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const j3=(...s)=>H(new kb(...s));class Gb extends Ye{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const Q3=fe(Gb);class Qi extends Ye{static get type(){return"SceneNode"}constructor(e=Qi.BACKGROUND_BLURRINESS,t=null){super(),this.scope=e,this.scene=t}setup(e){const t=this.scope,n=this.scene!==null?this.scene:e.scene;let i;return t===Qi.BACKGROUND_BLURRINESS?i=dn("backgroundBlurriness","float",n):t===Qi.BACKGROUND_INTENSITY?i=dn("backgroundIntensity","float",n):console.error("THREE.SceneNode: Unknown scope:",t),i}}Qi.BACKGROUND_BLURRINESS="backgroundBlurriness";Qi.BACKGROUND_INTENSITY="backgroundIntensity";const eD=fe(Qi,Qi.BACKGROUND_BLURRINESS),tD=fe(Qi,Qi.BACKGROUND_INTENSITY),L_={Storage:"storage",ReadOnlyStorage:"read-only-storage"},nf={WriteOnly:"write-only",ReadOnly:"read-only"};class r0 extends Ld{static get type(){return"StorageBufferNode"}constructor(e,t,n=0){super(e,t,n),this.isStorageBufferNode=!0,this.access=L_.Storage,this.isAtomic=!1,this.bufferObject=!1,this.bufferCount=n,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){if(this.bufferCount===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getInputType(){return"storageBuffer"}element(e){return X3(this,e)}setBufferObject(e){return this.bufferObject=e,this}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(L_.ReadOnlyStorage)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}generate(e){if(e.isAvailable("storageBuffer"))return super.generate(e);const t=this.getNodeType(e);this._attribute===null&&(this._attribute=pl(this.value),this._varying=Un(this._attribute));const n=this._varying.build(e,t);return e.registerTransform(n,this._attribute),n}}const nD=(s,e,t)=>H(new r0(s,e,t)),iD=(s,e,t)=>H(new r0(s,e,t).setBufferObject(!0));class Hb extends _s{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.isStorageTextureNode=!0,this.access=nf.WriteOnly}getInputType(){return"storageTexture"}setup(e){super.setup(e);const t=e.getNodeProperties(this);t.storeNode=this.storeNode}setAccess(e){return this.access=e,this}generate(e,t){let n;return this.storeNode!==null?n=this.generateStore(e):n=super.generate(e,t),n}toReadOnly(){return this.setAccess(nf.ReadOnly)}toWriteOnly(){return this.setAccess(nf.WriteOnly)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:n,storeNode:i}=t,r=super.generate(e,"property"),o=n.build(e,"uvec2"),a=i.build(e,"vec4"),c=e.generateTextureStore(e,r,o,a);e.addLineFlowCode(c,this)}}const Wb=K(Hb),sD=(s,e,t)=>{const n=Wb(s,e,t);return t!==null&&n.append(),n};class Xb extends gl{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}}const rD=(s,e,t)=>H(new Xb(s,e,t));class qb extends pt{static get type(){return"PosterizeNode"}constructor(e,t){super(),this.sourceNode=e,this.stepsNode=t}setup(){const{sourceNode:e,stepsNode:t}=this;return e.mul(t).floor().div(t)}}const oD=K(qb);let sf=null;class $b extends Ml{static get type(){return"ViewportSharedTextureNode"}constructor(e=yr,t=null){sf===null&&(sf=new _m),super(e,t,sf)}updateReference(){return this}}const aD=K($b),cD=new J;class Yb extends _s{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.setUpdateMatrix(!1)}setup(e){return e.object.isQuadMesh&&this.passNode.build(e),super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class D_ extends Yb{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){return new this.constructor(this.passNode,this.textureName,this.previousTexture)}}class bn extends pt{static get type(){return"PassNode"}constructor(e,t,n,i={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=i,this._pixelRatio=1,this._width=1,this._height=1;const r=new co;r.isRenderTargetTexture=!0,r.name="depth";const o=new fn(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Ln,...i});o.texture.name="output",o.depthTexture=r,this.renderTarget=o,this.updateBeforeType=We.FRAME,this._textures={output:o.texture,depth:r},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=pe(0),this._cameraFar=pe(0),this._mrt=null,this.isPassNode=!0}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}isGlobal(){return!0}getTexture(e){let t=this._textures[e];return t===void 0&&(t=this.renderTarget.texture.clone(),t.isRenderTargetTexture=!0,t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)),t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),t.isRenderTargetTexture=!0,this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(t!==void 0){const n=this._textures[e],i=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[i]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(this._textureNodes[e]=t=H(new D_(this,e)),this._textureNodes[e].updateTexture()),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),this._previousTextureNodes[e]=t=H(new D_(this,e,!0)),this._previousTextureNodes[e].updateTexture()),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){const n=this._cameraNear,i=this._cameraFar;this._viewZNodes[e]=t=Gg(this.getTextureNode(e),n,i)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){const n=this._cameraNear,i=this._cameraFar,r=this.getViewZNode(e);this._linearDepthNodes[e]=t=oc(r,n,i)}return t}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,e.backend.isWebGLBackend===!0&&(this.renderTarget.samples=0),this.renderTarget.depthTexture.isMultisampleRenderTargetTexture=this.renderTarget.samples>1,this.scope===bn.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:n,camera:i}=this;this._pixelRatio=t.getPixelRatio();const r=t.getSize(cD);this.setSize(r.width,r.height);const o=t.getRenderTarget(),a=t.getMRT();this._cameraNear.value=i.near,this._cameraFar.value=i.far;for(const c in this._previousTextures)this.toggleTexture(c);t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.render(n,i),t.setRenderTarget(o),t.setMRT(a)}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget.setSize(n,i)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}bn.COLOR="color";bn.DEPTH="depth";const lD=(s,e,t)=>H(new bn(bn.COLOR,s,e,t)),Ea=(s,e)=>H(new Yb(s,e)),uD=(s,e)=>H(new bn(bn.DEPTH,s,e)),U_=new Ms,F_=new Ms;class Zb extends pt{static get type(){return"GaussianBlurNode"}constructor(e,t=null,n=2){super("vec4"),this.textureNode=e,this.directionNode=t,this.sigma=n,this._invSize=pe(new J),this._passDirection=pe(new J),this._horizontalRT=new fn,this._horizontalRT.texture.name="GaussianBlurNode.horizontal",this._verticalRT=new fn,this._verticalRT.texture.name="GaussianBlurNode.vertical",this._textureNode=Ea(this,this._verticalRT.texture),this.updateBeforeType=We.RENDER,this.resolution=new J(1,1)}setSize(e,t){e=Math.max(Math.round(e*this.resolution.x),1),t=Math.max(Math.round(t*this.resolution.y),1),this._invSize.value.set(1/e,1/t),this._horizontalRT.setSize(e,t),this._verticalRT.setSize(e,t)}updateBefore(e){const{renderer:t}=e,n=this.textureNode,i=n.value,r=t.getRenderTarget(),o=t.getMRT(),a=n.value;U_.material=this._material,F_.material=this._material,this.setSize(i.image.width,i.image.height);const c=i.type;this._horizontalRT.texture.type=c,this._verticalRT.texture.type=c,t.setMRT(null),t.setRenderTarget(this._horizontalRT),this._passDirection.value.set(1,0),U_.render(t),n.value=this._horizontalRT.texture,t.setRenderTarget(this._verticalRT),this._passDirection.value.set(0,1),F_.render(t),t.setRenderTarget(r),t.setMRT(o),n.value=a}getTextureNode(){return this._textureNode}setup(e){const t=this.textureNode;if(t.isTextureNode!==!0)return console.error("GaussianBlurNode requires a TextureNode."),oe();const n=t.uvNode||rt(),i=z(this.directionNode||1),r=l=>t.uv(l),o=U(()=>{const l=3+2*this.sigma,u=this._getCoefficients(l),h=this._invSize,d=i.mul(this._passDirection),p=A(u[0]).toVar(),f=oe(r(n).mul(p)).toVar();for(let x=1;x<l;x++){const m=A(x),g=A(u[x]),y=z(d.mul(h.mul(m))).toVar(),_=oe(r(n.add(y))),v=oe(r(n.sub(y)));f.addAssign(_.add(v).mul(g)),p.addAssign(ot(2,g))}return f.div(p)}),a=this._material||(this._material=new Tt);a.fragmentNode=o().context(e.getSharedContext()),a.name="Gaussian_blur",a.needsUpdate=!0;const c=e.getNodeProperties(this);return c.textureNode=t,this._textureNode}dispose(){this._horizontalRT.dispose(),this._verticalRT.dispose()}_getCoefficients(e){const t=[];for(let n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(e*e))/e);return t}}const hD=(s,e,t)=>H(new Zb(ei(s),e,t)),rf=new J,O_=new Ms;class Jb extends pt{static get type(){return"AfterImageNode"}constructor(e,t=.96){super(e),this.textureNode=e,this.textureNodeOld=xt(),this.damp=pe(t),this._compRT=new fn,this._compRT.texture.name="AfterImageNode.comp",this._oldRT=new fn,this._oldRT.texture.name="AfterImageNode.old",this._textureNode=Ea(this,this._compRT.texture),this.updateBeforeType=We.RENDER}getTextureNode(){return this._textureNode}setSize(e,t){this._compRT.setSize(e,t),this._oldRT.setSize(e,t)}updateBefore(e){const{renderer:t}=e,n=this.textureNode,r=n.value.type;this._compRT.texture.type=r,this._oldRT.texture.type=r,t.getDrawingBufferSize(rf),this.setSize(rf.x,rf.y);const o=t.getRenderTarget(),a=n.value;this.textureNodeOld.value=this._oldRT.texture,t.setRenderTarget(this._compRT),O_.render(t);const c=this._oldRT;this._oldRT=this._compRT,this._compRT=c,t.setRenderTarget(o),n.value=a}setup(e){const t=this.textureNode,n=this.textureNodeOld,i=t.uvNode||rt();n.uvNode=i;const r=u=>t.uv(u),o=U(([u,h])=>{const d=A(h).toVar(),p=oe(u).toVar();return ft(ll(p.sub(d)),0)}),a=U(()=>{const u=oe(n),h=oe(r(i));return u.mulAssign(this.damp.mul(o(u,.1))),ft(h,u)}),c=this._materialComposed||(this._materialComposed=new Tt);c.name="AfterImage",c.fragmentNode=a(),O_.material=c;const l=e.getNodeProperties(this);return l.textureNode=t,this._textureNode}dispose(){this._compRT.dispose(),this._oldRT.dispose()}}const dD=(s,e)=>H(new Jb(ei(s),e)),pD=U(([s])=>En(s.rgb)),fD=U(([s,e=A(1)])=>e.mix(En(s.rgb),s.rgb)),mD=U(([s,e=A(1)])=>{const t=Wt(s.r,s.g,s.b).div(3),n=s.r.max(s.g.max(s.b)),i=n.sub(t).mul(e).mul(-3);return it(s.rgb,n,i)}),gD=U(([s,e=A(1)])=>{const t=D(.57735,.57735,.57735),n=e.cos();return D(s.rgb.mul(n).add(t.cross(s.rgb).mul(e.sin()).add(t.mul($t(t,s.rgb).mul(n.oneMinus())))))}),xD=new E,En=(s,e=D(...gt.getLuminanceCoefficients(xD)))=>$t(s,e),Kb=(s,e)=>it(D(0),s,En(s).sub(e).max(0)),V_=new Ms;class jb extends pt{static get type(){return"AnamorphicNode"}constructor(e,t,n,i){super("vec4"),this.textureNode=e,this.tresholdNode=t,this.scaleNode=n,this.colorNode=D(.1,0,1),this.samples=i,this.resolution=new J(1,1),this._renderTarget=new fn,this._renderTarget.texture.name="anamorphic",this._invSize=pe(new J),this._textureNode=Ea(this,this._renderTarget.texture),this.updateBeforeType=We.RENDER}getTextureNode(){return this._textureNode}setSize(e,t){this._invSize.value.set(1/e,1/t),e=Math.max(Math.round(e*this.resolution.x),1),t=Math.max(Math.round(t*this.resolution.y),1),this._renderTarget.setSize(e,t)}updateBefore(e){const{renderer:t}=e,n=this.textureNode,i=n.value;this._renderTarget.texture.type=i.type;const r=t.getRenderTarget(),o=n.value;V_.material=this._material,this.setSize(i.image.width,i.image.height),t.setRenderTarget(this._renderTarget),V_.render(t),t.setRenderTarget(r),n.value=o}setup(e){const t=this.textureNode,n=t.uvNode||rt(),i=c=>t.uv(c),r=U(()=>{const c=this.samples,l=Math.floor(c/2),u=D(0).toVar();return mt({start:-l,end:l},({i:h})=>{const d=A(h).abs().div(l).oneMinus(),p=z(n.x.add(this._invSize.x.mul(h).mul(this.scaleNode)),n.y),f=i(p),x=Kb(f,this.tresholdNode).mul(d);u.addAssign(x)}),u.mul(this.colorNode)}),o=this._material||(this._material=new Tt);o.name="Anamorphic",o.fragmentNode=r();const a=e.getNodeProperties(this);return a.textureNode=t,this._textureNode}dispose(){this._renderTarget.dispose()}}const _D=(s,e=.9,t=3,n=32)=>H(new jb(ei(s),H(e),H(t),n));class Qb extends pt{static get type(){return"SobelOperatorNode"}constructor(e){super(),this.textureNode=e,this.updateBeforeType=We.RENDER,this._invSize=pe(new J)}updateBefore(){const e=this.textureNode.value;this._invSize.value.set(1/e.image.width,1/e.image.height)}setup(){const{textureNode:e}=this,t=e.uvNode||rt(),n=o=>e.uv(o);return U(()=>{const o=this._invSize,a=Tn(-1,-2,-1,0,0,0,1,2,1),c=Tn(-1,0,1,-2,0,2,-1,0,1),l=En(n(t.add(o.mul(z(-1,-1)))).xyz),u=En(n(t.add(o.mul(z(-1,0)))).xyz),h=En(n(t.add(o.mul(z(-1,1)))).xyz),d=En(n(t.add(o.mul(z(0,-1)))).xyz),p=En(n(t.add(o.mul(z(0,0)))).xyz),f=En(n(t.add(o.mul(z(0,1)))).xyz),x=En(n(t.add(o.mul(z(1,-1)))).xyz),m=En(n(t.add(o.mul(z(1,0)))).xyz),g=En(n(t.add(o.mul(z(1,1)))).xyz),y=Wt(a[0][0].mul(l),a[1][0].mul(d),a[2][0].mul(x),a[0][1].mul(u),a[1][1].mul(p),a[2][1].mul(m),a[0][2].mul(h),a[1][2].mul(f),a[2][2].mul(g)),_=Wt(c[0][0].mul(l),c[1][0].mul(d),c[2][0].mul(x),c[0][1].mul(u),c[1][1].mul(p),c[2][1].mul(m),c[0][2].mul(h),c[1][2].mul(f),c[2][2].mul(g)),v=y.mul(y).add(_.mul(_)).sqrt();return oe(D(v),1)})()}}const yD=s=>H(new Qb(ei(s)));class ew extends pt{static get type(){return"DepthOfFieldNode"}constructor(e,t,n,i,r){super(),this.textureNode=e,this.viewZNode=t,this.focusNode=n,this.apertureNode=i,this.maxblurNode=r,this._aspect=pe(0),this.updateBeforeType=We.RENDER}updateBefore(){const e=this.textureNode.value;this._aspect.value=e.image.width/e.image.height}setup(){const e=this.textureNode,t=e.uvNode||rt(),n=o=>e.uv(o);return U(()=>{const o=z(1,this._aspect),a=this.focusNode.add(this.viewZNode),c=z(cn(a.mul(this.apertureNode),this.maxblurNode.negate(),this.maxblurNode)),l=c.mul(.9),u=c.mul(.7),h=c.mul(.4);let d=oe(0);return d=d.add(n(t)),d=d.add(n(t.add(z(0,.4).mul(o).mul(c)))),d=d.add(n(t.add(z(.15,.37).mul(o).mul(c)))),d=d.add(n(t.add(z(.29,.29).mul(o).mul(c)))),d=d.add(n(t.add(z(-.37,.15).mul(o).mul(c)))),d=d.add(n(t.add(z(.4,0).mul(o).mul(c)))),d=d.add(n(t.add(z(.37,-.15).mul(o).mul(c)))),d=d.add(n(t.add(z(.29,-.29).mul(o).mul(c)))),d=d.add(n(t.add(z(-.15,-.37).mul(o).mul(c)))),d=d.add(n(t.add(z(0,-.4).mul(o).mul(c)))),d=d.add(n(t.add(z(-.15,.37).mul(o).mul(c)))),d=d.add(n(t.add(z(-.29,.29).mul(o).mul(c)))),d=d.add(n(t.add(z(.37,.15).mul(o).mul(c)))),d=d.add(n(t.add(z(-.4,0).mul(o).mul(c)))),d=d.add(n(t.add(z(-.37,-.15).mul(o).mul(c)))),d=d.add(n(t.add(z(-.29,-.29).mul(o).mul(c)))),d=d.add(n(t.add(z(.15,-.37).mul(o).mul(c)))),d=d.add(n(t.add(z(.15,.37).mul(o).mul(l)))),d=d.add(n(t.add(z(-.37,.15).mul(o).mul(l)))),d=d.add(n(t.add(z(.37,-.15).mul(o).mul(l)))),d=d.add(n(t.add(z(-.15,-.37).mul(o).mul(l)))),d=d.add(n(t.add(z(-.15,.37).mul(o).mul(l)))),d=d.add(n(t.add(z(.37,.15).mul(o).mul(l)))),d=d.add(n(t.add(z(-.37,-.15).mul(o).mul(l)))),d=d.add(n(t.add(z(.15,-.37).mul(o).mul(l)))),d=d.add(n(t.add(z(.29,.29).mul(o).mul(u)))),d=d.add(n(t.add(z(.4,0).mul(o).mul(u)))),d=d.add(n(t.add(z(.29,-.29).mul(o).mul(u)))),d=d.add(n(t.add(z(0,-.4).mul(o).mul(u)))),d=d.add(n(t.add(z(-.29,.29).mul(o).mul(u)))),d=d.add(n(t.add(z(-.4,0).mul(o).mul(u)))),d=d.add(n(t.add(z(-.29,-.29).mul(o).mul(u)))),d=d.add(n(t.add(z(0,.4).mul(o).mul(u)))),d=d.add(n(t.add(z(.29,.29).mul(o).mul(h)))),d=d.add(n(t.add(z(.4,0).mul(o).mul(h)))),d=d.add(n(t.add(z(.29,-.29).mul(o).mul(h)))),d=d.add(n(t.add(z(0,-.4).mul(o).mul(h)))),d=d.add(n(t.add(z(-.29,.29).mul(o).mul(h)))),d=d.add(n(t.add(z(-.4,0).mul(o).mul(h)))),d=d.add(n(t.add(z(-.29,-.29).mul(o).mul(h)))),d=d.add(n(t.add(z(0,.4).mul(o).mul(h)))),d=d.div(41),d.a=1,oe(d)})()}}const vD=(s,e,t=1,n=.025,i=1)=>H(new ew(ei(s),H(e),H(t),H(n),H(i)));class tw extends pt{static get type(){return"DotScreenNode"}constructor(e,t=new J(.5,.5),n=1.57,i=1){super("vec4"),this.inputNode=e,this.center=pe(t),this.angle=pe(n),this.scale=pe(i)}setup(){const e=this.inputNode,t=U(()=>{const r=Cn(this.angle),o=Mi(this.angle),a=rt().mul(pa).sub(this.center),c=z(o.mul(a.x).sub(r.mul(a.y)),r.mul(a.x).add(o.mul(a.y))).mul(this.scale);return Cn(c.x).mul(Cn(c.y)).mul(4)});return U(()=>{const r=e,o=Wt(r.r,r.g,r.b).div(3);return oe(D(o.mul(10).sub(5).add(t())),r.a)})()}}const MD=(s,e,t,n)=>H(new tw(H(s),e,t,n));class nw extends pt{static get type(){return"RGBShiftNode"}constructor(e,t=.005,n=0){super("vec4"),this.textureNode=e,this.amount=pe(t),this.angle=pe(n)}setup(){const{textureNode:e}=this,t=e.uvNode||rt(),n=r=>e.uv(r);return U(()=>{const r=z(Mi(this.angle),Cn(this.angle)).mul(this.amount),o=n(t.add(r)),a=n(t),c=n(t.sub(r));return oe(o.r,a.g,c.b,a.a)})()}}const SD=(s,e,t)=>H(new nw(ei(s),e,t));class iw extends pt{static get type(){return"FilmNode"}constructor(e,t=null,n=null){super(),this.inputNode=e,this.intensityNode=t,this.uvNode=n}setup(){const e=this.uvNode||rt();return U(()=>{const i=this.inputNode.rgb,r=Tg(_r(e.add(s0())));let o=i.add(i.mul(cn(r.add(.1),0,1)));return this.intensityNode!==null&&(o=it(i,o,this.intensityNode)),oe(o,this.inputNode.a)})()}}const TD=K(iw);class sw extends pt{static get type(){return"Lut3DNode"}constructor(e,t,n,i){super(),this.inputNode=e,this.lutNode=t,this.size=pe(n),this.intensityNode=i}setup(){const{inputNode:e,lutNode:t}=this,n=o=>t.uv(o);return U(()=>{const o=e,a=A(1).div(this.size),c=A(.5).div(this.size),l=D(c).add(o.rgb.mul(A(1).sub(a))),u=oe(n(l).rgb,o.a);return oe(it(o,u,this.intensityNode))})()}}const bD=(s,e,t,n)=>H(new sw(H(s),H(e),t,H(n))),B_=new Ms,z_=new _e,wD=new J;class rw extends pt{static get type(){return"GTAONode"}constructor(e,t,n){super(),this.depthNode=e,this.normalNode=t,this.radius=pe(.25),this.resolution=pe(new J),this.thickness=pe(1),this.distanceExponent=pe(1),this.distanceFallOff=pe(1),this.scale=pe(1),this.noiseNode=xt(AD()),this.cameraProjectionMatrix=pe(n.projectionMatrix),this.cameraProjectionMatrixInverse=pe(n.projectionMatrixInverse),this.SAMPLES=pe(16),this._aoRenderTarget=new fn,this._aoRenderTarget.texture.name="GTAONode.AO",this._material=null,this._textureNode=Ea(this,this._aoRenderTarget.texture),this.updateBeforeType=We.FRAME}getTextureNode(){return this._textureNode}setSize(e,t){this.resolution.value.set(e,t),this._aoRenderTarget.setSize(e,t)}updateBefore(e){const{renderer:t}=e,n=t.getDrawingBufferSize(wD),i=t.getRenderTarget(),r=t.getMRT();t.getClearColor(z_);const o=t.getClearAlpha();B_.material=this._material,this.setSize(n.width,n.height),t.setMRT(null),t.setClearColor(16777215,1),t.setRenderTarget(this._aoRenderTarget),B_.render(t),t.setRenderTarget(i),t.setMRT(r),t.setClearColor(z_,o)}setup(e){const t=rt(),n=l=>this.depthNode.uv(l).x,i=l=>this.noiseNode.uv(l),r=U(([l])=>{const u=this.cameraProjectionMatrix.mul(oe(l,1));let h=u.xy.div(u.w).mul(.5).add(.5).toVar();h=z(h.x,h.y.oneMinus());const d=n(h);return D(h,d)}),o=U(([l,u])=>{l=z(l.x,l.y.oneMinus()).mul(2).sub(1);const h=oe(D(l,u),1),d=oe(this.cameraProjectionMatrixInverse.mul(h));return d.xyz.div(d.w)}),a=U(()=>{const l=n(t);l.greaterThanEqual(1).discard();const u=o(t,l),h=this.normalNode.rgb.normalize(),d=this.radius,p=nr(this.noiseNode,0);let f=z(t.x,t.y.oneMinus());f=f.mul(this.resolution.div(p));const x=i(f),m=x.xyz.mul(2).sub(1),g=D(m.xy,0).normalize(),y=D(g.y.mul(-1),g.x,0),_=Tn(g,y,D(0,0,1)),v=this.SAMPLES.lessThan(30).select(3,5),I=Wt(this.SAMPLES,v.sub(1)).div(v),T=A(0).toVar();return mt({start:L(0),end:v,type:"int",condition:"<"},({i:w})=>{const C=A(w).div(A(v)).mul(no),F=oe(Mi(C),Cn(C),0,Wt(.5,ot(.5,x.w)));F.xyz=vi(_.mul(F.xyz));const M=vi(u.xyz.negate()),b=vi(ea(F.xyz,M)),G=ea(b,M),W=vi(h.sub(b.mul($t(h,b)))),$=ea(W,b),ie=z($t(M,$),$t(M,$.negate())).toVar();mt({end:I,type:"int",name:"j",condition:"<"},({j:Qe})=>{const ht=F.xyz.mul(d).mul(F.w).mul(jn(ns(A(Qe).add(1),A(I)),this.distanceExponent)),ne=r(u.add(ht)),Ae=o(ne.xy,ne.z).sub(u);Oe(Dt(Ae.z).lessThan(this.thickness),()=>{const Je=$t(M,vi(Ae));ie.x.addAssign(ft(0,ot(Je.sub(ie.x),it(1,A(2).div(A(Qe).add(2)),this.distanceFallOff))))});const ge=r(u.sub(ht)),Xe=o(ge.xy,ge.z).sub(u);Oe(Dt(Xe.z).lessThan(this.thickness),()=>{const Je=$t(M,vi(Xe));ie.y.addAssign(ft(0,ot(Je.sub(ie.y),it(1,A(2).div(A(Qe).add(2)),this.distanceFallOff))))})});const q=os(Ft(1,ie.mul(ie))),he=$t(W,G),Q=$t(W,M),we=ot(.5,yh(ie.y).sub(yh(ie.x)).add(q.x.mul(ie.x).sub(q.y.mul(ie.y)))),Ne=ot(.5,Ft(2,ie.x.mul(ie.x)).sub(ie.y.mul(ie.y))),Ee=he.mul(we).add(Q.mul(Ne));T.addAssign(Ee)}),T.assign(cn(T.div(v),0,1)),T.assign(jn(T,this.scale)),oe(D(T),1)}),c=this._material||(this._material=new Tt);return c.fragmentNode=a().context(e.getSharedContext()),c.name="GTAO",c.needsUpdate=!0,this._textureNode}dispose(){this._aoRenderTarget.dispose()}}function AD(s=5){const e=Math.floor(s)%2===0?Math.floor(s)+1:Math.floor(s),t=ND(e),n=t.length,i=new Uint8Array(n*4);for(let o=0;o<n;++o){const a=t[o],c=2*Math.PI*a/n,l=new E(Math.cos(c),Math.sin(c),0).normalize();i[o*4]=(l.x*.5+.5)*255,i[o*4+1]=(l.y*.5+.5)*255,i[o*4+2]=127,i[o*4+3]=255}const r=new Oi(i,e,e);return r.wrapS=or,r.wrapT=or,r.needsUpdate=!0,r}function ND(s){const e=Math.floor(s)%2===0?Math.floor(s)+1:Math.floor(s),t=e*e,n=Array(t).fill(0);let i=Math.floor(e/2),r=e-1;for(let o=1;o<=t;){if(i===-1&&r===e?(r=e-2,i=0):(r===e&&(r=0),i<0&&(i=e-1)),n[i*e+r]!==0){r-=2,i++;continue}else n[i*e+r]=o++;r++,i--}return n}const ED=(s,e,t)=>H(new rw(H(s),H(e),t));class ow extends pt{static get type(){return"DenoiseNode"}constructor(e,t,n,i,r){super(),this.textureNode=e,this.depthNode=t,this.normalNode=n,this.noiseNode=i,this.cameraProjectionMatrixInverse=pe(r.projectionMatrixInverse),this.lumaPhi=pe(5),this.depthPhi=pe(5),this.normalPhi=pe(5),this.radius=pe(5),this.index=pe(0),this._resolution=pe(new J),this._sampleVectors=fs(CD(16,2,1)),this.updateBeforeType=We.RENDER}updateBefore(){const e=this.textureNode.value;this._resolution.value.set(e.image.width,e.image.height)}setup(){const e=rt(),t=h=>this.textureNode.uv(h),n=h=>this.depthNode.uv(h).x,i=h=>this.normalNode.uv(h),r=h=>this.noiseNode.uv(h),o=U(([h,d])=>{h=z(h.x,h.y.oneMinus()).mul(2).sub(1);const p=oe(D(h,d),1),f=oe(this.cameraProjectionMatrixInverse.mul(p));return f.xyz.div(f.w)}),a=U(([h,d,p,f])=>{const x=t(f),m=n(f),g=i(f).rgb.normalize(),y=x.rgb,_=o(f,m),v=$t(d,g).toVar(),I=jn(ft(v,0),this.normalPhi).toVar(),T=Dt(En(y).sub(En(h))).toVar(),w=ft(A(1).sub(T.div(this.lumaPhi)),0).toVar(),C=Dt($t(p.sub(_),d)).toVar(),F=ft(A(1).sub(C.div(this.depthPhi)),0),M=w.mul(F).mul(I);return oe(y.mul(M),M)}),c=U(([h])=>{const d=n(h),p=i(h).rgb.normalize(),f=t(h);Oe(d.greaterThanEqual(1).or($t(p,p).equal(0)),()=>f);const x=D(f.rgb),m=o(h,d),g=nr(this.noiseNode,0);let y=z(h.x,h.y.oneMinus());y=y.mul(this._resolution.div(g));const _=r(y),v=Cn(_.element(this.index.mod(4).mul(2).mul(no))),I=Mi(_.element(this.index.mod(4).mul(2).mul(no))),T=z(v,I),w=al(T.x,T.y.negate(),T.x,T.y),C=A(1).toVar(),F=D(f.rgb).toVar();return mt({start:L(0),end:L(16),type:"int",condition:"<"},({i:M})=>{const b=this._sampleVectors.element(M).toVar(),G=w.mul(b.xy.mul(A(1).add(b.z.mul(this.radius.sub(1))))).div(this._resolution).toVar(),W=h.add(G).toVar(),$=a(x,p,m,W);F.addAssign($.xyz),C.addAssign($.w)}),Oe(C.greaterThan(A(0)),()=>{F.divAssign(C)}),oe(F,f.a)}).setLayout({name:"denoise",type:"vec4",inputs:[{name:"uv",type:"vec2"}]});return U(()=>c(e))()}}function CD(s,e,t){const n=RD(s,e,t),i=[];for(let r=0;r<s;r++){const o=n[r];i.push(o)}return i}function RD(s,e,t){const n=[];for(let i=0;i<s;i++){const r=2*Math.PI*e*i/s,o=Math.pow(i/(s-1),t);n.push(new E(Math.cos(r),Math.sin(r),o))}return n}const ID=(s,e,t,n,i)=>H(new ow(ei(s),H(e),H(t),H(n),i));class aw extends pt{static get type(){return"FXAANode"}constructor(e){super(),this.textureNode=e,this.updateBeforeType=We.RENDER,this._invSize=pe(new J)}updateBefore(){const e=this.textureNode.value;this._invSize.value.set(1/e.image.width,1/e.image.height)}setup(){const e=this.textureNode.bias(-100),t=e.uvNode||rt(),n=u=>e.uv(u),i=(u,h,d)=>e.uv(u.add(h.mul(d))),r=L(5),o=U(([u,h])=>{const d=oe(h).toVar(),p=oe(u).toVar(),f=oe(Dt(p.sub(d))).toVar();return ft(ft(ft(f.r,f.g),f.b),f.a)}),a=U(([u,h,d,p])=>{const f=n(u).toVar(),x=i(u,z(0,-1),h.xy).toVar(),m=i(u,z(1,0),h.xy).toVar(),g=i(u,z(0,1),h.xy).toVar(),y=i(u,z(-1,0),h.xy).toVar(),_=o(f,g).toVar(),v=o(f,x).toVar(),I=o(f,m).toVar(),T=o(f,y).toVar(),w=ft(_,ft(v,ft(I,T))).toVar();Oe(w.lessThan(d),()=>f);const C=Ft(_.add(v),I.add(T)).toVar();C.mulAssign(p),Oe(Dt(C).lessThan(.3),()=>{const ht=I.greaterThan(T).select(1,-1).toVar(),ne=v.greaterThan(_).select(1,-1).toVar(),ue=z(ht,ne).toVar(),Ae=i(u,z(ue.x,ue.y),h.xy),ge=o(f,Ae).toVar(),Ze=i(u,z(ue.x.negate(),ue.y.negate()),h.xy),Xe=o(f,Ze).toVar();C.assign(Xe.sub(ge)),C.mulAssign(p),Oe(Dt(C).lessThan(.3),()=>{const Je=g.add(x).add(m).add(y);return it(f,Je.mul(.25),.4)})});const F=z().toVar();Oe(C.lessThanEqual(0),()=>{g.assign(y),x.assign(m),F.x.assign(0),F.y.assign(h.y)}).Else(()=>{F.x.assign(h.x),F.y.assign(0)});const M=o(f,g).toVar(),b=o(f,x).toVar();Oe(M.lessThanEqual(b),()=>{g.assign(x)});const G=L(0).toVar(),W=L(0).toVar(),$=A(0).toVar(),ie=A(0).toVar(),q=z(u).toVar(),he=z(u).toVar(),Q=L(0).toVar(),we=L(0).toVar();mt(r,({i:ht})=>{const ne=ht.add(1).toVar();Oe(G.equal(0),()=>{$.addAssign(ne),q.assign(u.add(F.mul($)));const ue=n(q.xy),Ae=o(ue,f).toVar(),ge=o(ue,g).toVar();Oe(Ae.greaterThan(ge),()=>{G.assign(1)}),Q.assign(ht)}),Oe(W.equal(0),()=>{ie.addAssign(ne),he.assign(u.sub(F.mul(ie)));const ue=n(he.xy),Ae=o(ue,f).toVar(),ge=o(ue,g).toVar();Oe(Ae.greaterThan(ge),()=>{W.assign(1)}),we.assign(ht)}),Oe(G.equal(1).or(W.equal(1)),()=>{Fd()})}),Oe(G.equal(0).and(W.equal(0)),()=>f);const Ne=A(1).toVar(),Ee=A(1).toVar();Oe(G.equal(1),()=>{Ne.assign(A(Q).div(A(r.sub(1))))}),Oe(W.equal(1),()=>{Ee.assign(A(we).div(A(r.sub(1))))});const Qe=Mn(Ne,Ee);return Qe.assign(jn(Qe,.5)),Qe.assign(A(1).sub(Qe)),it(f,g,Qe.mul(.5))}).setLayout({name:"FxaaPixelShader",type:"vec4",inputs:[{name:"uv",type:"vec2"},{name:"fxaaQualityRcpFrame",type:"vec2"},{name:"fxaaQualityEdgeThreshold",type:"float"},{name:"fxaaQualityinvEdgeThreshold",type:"float"}]});return U(()=>{const u=A(.2),h=A(1).div(u);return a(t,this._invSize,u,h)})()}}const PD=s=>H(new aw(ei(s))),Dr=new Ms,LD=new _e(0,0,0),k_=new _e,DD=new J,UD=new J(1,0),FD=new J(0,1);class cw extends pt{static get type(){return"BloomNode"}constructor(e,t=1,n=0,i=0){super(),this.inputNode=e,this.strength=pe(t),this.radius=pe(n),this.threshold=pe(i),this.smoothWidth=pe(.01),this._renderTargetsHorizontal=[],this._renderTargetsVertical=[],this._nMips=5,this._renderTargetBright=new fn(1,1,{type:Ln}),this._renderTargetBright.texture.name="UnrealBloomPass.bright",this._renderTargetBright.texture.generateMipmaps=!1;for(let r=0;r<this._nMips;r++){const o=new fn(1,1,{type:Ln});o.texture.name="UnrealBloomPass.h"+r,o.texture.generateMipmaps=!1,this._renderTargetsHorizontal.push(o);const a=new fn(1,1,{type:Ln});a.texture.name="UnrealBloomPass.v"+r,a.texture.generateMipmaps=!1,this._renderTargetsVertical.push(a)}this._compositeMaterial=null,this._highPassFilterMaterial=null,this._separableBlurMaterials=[],this._textureNodeBright=xt(this._renderTargetBright.texture),this._textureNodeBlur0=xt(this._renderTargetsVertical[0].texture),this._textureNodeBlur1=xt(this._renderTargetsVertical[1].texture),this._textureNodeBlur2=xt(this._renderTargetsVertical[2].texture),this._textureNodeBlur3=xt(this._renderTargetsVertical[3].texture),this._textureNodeBlur4=xt(this._renderTargetsVertical[4].texture),this._textureOutput=Ea(this,this._renderTargetsHorizontal[0].texture),this.updateBeforeType=We.FRAME}getTextureNode(){return this._textureOutput}setSize(e,t){let n=Math.round(e/2),i=Math.round(t/2);this._renderTargetBright.setSize(n,i);for(let r=0;r<this._nMips;r++)this._renderTargetsHorizontal[r].setSize(n,i),this._renderTargetsVertical[r].setSize(n,i),this._separableBlurMaterials[r].invSize.value.set(1/n,1/i),n=Math.round(n/2),i=Math.round(i/2)}updateBefore(e){const{renderer:t}=e,n=t.getDrawingBufferSize(DD);this.setSize(n.width,n.height);const i=t.getRenderTarget(),r=t.getMRT();t.getClearColor(k_);const o=t.getClearAlpha();this.setSize(n.width,n.height),t.setMRT(null),t.setClearColor(LD,0),t.setRenderTarget(this._renderTargetBright),Dr.material=this._highPassFilterMaterial,Dr.render(t);let a=this._renderTargetBright;for(let c=0;c<this._nMips;c++)Dr.material=this._separableBlurMaterials[c],this._separableBlurMaterials[c].colorTexture.value=a.texture,this._separableBlurMaterials[c].direction.value=UD,t.setRenderTarget(this._renderTargetsHorizontal[c]),t.clear(),Dr.render(t),this._separableBlurMaterials[c].colorTexture.value=this._renderTargetsHorizontal[c].texture,this._separableBlurMaterials[c].direction.value=FD,t.setRenderTarget(this._renderTargetsVertical[c]),t.clear(),Dr.render(t),a=this._renderTargetsVertical[c];t.setRenderTarget(this._renderTargetsHorizontal[0]),t.clear(),Dr.material=this._compositeMaterial,Dr.render(t),t.setRenderTarget(i),t.setMRT(r),t.setClearColor(k_,o)}setup(e){const t=U(()=>{const c=this.inputNode,l=En(c.rgb),u=ti(this.threshold,this.threshold.add(this.smoothWidth),l);return it(oe(0),c,u)});this._highPassFilterMaterial=this._highPassFilterMaterial||new Tt,this._highPassFilterMaterial.fragmentNode=t().context(e.getSharedContext()),this._highPassFilterMaterial.name="Bloom_highPass",this._highPassFilterMaterial.needsUpdate=!0;const n=[3,5,7,9,11];for(let c=0;c<this._nMips;c++)this._separableBlurMaterials.push(this._getSeperableBlurMaterial(e,n[c]));const i=fs([1,.8,.6,.4,.2]),r=fs([new E(1,1,1),new E(1,1,1),new E(1,1,1),new E(1,1,1),new E(1,1,1)]),o=U(([c,l])=>{const u=A(1.2).sub(c);return it(c,u,l)}).setLayout({name:"lerpBloomFactor",type:"float",inputs:[{name:"factor",type:"float"},{name:"radius",type:"float"}]}),a=U(()=>{const c=o(i.element(0),this.radius).mul(oe(r.element(0),1)).mul(this._textureNodeBlur0),l=o(i.element(1),this.radius).mul(oe(r.element(1),1)).mul(this._textureNodeBlur1),u=o(i.element(2),this.radius).mul(oe(r.element(2),1)).mul(this._textureNodeBlur2),h=o(i.element(3),this.radius).mul(oe(r.element(3),1)).mul(this._textureNodeBlur3),d=o(i.element(4),this.radius).mul(oe(r.element(4),1)).mul(this._textureNodeBlur4);return c.add(l).add(u).add(h).add(d).mul(this.strength)});return this._compositeMaterial=this._compositeMaterial||new Tt,this._compositeMaterial.fragmentNode=a().context(e.getSharedContext()),this._compositeMaterial.name="Bloom_comp",this._compositeMaterial.needsUpdate=!0,this._textureOutput}dispose(){for(let e=0;e<this._renderTargetsHorizontal.length;e++)this._renderTargetsHorizontal[e].dispose();for(let e=0;e<this._renderTargetsVertical.length;e++)this._renderTargetsVertical[e].dispose();this._renderTargetBright.dispose()}_getSeperableBlurMaterial(e,t){const n=[];for(let d=0;d<t;d++)n.push(.39894*Math.exp(-.5*d*d/(t*t))/t);const i=xt(),r=fs(n),o=pe(new J),a=pe(new J(.5,.5)),c=rt(),l=d=>i.uv(d),u=U(()=>{const d=r.element(0).toVar(),p=l(c).rgb.mul(d).toVar();return mt({start:L(1),end:L(t),type:"int",condition:"<"},({i:f})=>{const x=A(f),m=r.element(f),g=a.mul(o).mul(x),y=l(c.add(g)).rgb,_=l(c.sub(g)).rgb;p.addAssign(Wt(y,_).mul(m)),d.addAssign(A(2).mul(m))}),oe(p.div(d),1)}),h=new Tt;return h.fragmentNode=u().context(e.getSharedContext()),h.name="Bloom_seperable",h.needsUpdate=!0,h.colorTexture=i,h.direction=a,h.invSize=o,h}}const OD=(s,e,t,n)=>H(new cw(H(s),e,t,n));class lw extends pt{static get type(){return"TransitionNode"}constructor(e,t,n,i,r,o){super(),this.textureNodeA=e,this.textureNodeB=t,this.mixTextureNode=n,this.mixRatioNode=i,this.thresholdNode=r,this.useTextureNode=o}setup(){const{textureNodeA:e,textureNodeB:t,mixTextureNode:n,mixRatioNode:i,thresholdNode:r,useTextureNode:o}=this,a=u=>{const h=u.uvNode||rt();return u.uv(h)};return U(()=>{const u=a(e),h=a(t),d=oe().toVar();return Oe(o.equal(L(1)),()=>{const p=a(n),f=i.mul(r.mul(2).add(1)).sub(r),x=cn(Ft(p.r,f).mul(A(1).div(r)),0,1);d.assign(it(u,h,x))}).Else(()=>{d.assign(it(h,u,i))}),d})()}}const VD=(s,e,t,n=0,i=.1,r=0)=>H(new lw(ei(s),ei(e),ei(t),H(n),H(i),H(r)));class BD extends pt{static get type(){return"PixelationNode"}constructor(e,t,n,i,r,o){super(),this.textureNode=e,this.depthNode=t,this.normalNode=n,this.pixelSize=i,this.normalEdgeStrength=r,this.depthEdgeStrength=o,this._resolution=pe(new st),this.updateBeforeType=We.RENDER}updateBefore(){const e=this.textureNode.value,t=e.image.width,n=e.image.height;this._resolution.value.set(t,n,1/t,1/n)}setup(){const{textureNode:e,depthNode:t,normalNode:n}=this,i=e.uvNode||rt(),r=t.uvNode||rt(),o=n.uvNode||rt(),a=()=>e.uv(i),c=(x,m)=>t.uv(r.add(z(x,m).mul(this._resolution.zw))).r,l=(x,m)=>n.uv(o.add(z(x,m).mul(this._resolution.zw))).rgb.normalize(),u=x=>{const m=ai("float","diff");return m.addAssign(cn(c(1,0).sub(x))),m.addAssign(cn(c(-1,0).sub(x))),m.addAssign(cn(c(0,1).sub(x))),m.addAssign(cn(c(0,-1).sub(x))),xr(ti(.01,.02,m).mul(2)).div(2)},h=(x,m,g,y)=>{const _=c(x,m).sub(g),v=l(x,m),I=D(1,1,1),T=$t(y.sub(v),I),w=cn(ti(-.01,.01,T),0,1),C=cn(ll(_.mul(.25).add(.0025)),0,1);return A(1).sub($t(y,v)).mul(C).mul(w)},d=(x,m)=>{const g=ai("float","indicator");return g.addAssign(h(0,-1,x,m)),g.addAssign(h(0,1,x,m)),g.addAssign(h(-1,0,x,m)),g.addAssign(h(1,0,x,m)),ul(.1,g)};return U(()=>{const x=a(),m=ai("float","depth"),g=ai("vec3","normal");Oe(this.depthEdgeStrength.greaterThan(0).or(this.normalEdgeStrength.greaterThan(0)),()=>{m.assign(c(0,0)),g.assign(l(0,0))});const y=ai("float","dei");Oe(this.depthEdgeStrength.greaterThan(0),()=>{y.assign(u(m))});const _=ai("float","nei");Oe(this.normalEdgeStrength.greaterThan(0),()=>{_.assign(d(m,g))});const v=y.greaterThan(0).select(A(1).sub(y.mul(this.depthEdgeStrength)),_.mul(this.normalEdgeStrength).add(1));return x.mul(v)})()}}const zD=(s,e,t,n=6,i=.3,r=.4)=>H(new BD(ei(s),ei(e),ei(t),H(n),H(i),H(r)));class uw extends bn{static get type(){return"PixelationPassNode"}constructor(e,t,n=6,i=.3,r=.4){super("color",e,t,{minFilter:Qt,magFilter:Qt}),this.pixelSize=n,this.normalEdgeStrength=i,this.depthEdgeStrength=r,this.isPixelationPassNode=!0,this._mrt=kd({output:cg,normal:di})}setSize(e,t){const n=this.pixelSize.value?this.pixelSize.value:this.pixelSize,i=Math.floor(e/n),r=Math.floor(t/n);super.setSize(i,r)}setup(){const e=super.getTextureNode("output"),t=super.getTextureNode("depth"),n=super.getTextureNode("normal");return zD(e,t,n,this.pixelSize,this.normalEdgeStrength,this.depthEdgeStrength)}}const kD=(s,e,t,n,i)=>H(new uw(s,e,t,n,i)),GD=new J;class hw extends bn{static get type(){return"SSAAPassNode"}constructor(e,t){super(bn.COLOR,e,t),this.isSSAAPassNode=!0,this.sampleLevel=4,this.unbiased=!0,this.clearColor=new _e(0),this.clearAlpha=0,this._currentClearColor=new _e,this.sampleWeight=pe(1),this.sampleRenderTarget=null,this._quadMesh=new Ms}updateBefore(e){const{renderer:t}=e,{scene:n,camera:i}=this;this._pixelRatio=t.getPixelRatio();const r=t.getSize(GD);this.setSize(r.width,r.height),this.sampleRenderTarget.setSize(this.renderTarget.width,this.renderTarget.height),t.getClearColor(this._currentClearColor);const o=t.getClearAlpha(),a=t.getRenderTarget(),c=t.getMRT(),l=t.autoClear;this._cameraNear.value=i.near,this._cameraFar.value=i.far,t.setMRT(this.getMRT()),t.autoClear=!1;const u=HD[Math.max(0,Math.min(this.sampleLevel,5))],h=1/u.length,d=1/32,p={fullWidth:this.renderTarget.width,fullHeight:this.renderTarget.height,offsetX:0,offsetY:0,width:this.renderTarget.width,height:this.renderTarget.height},f=Object.assign({},i.view);f.enabled&&Object.assign(p,f);for(let x=0;x<u.length;x++){const m=u[x];if(i.setViewOffset&&i.setViewOffset(p.fullWidth,p.fullHeight,p.offsetX+m[0]*.0625,p.offsetY+m[1]*.0625,p.width,p.height),this.sampleWeight.value=h,this.unbiased){const g=-.5+(x+.5)/u.length;this.sampleWeight.value+=d*g}t.setClearColor(this.clearColor,this.clearAlpha),t.setRenderTarget(this.sampleRenderTarget),t.clear(),t.render(n,i),t.setRenderTarget(this.renderTarget),x===0&&(t.setClearColor(0,0),t.clear()),this._quadMesh.render(t)}t.copyTextureToTexture(this.sampleRenderTarget.depthTexture,this.renderTarget.depthTexture),i.setViewOffset&&f.enabled?i.setViewOffset(f.fullWidth,f.fullHeight,f.offsetX,f.offsetY,f.width,f.height):i.clearViewOffset&&i.clearViewOffset(),t.setRenderTarget(a),t.setMRT(c),t.autoClear=l,t.setClearColor(this._currentClearColor,o)}setup(e){this.sampleRenderTarget===null&&(this.sampleRenderTarget=this.renderTarget.clone());let t;const n=this.getMRT();if(n!==null){const i={};for(const r in n.outputNodes){const o=i0(this.sampleRenderTarget.textures,r);o>=0&&(i[r]=xt(this.sampleRenderTarget.textures[o]).mul(this.sampleWeight))}t=kd(i)}else t=xt(this.sampleRenderTarget.texture).mul(this.sampleWeight);return this._quadMesh.material=new Tt,this._quadMesh.material.fragmentNode=t,this._quadMesh.material.transparent=!0,this._quadMesh.material.depthTest=!1,this._quadMesh.material.depthWrite=!1,this._quadMesh.material.premultipliedAlpha=!0,this._quadMesh.material.blending=lc,this._quadMesh.material.normals=!1,this._quadMesh.material.name="SSAA",super.setup(e)}dispose(){super.dispose(),this.sampleRenderTarget!==null&&this.sampleRenderTarget.dispose()}}const HD=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]],WD=(s,e)=>H(new hw(s,e)),XD=new J;class dw extends bn{static get type(){return"StereoPassNode"}constructor(e,t){super(bn.COLOR,e,t),this.isStereoPassNode=!0,this.stereo=new Vm,this.stereo.aspect=.5}updateBefore(e){const{renderer:t}=e,{scene:n,camera:i,stereo:r,renderTarget:o}=this;this._pixelRatio=t.getPixelRatio(),r.cameraL.coordinateSystem=t.coordinateSystem,r.cameraR.coordinateSystem=t.coordinateSystem,r.update(i);const a=t.getSize(XD);this.setSize(a.width,a.height);const c=t.autoClear;t.autoClear=!1;const l=t.getRenderTarget(),u=t.getMRT();this._cameraNear.value=i.near,this._cameraFar.value=i.far;for(const h in this._previousTextures)this.toggleTexture(h);t.setRenderTarget(o),t.setMRT(this._mrt),t.clear(),o.scissorTest=!0,o.scissor.set(0,0,o.width/2,o.height),o.viewport.set(0,0,o.width/2,o.height),t.render(n,r.cameraL),o.scissor.set(o.width/2,0,o.width/2,o.height),o.viewport.set(o.width/2,0,o.width/2,o.height),t.render(n,r.cameraR),o.scissorTest=!1,t.setRenderTarget(l),t.setMRT(u),t.autoClear=c}}const qD=(s,e)=>H(new dw(s,e)),$D=new J,G_=new Ms;class pw extends bn{static get type(){return"StereoCompositePassNode"}constructor(e,t){super(bn.COLOR,e,t),this.isStereoCompositePassNode=!0,this.stereo=new Vm;const n={minFilter:Ut,magFilter:Qt,type:Ln};this._renderTargetL=new fn(1,1,n),this._renderTargetR=new fn(1,1,n),this._mapLeft=xt(this._renderTargetL.texture),this._mapRight=xt(this._renderTargetR.texture),this._material=null}updateStereoCamera(e){this.stereo.cameraL.coordinateSystem=e,this.stereo.cameraR.coordinateSystem=e,this.stereo.update(this.camera)}setSize(e,t){super.setSize(e,t),this._renderTargetL.setSize(this.renderTarget.width,this.renderTarget.height),this._renderTargetR.setSize(this.renderTarget.width,this.renderTarget.height)}updateBefore(e){const{renderer:t}=e,{scene:n,stereo:i,renderTarget:r}=this;this._pixelRatio=t.getPixelRatio(),this.updateStereoCamera(t.coordinateSystem);const o=t.getSize($D);this.setSize(o.width,o.height);const a=t.getRenderTarget();t.setRenderTarget(this._renderTargetL),t.render(n,i.cameraL),t.setRenderTarget(this._renderTargetR),t.render(n,i.cameraR),t.setRenderTarget(r),G_.material=this._material,G_.render(t),t.setRenderTarget(a)}dispose(){super.dispose(),this._renderTargetL.dispose(),this._renderTargetR.dispose(),this._material!==null&&this._material.dispose()}}class fw extends pw{static get type(){return"AnaglyphPassNode"}constructor(e,t){super(e,t),this.isAnaglyphPassNode=!0,this._colorMatrixLeft=pe(new Ke().fromArray([.4561,-.0400822,-.0152161,.500484,-.0378246,-.0205971,.176381,-.0157589,-.00546856])),this._colorMatrixRight=pe(new Ke().fromArray([-.0434706,.378476,-.0721527,-.0879388,.73364,-.112961,-.00155529,-.0184503,1.2264]))}setup(e){const t=rt(),n=U(()=>{const r=this._mapLeft.uv(t),o=this._mapRight.uv(t),a=cn(this._colorMatrixLeft.mul(r.rgb).add(this._colorMatrixRight.mul(o.rgb)));return oe(a.rgb,ft(r.a,o.a))}),i=this._material||(this._material=new Tt);return i.fragmentNode=n().context(e.getSharedContext()),i.name="Anaglyph",i.needsUpdate=!0,super.setup(e)}}const YD=(s,e)=>H(new fw(s,e));class mw extends pw{static get type(){return"ParallaxBarrierPassNode"}constructor(e,t){super(e,t),this.isParallaxBarrierPassNode=!0}setup(e){const t=rt(),n=U(()=>{const r=oe().toVar();return Oe(Cd(Na.y,2).greaterThan(1),()=>{r.assign(this._mapLeft.uv(t))}).Else(()=>{r.assign(this._mapRight.uv(t))}),r}),i=this._material||(this._material=new Tt);return i.fragmentNode=n().context(e.getSharedContext()),i.needsUpdate=!0,super.setup(e)}}const ZD=(s,e)=>H(new mw(s,e));class gw extends bn{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,i,r){super(bn.COLOR,e,t),this.colorNode=n,this.thicknessNode=i,this.alphaNode=r,this._materialCache=new WeakMap}updateBefore(e){const{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((i,r,o,a,c,l,u)=>{if((c.isMeshToonMaterial||c.isMeshToonNodeMaterial)&&c.wireframe===!1){const h=this._getOutlineMaterial(c);t.renderObject(i,r,o,a,h,l,u)}t.renderObject(i,r,o,a,c,l,u)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){const e=new Tt;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=ln;const t=hi.negate(),n=ci.mul(ys),i=A(1),r=n.mul(oe(en,1)),o=n.mul(oe(en.add(t),1)),a=vi(r.sub(o));return e.vertexNode=r.add(a.mul(this.thicknessNode).mul(r.w).mul(i)),e.colorNode=oe(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}const JD=(s,e,t=new _e(0,0,0),n=.003,i=1)=>H(new gw(s,e,H(t),H(n),H(i)));class xw extends Ye{static get type(){return"ScriptableValueNode"}constructor(e=null){super(),this._value=e,this._cache=null,this.inputType=null,this.outpuType=null,this.events=new Ai,this.isScriptableValueNode=!0}get isScriptableOutputNode(){return this.outputType!==null}set value(e){this._value!==e&&(this._cache&&this.inputType==="URL"&&this.value.value instanceof ArrayBuffer&&(URL.revokeObjectURL(this._cache),this._cache=null),this._value=e,this.events.dispatchEvent({type:"change"}),this.refresh())}get value(){return this._value}refresh(){this.events.dispatchEvent({type:"refresh"})}getValue(){const e=this.value;if(e&&this._cache===null&&this.inputType==="URL"&&e.value instanceof ArrayBuffer)this._cache=URL.createObjectURL(new Blob([e.value]));else if(e&&e.value!==null&&e.value!==void 0&&((this.inputType==="URL"||this.inputType==="String")&&typeof e.value=="string"||this.inputType==="Number"&&typeof e.value=="number"||this.inputType==="Vector2"&&e.value.isVector2||this.inputType==="Vector3"&&e.value.isVector3||this.inputType==="Vector4"&&e.value.isVector4||this.inputType==="Color"&&e.value.isColor||this.inputType==="Matrix3"&&e.value.isMatrix3||this.inputType==="Matrix4"&&e.value.isMatrix4))return e.value;return this._cache||e}getNodeType(e){return this.value&&this.value.isNode?this.value.getNodeType(e):"float"}setup(){return this.value&&this.value.isNode?this.value:A()}serialize(e){super.serialize(e),this.value!==null?this.inputType==="ArrayBuffer"?e.value=Ym(this.value):e.value=this.value?this.value.toJSON(e.meta).uuid:null:e.value=null,e.inputType=this.inputType,e.outputType=this.outputType}deserialize(e){super.deserialize(e);let t=null;e.value!==null&&(e.inputType==="ArrayBuffer"?t=Zm(e.value):e.inputType==="Texture"?t=e.meta.textures[e.value]:t=e.meta.nodes[e.value]||null),this.value=t,this.inputType=e.inputType,this.outputType=e.outputType}}const Vu=K(xw);class _w extends Map{get(e,t=null,...n){if(this.has(e))return super.get(e);if(t!==null){const i=t(...n);return this.set(e,i),i}}}class KD{constructor(e){this.scriptableNode=e}get parameters(){return this.scriptableNode.parameters}get layout(){return this.scriptableNode.getLayout()}getInputLayout(e){return this.scriptableNode.getInputLayout(e)}get(e){const t=this.parameters[e];return t?t.getValue():null}}const Bu=new _w;class yw extends Ye{static get type(){return"ScriptableNode"}constructor(e=null,t={}){super(),this.codeNode=e,this.parameters=t,this._local=new _w,this._output=Vu(),this._outputs={},this._source=this.source,this._method=null,this._object=null,this._value=null,this._needsOutputUpdate=!0,this.onRefresh=this.onRefresh.bind(this),this.isScriptableNode=!0}get source(){return this.codeNode?this.codeNode.code:""}setLocal(e,t){return this._local.set(e,t)}getLocal(e){return this._local.get(e)}onRefresh(){this._refresh()}getInputLayout(e){for(const t of this.getLayout())if(t.inputType&&(t.id===e||t.name===e))return t}getOutputLayout(e){for(const t of this.getLayout())if(t.outputType&&(t.id===e||t.name===e))return t}setOutput(e,t){const n=this._outputs;return n[e]===void 0?n[e]=Vu(t):n[e].value=t,this}getOutput(e){return this._outputs[e]}getParameter(e){return this.parameters[e]}setParameter(e,t){const n=this.parameters;return t&&t.isScriptableNode?(this.deleteParameter(e),n[e]=t,n[e].getDefaultOutput().events.addEventListener("refresh",this.onRefresh)):t&&t.isScriptableValueNode?(this.deleteParameter(e),n[e]=t,n[e].events.addEventListener("refresh",this.onRefresh)):n[e]===void 0?(n[e]=Vu(t),n[e].events.addEventListener("refresh",this.onRefresh)):n[e].value=t,this}getValue(){return this.getDefaultOutput().getValue()}deleteParameter(e){let t=this.parameters[e];return t&&(t.isScriptableNode&&(t=t.getDefaultOutput()),t.events.removeEventListener("refresh",this.onRefresh)),this}clearParameters(){for(const e of Object.keys(this.parameters))this.deleteParameter(e);return this.needsUpdate=!0,this}call(e,...t){const i=this.getObject()[e];if(typeof i=="function")return i(...t)}async callAsync(e,...t){const i=this.getObject()[e];if(typeof i=="function")return i.constructor.name==="AsyncFunction"?await i(...t):i(...t)}getNodeType(e){return this.getDefaultOutputNode().getNodeType(e)}refresh(e=null){e!==null?this.getOutput(e).refresh():this._refresh()}getObject(){if(this.needsUpdate&&this.dispose(),this._object!==null)return this._object;const e=()=>this.refresh(),t=(l,u)=>this.setOutput(l,u),n=new KD(this),i=Bu.get("THREE"),r=Bu.get("TSL"),o=this.getMethod(this.codeNode),a=[n,this._local,Bu,e,t,i,r];this._object=o(...a);const c=this._object.layout;if(c&&(c.cache===!1&&this._local.clear(),this._output.outputType=c.outputType||null,Array.isArray(c.elements)))for(const l of c.elements){const u=l.id||l.name;l.inputType&&(this.getParameter(u)===void 0&&this.setParameter(u,null),this.getParameter(u).inputType=l.inputType),l.outputType&&(this.getOutput(u)===void 0&&this.setOutput(u,null),this.getOutput(u).outputType=l.outputType)}return this._object}deserialize(e){super.deserialize(e);for(const t in this.parameters){let n=this.parameters[t];n.isScriptableNode&&(n=n.getDefaultOutput()),n.events.addEventListener("refresh",this.onRefresh)}}getLayout(){return this.getObject().layout}getDefaultOutputNode(){const e=this.getDefaultOutput().value;return e&&e.isNode?e:A()}getDefaultOutput(){return this._exec()._output}getMethod(){if(this.needsUpdate&&this.dispose(),this._method!==null)return this._method;const e=["parameters","local","global","refresh","setOutput","THREE","TSL"],n=["layout","init","main","dispose"].join(", "),i="var "+n+`; var output = {};
|
|
3868
3868
|
`,r=`
|
|
3869
3869
|
return { ...output, `+n+" };",o=i+this.codeNode.code+r;return this._method=new Function(...e,o),this._method}dispose(){this._method!==null&&(this._object&&typeof this._object.dispose=="function"&&this._object.dispose(),this._method=null,this._object=null,this._source=null,this._value=null,this._needsOutputUpdate=!0,this._output.value=null,this._outputs={})}setup(){return this.getDefaultOutputNode()}getCacheKey(e){const t=[Wv(this.source),this.getDefaultOutputNode().getCacheKey(e)];for(const n in this.parameters)t.push(this.parameters[n].getCacheKey(e));return Xv(t)}set needsUpdate(e){e===!0&&this.dispose()}get needsUpdate(){return this.source!==this._source}_exec(){return this.codeNode===null?this:(this._needsOutputUpdate===!0&&(this._value=this.call("main"),this._needsOutputUpdate=!1),this._output.value=this._value,this)}_refresh(){this.needsUpdate=!0,this._exec(),this._output.refresh()}}const jD=K(yw);class Gd extends Ye{static get type(){return"FogNode"}constructor(e,t){super("float"),this.isFogNode=!0,this.colorNode=e,this.factorNode=t}getViewZNode(e){let t;const n=e.context.getViewZ;return n!==void 0&&(t=n(this)),(t||Pn.z).negate()}setup(){return this.factorNode}}const QD=K(Gd);class vw extends Gd{static get type(){return"FogRangeNode"}constructor(e,t,n){super(e),this.isFogRangeNode=!0,this.nearNode=t,this.farNode=n}setup(e){const t=this.getViewZNode(e);return ti(this.nearNode,this.farNode,t)}}const eU=K(vw);class Mw extends Gd{static get type(){return"FogExp2Node"}constructor(e,t){super(e),this.isFogExp2Node=!0,this.densityNode=t}setup(e){const t=this.getViewZNode(e),n=this.densityNode;return n.mul(n,t,t).negate().exp().oneMinus()}}const tU=K(Mw);let Ur=null,Fr=null;class Sw extends Ye{static get type(){return"RangeNode"}constructor(e=A(),t=A()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=e.getTypeLength(Ps(this.minNode.value)),n=e.getTypeLength(Ps(this.maxNode.value));return t>n?t:n}getNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}setup(e){const t=e.object;let n=null;if(t.count>1){const i=this.minNode.value,r=this.maxNode.value,o=e.getTypeLength(Ps(i)),a=e.getTypeLength(Ps(r));Ur=Ur||new st,Fr=Fr||new st,Ur.setScalar(0),Fr.setScalar(0),o===1?Ur.setScalar(i):i.isColor?Ur.set(i.r,i.g,i.b):Ur.set(i.x,i.y,i.z||0,i.w||0),a===1?Fr.setScalar(r):r.isColor?Fr.set(r.r,r.g,r.b):Fr.set(r.x,r.y,r.z||0,r.w||0);const c=4,l=c*t.count,u=new Float32Array(l);for(let d=0;d<l;d++){const p=d%c,f=Ur.getComponent(p),x=Fr.getComponent(p);u[d]=Xh.lerp(f,x,Math.random())}const h=this.getNodeType(e);if(t.count<=4096)n=ml(u,"vec4",t.count).element(vl).convert(h);else{const d=new Fs(u,4);e.geometry.setAttribute("__range"+this.id,d),n=Mh(d).convert(h)}}else n=A(0);return n}}const nU=K(Sw),iU=U(({depthTexture:s,shadowCoord:e})=>xt(s,e.xy).compare(e.z)),sU=U(({depthTexture:s,shadowCoord:e,shadow:t})=>{const n=(x,m)=>xt(s,x).compare(m),i=dn("mapSize","vec2",t).setGroup(_t),r=dn("radius","float",t).setGroup(_t),o=z(1).div(i),a=o.x.negate().mul(r),c=o.y.negate().mul(r),l=o.x.mul(r),u=o.y.mul(r),h=a.div(2),d=c.div(2),p=l.div(2),f=u.div(2);return Wt(n(e.xy.add(z(a,c)),e.z),n(e.xy.add(z(0,c)),e.z),n(e.xy.add(z(l,c)),e.z),n(e.xy.add(z(h,d)),e.z),n(e.xy.add(z(0,d)),e.z),n(e.xy.add(z(p,d)),e.z),n(e.xy.add(z(a,0)),e.z),n(e.xy.add(z(h,0)),e.z),n(e.xy,e.z),n(e.xy.add(z(p,0)),e.z),n(e.xy.add(z(l,0)),e.z),n(e.xy.add(z(h,f)),e.z),n(e.xy.add(z(0,f)),e.z),n(e.xy.add(z(p,f)),e.z),n(e.xy.add(z(a,u)),e.z),n(e.xy.add(z(0,u)),e.z),n(e.xy.add(z(l,u)),e.z)).mul(1/17)}),rU=U(({depthTexture:s,shadowCoord:e,shadow:t})=>{const n=(u,h)=>xt(s,u).compare(h),i=dn("mapSize","vec2",t).setGroup(_t),r=z(1).div(i),o=r.x,a=r.y,c=e.xy,l=_r(c.mul(i).add(.5));return c.subAssign(l.mul(r)),Wt(n(c,e.z),n(c.add(z(o,0)),e.z),n(c.add(z(0,a)),e.z),n(c.add(r),e.z),it(n(c.add(z(o.negate(),0)),e.z),n(c.add(z(o.mul(2),0)),e.z),l.x),it(n(c.add(z(o.negate(),a)),e.z),n(c.add(z(o.mul(2),a)),e.z),l.x),it(n(c.add(z(0,a.negate())),e.z),n(c.add(z(0,a.mul(2))),e.z),l.y),it(n(c.add(z(o,a.negate())),e.z),n(c.add(z(o,a.mul(2))),e.z),l.y),it(it(n(c.add(z(o.negate(),a.negate())),e.z),n(c.add(z(o.mul(2),a.negate())),e.z),l.x),it(n(c.add(z(o.negate(),a.mul(2))),e.z),n(c.add(z(o.mul(2),a.mul(2))),e.z),l.x),l.y)).mul(1/9)}),oU=U(({depthTexture:s,shadowCoord:e})=>{const t=A(1).toVar(),n=xt(s).uv(e.xy).rg,i=ul(e.z,n.x);return Oe(i.notEqual(A(1)),()=>{const r=e.z.sub(n.x),o=ft(0,n.y.mul(n.y));let a=o.div(o.add(r.mul(r)));a=cn(Ft(a,.3).div(.95-.3)),t.assign(cn(ft(i,a)))}),t}),aU=U(({samples:s,radius:e,size:t,shadowPass:n})=>{const i=A(0).toVar(),r=A(0).toVar(),o=s.lessThanEqual(A(1)).select(A(0),A(2).div(s.sub(1))),a=s.lessThanEqual(A(1)).select(A(0),A(-1));mt({start:L(0),end:L(s),type:"int",condition:"<"},({i:l})=>{const u=a.add(A(l).mul(o)),h=n.uv(Wt(Na.xy,z(0,u).mul(e)).div(t)).x;i.addAssign(h),r.addAssign(h.mul(h))}),i.divAssign(s),r.divAssign(s);const c=os(r.sub(i.mul(i)));return z(i,c)}),cU=U(({samples:s,radius:e,size:t,shadowPass:n})=>{const i=A(0).toVar(),r=A(0).toVar(),o=s.lessThanEqual(A(1)).select(A(0),A(2).div(s.sub(1))),a=s.lessThanEqual(A(1)).select(A(0),A(-1));mt({start:L(0),end:L(s),type:"int",condition:"<"},({i:l})=>{const u=a.add(A(l).mul(o)),h=n.uv(Wt(Na.xy,z(u,0).mul(e)).div(t));i.addAssign(h.x),r.addAssign(Wt(h.y.mul(h.y),h.x.mul(h.x)))}),i.divAssign(s),r.divAssign(s);const c=os(r.sub(i.mul(i)));return z(i,c)}),lU=[iU,sU,rU,oU];let Vo=null;const Eu=new Ms;class vr extends po{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.updateType=We.FRAME,this.light=e,this.color=new _e,this.colorNode=pe(this.color).setGroup(_t),this.baseColorNode=null,this.shadowMap=null,this.shadowNode=null,this.shadowColorNode=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this.isAnalyticLightNode=!0}getCacheKey(){return Xm(super.getCacheKey(),this.light.id,this.light.castShadow?1:0)}getHash(){return this.light.uuid}setupShadow(e){const{object:t,renderer:n}=e;if(n.shadowMap.enabled===!1)return;let i=this.shadowColorNode;if(i===null){Vo===null&&(Vo=new Tt,Vo.fragmentNode=oe(0,0,0,1),Vo.isShadowNodeMaterial=!0,Vo.name="ShadowMaterial");const r=n.shadowMap.type,o=this.light.shadow,a=new co;a.compareFunction=nm;const c=e.createRenderTarget(o.mapSize.width,o.mapSize.height);if(c.depthTexture=a,o.camera.updateProjectionMatrix(),r===oi){a.compareFunction=null,this.vsmShadowMapVertical=e.createRenderTarget(o.mapSize.width,o.mapSize.height,{format:ia,type:Ln}),this.vsmShadowMapHorizontal=e.createRenderTarget(o.mapSize.width,o.mapSize.height,{format:ia,type:Ln});const _=xt(a),v=xt(this.vsmShadowMapVertical.texture),I=dn("blurSamples","float",o).setGroup(_t),T=dn("radius","float",o).setGroup(_t),w=dn("mapSize","vec2",o).setGroup(_t);let C=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Tt);C.fragmentNode=aU({samples:I,radius:T,size:w,shadowPass:_}).context(e.getSharedContext()),C.name="VSMVertical",C=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Tt),C.fragmentNode=cU({samples:I,radius:T,size:w,shadowPass:v}).context(e.getSharedContext()),C.name="VSMHorizontal"}const l=dn("intensity","float",o).setGroup(_t),u=dn("bias","float",o).setGroup(_t),h=dn("normalBias","float",o).setGroup(_t),d=t.material.shadowPositionNode||Th;let p=pe(o.matrix).setGroup(_t).mul(d.add(Id.mul(h)));p=p.xyz.div(p.w);let f=p.z.add(u);n.coordinateSystem===eo&&(f=f.mul(2).sub(1)),p=D(p.x,p.y.oneMinus(),f);const x=p.x.greaterThanEqual(0).and(p.x.lessThanEqual(1)).and(p.y.greaterThanEqual(0)).and(p.y.lessThanEqual(1)).and(p.z.lessThanEqual(1)),m=o.filterNode||lU[n.shadowMap.type]||null;if(m===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const g=xt(c.texture,p),y=x.select(m({depthTexture:r===oi?this.vsmShadowMapHorizontal.texture:a,shadowCoord:p,shadow:o}),A(1));this.shadowMap=c,this.light.shadow.map=c,this.shadowNode=y,this.shadowColorNode=i=this.colorNode.mul(it(1,y.rgb.mix(g,1),l.mul(g.a))),this.baseColorNode=this.colorNode}this.colorNode=i,this.updateBeforeType=We.RENDER}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&this.disposeShadow()}updateShadow(e){const{shadowMap:t,light:n}=this,{renderer:i,scene:r,camera:o}=e,a=i.shadowMap.type,c=t.depthTexture.version;this._depthVersionCached=c;const l=r.overrideMaterial;r.overrideMaterial=Vo,t.setSize(n.shadow.mapSize.width,n.shadow.mapSize.height),n.shadow.updateMatrices(n),n.shadow.camera.layers.mask=o.layers.mask;const u=i.getRenderTarget(),h=i.getRenderObjectFunction();i.setRenderObjectFunction((d,...p)=>{(d.castShadow===!0||d.receiveShadow&&a===oi)&&i.renderObject(d,...p)}),i.setRenderTarget(t),i.render(r,n.shadow.camera),i.setRenderObjectFunction(h),n.isPointLight!==!0&&a===oi&&this.vsmPass(e,n),i.setRenderTarget(u),r.overrideMaterial=l}vsmPass(e,t){const{renderer:n}=e;this.vsmShadowMapVertical.setSize(t.shadow.mapSize.width,t.shadow.mapSize.height),this.vsmShadowMapHorizontal.setSize(t.shadow.mapSize.width,t.shadow.mapSize.height),n.setRenderTarget(this.vsmShadowMapVertical),Eu.material=this.vsmMaterialVertical,Eu.render(n),n.setRenderTarget(this.vsmShadowMapHorizontal),Eu.material=this.vsmMaterialHorizontal,Eu.render(n)}disposeShadow(){this.shadowMap.dispose(),this.shadowMap=null,this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null),this.shadowNode=null,this.shadowColorNode=null,this.baseColorNode=null,this.updateBeforeType=We.NONE}updateBefore(e){const t=this.light.shadow;(t.needsUpdate||t.autoUpdate)&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const o0=U(s=>{const{lightDistance:e,cutoffDistance:t,decayExponent:n}=s,i=e.pow(n).max(.01).reciprocal();return t.greaterThan(0).select(i.mul(e.div(t).pow4().oneMinus().clamp().pow2()),i)});let Cu;function a0(s){Cu=Cu||new WeakMap;let e=Cu.get(s);return e===void 0&&Cu.set(s,e={}),e}function c0(s){const e=a0(s);return e.position||(e.position=pe(new E).setGroup(_t).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(s.matrixWorld)))}function Tw(s){const e=a0(s);return e.targetPosition||(e.targetPosition=pe(new E).setGroup(_t).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(s.target.matrixWorld)))}function Hd(s){const e=a0(s);return e.viewPosition||(e.viewPosition=pe(new E).setGroup(_t).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new E,n.value.setFromMatrixPosition(s.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}const l0=s=>pi.transformDirection(c0(s).sub(Tw(s))),uU=U(([s])=>{const e=s.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),Uf=(s,e)=>jn(ot(4,s.mul(Ft(1,s))),e),hU=(s,e)=>s.lessThan(.5)?Uf(s.mul(2),e).div(2):Ft(1,Uf(ot(Ft(1,s),2),e).div(2)),dU=(s,e,t)=>jn(ns(jn(s,e),Wt(jn(s,e),jn(Ft(1,s),t))),1/e),pU=(s,e)=>Cn(no.mul(e.mul(s).sub(1))).div(no.mul(e.mul(s).sub(1))),hs=U(([s])=>s.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),bw=U(([s])=>D(hs(s.z.add(hs(s.y.mul(1)))),hs(s.z.add(hs(s.x.mul(1)))),hs(s.y.add(hs(s.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),fU=U(([s,e,t])=>{const n=D(s).toVar(),i=A(1.4).toVar(),r=A(0).toVar(),o=D(n).toVar();return mt({start:A(0),end:A(3),type:"float",condition:"<="},()=>{const a=D(bw(o.mul(2))).toVar();n.addAssign(a.add(t.mul(A(.1).mul(e)))),o.mulAssign(1.8),i.mulAssign(1.5),n.mulAssign(1.2);const c=A(hs(n.z.add(hs(n.x.add(hs(n.y)))))).toVar();r.addAssign(c.div(i)),o.addAssign(.14)}),r}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"p",type:"vec3"},{name:"spd",type:"float"},{name:"time",type:"float"}]}),mU=U(([s,e,t=z(.5)])=>Yg(s.sub(t),e).add(t)),gU=U(([s,e,t=z(.5)])=>{const n=s.sub(t),i=n.dot(n),o=i.mul(i).mul(e);return s.add(n.mul(o))}),xU=U(({position:s=null,horizontal:e=!0,vertical:t=!1})=>{let n;s!==null?(n=Ui.toVar(),n[3][0]=s.x,n[3][1]=s.y,n[3][2]=s.z):n=Ui;const i=pi.mul(n);return Vc(e)&&(i[0][0]=Ui[0].length(),i[0][1]=0,i[0][2]=0),Vc(t)&&(i[1][0]=0,i[1][1]=Ui[1].length(),i[1][2]=0),i[2][0]=0,i[2][1]=0,i[2][2]=1,ci.mul(i).mul(en)}),_U=U(([s=null])=>{const e=wh();return wh(kg(s)).sub(e).lessThan(0).select(yr,s)}),H_=new WeakMap;class yU extends pt{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.updateType=We.OBJECT,this.updateAfterType=We.OBJECT,this.previousModelWorldMatrix=pe(new Fe),this.previousProjectionMatrix=pe(new Fe).setGroup(_t),this.previousCameraViewMatrix=pe(new Fe)}update({frameId:e,camera:t,object:n}){const i=W_(n);this.previousModelWorldMatrix.value.copy(i);const r=ww(t);r.frameId!==e&&(r.frameId=e,r.previousProjectionMatrix===void 0?(r.previousProjectionMatrix=new Fe,r.previousCameraViewMatrix=new Fe,r.currentProjectionMatrix=new Fe,r.currentCameraViewMatrix=new Fe,r.previousProjectionMatrix.copy(t.projectionMatrix),r.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(r.previousProjectionMatrix.copy(r.currentProjectionMatrix),r.previousCameraViewMatrix.copy(r.currentCameraViewMatrix)),r.currentProjectionMatrix.copy(t.projectionMatrix),r.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(r.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(r.previousCameraViewMatrix))}updateAfter({object:e}){W_(e).copy(e.matrixWorld)}setup(){const e=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),t=ci.mul(ys).mul(en),n=this.previousProjectionMatrix.mul(e).mul(Sh),i=t.xy.div(t.w),r=n.xy.div(n.w);return Ft(i,r)}}function ww(s){let e=H_.get(s);return e===void 0&&(e={},H_.set(s,e)),e}function W_(s,e=0){const t=ww(s);let n=t[e];return n===void 0&&(t[e]=n=new Fe),n}const vU=fe(yU),MU=U(([s,e])=>Mn(1,s.oneMinus().div(e)).oneMinus()).setLayout({name:"burnBlend",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),SU=U(([s,e])=>Mn(s.div(e.oneMinus()),1)).setLayout({name:"dodgeBlend",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),TU=U(([s,e])=>s.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"screenBlend",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),bU=U(([s,e])=>it(s.mul(2).mul(e),s.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),ul(.5,s))).setLayout({name:"overlayBlend",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),wU=U(([s,e,t=L(16)])=>{const n=a=>s.uv(a),i=rt(),r=n(i).toVar(),o=A(t);return mt({start:L(1),end:t,type:"int",condition:"<="},({i:a})=>{const c=e.mul(A(a).div(o.sub(1)).sub(.5));r.addAssign(n(i.add(c)))}),r.divAssign(o),r}),AU=U(([s,e=1])=>{const t=s,n=En(t.rgb),i=D(n),r=Mn(1,ft(0,A(10).mul(n.sub(.45)))),o=i.mul(t.rgb).mul(2),a=A(2).mul(i.oneMinus()).mul(t.rgb.oneMinus()).oneMinus(),c=it(o,a,r),l=t.a.mul(e),u=l.mul(c.rgb);return u.addAssign(t.rgb.mul(l.oneMinus())),oe(u,t.a)}),NU=U(([s])=>{const e=D(s);return oe($t(e,D(.393,.769,.189)),$t(e,D(.349,.686,.168)),$t(e,D(.272,.534,.131)),s.a)}),Aw=U(([s])=>{const e=s.mul(.9478672986).add(.0521327014).pow(2.4),t=s.mul(.0773993808),n=s.lessThanEqual(.04045);return it(e,t,n)}).setLayout({name:"sRGBToLinearSRGB",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Nw=U(([s])=>{const e=s.pow(.41666).mul(1.055).sub(.055),t=s.mul(12.92),n=s.lessThanEqual(.0031308);return it(e,t,n)}).setLayout({name:"linearSRGBTosRGB",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Ew=U(([s,e])=>s.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Cw=U(([s,e])=>(s=s.mul(e),s.div(s.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Rw=U(([s,e])=>{s=s.mul(e),s=s.sub(.004).max(0);const t=s.mul(s.mul(6.2).add(.5)),n=s.mul(s.mul(6.2).add(1.7)).add(.06);return t.div(n).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),EU=U(([s])=>{const e=s.mul(s.add(.0245786)).sub(90537e-9),t=s.mul(s.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),Iw=U(([s,e])=>{const t=Tn(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=Tn(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return s=s.mul(e).div(.6),s=t.mul(s),s=EU(s),s=n.mul(s),s.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),CU=Tn(D(1.6605,-.1246,-.0182),D(-.5876,1.1329,-.1006),D(-.0728,-.0083,1.1187)),RU=Tn(D(.6274,.0691,.0164),D(.3293,.9195,.088),D(.0433,.0113,.8956)),IU=U(([s])=>{const e=D(s).toVar(),t=D(e.mul(e)).toVar(),n=D(t.mul(t)).toVar();return A(15.5).mul(n.mul(t)).sub(ot(40.14,n.mul(e))).add(ot(31.96,n).sub(ot(6.868,t.mul(e))).add(ot(.4298,t).add(ot(.1191,e).sub(.00232))))}),Pw=U(([s,e])=>{const t=D(s).toVar(),n=Tn(D(.856627153315983,.137318972929847,.11189821299995),D(.0951212405381588,.761241990602591,.0767994186031903),D(.0482516061458583,.101439036467562,.811302368396859)),i=Tn(D(1.1271005818144368,-.1413297634984383,-.14132976349843826),D(-.11060664309660323,1.157823702216272,-.11060664309660294),D(-.016493938717834573,-.016493938717834257,1.2519364065950405)),r=A(-12.47393),o=A(4.026069);return t.mulAssign(e),t.assign(RU.mul(t)),t.assign(n.mul(t)),t.assign(ft(t,1e-10)),t.assign(cl(t)),t.assign(t.sub(r).div(o.sub(r))),t.assign(cn(t,0,1)),t.assign(IU(t)),t.assign(i.mul(t)),t.assign(jn(ft(D(0),t),D(2.2))),t.assign(CU.mul(t)),t.assign(cn(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Lw=U(([s,e])=>{const t=A(.76),n=A(.15);s=s.mul(e);const i=Mn(s.r,Mn(s.g,s.b)),r=In(i.lessThan(.08),i.sub(ot(6.25,i.mul(i))),.04);s.subAssign(r);const o=ft(s.r,ft(s.g,s.b));Oe(o.lessThan(t),()=>s);const a=Ft(1,t),c=Ft(1,a.mul(a).div(o.add(a.sub(t))));s.mulAssign(c.div(o));const l=Ft(1,ns(1,n.mul(o.sub(c)).add(1)));return it(s,D(c),l)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class PU extends Ye{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}getNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){e.hasBuiltin(this._builtinName)}generate(e,t){const n=this.getBuiltinName(e),i=this.getNodeType(e);return e.shaderStage==="compute"?e.format(n,i,t):(console.warn(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(i))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}}const Wd=(s,e)=>H(new PU(s,e)),LU=Wd("numWorkgroups","uvec3"),DU=Wd("workgroupId","uvec3"),UU=Wd("localId","uvec3"),FU=Wd("subgroupSize","uint");class OU extends Ye{constructor(e){super(),this.scope=e}generate(e){const{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier
|
|
3870
|
-
`):e.addLineFlowCode(`${t}Barrier()`,this)}}const u0=K(OU),VU=()=>u0("workgroup").append(),BU=()=>u0("storage").append(),zU=()=>u0("texture").append();class kU extends gr{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n;const i=e.context.assign;if(n=super.generate(e),i!==!0){const r=this.getNodeType(e);n=e.format(n,r,t)}return n}}class GU extends Ye{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.scope=e}label(e){return this.name=e,this}getHash(){return this.uuid}setScope(e){return this.scope=e,this}getInputType(){return`${this.scope}Array`}element(e){return H(new kU(this,e))}generate(e){return e.getScopedArray(this.name||`${this.scope}Array_${this.id}`,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}const HU=(s,e)=>H(new GU("Workgroup",s,e));class wn extends pt{static get type(){return"AtomicFunctionNode"}constructor(e,t,n,i=null){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.storeNode=i}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=this.method,n=this.getNodeType(e),i=this.getInputType(e),r=this.pointerNode,o=this.valueNode,a=[];a.push(`&${r.build(e,i)}`),a.push(o.build(e,i));const c=`${e.getMethod(t,n)}( ${a.join(", ")} )`;if(this.storeNode!==null){const l=this.storeNode.build(e,i);e.addLineFlowCode(`${l} = ${c}`,this)}else e.addLineFlowCode(c,this)}}wn.ATOMIC_LOAD="atomicLoad";wn.ATOMIC_STORE="atomicStore";wn.ATOMIC_ADD="atomicAdd";wn.ATOMIC_SUB="atomicSub";wn.ATOMIC_MAX="atomicMax";wn.ATOMIC_MIN="atomicMin";wn.ATOMIC_AND="atomicAnd";wn.ATOMIC_OR="atomicOr";wn.ATOMIC_XOR="atomicXor";const WU=K(wn),Vs=(s,e,t,n)=>{const i=WU(s,e,t,n);return i.append(),i},XU=(s,e,t=null)=>Vs(wn.ATOMIC_STORE,s,e,t),qU=(s,e,t=null)=>Vs(wn.ATOMIC_ADD,s,e,t),$U=(s,e,t=null)=>Vs(wn.ATOMIC_SUB,s,e,t),YU=(s,e,t=null)=>Vs(wn.ATOMIC_MAX,s,e,t),ZU=(s,e,t=null)=>Vs(wn.ATOMIC_MIN,s,e,t),JU=(s,e,t=null)=>Vs(wn.ATOMIC_AND,s,e,t),KU=(s,e,t=null)=>Vs(wn.ATOMIC_OR,s,e,t),jU=(s,e,t=null)=>Vs(wn.ATOMIC_XOR,s,e,t),QU=U(([s=rt()])=>{const e=s.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),cc=U(([s,e,t])=>{const n=A(t).toVar(),i=A(e).toVar(),r=lr(s).toVar();return In(r,i,n)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),Nh=U(([s,e])=>{const t=lr(e).toVar(),n=A(s).toVar();return In(t,n.negate(),n)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),rn=U(([s])=>{const e=A(s).toVar();return L(xr(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Ht=U(([s,e])=>{const t=A(s).toVar();return e.assign(rn(t)),t.sub(A(e))}),eF=U(([s,e,t,n,i,r])=>{const o=A(r).toVar(),a=A(i).toVar(),c=A(n).toVar(),l=A(t).toVar(),u=A(e).toVar(),h=A(s).toVar(),d=A(Ft(1,a)).toVar();return Ft(1,o).mul(h.mul(d).add(u.mul(a))).add(o.mul(l.mul(d).add(c.mul(a))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),tF=U(([s,e,t,n,i,r])=>{const o=A(r).toVar(),a=A(i).toVar(),c=D(n).toVar(),l=D(t).toVar(),u=D(e).toVar(),h=D(s).toVar(),d=A(Ft(1,a)).toVar();return Ft(1,o).mul(h.mul(d).add(u.mul(a))).add(o.mul(l.mul(d).add(c.mul(a))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),Dw=On([eF,tF]),nF=U(([s,e,t,n,i,r,o,a,c,l,u])=>{const h=A(u).toVar(),d=A(l).toVar(),p=A(c).toVar(),f=A(a).toVar(),x=A(o).toVar(),m=A(r).toVar(),g=A(i).toVar(),y=A(n).toVar(),_=A(t).toVar(),v=A(e).toVar(),I=A(s).toVar(),T=A(Ft(1,p)).toVar(),w=A(Ft(1,d)).toVar();return A(Ft(1,h)).toVar().mul(w.mul(I.mul(T).add(v.mul(p))).add(d.mul(_.mul(T).add(y.mul(p))))).add(h.mul(w.mul(g.mul(T).add(m.mul(p))).add(d.mul(x.mul(T).add(f.mul(p))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),iF=U(([s,e,t,n,i,r,o,a,c,l,u])=>{const h=A(u).toVar(),d=A(l).toVar(),p=A(c).toVar(),f=D(a).toVar(),x=D(o).toVar(),m=D(r).toVar(),g=D(i).toVar(),y=D(n).toVar(),_=D(t).toVar(),v=D(e).toVar(),I=D(s).toVar(),T=A(Ft(1,p)).toVar(),w=A(Ft(1,d)).toVar();return A(Ft(1,h)).toVar().mul(w.mul(I.mul(T).add(v.mul(p))).add(d.mul(_.mul(T).add(y.mul(p))))).add(h.mul(w.mul(g.mul(T).add(m.mul(p))).add(d.mul(x.mul(T).add(f.mul(p))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),Uw=On([nF,iF]),sF=U(([s,e,t])=>{const n=A(t).toVar(),i=A(e).toVar(),r=ve(s).toVar(),o=ve(r.bitAnd(ve(7))).toVar(),a=A(cc(o.lessThan(ve(4)),i,n)).toVar(),c=A(ot(2,cc(o.lessThan(ve(4)),n,i))).toVar();return Nh(a,lr(o.bitAnd(ve(1)))).add(Nh(c,lr(o.bitAnd(ve(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),rF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=A(e).toVar(),a=ve(s).toVar(),c=ve(a.bitAnd(ve(15))).toVar(),l=A(cc(c.lessThan(ve(8)),o,r)).toVar(),u=A(cc(c.lessThan(ve(4)),r,cc(c.equal(ve(12)).or(c.equal(ve(14))),o,i))).toVar();return Nh(l,lr(c.bitAnd(ve(1)))).add(Nh(u,lr(c.bitAnd(ve(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),yn=On([sF,rF]),oF=U(([s,e,t])=>{const n=A(t).toVar(),i=A(e).toVar(),r=Aa(s).toVar();return D(yn(r.x,i,n),yn(r.y,i,n),yn(r.z,i,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),aF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=A(e).toVar(),a=Aa(s).toVar();return D(yn(a.x,o,r,i),yn(a.y,o,r,i),yn(a.z,o,r,i))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Ri=On([oF,aF]),cF=U(([s])=>{const e=A(s).toVar();return ot(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),lF=U(([s])=>{const e=A(s).toVar();return ot(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),uF=U(([s])=>{const e=D(s).toVar();return ot(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Fw=On([cF,uF]),hF=U(([s])=>{const e=D(s).toVar();return ot(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Ow=On([lF,hF]),yi=U(([s,e])=>{const t=L(e).toVar(),n=ve(s).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(L(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),Vw=U(([s,e,t])=>{s.subAssign(t),s.bitXorAssign(yi(t,L(4))),t.addAssign(e),e.subAssign(s),e.bitXorAssign(yi(s,L(6))),s.addAssign(t),t.subAssign(e),t.bitXorAssign(yi(e,L(8))),e.addAssign(s),s.subAssign(t),s.bitXorAssign(yi(t,L(16))),t.addAssign(e),e.subAssign(s),e.bitXorAssign(yi(s,L(19))),s.addAssign(t),t.subAssign(e),t.bitXorAssign(yi(e,L(4))),e.addAssign(s)}),Tl=U(([s,e,t])=>{const n=ve(t).toVar(),i=ve(e).toVar(),r=ve(s).toVar();return n.bitXorAssign(i),n.subAssign(yi(i,L(14))),r.bitXorAssign(n),r.subAssign(yi(n,L(11))),i.bitXorAssign(r),i.subAssign(yi(r,L(25))),n.bitXorAssign(i),n.subAssign(yi(i,L(16))),r.bitXorAssign(n),r.subAssign(yi(n,L(4))),i.bitXorAssign(r),i.subAssign(yi(r,L(14))),n.bitXorAssign(i),n.subAssign(yi(i,L(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Xn=U(([s])=>{const e=ve(s).toVar();return A(e).div(A(ve(L(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),ms=U(([s])=>{const e=A(s).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),dF=U(([s])=>{const e=L(s).toVar(),t=ve(ve(1)).toVar(),n=ve(ve(L(3735928559)).add(t.shiftLeft(ve(2))).add(ve(13))).toVar();return Tl(n.add(ve(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),pF=U(([s,e])=>{const t=L(e).toVar(),n=L(s).toVar(),i=ve(ve(2)).toVar(),r=ve().toVar(),o=ve().toVar(),a=ve().toVar();return r.assign(o.assign(a.assign(ve(L(3735928559)).add(i.shiftLeft(ve(2))).add(ve(13))))),r.addAssign(ve(n)),o.addAssign(ve(t)),Tl(r,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),fF=U(([s,e,t])=>{const n=L(t).toVar(),i=L(e).toVar(),r=L(s).toVar(),o=ve(ve(3)).toVar(),a=ve().toVar(),c=ve().toVar(),l=ve().toVar();return a.assign(c.assign(l.assign(ve(L(3735928559)).add(o.shiftLeft(ve(2))).add(ve(13))))),a.addAssign(ve(r)),c.addAssign(ve(i)),l.addAssign(ve(n)),Tl(a,c,l)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),mF=U(([s,e,t,n])=>{const i=L(n).toVar(),r=L(t).toVar(),o=L(e).toVar(),a=L(s).toVar(),c=ve(ve(4)).toVar(),l=ve().toVar(),u=ve().toVar(),h=ve().toVar();return l.assign(u.assign(h.assign(ve(L(3735928559)).add(c.shiftLeft(ve(2))).add(ve(13))))),l.addAssign(ve(a)),u.addAssign(ve(o)),h.addAssign(ve(r)),Vw(l,u,h),l.addAssign(ve(i)),Tl(l,u,h)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),gF=U(([s,e,t,n,i])=>{const r=L(i).toVar(),o=L(n).toVar(),a=L(t).toVar(),c=L(e).toVar(),l=L(s).toVar(),u=ve(ve(5)).toVar(),h=ve().toVar(),d=ve().toVar(),p=ve().toVar();return h.assign(d.assign(p.assign(ve(L(3735928559)).add(u.shiftLeft(ve(2))).add(ve(13))))),h.addAssign(ve(l)),d.addAssign(ve(c)),p.addAssign(ve(a)),Vw(h,d,p),h.addAssign(ve(o)),d.addAssign(ve(r)),Tl(h,d,p)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),Pt=On([dF,pF,fF,mF,gF]),xF=U(([s,e])=>{const t=L(e).toVar(),n=L(s).toVar(),i=ve(Pt(n,t)).toVar(),r=Aa().toVar();return r.x.assign(i.bitAnd(L(255))),r.y.assign(i.shiftRight(L(8)).bitAnd(L(255))),r.z.assign(i.shiftRight(L(16)).bitAnd(L(255))),r}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),_F=U(([s,e,t])=>{const n=L(t).toVar(),i=L(e).toVar(),r=L(s).toVar(),o=ve(Pt(r,i,n)).toVar(),a=Aa().toVar();return a.x.assign(o.bitAnd(L(255))),a.y.assign(o.shiftRight(L(8)).bitAnd(L(255))),a.z.assign(o.shiftRight(L(16)).bitAnd(L(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),Ii=On([xF,_F]),yF=U(([s])=>{const e=z(s).toVar(),t=L().toVar(),n=L().toVar(),i=A(Ht(e.x,t)).toVar(),r=A(Ht(e.y,n)).toVar(),o=A(ms(i)).toVar(),a=A(ms(r)).toVar(),c=A(Dw(yn(Pt(t,n),i,r),yn(Pt(t.add(L(1)),n),i.sub(1),r),yn(Pt(t,n.add(L(1))),i,r.sub(1)),yn(Pt(t.add(L(1)),n.add(L(1))),i.sub(1),r.sub(1)),o,a)).toVar();return Fw(c)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),vF=U(([s])=>{const e=D(s).toVar(),t=L().toVar(),n=L().toVar(),i=L().toVar(),r=A(Ht(e.x,t)).toVar(),o=A(Ht(e.y,n)).toVar(),a=A(Ht(e.z,i)).toVar(),c=A(ms(r)).toVar(),l=A(ms(o)).toVar(),u=A(ms(a)).toVar(),h=A(Uw(yn(Pt(t,n,i),r,o,a),yn(Pt(t.add(L(1)),n,i),r.sub(1),o,a),yn(Pt(t,n.add(L(1)),i),r,o.sub(1),a),yn(Pt(t.add(L(1)),n.add(L(1)),i),r.sub(1),o.sub(1),a),yn(Pt(t,n,i.add(L(1))),r,o,a.sub(1)),yn(Pt(t.add(L(1)),n,i.add(L(1))),r.sub(1),o,a.sub(1)),yn(Pt(t,n.add(L(1)),i.add(L(1))),r,o.sub(1),a.sub(1)),yn(Pt(t.add(L(1)),n.add(L(1)),i.add(L(1))),r.sub(1),o.sub(1),a.sub(1)),c,l,u)).toVar();return Ow(h)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),h0=On([yF,vF]),MF=U(([s])=>{const e=z(s).toVar(),t=L().toVar(),n=L().toVar(),i=A(Ht(e.x,t)).toVar(),r=A(Ht(e.y,n)).toVar(),o=A(ms(i)).toVar(),a=A(ms(r)).toVar(),c=D(Dw(Ri(Ii(t,n),i,r),Ri(Ii(t.add(L(1)),n),i.sub(1),r),Ri(Ii(t,n.add(L(1))),i,r.sub(1)),Ri(Ii(t.add(L(1)),n.add(L(1))),i.sub(1),r.sub(1)),o,a)).toVar();return Fw(c)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),SF=U(([s])=>{const e=D(s).toVar(),t=L().toVar(),n=L().toVar(),i=L().toVar(),r=A(Ht(e.x,t)).toVar(),o=A(Ht(e.y,n)).toVar(),a=A(Ht(e.z,i)).toVar(),c=A(ms(r)).toVar(),l=A(ms(o)).toVar(),u=A(ms(a)).toVar(),h=D(Uw(Ri(Ii(t,n,i),r,o,a),Ri(Ii(t.add(L(1)),n,i),r.sub(1),o,a),Ri(Ii(t,n.add(L(1)),i),r,o.sub(1),a),Ri(Ii(t.add(L(1)),n.add(L(1)),i),r.sub(1),o.sub(1),a),Ri(Ii(t,n,i.add(L(1))),r,o,a.sub(1)),Ri(Ii(t.add(L(1)),n,i.add(L(1))),r.sub(1),o,a.sub(1)),Ri(Ii(t,n.add(L(1)),i.add(L(1))),r,o.sub(1),a.sub(1)),Ri(Ii(t.add(L(1)),n.add(L(1)),i.add(L(1))),r.sub(1),o.sub(1),a.sub(1)),c,l,u)).toVar();return Ow(h)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),d0=On([MF,SF]),TF=U(([s])=>{const e=A(s).toVar(),t=L(rn(e)).toVar();return Xn(Pt(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),bF=U(([s])=>{const e=z(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar();return Xn(Pt(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),wF=U(([s])=>{const e=D(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar();return Xn(Pt(t,n,i))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),AF=U(([s])=>{const e=oe(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar(),r=L(rn(e.w)).toVar();return Xn(Pt(t,n,i,r))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),NF=On([TF,bF,wF,AF]),EF=U(([s])=>{const e=A(s).toVar(),t=L(rn(e)).toVar();return D(Xn(Pt(t,L(0))),Xn(Pt(t,L(1))),Xn(Pt(t,L(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),CF=U(([s])=>{const e=z(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar();return D(Xn(Pt(t,n,L(0))),Xn(Pt(t,n,L(1))),Xn(Pt(t,n,L(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),RF=U(([s])=>{const e=D(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar();return D(Xn(Pt(t,n,i,L(0))),Xn(Pt(t,n,i,L(1))),Xn(Pt(t,n,i,L(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),IF=U(([s])=>{const e=oe(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar(),r=L(rn(e.w)).toVar();return D(Xn(Pt(t,n,i,r,L(0))),Xn(Pt(t,n,i,r,L(1))),Xn(Pt(t,n,i,r,L(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),Bw=On([EF,CF,RF,IF]),Eh=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar(),c=A(0).toVar(),l=A(1).toVar();return mt(o,()=>{c.addAssign(l.mul(h0(a))),l.mulAssign(i),a.mulAssign(r)}),c}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),zw=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar(),c=D(0).toVar(),l=A(1).toVar();return mt(o,()=>{c.addAssign(l.mul(d0(a))),l.mulAssign(i),a.mulAssign(r)}),c}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),PF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar();return z(Eh(a,o,r,i),Eh(a.add(D(L(19),L(193),L(17))),o,r,i))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),LF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar(),c=D(zw(a,o,r,i)).toVar(),l=A(Eh(a.add(D(L(19),L(193),L(17))),o,r,i)).toVar();return oe(c,l)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),DF=U(([s,e,t,n,i,r,o])=>{const a=L(o).toVar(),c=A(r).toVar(),l=L(i).toVar(),u=L(n).toVar(),h=L(t).toVar(),d=L(e).toVar(),p=z(s).toVar(),f=D(Bw(z(d.add(u),h.add(l)))).toVar(),x=z(f.x,f.y).toVar();x.subAssign(.5),x.mulAssign(c),x.addAssign(.5);const m=z(z(A(d),A(h)).add(x)).toVar(),g=z(m.sub(p)).toVar();return Oe(a.equal(L(2)),()=>Dt(g.x).add(Dt(g.y))),Oe(a.equal(L(3)),()=>ft(Dt(g.x),Dt(g.y))),$t(g,g)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),UF=U(([s,e,t,n,i,r,o,a,c])=>{const l=L(c).toVar(),u=A(a).toVar(),h=L(o).toVar(),d=L(r).toVar(),p=L(i).toVar(),f=L(n).toVar(),x=L(t).toVar(),m=L(e).toVar(),g=D(s).toVar(),y=D(Bw(D(m.add(p),x.add(d),f.add(h)))).toVar();y.subAssign(.5),y.mulAssign(u),y.addAssign(.5);const _=D(D(A(m),A(x),A(f)).add(y)).toVar(),v=D(_.sub(g)).toVar();return Oe(l.equal(L(2)),()=>Dt(v.x).add(Dt(v.y)).add(Dt(v.z))),Oe(l.equal(L(3)),()=>ft(ft(Dt(v.x),Dt(v.y)),Dt(v.z))),$t(v,v)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Ca=On([DF,UF]),FF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=z(s).toVar(),o=L().toVar(),a=L().toVar(),c=z(Ht(r.x,o),Ht(r.y,a)).toVar(),l=A(1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:u})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:h})=>{const d=A(Ca(c,u,h,o,a,i,n)).toVar();l.assign(Mn(l,d))})}),Oe(n.equal(L(0)),()=>{l.assign(os(l))}),l}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),OF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=z(s).toVar(),o=L().toVar(),a=L().toVar(),c=z(Ht(r.x,o),Ht(r.y,a)).toVar(),l=z(1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:u})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:h})=>{const d=A(Ca(c,u,h,o,a,i,n)).toVar();Oe(d.lessThan(l.x),()=>{l.y.assign(l.x),l.x.assign(d)}).ElseIf(d.lessThan(l.y),()=>{l.y.assign(d)})})}),Oe(n.equal(L(0)),()=>{l.assign(os(l))}),l}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),VF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=z(s).toVar(),o=L().toVar(),a=L().toVar(),c=z(Ht(r.x,o),Ht(r.y,a)).toVar(),l=D(1e6,1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:u})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:h})=>{const d=A(Ca(c,u,h,o,a,i,n)).toVar();Oe(d.lessThan(l.x),()=>{l.z.assign(l.y),l.y.assign(l.x),l.x.assign(d)}).ElseIf(d.lessThan(l.y),()=>{l.z.assign(l.y),l.y.assign(d)}).ElseIf(d.lessThan(l.z),()=>{l.z.assign(d)})})}),Oe(n.equal(L(0)),()=>{l.assign(os(l))}),l}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),BF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=D(s).toVar(),o=L().toVar(),a=L().toVar(),c=L().toVar(),l=D(Ht(r.x,o),Ht(r.y,a),Ht(r.z,c)).toVar(),u=A(1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:h})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:d})=>{mt({start:-1,end:L(1),name:"z",condition:"<="},({z:p})=>{const f=A(Ca(l,h,d,p,o,a,c,i,n)).toVar();u.assign(Mn(u,f))})})}),Oe(n.equal(L(0)),()=>{u.assign(os(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),zF=On([FF,BF]),kF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=D(s).toVar(),o=L().toVar(),a=L().toVar(),c=L().toVar(),l=D(Ht(r.x,o),Ht(r.y,a),Ht(r.z,c)).toVar(),u=z(1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:h})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:d})=>{mt({start:-1,end:L(1),name:"z",condition:"<="},({z:p})=>{const f=A(Ca(l,h,d,p,o,a,c,i,n)).toVar();Oe(f.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(f)}).ElseIf(f.lessThan(u.y),()=>{u.y.assign(f)})})})}),Oe(n.equal(L(0)),()=>{u.assign(os(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),GF=On([OF,kF]),HF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=D(s).toVar(),o=L().toVar(),a=L().toVar(),c=L().toVar(),l=D(Ht(r.x,o),Ht(r.y,a),Ht(r.z,c)).toVar(),u=D(1e6,1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:h})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:d})=>{mt({start:-1,end:L(1),name:"z",condition:"<="},({z:p})=>{const f=A(Ca(l,h,d,p,o,a,c,i,n)).toVar();Oe(f.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(f)}).ElseIf(f.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(f)}).ElseIf(f.lessThan(u.z),()=>{u.z.assign(f)})})})}),Oe(n.equal(L(0)),()=>{u.assign(os(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),WF=On([VF,HF]),XF=U(([s])=>{const e=s.y,t=s.z,n=D().toVar();return Oe(e.lessThan(1e-4),()=>{n.assign(D(t,t,t))}).Else(()=>{let i=s.x;i=i.sub(xr(i)).mul(6).toVar();const r=L(yg(i)),o=i.sub(A(r)),a=t.mul(e.oneMinus()),c=t.mul(e.mul(o).oneMinus()),l=t.mul(e.mul(o.oneMinus()).oneMinus());Oe(r.equal(L(0)),()=>{n.assign(D(t,l,a))}).ElseIf(r.equal(L(1)),()=>{n.assign(D(c,t,a))}).ElseIf(r.equal(L(2)),()=>{n.assign(D(a,t,l))}).ElseIf(r.equal(L(3)),()=>{n.assign(D(a,c,t))}).ElseIf(r.equal(L(4)),()=>{n.assign(D(l,a,t))}).Else(()=>{n.assign(D(t,a,c))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),qF=U(([s])=>{const e=D(s).toVar(),t=A(e.x).toVar(),n=A(e.y).toVar(),i=A(e.z).toVar(),r=A(Mn(t,Mn(n,i))).toVar(),o=A(ft(t,ft(n,i))).toVar(),a=A(o.sub(r)).toVar(),c=A().toVar(),l=A().toVar(),u=A().toVar();return u.assign(o),Oe(o.greaterThan(0),()=>{l.assign(a.div(o))}).Else(()=>{l.assign(0)}),Oe(l.lessThanEqual(0),()=>{c.assign(0)}).Else(()=>{Oe(t.greaterThanEqual(o),()=>{c.assign(n.sub(i).div(a))}).ElseIf(n.greaterThanEqual(o),()=>{c.assign(Wt(2,i.sub(t).div(a)))}).Else(()=>{c.assign(Wt(4,t.sub(n).div(a)))}),c.mulAssign(1/6),Oe(c.lessThan(0),()=>{c.addAssign(1)})}),D(c,l,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),$F=U(([s])=>{const e=D(s).toVar(),t=ig(fg(e,D(.04045))).toVar(),n=D(e.div(12.92)).toVar(),i=D(jn(ft(e.add(D(.055)),D(0)).div(1.055),D(2.4))).toVar();return it(n,i,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),kw=(s,e)=>{s=A(s),e=A(e);const t=z(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return ti(s.sub(t),s.add(t),e)},Gw=(s,e,t,n)=>it(s,e,t[n].clamp()),YF=(s,e,t=rt())=>Gw(s,e,t,"x"),ZF=(s,e,t=rt())=>Gw(s,e,t,"y"),Hw=(s,e,t,n,i)=>it(s,e,kw(t,n[i])),JF=(s,e,t,n=rt())=>Hw(s,e,t,n,"x"),KF=(s,e,t,n=rt())=>Hw(s,e,t,n,"y"),jF=(s=1,e=0,t=rt())=>t.mul(s).add(e),QF=(s,e=1)=>(s=A(s),s.abs().pow(e).mul(s.sign())),eO=(s,e=1,t=.5)=>A(s).sub(t).mul(e).add(t),tO=(s=rt(),e=1,t=0)=>h0(s.convert("vec2|vec3")).mul(e).add(t),nO=(s=rt(),e=1,t=0)=>d0(s.convert("vec2|vec3")).mul(e).add(t),iO=(s=rt(),e=1,t=0)=>(s=s.convert("vec2|vec3"),oe(d0(s),h0(s.add(z(19,73)))).mul(e).add(t)),sO=(s=rt(),e=1)=>zF(s.convert("vec2|vec3"),e,L(1)),rO=(s=rt(),e=1)=>GF(s.convert("vec2|vec3"),e,L(1)),oO=(s=rt(),e=1)=>WF(s.convert("vec2|vec3"),e,L(1)),aO=(s=rt())=>NF(s.convert("vec2|vec3")),cO=(s=rt(),e=3,t=2,n=.5,i=1)=>Eh(s,L(e),t,n).mul(i),lO=(s=rt(),e=3,t=2,n=.5,i=1)=>PF(s,L(e),t,n).mul(i),uO=(s=rt(),e=3,t=2,n=.5,i=1)=>zw(s,L(e),t,n).mul(i),hO=(s=rt(),e=3,t=2,n=.5,i=1)=>LF(s,L(e),t,n).mul(i),Ww=U(([s,e])=>{const t=s.x,n=s.y,i=s.z;let r=e.element(0).mul(.886227);return r=r.add(e.element(1).mul(2*.511664).mul(n)),r=r.add(e.element(2).mul(2*.511664).mul(i)),r=r.add(e.element(3).mul(2*.511664).mul(t)),r=r.add(e.element(4).mul(2*.429043).mul(t).mul(n)),r=r.add(e.element(5).mul(2*.429043).mul(n).mul(i)),r=r.add(e.element(6).mul(i.mul(i).mul(.743125).sub(.247708))),r=r.add(e.element(7).mul(2*.429043).mul(t).mul(i)),r=r.add(e.element(8).mul(.429043).mul(ot(t,t).sub(ot(n,n)))),r});class Xw extends vr{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=pe(0).setGroup(_t),this.decayExponentNode=pe(0).setGroup(_t)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setup(e){const{colorNode:t,cutoffDistanceNode:n,decayExponentNode:i,light:r}=this,o=e.context.lightingModel,a=Hd(r).sub(Pn),c=a.normalize(),l=a.length(),u=o0({lightDistance:l,cutoffDistance:n,decayExponent:i}),h=t.mul(u),d=e.context.reflectedLight;o.direct({lightDirection:c,lightColor:h,reflectedLight:d},e.stack,e)}}class qw extends vr{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setup(e){super.setup(e);const t=e.context.lightingModel,n=this.colorNode,i=l0(this.light),r=e.context.reflectedLight;t.direct({lightDirection:i,lightColor:n,reflectedLight:r},e.stack,e)}}const of=new Fe,Ru=new Fe;let Za=null;class $w extends vr{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=pe(new E).setGroup(_t),this.halfWidth=pe(new E).setGroup(_t)}update(e){super.update(e);const{light:t}=this,n=e.camera.matrixWorldInverse;Ru.identity(),of.copy(t.matrixWorld),of.premultiply(n),Ru.extractRotation(of),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(Ru),this.halfHeight.value.applyMatrix4(Ru)}setup(e){super.setup(e);let t,n;e.isAvailable("float32Filterable")?(t=xt(Za.LTC_FLOAT_1),n=xt(Za.LTC_FLOAT_2)):(t=xt(Za.LTC_HALF_1),n=xt(Za.LTC_HALF_2));const{colorNode:i,light:r}=this,o=e.context.lightingModel,a=Hd(r),c=e.context.reflectedLight;o.directRectArea({lightColor:i,lightPosition:a,halfWidth:this.halfWidth,halfHeight:this.halfHeight,reflectedLight:c,ltc_1:t,ltc_2:n},e.stack,e)}static setLTC(e){Za=e}}class p0 extends vr{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=pe(0).setGroup(_t),this.penumbraCosNode=pe(0).setGroup(_t),this.cutoffDistanceNode=pe(0).setGroup(_t),this.decayExponentNode=pe(0).setGroup(_t)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e){const{coneCosNode:t,penumbraCosNode:n}=this;return ti(t,n,e)}setup(e){super.setup(e);const t=e.context.lightingModel,{colorNode:n,cutoffDistanceNode:i,decayExponentNode:r,light:o}=this,a=Hd(o).sub(Pn),c=a.normalize(),l=c.dot(l0(o)),u=this.getSpotAttenuation(l),h=a.length(),d=o0({lightDistance:h,cutoffDistance:i,decayExponent:r}),p=n.mul(u).mul(d),f=e.context.reflectedLight;t.direct({lightDirection:c,lightColor:p,reflectedLight:f},e.stack,e)}}class Yw extends p0{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e){const t=this.light.iesMap;let n=null;if(t&&t.isTexture===!0){const i=e.acos().mul(1/Math.PI);n=xt(t,z(i,0),0).r}else n=super.getSpotAttenuation(e);return n}}class Zw extends vr{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class Jw extends vr{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=c0(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=pe(new _e).setGroup(_t)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:n,lightDirectionNode:i}=this,o=di.dot(i).mul(.5).add(.5),a=it(n,t,o);e.context.irradiance.addAssign(a)}}class Kw extends vr{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let n=0;n<9;n++)t.push(new E);this.lightProbe=fs(t)}update(e){const{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){const t=Ww(Id,this.lightProbe);e.context.irradiance.addAssign(t)}}class dO{parseFunction(){console.warn("Abstract function.")}}class jw{constructor(e,t,n="",i=""){this.type=e,this.inputs=t,this.name=n,this.precision=i}getCode(){console.warn("Abstract function.")}}jw.isNodeFunction=!0;const pO=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,fO=/[a-z_0-9]+/ig,X_="#pragma main",mO=s=>{s=s.trim();const e=s.indexOf(X_),t=e!==-1?s.slice(e+X_.length):s,n=t.match(pO);if(n!==null&&n.length===5){const i=n[4],r=[];let o=null;for(;(o=fO.exec(i))!==null;)r.push(o);const a=[];let c=0;for(;c<r.length;){const f=r[c][0]==="const";f===!0&&c++;let x=r[c][0];x==="in"||x==="out"||x==="inout"?c++:x="";const m=r[c++][0];let g=Number.parseInt(r[c][0]);Number.isNaN(g)===!1?c++:g=null;const y=r[c++][0];a.push(new t0(m,y,g,x,f))}const l=t.substring(n[0].length),u=n[3]!==void 0?n[3]:"",h=n[2],d=n[1]!==void 0?n[1]:"",p=e!==-1?s.slice(0,e):"";return{type:h,inputs:a,name:u,precision:d,inputsCode:i,blockCode:l,headerCode:p}}else throw new Error("FunctionNode: Function is not a GLSL code.")};class gO extends jw{constructor(e){const{type:t,inputs:n,name:i,precision:r,inputsCode:o,blockCode:a,headerCode:c}=mO(e);super(t,n,i,r),this.inputsCode=o,this.blockCode=a,this.headerCode=c}getCode(e=this.name){let t;const n=this.blockCode;if(n!==""){const{type:i,inputsCode:r,headerCode:o,precision:a}=this;let c=`${i} ${e} ( ${r.trim()} )`;a!==""&&(c=`${a} ${c}`),t=o+c+n}else t="";return t}}class Qw extends dO{parseFunction(e){return new gO(e)}}class xO{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map,this.colorSpaceNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null;const n=this.getMaterialNodeClass(e.type);if(n!==null){t=new n;for(const i in e)t[i]=e[i]}return t}addColorSpace(e,t){this.addType(e,t,this.colorSpaceNodes)}getColorSpaceFunction(e){return this.colorSpaceNodes.get(e)||null}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t.name,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t)){console.warn(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`Base class ${t} is not a class.`);n.set(t,e)}addClass(e,t,n){if(n.has(t)){console.warn(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`Base class ${t.name} is not a class.`);n.set(t,e)}}class _O extends sl{constructor(e,t,n,i,r,o){super(e,t,n,i,r,o),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}}class eA extends xO{constructor(){super(),this.addLight(Xw,Md),this.addLight(qw,Sd),this.addLight($w,Um),this.addLight(p0,sl),this.addLight(Zw,Td),this.addLight(Jw,vd),this.addLight(Kw,Fm),this.addLight(Yw,_O),this.addToneMapping(Ew,Ch),this.addToneMapping(Cw,Rh),this.addToneMapping(Rw,Gf),this.addToneMapping(Iw,Ih),this.addToneMapping(Pw,Ph),this.addToneMapping(Lw,Lh),this.addColorSpace(Nw,vh(li,kn)),this.addColorSpace(Aw,vh(kn,li))}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:js}}));if(typeof window<"u"){try{typeof document>"u"?require("url").pathToFileURL(__filename).href:go&&go.tagName.toUpperCase()==="SCRIPT"&&go.src||new URL("three-BW2s1Yl-.umd.cjs",document.baseURI).href,window.__THREE__IMPORTS__||(window.__THREE__IMPORTS__=[]),window.__THREE__IMPORTS__.push({url:typeof document>"u"?require("url").pathToFileURL(__filename).href:go&&go.tagName.toUpperCase()==="SCRIPT"&&go.src||new URL("three-BW2s1Yl-.umd.cjs",document.baseURI).href,revision:js})}catch{}window.__THREE__?(console.warn("WARNING: Multiple instances of Three.js being imported. Existing: "+window.__THREE__+", new: "+js),console.warn(window.__THREE__IMPORTS__)):window.__THREE__=js}const yO=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Ih,AONode:kT,AddEquation:Js,AddOperation:kf,AdditiveAnimationBlendMode:jf,AdditiveBlending:lc,AfterImageNode:Jb,AgXToneMapping:Ph,AlphaFormat:qf,AlwaysCompare:Vy,AlwaysDepth:hc,AlwaysStencilFunc:oh,AmbientLight:Td,AmbientLightNode:Zw,AnaglyphPassNode:fw,AnalyticLightNode:vr,AnamorphicNode:jb,AnimationAction:Nv,AnimationClip:ua,AnimationLoader:BI,AnimationMixer:Ev,AnimationObjectGroup:sP,AnimationUtils:UI,ArcCurve:rv,ArrayCamera:lm,ArrayElementNode:gr,ArrowHelper:_P,AssignNode:uM,AttachedBindMode:uf,AttributeNode:Rg,Audio:zm,AudioAnalyser:YI,AudioContext:bd,AudioListener:bv,AudioLoader:Tv,AxesHelper:zv,BRDF_GGX:Cf,BRDF_Lambert:io,BackSide:ln,BasicDepthPacking:Qf,BasicEnvironmentNode:Od,BasicNodeLibrary:eA,BasicShadowMap:oA,BatchNode:LT,BatchedMesh:mm,BloomNode:cw,Bone:ed,BooleanKeyframeTrack:fr,Box2:uP,Box3:Wn,Box3Helper:Bv,BoxGeometry:vs,BoxHelper:Vv,Break:Fd,BufferAttribute:At,BufferAttributeNode:_S,BufferGeometry:at,BufferGeometryLoader:vv,BufferNode:Ld,BumpMapNode:eT,BypassNode:TS,ByteType:Wf,Cache:ps,CacheNode:SS,Camera:Zc,CameraHelper:Ov,CanvasTexture:sv,CapsuleGeometry:nd,CatmullRomCurve3:vm,CineonToneMapping:Gf,CircleGeometry:id,ClampToEdgeWrapping:Si,Clock:Bm,CodeNode:Kg,Color:_e,ColorKeyframeTrack:_d,ColorManagement:gt,ColorSpaceNode:dl,CompressedArrayTexture:nv,CompressedCubeTexture:iv,CompressedTexture:jc,CompressedTextureLoader:zI,ComputeNode:vS,ConeGeometry:sd,ConstNode:Wi,ConstantAlphaFactor:uy,ConstantColorFactor:cy,ContextNode:bg,Continue:EL,Controls:Gv,ConvertNode:Km,CubeCamera:Yh,CubeReflectionMapping:wi,CubeRefractionMapping:Vi,CubeTexture:ro,CubeTextureLoader:kI,CubeTextureNode:qS,CubeUVReflectionMapping:dr,CubicBezierCurve:Mm,CubicBezierCurve3:ov,CubicInterpolant:fv,CullFaceBack:af,CullFaceFront:Z_,CullFaceFrontBack:rA,CullFaceNone:Y_,Curve:Gi,CurvePath:cv,CustomBlending:Vf,CustomToneMapping:dy,CylinderGeometry:lo,Cylindrical:lP,DFGApprox:$g,D_GGX:sb,Data3DTexture:qh,DataArrayTexture:$c,DataTexture:Oi,DataTextureLoader:xv,DataUtils:Hy,DecrementStencilOp:Sy,DecrementWrapStencilOp:by,DefaultLoadingManager:Lm,DenoiseNode:ow,DepthFormat:er,DepthOfFieldNode:ew,DepthStencilFormat:cr,DepthTexture:co,DetachedBindMode:py,DirectionalLight:Sd,DirectionalLightHelper:Fv,DirectionalLightNode:qw,Discard:ES,DiscreteInterpolant:mv,DisplayP3ColorSpace:Wh,DodecahedronGeometry:rd,DotScreenNode:tw,DoubleSide:Ji,DstAlphaFactor:iy,DstColorFactor:ry,DynamicCopyUsage:xA,DynamicDrawUsage:Hr,DynamicReadUsage:fA,EPSILON:RM,EdgesGeometry:Am,EllipseCurve:td,EnvironmentNode:mb,EqualCompare:Dy,EqualDepth:pc,EqualStencilFunc:Ey,EquirectUVNode:jT,EquirectangularReflectionMapping:sr,EquirectangularRefractionMapping:rr,Euler:ui,EventDispatcher:Ai,ExpressionNode:NS,ExtrudeGeometry:el,FXAANode:aw,F_Schlick:fa,FileLoader:ts,FilmNode:iw,Float16BufferAttribute:Wy,Float32BufferAttribute:Ve,FloatType:Gn,Fn:U,Fog:um,FogExp2:jh,FogExp2Node:Mw,FogNode:Gd,FogRangeNode:vw,FramebufferTexture:_m,FrontFacingNode:OS,FrontSide:gs,Frustum:xa,FunctionCallNode:dM,FunctionNode:jg,FunctionOverloadingNode:Lb,GLBufferAttribute:cP,GLSL1:yA,GLSL3:ah,GLSLNodeParser:Qw,GTAONode:rw,GaussianBlurNode:Zb,GreaterCompare:Uy,GreaterDepth:mc,GreaterEqualCompare:Oy,GreaterEqualDepth:fc,GreaterEqualStencilFunc:Py,GreaterStencilFunc:Ry,GridHelper:Uv,Group:Wr,HalfFloatType:Ln,HemisphereLight:vd,HemisphereLightHelper:mP,HemisphereLightNode:Jw,IESSpotLightNode:Yw,INFINITY:HP,IcosahedronGeometry:ad,If:Oe,ImageBitmapLoader:Sv,ImageLoader:Uc,ImageUtils:ky,IncrementStencilOp:My,IncrementWrapStencilOp:Ty,IndexNode:zt,InstanceNode:IT,InstancedBufferAttribute:Fs,InstancedBufferGeometry:Om,InstancedInterleavedBuffer:Hm,InstancedMesh:fm,InstancedPointsNodeMaterial:HL,Int16BufferAttribute:i1,Int32BufferAttribute:s1,Int8BufferAttribute:e1,IntType:ga,InterleavedBuffer:ya,InterleavedBufferAttribute:Us,Interpolant:Ta,InterpolateDiscrete:sa,InterpolateLinear:wc,InterpolateSmooth:Iu,InvertStencilOp:wy,IrradianceNode:WT,JoinNode:qv,KeepStencilOp:Ys,KeyframeTrack:Hi,LOD:dm,LatheGeometry:Qc,Layers:Yc,LessCompare:nm,LessDepth:dc,LessEqualCompare:im,LessEqualDepth:ir,LessEqualStencilFunc:Cy,LessStencilFunc:Ny,Light:mr,LightProbe:Fm,LightProbeNode:Kw,LightingContextNode:GT,LightingModel:Sl,LightingNode:po,LightsNode:BT,Line:Os,Line2NodeMaterial:ZL,Line3:Lv,LineBasicMaterial:Fn,LineBasicNodeMaterial:XL,LineCurve:Sm,LineCurve3:av,LineDashedMaterial:xd,LineDashedNodeMaterial:$L,LineLoop:gm,LineSegments:rs,LinearDisplayP3ColorSpace:qc,LinearFilter:Ut,LinearInterpolant:Pm,LinearMipMapLinearFilter:Hf,LinearMipMapNearestFilter:cA,LinearMipmapLinearFilter:Kn,LinearMipmapNearestFilter:Qs,LinearSRGBColorSpace:li,LinearToneMapping:Ch,LinearTransfer:Nc,Loader:qn,LoaderUtils:dh,LoadingManager:yd,Loop:mt,LoopNode:FT,LoopOnce:Jf,LoopPingPong:my,LoopRepeat:Kf,LuminanceAlphaFormat:Yf,LuminanceFormat:$f,Lut3DNode:sw,MOUSE:q_,MRTNode:Pb,MatcapUVNode:_b,Material:mn,MaterialLoader:rl,MaterialNode:j,MaterialReferenceNode:$S,MathUtils:Xh,Matrix2:Wm,Matrix3:Ke,Matrix4:Fe,MaxEquation:Bf,MaxMipLevelNode:PS,Mesh:kt,MeshBasicMaterial:ss,MeshBasicNodeMaterial:s2,MeshDepthMaterial:Kh,MeshDistanceMaterial:cm,MeshLambertMaterial:gd,MeshLambertNodeMaterial:l2,MeshMatcapMaterial:Rm,MeshMatcapNodeMaterial:$2,MeshNormalMaterial:md,MeshNormalNodeMaterial:jL,MeshPhongMaterial:fd,MeshPhongNodeMaterial:h2,MeshPhysicalMaterial:pd,MeshPhysicalNodeMaterial:xb,MeshSSSNodeMaterial:k2,MeshStandardMaterial:il,MeshStandardNodeMaterial:gb,MeshToonMaterial:Cm,MeshToonNodeMaterial:X2,MinEquation:j_,MirroredRepeatWrapping:ta,MixOperation:zf,ModelNode:is,ModelViewProjectionNode:ET,MorphNode:OT,MultiplyBlending:lf,MultiplyOperation:ma,NearestFilter:Qt,NearestMipMapLinearFilter:aA,NearestMipMapNearestFilter:fy,NearestMipmapLinearFilter:Is,NearestMipmapNearestFilter:Uh,NeutralToneMapping:Lh,NeverCompare:Ly,NeverDepth:uc,NeverStencilFunc:Ay,NoBlending:Fi,NoColorSpace:Li,NoToneMapping:Ti,Node:Ye,NodeAttribute:Df,NodeBuilder:Rb,NodeCache:Fu,NodeCode:Nb,NodeFrame:Ib,NodeFunctionInput:t0,NodeLoader:Tb,NodeMaterial:Tt,NodeMaterialLoader:bb,NodeMaterialObserver:Hv,NodeObjectLoader:i3,NodeShaderStage:_f,NodeType:SP,NodeUniform:wb,NodeUpdateType:We,NodeUtils:MP,NodeVar:Zg,NodeVarying:Ab,NormalAnimationBlendMode:Hh,NormalBlending:Ls,NormalMapNode:QS,NotEqualCompare:Fy,NotEqualDepth:gc,NotEqualStencilFunc:Iy,NumberKeyframeTrack:ca,Object3D:yt,Object3DNode:wt,ObjectLoader:Mv,ObjectSpaceNormalMap:tm,OctahedronGeometry:Ma,OneFactor:ey,OneMinusConstantAlphaFactor:hy,OneMinusConstantColorFactor:ly,OneMinusDstAlphaFactor:sy,OneMinusDstColorFactor:oy,OneMinusSrcAlphaFactor:ku,OneMinusSrcColorFactor:ny,OrthographicCamera:ao,OscNode:pn,OutputStructNode:n0,P3Primaries:Cc,PCFShadowMap:Ff,PCFSoftShadowMap:Of,PI:no,PI2:WP,PMREMGenerator:ch,PMREMNode:pb,ParallaxBarrierPassNode:mw,ParameterNode:Jg,PassNode:bn,Path:Ic,PerspectiveCamera:hn,PhongLightingModel:Xg,PhysicalLightingModel:Bd,PixelationPassNode:uw,Plane:ls,PlaneGeometry:oo,PlaneHelper:xP,PointLight:Md,PointLightHelper:pP,PointLightNode:Xw,PointUVNode:Gb,Points:xm,PointsMaterial:va,PointsNodeMaterial:Z2,PolarGridHelper:gP,PolyhedronGeometry:pr,PositionalAudio:wv,PosterizeNode:qb,PropertyBinding:St,PropertyMixer:Av,PropertyNode:Nt,QuadraticBezierCurve:Tm,QuadraticBezierCurve3:bm,Quaternion:Hn,QuaternionKeyframeTrack:ba,QuaternionLinearInterpolant:gv,RED_GREEN_RGTC2_Format:sh,RED_RGTC1_Format:Zf,REVISION:js,RGBADepthPacking:em,RGBAFormat:Rn,RGBAIntegerFormat:Gh,RGBA_ASTC_10x10_Format:Qu,RGBA_ASTC_10x5_Format:Ju,RGBA_ASTC_10x6_Format:Ku,RGBA_ASTC_10x8_Format:ju,RGBA_ASTC_12x10_Format:eh,RGBA_ASTC_12x12_Format:th,RGBA_ASTC_4x4_Format:Sc,RGBA_ASTC_5x4_Format:Wu,RGBA_ASTC_5x5_Format:Xu,RGBA_ASTC_6x5_Format:qu,RGBA_ASTC_6x6_Format:Tc,RGBA_ASTC_8x5_Format:$u,RGBA_ASTC_8x6_Format:Yu,RGBA_ASTC_8x8_Format:Zu,RGBA_BPTC_Format:jo,RGBA_ETC2_EAC_Format:Mc,RGBA_PVRTC_2BPPV1_Format:Hu,RGBA_PVRTC_4BPPV1_Format:_c,RGBA_S3TC_DXT1_Format:Zo,RGBA_S3TC_DXT3_Format:Jo,RGBA_S3TC_DXT5_Format:Ko,RGBDepthPacking:uA,RGBFormat:zh,RGBIntegerFormat:lA,RGBShiftNode:nw,RGB_BPTC_SIGNED_Format:nh,RGB_BPTC_UNSIGNED_Format:bc,RGB_ETC1_Format:yc,RGB_ETC2_Format:vc,RGB_PVRTC_2BPPV1_Format:Gu,RGB_PVRTC_4BPPV1_Format:xc,RGB_S3TC_DXT1_Format:Yo,RGDepthPacking:hA,RGFormat:ia,RGIntegerFormat:kh,RTTNode:Bb,RangeNode:Sw,RawShaderMaterial:Em,Ray:so,Raycaster:Iv,Rec709Primaries:Ec,RectAreaLight:Um,RectAreaLightNode:$w,RedFormat:Wc,RedIntegerFormat:Xc,ReferenceNode:gl,ReflectorNode:Vb,ReinhardToneMapping:Rh,RemapNode:Cg,RenderOutputNode:CS,RenderTarget:fn,RendererReferenceNode:pS,RepeatWrapping:or,ReplaceStencilOp:vy,Return:ZP,ReverseSubtractEquation:K_,RingGeometry:tl,RotateNode:vb,SIGNED_RED_GREEN_RGTC2_Format:rh,SIGNED_RED_RGTC1_Format:ih,SRGBColorSpace:kn,SRGBTransfer:Vt,SSAAPassNode:hw,Scene:Qh,SceneNode:Qi,Schlick_to_F0:ob,ScreenNode:sn,ScriptableNode:yw,ScriptableValueNode:xw,SetNode:$v,ShaderChunk:lt,ShaderLib:Pi,ShaderMaterial:ki,ShaderNode:tc,ShadowMaterial:dd,ShadowNodeMaterial:e3,Shape:tr,ShapeGeometry:cd,ShapePath:kv,ShapeUtils:ji,ShortType:Xf,Skeleton:Kc,SkeletonHelper:dP,SkinnedMesh:pm,SkinningNode:zg,SobelOperatorNode:Qb,Source:Ks,Sphere:Dn,SphereGeometry:Sa,Spherical:Pv,SphericalHarmonics3:yv,SplineCurve:wm,SplitNode:ph,SpotLight:sl,SpotLightHelper:hP,SpotLightNode:p0,Sprite:hm,SpriteMaterial:Jc,SpriteNodeMaterial:K2,SpriteSheetUVNode:Db,SrcAlphaFactor:zu,SrcAlphaSaturateFactor:ay,SrcColorFactor:ty,StackNode:Cb,StaticCopyUsage:gA,StaticDrawUsage:ra,StaticReadUsage:pA,StereoCamera:Vm,StereoPassNode:dw,StorageArrayElementNode:Ub,StorageBufferNode:r0,StorageTextureNode:Hb,StreamCopyUsage:_A,StreamDrawUsage:dA,StreamReadUsage:mA,StringKeyframeTrack:uo,SubtractEquation:J_,SubtractiveBlending:cf,TBNViewMatrix:$r,TOUCH:$_,TangentSpaceNormalMap:xs,TempNode:pt,TetrahedronGeometry:ld,Texture:Xt,Texture3DNode:Mb,TextureLoader:_v,TextureNode:_s,TextureSizeNode:IS,TextureUtils:zR,TimerNode:Sn,ToneMappingNode:mS,ToonOutlinePassNode:gw,TorusGeometry:nl,TorusKnotGeometry:ud,TransitionNode:lw,Triangle:Jn,TriangleFanDrawMode:_y,TriangleStripDrawMode:xy,TrianglesDrawMode:gy,TriplanarTexturesNode:Fb,TubeGeometry:hd,UVMapping:Dh,Uint16BufferAttribute:$h,Uint32BufferAttribute:rm,Uint8BufferAttribute:t1,Uint8ClampedBufferAttribute:n1,Uniform:Cv,UniformArrayNode:Ug,UniformGroupNode:sg,UniformNode:ho,UniformsGroup:aP,UniformsLib:Se,UniformsUtils:om,UnsignedByteType:es,UnsignedInt101111Type:Bh,UnsignedInt248Type:ar,UnsignedInt5999Type:Vh,UnsignedIntType:Bi,UnsignedShort4444Type:Fh,UnsignedShort5551Type:Oh,UnsignedShortType:na,UserDataNode:Xb,VSMShadowMap:oi,V_GGX_SmithCorrelated:ib,VarNode:aS,VaryingNode:cS,Vector2:J,Vector3:E,Vector4:st,VectorKeyframeTrack:la,VertexColorNode:kb,VideoTexture:tv,ViewportDepthNode:Qn,ViewportDepthTextureNode:YT,ViewportSharedTextureNode:$b,ViewportTextureNode:Ml,VolumeNodeMaterial:n3,WebGL3DRenderTarget:WA,WebGLArrayRenderTarget:HA,WebGLCoordinateSystem:Di,WebGLCubeRenderTarget:Zh,WebGLMultipleRenderTargets:yP,WebGLRenderTarget:zi,WebGLRenderer:jy,WebGLUtils:Ky,WebGPUCoordinateSystem:eo,WireframeGeometry:Nm,WrapAroundEnding:Ac,ZeroCurvatureEnding:kr,ZeroFactor:Q_,ZeroSlopeEnding:Gr,ZeroStencilOp:yy,abs:Dt,acesFilmicToneMapping:Iw,acos:yh,add:Wt,addMethodChaining:te,addNodeElement:JP,afterImage:dD,agxToneMapping:Pw,all:mg,alphaT:mh,anaglyphPass:YD,anamorphic:_D,and:yM,anisotropy:Zs,anisotropyB:Kr,anisotropyT:nc,any:IM,ao:ED,append:jv,arrayBuffer:BP,asin:OM,assign:hM,atan:VM,atan2:$M,atomicAdd:qU,atomicAnd:JU,atomicFunc:Vs,atomicMax:YU,atomicMin:ZU,atomicOr:KU,atomicStore:XU,atomicSub:$U,atomicXor:jU,attenuationColor:hg,attenuationDistance:ug,attribute:vn,backgroundBlurriness:eD,backgroundIntensity:tD,batch:DT,billboarding:xU,bitAnd:TM,bitNot:bM,bitOr:wM,bitXor:AM,bitangentGeometry:gL,bitangentLocal:xL,bitangentView:ZS,bitangentWorld:_L,bitcast:XP,bleach:AU,bloom:OD,blur:db,bool:lr,buffer:ml,bufferAttribute:pl,bumpMap:tT,burn:MU,bvec2:tM,bvec3:ig,bvec4:rM,bypass:bS,cache:sc,call:pM,cameraFar:zo,cameraLogDepth:DS,cameraNear:Bo,cameraNormalMatrix:eL,cameraPosition:Ig,cameraProjectionMatrix:ci,cameraProjectionMatrixInverse:jP,cameraViewMatrix:pi,cameraWorldMatrix:QP,cbrt:eS,ceil:_g,checker:QU,cineonToneMapping:Rw,clamp:cn,clearcoat:fh,clearcoatRoughness:kc,code:zd,color:Qv,colorSpaceToWorking:Eg,colorToDirection:JL,compute:MS,cond:rS,context:wg,convert:aM,convertToTexture:ei,cos:Mi,createCanvasElement:zy,cross:ea,cubeTexture:Pd,dFdx:kM,dFdy:GM,dashSize:jr,defaultBuildStages:yf,defaultShaderStages:Jm,defined:Vc,degrees:DM,denoise:ID,densityFog:tU,depth:Hg,depthPass:uD,difference:JM,diffuseColor:Ct,directionToColor:KT,dispersion:dg,distance:ZM,div:ns,dodge:SU,dof:vD,dot:$t,dotScreen:MD,drawIndex:RT,dynamicBufferAttribute:yS,element:oM,emissive:Sf,equal:fM,equals:PM,equirectUV:Wg,exp:gg,exp2:_h,expression:ur,faceDirection:fl,faceForward:nS,film:TD,float:A,floor:xr,fog:QD,fract:_r,frameGroup:kP,frameId:B3,frontFacing:VS,fwidth:XM,fxaa:PD,gain:hU,gapSize:Hc,gaussianBlur:hD,getColorSpaceMethod:vh,getConstNodeType:Kv,getCurrentStack:ng,getDirection:ub,getDistanceAttenuation:o0,getGeometryRoughness:nb,getRoughness:qg,getShIrradianceAt:Ww,getTextureIndex:i0,global:Bu,glsl:c3,glslFn:l3,grayscale:pD,greaterThan:fg,greaterThanEqual:_M,hash:uU,highPrecisionModelNormalViewMatrix:hL,highPrecisionModelViewMatrix:uL,hue:gD,instance:PT,instanceIndex:vl,instancedBufferAttribute:Mh,instancedDynamicBufferAttribute:Tf,int:L,inverseSqrt:UM,invocationLocalIndex:AL,invocationSubgroupIndex:wL,ior:ic,iridescence:Ed,iridescenceIOR:og,iridescenceThickness:ag,ivec2:us,ivec3:nM,ivec4:iM,js:o3,label:oS,length:Qr,lengthSq:Mg,lessThan:gM,lessThanEqual:xM,lightPosition:c0,lightTargetDirection:l0,lightTargetPosition:Tw,lightViewPosition:Hd,lightingContext:HT,lights:zT,linearDepth:wh,linearSRGBTosRGB:Nw,linearToneMapping:Ew,localId:UU,log:xg,log2:cl,loop:CL,luminance:En,lut3D:bD,mat2:al,mat3:Tn,mat4:Jr,matcapUV:yb,materialAOMap:NT,materialAlphaTest:nT,materialAnisotropy:gT,materialAnisotropyVector:ko,materialAttenuationColor:bT,materialAttenuationDistance:TT,materialClearcoat:uT,materialClearcoatNormal:dT,materialClearcoatRoughness:hT,materialColor:da,materialDispersion:AT,materialEmissive:sT,materialIOR:ST,materialIridescence:xT,materialIridescenceIOR:_T,materialIridescenceThickness:yT,materialLightMap:Bg,materialLineDashOffset:Nf,materialLineDashSize:Og,materialLineGapSize:Vg,materialLineScale:bh,materialLineWidth:Uu,materialMetalness:cT,materialNormal:lT,materialOpacity:Ud,materialPointWidth:wT,materialReference:Ki,materialReflectivity:Du,materialRefractionRatio:kS,materialRotation:pT,materialRoughness:aT,materialSheen:fT,materialSheenRoughness:mT,materialShininess:iT,materialSpecular:rT,materialSpecularColor:oT,materialSpecularIntensity:Af,materialSpecularStrength:rc,materialThickness:MT,materialTransmission:vT,max:ft,maxMipLevel:LS,metalness:zc,min:Mn,mix:it,mixElement:iS,mod:Cd,modInt:pg,modelDirection:oL,modelNormalMatrix:US,modelPosition:aL,modelScale:cL,modelViewMatrix:ys,modelViewPosition:lL,modelViewProjection:Ef,modelWorldMatrix:Ui,modelWorldMatrixInverse:FS,morphReference:VT,motionBlur:wU,mrt:kd,mul:ot,mx_aastep:kw,mx_cell_noise_float:aO,mx_contrast:eO,mx_fractal_noise_float:cO,mx_fractal_noise_vec2:lO,mx_fractal_noise_vec3:uO,mx_fractal_noise_vec4:hO,mx_hsvtorgb:XF,mx_noise_float:tO,mx_noise_vec3:nO,mx_noise_vec4:iO,mx_ramplr:YF,mx_ramptb:ZF,mx_rgbtohsv:qF,mx_safepower:QF,mx_splitlr:JF,mx_splittb:KF,mx_srgb_texture_to_lin_rec709:$F,mx_transform_uv:jF,mx_worley_noise_float:sO,mx_worley_noise_vec2:rO,mx_worley_noise_vec3:oO,negate:BM,neutralToneMapping:Lw,nodeArray:Zr,nodeImmutable:fe,nodeObject:H,nodeObjects:ol,nodeProxy:K,normalFlat:BS,normalGeometry:Rd,normalLocal:hi,normalMap:wf,normalView:di,normalWorld:Id,normalize:vi,not:MM,notEqual:mM,numWorkgroups:LU,objectDirection:tL,objectGroup:lM,objectPosition:iL,objectScale:sL,objectViewPosition:rL,objectWorldMatrix:nL,oneMinus:zM,or:vM,orthographicDepthToViewZ:VL,oscSawtooth:H3,oscSine:z3,oscSquare:k3,oscTriangle:G3,output:cg,outputStruct:U3,overlay:bU,overloadingFn:On,parabola:Uf,parallaxBarrierPass:ZD,parallaxDirection:KS,parallaxUV:vL,parameter:r3,pass:lD,passTexture:Ea,pcurve:dU,perspectiveDepthToViewZ:Gg,pixelationPass:kD,pmremTexture:fb,pointUV:Q3,pointWidth:GP,positionGeometry:Nn,positionLocal:en,positionPrevious:Sh,positionView:Pn,positionViewDirection:Bt,positionWorld:Th,positionWorldDirection:Pg,posterize:oD,pow:jn,pow2:vg,pow3:KM,pow4:jM,property:ai,radians:LM,rand:Tg,range:nU,rangeFog:eU,reciprocal:WM,reference:dn,referenceBuffer:bf,reflect:YM,reflectVector:WS,reflectView:GS,reflector:Y3,refract:Sg,refractVector:XS,refractView:HS,reinhardToneMapping:Cw,remainder:CM,remap:wS,remapClamp:AS,renderGroup:_t,renderOutput:RS,rendererReference:fS,rgbShift:SD,rotate:Yg,rotateUV:mU,roughness:ds,round:HM,rtt:zb,sRGBToLinearSRGB:Aw,sampler:KP,saturate:tS,saturation:fD,screen:TU,screenCoordinate:Na,screenSize:pa,screenUV:yr,scriptable:jD,scriptableValue:Vu,select:In,sepia:NU,setCurrentStack:Bc,shaderStages:vf,sharedUniformGroup:rg,sheen:qr,sheenRoughness:Nd,shiftLeft:NM,shiftRight:EM,shininess:gh,sign:ll,sin:Cn,sinc:pU,skinning:NL,skinningReference:UT,smoothstep:ti,smoothstepElement:sS,sobel:yD,specularColor:ri,specularF90:Gc,spherizeUV:gU,split:zP,spritesheetUV:W3,sqrt:os,ssaaPass:WD,stack:Ou,step:ul,stereoPass:qD,storage:nD,storageBarrier:BU,storageObject:iD,storageTexture:Wb,string:VP,sub:Ft,subgroupIndex:bL,subgroupSize:FU,tan:FM,tangentGeometry:Dd,tangentLocal:xl,tangentView:_l,tangentWorld:YS,temp:Ag,texture:xt,texture3D:Sb,textureBarrier:zU,textureBicubic:lb,textureCubeUV:hb,textureLoad:Ci,textureSize:nr,textureStore:sD,thickness:lg,threshold:Kb,timerDelta:V3,timerGlobal:O3,timerLocal:s0,toOutputColorSpace:lS,toWorkingColorSpace:uS,toneMapping:gS,toneMappingExposure:xS,toonOutlinePass:JD,transformDirection:QM,transformNormal:zS,transformNormalToView:Dg,transformedBentNormalView:jS,transformedBitangentView:JS,transformedBitangentWorld:yL,transformedClearcoatNormalView:qo,transformedNormalView:Yt,transformedNormalWorld:Lg,transformedTangentView:Fg,transformedTangentWorld:mL,transition:VD,transmission:xh,transpose:qM,tri:hs,tri3:bw,triNoise3D:fU,triplanarTexture:q3,triplanarTextures:Ob,trunc:yg,tslFn:OP,uint:ve,uniform:pe,uniformArray:fs,uniformGroup:cM,uniforms:pL,userData:rD,uv:rt,uvec2:eM,uvec3:Aa,uvec4:sM,varying:Un,varyingProperty:Zi,vec2:z,vec3:D,vec4:oe,vectorComponents:wa,velocity:vU,vertexColor:j3,vertexIndex:CT,vibrance:mD,viewZToOrthographicDepth:oc,viewZToPerspectiveDepth:ZT,viewport:Ds,viewportBottomLeft:FL,viewportCoordinate:qT,viewportDepthTexture:kg,viewportLinearDepth:BL,viewportMipTexture:$T,viewportResolution:DL,viewportSafeUV:_U,viewportSharedTexture:aD,viewportSize:XT,viewportTexture:OL,viewportTopLeft:UL,viewportUV:LL,wgsl:a3,wgslFn:u3,workgroupArray:HU,workgroupBarrier:VU,workgroupId:DU,workingToColorSpace:hS,xor:SM},Symbol.toStringTag,{value:"Module"}));function vO(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function MO(s){const e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}exports.ACESFilmicToneMapping=Ih;exports.AdditiveBlending=lc;exports.AgXToneMapping=Ph;exports.AlwaysDepth=hc;exports.AlwaysStencilFunc=oh;exports.AmbientLight=Td;exports.AnimationClip=ua;exports.AnimationMixer=Ev;exports.ArrayCamera=lm;exports.Audio=zm;exports.AudioContext=bd;exports.AudioListener=bv;exports.AudioLoader=Tv;exports.AxesHelper=zv;exports.BackSide=ln;exports.BasicDepthPacking=Qf;exports.BasicNodeLibrary=eA;exports.BatchedMesh=mm;exports.Bone=ed;exports.BooleanKeyframeTrack=fr;exports.Box3=Wn;exports.Box3Helper=Bv;exports.BoxGeometry=vs;exports.BoxHelper=Vv;exports.BufferAttribute=At;exports.BufferGeometry=at;exports.Cache=ps;exports.Camera=Zc;exports.CameraHelper=Ov;exports.CanvasTexture=sv;exports.CatmullRomCurve3=vm;exports.ClampToEdgeWrapping=Si;exports.Clock=Bm;exports.Color=_e;exports.ColorKeyframeTrack=_d;exports.ColorManagement=gt;exports.CompressedArrayTexture=nv;exports.CompressedCubeTexture=iv;exports.CompressedTexture=jc;exports.Controls=Gv;exports.CubeCamera=Yh;exports.CubeTexture=ro;exports.CubeUVReflectionMapping=dr;exports.Curve=Gi;exports.CustomBlending=Vf;exports.CylinderGeometry=lo;exports.Data3DTexture=qh;exports.DataTexture=Oi;exports.DataTextureLoader=xv;exports.DataUtils=Hy;exports.DecrementStencilOp=Sy;exports.DecrementWrapStencilOp=by;exports.DefaultLoadingManager=Lm;exports.DepthFormat=er;exports.DepthStencilFormat=cr;exports.DepthTexture=co;exports.DirectionalLight=Sd;exports.DirectionalLightHelper=Fv;exports.DoubleSide=Ji;exports.DynamicDrawUsage=Hr;exports.EdgesGeometry=Am;exports.EqualDepth=pc;exports.EqualStencilFunc=Ey;exports.EquirectangularReflectionMapping=sr;exports.EquirectangularRefractionMapping=rr;exports.Euler=ui;exports.EventDispatcher=Ai;exports.ExtrudeGeometry=el;exports.FileLoader=ts;exports.Float32BufferAttribute=Ve;exports.FloatType=Gn;exports.Fog=um;exports.FrontSide=gs;exports.Frustum=xa;exports.GLSL3=ah;exports.GLSLNodeParser=Qw;exports.GreaterDepth=mc;exports.GreaterEqualDepth=fc;exports.GreaterEqualStencilFunc=Py;exports.GreaterStencilFunc=Ry;exports.GridHelper=Uv;exports.Group=Wr;exports.HalfFloatType=Ln;exports.HemisphereLight=vd;exports.ImageBitmapLoader=Sv;exports.IncrementStencilOp=My;exports.IncrementWrapStencilOp=Ty;exports.InstancedBufferAttribute=Fs;exports.InstancedBufferGeometry=Om;exports.InstancedInterleavedBuffer=Hm;exports.InstancedMesh=fm;exports.InterleavedBuffer=ya;exports.InterleavedBufferAttribute=Us;exports.Interpolant=Ta;exports.InterpolateDiscrete=sa;exports.InterpolateLinear=wc;exports.InvertStencilOp=wy;exports.KeepStencilOp=Ys;exports.KeyframeTrack=Hi;exports.LOD=dm;exports.Layers=Yc;exports.LessDepth=dc;exports.LessEqualDepth=ir;exports.LessEqualStencilFunc=Cy;exports.LessStencilFunc=Ny;exports.Line=Os;exports.Line3=Lv;exports.LineBasicMaterial=Fn;exports.LineLoop=gm;exports.LineSegments=rs;exports.LinearFilter=Ut;exports.LinearMipMapLinearFilter=Hf;exports.LinearMipmapLinearFilter=Kn;exports.LinearMipmapNearestFilter=Qs;exports.LinearSRGBColorSpace=li;exports.LinearToneMapping=Ch;exports.Loader=qn;exports.LoaderUtils=dh;exports.LoadingManager=yd;exports.LoopOnce=Jf;exports.LoopRepeat=Kf;exports.MOUSE=q_;exports.Material=mn;exports.MathUtils=Xh;exports.Matrix3=Ke;exports.Matrix4=Fe;exports.MaxEquation=Bf;exports.Mesh=kt;exports.MeshBasicMaterial=ss;exports.MeshDepthMaterial=Kh;exports.MeshLambertMaterial=gd;exports.MeshNormalMaterial=md;exports.MeshPhongMaterial=fd;exports.MeshPhysicalMaterial=pd;exports.MeshStandardMaterial=il;exports.MirroredRepeatWrapping=ta;exports.NearestFilter=Qt;exports.NearestMipMapNearestFilter=fy;exports.NearestMipmapLinearFilter=Is;exports.NearestMipmapNearestFilter=Uh;exports.NeutralToneMapping=Lh;exports.NeverDepth=uc;exports.NeverStencilFunc=Ay;exports.NoBlending=Fi;exports.NoColorSpace=Li;exports.NoToneMapping=Ti;exports.Node=Ye;exports.NodeBuilder=Rb;exports.NodeFrame=Ib;exports.NormalBlending=Ls;exports.NotEqualDepth=gc;exports.NotEqualStencilFunc=Iy;exports.NumberKeyframeTrack=ca;exports.Object3D=yt;exports.OctahedronGeometry=Ma;exports.OrthographicCamera=ao;exports.PCFSoftShadowMap$1=Of;exports.PMREMGenerator$1=ch;exports.PerspectiveCamera=hn;exports.Plane=ls;exports.PlaneGeometry=oo;exports.PointLight=Md;exports.Points=xm;exports.PointsMaterial=va;exports.PositionalAudio=wv;exports.PropertyBinding=St;exports.Quaternion=Hn;exports.QuaternionKeyframeTrack=ba;exports.REVISION=js;exports.RGBADepthPacking=em;exports.RGBAFormat=Rn;exports.RGBA_ASTC_4x4_Format=Sc;exports.RGBA_ASTC_6x6_Format=Tc;exports.RGBA_BPTC_Format=jo;exports.RGBA_ETC2_EAC_Format=Mc;exports.RGBA_PVRTC_4BPPV1_Format=_c;exports.RGBA_S3TC_DXT1_Format=Zo;exports.RGBA_S3TC_DXT3_Format=Jo;exports.RGBA_S3TC_DXT5_Format=Ko;exports.RGBFormat=zh;exports.RGB_BPTC_UNSIGNED_Format=bc;exports.RGB_ETC1_Format=yc;exports.RGB_ETC2_Format=vc;exports.RGB_PVRTC_4BPPV1_Format=xc;exports.RGB_S3TC_DXT1_Format=Yo;exports.RGFormat=ia;exports.RawShaderMaterial=Em;exports.Ray=so;exports.Raycaster=Iv;exports.RedFormat=Wc;exports.ReinhardToneMapping=Rh;exports.RepeatWrapping=or;exports.ReplaceStencilOp=vy;exports.RingGeometry=tl;exports.SRGBColorSpace=kn;exports.Scene=Qh;exports.ShaderChunk=lt;exports.ShaderLib=Pi;exports.ShaderMaterial=ki;exports.ShadowMaterial=dd;exports.Shape=tr;exports.ShapePath=kv;exports.ShapeUtils=ji;exports.Skeleton=Kc;exports.SkinnedMesh=pm;exports.Source=Ks;exports.Sphere=Dn;exports.SphereGeometry=Sa;exports.Spherical=Pv;exports.SpotLight=sl;exports.Sprite=hm;exports.SpriteMaterial=Jc;exports.THREE=yO;exports.TOUCH=$_;exports.Texture=Xt;exports.TextureLoader=_v;exports.TorusGeometry=nl;exports.Triangle=Jn;exports.TriangleFanDrawMode=_y;exports.TriangleStripDrawMode=xy;exports.TrianglesDrawMode=gy;exports.Uint16BufferAttribute=$h;exports.Uniform$1=Cv;exports.UniformsLib=Se;exports.UniformsUtils=om;exports.UnsignedByteType=es;exports.UnsignedInt101111Type=Bh;exports.UnsignedInt248Type=ar;exports.UnsignedInt5999Type=Vh;exports.UnsignedIntType=Bi;exports.Vector2=J;exports.Vector3=E;exports.Vector4=st;exports.VectorKeyframeTrack=la;exports.VideoTexture=tv;exports.WebGLCubeRenderTarget=Zh;exports.WebGLRenderTarget=zi;exports.WebGLRenderer=jy;exports.WireframeGeometry=Nm;exports.ZeroStencilOp=yy;exports.cloneUniforms=vO;exports.cloneUniformsGroups=MO;exports.defaultShaderStages=Jm;exports.normalView=di;
|
|
3870
|
+
`):e.addLineFlowCode(`${t}Barrier()`,this)}}const u0=K(OU),VU=()=>u0("workgroup").append(),BU=()=>u0("storage").append(),zU=()=>u0("texture").append();class kU extends gr{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n;const i=e.context.assign;if(n=super.generate(e),i!==!0){const r=this.getNodeType(e);n=e.format(n,r,t)}return n}}class GU extends Ye{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.scope=e}label(e){return this.name=e,this}getHash(){return this.uuid}setScope(e){return this.scope=e,this}getInputType(){return`${this.scope}Array`}element(e){return H(new kU(this,e))}generate(e){return e.getScopedArray(this.name||`${this.scope}Array_${this.id}`,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}const HU=(s,e)=>H(new GU("Workgroup",s,e));class wn extends pt{static get type(){return"AtomicFunctionNode"}constructor(e,t,n,i=null){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.storeNode=i}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=this.method,n=this.getNodeType(e),i=this.getInputType(e),r=this.pointerNode,o=this.valueNode,a=[];a.push(`&${r.build(e,i)}`),a.push(o.build(e,i));const c=`${e.getMethod(t,n)}( ${a.join(", ")} )`;if(this.storeNode!==null){const l=this.storeNode.build(e,i);e.addLineFlowCode(`${l} = ${c}`,this)}else e.addLineFlowCode(c,this)}}wn.ATOMIC_LOAD="atomicLoad";wn.ATOMIC_STORE="atomicStore";wn.ATOMIC_ADD="atomicAdd";wn.ATOMIC_SUB="atomicSub";wn.ATOMIC_MAX="atomicMax";wn.ATOMIC_MIN="atomicMin";wn.ATOMIC_AND="atomicAnd";wn.ATOMIC_OR="atomicOr";wn.ATOMIC_XOR="atomicXor";const WU=K(wn),Vs=(s,e,t,n)=>{const i=WU(s,e,t,n);return i.append(),i},XU=(s,e,t=null)=>Vs(wn.ATOMIC_STORE,s,e,t),qU=(s,e,t=null)=>Vs(wn.ATOMIC_ADD,s,e,t),$U=(s,e,t=null)=>Vs(wn.ATOMIC_SUB,s,e,t),YU=(s,e,t=null)=>Vs(wn.ATOMIC_MAX,s,e,t),ZU=(s,e,t=null)=>Vs(wn.ATOMIC_MIN,s,e,t),JU=(s,e,t=null)=>Vs(wn.ATOMIC_AND,s,e,t),KU=(s,e,t=null)=>Vs(wn.ATOMIC_OR,s,e,t),jU=(s,e,t=null)=>Vs(wn.ATOMIC_XOR,s,e,t),QU=U(([s=rt()])=>{const e=s.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),cc=U(([s,e,t])=>{const n=A(t).toVar(),i=A(e).toVar(),r=lr(s).toVar();return In(r,i,n)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),Nh=U(([s,e])=>{const t=lr(e).toVar(),n=A(s).toVar();return In(t,n.negate(),n)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),rn=U(([s])=>{const e=A(s).toVar();return L(xr(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Ht=U(([s,e])=>{const t=A(s).toVar();return e.assign(rn(t)),t.sub(A(e))}),eF=U(([s,e,t,n,i,r])=>{const o=A(r).toVar(),a=A(i).toVar(),c=A(n).toVar(),l=A(t).toVar(),u=A(e).toVar(),h=A(s).toVar(),d=A(Ft(1,a)).toVar();return Ft(1,o).mul(h.mul(d).add(u.mul(a))).add(o.mul(l.mul(d).add(c.mul(a))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),tF=U(([s,e,t,n,i,r])=>{const o=A(r).toVar(),a=A(i).toVar(),c=D(n).toVar(),l=D(t).toVar(),u=D(e).toVar(),h=D(s).toVar(),d=A(Ft(1,a)).toVar();return Ft(1,o).mul(h.mul(d).add(u.mul(a))).add(o.mul(l.mul(d).add(c.mul(a))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),Dw=On([eF,tF]),nF=U(([s,e,t,n,i,r,o,a,c,l,u])=>{const h=A(u).toVar(),d=A(l).toVar(),p=A(c).toVar(),f=A(a).toVar(),x=A(o).toVar(),m=A(r).toVar(),g=A(i).toVar(),y=A(n).toVar(),_=A(t).toVar(),v=A(e).toVar(),I=A(s).toVar(),T=A(Ft(1,p)).toVar(),w=A(Ft(1,d)).toVar();return A(Ft(1,h)).toVar().mul(w.mul(I.mul(T).add(v.mul(p))).add(d.mul(_.mul(T).add(y.mul(p))))).add(h.mul(w.mul(g.mul(T).add(m.mul(p))).add(d.mul(x.mul(T).add(f.mul(p))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),iF=U(([s,e,t,n,i,r,o,a,c,l,u])=>{const h=A(u).toVar(),d=A(l).toVar(),p=A(c).toVar(),f=D(a).toVar(),x=D(o).toVar(),m=D(r).toVar(),g=D(i).toVar(),y=D(n).toVar(),_=D(t).toVar(),v=D(e).toVar(),I=D(s).toVar(),T=A(Ft(1,p)).toVar(),w=A(Ft(1,d)).toVar();return A(Ft(1,h)).toVar().mul(w.mul(I.mul(T).add(v.mul(p))).add(d.mul(_.mul(T).add(y.mul(p))))).add(h.mul(w.mul(g.mul(T).add(m.mul(p))).add(d.mul(x.mul(T).add(f.mul(p))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),Uw=On([nF,iF]),sF=U(([s,e,t])=>{const n=A(t).toVar(),i=A(e).toVar(),r=ve(s).toVar(),o=ve(r.bitAnd(ve(7))).toVar(),a=A(cc(o.lessThan(ve(4)),i,n)).toVar(),c=A(ot(2,cc(o.lessThan(ve(4)),n,i))).toVar();return Nh(a,lr(o.bitAnd(ve(1)))).add(Nh(c,lr(o.bitAnd(ve(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),rF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=A(e).toVar(),a=ve(s).toVar(),c=ve(a.bitAnd(ve(15))).toVar(),l=A(cc(c.lessThan(ve(8)),o,r)).toVar(),u=A(cc(c.lessThan(ve(4)),r,cc(c.equal(ve(12)).or(c.equal(ve(14))),o,i))).toVar();return Nh(l,lr(c.bitAnd(ve(1)))).add(Nh(u,lr(c.bitAnd(ve(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),yn=On([sF,rF]),oF=U(([s,e,t])=>{const n=A(t).toVar(),i=A(e).toVar(),r=Aa(s).toVar();return D(yn(r.x,i,n),yn(r.y,i,n),yn(r.z,i,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),aF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=A(e).toVar(),a=Aa(s).toVar();return D(yn(a.x,o,r,i),yn(a.y,o,r,i),yn(a.z,o,r,i))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Ri=On([oF,aF]),cF=U(([s])=>{const e=A(s).toVar();return ot(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),lF=U(([s])=>{const e=A(s).toVar();return ot(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),uF=U(([s])=>{const e=D(s).toVar();return ot(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Fw=On([cF,uF]),hF=U(([s])=>{const e=D(s).toVar();return ot(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Ow=On([lF,hF]),yi=U(([s,e])=>{const t=L(e).toVar(),n=ve(s).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(L(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),Vw=U(([s,e,t])=>{s.subAssign(t),s.bitXorAssign(yi(t,L(4))),t.addAssign(e),e.subAssign(s),e.bitXorAssign(yi(s,L(6))),s.addAssign(t),t.subAssign(e),t.bitXorAssign(yi(e,L(8))),e.addAssign(s),s.subAssign(t),s.bitXorAssign(yi(t,L(16))),t.addAssign(e),e.subAssign(s),e.bitXorAssign(yi(s,L(19))),s.addAssign(t),t.subAssign(e),t.bitXorAssign(yi(e,L(4))),e.addAssign(s)}),Tl=U(([s,e,t])=>{const n=ve(t).toVar(),i=ve(e).toVar(),r=ve(s).toVar();return n.bitXorAssign(i),n.subAssign(yi(i,L(14))),r.bitXorAssign(n),r.subAssign(yi(n,L(11))),i.bitXorAssign(r),i.subAssign(yi(r,L(25))),n.bitXorAssign(i),n.subAssign(yi(i,L(16))),r.bitXorAssign(n),r.subAssign(yi(n,L(4))),i.bitXorAssign(r),i.subAssign(yi(r,L(14))),n.bitXorAssign(i),n.subAssign(yi(i,L(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Xn=U(([s])=>{const e=ve(s).toVar();return A(e).div(A(ve(L(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),ms=U(([s])=>{const e=A(s).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),dF=U(([s])=>{const e=L(s).toVar(),t=ve(ve(1)).toVar(),n=ve(ve(L(3735928559)).add(t.shiftLeft(ve(2))).add(ve(13))).toVar();return Tl(n.add(ve(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),pF=U(([s,e])=>{const t=L(e).toVar(),n=L(s).toVar(),i=ve(ve(2)).toVar(),r=ve().toVar(),o=ve().toVar(),a=ve().toVar();return r.assign(o.assign(a.assign(ve(L(3735928559)).add(i.shiftLeft(ve(2))).add(ve(13))))),r.addAssign(ve(n)),o.addAssign(ve(t)),Tl(r,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),fF=U(([s,e,t])=>{const n=L(t).toVar(),i=L(e).toVar(),r=L(s).toVar(),o=ve(ve(3)).toVar(),a=ve().toVar(),c=ve().toVar(),l=ve().toVar();return a.assign(c.assign(l.assign(ve(L(3735928559)).add(o.shiftLeft(ve(2))).add(ve(13))))),a.addAssign(ve(r)),c.addAssign(ve(i)),l.addAssign(ve(n)),Tl(a,c,l)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),mF=U(([s,e,t,n])=>{const i=L(n).toVar(),r=L(t).toVar(),o=L(e).toVar(),a=L(s).toVar(),c=ve(ve(4)).toVar(),l=ve().toVar(),u=ve().toVar(),h=ve().toVar();return l.assign(u.assign(h.assign(ve(L(3735928559)).add(c.shiftLeft(ve(2))).add(ve(13))))),l.addAssign(ve(a)),u.addAssign(ve(o)),h.addAssign(ve(r)),Vw(l,u,h),l.addAssign(ve(i)),Tl(l,u,h)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),gF=U(([s,e,t,n,i])=>{const r=L(i).toVar(),o=L(n).toVar(),a=L(t).toVar(),c=L(e).toVar(),l=L(s).toVar(),u=ve(ve(5)).toVar(),h=ve().toVar(),d=ve().toVar(),p=ve().toVar();return h.assign(d.assign(p.assign(ve(L(3735928559)).add(u.shiftLeft(ve(2))).add(ve(13))))),h.addAssign(ve(l)),d.addAssign(ve(c)),p.addAssign(ve(a)),Vw(h,d,p),h.addAssign(ve(o)),d.addAssign(ve(r)),Tl(h,d,p)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),Pt=On([dF,pF,fF,mF,gF]),xF=U(([s,e])=>{const t=L(e).toVar(),n=L(s).toVar(),i=ve(Pt(n,t)).toVar(),r=Aa().toVar();return r.x.assign(i.bitAnd(L(255))),r.y.assign(i.shiftRight(L(8)).bitAnd(L(255))),r.z.assign(i.shiftRight(L(16)).bitAnd(L(255))),r}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),_F=U(([s,e,t])=>{const n=L(t).toVar(),i=L(e).toVar(),r=L(s).toVar(),o=ve(Pt(r,i,n)).toVar(),a=Aa().toVar();return a.x.assign(o.bitAnd(L(255))),a.y.assign(o.shiftRight(L(8)).bitAnd(L(255))),a.z.assign(o.shiftRight(L(16)).bitAnd(L(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),Ii=On([xF,_F]),yF=U(([s])=>{const e=z(s).toVar(),t=L().toVar(),n=L().toVar(),i=A(Ht(e.x,t)).toVar(),r=A(Ht(e.y,n)).toVar(),o=A(ms(i)).toVar(),a=A(ms(r)).toVar(),c=A(Dw(yn(Pt(t,n),i,r),yn(Pt(t.add(L(1)),n),i.sub(1),r),yn(Pt(t,n.add(L(1))),i,r.sub(1)),yn(Pt(t.add(L(1)),n.add(L(1))),i.sub(1),r.sub(1)),o,a)).toVar();return Fw(c)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),vF=U(([s])=>{const e=D(s).toVar(),t=L().toVar(),n=L().toVar(),i=L().toVar(),r=A(Ht(e.x,t)).toVar(),o=A(Ht(e.y,n)).toVar(),a=A(Ht(e.z,i)).toVar(),c=A(ms(r)).toVar(),l=A(ms(o)).toVar(),u=A(ms(a)).toVar(),h=A(Uw(yn(Pt(t,n,i),r,o,a),yn(Pt(t.add(L(1)),n,i),r.sub(1),o,a),yn(Pt(t,n.add(L(1)),i),r,o.sub(1),a),yn(Pt(t.add(L(1)),n.add(L(1)),i),r.sub(1),o.sub(1),a),yn(Pt(t,n,i.add(L(1))),r,o,a.sub(1)),yn(Pt(t.add(L(1)),n,i.add(L(1))),r.sub(1),o,a.sub(1)),yn(Pt(t,n.add(L(1)),i.add(L(1))),r,o.sub(1),a.sub(1)),yn(Pt(t.add(L(1)),n.add(L(1)),i.add(L(1))),r.sub(1),o.sub(1),a.sub(1)),c,l,u)).toVar();return Ow(h)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),h0=On([yF,vF]),MF=U(([s])=>{const e=z(s).toVar(),t=L().toVar(),n=L().toVar(),i=A(Ht(e.x,t)).toVar(),r=A(Ht(e.y,n)).toVar(),o=A(ms(i)).toVar(),a=A(ms(r)).toVar(),c=D(Dw(Ri(Ii(t,n),i,r),Ri(Ii(t.add(L(1)),n),i.sub(1),r),Ri(Ii(t,n.add(L(1))),i,r.sub(1)),Ri(Ii(t.add(L(1)),n.add(L(1))),i.sub(1),r.sub(1)),o,a)).toVar();return Fw(c)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),SF=U(([s])=>{const e=D(s).toVar(),t=L().toVar(),n=L().toVar(),i=L().toVar(),r=A(Ht(e.x,t)).toVar(),o=A(Ht(e.y,n)).toVar(),a=A(Ht(e.z,i)).toVar(),c=A(ms(r)).toVar(),l=A(ms(o)).toVar(),u=A(ms(a)).toVar(),h=D(Uw(Ri(Ii(t,n,i),r,o,a),Ri(Ii(t.add(L(1)),n,i),r.sub(1),o,a),Ri(Ii(t,n.add(L(1)),i),r,o.sub(1),a),Ri(Ii(t.add(L(1)),n.add(L(1)),i),r.sub(1),o.sub(1),a),Ri(Ii(t,n,i.add(L(1))),r,o,a.sub(1)),Ri(Ii(t.add(L(1)),n,i.add(L(1))),r.sub(1),o,a.sub(1)),Ri(Ii(t,n.add(L(1)),i.add(L(1))),r,o.sub(1),a.sub(1)),Ri(Ii(t.add(L(1)),n.add(L(1)),i.add(L(1))),r.sub(1),o.sub(1),a.sub(1)),c,l,u)).toVar();return Ow(h)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),d0=On([MF,SF]),TF=U(([s])=>{const e=A(s).toVar(),t=L(rn(e)).toVar();return Xn(Pt(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),bF=U(([s])=>{const e=z(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar();return Xn(Pt(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),wF=U(([s])=>{const e=D(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar();return Xn(Pt(t,n,i))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),AF=U(([s])=>{const e=oe(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar(),r=L(rn(e.w)).toVar();return Xn(Pt(t,n,i,r))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),NF=On([TF,bF,wF,AF]),EF=U(([s])=>{const e=A(s).toVar(),t=L(rn(e)).toVar();return D(Xn(Pt(t,L(0))),Xn(Pt(t,L(1))),Xn(Pt(t,L(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),CF=U(([s])=>{const e=z(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar();return D(Xn(Pt(t,n,L(0))),Xn(Pt(t,n,L(1))),Xn(Pt(t,n,L(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),RF=U(([s])=>{const e=D(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar();return D(Xn(Pt(t,n,i,L(0))),Xn(Pt(t,n,i,L(1))),Xn(Pt(t,n,i,L(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),IF=U(([s])=>{const e=oe(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar(),r=L(rn(e.w)).toVar();return D(Xn(Pt(t,n,i,r,L(0))),Xn(Pt(t,n,i,r,L(1))),Xn(Pt(t,n,i,r,L(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),Bw=On([EF,CF,RF,IF]),Eh=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar(),c=A(0).toVar(),l=A(1).toVar();return mt(o,()=>{c.addAssign(l.mul(h0(a))),l.mulAssign(i),a.mulAssign(r)}),c}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),zw=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar(),c=D(0).toVar(),l=A(1).toVar();return mt(o,()=>{c.addAssign(l.mul(d0(a))),l.mulAssign(i),a.mulAssign(r)}),c}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),PF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar();return z(Eh(a,o,r,i),Eh(a.add(D(L(19),L(193),L(17))),o,r,i))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),LF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar(),c=D(zw(a,o,r,i)).toVar(),l=A(Eh(a.add(D(L(19),L(193),L(17))),o,r,i)).toVar();return oe(c,l)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),DF=U(([s,e,t,n,i,r,o])=>{const a=L(o).toVar(),c=A(r).toVar(),l=L(i).toVar(),u=L(n).toVar(),h=L(t).toVar(),d=L(e).toVar(),p=z(s).toVar(),f=D(Bw(z(d.add(u),h.add(l)))).toVar(),x=z(f.x,f.y).toVar();x.subAssign(.5),x.mulAssign(c),x.addAssign(.5);const m=z(z(A(d),A(h)).add(x)).toVar(),g=z(m.sub(p)).toVar();return Oe(a.equal(L(2)),()=>Dt(g.x).add(Dt(g.y))),Oe(a.equal(L(3)),()=>ft(Dt(g.x),Dt(g.y))),$t(g,g)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),UF=U(([s,e,t,n,i,r,o,a,c])=>{const l=L(c).toVar(),u=A(a).toVar(),h=L(o).toVar(),d=L(r).toVar(),p=L(i).toVar(),f=L(n).toVar(),x=L(t).toVar(),m=L(e).toVar(),g=D(s).toVar(),y=D(Bw(D(m.add(p),x.add(d),f.add(h)))).toVar();y.subAssign(.5),y.mulAssign(u),y.addAssign(.5);const _=D(D(A(m),A(x),A(f)).add(y)).toVar(),v=D(_.sub(g)).toVar();return Oe(l.equal(L(2)),()=>Dt(v.x).add(Dt(v.y)).add(Dt(v.z))),Oe(l.equal(L(3)),()=>ft(ft(Dt(v.x),Dt(v.y)),Dt(v.z))),$t(v,v)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Ca=On([DF,UF]),FF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=z(s).toVar(),o=L().toVar(),a=L().toVar(),c=z(Ht(r.x,o),Ht(r.y,a)).toVar(),l=A(1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:u})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:h})=>{const d=A(Ca(c,u,h,o,a,i,n)).toVar();l.assign(Mn(l,d))})}),Oe(n.equal(L(0)),()=>{l.assign(os(l))}),l}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),OF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=z(s).toVar(),o=L().toVar(),a=L().toVar(),c=z(Ht(r.x,o),Ht(r.y,a)).toVar(),l=z(1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:u})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:h})=>{const d=A(Ca(c,u,h,o,a,i,n)).toVar();Oe(d.lessThan(l.x),()=>{l.y.assign(l.x),l.x.assign(d)}).ElseIf(d.lessThan(l.y),()=>{l.y.assign(d)})})}),Oe(n.equal(L(0)),()=>{l.assign(os(l))}),l}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),VF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=z(s).toVar(),o=L().toVar(),a=L().toVar(),c=z(Ht(r.x,o),Ht(r.y,a)).toVar(),l=D(1e6,1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:u})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:h})=>{const d=A(Ca(c,u,h,o,a,i,n)).toVar();Oe(d.lessThan(l.x),()=>{l.z.assign(l.y),l.y.assign(l.x),l.x.assign(d)}).ElseIf(d.lessThan(l.y),()=>{l.z.assign(l.y),l.y.assign(d)}).ElseIf(d.lessThan(l.z),()=>{l.z.assign(d)})})}),Oe(n.equal(L(0)),()=>{l.assign(os(l))}),l}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),BF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=D(s).toVar(),o=L().toVar(),a=L().toVar(),c=L().toVar(),l=D(Ht(r.x,o),Ht(r.y,a),Ht(r.z,c)).toVar(),u=A(1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:h})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:d})=>{mt({start:-1,end:L(1),name:"z",condition:"<="},({z:p})=>{const f=A(Ca(l,h,d,p,o,a,c,i,n)).toVar();u.assign(Mn(u,f))})})}),Oe(n.equal(L(0)),()=>{u.assign(os(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),zF=On([FF,BF]),kF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=D(s).toVar(),o=L().toVar(),a=L().toVar(),c=L().toVar(),l=D(Ht(r.x,o),Ht(r.y,a),Ht(r.z,c)).toVar(),u=z(1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:h})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:d})=>{mt({start:-1,end:L(1),name:"z",condition:"<="},({z:p})=>{const f=A(Ca(l,h,d,p,o,a,c,i,n)).toVar();Oe(f.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(f)}).ElseIf(f.lessThan(u.y),()=>{u.y.assign(f)})})})}),Oe(n.equal(L(0)),()=>{u.assign(os(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),GF=On([OF,kF]),HF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=D(s).toVar(),o=L().toVar(),a=L().toVar(),c=L().toVar(),l=D(Ht(r.x,o),Ht(r.y,a),Ht(r.z,c)).toVar(),u=D(1e6,1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:h})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:d})=>{mt({start:-1,end:L(1),name:"z",condition:"<="},({z:p})=>{const f=A(Ca(l,h,d,p,o,a,c,i,n)).toVar();Oe(f.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(f)}).ElseIf(f.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(f)}).ElseIf(f.lessThan(u.z),()=>{u.z.assign(f)})})})}),Oe(n.equal(L(0)),()=>{u.assign(os(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),WF=On([VF,HF]),XF=U(([s])=>{const e=s.y,t=s.z,n=D().toVar();return Oe(e.lessThan(1e-4),()=>{n.assign(D(t,t,t))}).Else(()=>{let i=s.x;i=i.sub(xr(i)).mul(6).toVar();const r=L(yg(i)),o=i.sub(A(r)),a=t.mul(e.oneMinus()),c=t.mul(e.mul(o).oneMinus()),l=t.mul(e.mul(o.oneMinus()).oneMinus());Oe(r.equal(L(0)),()=>{n.assign(D(t,l,a))}).ElseIf(r.equal(L(1)),()=>{n.assign(D(c,t,a))}).ElseIf(r.equal(L(2)),()=>{n.assign(D(a,t,l))}).ElseIf(r.equal(L(3)),()=>{n.assign(D(a,c,t))}).ElseIf(r.equal(L(4)),()=>{n.assign(D(l,a,t))}).Else(()=>{n.assign(D(t,a,c))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),qF=U(([s])=>{const e=D(s).toVar(),t=A(e.x).toVar(),n=A(e.y).toVar(),i=A(e.z).toVar(),r=A(Mn(t,Mn(n,i))).toVar(),o=A(ft(t,ft(n,i))).toVar(),a=A(o.sub(r)).toVar(),c=A().toVar(),l=A().toVar(),u=A().toVar();return u.assign(o),Oe(o.greaterThan(0),()=>{l.assign(a.div(o))}).Else(()=>{l.assign(0)}),Oe(l.lessThanEqual(0),()=>{c.assign(0)}).Else(()=>{Oe(t.greaterThanEqual(o),()=>{c.assign(n.sub(i).div(a))}).ElseIf(n.greaterThanEqual(o),()=>{c.assign(Wt(2,i.sub(t).div(a)))}).Else(()=>{c.assign(Wt(4,t.sub(n).div(a)))}),c.mulAssign(1/6),Oe(c.lessThan(0),()=>{c.addAssign(1)})}),D(c,l,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),$F=U(([s])=>{const e=D(s).toVar(),t=ig(fg(e,D(.04045))).toVar(),n=D(e.div(12.92)).toVar(),i=D(jn(ft(e.add(D(.055)),D(0)).div(1.055),D(2.4))).toVar();return it(n,i,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),kw=(s,e)=>{s=A(s),e=A(e);const t=z(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return ti(s.sub(t),s.add(t),e)},Gw=(s,e,t,n)=>it(s,e,t[n].clamp()),YF=(s,e,t=rt())=>Gw(s,e,t,"x"),ZF=(s,e,t=rt())=>Gw(s,e,t,"y"),Hw=(s,e,t,n,i)=>it(s,e,kw(t,n[i])),JF=(s,e,t,n=rt())=>Hw(s,e,t,n,"x"),KF=(s,e,t,n=rt())=>Hw(s,e,t,n,"y"),jF=(s=1,e=0,t=rt())=>t.mul(s).add(e),QF=(s,e=1)=>(s=A(s),s.abs().pow(e).mul(s.sign())),eO=(s,e=1,t=.5)=>A(s).sub(t).mul(e).add(t),tO=(s=rt(),e=1,t=0)=>h0(s.convert("vec2|vec3")).mul(e).add(t),nO=(s=rt(),e=1,t=0)=>d0(s.convert("vec2|vec3")).mul(e).add(t),iO=(s=rt(),e=1,t=0)=>(s=s.convert("vec2|vec3"),oe(d0(s),h0(s.add(z(19,73)))).mul(e).add(t)),sO=(s=rt(),e=1)=>zF(s.convert("vec2|vec3"),e,L(1)),rO=(s=rt(),e=1)=>GF(s.convert("vec2|vec3"),e,L(1)),oO=(s=rt(),e=1)=>WF(s.convert("vec2|vec3"),e,L(1)),aO=(s=rt())=>NF(s.convert("vec2|vec3")),cO=(s=rt(),e=3,t=2,n=.5,i=1)=>Eh(s,L(e),t,n).mul(i),lO=(s=rt(),e=3,t=2,n=.5,i=1)=>PF(s,L(e),t,n).mul(i),uO=(s=rt(),e=3,t=2,n=.5,i=1)=>zw(s,L(e),t,n).mul(i),hO=(s=rt(),e=3,t=2,n=.5,i=1)=>LF(s,L(e),t,n).mul(i),Ww=U(([s,e])=>{const t=s.x,n=s.y,i=s.z;let r=e.element(0).mul(.886227);return r=r.add(e.element(1).mul(2*.511664).mul(n)),r=r.add(e.element(2).mul(2*.511664).mul(i)),r=r.add(e.element(3).mul(2*.511664).mul(t)),r=r.add(e.element(4).mul(2*.429043).mul(t).mul(n)),r=r.add(e.element(5).mul(2*.429043).mul(n).mul(i)),r=r.add(e.element(6).mul(i.mul(i).mul(.743125).sub(.247708))),r=r.add(e.element(7).mul(2*.429043).mul(t).mul(i)),r=r.add(e.element(8).mul(.429043).mul(ot(t,t).sub(ot(n,n)))),r});class Xw extends vr{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=pe(0).setGroup(_t),this.decayExponentNode=pe(0).setGroup(_t)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setup(e){const{colorNode:t,cutoffDistanceNode:n,decayExponentNode:i,light:r}=this,o=e.context.lightingModel,a=Hd(r).sub(Pn),c=a.normalize(),l=a.length(),u=o0({lightDistance:l,cutoffDistance:n,decayExponent:i}),h=t.mul(u),d=e.context.reflectedLight;o.direct({lightDirection:c,lightColor:h,reflectedLight:d},e.stack,e)}}class qw extends vr{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setup(e){super.setup(e);const t=e.context.lightingModel,n=this.colorNode,i=l0(this.light),r=e.context.reflectedLight;t.direct({lightDirection:i,lightColor:n,reflectedLight:r},e.stack,e)}}const of=new Fe,Ru=new Fe;let Za=null;class $w extends vr{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=pe(new E).setGroup(_t),this.halfWidth=pe(new E).setGroup(_t)}update(e){super.update(e);const{light:t}=this,n=e.camera.matrixWorldInverse;Ru.identity(),of.copy(t.matrixWorld),of.premultiply(n),Ru.extractRotation(of),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(Ru),this.halfHeight.value.applyMatrix4(Ru)}setup(e){super.setup(e);let t,n;e.isAvailable("float32Filterable")?(t=xt(Za.LTC_FLOAT_1),n=xt(Za.LTC_FLOAT_2)):(t=xt(Za.LTC_HALF_1),n=xt(Za.LTC_HALF_2));const{colorNode:i,light:r}=this,o=e.context.lightingModel,a=Hd(r),c=e.context.reflectedLight;o.directRectArea({lightColor:i,lightPosition:a,halfWidth:this.halfWidth,halfHeight:this.halfHeight,reflectedLight:c,ltc_1:t,ltc_2:n},e.stack,e)}static setLTC(e){Za=e}}class p0 extends vr{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=pe(0).setGroup(_t),this.penumbraCosNode=pe(0).setGroup(_t),this.cutoffDistanceNode=pe(0).setGroup(_t),this.decayExponentNode=pe(0).setGroup(_t)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e){const{coneCosNode:t,penumbraCosNode:n}=this;return ti(t,n,e)}setup(e){super.setup(e);const t=e.context.lightingModel,{colorNode:n,cutoffDistanceNode:i,decayExponentNode:r,light:o}=this,a=Hd(o).sub(Pn),c=a.normalize(),l=c.dot(l0(o)),u=this.getSpotAttenuation(l),h=a.length(),d=o0({lightDistance:h,cutoffDistance:i,decayExponent:r}),p=n.mul(u).mul(d),f=e.context.reflectedLight;t.direct({lightDirection:c,lightColor:p,reflectedLight:f},e.stack,e)}}class Yw extends p0{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e){const t=this.light.iesMap;let n=null;if(t&&t.isTexture===!0){const i=e.acos().mul(1/Math.PI);n=xt(t,z(i,0),0).r}else n=super.getSpotAttenuation(e);return n}}class Zw extends vr{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class Jw extends vr{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=c0(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=pe(new _e).setGroup(_t)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:n,lightDirectionNode:i}=this,o=di.dot(i).mul(.5).add(.5),a=it(n,t,o);e.context.irradiance.addAssign(a)}}class Kw extends vr{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let n=0;n<9;n++)t.push(new E);this.lightProbe=fs(t)}update(e){const{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){const t=Ww(Id,this.lightProbe);e.context.irradiance.addAssign(t)}}class dO{parseFunction(){console.warn("Abstract function.")}}class jw{constructor(e,t,n="",i=""){this.type=e,this.inputs=t,this.name=n,this.precision=i}getCode(){console.warn("Abstract function.")}}jw.isNodeFunction=!0;const pO=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,fO=/[a-z_0-9]+/ig,X_="#pragma main",mO=s=>{s=s.trim();const e=s.indexOf(X_),t=e!==-1?s.slice(e+X_.length):s,n=t.match(pO);if(n!==null&&n.length===5){const i=n[4],r=[];let o=null;for(;(o=fO.exec(i))!==null;)r.push(o);const a=[];let c=0;for(;c<r.length;){const f=r[c][0]==="const";f===!0&&c++;let x=r[c][0];x==="in"||x==="out"||x==="inout"?c++:x="";const m=r[c++][0];let g=Number.parseInt(r[c][0]);Number.isNaN(g)===!1?c++:g=null;const y=r[c++][0];a.push(new t0(m,y,g,x,f))}const l=t.substring(n[0].length),u=n[3]!==void 0?n[3]:"",h=n[2],d=n[1]!==void 0?n[1]:"",p=e!==-1?s.slice(0,e):"";return{type:h,inputs:a,name:u,precision:d,inputsCode:i,blockCode:l,headerCode:p}}else throw new Error("FunctionNode: Function is not a GLSL code.")};class gO extends jw{constructor(e){const{type:t,inputs:n,name:i,precision:r,inputsCode:o,blockCode:a,headerCode:c}=mO(e);super(t,n,i,r),this.inputsCode=o,this.blockCode=a,this.headerCode=c}getCode(e=this.name){let t;const n=this.blockCode;if(n!==""){const{type:i,inputsCode:r,headerCode:o,precision:a}=this;let c=`${i} ${e} ( ${r.trim()} )`;a!==""&&(c=`${a} ${c}`),t=o+c+n}else t="";return t}}class Qw extends dO{parseFunction(e){return new gO(e)}}class xO{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map,this.colorSpaceNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null;const n=this.getMaterialNodeClass(e.type);if(n!==null){t=new n;for(const i in e)t[i]=e[i]}return t}addColorSpace(e,t){this.addType(e,t,this.colorSpaceNodes)}getColorSpaceFunction(e){return this.colorSpaceNodes.get(e)||null}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t.name,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t)){console.warn(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`Base class ${t} is not a class.`);n.set(t,e)}addClass(e,t,n){if(n.has(t)){console.warn(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`Base class ${t.name} is not a class.`);n.set(t,e)}}class _O extends sl{constructor(e,t,n,i,r,o){super(e,t,n,i,r,o),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}}class eA extends xO{constructor(){super(),this.addLight(Xw,Md),this.addLight(qw,Sd),this.addLight($w,Um),this.addLight(p0,sl),this.addLight(Zw,Td),this.addLight(Jw,vd),this.addLight(Kw,Fm),this.addLight(Yw,_O),this.addToneMapping(Ew,Ch),this.addToneMapping(Cw,Rh),this.addToneMapping(Rw,Gf),this.addToneMapping(Iw,Ih),this.addToneMapping(Pw,Ph),this.addToneMapping(Lw,Lh),this.addColorSpace(Nw,vh(li,kn)),this.addColorSpace(Aw,vh(kn,li))}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:js}}));if(typeof window<"u"){try{typeof document>"u"?require("url").pathToFileURL(__filename).href:go&&go.tagName.toUpperCase()==="SCRIPT"&&go.src||new URL("three-BjYim-vL.umd.cjs",document.baseURI).href,window.__THREE__IMPORTS__||(window.__THREE__IMPORTS__=[]),window.__THREE__IMPORTS__.push({url:typeof document>"u"?require("url").pathToFileURL(__filename).href:go&&go.tagName.toUpperCase()==="SCRIPT"&&go.src||new URL("three-BjYim-vL.umd.cjs",document.baseURI).href,revision:js})}catch{}window.__THREE__?(console.warn("WARNING: Multiple instances of Three.js being imported. Existing: "+window.__THREE__+", new: "+js),console.warn(window.__THREE__IMPORTS__)):window.__THREE__=js}const yO=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Ih,AONode:kT,AddEquation:Js,AddOperation:kf,AdditiveAnimationBlendMode:jf,AdditiveBlending:lc,AfterImageNode:Jb,AgXToneMapping:Ph,AlphaFormat:qf,AlwaysCompare:Vy,AlwaysDepth:hc,AlwaysStencilFunc:oh,AmbientLight:Td,AmbientLightNode:Zw,AnaglyphPassNode:fw,AnalyticLightNode:vr,AnamorphicNode:jb,AnimationAction:Nv,AnimationClip:ua,AnimationLoader:BI,AnimationMixer:Ev,AnimationObjectGroup:sP,AnimationUtils:UI,ArcCurve:rv,ArrayCamera:lm,ArrayElementNode:gr,ArrowHelper:_P,AssignNode:uM,AttachedBindMode:uf,AttributeNode:Rg,Audio:zm,AudioAnalyser:YI,AudioContext:bd,AudioListener:bv,AudioLoader:Tv,AxesHelper:zv,BRDF_GGX:Cf,BRDF_Lambert:io,BackSide:ln,BasicDepthPacking:Qf,BasicEnvironmentNode:Od,BasicNodeLibrary:eA,BasicShadowMap:oA,BatchNode:LT,BatchedMesh:mm,BloomNode:cw,Bone:ed,BooleanKeyframeTrack:fr,Box2:uP,Box3:Wn,Box3Helper:Bv,BoxGeometry:vs,BoxHelper:Vv,Break:Fd,BufferAttribute:At,BufferAttributeNode:_S,BufferGeometry:at,BufferGeometryLoader:vv,BufferNode:Ld,BumpMapNode:eT,BypassNode:TS,ByteType:Wf,Cache:ps,CacheNode:SS,Camera:Zc,CameraHelper:Ov,CanvasTexture:sv,CapsuleGeometry:nd,CatmullRomCurve3:vm,CineonToneMapping:Gf,CircleGeometry:id,ClampToEdgeWrapping:Si,Clock:Bm,CodeNode:Kg,Color:_e,ColorKeyframeTrack:_d,ColorManagement:gt,ColorSpaceNode:dl,CompressedArrayTexture:nv,CompressedCubeTexture:iv,CompressedTexture:jc,CompressedTextureLoader:zI,ComputeNode:vS,ConeGeometry:sd,ConstNode:Wi,ConstantAlphaFactor:uy,ConstantColorFactor:cy,ContextNode:bg,Continue:EL,Controls:Gv,ConvertNode:Km,CubeCamera:Yh,CubeReflectionMapping:wi,CubeRefractionMapping:Vi,CubeTexture:ro,CubeTextureLoader:kI,CubeTextureNode:qS,CubeUVReflectionMapping:dr,CubicBezierCurve:Mm,CubicBezierCurve3:ov,CubicInterpolant:fv,CullFaceBack:af,CullFaceFront:Z_,CullFaceFrontBack:rA,CullFaceNone:Y_,Curve:Gi,CurvePath:cv,CustomBlending:Vf,CustomToneMapping:dy,CylinderGeometry:lo,Cylindrical:lP,DFGApprox:$g,D_GGX:sb,Data3DTexture:qh,DataArrayTexture:$c,DataTexture:Oi,DataTextureLoader:xv,DataUtils:Hy,DecrementStencilOp:Sy,DecrementWrapStencilOp:by,DefaultLoadingManager:Lm,DenoiseNode:ow,DepthFormat:er,DepthOfFieldNode:ew,DepthStencilFormat:cr,DepthTexture:co,DetachedBindMode:py,DirectionalLight:Sd,DirectionalLightHelper:Fv,DirectionalLightNode:qw,Discard:ES,DiscreteInterpolant:mv,DisplayP3ColorSpace:Wh,DodecahedronGeometry:rd,DotScreenNode:tw,DoubleSide:Ji,DstAlphaFactor:iy,DstColorFactor:ry,DynamicCopyUsage:xA,DynamicDrawUsage:Hr,DynamicReadUsage:fA,EPSILON:RM,EdgesGeometry:Am,EllipseCurve:td,EnvironmentNode:mb,EqualCompare:Dy,EqualDepth:pc,EqualStencilFunc:Ey,EquirectUVNode:jT,EquirectangularReflectionMapping:sr,EquirectangularRefractionMapping:rr,Euler:ui,EventDispatcher:Ai,ExpressionNode:NS,ExtrudeGeometry:el,FXAANode:aw,F_Schlick:fa,FileLoader:ts,FilmNode:iw,Float16BufferAttribute:Wy,Float32BufferAttribute:Ve,FloatType:Gn,Fn:U,Fog:um,FogExp2:jh,FogExp2Node:Mw,FogNode:Gd,FogRangeNode:vw,FramebufferTexture:_m,FrontFacingNode:OS,FrontSide:gs,Frustum:xa,FunctionCallNode:dM,FunctionNode:jg,FunctionOverloadingNode:Lb,GLBufferAttribute:cP,GLSL1:yA,GLSL3:ah,GLSLNodeParser:Qw,GTAONode:rw,GaussianBlurNode:Zb,GreaterCompare:Uy,GreaterDepth:mc,GreaterEqualCompare:Oy,GreaterEqualDepth:fc,GreaterEqualStencilFunc:Py,GreaterStencilFunc:Ry,GridHelper:Uv,Group:Wr,HalfFloatType:Ln,HemisphereLight:vd,HemisphereLightHelper:mP,HemisphereLightNode:Jw,IESSpotLightNode:Yw,INFINITY:HP,IcosahedronGeometry:ad,If:Oe,ImageBitmapLoader:Sv,ImageLoader:Uc,ImageUtils:ky,IncrementStencilOp:My,IncrementWrapStencilOp:Ty,IndexNode:zt,InstanceNode:IT,InstancedBufferAttribute:Fs,InstancedBufferGeometry:Om,InstancedInterleavedBuffer:Hm,InstancedMesh:fm,InstancedPointsNodeMaterial:HL,Int16BufferAttribute:i1,Int32BufferAttribute:s1,Int8BufferAttribute:e1,IntType:ga,InterleavedBuffer:ya,InterleavedBufferAttribute:Us,Interpolant:Ta,InterpolateDiscrete:sa,InterpolateLinear:wc,InterpolateSmooth:Iu,InvertStencilOp:wy,IrradianceNode:WT,JoinNode:qv,KeepStencilOp:Ys,KeyframeTrack:Hi,LOD:dm,LatheGeometry:Qc,Layers:Yc,LessCompare:nm,LessDepth:dc,LessEqualCompare:im,LessEqualDepth:ir,LessEqualStencilFunc:Cy,LessStencilFunc:Ny,Light:mr,LightProbe:Fm,LightProbeNode:Kw,LightingContextNode:GT,LightingModel:Sl,LightingNode:po,LightsNode:BT,Line:Os,Line2NodeMaterial:ZL,Line3:Lv,LineBasicMaterial:Fn,LineBasicNodeMaterial:XL,LineCurve:Sm,LineCurve3:av,LineDashedMaterial:xd,LineDashedNodeMaterial:$L,LineLoop:gm,LineSegments:rs,LinearDisplayP3ColorSpace:qc,LinearFilter:Ut,LinearInterpolant:Pm,LinearMipMapLinearFilter:Hf,LinearMipMapNearestFilter:cA,LinearMipmapLinearFilter:Kn,LinearMipmapNearestFilter:Qs,LinearSRGBColorSpace:li,LinearToneMapping:Ch,LinearTransfer:Nc,Loader:qn,LoaderUtils:dh,LoadingManager:yd,Loop:mt,LoopNode:FT,LoopOnce:Jf,LoopPingPong:my,LoopRepeat:Kf,LuminanceAlphaFormat:Yf,LuminanceFormat:$f,Lut3DNode:sw,MOUSE:q_,MRTNode:Pb,MatcapUVNode:_b,Material:mn,MaterialLoader:rl,MaterialNode:j,MaterialReferenceNode:$S,MathUtils:Xh,Matrix2:Wm,Matrix3:Ke,Matrix4:Fe,MaxEquation:Bf,MaxMipLevelNode:PS,Mesh:kt,MeshBasicMaterial:ss,MeshBasicNodeMaterial:s2,MeshDepthMaterial:Kh,MeshDistanceMaterial:cm,MeshLambertMaterial:gd,MeshLambertNodeMaterial:l2,MeshMatcapMaterial:Rm,MeshMatcapNodeMaterial:$2,MeshNormalMaterial:md,MeshNormalNodeMaterial:jL,MeshPhongMaterial:fd,MeshPhongNodeMaterial:h2,MeshPhysicalMaterial:pd,MeshPhysicalNodeMaterial:xb,MeshSSSNodeMaterial:k2,MeshStandardMaterial:il,MeshStandardNodeMaterial:gb,MeshToonMaterial:Cm,MeshToonNodeMaterial:X2,MinEquation:j_,MirroredRepeatWrapping:ta,MixOperation:zf,ModelNode:is,ModelViewProjectionNode:ET,MorphNode:OT,MultiplyBlending:lf,MultiplyOperation:ma,NearestFilter:Qt,NearestMipMapLinearFilter:aA,NearestMipMapNearestFilter:fy,NearestMipmapLinearFilter:Is,NearestMipmapNearestFilter:Uh,NeutralToneMapping:Lh,NeverCompare:Ly,NeverDepth:uc,NeverStencilFunc:Ay,NoBlending:Fi,NoColorSpace:Li,NoToneMapping:Ti,Node:Ye,NodeAttribute:Df,NodeBuilder:Rb,NodeCache:Fu,NodeCode:Nb,NodeFrame:Ib,NodeFunctionInput:t0,NodeLoader:Tb,NodeMaterial:Tt,NodeMaterialLoader:bb,NodeMaterialObserver:Hv,NodeObjectLoader:i3,NodeShaderStage:_f,NodeType:SP,NodeUniform:wb,NodeUpdateType:We,NodeUtils:MP,NodeVar:Zg,NodeVarying:Ab,NormalAnimationBlendMode:Hh,NormalBlending:Ls,NormalMapNode:QS,NotEqualCompare:Fy,NotEqualDepth:gc,NotEqualStencilFunc:Iy,NumberKeyframeTrack:ca,Object3D:yt,Object3DNode:wt,ObjectLoader:Mv,ObjectSpaceNormalMap:tm,OctahedronGeometry:Ma,OneFactor:ey,OneMinusConstantAlphaFactor:hy,OneMinusConstantColorFactor:ly,OneMinusDstAlphaFactor:sy,OneMinusDstColorFactor:oy,OneMinusSrcAlphaFactor:ku,OneMinusSrcColorFactor:ny,OrthographicCamera:ao,OscNode:pn,OutputStructNode:n0,P3Primaries:Cc,PCFShadowMap:Ff,PCFSoftShadowMap:Of,PI:no,PI2:WP,PMREMGenerator:ch,PMREMNode:pb,ParallaxBarrierPassNode:mw,ParameterNode:Jg,PassNode:bn,Path:Ic,PerspectiveCamera:hn,PhongLightingModel:Xg,PhysicalLightingModel:Bd,PixelationPassNode:uw,Plane:ls,PlaneGeometry:oo,PlaneHelper:xP,PointLight:Md,PointLightHelper:pP,PointLightNode:Xw,PointUVNode:Gb,Points:xm,PointsMaterial:va,PointsNodeMaterial:Z2,PolarGridHelper:gP,PolyhedronGeometry:pr,PositionalAudio:wv,PosterizeNode:qb,PropertyBinding:St,PropertyMixer:Av,PropertyNode:Nt,QuadraticBezierCurve:Tm,QuadraticBezierCurve3:bm,Quaternion:Hn,QuaternionKeyframeTrack:ba,QuaternionLinearInterpolant:gv,RED_GREEN_RGTC2_Format:sh,RED_RGTC1_Format:Zf,REVISION:js,RGBADepthPacking:em,RGBAFormat:Rn,RGBAIntegerFormat:Gh,RGBA_ASTC_10x10_Format:Qu,RGBA_ASTC_10x5_Format:Ju,RGBA_ASTC_10x6_Format:Ku,RGBA_ASTC_10x8_Format:ju,RGBA_ASTC_12x10_Format:eh,RGBA_ASTC_12x12_Format:th,RGBA_ASTC_4x4_Format:Sc,RGBA_ASTC_5x4_Format:Wu,RGBA_ASTC_5x5_Format:Xu,RGBA_ASTC_6x5_Format:qu,RGBA_ASTC_6x6_Format:Tc,RGBA_ASTC_8x5_Format:$u,RGBA_ASTC_8x6_Format:Yu,RGBA_ASTC_8x8_Format:Zu,RGBA_BPTC_Format:jo,RGBA_ETC2_EAC_Format:Mc,RGBA_PVRTC_2BPPV1_Format:Hu,RGBA_PVRTC_4BPPV1_Format:_c,RGBA_S3TC_DXT1_Format:Zo,RGBA_S3TC_DXT3_Format:Jo,RGBA_S3TC_DXT5_Format:Ko,RGBDepthPacking:uA,RGBFormat:zh,RGBIntegerFormat:lA,RGBShiftNode:nw,RGB_BPTC_SIGNED_Format:nh,RGB_BPTC_UNSIGNED_Format:bc,RGB_ETC1_Format:yc,RGB_ETC2_Format:vc,RGB_PVRTC_2BPPV1_Format:Gu,RGB_PVRTC_4BPPV1_Format:xc,RGB_S3TC_DXT1_Format:Yo,RGDepthPacking:hA,RGFormat:ia,RGIntegerFormat:kh,RTTNode:Bb,RangeNode:Sw,RawShaderMaterial:Em,Ray:so,Raycaster:Iv,Rec709Primaries:Ec,RectAreaLight:Um,RectAreaLightNode:$w,RedFormat:Wc,RedIntegerFormat:Xc,ReferenceNode:gl,ReflectorNode:Vb,ReinhardToneMapping:Rh,RemapNode:Cg,RenderOutputNode:CS,RenderTarget:fn,RendererReferenceNode:pS,RepeatWrapping:or,ReplaceStencilOp:vy,Return:ZP,ReverseSubtractEquation:K_,RingGeometry:tl,RotateNode:vb,SIGNED_RED_GREEN_RGTC2_Format:rh,SIGNED_RED_RGTC1_Format:ih,SRGBColorSpace:kn,SRGBTransfer:Vt,SSAAPassNode:hw,Scene:Qh,SceneNode:Qi,Schlick_to_F0:ob,ScreenNode:sn,ScriptableNode:yw,ScriptableValueNode:xw,SetNode:$v,ShaderChunk:lt,ShaderLib:Pi,ShaderMaterial:ki,ShaderNode:tc,ShadowMaterial:dd,ShadowNodeMaterial:e3,Shape:tr,ShapeGeometry:cd,ShapePath:kv,ShapeUtils:ji,ShortType:Xf,Skeleton:Kc,SkeletonHelper:dP,SkinnedMesh:pm,SkinningNode:zg,SobelOperatorNode:Qb,Source:Ks,Sphere:Dn,SphereGeometry:Sa,Spherical:Pv,SphericalHarmonics3:yv,SplineCurve:wm,SplitNode:ph,SpotLight:sl,SpotLightHelper:hP,SpotLightNode:p0,Sprite:hm,SpriteMaterial:Jc,SpriteNodeMaterial:K2,SpriteSheetUVNode:Db,SrcAlphaFactor:zu,SrcAlphaSaturateFactor:ay,SrcColorFactor:ty,StackNode:Cb,StaticCopyUsage:gA,StaticDrawUsage:ra,StaticReadUsage:pA,StereoCamera:Vm,StereoPassNode:dw,StorageArrayElementNode:Ub,StorageBufferNode:r0,StorageTextureNode:Hb,StreamCopyUsage:_A,StreamDrawUsage:dA,StreamReadUsage:mA,StringKeyframeTrack:uo,SubtractEquation:J_,SubtractiveBlending:cf,TBNViewMatrix:$r,TOUCH:$_,TangentSpaceNormalMap:xs,TempNode:pt,TetrahedronGeometry:ld,Texture:Xt,Texture3DNode:Mb,TextureLoader:_v,TextureNode:_s,TextureSizeNode:IS,TextureUtils:zR,TimerNode:Sn,ToneMappingNode:mS,ToonOutlinePassNode:gw,TorusGeometry:nl,TorusKnotGeometry:ud,TransitionNode:lw,Triangle:Jn,TriangleFanDrawMode:_y,TriangleStripDrawMode:xy,TrianglesDrawMode:gy,TriplanarTexturesNode:Fb,TubeGeometry:hd,UVMapping:Dh,Uint16BufferAttribute:$h,Uint32BufferAttribute:rm,Uint8BufferAttribute:t1,Uint8ClampedBufferAttribute:n1,Uniform:Cv,UniformArrayNode:Ug,UniformGroupNode:sg,UniformNode:ho,UniformsGroup:aP,UniformsLib:Se,UniformsUtils:om,UnsignedByteType:es,UnsignedInt101111Type:Bh,UnsignedInt248Type:ar,UnsignedInt5999Type:Vh,UnsignedIntType:Bi,UnsignedShort4444Type:Fh,UnsignedShort5551Type:Oh,UnsignedShortType:na,UserDataNode:Xb,VSMShadowMap:oi,V_GGX_SmithCorrelated:ib,VarNode:aS,VaryingNode:cS,Vector2:J,Vector3:E,Vector4:st,VectorKeyframeTrack:la,VertexColorNode:kb,VideoTexture:tv,ViewportDepthNode:Qn,ViewportDepthTextureNode:YT,ViewportSharedTextureNode:$b,ViewportTextureNode:Ml,VolumeNodeMaterial:n3,WebGL3DRenderTarget:WA,WebGLArrayRenderTarget:HA,WebGLCoordinateSystem:Di,WebGLCubeRenderTarget:Zh,WebGLMultipleRenderTargets:yP,WebGLRenderTarget:zi,WebGLRenderer:jy,WebGLUtils:Ky,WebGPUCoordinateSystem:eo,WireframeGeometry:Nm,WrapAroundEnding:Ac,ZeroCurvatureEnding:kr,ZeroFactor:Q_,ZeroSlopeEnding:Gr,ZeroStencilOp:yy,abs:Dt,acesFilmicToneMapping:Iw,acos:yh,add:Wt,addMethodChaining:te,addNodeElement:JP,afterImage:dD,agxToneMapping:Pw,all:mg,alphaT:mh,anaglyphPass:YD,anamorphic:_D,and:yM,anisotropy:Zs,anisotropyB:Kr,anisotropyT:nc,any:IM,ao:ED,append:jv,arrayBuffer:BP,asin:OM,assign:hM,atan:VM,atan2:$M,atomicAdd:qU,atomicAnd:JU,atomicFunc:Vs,atomicMax:YU,atomicMin:ZU,atomicOr:KU,atomicStore:XU,atomicSub:$U,atomicXor:jU,attenuationColor:hg,attenuationDistance:ug,attribute:vn,backgroundBlurriness:eD,backgroundIntensity:tD,batch:DT,billboarding:xU,bitAnd:TM,bitNot:bM,bitOr:wM,bitXor:AM,bitangentGeometry:gL,bitangentLocal:xL,bitangentView:ZS,bitangentWorld:_L,bitcast:XP,bleach:AU,bloom:OD,blur:db,bool:lr,buffer:ml,bufferAttribute:pl,bumpMap:tT,burn:MU,bvec2:tM,bvec3:ig,bvec4:rM,bypass:bS,cache:sc,call:pM,cameraFar:zo,cameraLogDepth:DS,cameraNear:Bo,cameraNormalMatrix:eL,cameraPosition:Ig,cameraProjectionMatrix:ci,cameraProjectionMatrixInverse:jP,cameraViewMatrix:pi,cameraWorldMatrix:QP,cbrt:eS,ceil:_g,checker:QU,cineonToneMapping:Rw,clamp:cn,clearcoat:fh,clearcoatRoughness:kc,code:zd,color:Qv,colorSpaceToWorking:Eg,colorToDirection:JL,compute:MS,cond:rS,context:wg,convert:aM,convertToTexture:ei,cos:Mi,createCanvasElement:zy,cross:ea,cubeTexture:Pd,dFdx:kM,dFdy:GM,dashSize:jr,defaultBuildStages:yf,defaultShaderStages:Jm,defined:Vc,degrees:DM,denoise:ID,densityFog:tU,depth:Hg,depthPass:uD,difference:JM,diffuseColor:Ct,directionToColor:KT,dispersion:dg,distance:ZM,div:ns,dodge:SU,dof:vD,dot:$t,dotScreen:MD,drawIndex:RT,dynamicBufferAttribute:yS,element:oM,emissive:Sf,equal:fM,equals:PM,equirectUV:Wg,exp:gg,exp2:_h,expression:ur,faceDirection:fl,faceForward:nS,film:TD,float:A,floor:xr,fog:QD,fract:_r,frameGroup:kP,frameId:B3,frontFacing:VS,fwidth:XM,fxaa:PD,gain:hU,gapSize:Hc,gaussianBlur:hD,getColorSpaceMethod:vh,getConstNodeType:Kv,getCurrentStack:ng,getDirection:ub,getDistanceAttenuation:o0,getGeometryRoughness:nb,getRoughness:qg,getShIrradianceAt:Ww,getTextureIndex:i0,global:Bu,glsl:c3,glslFn:l3,grayscale:pD,greaterThan:fg,greaterThanEqual:_M,hash:uU,highPrecisionModelNormalViewMatrix:hL,highPrecisionModelViewMatrix:uL,hue:gD,instance:PT,instanceIndex:vl,instancedBufferAttribute:Mh,instancedDynamicBufferAttribute:Tf,int:L,inverseSqrt:UM,invocationLocalIndex:AL,invocationSubgroupIndex:wL,ior:ic,iridescence:Ed,iridescenceIOR:og,iridescenceThickness:ag,ivec2:us,ivec3:nM,ivec4:iM,js:o3,label:oS,length:Qr,lengthSq:Mg,lessThan:gM,lessThanEqual:xM,lightPosition:c0,lightTargetDirection:l0,lightTargetPosition:Tw,lightViewPosition:Hd,lightingContext:HT,lights:zT,linearDepth:wh,linearSRGBTosRGB:Nw,linearToneMapping:Ew,localId:UU,log:xg,log2:cl,loop:CL,luminance:En,lut3D:bD,mat2:al,mat3:Tn,mat4:Jr,matcapUV:yb,materialAOMap:NT,materialAlphaTest:nT,materialAnisotropy:gT,materialAnisotropyVector:ko,materialAttenuationColor:bT,materialAttenuationDistance:TT,materialClearcoat:uT,materialClearcoatNormal:dT,materialClearcoatRoughness:hT,materialColor:da,materialDispersion:AT,materialEmissive:sT,materialIOR:ST,materialIridescence:xT,materialIridescenceIOR:_T,materialIridescenceThickness:yT,materialLightMap:Bg,materialLineDashOffset:Nf,materialLineDashSize:Og,materialLineGapSize:Vg,materialLineScale:bh,materialLineWidth:Uu,materialMetalness:cT,materialNormal:lT,materialOpacity:Ud,materialPointWidth:wT,materialReference:Ki,materialReflectivity:Du,materialRefractionRatio:kS,materialRotation:pT,materialRoughness:aT,materialSheen:fT,materialSheenRoughness:mT,materialShininess:iT,materialSpecular:rT,materialSpecularColor:oT,materialSpecularIntensity:Af,materialSpecularStrength:rc,materialThickness:MT,materialTransmission:vT,max:ft,maxMipLevel:LS,metalness:zc,min:Mn,mix:it,mixElement:iS,mod:Cd,modInt:pg,modelDirection:oL,modelNormalMatrix:US,modelPosition:aL,modelScale:cL,modelViewMatrix:ys,modelViewPosition:lL,modelViewProjection:Ef,modelWorldMatrix:Ui,modelWorldMatrixInverse:FS,morphReference:VT,motionBlur:wU,mrt:kd,mul:ot,mx_aastep:kw,mx_cell_noise_float:aO,mx_contrast:eO,mx_fractal_noise_float:cO,mx_fractal_noise_vec2:lO,mx_fractal_noise_vec3:uO,mx_fractal_noise_vec4:hO,mx_hsvtorgb:XF,mx_noise_float:tO,mx_noise_vec3:nO,mx_noise_vec4:iO,mx_ramplr:YF,mx_ramptb:ZF,mx_rgbtohsv:qF,mx_safepower:QF,mx_splitlr:JF,mx_splittb:KF,mx_srgb_texture_to_lin_rec709:$F,mx_transform_uv:jF,mx_worley_noise_float:sO,mx_worley_noise_vec2:rO,mx_worley_noise_vec3:oO,negate:BM,neutralToneMapping:Lw,nodeArray:Zr,nodeImmutable:fe,nodeObject:H,nodeObjects:ol,nodeProxy:K,normalFlat:BS,normalGeometry:Rd,normalLocal:hi,normalMap:wf,normalView:di,normalWorld:Id,normalize:vi,not:MM,notEqual:mM,numWorkgroups:LU,objectDirection:tL,objectGroup:lM,objectPosition:iL,objectScale:sL,objectViewPosition:rL,objectWorldMatrix:nL,oneMinus:zM,or:vM,orthographicDepthToViewZ:VL,oscSawtooth:H3,oscSine:z3,oscSquare:k3,oscTriangle:G3,output:cg,outputStruct:U3,overlay:bU,overloadingFn:On,parabola:Uf,parallaxBarrierPass:ZD,parallaxDirection:KS,parallaxUV:vL,parameter:r3,pass:lD,passTexture:Ea,pcurve:dU,perspectiveDepthToViewZ:Gg,pixelationPass:kD,pmremTexture:fb,pointUV:Q3,pointWidth:GP,positionGeometry:Nn,positionLocal:en,positionPrevious:Sh,positionView:Pn,positionViewDirection:Bt,positionWorld:Th,positionWorldDirection:Pg,posterize:oD,pow:jn,pow2:vg,pow3:KM,pow4:jM,property:ai,radians:LM,rand:Tg,range:nU,rangeFog:eU,reciprocal:WM,reference:dn,referenceBuffer:bf,reflect:YM,reflectVector:WS,reflectView:GS,reflector:Y3,refract:Sg,refractVector:XS,refractView:HS,reinhardToneMapping:Cw,remainder:CM,remap:wS,remapClamp:AS,renderGroup:_t,renderOutput:RS,rendererReference:fS,rgbShift:SD,rotate:Yg,rotateUV:mU,roughness:ds,round:HM,rtt:zb,sRGBToLinearSRGB:Aw,sampler:KP,saturate:tS,saturation:fD,screen:TU,screenCoordinate:Na,screenSize:pa,screenUV:yr,scriptable:jD,scriptableValue:Vu,select:In,sepia:NU,setCurrentStack:Bc,shaderStages:vf,sharedUniformGroup:rg,sheen:qr,sheenRoughness:Nd,shiftLeft:NM,shiftRight:EM,shininess:gh,sign:ll,sin:Cn,sinc:pU,skinning:NL,skinningReference:UT,smoothstep:ti,smoothstepElement:sS,sobel:yD,specularColor:ri,specularF90:Gc,spherizeUV:gU,split:zP,spritesheetUV:W3,sqrt:os,ssaaPass:WD,stack:Ou,step:ul,stereoPass:qD,storage:nD,storageBarrier:BU,storageObject:iD,storageTexture:Wb,string:VP,sub:Ft,subgroupIndex:bL,subgroupSize:FU,tan:FM,tangentGeometry:Dd,tangentLocal:xl,tangentView:_l,tangentWorld:YS,temp:Ag,texture:xt,texture3D:Sb,textureBarrier:zU,textureBicubic:lb,textureCubeUV:hb,textureLoad:Ci,textureSize:nr,textureStore:sD,thickness:lg,threshold:Kb,timerDelta:V3,timerGlobal:O3,timerLocal:s0,toOutputColorSpace:lS,toWorkingColorSpace:uS,toneMapping:gS,toneMappingExposure:xS,toonOutlinePass:JD,transformDirection:QM,transformNormal:zS,transformNormalToView:Dg,transformedBentNormalView:jS,transformedBitangentView:JS,transformedBitangentWorld:yL,transformedClearcoatNormalView:qo,transformedNormalView:Yt,transformedNormalWorld:Lg,transformedTangentView:Fg,transformedTangentWorld:mL,transition:VD,transmission:xh,transpose:qM,tri:hs,tri3:bw,triNoise3D:fU,triplanarTexture:q3,triplanarTextures:Ob,trunc:yg,tslFn:OP,uint:ve,uniform:pe,uniformArray:fs,uniformGroup:cM,uniforms:pL,userData:rD,uv:rt,uvec2:eM,uvec3:Aa,uvec4:sM,varying:Un,varyingProperty:Zi,vec2:z,vec3:D,vec4:oe,vectorComponents:wa,velocity:vU,vertexColor:j3,vertexIndex:CT,vibrance:mD,viewZToOrthographicDepth:oc,viewZToPerspectiveDepth:ZT,viewport:Ds,viewportBottomLeft:FL,viewportCoordinate:qT,viewportDepthTexture:kg,viewportLinearDepth:BL,viewportMipTexture:$T,viewportResolution:DL,viewportSafeUV:_U,viewportSharedTexture:aD,viewportSize:XT,viewportTexture:OL,viewportTopLeft:UL,viewportUV:LL,wgsl:a3,wgslFn:u3,workgroupArray:HU,workgroupBarrier:VU,workgroupId:DU,workingToColorSpace:hS,xor:SM},Symbol.toStringTag,{value:"Module"}));function vO(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function MO(s){const e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}exports.ACESFilmicToneMapping=Ih;exports.AdditiveBlending=lc;exports.AgXToneMapping=Ph;exports.AlwaysDepth=hc;exports.AlwaysStencilFunc=oh;exports.AmbientLight=Td;exports.AnimationClip=ua;exports.AnimationMixer=Ev;exports.ArrayCamera=lm;exports.Audio=zm;exports.AudioContext=bd;exports.AudioListener=bv;exports.AudioLoader=Tv;exports.AxesHelper=zv;exports.BackSide=ln;exports.BasicDepthPacking=Qf;exports.BasicNodeLibrary=eA;exports.BatchedMesh=mm;exports.Bone=ed;exports.BooleanKeyframeTrack=fr;exports.Box3=Wn;exports.Box3Helper=Bv;exports.BoxGeometry=vs;exports.BoxHelper=Vv;exports.BufferAttribute=At;exports.BufferGeometry=at;exports.Cache=ps;exports.Camera=Zc;exports.CameraHelper=Ov;exports.CanvasTexture=sv;exports.CatmullRomCurve3=vm;exports.ClampToEdgeWrapping=Si;exports.Clock=Bm;exports.Color=_e;exports.ColorKeyframeTrack=_d;exports.ColorManagement=gt;exports.CompressedArrayTexture=nv;exports.CompressedCubeTexture=iv;exports.CompressedTexture=jc;exports.Controls=Gv;exports.CubeCamera=Yh;exports.CubeTexture=ro;exports.CubeUVReflectionMapping=dr;exports.Curve=Gi;exports.CustomBlending=Vf;exports.CylinderGeometry=lo;exports.Data3DTexture=qh;exports.DataTexture=Oi;exports.DataTextureLoader=xv;exports.DataUtils=Hy;exports.DecrementStencilOp=Sy;exports.DecrementWrapStencilOp=by;exports.DefaultLoadingManager=Lm;exports.DepthFormat=er;exports.DepthStencilFormat=cr;exports.DepthTexture=co;exports.DirectionalLight=Sd;exports.DirectionalLightHelper=Fv;exports.DoubleSide=Ji;exports.DynamicDrawUsage=Hr;exports.EdgesGeometry=Am;exports.EqualDepth=pc;exports.EqualStencilFunc=Ey;exports.EquirectangularReflectionMapping=sr;exports.EquirectangularRefractionMapping=rr;exports.Euler=ui;exports.EventDispatcher=Ai;exports.ExtrudeGeometry=el;exports.FileLoader=ts;exports.Float32BufferAttribute=Ve;exports.FloatType=Gn;exports.Fog=um;exports.FrontSide=gs;exports.Frustum=xa;exports.GLSL3=ah;exports.GLSLNodeParser=Qw;exports.GreaterDepth=mc;exports.GreaterEqualDepth=fc;exports.GreaterEqualStencilFunc=Py;exports.GreaterStencilFunc=Ry;exports.GridHelper=Uv;exports.Group=Wr;exports.HalfFloatType=Ln;exports.HemisphereLight=vd;exports.ImageBitmapLoader=Sv;exports.IncrementStencilOp=My;exports.IncrementWrapStencilOp=Ty;exports.InstancedBufferAttribute=Fs;exports.InstancedBufferGeometry=Om;exports.InstancedInterleavedBuffer=Hm;exports.InstancedMesh=fm;exports.InterleavedBuffer=ya;exports.InterleavedBufferAttribute=Us;exports.Interpolant=Ta;exports.InterpolateDiscrete=sa;exports.InterpolateLinear=wc;exports.InvertStencilOp=wy;exports.KeepStencilOp=Ys;exports.KeyframeTrack=Hi;exports.LOD=dm;exports.Layers=Yc;exports.LessDepth=dc;exports.LessEqualDepth=ir;exports.LessEqualStencilFunc=Cy;exports.LessStencilFunc=Ny;exports.Line=Os;exports.Line3=Lv;exports.LineBasicMaterial=Fn;exports.LineLoop=gm;exports.LineSegments=rs;exports.LinearFilter=Ut;exports.LinearMipMapLinearFilter=Hf;exports.LinearMipmapLinearFilter=Kn;exports.LinearMipmapNearestFilter=Qs;exports.LinearSRGBColorSpace=li;exports.LinearToneMapping=Ch;exports.Loader=qn;exports.LoaderUtils=dh;exports.LoadingManager=yd;exports.LoopOnce=Jf;exports.LoopRepeat=Kf;exports.MOUSE=q_;exports.Material=mn;exports.MathUtils=Xh;exports.Matrix3=Ke;exports.Matrix4=Fe;exports.MaxEquation=Bf;exports.Mesh=kt;exports.MeshBasicMaterial=ss;exports.MeshDepthMaterial=Kh;exports.MeshLambertMaterial=gd;exports.MeshNormalMaterial=md;exports.MeshPhongMaterial=fd;exports.MeshPhysicalMaterial=pd;exports.MeshStandardMaterial=il;exports.MirroredRepeatWrapping=ta;exports.NearestFilter=Qt;exports.NearestMipMapNearestFilter=fy;exports.NearestMipmapLinearFilter=Is;exports.NearestMipmapNearestFilter=Uh;exports.NeutralToneMapping=Lh;exports.NeverDepth=uc;exports.NeverStencilFunc=Ay;exports.NoBlending=Fi;exports.NoColorSpace=Li;exports.NoToneMapping=Ti;exports.Node=Ye;exports.NodeBuilder=Rb;exports.NodeFrame=Ib;exports.NormalBlending=Ls;exports.NotEqualDepth=gc;exports.NotEqualStencilFunc=Iy;exports.NumberKeyframeTrack=ca;exports.Object3D=yt;exports.OctahedronGeometry=Ma;exports.OrthographicCamera=ao;exports.PCFSoftShadowMap$1=Of;exports.PMREMGenerator$1=ch;exports.PerspectiveCamera=hn;exports.Plane=ls;exports.PlaneGeometry=oo;exports.PointLight=Md;exports.Points=xm;exports.PointsMaterial=va;exports.PositionalAudio=wv;exports.PropertyBinding=St;exports.Quaternion=Hn;exports.QuaternionKeyframeTrack=ba;exports.REVISION=js;exports.RGBADepthPacking=em;exports.RGBAFormat=Rn;exports.RGBA_ASTC_4x4_Format=Sc;exports.RGBA_ASTC_6x6_Format=Tc;exports.RGBA_BPTC_Format=jo;exports.RGBA_ETC2_EAC_Format=Mc;exports.RGBA_PVRTC_4BPPV1_Format=_c;exports.RGBA_S3TC_DXT1_Format=Zo;exports.RGBA_S3TC_DXT3_Format=Jo;exports.RGBA_S3TC_DXT5_Format=Ko;exports.RGBFormat=zh;exports.RGB_BPTC_UNSIGNED_Format=bc;exports.RGB_ETC1_Format=yc;exports.RGB_ETC2_Format=vc;exports.RGB_PVRTC_4BPPV1_Format=xc;exports.RGB_S3TC_DXT1_Format=Yo;exports.RGFormat=ia;exports.RawShaderMaterial=Em;exports.Ray=so;exports.Raycaster=Iv;exports.RedFormat=Wc;exports.ReinhardToneMapping=Rh;exports.RepeatWrapping=or;exports.ReplaceStencilOp=vy;exports.RingGeometry=tl;exports.SRGBColorSpace=kn;exports.Scene=Qh;exports.ShaderChunk=lt;exports.ShaderLib=Pi;exports.ShaderMaterial=ki;exports.ShadowMaterial=dd;exports.Shape=tr;exports.ShapePath=kv;exports.ShapeUtils=ji;exports.Skeleton=Kc;exports.SkinnedMesh=pm;exports.Source=Ks;exports.Sphere=Dn;exports.SphereGeometry=Sa;exports.Spherical=Pv;exports.SpotLight=sl;exports.Sprite=hm;exports.SpriteMaterial=Jc;exports.THREE=yO;exports.TOUCH=$_;exports.Texture=Xt;exports.TextureLoader=_v;exports.TorusGeometry=nl;exports.Triangle=Jn;exports.TriangleFanDrawMode=_y;exports.TriangleStripDrawMode=xy;exports.TrianglesDrawMode=gy;exports.Uint16BufferAttribute=$h;exports.Uniform$1=Cv;exports.UniformsLib=Se;exports.UniformsUtils=om;exports.UnsignedByteType=es;exports.UnsignedInt101111Type=Bh;exports.UnsignedInt248Type=ar;exports.UnsignedInt5999Type=Vh;exports.UnsignedIntType=Bi;exports.Vector2=J;exports.Vector3=E;exports.Vector4=st;exports.VectorKeyframeTrack=la;exports.VideoTexture=tv;exports.WebGLCubeRenderTarget=Zh;exports.WebGLRenderTarget=zi;exports.WebGLRenderer=jy;exports.WireframeGeometry=Nm;exports.ZeroStencilOp=yy;exports.cloneUniforms=vO;exports.cloneUniformsGroups=MO;exports.defaultShaderStages=Jm;exports.normalView=di;
|