gl-draw 0.3.13 → 0.4.0
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/dist/index.js +1 -1
- package/dist/index.module.js +1 -1
- package/dist/objects/extrudePolygon/index.d.ts +10 -2
- package/dist/objects/index.js +11 -11
- package/dist/objects/index.module.js +11 -11
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.module.js +1 -1
- package/dist/workers/extrudePolygon.js +1 -1
- package/package.json +1 -1
|
@@ -3043,4 +3043,4 @@ void main() {
|
|
|
3043
3043
|
squared_mean = squared_mean / samples;
|
|
3044
3044
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
3045
3045
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
3046
|
-
}`;function Wh(r,e,t){let n=new qr;const i=new W,s=new W,o=new We,a=new lo({depthPacking:Nu}),l=new co,c={},u=t.maxTextureSize,h={0:it,1:Jn,2:Zn},f=new bn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new W},radius:{value:4}},vertexShader:z0,fragmentShader:U0}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const m=new ve;m.setAttribute("position",new ze(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new ft(m,f),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=aa,this.render=function(y,M,b){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||y.length===0)return;const E=r.getRenderTarget(),P=r.getActiveCubeFace(),z=r.getActiveMipmapLevel(),N=r.state;N.setBlending(dn),N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);for(let I=0,w=y.length;I<w;I++){const T=y[I],B=T.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",T,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;i.copy(B.mapSize);const L=B.getFrameExtents();if(i.multiply(L),s.copy(B.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/L.x),i.x=s.x*L.x,B.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/L.y),i.y=s.y*L.y,B.mapSize.y=s.y)),B.map===null&&!B.isPointLightShadow&&this.type===Di){const U={minFilter:Ke,magFilter:Ke,format:ut};B.map=new Nt(i.x,i.y,U),B.map.texture.name=T.name+".shadowMap",B.mapPass=new Nt(i.x,i.y,U),B.camera.updateProjectionMatrix()}if(B.map===null){const U={minFilter:rt,magFilter:rt,format:ut};B.map=new Nt(i.x,i.y,U),B.map.texture.name=T.name+".shadowMap",B.camera.updateProjectionMatrix()}r.setRenderTarget(B.map),r.clear();const F=B.getViewportCount();for(let U=0;U<F;U++){const Z=B.getViewport(U);o.set(s.x*Z.x,s.y*Z.y,s.x*Z.z,s.y*Z.w),N.viewport(o),B.updateMatrices(T,U),n=B.getFrustum(),_(M,b,B.camera,T,this.type)}!B.isPointLightShadow&&this.type===Di&&g(B,b),B.needsUpdate=!1}v.needsUpdate=!1,r.setRenderTarget(E,P,z)};function g(y,M){const b=e.update(x);f.defines.VSM_SAMPLES!==y.blurSamples&&(f.defines.VSM_SAMPLES=y.blurSamples,d.defines.VSM_SAMPLES=y.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),f.uniforms.shadow_pass.value=y.map.texture,f.uniforms.resolution.value=y.mapSize,f.uniforms.radius.value=y.radius,r.setRenderTarget(y.mapPass),r.clear(),r.renderBufferDirect(M,null,b,f,x,null),d.uniforms.shadow_pass.value=y.mapPass.texture,d.uniforms.resolution.value=y.mapSize,d.uniforms.radius.value=y.radius,r.setRenderTarget(y.map),r.clear(),r.renderBufferDirect(M,null,b,d,x,null)}function p(y,M,b,E,P,z,N){let I=null;const w=E.isPointLight===!0?y.customDistanceMaterial:y.customDepthMaterial;if(w!==void 0?I=w:I=E.isPointLight===!0?l:a,r.localClippingEnabled&&b.clipShadows===!0&&b.clippingPlanes.length!==0||b.displacementMap&&b.displacementScale!==0||b.alphaMap&&b.alphaTest>0){const T=I.uuid,B=b.uuid;let L=c[T];L===void 0&&(L={},c[T]=L);let F=L[B];F===void 0&&(F=I.clone(),L[B]=F),I=F}return I.visible=b.visible,I.wireframe=b.wireframe,N===Di?I.side=b.shadowSide!==null?b.shadowSide:b.side:I.side=b.shadowSide!==null?b.shadowSide:h[b.side],I.alphaMap=b.alphaMap,I.alphaTest=b.alphaTest,I.clipShadows=b.clipShadows,I.clippingPlanes=b.clippingPlanes,I.clipIntersection=b.clipIntersection,I.displacementMap=b.displacementMap,I.displacementScale=b.displacementScale,I.displacementBias=b.displacementBias,I.wireframeLinewidth=b.wireframeLinewidth,I.linewidth=b.linewidth,E.isPointLight===!0&&I.isMeshDistanceMaterial===!0&&(I.referencePosition.setFromMatrixPosition(E.matrixWorld),I.nearDistance=P,I.farDistance=z),I}function _(y,M,b,E,P){if(y.visible===!1)return;if(y.layers.test(M.layers)&&(y.isMesh||y.isLine||y.isPoints)&&(y.castShadow||y.receiveShadow&&P===Di)&&(!y.frustumCulled||n.intersectsObject(y))){y.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,y.matrixWorld);const I=e.update(y),w=y.material;if(Array.isArray(w)){const T=I.groups;for(let B=0,L=T.length;B<L;B++){const F=T[B],U=w[F.materialIndex];if(U&&U.visible){const Z=p(y,I,U,E,b.near,b.far,P);r.renderBufferDirect(b,null,I,Z,y,F)}}}else if(w.visible){const T=p(y,I,w,E,b.near,b.far,P);r.renderBufferDirect(b,null,I,T,y,null)}}const N=y.children;for(let I=0,w=N.length;I<w;I++)_(N[I],M,b,E,P)}}function O0(r,e,t){const n=t.isWebGL2;function i(){let D=!1;const re=new We;let te=null;const Ce=new We(0,0,0,0);return{setMask:function(xe){te!==xe&&!D&&(r.colorMask(xe,xe,xe,xe),te=xe)},setLocked:function(xe){D=xe},setClear:function(xe,Pe,ue,Re,Ze){Ze===!0&&(xe*=Re,Pe*=Re,ue*=Re),re.set(xe,Pe,ue,Re),Ce.equals(re)===!1&&(r.clearColor(xe,Pe,ue,Re),Ce.copy(re))},reset:function(){D=!1,te=null,Ce.set(-1,0,0,0)}}}function s(){let D=!1,re=null,te=null,Ce=null;return{setTest:function(xe){xe?K(2929):he(2929)},setMask:function(xe){re!==xe&&!D&&(r.depthMask(xe),re=xe)},setFunc:function(xe){if(te!==xe){if(xe)switch(xe){case Ec:r.depthFunc(512);break;case Ac:r.depthFunc(519);break;case Cc:r.depthFunc(513);break;case Ss:r.depthFunc(515);break;case Lc:r.depthFunc(514);break;case Rc:r.depthFunc(518);break;case Pc:r.depthFunc(516);break;case Ic:r.depthFunc(517);break;default:r.depthFunc(515)}else r.depthFunc(515);te=xe}},setLocked:function(xe){D=xe},setClear:function(xe){Ce!==xe&&(r.clearDepth(xe),Ce=xe)},reset:function(){D=!1,re=null,te=null,Ce=null}}}function o(){let D=!1,re=null,te=null,Ce=null,xe=null,Pe=null,ue=null,Re=null,Ze=null;return{setTest:function(Xe){D||(Xe?K(2960):he(2960))},setMask:function(Xe){re!==Xe&&!D&&(r.stencilMask(Xe),re=Xe)},setFunc:function(Xe,ln,cn){(te!==Xe||Ce!==ln||xe!==cn)&&(r.stencilFunc(Xe,ln,cn),te=Xe,Ce=ln,xe=cn)},setOp:function(Xe,ln,cn){(Pe!==Xe||ue!==ln||Re!==cn)&&(r.stencilOp(Xe,ln,cn),Pe=Xe,ue=ln,Re=cn)},setLocked:function(Xe){D=Xe},setClear:function(Xe){Ze!==Xe&&(r.clearStencil(Xe),Ze=Xe)},reset:function(){D=!1,re=null,te=null,Ce=null,xe=null,Pe=null,ue=null,Re=null,Ze=null}}}const a=new i,l=new s,c=new o;let u={},h={},f=null,d=!1,m=null,x=null,v=null,g=null,p=null,_=null,y=null,M=!1,b=null,E=null,P=null,z=null,N=null;const I=r.getParameter(35661);let w=!1,T=0;const B=r.getParameter(7938);B.indexOf("WebGL")!==-1?(T=parseFloat(/^WebGL (\d)/.exec(B)[1]),w=T>=1):B.indexOf("OpenGL ES")!==-1&&(T=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),w=T>=2);let L=null,F={};const U=r.getParameter(3088),Z=r.getParameter(2978),ee=new We().fromArray(U),V=new We().fromArray(Z);function q(D,re,te){const Ce=new Uint8Array(4),xe=r.createTexture();r.bindTexture(D,xe),r.texParameteri(D,10241,9728),r.texParameteri(D,10240,9728);for(let Pe=0;Pe<te;Pe++)r.texImage2D(re+Pe,0,6408,1,1,0,6408,5121,Ce);return xe}const ne={};ne[3553]=q(3553,3553,1),ne[34067]=q(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),K(2929),l.setFunc(Ss),Oe(!1),k(Yn),K(2884),me(dn);function K(D){u[D]!==!0&&(r.enable(D),u[D]=!0)}function he(D){u[D]!==!1&&(r.disable(D),u[D]=!1)}function Me(D,re){return h[D]!==re?(r.bindFramebuffer(D,re),h[D]=re,n&&(D===36009&&(h[36160]=re),D===36160&&(h[36009]=re)),!0):!1}function Y(D){return f!==D?(r.useProgram(D),f=D,!0):!1}const be={[$n]:32774,[mc]:32778,[gc]:32779};if(n)be[fa]=32775,be[da]=32776;else{const D=e.get("EXT_blend_minmax");D!==null&&(be[fa]=D.MIN_EXT,be[da]=D.MAX_EXT)}const pe={[xc]:0,[yc]:1,[vc]:768,[pa]:770,[Tc]:776,[wc]:774,[Mc]:772,[_c]:769,[ma]:771,[Sc]:775,[bc]:773};function me(D,re,te,Ce,xe,Pe,ue,Re){if(D===dn){d===!0&&(he(3042),d=!1);return}if(d===!1&&(K(3042),d=!0),D!==pc){if(D!==m||Re!==M){if((x!==$n||p!==$n)&&(r.blendEquation(32774),x=$n,p=$n),Re)switch(D){case Fi:r.blendFuncSeparate(1,771,1,771);break;case ca:r.blendFunc(1,1);break;case ua:r.blendFuncSeparate(0,0,769,771);break;case ha:r.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}else switch(D){case Fi:r.blendFuncSeparate(770,771,1,771);break;case ca:r.blendFunc(770,1);break;case ua:r.blendFunc(0,769);break;case ha:r.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}v=null,g=null,_=null,y=null,m=D,M=Re}return}xe=xe||re,Pe=Pe||te,ue=ue||Ce,(re!==x||xe!==p)&&(r.blendEquationSeparate(be[re],be[xe]),x=re,p=xe),(te!==v||Ce!==g||Pe!==_||ue!==y)&&(r.blendFuncSeparate(pe[te],pe[Ce],pe[Pe],pe[ue]),v=te,g=Ce,_=Pe,y=ue),m=D,M=null}function ye(D,re){D.side===Zn?he(2884):K(2884);let te=D.side===it;re&&(te=!te),Oe(te),D.blending===Fi&&D.transparent===!1?me(dn):me(D.blending,D.blendEquation,D.blendSrc,D.blendDst,D.blendEquationAlpha,D.blendSrcAlpha,D.blendDstAlpha,D.premultipliedAlpha),l.setFunc(D.depthFunc),l.setTest(D.depthTest),l.setMask(D.depthWrite),a.setMask(D.colorWrite);const Ce=D.stencilWrite;c.setTest(Ce),Ce&&(c.setMask(D.stencilWriteMask),c.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),c.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),ie(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?K(32926):he(32926)}function Oe(D){b!==D&&(D?r.frontFace(2304):r.frontFace(2305),b=D)}function k(D){D!==ws?(K(2884),D!==E&&(D===Yn?r.cullFace(1029):D===Qt?r.cullFace(1028):r.cullFace(1032))):he(2884),E=D}function $(D){D!==P&&(w&&r.lineWidth(D),P=D)}function ie(D,re,te){D?(K(32823),(z!==re||N!==te)&&(r.polygonOffset(re,te),z=re,N=te)):he(32823)}function fe(D){D?K(3089):he(3089)}function ce(D){D===void 0&&(D=33984+I-1),L!==D&&(r.activeTexture(D),L=D)}function Ee(D,re){L===null&&ce();let te=F[L];te===void 0&&(te={type:void 0,texture:void 0},F[L]=te),(te.type!==D||te.texture!==re)&&(r.bindTexture(D,re||ne[D]),te.type=D,te.texture=re)}function Ae(){const D=F[L];D!==void 0&&D.type!==void 0&&(r.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function De(){try{r.compressedTexImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function je(){try{r.texSubImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function R(){try{r.texSubImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function C(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function J(){try{r.texStorage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Q(){try{r.texStorage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function ae(){try{r.texImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function j(){try{r.texImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function we(D){ee.equals(D)===!1&&(r.scissor(D.x,D.y,D.z,D.w),ee.copy(D))}function _e(D){V.equals(D)===!1&&(r.viewport(D.x,D.y,D.z,D.w),V.copy(D))}function se(){r.disable(3042),r.disable(2884),r.disable(2929),r.disable(32823),r.disable(3089),r.disable(2960),r.disable(32926),r.blendEquation(32774),r.blendFunc(1,0),r.blendFuncSeparate(1,0,1,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(513),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(519,0,4294967295),r.stencilOp(7680,7680,7680),r.clearStencil(0),r.cullFace(1029),r.frontFace(2305),r.polygonOffset(0,0),r.activeTexture(33984),r.bindFramebuffer(36160,null),n===!0&&(r.bindFramebuffer(36009,null),r.bindFramebuffer(36008,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),u={},L=null,F={},h={},f=null,d=!1,m=null,x=null,v=null,g=null,p=null,_=null,y=null,M=!1,b=null,E=null,P=null,z=null,N=null,ee.set(0,0,r.canvas.width,r.canvas.height),V.set(0,0,r.canvas.width,r.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:K,disable:he,bindFramebuffer:Me,useProgram:Y,setBlending:me,setMaterial:ye,setFlipSided:Oe,setCullFace:k,setLineWidth:$,setPolygonOffset:ie,setScissorTest:fe,activeTexture:ce,bindTexture:Ee,unbindTexture:Ae,compressedTexImage2D:De,texImage2D:ae,texImage3D:j,texStorage2D:J,texStorage3D:Q,texSubImage2D:je,texSubImage3D:R,compressedTexSubImage2D:C,scissor:we,viewport:_e,reset:se}}function G0(r,e,t,n,i,s,o){const a=i.isWebGL2,l=i.maxTextures,c=i.maxCubemapSize,u=i.maxTextureSize,h=i.maxSamples,d=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):void 0,m=new WeakMap;let x,v=!1;try{v=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(R){}function g(R,C){return v?new OffscreenCanvas(R,C):Is("canvas")}function p(R,C,J,Q){let ae=1;if((R.width>Q||R.height>Q)&&(ae=Q/Math.max(R.width,R.height)),ae<1||C===!0)if(typeof HTMLImageElement!="undefined"&&R instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&R instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&R instanceof ImageBitmap){const j=C?Gu:Math.floor,we=j(ae*R.width),_e=j(ae*R.height);x===void 0&&(x=g(we,_e));const se=J?g(we,_e):x;return se.width=we,se.height=_e,se.getContext("2d").drawImage(R,0,0,we,_e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+R.width+"x"+R.height+") to ("+we+"x"+_e+")."),se}else return"data"in R&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+R.width+"x"+R.height+")."),R;return R}function _(R){return Ra(R.width)&&Ra(R.height)}function y(R){return a?!1:R.wrapS!==bt||R.wrapT!==bt||R.minFilter!==rt&&R.minFilter!==Ke}function M(R,C){return R.generateMipmaps&&C&&R.minFilter!==rt&&R.minFilter!==Ke}function b(R){r.generateMipmap(R)}function E(R,C,J,Q){if(a===!1)return C;if(R!==null){if(r[R]!==void 0)return r[R];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let ae=C;return C===6403&&(J===5126&&(ae=33326),J===5131&&(ae=33325),J===5121&&(ae=33321)),C===6407&&(J===5126&&(ae=34837),J===5131&&(ae=34843),J===5121&&(ae=32849)),C===6408&&(J===5126&&(ae=34836),J===5131&&(ae=34842),J===5121&&(ae=Q===ri?35907:32856)),(ae===33325||ae===33326||ae===34842||ae===34836)&&e.get("EXT_color_buffer_float"),ae}function P(R,C,J){return M(R,J)===!0||R.isFramebufferTexture&&R.minFilter!==rt&&R.minFilter!==Ke?Math.log2(Math.max(C.width,C.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?C.mipmaps.length:1}function z(R){return R===rt||R===Es||R===As?9728:9729}function N(R){const C=R.target;C.removeEventListener("dispose",N),w(C),C.isVideoTexture&&m.delete(C),o.memory.textures--}function I(R){const C=R.target;C.removeEventListener("dispose",I),T(C)}function w(R){const C=n.get(R);C.__webglInit!==void 0&&(r.deleteTexture(C.__webglTexture),n.remove(R))}function T(R){const C=R.texture,J=n.get(R),Q=n.get(C);if(!!R){if(Q.__webglTexture!==void 0&&(r.deleteTexture(Q.__webglTexture),o.memory.textures--),R.depthTexture&&R.depthTexture.dispose(),R.isWebGLCubeRenderTarget)for(let ae=0;ae<6;ae++)r.deleteFramebuffer(J.__webglFramebuffer[ae]),J.__webglDepthbuffer&&r.deleteRenderbuffer(J.__webglDepthbuffer[ae]);else r.deleteFramebuffer(J.__webglFramebuffer),J.__webglDepthbuffer&&r.deleteRenderbuffer(J.__webglDepthbuffer),J.__webglMultisampledFramebuffer&&r.deleteFramebuffer(J.__webglMultisampledFramebuffer),J.__webglColorRenderbuffer&&r.deleteRenderbuffer(J.__webglColorRenderbuffer),J.__webglDepthRenderbuffer&&r.deleteRenderbuffer(J.__webglDepthRenderbuffer);if(R.isWebGLMultipleRenderTargets)for(let ae=0,j=C.length;ae<j;ae++){const we=n.get(C[ae]);we.__webglTexture&&(r.deleteTexture(we.__webglTexture),o.memory.textures--),n.remove(C[ae])}n.remove(C),n.remove(R)}}let B=0;function L(){B=0}function F(){const R=B;return R>=l&&console.warn("THREE.WebGLTextures: Trying to use "+R+" texture units while this GPU supports only "+l),B+=1,R}function U(R,C){const J=n.get(R);if(R.isVideoTexture&&ce(R),R.version>0&&J.__version!==R.version){const Q=R.image;if(Q===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(Q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Me(J,R,C);return}}t.activeTexture(33984+C),t.bindTexture(3553,J.__webglTexture)}function Z(R,C){const J=n.get(R);if(R.version>0&&J.__version!==R.version){Me(J,R,C);return}t.activeTexture(33984+C),t.bindTexture(35866,J.__webglTexture)}function ee(R,C){const J=n.get(R);if(R.version>0&&J.__version!==R.version){Me(J,R,C);return}t.activeTexture(33984+C),t.bindTexture(32879,J.__webglTexture)}function V(R,C){const J=n.get(R);if(R.version>0&&J.__version!==R.version){Y(J,R,C);return}t.activeTexture(33984+C),t.bindTexture(34067,J.__webglTexture)}const q={[Ir]:10497,[bt]:33071,[Dr]:33648},ne={[rt]:9728,[Es]:9984,[As]:9986,[Ke]:9729,[ga]:9985,[Kn]:9987};function K(R,C,J){if(J?(r.texParameteri(R,10242,q[C.wrapS]),r.texParameteri(R,10243,q[C.wrapT]),(R===32879||R===35866)&&r.texParameteri(R,32882,q[C.wrapR]),r.texParameteri(R,10240,ne[C.magFilter]),r.texParameteri(R,10241,ne[C.minFilter])):(r.texParameteri(R,10242,33071),r.texParameteri(R,10243,33071),(R===32879||R===35866)&&r.texParameteri(R,32882,33071),(C.wrapS!==bt||C.wrapT!==bt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(R,10240,z(C.magFilter)),r.texParameteri(R,10241,z(C.minFilter)),C.minFilter!==rt&&C.minFilter!==Ke&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const Q=e.get("EXT_texture_filter_anisotropic");if(C.type===en&&e.has("OES_texture_float_linear")===!1||a===!1&&C.type===An&&e.has("OES_texture_half_float_linear")===!1)return;(C.anisotropy>1||n.get(C).__currentAnisotropy)&&(r.texParameterf(R,Q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(C.anisotropy,i.getMaxAnisotropy())),n.get(C).__currentAnisotropy=C.anisotropy)}}function he(R,C){R.__webglInit===void 0&&(R.__webglInit=!0,C.addEventListener("dispose",N),R.__webglTexture=r.createTexture(),o.memory.textures++)}function Me(R,C,J){let Q=3553;C.isDataTexture2DArray&&(Q=35866),C.isDataTexture3D&&(Q=32879),he(R,C),t.activeTexture(33984+J),t.bindTexture(Q,R.__webglTexture),r.pixelStorei(37440,C.flipY),r.pixelStorei(37441,C.premultiplyAlpha),r.pixelStorei(3317,C.unpackAlignment),r.pixelStorei(37443,0);const ae=y(C)&&_(C.image)===!1,j=p(C.image,ae,!1,u),we=_(j)||a,_e=s.convert(C.format);let se=s.convert(C.type),D=E(C.internalFormat,_e,se,C.encoding);K(Q,C,we);let re;const te=C.mipmaps,Ce=a&&C.isVideoTexture!==!0,xe=R.__version===void 0,Pe=P(C,j,we);if(C.isDepthTexture)D=6402,a?C.type===en?D=36012:C.type===Fr?D=33190:C.type===ei?D=35056:D=33189:C.type===en&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),C.format===Ln&&D===6402&&C.type!==Ni&&C.type!==Fr&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),C.type=Ni,se=s.convert(C.type)),C.format===ti&&D===6402&&(D=34041,C.type!==ei&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),C.type=ei,se=s.convert(C.type))),Ce&&xe?t.texStorage2D(3553,1,D,j.width,j.height):t.texImage2D(3553,0,D,j.width,j.height,0,_e,se,null);else if(C.isDataTexture)if(te.length>0&&we){Ce&&xe&&t.texStorage2D(3553,Pe,D,te[0].width,te[0].height);for(let ue=0,Re=te.length;ue<Re;ue++)re=te[ue],Ce?t.texSubImage2D(3553,0,0,0,re.width,re.height,_e,se,re.data):t.texImage2D(3553,ue,D,re.width,re.height,0,_e,se,re.data);C.generateMipmaps=!1}else Ce?(xe&&t.texStorage2D(3553,Pe,D,j.width,j.height),t.texSubImage2D(3553,0,0,0,j.width,j.height,_e,se,j.data)):t.texImage2D(3553,0,D,j.width,j.height,0,_e,se,j.data);else if(C.isCompressedTexture){Ce&&xe&&t.texStorage2D(3553,Pe,D,te[0].width,te[0].height);for(let ue=0,Re=te.length;ue<Re;ue++)re=te[ue],C.format!==ut&&C.format!==Cn?_e!==null?Ce?t.compressedTexSubImage2D(3553,ue,0,0,re.width,re.height,_e,re.data):t.compressedTexImage2D(3553,ue,D,re.width,re.height,0,re.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ce?t.texSubImage2D(3553,ue,0,0,re.width,re.height,_e,se,re.data):t.texImage2D(3553,ue,D,re.width,re.height,0,_e,se,re.data)}else if(C.isDataTexture2DArray)Ce?(xe&&t.texStorage3D(35866,Pe,D,j.width,j.height,j.depth),t.texSubImage3D(35866,0,0,0,0,j.width,j.height,j.depth,_e,se,j.data)):t.texImage3D(35866,0,D,j.width,j.height,j.depth,0,_e,se,j.data);else if(C.isDataTexture3D)Ce?(xe&&t.texStorage3D(32879,Pe,D,j.width,j.height,j.depth),t.texSubImage3D(32879,0,0,0,0,j.width,j.height,j.depth,_e,se,j.data)):t.texImage3D(32879,0,D,j.width,j.height,j.depth,0,_e,se,j.data);else if(C.isFramebufferTexture)Ce&&xe?t.texStorage2D(3553,Pe,D,j.width,j.height):t.texImage2D(3553,0,D,j.width,j.height,0,_e,se,null);else if(te.length>0&&we){Ce&&xe&&t.texStorage2D(3553,Pe,D,te[0].width,te[0].height);for(let ue=0,Re=te.length;ue<Re;ue++)re=te[ue],Ce?t.texSubImage2D(3553,ue,0,0,_e,se,re):t.texImage2D(3553,ue,D,_e,se,re);C.generateMipmaps=!1}else Ce?(xe&&t.texStorage2D(3553,Pe,D,j.width,j.height),t.texSubImage2D(3553,0,0,0,_e,se,j)):t.texImage2D(3553,0,D,_e,se,j);M(C,we)&&b(Q),R.__version=C.version,C.onUpdate&&C.onUpdate(C)}function Y(R,C,J){if(C.image.length!==6)return;he(R,C),t.activeTexture(33984+J),t.bindTexture(34067,R.__webglTexture),r.pixelStorei(37440,C.flipY),r.pixelStorei(37441,C.premultiplyAlpha),r.pixelStorei(3317,C.unpackAlignment),r.pixelStorei(37443,0);const Q=C&&(C.isCompressedTexture||C.image[0].isCompressedTexture),ae=C.image[0]&&C.image[0].isDataTexture,j=[];for(let ue=0;ue<6;ue++)!Q&&!ae?j[ue]=p(C.image[ue],!1,!0,c):j[ue]=ae?C.image[ue].image:C.image[ue];const we=j[0],_e=_(we)||a,se=s.convert(C.format),D=s.convert(C.type),re=E(C.internalFormat,se,D,C.encoding),te=a&&C.isVideoTexture!==!0,Ce=R.__version===void 0;let xe=P(C,we,_e);K(34067,C,_e);let Pe;if(Q){te&&Ce&&t.texStorage2D(34067,xe,re,we.width,we.height);for(let ue=0;ue<6;ue++){Pe=j[ue].mipmaps;for(let Re=0;Re<Pe.length;Re++){const Ze=Pe[Re];C.format!==ut&&C.format!==Cn?se!==null?te?t.compressedTexSubImage2D(34069+ue,Re,0,0,Ze.width,Ze.height,se,Ze.data):t.compressedTexImage2D(34069+ue,Re,re,Ze.width,Ze.height,0,Ze.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):te?t.texSubImage2D(34069+ue,Re,0,0,Ze.width,Ze.height,se,D,Ze.data):t.texImage2D(34069+ue,Re,re,Ze.width,Ze.height,0,se,D,Ze.data)}}}else{Pe=C.mipmaps,te&&Ce&&(Pe.length>0&&xe++,t.texStorage2D(34067,xe,re,j[0].width,j[0].height));for(let ue=0;ue<6;ue++)if(ae){te?t.texSubImage2D(34069+ue,0,0,0,j[ue].width,j[ue].height,se,D,j[ue].data):t.texImage2D(34069+ue,0,re,j[ue].width,j[ue].height,0,se,D,j[ue].data);for(let Re=0;Re<Pe.length;Re++){const Xe=Pe[Re].image[ue].image;te?t.texSubImage2D(34069+ue,Re+1,0,0,Xe.width,Xe.height,se,D,Xe.data):t.texImage2D(34069+ue,Re+1,re,Xe.width,Xe.height,0,se,D,Xe.data)}}else{te?t.texSubImage2D(34069+ue,0,0,0,se,D,j[ue]):t.texImage2D(34069+ue,0,re,se,D,j[ue]);for(let Re=0;Re<Pe.length;Re++){const Ze=Pe[Re];te?t.texSubImage2D(34069+ue,Re+1,0,0,se,D,Ze.image[ue]):t.texImage2D(34069+ue,Re+1,re,se,D,Ze.image[ue])}}}M(C,_e)&&b(34067),R.__version=C.version,C.onUpdate&&C.onUpdate(C)}function be(R,C,J,Q,ae){const j=s.convert(J.format),we=s.convert(J.type),_e=E(J.internalFormat,j,we,J.encoding);n.get(C).__hasExternalTextures||(ae===32879||ae===35866?t.texImage3D(ae,0,_e,C.width,C.height,C.depth,0,j,we,null):t.texImage2D(ae,0,_e,C.width,C.height,0,j,we,null)),t.bindFramebuffer(36160,R),C.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,Q,ae,n.get(J).__webglTexture,0,fe(C)):r.framebufferTexture2D(36160,Q,ae,n.get(J).__webglTexture,0),t.bindFramebuffer(36160,null)}function pe(R,C,J){if(r.bindRenderbuffer(36161,R),C.depthBuffer&&!C.stencilBuffer){let Q=33189;if(J||C.useRenderToTexture){const ae=C.depthTexture;ae&&ae.isDepthTexture&&(ae.type===en?Q=36012:ae.type===Fr&&(Q=33190));const j=fe(C);C.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,j,Q,C.width,C.height):r.renderbufferStorageMultisample(36161,j,Q,C.width,C.height)}else r.renderbufferStorage(36161,Q,C.width,C.height);r.framebufferRenderbuffer(36160,36096,36161,R)}else if(C.depthBuffer&&C.stencilBuffer){const Q=fe(C);J&&C.useRenderbuffer?r.renderbufferStorageMultisample(36161,Q,35056,C.width,C.height):C.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,Q,35056,C.width,C.height):r.renderbufferStorage(36161,34041,C.width,C.height),r.framebufferRenderbuffer(36160,33306,36161,R)}else{const Q=C.isWebGLMultipleRenderTargets===!0?C.texture[0]:C.texture,ae=s.convert(Q.format),j=s.convert(Q.type),we=E(Q.internalFormat,ae,j,Q.encoding),_e=fe(C);J&&C.useRenderbuffer?r.renderbufferStorageMultisample(36161,_e,we,C.width,C.height):C.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,_e,we,C.width,C.height):r.renderbufferStorage(36161,we,C.width,C.height)}r.bindRenderbuffer(36161,null)}function me(R,C){if(C&&C.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,R),!(C.depthTexture&&C.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(C.depthTexture).__webglTexture||C.depthTexture.image.width!==C.width||C.depthTexture.image.height!==C.height)&&(C.depthTexture.image.width=C.width,C.depthTexture.image.height=C.height,C.depthTexture.needsUpdate=!0),U(C.depthTexture,0);const Q=n.get(C.depthTexture).__webglTexture,ae=fe(C);if(C.depthTexture.format===Ln)C.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,36096,3553,Q,0,ae):r.framebufferTexture2D(36160,36096,3553,Q,0);else if(C.depthTexture.format===ti)C.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,33306,3553,Q,0,ae):r.framebufferTexture2D(36160,33306,3553,Q,0);else throw new Error("Unknown depthTexture format")}function ye(R){const C=n.get(R),J=R.isWebGLCubeRenderTarget===!0;if(R.depthTexture&&!C.__autoAllocateDepthBuffer){if(J)throw new Error("target.depthTexture not supported in Cube render targets");me(C.__webglFramebuffer,R)}else if(J){C.__webglDepthbuffer=[];for(let Q=0;Q<6;Q++)t.bindFramebuffer(36160,C.__webglFramebuffer[Q]),C.__webglDepthbuffer[Q]=r.createRenderbuffer(),pe(C.__webglDepthbuffer[Q],R,!1)}else t.bindFramebuffer(36160,C.__webglFramebuffer),C.__webglDepthbuffer=r.createRenderbuffer(),pe(C.__webglDepthbuffer,R,!1);t.bindFramebuffer(36160,null)}function Oe(R,C,J){const Q=n.get(R);C!==void 0&&be(Q.__webglFramebuffer,R,R.texture,36064,3553),J!==void 0&&ye(R)}function k(R){const C=R.texture,J=n.get(R),Q=n.get(C);R.addEventListener("dispose",I),R.isWebGLMultipleRenderTargets!==!0&&(Q.__webglTexture===void 0&&(Q.__webglTexture=r.createTexture()),Q.__version=C.version,o.memory.textures++);const ae=R.isWebGLCubeRenderTarget===!0,j=R.isWebGLMultipleRenderTargets===!0,we=C.isDataTexture3D||C.isDataTexture2DArray,_e=_(R)||a;if(a&&C.format===Cn&&(C.type===en||C.type===An)&&(C.format=ut,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),ae){J.__webglFramebuffer=[];for(let se=0;se<6;se++)J.__webglFramebuffer[se]=r.createFramebuffer()}else if(J.__webglFramebuffer=r.createFramebuffer(),j)if(i.drawBuffers){const se=R.texture;for(let D=0,re=se.length;D<re;D++){const te=n.get(se[D]);te.__webglTexture===void 0&&(te.__webglTexture=r.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(R.useRenderbuffer)if(a){J.__webglMultisampledFramebuffer=r.createFramebuffer(),J.__webglColorRenderbuffer=r.createRenderbuffer(),r.bindRenderbuffer(36161,J.__webglColorRenderbuffer);const se=s.convert(C.format),D=s.convert(C.type),re=E(C.internalFormat,se,D,C.encoding),te=fe(R);r.renderbufferStorageMultisample(36161,te,re,R.width,R.height),t.bindFramebuffer(36160,J.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(36160,36064,36161,J.__webglColorRenderbuffer),r.bindRenderbuffer(36161,null),R.depthBuffer&&(J.__webglDepthRenderbuffer=r.createRenderbuffer(),pe(J.__webglDepthRenderbuffer,R,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(ae){t.bindTexture(34067,Q.__webglTexture),K(34067,C,_e);for(let se=0;se<6;se++)be(J.__webglFramebuffer[se],R,C,36064,34069+se);M(C,_e)&&b(34067),t.unbindTexture()}else if(j){const se=R.texture;for(let D=0,re=se.length;D<re;D++){const te=se[D],Ce=n.get(te);t.bindTexture(3553,Ce.__webglTexture),K(3553,te,_e),be(J.__webglFramebuffer,R,te,36064+D,3553),M(te,_e)&&b(3553)}t.unbindTexture()}else{let se=3553;we&&(a?se=C.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),t.bindTexture(se,Q.__webglTexture),K(se,C,_e),be(J.__webglFramebuffer,R,C,36064,se),M(C,_e)&&b(se),t.unbindTexture()}R.depthBuffer&&ye(R)}function $(R){const C=_(R)||a,J=R.isWebGLMultipleRenderTargets===!0?R.texture:[R.texture];for(let Q=0,ae=J.length;Q<ae;Q++){const j=J[Q];if(M(j,C)){const we=R.isWebGLCubeRenderTarget?34067:3553,_e=n.get(j).__webglTexture;t.bindTexture(we,_e),b(we),t.unbindTexture()}}}function ie(R){if(R.useRenderbuffer)if(a){const C=R.width,J=R.height;let Q=16384;const ae=[36064],j=R.stencilBuffer?33306:36096;R.depthBuffer&&ae.push(j),R.ignoreDepthForMultisampleCopy||(R.depthBuffer&&(Q|=256),R.stencilBuffer&&(Q|=1024));const we=n.get(R);t.bindFramebuffer(36008,we.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,we.__webglFramebuffer),R.ignoreDepthForMultisampleCopy&&(r.invalidateFramebuffer(36008,[j]),r.invalidateFramebuffer(36009,[j])),r.blitFramebuffer(0,0,C,J,0,0,C,J,Q,9728),r.invalidateFramebuffer(36008,ae),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,we.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function fe(R){return a&&(R.useRenderbuffer||R.useRenderToTexture)?Math.min(h,R.samples):0}function ce(R){const C=o.render.frame;m.get(R)!==C&&(m.set(R,C),R.update())}let Ee=!1,Ae=!1;function De(R,C){R&&R.isWebGLRenderTarget&&(Ee===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),Ee=!0),R=R.texture),U(R,C)}function je(R,C){R&&R.isWebGLCubeRenderTarget&&(Ae===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),Ae=!0),R=R.texture),V(R,C)}this.allocateTextureUnit=F,this.resetTextureUnits=L,this.setTexture2D=U,this.setTexture2DArray=Z,this.setTexture3D=ee,this.setTextureCube=V,this.rebindTextures=Oe,this.setupRenderTarget=k,this.updateRenderTargetMipmap=$,this.updateMultisampleRenderTarget=ie,this.setupDepthRenderbuffer=ye,this.setupFrameBufferTexture=be,this.safeSetTexture2D=De,this.safeSetTextureCube=je}function qh(r,e,t){const n=t.isWebGL2;function i(s){let o;if(s===Kt)return 5121;if(s===kc)return 32819;if(s===Wc)return 32820;if(s===qc)return 33635;if(s===Gc)return 5120;if(s===Hc)return 5122;if(s===Ni)return 5123;if(s===Vc)return 5124;if(s===Fr)return 5125;if(s===en)return 5126;if(s===An)return n?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===Xc)return 6406;if(s===Cn)return 6407;if(s===ut)return 6408;if(s===Yc)return 6409;if(s===Jc)return 6410;if(s===Ln)return 6402;if(s===ti)return 34041;if(s===Zc)return 6403;if(s===$c)return 36244;if(s===jc)return 33319;if(s===Qc)return 33320;if(s===Kc)return 36248;if(s===eu)return 36249;if(s===xa||s===ya||s===va||s===_a)if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===xa)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===ya)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===va)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===_a)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Ma||s===ba||s===wa||s===Sa)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===Ma)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===ba)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===wa)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Sa)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===tu)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if((s===Ta||s===Ea)&&(o=e.get("WEBGL_compressed_texture_etc"),o!==null)){if(s===Ta)return o.COMPRESSED_RGB8_ETC2;if(s===Ea)return o.COMPRESSED_RGBA8_ETC2_EAC}if(s===nu||s===iu||s===ru||s===su||s===ou||s===au||s===lu||s===cu||s===uu||s===hu||s===fu||s===du||s===pu||s===mu||s===xu||s===yu||s===vu||s===_u||s===Mu||s===bu||s===wu||s===Su||s===Tu||s===Eu||s===Au||s===Cu||s===Lu||s===Ru)return o=e.get("WEBGL_compressed_texture_astc"),o!==null?s:null;if(s===gu)return o=e.get("EXT_texture_compression_bptc"),o!==null?s:null;if(s===ei)return n?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:i}}class ol extends _t{constructor(e=[]){super(),this.cameras=e}}ol.prototype.isArrayCamera=!0;class pi extends Ne{constructor(){super(),this.type="Group"}}pi.prototype.isGroup=!0;const H0={type:"move"};class al{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new pi,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new pi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new S,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new S),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new pi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new S,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new S),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(i=t.getPose(e.targetRaySpace,n),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(H0))),c&&e.hand){o=!0;for(const x of e.hand.values()){const v=t.getJointPose(x,n);if(c.joints[x.jointName]===void 0){const p=new pi;p.matrixAutoUpdate=!1,p.visible=!1,c.joints[x.jointName]=p,c.add(p)}const g=c.joints[x.jointName];v!==null&&(g.matrix.fromArray(v.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.jointRadius=v.radius),g.visible=v!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),d=.02,m=.005;c.inputState.pinching&&f>d+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}}class uo extends ht{constructor(e,t,n,i,s,o,a,l,c,u){if(u=u!==void 0?u:Ln,u!==Ln&&u!==ti)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===Ln&&(n=Ni),n===void 0&&u===ti&&(n=ei),super(null,i,s,o,a,l,u,n,c),this.image={width:e,height:t},this.magFilter=a!==void 0?a:rt,this.minFilter=l!==void 0?l:rt,this.flipY=!1,this.generateMipmaps=!1}}uo.prototype.isDepthTexture=!0;class V0 extends Rn{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor";const l=e.extensions.has("WEBGL_multisampled_render_to_texture");let c=null,u=null,h=null,f=null,d=!1,m=null;const x=t.getContextAttributes();let v=null,g=null;const p=[],_=new Map,y=new _t;y.layers.enable(1),y.viewport=new We;const M=new _t;M.layers.enable(2),M.viewport=new We;const b=[y,M],E=new ol;E.layers.enable(1),E.layers.enable(2);let P=null,z=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let q=p[V];return q===void 0&&(q=new al,p[V]=q),q.getTargetRaySpace()},this.getControllerGrip=function(V){let q=p[V];return q===void 0&&(q=new al,p[V]=q),q.getGripSpace()},this.getHand=function(V){let q=p[V];return q===void 0&&(q=new al,p[V]=q),q.getHandSpace()};function N(V){const q=_.get(V.inputSource);q&&q.dispatchEvent({type:V.type,data:V.inputSource})}function I(){_.forEach(function(V,q){V.disconnect(q)}),_.clear(),P=null,z=null,e.setRenderTarget(v),f=null,h=null,u=null,i=null,g=null,ee.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(V){s=V,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(V){a=V,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){return u},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=function(V){return Er(this,null,function*(){if(i=V,i!==null){if(v=e.getRenderTarget(),i.addEventListener("select",N),i.addEventListener("selectstart",N),i.addEventListener("selectend",N),i.addEventListener("squeeze",N),i.addEventListener("squeezestart",N),i.addEventListener("squeezeend",N),i.addEventListener("end",I),i.addEventListener("inputsourceschange",w),x.xrCompatible!==!0&&(yield t.makeXRCompatible()),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const q={antialias:i.renderState.layers===void 0?x.antialias:!0,alpha:x.alpha,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,t,q),i.updateRenderState({baseLayer:f}),g=new Nt(f.framebufferWidth,f.framebufferHeight,{format:ut,type:Kt,encoding:e.outputEncoding})}else{d=x.antialias;let q=null,ne=null,K=null;x.depth&&(K=x.stencil?35056:33190,q=x.stencil?ti:Ln,ne=x.stencil?ei:Ni);const he={colorFormat:x.alpha||d?32856:32849,depthFormat:K,scaleFactor:s};u=new XRWebGLBinding(i,t),h=u.createProjectionLayer(he),i.updateRenderState({layers:[h]}),d?g=new Ds(h.textureWidth,h.textureHeight,{format:ut,type:Kt,depthTexture:new uo(h.textureWidth,h.textureHeight,ne,void 0,void 0,void 0,void 0,void 0,void 0,q),stencilBuffer:x.stencil,ignoreDepth:h.ignoreDepthValues,useRenderToTexture:l,encoding:e.outputEncoding}):g=new Nt(h.textureWidth,h.textureHeight,{format:x.alpha?ut:Cn,type:Kt,depthTexture:new uo(h.textureWidth,h.textureHeight,ne,void 0,void 0,void 0,void 0,void 0,void 0,q),stencilBuffer:x.stencil,ignoreDepth:h.ignoreDepthValues,encoding:e.outputEncoding})}this.setFoveation(1),o=yield i.requestReferenceSpace(a),ee.setContext(i),ee.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}})};function w(V){const q=i.inputSources;for(let ne=0;ne<p.length;ne++)_.set(q[ne],p[ne]);for(let ne=0;ne<V.removed.length;ne++){const K=V.removed[ne],he=_.get(K);he&&(he.dispatchEvent({type:"disconnected",data:K}),_.delete(K))}for(let ne=0;ne<V.added.length;ne++){const K=V.added[ne],he=_.get(K);he&&he.dispatchEvent({type:"connected",data:K})}}const T=new S,B=new S;function L(V,q,ne){T.setFromMatrixPosition(q.matrixWorld),B.setFromMatrixPosition(ne.matrixWorld);const K=T.distanceTo(B),he=q.projectionMatrix.elements,Me=ne.projectionMatrix.elements,Y=he[14]/(he[10]-1),be=he[14]/(he[10]+1),pe=(he[9]+1)/he[5],me=(he[9]-1)/he[5],ye=(he[8]-1)/he[0],Oe=(Me[8]+1)/Me[0],k=Y*ye,$=Y*Oe,ie=K/(-ye+Oe),fe=ie*-ye;q.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(fe),V.translateZ(ie),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert();const ce=Y+ie,Ee=be+ie,Ae=k-fe,De=$+(K-fe),je=pe*be/Ee*ce,R=me*be/Ee*ce;V.projectionMatrix.makePerspective(Ae,De,je,R,ce,Ee)}function F(V,q){q===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(q.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(i===null)return;E.near=M.near=y.near=V.near,E.far=M.far=y.far=V.far,(P!==E.near||z!==E.far)&&(i.updateRenderState({depthNear:E.near,depthFar:E.far}),P=E.near,z=E.far);const q=V.parent,ne=E.cameras;F(E,q);for(let he=0;he<ne.length;he++)F(ne[he],q);E.matrixWorld.decompose(E.position,E.quaternion,E.scale),V.position.copy(E.position),V.quaternion.copy(E.quaternion),V.scale.copy(E.scale),V.matrix.copy(E.matrix),V.matrixWorld.copy(E.matrixWorld);const K=V.children;for(let he=0,Me=K.length;he<Me;he++)K[he].updateMatrixWorld(!0);ne.length===2?L(E,y,M):E.projectionMatrix.copy(y.projectionMatrix)},this.getCamera=function(){return E},this.getFoveation=function(){if(h!==null)return h.fixedFoveation;if(f!==null)return f.fixedFoveation},this.setFoveation=function(V){h!==null&&(h.fixedFoveation=V),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=V)};let U=null;function Z(V,q){if(c=q.getViewerPose(o),m=q,c!==null){const K=c.views;f!==null&&(e.setRenderTargetFramebuffer(g,f.framebuffer),e.setRenderTarget(g));let he=!1;K.length!==E.cameras.length&&(E.cameras.length=0,he=!0);for(let Me=0;Me<K.length;Me++){const Y=K[Me];let be=null;if(f!==null)be=f.getViewport(Y);else{const me=u.getViewSubImage(h,Y);be=me.viewport,Me===0&&(e.setRenderTargetTextures(g,me.colorTexture,h.ignoreDepthValues?void 0:me.depthStencilTexture),e.setRenderTarget(g))}const pe=b[Me];pe.matrix.fromArray(Y.transform.matrix),pe.projectionMatrix.fromArray(Y.projectionMatrix),pe.viewport.set(be.x,be.y,be.width,be.height),Me===0&&E.matrix.copy(pe.matrix),he===!0&&E.cameras.push(pe)}}const ne=i.inputSources;for(let K=0;K<p.length;K++){const he=p[K],Me=ne[K];he.update(Me,q,o)}U&&U(V,q),m=null}const ee=new uh;ee.setAnimationLoop(Z),this.setAnimationLoop=function(V){U=V},this.dispose=function(){}}}function k0(r){function e(g,p){g.fogColor.value.copy(p.color),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function t(g,p,_,y,M){p.isMeshBasicMaterial?n(g,p):p.isMeshLambertMaterial?(n(g,p),l(g,p)):p.isMeshToonMaterial?(n(g,p),u(g,p)):p.isMeshPhongMaterial?(n(g,p),c(g,p)):p.isMeshStandardMaterial?(n(g,p),p.isMeshPhysicalMaterial?f(g,p,M):h(g,p)):p.isMeshMatcapMaterial?(n(g,p),d(g,p)):p.isMeshDepthMaterial?(n(g,p),m(g,p)):p.isMeshDistanceMaterial?(n(g,p),x(g,p)):p.isMeshNormalMaterial?(n(g,p),v(g,p)):p.isLineBasicMaterial?(i(g,p),p.isLineDashedMaterial&&s(g,p)):p.isPointsMaterial?o(g,p,_,y):p.isSpriteMaterial?a(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function n(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.specularMap&&(g.specularMap.value=p.specularMap),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);const _=r.get(p).envMap;_&&(g.envMap.value=_,g.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity);let y;p.map?y=p.map:p.specularMap?y=p.specularMap:p.displacementMap?y=p.displacementMap:p.normalMap?y=p.normalMap:p.bumpMap?y=p.bumpMap:p.roughnessMap?y=p.roughnessMap:p.metalnessMap?y=p.metalnessMap:p.alphaMap?y=p.alphaMap:p.emissiveMap?y=p.emissiveMap:p.clearcoatMap?y=p.clearcoatMap:p.clearcoatNormalMap?y=p.clearcoatNormalMap:p.clearcoatRoughnessMap?y=p.clearcoatRoughnessMap:p.specularIntensityMap?y=p.specularIntensityMap:p.specularColorMap?y=p.specularColorMap:p.transmissionMap?y=p.transmissionMap:p.thicknessMap?y=p.thicknessMap:p.sheenColorMap?y=p.sheenColorMap:p.sheenRoughnessMap&&(y=p.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),g.uvTransform.value.copy(y.matrix));let M;p.aoMap?M=p.aoMap:p.lightMap&&(M=p.lightMap),M!==void 0&&(M.isWebGLRenderTarget&&(M=M.texture),M.matrixAutoUpdate===!0&&M.updateMatrix(),g.uv2Transform.value.copy(M.matrix))}function i(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity}function s(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function o(g,p,_,y){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*_,g.scale.value=y*.5,p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);let M;p.map?M=p.map:p.alphaMap&&(M=p.alphaMap),M!==void 0&&(M.matrixAutoUpdate===!0&&M.updateMatrix(),g.uvTransform.value.copy(M.matrix))}function a(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);let _;p.map?_=p.map:p.alphaMap&&(_=p.alphaMap),_!==void 0&&(_.matrixAutoUpdate===!0&&_.updateMatrix(),g.uvTransform.value.copy(_.matrix))}function l(g,p){p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap)}function c(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===it&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===it&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===it&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===it&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function h(g,p){g.roughness.value=p.roughness,g.metalness.value=p.metalness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap),p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===it&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===it&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),r.get(p).envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,_){h(g,p),g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap)),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap),p.clearcoatNormalMap&&(g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),g.clearcoatNormalMap.value=p.clearcoatNormalMap,p.side===it&&g.clearcoatNormalScale.value.negate())),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=_.texture,g.transmissionSamplerSize.value.set(_.width,_.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap)}function d(g,p){p.matcap&&(g.matcap.value=p.matcap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===it&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===it&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function m(g,p){p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function x(g,p){p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),g.referencePosition.value.copy(p.referencePosition),g.nearDistance.value=p.nearDistance,g.farDistance.value=p.farDistance}function v(g,p){p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===it&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===it&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:t}}function W0(){const r=Is("canvas");return r.style.display="block",r}function qe(r={}){const e=r.canvas!==void 0?r.canvas:W0(),t=r.context!==void 0?r.context:null,n=r.alpha!==void 0?r.alpha:!1,i=r.depth!==void 0?r.depth:!0,s=r.stencil!==void 0?r.stencil:!0,o=r.antialias!==void 0?r.antialias:!1,a=r.premultipliedAlpha!==void 0?r.premultipliedAlpha:!0,l=r.preserveDrawingBuffer!==void 0?r.preserveDrawingBuffer:!1,c=r.powerPreference!==void 0?r.powerPreference:"default",u=r.failIfMajorPerformanceCaveat!==void 0?r.failIfMajorPerformanceCaveat:!1;let h=null,f=null;const d=[],m=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Ht,this.physicallyCorrectLights=!1,this.toneMapping=pn,this.toneMappingExposure=1;const x=this;let v=!1,g=0,p=0,_=null,y=-1,M=null;const b=new We,E=new We;let P=null,z=e.width,N=e.height,I=1,w=null,T=null;const B=new We(0,0,z,N),L=new We(0,0,z,N);let F=!1;const U=[],Z=new qr;let ee=!1,V=!1,q=null;const ne=new ge,K=new S,he={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Me(){return _===null?I:1}let Y=t;function be(A,O){for(let H=0;H<A.length;H++){const G=A[H],X=e.getContext(G,O);if(X!==null)return X}return null}try{const A={alpha:n,depth:i,stencil:s,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Xn}`),e.addEventListener("webglcontextlost",Ce,!1),e.addEventListener("webglcontextrestored",xe,!1),Y===null){const O=["webgl2","webgl","experimental-webgl"];if(x.isWebGL1Renderer===!0&&O.shift(),Y=be(O,A),Y===null)throw be(O)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}Y.getShaderPrecisionFormat===void 0&&(Y.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(A){throw console.error("THREE.WebGLRenderer: "+A.message),A}let pe,me,ye,Oe,k,$,ie,fe,ce,Ee,Ae,De,je,R,C,J,Q,ae,j,we,_e,se,D;function re(){pe=new hx(Y),me=new sx(Y,pe,r),pe.init(me),se=new qh(Y,pe,me),ye=new O0(Y,pe,me),U[0]=1029,Oe=new px(Y),k=new C0,$=new G0(Y,pe,ye,k,me,se,Oe),ie=new ax(x),fe=new ux(x),ce=new am(Y,me),D=new ix(Y,pe,ce,me),Ee=new fx(Y,ce,Oe,D),Ae=new yx(Y,Ee,ce,Oe),j=new xx(Y,me,$),J=new ox(k),De=new A0(x,ie,fe,pe,me,D,J),je=new k0(k),R=new R0,C=new N0(pe,me),ae=new nx(x,ie,ye,Ae,a),Q=new Wh(x,Ae,me),we=new rx(Y,pe,Oe,me),_e=new dx(Y,pe,Oe,me),Oe.programs=De.programs,x.capabilities=me,x.extensions=pe,x.properties=k,x.renderLists=R,x.shadowMap=Q,x.state=ye,x.info=Oe}re();const te=new V0(x,Y);this.xr=te,this.getContext=function(){return Y},this.getContextAttributes=function(){return Y.getContextAttributes()},this.forceContextLoss=function(){const A=pe.get("WEBGL_lose_context");A&&A.loseContext()},this.forceContextRestore=function(){const A=pe.get("WEBGL_lose_context");A&&A.restoreContext()},this.getPixelRatio=function(){return I},this.setPixelRatio=function(A){A!==void 0&&(I=A,this.setSize(z,N,!1))},this.getSize=function(A){return A.set(z,N)},this.setSize=function(A,O,H){if(te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}z=A,N=O,e.width=Math.floor(A*I),e.height=Math.floor(O*I),H!==!1&&(e.style.width=A+"px",e.style.height=O+"px"),this.setViewport(0,0,A,O)},this.getDrawingBufferSize=function(A){return A.set(z*I,N*I).floor()},this.setDrawingBufferSize=function(A,O,H){z=A,N=O,I=H,e.width=Math.floor(A*H),e.height=Math.floor(O*H),this.setViewport(0,0,A,O)},this.getCurrentViewport=function(A){return A.copy(b)},this.getViewport=function(A){return A.copy(B)},this.setViewport=function(A,O,H,G){A.isVector4?B.set(A.x,A.y,A.z,A.w):B.set(A,O,H,G),ye.viewport(b.copy(B).multiplyScalar(I).floor())},this.getScissor=function(A){return A.copy(L)},this.setScissor=function(A,O,H,G){A.isVector4?L.set(A.x,A.y,A.z,A.w):L.set(A,O,H,G),ye.scissor(E.copy(L).multiplyScalar(I).floor())},this.getScissorTest=function(){return F},this.setScissorTest=function(A){ye.setScissorTest(F=A)},this.setOpaqueSort=function(A){w=A},this.setTransparentSort=function(A){T=A},this.getClearColor=function(A){return A.copy(ae.getClearColor())},this.setClearColor=function(){ae.setClearColor.apply(ae,arguments)},this.getClearAlpha=function(){return ae.getClearAlpha()},this.setClearAlpha=function(){ae.setClearAlpha.apply(ae,arguments)},this.clear=function(A,O,H){let G=0;(A===void 0||A)&&(G|=16384),(O===void 0||O)&&(G|=256),(H===void 0||H)&&(G|=1024),Y.clear(G)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Ce,!1),e.removeEventListener("webglcontextrestored",xe,!1),R.dispose(),C.dispose(),k.dispose(),ie.dispose(),fe.dispose(),Ae.dispose(),D.dispose(),De.dispose(),te.dispose(),te.removeEventListener("sessionstart",ln),te.removeEventListener("sessionend",cn),q&&(q.dispose(),q=null),Pi.stop()};function Ce(A){A.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function xe(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;const A=Oe.autoReset,O=Q.enabled,H=Q.autoUpdate,G=Q.needsUpdate,X=Q.type;re(),Oe.autoReset=A,Q.enabled=O,Q.autoUpdate=H,Q.needsUpdate=G,Q.type=X}function Pe(A){const O=A.target;O.removeEventListener("dispose",Pe),ue(O)}function ue(A){Re(A),k.remove(A)}function Re(A){const O=k.get(A).programs;O!==void 0&&(O.forEach(function(H){De.releaseProgram(H)}),A.isShaderMaterial&&De.releaseShaderCache(A))}this.renderBufferDirect=function(A,O,H,G,X,Se){O===null&&(O=he);const Le=X.isMesh&&X.matrixWorld.determinant()<0,Fe=z_(A,O,H,G,X);ye.setMaterial(G,Le);let Te=H.index;const Ve=H.attributes.position;if(Te===null){if(Ve===void 0||Ve.count===0)return}else if(Te.count===0)return;let Be=1;G.wireframe===!0&&(Te=Ee.getWireframeAttribute(H),Be=2),D.setup(X,G,Fe,H,Te);let Ge,nt=we;Te!==null&&(Ge=ce.get(Te),nt=_e,nt.setIndex(Ge));const Ii=Te!==null?Te.count:Ve.count,Tr=H.drawRange.start*Be,ke=H.drawRange.count*Be,un=Se!==null?Se.start*Be:0,gt=Se!==null?Se.count*Be:1/0,hn=Math.max(Tr,un),sa=Math.min(Ii,Tr+ke,un+gt)-1,fn=Math.max(0,sa-hn+1);if(fn!==0){if(X.isMesh)G.wireframe===!0?(ye.setLineWidth(G.wireframeLinewidth*Me()),nt.setMode(1)):nt.setMode(4);else if(X.isLine){let En=G.linewidth;En===void 0&&(En=1),ye.setLineWidth(En*Me()),X.isLineSegments?nt.setMode(1):X.isLineLoop?nt.setMode(2):nt.setMode(3)}else X.isPoints?nt.setMode(0):X.isSprite&&nt.setMode(4);if(X.isInstancedMesh)nt.renderInstances(hn,fn,X.count);else if(H.isInstancedBufferGeometry){const En=Math.min(H.instanceCount,H._maxInstanceCount);nt.renderInstances(hn,fn,En)}else nt.render(hn,fn)}},this.compile=function(A,O){f=C.get(A),f.init(),m.push(f),A.traverseVisible(function(H){H.isLight&&H.layers.test(O.layers)&&(f.pushLight(H),H.castShadow&&f.pushShadow(H))}),f.setupLights(x.physicallyCorrectLights),A.traverse(function(H){const G=H.material;if(G)if(Array.isArray(G))for(let X=0;X<G.length;X++){const Se=G[X];fc(Se,A,H)}else fc(G,A,H)}),m.pop(),f=null};let Ze=null;function Xe(A){Ze&&Ze(A)}function ln(){Pi.stop()}function cn(){Pi.start()}const Pi=new uh;Pi.setAnimationLoop(Xe),typeof window!="undefined"&&Pi.setContext(window),this.setAnimationLoop=function(A){Ze=A,te.setAnimationLoop(A),A===null?Pi.stop():Pi.start()},te.addEventListener("sessionstart",ln),te.addEventListener("sessionend",cn),this.render=function(A,O){if(O!==void 0&&O.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;A.autoUpdate===!0&&A.updateMatrixWorld(),O.parent===null&&O.updateMatrixWorld(),te.enabled===!0&&te.isPresenting===!0&&(te.cameraAutoUpdate===!0&&te.updateCamera(O),O=te.getCamera()),A.isScene===!0&&A.onBeforeRender(x,A,O,_),f=C.get(A,m.length),f.init(),m.push(f),ne.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),Z.setFromProjectionMatrix(ne),V=this.localClippingEnabled,ee=J.init(this.clippingPlanes,V,O),h=R.get(A,d.length),h.init(),d.push(h),Zd(A,O,0,x.sortObjects),h.finish(),x.sortObjects===!0&&h.sort(w,T),ee===!0&&J.beginShadows();const H=f.state.shadowsArray;if(Q.render(H,A,O),ee===!0&&J.endShadows(),this.info.autoReset===!0&&this.info.reset(),ae.render(h,A),f.setupLights(x.physicallyCorrectLights),O.isArrayCamera){const G=O.cameras;for(let X=0,Se=G.length;X<Se;X++){const Le=G[X];$d(h,A,Le,Le.viewport)}}else $d(h,A,O);_!==null&&($.updateMultisampleRenderTarget(_),$.updateRenderTargetMipmap(_)),A.isScene===!0&&A.onAfterRender(x,A,O),ye.buffers.depth.setTest(!0),ye.buffers.depth.setMask(!0),ye.buffers.color.setMask(!0),ye.setPolygonOffset(!1),D.resetDefaultState(),y=-1,M=null,m.pop(),m.length>0?f=m[m.length-1]:f=null,d.pop(),d.length>0?h=d[d.length-1]:h=null};function Zd(A,O,H,G){if(A.visible===!1)return;if(A.layers.test(O.layers)){if(A.isGroup)H=A.renderOrder;else if(A.isLOD)A.autoUpdate===!0&&A.update(O);else if(A.isLight)f.pushLight(A),A.castShadow&&f.pushShadow(A);else if(A.isSprite){if(!A.frustumCulled||Z.intersectsSprite(A)){G&&K.setFromMatrixPosition(A.matrixWorld).applyMatrix4(ne);const Le=Ae.update(A),Fe=A.material;Fe.visible&&h.push(A,Le,Fe,H,K.z,null)}}else if((A.isMesh||A.isLine||A.isPoints)&&(A.isSkinnedMesh&&A.skeleton.frame!==Oe.render.frame&&(A.skeleton.update(),A.skeleton.frame=Oe.render.frame),!A.frustumCulled||Z.intersectsObject(A))){G&&K.setFromMatrixPosition(A.matrixWorld).applyMatrix4(ne);const Le=Ae.update(A),Fe=A.material;if(Array.isArray(Fe)){const Te=Le.groups;for(let Ve=0,Be=Te.length;Ve<Be;Ve++){const Ge=Te[Ve],nt=Fe[Ge.materialIndex];nt&&nt.visible&&h.push(A,Le,nt,H,K.z,Ge)}}else Fe.visible&&h.push(A,Le,Fe,H,K.z,null)}}const Se=A.children;for(let Le=0,Fe=Se.length;Le<Fe;Le++)Zd(Se[Le],O,H,G)}function $d(A,O,H,G){const X=A.opaque,Se=A.transmissive,Le=A.transparent;f.setupLightsView(H),Se.length>0&&B_(X,O,H),G&&ye.viewport(b.copy(G)),X.length>0&&ra(X,O,H),Se.length>0&&ra(Se,O,H),Le.length>0&&ra(Le,O,H)}function B_(A,O,H){if(q===null){const Le=o===!0&&me.isWebGL2===!0?Ds:Nt;q=new Le(1024,1024,{generateMipmaps:!0,type:se.convert(An)!==null?An:Kt,minFilter:Kn,magFilter:rt,wrapS:bt,wrapT:bt,useRenderToTexture:pe.has("WEBGL_multisampled_render_to_texture")})}const G=x.getRenderTarget();x.setRenderTarget(q),x.clear();const X=x.toneMapping;x.toneMapping=pn,ra(A,O,H),x.toneMapping=X,$.updateMultisampleRenderTarget(q),$.updateRenderTargetMipmap(q),x.setRenderTarget(G)}function ra(A,O,H){const G=O.isScene===!0?O.overrideMaterial:null;for(let X=0,Se=A.length;X<Se;X++){const Le=A[X],Fe=Le.object,Te=Le.geometry,Ve=G===null?Le.material:G,Be=Le.group;Fe.layers.test(H.layers)&&N_(Fe,O,H,Te,Ve,Be)}}function N_(A,O,H,G,X,Se){A.onBeforeRender(x,O,H,G,X,Se),A.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,A.matrixWorld),A.normalMatrix.getNormalMatrix(A.modelViewMatrix),X.onBeforeRender(x,O,H,G,A,Se),X.transparent===!0&&X.side===Zn?(X.side=it,X.needsUpdate=!0,x.renderBufferDirect(H,O,G,X,A,Se),X.side=Jn,X.needsUpdate=!0,x.renderBufferDirect(H,O,G,X,A,Se),X.side=Zn):x.renderBufferDirect(H,O,G,X,A,Se),A.onAfterRender(x,O,H,G,X,Se)}function fc(A,O,H){O.isScene!==!0&&(O=he);const G=k.get(A),X=f.state.lights,Se=f.state.shadowsArray,Le=X.state.version,Fe=De.getParameters(A,X.state,Se,O,H),Te=De.getProgramCacheKey(Fe);let Ve=G.programs;G.environment=A.isMeshStandardMaterial?O.environment:null,G.fog=O.fog,G.envMap=(A.isMeshStandardMaterial?fe:ie).get(A.envMap||G.environment),Ve===void 0&&(A.addEventListener("dispose",Pe),Ve=new Map,G.programs=Ve);let Be=Ve.get(Te);if(Be!==void 0){if(G.currentProgram===Be&&G.lightsStateVersion===Le)return jd(A,Fe),Be}else Fe.uniforms=De.getUniforms(A),A.onBuild(H,Fe,x),A.onBeforeCompile(Fe,x),Be=De.acquireProgram(Fe,Te),Ve.set(Te,Be),G.uniforms=Fe.uniforms;const Ge=G.uniforms;(!A.isShaderMaterial&&!A.isRawShaderMaterial||A.clipping===!0)&&(Ge.clippingPlanes=J.uniform),jd(A,Fe),G.needsLights=O_(A),G.lightsStateVersion=Le,G.needsLights&&(Ge.ambientLightColor.value=X.state.ambient,Ge.lightProbe.value=X.state.probe,Ge.directionalLights.value=X.state.directional,Ge.directionalLightShadows.value=X.state.directionalShadow,Ge.spotLights.value=X.state.spot,Ge.spotLightShadows.value=X.state.spotShadow,Ge.rectAreaLights.value=X.state.rectArea,Ge.ltc_1.value=X.state.rectAreaLTC1,Ge.ltc_2.value=X.state.rectAreaLTC2,Ge.pointLights.value=X.state.point,Ge.pointLightShadows.value=X.state.pointShadow,Ge.hemisphereLights.value=X.state.hemi,Ge.directionalShadowMap.value=X.state.directionalShadowMap,Ge.directionalShadowMatrix.value=X.state.directionalShadowMatrix,Ge.spotShadowMap.value=X.state.spotShadowMap,Ge.spotShadowMatrix.value=X.state.spotShadowMatrix,Ge.pointShadowMap.value=X.state.pointShadowMap,Ge.pointShadowMatrix.value=X.state.pointShadowMatrix);const nt=Be.getUniforms(),Ii=Hn.seqWithValue(nt.seq,Ge);return G.currentProgram=Be,G.uniformsList=Ii,Be}function jd(A,O){const H=k.get(A);H.outputEncoding=O.outputEncoding,H.instancing=O.instancing,H.skinning=O.skinning,H.morphTargets=O.morphTargets,H.morphNormals=O.morphNormals,H.morphTargetsCount=O.morphTargetsCount,H.numClippingPlanes=O.numClippingPlanes,H.numIntersection=O.numClipIntersection,H.vertexAlphas=O.vertexAlphas,H.vertexTangents=O.vertexTangents,H.toneMapping=O.toneMapping}function z_(A,O,H,G,X){O.isScene!==!0&&(O=he),$.resetTextureUnits();const Se=O.fog,Le=G.isMeshStandardMaterial?O.environment:null,Fe=_===null?x.outputEncoding:_.texture.encoding,Te=(G.isMeshStandardMaterial?fe:ie).get(G.envMap||Le),Ve=G.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,Be=!!G.normalMap&&!!H.attributes.tangent,Ge=!!H.morphAttributes.position,nt=!!H.morphAttributes.normal,Ii=H.morphAttributes.position?H.morphAttributes.position.length:0,Tr=G.toneMapped?x.toneMapping:pn,ke=k.get(G),un=f.state.lights;if(ee===!0&&(V===!0||A!==M)){const jt=A===M&&G.id===y;J.setState(G,A,jt)}let gt=!1;G.version===ke.__version?(ke.needsLights&&ke.lightsStateVersion!==un.state.version||ke.outputEncoding!==Fe||X.isInstancedMesh&&ke.instancing===!1||!X.isInstancedMesh&&ke.instancing===!0||X.isSkinnedMesh&&ke.skinning===!1||!X.isSkinnedMesh&&ke.skinning===!0||ke.envMap!==Te||G.fog&&ke.fog!==Se||ke.numClippingPlanes!==void 0&&(ke.numClippingPlanes!==J.numPlanes||ke.numIntersection!==J.numIntersection)||ke.vertexAlphas!==Ve||ke.vertexTangents!==Be||ke.morphTargets!==Ge||ke.morphNormals!==nt||ke.toneMapping!==Tr||me.isWebGL2===!0&&ke.morphTargetsCount!==Ii)&&(gt=!0):(gt=!0,ke.__version=G.version);let hn=ke.currentProgram;gt===!0&&(hn=fc(G,O,X));let sa=!1,fn=!1,En=!1;const Ct=hn.getUniforms(),Ms=ke.uniforms;if(ye.useProgram(hn.program)&&(sa=!0,fn=!0,En=!0),G.id!==y&&(y=G.id,fn=!0),sa||M!==A){if(Ct.setValue(Y,"projectionMatrix",A.projectionMatrix),me.logarithmicDepthBuffer&&Ct.setValue(Y,"logDepthBufFC",2/(Math.log(A.far+1)/Math.LN2)),M!==A&&(M=A,fn=!0,En=!0),G.isShaderMaterial||G.isMeshPhongMaterial||G.isMeshToonMaterial||G.isMeshStandardMaterial||G.envMap){const jt=Ct.map.cameraPosition;jt!==void 0&&jt.setValue(Y,K.setFromMatrixPosition(A.matrixWorld))}(G.isMeshPhongMaterial||G.isMeshToonMaterial||G.isMeshLambertMaterial||G.isMeshBasicMaterial||G.isMeshStandardMaterial||G.isShaderMaterial)&&Ct.setValue(Y,"isOrthographic",A.isOrthographicCamera===!0),(G.isMeshPhongMaterial||G.isMeshToonMaterial||G.isMeshLambertMaterial||G.isMeshBasicMaterial||G.isMeshStandardMaterial||G.isShaderMaterial||G.isShadowMaterial||X.isSkinnedMesh)&&Ct.setValue(Y,"viewMatrix",A.matrixWorldInverse)}if(X.isSkinnedMesh){Ct.setOptional(Y,X,"bindMatrix"),Ct.setOptional(Y,X,"bindMatrixInverse");const jt=X.skeleton;jt&&(me.floatVertexTextures?(jt.boneTexture===null&&jt.computeBoneTexture(),Ct.setValue(Y,"boneTexture",jt.boneTexture,$),Ct.setValue(Y,"boneTextureSize",jt.boneTextureSize)):Ct.setOptional(Y,jt,"boneMatrices"))}return!!H&&(H.morphAttributes.position!==void 0||H.morphAttributes.normal!==void 0)&&j.update(X,H,G,hn),(fn||ke.receiveShadow!==X.receiveShadow)&&(ke.receiveShadow=X.receiveShadow,Ct.setValue(Y,"receiveShadow",X.receiveShadow)),fn&&(Ct.setValue(Y,"toneMappingExposure",x.toneMappingExposure),ke.needsLights&&U_(Ms,En),Se&&G.fog&&je.refreshFogUniforms(Ms,Se),je.refreshMaterialUniforms(Ms,G,I,N,q),Hn.upload(Y,ke.uniformsList,Ms,$)),G.isShaderMaterial&&G.uniformsNeedUpdate===!0&&(Hn.upload(Y,ke.uniformsList,Ms,$),G.uniformsNeedUpdate=!1),G.isSpriteMaterial&&Ct.setValue(Y,"center",X.center),Ct.setValue(Y,"modelViewMatrix",X.modelViewMatrix),Ct.setValue(Y,"normalMatrix",X.normalMatrix),Ct.setValue(Y,"modelMatrix",X.matrixWorld),hn}function U_(A,O){A.ambientLightColor.needsUpdate=O,A.lightProbe.needsUpdate=O,A.directionalLights.needsUpdate=O,A.directionalLightShadows.needsUpdate=O,A.pointLights.needsUpdate=O,A.pointLightShadows.needsUpdate=O,A.spotLights.needsUpdate=O,A.spotLightShadows.needsUpdate=O,A.rectAreaLights.needsUpdate=O,A.hemisphereLights.needsUpdate=O}function O_(A){return A.isMeshLambertMaterial||A.isMeshToonMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isShadowMaterial||A.isShaderMaterial&&A.lights===!0}this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return p},this.getRenderTarget=function(){return _},this.setRenderTargetTextures=function(A,O,H){k.get(A.texture).__webglTexture=O,k.get(A.depthTexture).__webglTexture=H;const G=k.get(A);G.__hasExternalTextures=!0,G.__hasExternalTextures&&(G.__autoAllocateDepthBuffer=H===void 0,G.__autoAllocateDepthBuffer||A.useRenderToTexture&&(console.warn("render-to-texture extension was disabled because an external texture was provided"),A.useRenderToTexture=!1,A.useRenderbuffer=!0))},this.setRenderTargetFramebuffer=function(A,O){const H=k.get(A);H.__webglFramebuffer=O,H.__useDefaultFramebuffer=O===void 0},this.setRenderTarget=function(A,O=0,H=0){_=A,g=O,p=H;let G=!0;if(A){const Te=k.get(A);Te.__useDefaultFramebuffer!==void 0?(ye.bindFramebuffer(36160,null),G=!1):Te.__webglFramebuffer===void 0?$.setupRenderTarget(A):Te.__hasExternalTextures&&$.rebindTextures(A,k.get(A.texture).__webglTexture,k.get(A.depthTexture).__webglTexture)}let X=null,Se=!1,Le=!1;if(A){const Te=A.texture;(Te.isDataTexture3D||Te.isDataTexture2DArray)&&(Le=!0);const Ve=k.get(A).__webglFramebuffer;A.isWebGLCubeRenderTarget?(X=Ve[O],Se=!0):A.useRenderbuffer?X=k.get(A).__webglMultisampledFramebuffer:X=Ve,b.copy(A.viewport),E.copy(A.scissor),P=A.scissorTest}else b.copy(B).multiplyScalar(I).floor(),E.copy(L).multiplyScalar(I).floor(),P=F;if(ye.bindFramebuffer(36160,X)&&me.drawBuffers&&G){let Te=!1;if(A)if(A.isWebGLMultipleRenderTargets){const Ve=A.texture;if(U.length!==Ve.length||U[0]!==36064){for(let Be=0,Ge=Ve.length;Be<Ge;Be++)U[Be]=36064+Be;U.length=Ve.length,Te=!0}}else(U.length!==1||U[0]!==36064)&&(U[0]=36064,U.length=1,Te=!0);else(U.length!==1||U[0]!==1029)&&(U[0]=1029,U.length=1,Te=!0);Te&&(me.isWebGL2?Y.drawBuffers(U):pe.get("WEBGL_draw_buffers").drawBuffersWEBGL(U))}if(ye.viewport(b),ye.scissor(E),ye.setScissorTest(P),Se){const Te=k.get(A.texture);Y.framebufferTexture2D(36160,36064,34069+O,Te.__webglTexture,H)}else if(Le){const Te=k.get(A.texture),Ve=O||0;Y.framebufferTextureLayer(36160,36064,Te.__webglTexture,H||0,Ve)}y=-1},this.readRenderTargetPixels=function(A,O,H,G,X,Se,Le){if(!(A&&A.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Fe=k.get(A).__webglFramebuffer;if(A.isWebGLCubeRenderTarget&&Le!==void 0&&(Fe=Fe[Le]),Fe){ye.bindFramebuffer(36160,Fe);try{const Te=A.texture,Ve=Te.format,Be=Te.type;if(Ve!==ut&&se.convert(Ve)!==Y.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ge=Be===An&&(pe.has("EXT_color_buffer_half_float")||me.isWebGL2&&pe.has("EXT_color_buffer_float"));if(Be!==Kt&&se.convert(Be)!==Y.getParameter(35738)&&!(Be===en&&(me.isWebGL2||pe.has("OES_texture_float")||pe.has("WEBGL_color_buffer_float")))&&!Ge){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y.checkFramebufferStatus(36160)===36053?O>=0&&O<=A.width-G&&H>=0&&H<=A.height-X&&Y.readPixels(O,H,G,X,se.convert(Ve),se.convert(Be),Se):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const Te=_!==null?k.get(_).__webglFramebuffer:null;ye.bindFramebuffer(36160,Te)}}},this.copyFramebufferToTexture=function(A,O,H=0){if(O.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}const G=Math.pow(2,-H),X=Math.floor(O.image.width*G),Se=Math.floor(O.image.height*G);$.setTexture2D(O,0),Y.copyTexSubImage2D(3553,H,0,0,A.x,A.y,X,Se),ye.unbindTexture()},this.copyTextureToTexture=function(A,O,H,G=0){const X=O.image.width,Se=O.image.height,Le=se.convert(H.format),Fe=se.convert(H.type);$.setTexture2D(H,0),Y.pixelStorei(37440,H.flipY),Y.pixelStorei(37441,H.premultiplyAlpha),Y.pixelStorei(3317,H.unpackAlignment),O.isDataTexture?Y.texSubImage2D(3553,G,A.x,A.y,X,Se,Le,Fe,O.image.data):O.isCompressedTexture?Y.compressedTexSubImage2D(3553,G,A.x,A.y,O.mipmaps[0].width,O.mipmaps[0].height,Le,O.mipmaps[0].data):Y.texSubImage2D(3553,G,A.x,A.y,Le,Fe,O.image),G===0&&H.generateMipmaps&&Y.generateMipmap(3553),ye.unbindTexture()},this.copyTextureToTexture3D=function(A,O,H,G,X=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Se=A.max.x-A.min.x+1,Le=A.max.y-A.min.y+1,Fe=A.max.z-A.min.z+1,Te=se.convert(G.format),Ve=se.convert(G.type);let Be;if(G.isDataTexture3D)$.setTexture3D(G,0),Be=32879;else if(G.isDataTexture2DArray)$.setTexture2DArray(G,0),Be=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Y.pixelStorei(37440,G.flipY),Y.pixelStorei(37441,G.premultiplyAlpha),Y.pixelStorei(3317,G.unpackAlignment);const Ge=Y.getParameter(3314),nt=Y.getParameter(32878),Ii=Y.getParameter(3316),Tr=Y.getParameter(3315),ke=Y.getParameter(32877),un=H.isCompressedTexture?H.mipmaps[0]:H.image;Y.pixelStorei(3314,un.width),Y.pixelStorei(32878,un.height),Y.pixelStorei(3316,A.min.x),Y.pixelStorei(3315,A.min.y),Y.pixelStorei(32877,A.min.z),H.isDataTexture||H.isDataTexture3D?Y.texSubImage3D(Be,X,O.x,O.y,O.z,Se,Le,Fe,Te,Ve,un.data):H.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Y.compressedTexSubImage3D(Be,X,O.x,O.y,O.z,Se,Le,Fe,Te,un.data)):Y.texSubImage3D(Be,X,O.x,O.y,O.z,Se,Le,Fe,Te,Ve,un),Y.pixelStorei(3314,Ge),Y.pixelStorei(32878,nt),Y.pixelStorei(3316,Ii),Y.pixelStorei(3315,Tr),Y.pixelStorei(32877,ke),X===0&&G.generateMipmaps&&Y.generateMipmap(Be),ye.unbindTexture()},this.initTexture=function(A){$.setTexture2D(A,0),ye.unbindTexture()},this.resetState=function(){g=0,p=0,_=null,ye.reset(),D.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}qe.prototype.isWebGLRenderer=!0;class Xh extends qe{}Xh.prototype.isWebGL1Renderer=!0;class Zr{constructor(e,t=25e-5){this.name="",this.color=new le(e),this.density=t}clone(){return new Zr(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}Zr.prototype.isFogExp2=!0;class $r{constructor(e,t=1,n=1e3){this.name="",this.color=new le(e),this.near=t,this.far=n}clone(){return new $r(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}$r.prototype.isFog=!0;class ho extends Ne{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__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()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}}ho.prototype.isScene=!0;class mi{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=zi,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Bt()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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,s=this.stride;i<s;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=Bt()),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=Bt()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}mi.prototype.isInterleavedBuffer=!0;const ot=new S;class Vn{constructor(e,t,n,i=!1){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i===!0}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++)ot.x=this.getX(t),ot.y=this.getY(t),ot.z=this.getZ(t),ot.applyMatrix4(e),this.setXYZ(t,ot.x,ot.y,ot.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ot.x=this.getX(t),ot.y=this.getY(t),ot.z=this.getZ(t),ot.applyNormalMatrix(e),this.setXYZ(t,ot.x,ot.y,ot.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ot.x=this.getX(t),ot.y=this.getY(t),ot.z=this.getZ(t),ot.transformDirection(e),this.setXYZ(t,ot.x,ot.y,ot.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,n){return e=e*this.data.stride+this.offset,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.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new ze(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 Vn(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}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}}}Vn.prototype.isInterleavedBufferAttribute=!0;class fo extends yt{constructor(e){super(),this.type="SpriteMaterial",this.color=new le(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!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}}fo.prototype.isSpriteMaterial=!0;let or;const jr=new S,ar=new S,lr=new S,cr=new W,Qr=new W,Yh=new ge,po=new S,Kr=new S,mo=new S,Jh=new W,ll=new W,Zh=new W;class go extends Ne{constructor(e){if(super(),this.type="Sprite",or===void 0){or=new ve;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 mi(t,5);or.setIndex([0,1,2,0,2,3]),or.setAttribute("position",new Vn(n,3,0,!1)),or.setAttribute("uv",new Vn(n,2,3,!1))}this.geometry=or,this.material=e!==void 0?e:new fo,this.center=new W(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ar.setFromMatrixScale(this.matrixWorld),Yh.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),lr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&ar.multiplyScalar(-lr.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const o=this.center;xo(po.set(-.5,-.5,0),lr,o,ar,i,s),xo(Kr.set(.5,-.5,0),lr,o,ar,i,s),xo(mo.set(.5,.5,0),lr,o,ar,i,s),Jh.set(0,0),ll.set(1,0),Zh.set(1,1);let a=e.ray.intersectTriangle(po,Kr,mo,!1,jr);if(a===null&&(xo(Kr.set(-.5,.5,0),lr,o,ar,i,s),ll.set(0,1),a=e.ray.intersectTriangle(po,mo,Kr,!1,jr),a===null))return;const l=e.ray.origin.distanceTo(jr);l<e.near||l>e.far||t.push({distance:l,point:jr.clone(),uv:st.getUV(jr,po,Kr,mo,Jh,ll,Zh,new W),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}go.prototype.isSprite=!0;function xo(r,e,t,n,i,s){cr.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Qr.x=s*cr.x-i*cr.y,Qr.y=i*cr.x+s*cr.y):Qr.copy(cr),r.copy(e),r.x+=Qr.x,r.y+=Qr.y,r.applyMatrix4(Yh)}const yo=new S,$h=new S;class jh extends Ne{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 s=t[n];this.addLevel(s.object.clone(),s.distance)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0){t=Math.abs(t);const n=this.levels;let i;for(i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this}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&&!(e<t[n].distance);n++);return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){yo.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(yo);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){yo.setFromMatrixPosition(e.matrixWorld),$h.setFromMatrixPosition(this.matrixWorld);const n=yo.distanceTo($h)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<s;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,s=n.length;i<s;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance})}return t}}const Qh=new S,Kh=new We,ef=new We,q0=new S,tf=new ge;class vo extends ft{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new ge,this.bindMatrixInverse=new ge}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}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 We,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const n=this.skeleton,i=this.geometry;Kh.fromBufferAttribute(i.attributes.skinIndex,e),ef.fromBufferAttribute(i.attributes.skinWeight,e),Qh.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=ef.getComponent(s);if(o!==0){const a=Kh.getComponent(s);tf.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(q0.copy(Qh).applyMatrix4(tf),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}vo.prototype.isSkinnedMesh=!0;class _o extends Ne{constructor(){super(),this.type="Bone"}}_o.prototype.isBone=!0;class gi extends ht{constructor(e=null,t=1,n=1,i,s,o,a,l,c=rt,u=rt,h,f){super(null,o,a,l,c,u,i,s,h,f),this.image={data:e,width:t,height:n},this.magFilter=c,this.minFilter=u,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}gi.prototype.isDataTexture=!0;const nf=new ge,X0=new ge;class Mo{constructor(e=[],t=[]){this.uuid=Bt(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,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 ge)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new ge;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 s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:X0;nf.multiplyMatrices(a,t[s]),nf.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Mo(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Ou(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new gi(t,e,e,ut,en);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,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 s=e.bones[n];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new _o),this.bones.push(o),this.boneInverses.push(new ge().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const o=t[i];e.bones.push(o.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class xi extends ze{constructor(e,t,n,i=1){typeof n=="number"&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,n),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}}xi.prototype.isInstancedBufferAttribute=!0;const rf=new ge,sf=new ge,bo=[],es=new ft;class cl extends ft{constructor(e,t,n){super(e,t),this.instanceMatrix=new xi(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const n=this.matrixWorld,i=this.count;if(es.geometry=this.geometry,es.material=this.material,es.material!==void 0)for(let s=0;s<i;s++){this.getMatrixAt(s,rf),sf.multiplyMatrices(n,rf),es.matrixWorld=sf,es.raycast(e,bo);for(let o=0,a=bo.length;o<a;o++){const l=bo[o];l.instanceId=s,l.object=this,t.push(l)}bo.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new xi(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}cl.prototype.isInstancedMesh=!0;class Mt extends yt{constructor(e){super(),this.type="LineBasicMaterial",this.color=new le(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this}}Mt.prototype.isLineBasicMaterial=!0;const of=new S,af=new S,lf=new ge,ul=new Bn,wo=new Dn;class wn extends Ne{constructor(e=new ve,t=new Mt){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)of.fromBufferAttribute(t,i-1),af.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=of.distanceTo(af);e.setAttribute("lineDistance",new de(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),wo.copy(n.boundingSphere),wo.applyMatrix4(i),wo.radius+=s,e.ray.intersectsSphere(wo)===!1)return;lf.copy(i).invert(),ul.copy(e.ray).applyMatrix4(lf);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new S,u=new S,h=new S,f=new S,d=this.isLineSegments?2:1;if(n.isBufferGeometry){const m=n.index,v=n.attributes.position;if(m!==null){const g=Math.max(0,o.start),p=Math.min(m.count,o.start+o.count);for(let _=g,y=p-1;_<y;_+=d){const M=m.getX(_),b=m.getX(_+1);if(c.fromBufferAttribute(v,M),u.fromBufferAttribute(v,b),ul.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);const P=e.ray.origin.distanceTo(f);P<e.near||P>e.far||t.push({distance:P,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),p=Math.min(v.count,o.start+o.count);for(let _=g,y=p-1;_<y;_+=d){if(c.fromBufferAttribute(v,_),u.fromBufferAttribute(v,_+1),ul.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(f);b<e.near||b>e.far||t.push({distance:b,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}wn.prototype.isLine=!0;const cf=new S,uf=new S;class Dt extends wn{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)cf.fromBufferAttribute(t,i),uf.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+cf.distanceTo(uf);e.setAttribute("lineDistance",new de(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}Dt.prototype.isLineSegments=!0;class hl extends wn{constructor(e,t){super(e,t),this.type="LineLoop"}}hl.prototype.isLineLoop=!0;class yi extends yt{constructor(e){super(),this.type="PointsMaterial",this.color=new le(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!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}}yi.prototype.isPointsMaterial=!0;const hf=new ge,fl=new Bn,So=new Dn,To=new S;class ts extends Ne{constructor(e=new ve,t=new yi){super(),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),So.copy(n.boundingSphere),So.applyMatrix4(i),So.radius+=s,e.ray.intersectsSphere(So)===!1)return;hf.copy(i).invert(),fl.copy(e.ray).applyMatrix4(hf);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a;if(n.isBufferGeometry){const c=n.index,h=n.attributes.position;if(c!==null){const f=Math.max(0,o.start),d=Math.min(c.count,o.start+o.count);for(let m=f,x=d;m<x;m++){const v=c.getX(m);To.fromBufferAttribute(h,v),ff(To,v,l,i,e,t,this)}}else{const f=Math.max(0,o.start),d=Math.min(h.count,o.start+o.count);for(let m=f,x=d;m<x;m++)To.fromBufferAttribute(h,m),ff(To,m,l,i,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}ts.prototype.isPoints=!0;function ff(r,e,t,n,i,s,o){const a=fl.distanceSqToPoint(r);if(a<t){const l=new S;fl.closestPointToPoint(r,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class df extends ht{constructor(e,t,n,i,s,o,a,l,c){super(e,t,n,i,s,o,a,l,c),this.format=a!==void 0?a:Cn,this.minFilter=o!==void 0?o:Ke,this.magFilter=s!==void 0?s:Ke,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)}}df.prototype.isVideoTexture=!0;class pf extends ht{constructor(e,t,n){super({width:e,height:t}),this.format=n,this.magFilter=rt,this.minFilter=rt,this.generateMipmaps=!1,this.needsUpdate=!0}}pf.prototype.isFramebufferTexture=!0;class dl extends ht{constructor(e,t,n,i,s,o,a,l,c,u,h,f){super(null,o,a,l,c,u,i,s,h,f),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}dl.prototype.isCompressedTexture=!0;class mf extends ht{constructor(e,t,n,i,s,o,a,l,c){super(e,t,n,i,s,o,a,l,c),this.needsUpdate=!0}}mf.prototype.isCanvasTexture=!0;class ur extends ve{constructor(e=1,t=8,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 s=[],o=[],a=[],l=[],c=new S,u=new W;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let h=0,f=3;h<=t;h++,f+=3){const d=n+h/t*i;c.x=e*Math.cos(d),c.y=e*Math.sin(d),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[f]/e+1)/2,u.y=(o[f+1]/e+1)/2,l.push(u.x,u.y)}for(let h=1;h<=t;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new de(o,3)),this.setAttribute("normal",new de(a,3)),this.setAttribute("uv",new de(l,2))}static fromJSON(e){return new ur(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class kn extends ve{constructor(e=1,t=1,n=1,i=8,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const u=[],h=[],f=[],d=[];let m=0;const x=[],v=n/2;let g=0;p(),o===!1&&(e>0&&_(!0),t>0&&_(!1)),this.setIndex(u),this.setAttribute("position",new de(h,3)),this.setAttribute("normal",new de(f,3)),this.setAttribute("uv",new de(d,2));function p(){const y=new S,M=new S;let b=0;const E=(t-e)/n;for(let P=0;P<=s;P++){const z=[],N=P/s,I=N*(t-e)+e;for(let w=0;w<=i;w++){const T=w/i,B=T*l+a,L=Math.sin(B),F=Math.cos(B);M.x=I*L,M.y=-N*n+v,M.z=I*F,h.push(M.x,M.y,M.z),y.set(L,E,F).normalize(),f.push(y.x,y.y,y.z),d.push(T,1-N),z.push(m++)}x.push(z)}for(let P=0;P<i;P++)for(let z=0;z<s;z++){const N=x[z][P],I=x[z+1][P],w=x[z+1][P+1],T=x[z][P+1];u.push(N,I,T),u.push(I,w,T),b+=6}c.addGroup(g,b,0),g+=b}function _(y){const M=m,b=new W,E=new S;let P=0;const z=y===!0?e:t,N=y===!0?1:-1;for(let w=1;w<=i;w++)h.push(0,v*N,0),f.push(0,N,0),d.push(.5,.5),m++;const I=m;for(let w=0;w<=i;w++){const B=w/i*l+a,L=Math.cos(B),F=Math.sin(B);E.x=z*F,E.y=v*N,E.z=z*L,h.push(E.x,E.y,E.z),f.push(0,N,0),b.x=L*.5+.5,b.y=F*.5*N+.5,d.push(b.x,b.y),m++}for(let w=0;w<i;w++){const T=M+w,B=I+w;y===!0?u.push(B,B+1,T):u.push(B+1,B,T),P+=3}c.addGroup(g,P,y===!0?1:2),g+=P}}static fromJSON(e){return new kn(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class hr extends kn{constructor(e=1,t=1,n=8,i=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,n,i,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new hr(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class rn extends ve{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],o=[];a(i),c(n),u(),this.setAttribute("position",new de(s,3)),this.setAttribute("normal",new de(s.slice(),3)),this.setAttribute("uv",new de(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(p){const _=new S,y=new S,M=new S;for(let b=0;b<t.length;b+=3)d(t[b+0],_),d(t[b+1],y),d(t[b+2],M),l(_,y,M,p)}function l(p,_,y,M){const b=M+1,E=[];for(let P=0;P<=b;P++){E[P]=[];const z=p.clone().lerp(y,P/b),N=_.clone().lerp(y,P/b),I=b-P;for(let w=0;w<=I;w++)w===0&&P===b?E[P][w]=z:E[P][w]=z.clone().lerp(N,w/I)}for(let P=0;P<b;P++)for(let z=0;z<2*(b-P)-1;z++){const N=Math.floor(z/2);z%2===0?(f(E[P][N+1]),f(E[P+1][N]),f(E[P][N])):(f(E[P][N+1]),f(E[P+1][N+1]),f(E[P+1][N]))}}function c(p){const _=new S;for(let y=0;y<s.length;y+=3)_.x=s[y+0],_.y=s[y+1],_.z=s[y+2],_.normalize().multiplyScalar(p),s[y+0]=_.x,s[y+1]=_.y,s[y+2]=_.z}function u(){const p=new S;for(let _=0;_<s.length;_+=3){p.x=s[_+0],p.y=s[_+1],p.z=s[_+2];const y=v(p)/2/Math.PI+.5,M=g(p)/Math.PI+.5;o.push(y,1-M)}m(),h()}function h(){for(let p=0;p<o.length;p+=6){const _=o[p+0],y=o[p+2],M=o[p+4],b=Math.max(_,y,M),E=Math.min(_,y,M);b>.9&&E<.1&&(_<.2&&(o[p+0]+=1),y<.2&&(o[p+2]+=1),M<.2&&(o[p+4]+=1))}}function f(p){s.push(p.x,p.y,p.z)}function d(p,_){const y=p*3;_.x=e[y+0],_.y=e[y+1],_.z=e[y+2]}function m(){const p=new S,_=new S,y=new S,M=new S,b=new W,E=new W,P=new W;for(let z=0,N=0;z<s.length;z+=9,N+=6){p.set(s[z+0],s[z+1],s[z+2]),_.set(s[z+3],s[z+4],s[z+5]),y.set(s[z+6],s[z+7],s[z+8]),b.set(o[N+0],o[N+1]),E.set(o[N+2],o[N+3]),P.set(o[N+4],o[N+5]),M.copy(p).add(_).add(y).divideScalar(3);const I=v(M);x(b,N+0,p,I),x(E,N+2,_,I),x(P,N+4,y,I)}}function x(p,_,y,M){M<0&&p.x===1&&(o[_]=p.x-1),y.x===0&&y.z===0&&(o[_]=M/2/Math.PI+.5)}function v(p){return Math.atan2(p.z,-p.x)}function g(p){return Math.atan2(-p.y,Math.sqrt(p.x*p.x+p.z*p.z))}}static fromJSON(e){return new rn(e.vertices,e.indices,e.radius,e.details)}}class fr extends rn{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-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(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new fr(e.radius,e.detail)}}const Eo=new S,Ao=new S,pl=new S,Co=new st;class ml extends ve{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(oi*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],u=["a","b","c"],h=new Array(3),f={},d=[];for(let m=0;m<l;m+=3){o?(c[0]=o.getX(m),c[1]=o.getX(m+1),c[2]=o.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:x,b:v,c:g}=Co;if(x.fromBufferAttribute(a,c[0]),v.fromBufferAttribute(a,c[1]),g.fromBufferAttribute(a,c[2]),Co.getNormal(pl),h[0]=`${Math.round(x.x*i)},${Math.round(x.y*i)},${Math.round(x.z*i)}`,h[1]=`${Math.round(v.x*i)},${Math.round(v.y*i)},${Math.round(v.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 p=0;p<3;p++){const _=(p+1)%3,y=h[p],M=h[_],b=Co[u[p]],E=Co[u[_]],P=`${y}_${M}`,z=`${M}_${y}`;z in f&&f[z]?(pl.dot(f[z].normal)<=s&&(d.push(b.x,b.y,b.z),d.push(E.x,E.y,E.z)),f[z]=null):P in f||(f[P]={index0:c[p],index1:c[_],normal:pl.clone()})}}for(const m in f)if(f[m]){const{index0:x,index1:v}=f[m];Eo.fromBufferAttribute(a,x),Ao.fromBufferAttribute(a,v),d.push(Eo.x,Eo.y,Eo.z),d.push(Ao.x,Ao.y,Ao.z)}this.setAttribute("position",new de(d,3))}}}class Ot{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),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=n[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===o)return i/(s-1);const u=n[i],f=n[i+1]-u,d=(o-u)/f;return(i+d)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new W:new S);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new S,i=[],s=[],o=[],a=new S,l=new ge;for(let d=0;d<=e;d++){const m=d/e;i[d]=this.getTangentAt(m,new S)}s[0]=new S,o[0]=new S;let c=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),f=Math.abs(i[0].z);u<=c&&(c=u,n.set(1,0,0)),h<=c&&(c=h,n.set(0,1,0)),f<=c&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(St(i[d-1].dot(i[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(a,m))}o[d].crossVectors(i[d],s[d])}if(t===!0){let d=Math.acos(St(s[0].dot(s[e]),-1,1));d/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(i[m],d*m)),o[m].crossVectors(i[m],s[m])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class ns extends Ot{constructor(e=0,t=0,n=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const n=t||new W,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),f=l-this.aX,d=c-this.aY;l=f*u-d*h+this.aX,c=f*h+d*u+this.aY}return n.set(l,c)}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}}ns.prototype.isEllipseCurve=!0;class gl extends ns{constructor(e,t,n,i,s,o){super(e,t,n,n,i,s,o),this.type="ArcCurve"}}gl.prototype.isArcCurve=!0;function xl(){let r=0,e=0,t=0,n=0;function i(s,o,a,l){r=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){i(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,h){let f=(o-s)/c-(a-s)/(c+u)+(a-o)/u,d=(a-o)/u-(l-o)/(u+h)+(l-a)/h;f*=u,d*=u,i(o,a,f,d)},calc:function(s){const o=s*s,a=o*s;return r+e*s+t*o+n*a}}}const Lo=new S,yl=new xl,vl=new xl,_l=new xl;class Ml extends Ot{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new S){const n=t,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=i[(a-1)%s]:(Lo.subVectors(i[0],i[1]).add(i[0]),c=Lo);const h=i[a%s],f=i[(a+1)%s];if(this.closed||a+2<s?u=i[(a+2)%s]:(Lo.subVectors(i[s-1],i[s-2]).add(i[s-1]),u=Lo),this.curveType==="centripetal"||this.curveType==="chordal"){const d=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(h),d),x=Math.pow(h.distanceToSquared(f),d),v=Math.pow(f.distanceToSquared(u),d);x<1e-4&&(x=1),m<1e-4&&(m=x),v<1e-4&&(v=x),yl.initNonuniformCatmullRom(c.x,h.x,f.x,u.x,m,x,v),vl.initNonuniformCatmullRom(c.y,h.y,f.y,u.y,m,x,v),_l.initNonuniformCatmullRom(c.z,h.z,f.z,u.z,m,x,v)}else this.curveType==="catmullrom"&&(yl.initCatmullRom(c.x,h.x,f.x,u.x,this.tension),vl.initCatmullRom(c.y,h.y,f.y,u.y,this.tension),_l.initCatmullRom(c.z,h.z,f.z,u.z,this.tension));return n.set(yl.calc(l),vl.calc(l),_l.calc(l)),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 S().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}Ml.prototype.isCatmullRomCurve3=!0;function gf(r,e,t,n,i){const s=(n-e)*.5,o=(i-t)*.5,a=r*r,l=r*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*r+t}function Y0(r,e){const t=1-r;return t*t*e}function J0(r,e){return 2*(1-r)*r*e}function Z0(r,e){return r*r*e}function is(r,e,t,n){return Y0(r,e)+J0(r,t)+Z0(r,n)}function $0(r,e){const t=1-r;return t*t*t*e}function j0(r,e){const t=1-r;return 3*t*t*r*e}function Q0(r,e){return 3*(1-r)*r*r*e}function K0(r,e){return r*r*r*e}function rs(r,e,t,n,i){return $0(r,e)+j0(r,t)+Q0(r,n)+K0(r,i)}class Ro extends Ot{constructor(e=new W,t=new W,n=new W,i=new W){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new W){const n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(rs(e,i.x,s.x,o.x,a.x),rs(e,i.y,s.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}}Ro.prototype.isCubicBezierCurve=!0;class bl extends Ot{constructor(e=new S,t=new S,n=new S,i=new S){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new S){const n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(rs(e,i.x,s.x,o.x,a.x),rs(e,i.y,s.y,o.y,a.y),rs(e,i.z,s.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}}bl.prototype.isCubicBezierCurve3=!0;class ss extends Ot{constructor(e=new W,t=new W){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new W){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){const n=t||new W;return n.copy(this.v2).sub(this.v1).normalize(),n}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}}ss.prototype.isLineCurve=!0;class xf extends Ot{constructor(e=new S,t=new S){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new S){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)}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 Po extends Ot{constructor(e=new W,t=new W,n=new W){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new W){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(is(e,i.x,s.x,o.x),is(e,i.y,s.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}}Po.prototype.isQuadraticBezierCurve=!0;class Io extends Ot{constructor(e=new S,t=new S,n=new S){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new S){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(is(e,i.x,s.x,o.x),is(e,i.y,s.y,o.y),is(e,i.z,s.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}}Io.prototype.isQuadraticBezierCurve3=!0;class Do extends Ot{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new W){const n=t,i=this.points,s=(i.length-1)*e,o=Math.floor(s),a=s-o,l=i[o===0?o:o-1],c=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(gf(a,l.x,c.x,u.x,h.x),gf(a,l.y,c.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 W().fromArray(i))}return this}}Do.prototype.isSplineCurve=!0;var wl=Object.freeze({__proto__:null,ArcCurve:gl,CatmullRomCurve3:Ml,CubicBezierCurve:Ro,CubicBezierCurve3:bl,EllipseCurve:ns,LineCurve:ss,LineCurve3:xf,QuadraticBezierCurve:Po,QuadraticBezierCurve3:Io,SplineCurve:Do});class yf extends Ot{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);e.equals(t)||this.curves.push(new ss(t,e))}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const o=i[s]-n,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}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,s=this.curves;i<s.length;i++){const o=s[i],a=o&&o.isEllipseCurve?e*2:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const u=l[c];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 wl[i.type]().fromJSON(i))}return this}}class os extends yf{constructor(e){super(),this.type="Path",this.currentPoint=new W,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 ss(this.currentPoint.clone(),new W(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new Po(this.currentPoint.clone(),new W(e,t),new W(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,o){const a=new Ro(this.currentPoint.clone(),new W(e,t),new W(n,i),new W(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Do(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,i,s,o),this}absarc(e,t,n,i,s,o){return this.absellipse(e,t,n,n,i,s,o),this}ellipse(e,t,n,i,s,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,i,s,o,a,l),this}absellipse(e,t,n,i,s,o,a,l){const c=new ns(e,t,n,i,s,o,a,l);if(this.curves.length>0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.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 Jt extends os{constructor(e){super(e),this.uuid=Bt(),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 os().fromJSON(i))}return this}}const ey={triangulate:function(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=vf(r,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,h,f,d;if(n&&(s=sy(r,e,s,t)),r.length>80*t){a=c=r[0],l=u=r[1];for(let m=t;m<i;m+=t)h=r[m],f=r[m+1],h<a&&(a=h),f<l&&(l=f),h>c&&(c=h),f>u&&(u=f);d=Math.max(c-a,u-l),d=d!==0?1/d:0}return as(s,o,t,a,l,d),o}};function vf(r,e,t,n,i){let s,o;if(i===gy(r,e,t,n)>0)for(s=e;s<t;s+=n)o=bf(s,r[s],r[s+1],o);else for(s=t-n;s>=e;s-=n)o=bf(s,r[s],r[s+1],o);return o&&Fo(o,o.next)&&(cs(o),o=o.next),o}function Wn(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(Fo(t,t.next)||Qe(t.prev,t,t.next)===0)){if(cs(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function as(r,e,t,n,i,s,o){if(!r)return;!o&&s&&uy(r,n,i,s);let a=r,l,c;for(;r.prev!==r.next;){if(l=r.prev,c=r.next,s?ny(r,n,i,s):ty(r)){e.push(l.i/t),e.push(r.i/t),e.push(c.i/t),cs(r),r=c.next,a=c.next;continue}if(r=c,r===a){o?o===1?(r=iy(Wn(r),e,t),as(r,e,t,n,i,s,2)):o===2&&ry(r,e,t,n,i,s):as(Wn(r),e,t,n,i,s,1);break}}}function ty(r){const e=r.prev,t=r,n=r.next;if(Qe(e,t,n)>=0)return!1;let i=r.next.next;for(;i!==r.prev;){if(dr(e.x,e.y,t.x,t.y,n.x,n.y,i.x,i.y)&&Qe(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function ny(r,e,t,n){const i=r.prev,s=r,o=r.next;if(Qe(i,s,o)>=0)return!1;const a=i.x<s.x?i.x<o.x?i.x:o.x:s.x<o.x?s.x:o.x,l=i.y<s.y?i.y<o.y?i.y:o.y:s.y<o.y?s.y:o.y,c=i.x>s.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,u=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,h=Sl(a,l,e,t,n),f=Sl(c,u,e,t,n);let d=r.prevZ,m=r.nextZ;for(;d&&d.z>=h&&m&&m.z<=f;){if(d!==r.prev&&d!==r.next&&dr(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&Qe(d.prev,d,d.next)>=0||(d=d.prevZ,m!==r.prev&&m!==r.next&&dr(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&Qe(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;d&&d.z>=h;){if(d!==r.prev&&d!==r.next&&dr(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&Qe(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=f;){if(m!==r.prev&&m!==r.next&&dr(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&Qe(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function iy(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!Fo(i,s)&&_f(i,n,n.next,s)&&ls(i,s)&&ls(s,i)&&(e.push(i.i/t),e.push(n.i/t),e.push(s.i/t),cs(n),cs(n.next),n=r=s),n=n.next}while(n!==r);return Wn(n)}function ry(r,e,t,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&dy(o,a)){let l=Mf(o,a);o=Wn(o,o.next),l=Wn(l,l.next),as(o,e,t,n,i,s),as(l,e,t,n,i,s);return}a=a.next}o=o.next}while(o!==r)}function sy(r,e,t,n){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*n,l=s<o-1?e[s+1]*n:r.length,c=vf(r,a,l,n,!1),c===c.next&&(c.steiner=!0),i.push(fy(c));for(i.sort(oy),s=0;s<i.length;s++)ay(i[s],t),t=Wn(t,t.next);return t}function oy(r,e){return r.x-e.x}function ay(r,e){if(e=ly(r,e),e){const t=Mf(e,r);Wn(e,e.next),Wn(t,t.next)}}function ly(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,o;do{if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const f=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s){if(s=f,f===n){if(i===t.y)return t;if(i===t.next.y)return t.next}o=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!o)return null;if(n===s)return o;const a=o,l=o.x,c=o.y;let u=1/0,h;t=o;do n>=t.x&&t.x>=l&&n!==t.x&&dr(i<c?n:s,i,l,c,i<c?s:n,i,t.x,t.y)&&(h=Math.abs(i-t.y)/(n-t.x),ls(t,r)&&(h<u||h===u&&(t.x>o.x||t.x===o.x&&cy(o,t)))&&(o=t,u=h)),t=t.next;while(t!==a);return o}function cy(r,e){return Qe(r.prev,r,e.prev)<0&&Qe(e.next,r,r.next)<0}function uy(r,e,t,n){let i=r;do i.z===null&&(i.z=Sl(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,hy(i)}function hy(r){let e,t,n,i,s,o,a,l,c=1;do{for(t=r,r=null,s=null,o=0;t;){for(o++,n=t,a=0,e=0;e<c&&(a++,n=n.nextZ,!!n);e++);for(l=c;a>0||l>0&&n;)a!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,c*=2}while(o>1);return r}function Sl(r,e,t,n,i){return r=32767*(r-t)*i,e=32767*(e-n)*i,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function fy(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function dr(r,e,t,n,i,s,o,a){return(i-o)*(e-a)-(r-o)*(s-a)>=0&&(r-o)*(n-a)-(t-o)*(e-a)>=0&&(t-o)*(s-a)-(i-o)*(n-a)>=0}function dy(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!py(r,e)&&(ls(r,e)&&ls(e,r)&&my(r,e)&&(Qe(r.prev,r,e.prev)||Qe(r,e.prev,e))||Fo(r,e)&&Qe(r.prev,r,r.next)>0&&Qe(e.prev,e,e.next)>0)}function Qe(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Fo(r,e){return r.x===e.x&&r.y===e.y}function _f(r,e,t,n){const i=No(Qe(r,e,t)),s=No(Qe(r,e,n)),o=No(Qe(t,n,r)),a=No(Qe(t,n,e));return!!(i!==s&&o!==a||i===0&&Bo(r,t,e)||s===0&&Bo(r,n,e)||o===0&&Bo(t,r,n)||a===0&&Bo(t,e,n))}function Bo(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function No(r){return r>0?1:r<0?-1:0}function py(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&_f(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function ls(r,e){return Qe(r.prev,r,r.next)<0?Qe(r,e,r.next)>=0&&Qe(r,r.prev,e)>=0:Qe(r,e,r.prev)<0||Qe(r,r.next,e)<0}function my(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function Mf(r,e){const t=new Tl(r.i,r.x,r.y),n=new Tl(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function bf(r,e,t,n){const i=new Tl(r,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 cs(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Tl(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function gy(r,e,t,n){let i=0;for(let s=e,o=t-n;s<t;s+=n)i+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=s;return i}class sn{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return sn.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];wf(e),Sf(n,e);let o=e.length;t.forEach(wf);for(let l=0;l<t.length;l++)i.push(o),o+=t[l].length,Sf(n,t[l]);const a=ey.triangulate(n,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function wf(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function Sf(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class on extends ve{constructor(e=new Jt([new W(.5,.5),new W(-.5,.5),new W(-.5,-.5),new W(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new de(i,3)),this.setAttribute("uv",new de(s,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1;let h=t.depth!==void 0?t.depth:1,f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,m=t.bevelSize!==void 0?t.bevelSize:d-.1,x=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,p=t.UVGenerator!==void 0?t.UVGenerator:xy;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),h=t.amount);let _,y=!1,M,b,E,P;g&&(_=g.getSpacedPoints(u),y=!0,f=!1,M=g.computeFrenetFrames(u,!1),b=new S,E=new S,P=new S),f||(v=0,d=0,m=0,x=0);const z=a.extractPoints(c);let N=z.shape;const I=z.holes;if(!sn.isClockWise(N)){N=N.reverse();for(let k=0,$=I.length;k<$;k++){const ie=I[k];sn.isClockWise(ie)&&(I[k]=ie.reverse())}}const T=sn.triangulateShape(N,I),B=N;for(let k=0,$=I.length;k<$;k++){const ie=I[k];N=N.concat(ie)}function L(k,$,ie){return $||console.error("THREE.ExtrudeGeometry: vec does not exist"),$.clone().multiplyScalar(ie).add(k)}const F=N.length,U=T.length;function Z(k,$,ie){let fe,ce,Ee;const Ae=k.x-$.x,De=k.y-$.y,je=ie.x-k.x,R=ie.y-k.y,C=Ae*Ae+De*De,J=Ae*R-De*je;if(Math.abs(J)>Number.EPSILON){const Q=Math.sqrt(C),ae=Math.sqrt(je*je+R*R),j=$.x-De/Q,we=$.y+Ae/Q,_e=ie.x-R/ae,se=ie.y+je/ae,D=((_e-j)*R-(se-we)*je)/(Ae*R-De*je);fe=j+Ae*D-k.x,ce=we+De*D-k.y;const re=fe*fe+ce*ce;if(re<=2)return new W(fe,ce);Ee=Math.sqrt(re/2)}else{let Q=!1;Ae>Number.EPSILON?je>Number.EPSILON&&(Q=!0):Ae<-Number.EPSILON?je<-Number.EPSILON&&(Q=!0):Math.sign(De)===Math.sign(R)&&(Q=!0),Q?(fe=-De,ce=Ae,Ee=Math.sqrt(C)):(fe=Ae,ce=De,Ee=Math.sqrt(C/2))}return new W(fe/Ee,ce/Ee)}const ee=[];for(let k=0,$=B.length,ie=$-1,fe=k+1;k<$;k++,ie++,fe++)ie===$&&(ie=0),fe===$&&(fe=0),ee[k]=Z(B[k],B[ie],B[fe]);const V=[];let q,ne=ee.concat();for(let k=0,$=I.length;k<$;k++){const ie=I[k];q=[];for(let fe=0,ce=ie.length,Ee=ce-1,Ae=fe+1;fe<ce;fe++,Ee++,Ae++)Ee===ce&&(Ee=0),Ae===ce&&(Ae=0),q[fe]=Z(ie[fe],ie[Ee],ie[Ae]);V.push(q),ne=ne.concat(q)}for(let k=0;k<v;k++){const $=k/v,ie=d*Math.cos($*Math.PI/2),fe=m*Math.sin($*Math.PI/2)+x;for(let ce=0,Ee=B.length;ce<Ee;ce++){const Ae=L(B[ce],ee[ce],fe);be(Ae.x,Ae.y,-ie)}for(let ce=0,Ee=I.length;ce<Ee;ce++){const Ae=I[ce];q=V[ce];for(let De=0,je=Ae.length;De<je;De++){const R=L(Ae[De],q[De],fe);be(R.x,R.y,-ie)}}}const K=m+x;for(let k=0;k<F;k++){const $=f?L(N[k],ne[k],K):N[k];y?(E.copy(M.normals[0]).multiplyScalar($.x),b.copy(M.binormals[0]).multiplyScalar($.y),P.copy(_[0]).add(E).add(b),be(P.x,P.y,P.z)):be($.x,$.y,0)}for(let k=1;k<=u;k++)for(let $=0;$<F;$++){const ie=f?L(N[$],ne[$],K):N[$];y?(E.copy(M.normals[k]).multiplyScalar(ie.x),b.copy(M.binormals[k]).multiplyScalar(ie.y),P.copy(_[k]).add(E).add(b),be(P.x,P.y,P.z)):be(ie.x,ie.y,h/u*k)}for(let k=v-1;k>=0;k--){const $=k/v,ie=d*Math.cos($*Math.PI/2),fe=m*Math.sin($*Math.PI/2)+x;for(let ce=0,Ee=B.length;ce<Ee;ce++){const Ae=L(B[ce],ee[ce],fe);be(Ae.x,Ae.y,h+ie)}for(let ce=0,Ee=I.length;ce<Ee;ce++){const Ae=I[ce];q=V[ce];for(let De=0,je=Ae.length;De<je;De++){const R=L(Ae[De],q[De],fe);y?be(R.x,R.y+_[u-1].y,_[u-1].x+ie):be(R.x,R.y,h+ie)}}}he(),Me();function he(){const k=i.length/3;if(f){let $=0,ie=F*$;for(let fe=0;fe<U;fe++){const ce=T[fe];pe(ce[2]+ie,ce[1]+ie,ce[0]+ie)}$=u+v*2,ie=F*$;for(let fe=0;fe<U;fe++){const ce=T[fe];pe(ce[0]+ie,ce[1]+ie,ce[2]+ie)}}else{for(let $=0;$<U;$++){const ie=T[$];pe(ie[2],ie[1],ie[0])}for(let $=0;$<U;$++){const ie=T[$];pe(ie[0]+F*u,ie[1]+F*u,ie[2]+F*u)}}n.addGroup(k,i.length/3-k,0)}function Me(){const k=i.length/3;let $=0;Y(B,$),$+=B.length;for(let ie=0,fe=I.length;ie<fe;ie++){const ce=I[ie];Y(ce,$),$+=ce.length}n.addGroup(k,i.length/3-k,1)}function Y(k,$){let ie=k.length;for(;--ie>=0;){const fe=ie;let ce=ie-1;ce<0&&(ce=k.length-1);for(let Ee=0,Ae=u+v*2;Ee<Ae;Ee++){const De=F*Ee,je=F*(Ee+1),R=$+fe+De,C=$+ce+De,J=$+ce+je,Q=$+fe+je;me(R,C,J,Q)}}}function be(k,$,ie){l.push(k),l.push($),l.push(ie)}function pe(k,$,ie){ye(k),ye($),ye(ie);const fe=i.length/3,ce=p.generateTopUV(n,i,fe-3,fe-2,fe-1);Oe(ce[0]),Oe(ce[1]),Oe(ce[2])}function me(k,$,ie,fe){ye(k),ye($),ye(fe),ye($),ye(ie),ye(fe);const ce=i.length/3,Ee=p.generateSideWallUV(n,i,ce-6,ce-3,ce-2,ce-1);Oe(Ee[0]),Oe(Ee[1]),Oe(Ee[3]),Oe(Ee[1]),Oe(Ee[2]),Oe(Ee[3])}function ye(k){i.push(l[k*3+0]),i.push(l[k*3+1]),i.push(l[k*3+2])}function Oe(k){s.push(k.x),s.push(k.y)}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return yy(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];n.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new wl[i.type]().fromJSON(i)),new on(n,e.options)}}const xy={generateTopUV:function(r,e,t,n,i){const s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[i*3],u=e[i*3+1];return[new W(s,o),new W(a,l),new W(c,u)]},generateSideWallUV:function(r,e,t,n,i,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],h=e[n*3+2],f=e[i*3],d=e[i*3+1],m=e[i*3+2],x=e[s*3],v=e[s*3+1],g=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new W(o,1-l),new W(c,1-h),new W(f,1-m),new W(x,1-g)]:[new W(a,1-l),new W(u,1-h),new W(d,1-m),new W(v,1-g)]}};function yy(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class pr extends rn{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],s=[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,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new pr(e.radius,e.detail)}}class mr extends ve{constructor(e=[new W(0,.5),new W(.5,0),new W(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=St(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,h=new S,f=new W,d=new S,m=new S,x=new S;let v=0,g=0;for(let p=0;p<=e.length-1;p++)switch(p){case 0:v=e[p+1].x-e[p].x,g=e[p+1].y-e[p].y,d.x=g*1,d.y=-v,d.z=g*0,x.copy(d),d.normalize(),l.push(d.x,d.y,d.z);break;case e.length-1:l.push(x.x,x.y,x.z);break;default:v=e[p+1].x-e[p].x,g=e[p+1].y-e[p].y,d.x=g*1,d.y=-v,d.z=g*0,m.copy(d),d.x+=x.x,d.y+=x.y,d.z+=x.z,d.normalize(),l.push(d.x,d.y,d.z),x.copy(m)}for(let p=0;p<=t;p++){const _=n+p*u*i,y=Math.sin(_),M=Math.cos(_);for(let b=0;b<=e.length-1;b++){h.x=e[b].x*y,h.y=e[b].y,h.z=e[b].x*M,o.push(h.x,h.y,h.z),f.x=p/t,f.y=b/(e.length-1),a.push(f.x,f.y);const E=l[3*b+0]*y,P=l[3*b+1],z=l[3*b+0]*M;c.push(E,P,z)}}for(let p=0;p<t;p++)for(let _=0;_<e.length-1;_++){const y=_+p*e.length,M=y,b=y+e.length,E=y+e.length+1,P=y+1;s.push(M,b,P),s.push(b,E,P)}this.setIndex(s),this.setAttribute("position",new de(o,3)),this.setAttribute("uv",new de(a,2)),this.setAttribute("normal",new de(c,3))}static fromJSON(e){return new mr(e.points,e.segments,e.phiStart,e.phiLength)}}class vi extends rn{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 vi(e.radius,e.detail)}}class gr extends ve{constructor(e=.5,t=1,n=8,i=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const a=[],l=[],c=[],u=[];let h=e;const f=(t-e)/i,d=new S,m=new W;for(let x=0;x<=i;x++){for(let v=0;v<=n;v++){const g=s+v/n*o;d.x=h*Math.cos(g),d.y=h*Math.sin(g),l.push(d.x,d.y,d.z),c.push(0,0,1),m.x=(d.x/t+1)/2,m.y=(d.y/t+1)/2,u.push(m.x,m.y)}h+=f}for(let x=0;x<i;x++){const v=x*(n+1);for(let g=0;g<n;g++){const p=g+v,_=p,y=p+n+1,M=p+n+2,b=p+1;a.push(_,y,b),a.push(y,M,b)}}this.setIndex(a),this.setAttribute("position",new de(l,3)),this.setAttribute("normal",new de(c,3)),this.setAttribute("uv",new de(u,2))}static fromJSON(e){return new gr(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class _i extends ve{constructor(e=new Jt([new W(0,.5),new W(-.5,-.5),new W(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(n),this.setAttribute("position",new de(i,3)),this.setAttribute("normal",new de(s,3)),this.setAttribute("uv",new de(o,2));function c(u){const h=i.length/3,f=u.extractPoints(t);let d=f.shape;const m=f.holes;sn.isClockWise(d)===!1&&(d=d.reverse());for(let v=0,g=m.length;v<g;v++){const p=m[v];sn.isClockWise(p)===!0&&(m[v]=p.reverse())}const x=sn.triangulateShape(d,m);for(let v=0,g=m.length;v<g;v++){const p=m[v];d=d.concat(p)}for(let v=0,g=d.length;v<g;v++){const p=d[v];i.push(p.x,p.y,0),s.push(0,0,1),o.push(p.x,p.y)}for(let v=0,g=x.length;v<g;v++){const p=x[v],_=p[0]+h,y=p[1]+h,M=p[2]+h;n.push(_,y,M),l+=3}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return vy(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=t[e.shapes[i]];n.push(o)}return new _i(n,e.curveSegments)}}function vy(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class Mi extends ve{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(o+a,Math.PI);let c=0;const u=[],h=new S,f=new S,d=[],m=[],x=[],v=[];for(let g=0;g<=n;g++){const p=[],_=g/n;let y=0;g==0&&o==0?y=.5/t:g==n&&l==Math.PI&&(y=-.5/t);for(let M=0;M<=t;M++){const b=M/t;h.x=-e*Math.cos(i+b*s)*Math.sin(o+_*a),h.y=e*Math.cos(o+_*a),h.z=e*Math.sin(i+b*s)*Math.sin(o+_*a),m.push(h.x,h.y,h.z),f.copy(h).normalize(),x.push(f.x,f.y,f.z),v.push(b+y,1-_),p.push(c++)}u.push(p)}for(let g=0;g<n;g++)for(let p=0;p<t;p++){const _=u[g][p+1],y=u[g][p],M=u[g+1][p],b=u[g+1][p+1];(g!==0||o>0)&&d.push(_,y,b),(g!==n-1||l<Math.PI)&&d.push(y,M,b)}this.setIndex(d),this.setAttribute("position",new de(m,3)),this.setAttribute("normal",new de(x,3)),this.setAttribute("uv",new de(v,2))}static fromJSON(e){return new Mi(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class xr extends rn{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 xr(e.radius,e.detail)}}class yr extends ve{constructor(e=1,t=.4,n=8,i=6,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],l=[],c=[],u=new S,h=new S,f=new S;for(let d=0;d<=n;d++)for(let m=0;m<=i;m++){const x=m/i*s,v=d/n*Math.PI*2;h.x=(e+t*Math.cos(v))*Math.cos(x),h.y=(e+t*Math.cos(v))*Math.sin(x),h.z=t*Math.sin(v),a.push(h.x,h.y,h.z),u.x=e*Math.cos(x),u.y=e*Math.sin(x),f.subVectors(h,u).normalize(),l.push(f.x,f.y,f.z),c.push(m/i),c.push(d/n)}for(let d=1;d<=n;d++)for(let m=1;m<=i;m++){const x=(i+1)*d+m-1,v=(i+1)*(d-1)+m-1,g=(i+1)*(d-1)+m,p=(i+1)*d+m;o.push(x,v,p),o.push(v,g,p)}this.setIndex(o),this.setAttribute("position",new de(a,3)),this.setAttribute("normal",new de(l,3)),this.setAttribute("uv",new de(c,2))}static fromJSON(e){return new yr(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class vr extends ve{constructor(e=1,t=.4,n=64,i=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:o},n=Math.floor(n),i=Math.floor(i);const a=[],l=[],c=[],u=[],h=new S,f=new S,d=new S,m=new S,x=new S,v=new S,g=new S;for(let _=0;_<=n;++_){const y=_/n*s*Math.PI*2;p(y,s,o,e,d),p(y+.01,s,o,e,m),v.subVectors(m,d),g.addVectors(m,d),x.crossVectors(v,g),g.crossVectors(x,v),x.normalize(),g.normalize();for(let M=0;M<=i;++M){const b=M/i*Math.PI*2,E=-t*Math.cos(b),P=t*Math.sin(b);h.x=d.x+(E*g.x+P*x.x),h.y=d.y+(E*g.y+P*x.y),h.z=d.z+(E*g.z+P*x.z),l.push(h.x,h.y,h.z),f.subVectors(h,d).normalize(),c.push(f.x,f.y,f.z),u.push(_/n),u.push(M/i)}}for(let _=1;_<=n;_++)for(let y=1;y<=i;y++){const M=(i+1)*(_-1)+(y-1),b=(i+1)*_+(y-1),E=(i+1)*_+y,P=(i+1)*(_-1)+y;a.push(M,b,P),a.push(b,E,P)}this.setIndex(a),this.setAttribute("position",new de(l,3)),this.setAttribute("normal",new de(c,3)),this.setAttribute("uv",new de(u,2));function p(_,y,M,b,E){const P=Math.cos(_),z=Math.sin(_),N=M/y*_,I=Math.cos(N);E.x=b*(2+I)*.5*P,E.y=b*(2+I)*z*.5,E.z=b*Math.sin(N)*.5}}static fromJSON(e){return new vr(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class _r extends ve{constructor(e=new Io(new S(-1,-1,0),new S(-1,1,0),new S(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new S,l=new S,c=new W;let u=new S;const h=[],f=[],d=[],m=[];x(),this.setIndex(m),this.setAttribute("position",new de(h,3)),this.setAttribute("normal",new de(f,3)),this.setAttribute("uv",new de(d,2));function x(){for(let _=0;_<t;_++)v(_);v(s===!1?t:0),p(),g()}function v(_){u=e.getPointAt(_/t,u);const y=o.normals[_],M=o.binormals[_];for(let b=0;b<=i;b++){const E=b/i*Math.PI*2,P=Math.sin(E),z=-Math.cos(E);l.x=z*y.x+P*M.x,l.y=z*y.y+P*M.y,l.z=z*y.z+P*M.z,l.normalize(),f.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,h.push(a.x,a.y,a.z)}}function g(){for(let _=1;_<=t;_++)for(let y=1;y<=i;y++){const M=(i+1)*(_-1)+(y-1),b=(i+1)*_+(y-1),E=(i+1)*_+y,P=(i+1)*(_-1)+y;m.push(M,b,P),m.push(b,E,P)}}function p(){for(let _=0;_<=t;_++)for(let y=0;y<=i;y++)c.x=_/t,c.y=y/i,d.push(c.x,c.y)}}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new _r(new wl[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class El extends ve{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new S,s=new S;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const h=l[c],f=h.start,d=h.count;for(let m=f,x=f+d;m<x;m+=3)for(let v=0;v<3;v++){const g=a.getX(m+v),p=a.getX(m+(v+1)%3);i.fromBufferAttribute(o,g),s.fromBufferAttribute(o,p),Tf(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const u=3*a+c,h=3*a+(c+1)%3;i.fromBufferAttribute(o,u),s.fromBufferAttribute(o,h),Tf(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new de(t,3))}}}function Tf(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n,i),!0)}var Ef=Object.freeze({__proto__:null,BoxGeometry:Mn,BoxBufferGeometry:Mn,CircleGeometry:ur,CircleBufferGeometry:ur,ConeGeometry:hr,ConeBufferGeometry:hr,CylinderGeometry:kn,CylinderBufferGeometry:kn,DodecahedronGeometry:fr,DodecahedronBufferGeometry:fr,EdgesGeometry:ml,ExtrudeGeometry:on,ExtrudeBufferGeometry:on,IcosahedronGeometry:pr,IcosahedronBufferGeometry:pr,LatheGeometry:mr,LatheBufferGeometry:mr,OctahedronGeometry:vi,OctahedronBufferGeometry:vi,PlaneGeometry:hi,PlaneBufferGeometry:hi,PolyhedronGeometry:rn,PolyhedronBufferGeometry:rn,RingGeometry:gr,RingBufferGeometry:gr,ShapeGeometry:_i,ShapeBufferGeometry:_i,SphereGeometry:Mi,SphereBufferGeometry:Mi,TetrahedronGeometry:xr,TetrahedronBufferGeometry:xr,TorusGeometry:yr,TorusBufferGeometry:yr,TorusKnotGeometry:vr,TorusKnotBufferGeometry:vr,TubeGeometry:_r,TubeBufferGeometry:_r,WireframeGeometry:El});class Al extends yt{constructor(e){super(),this.type="ShadowMaterial",this.color=new le(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}}Al.prototype.isShadowMaterial=!0;class zo extends yt{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new le(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 le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=si,this.normalScale=new W(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,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.envMapIntensity=e.envMapIntensity,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}}zo.prototype.isMeshStandardMaterial=!0;class Cl extends zo{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new W(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return St(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new le(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new le(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new le(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=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.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.ior=e.ior,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}}Cl.prototype.isMeshPhysicalMaterial=!0;class Ll extends yt{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new le(16777215),this.specular=new le(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=si,this.normalScale=new W(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Cr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,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.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}}Ll.prototype.isMeshPhongMaterial=!0;class Rl extends yt{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new le(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=si,this.normalScale=new W(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.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}}Rl.prototype.isMeshToonMaterial=!0;class Pl extends yt{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=si,this.normalScale=new W(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!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}}Pl.prototype.isMeshNormalMaterial=!0;class Il extends yt{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Cr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",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.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,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}}Il.prototype.isMeshLambertMaterial=!0;class Dl extends yt{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new le(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=si,this.normalScale=new W(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,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}}Dl.prototype.isMeshMatcapMaterial=!0;class Fl extends Mt{constructor(e){super(),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}}Fl.prototype.isLineDashedMaterial=!0;var _y=Object.freeze({__proto__:null,ShadowMaterial:Al,SpriteMaterial:fo,RawShaderMaterial:tr,ShaderMaterial:bn,PointsMaterial:yi,MeshPhysicalMaterial:Cl,MeshStandardMaterial:zo,MeshPhongMaterial:Ll,MeshToonMaterial:Rl,MeshNormalMaterial:Pl,MeshLambertMaterial:Il,MeshDepthMaterial:lo,MeshDistanceMaterial:co,MeshBasicMaterial:_n,MeshMatcapMaterial:Dl,LineDashedMaterial:Fl,LineBasicMaterial:Mt,Material:yt});const $e={arraySlice:function(r,e,t){return $e.isTypedArray(r)?new r.constructor(r.subarray(e,t!==void 0?t:r.length)):r.slice(e,t)},convertArray:function(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)},isTypedArray:function(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)},getKeyframeOrder:function(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n},sortedArray:function(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=r[a+l]}return i},flattenJSON:function(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)},subclip:function(r,e,t,n,i=30){const s=r.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),h=[],f=[];for(let d=0;d<c.times.length;++d){const m=c.times[d]*i;if(!(m<t||m>=n)){h.push(c.times[d]);for(let x=0;x<u;++x)f.push(c.values[d*u+x])}}h.length!==0&&(c.times=$e.convertArray(h,c.times.constructor),c.values=$e.convertArray(f,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let o=0;o<i;++o){const a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=r.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===l});if(c===void 0)continue;let u=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let f=0;const d=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);const m=a.times.length-1;let x;if(s<=a.times[0]){const g=u,p=h-u;x=$e.arraySlice(a.values,g,p)}else if(s>=a.times[m]){const g=m*h+u,p=g+h-u;x=$e.arraySlice(a.values,g,p)}else{const g=a.createInterpolant(),p=u,_=h-u;g.evaluate(s),x=$e.arraySlice(g.resultBuffer,p,_)}l==="quaternion"&&new Tt().fromArray(x).normalize().conjugate().toArray(x);const v=c.times.length;for(let g=0;g<v;++g){const p=g*d+f;if(l==="quaternion")Tt.multiplyQuaternionsFlat(c.values,p,x,0,c.values,p);else{const _=d-f*2;for(let y=0;y<_;++y)c.values[p+y]-=x[y]}}}return r.blendMode=Aa,r}};class Sn{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],s=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,s)}if(n===a)break;if(s=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===l)break;if(i=s,s=t[--n-1],e>=s)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],s=t[n-1],s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(i===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,s,e)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let o=0;o!==i;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Sn.prototype.beforeStart_=Sn.prototype.copySampleValue_,Sn.prototype.afterEnd_=Sn.prototype.copySampleValue_;class Af extends Sn{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:ni,endingEnd:ni}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,o=e+1,a=i[s],l=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case ii:s=e,a=2*t-n;break;case zr:s=i.length-2,a=t+i[s]-i[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case ii:o=e,l=2*n-t;break;case zr:o=1,l=n+i[1]-i[0];break;default:o=e-1,l=t}const c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,d=this._weightNext,m=(n-t)/(i-t),x=m*m,v=x*m,g=-f*v+2*f*x-f*m,p=(1+f)*v+(-1.5-2*f)*x+(-.5+f)*m+1,_=(-1-d)*v+(1.5+d)*x+.5*m,y=d*v-d*x;for(let M=0;M!==a;++M)s[M]=g*o[u+M]+p*o[c+M]+_*o[l+M]+y*o[h+M];return s}}class Bl extends Sn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(i-t),h=1-u;for(let f=0;f!==a;++f)s[f]=o[c+f]*h+o[l+f]*u;return s}}class Cf extends Sn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Zt{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=$e.convertArray(t,this.TimeBufferType),this.values=$e.convertArray(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:$e.convertArray(e.times,Array),values:$e.convertArray(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Cf(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Bl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Af(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Br:t=this.InterpolantFactoryMethodDiscrete;break;case Nr:t=this.InterpolantFactoryMethodLinear;break;case Cs: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 Br;case this.InterpolantFactoryMethodLinear:return Nr;case this.InterpolantFactoryMethodSmooth:return Cs}}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 s=0,o=i-1;for(;s!==i&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=$e.arraySlice(n,s,o),this.values=$e.arraySlice(this.values,s*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,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=n[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&$e.isTypedArray(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=$e.arraySlice(this.times),t=$e.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Cs,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(i)l=!0;else{const h=a*n,f=h-n,d=h+n;for(let m=0;m!==n;++m){const x=t[h+m];if(x!==t[f+m]||x!==t[d+m]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const h=a*n,f=o*n;for(let d=0;d!==n;++d)t[f+d]=t[h+d]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=$e.arraySlice(e,0,o),this.values=$e.arraySlice(t,0,o*n)):(this.times=e,this.values=t),this}clone(){const e=$e.arraySlice(this.times,0),t=$e.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Zt.prototype.TimeBufferType=Float32Array,Zt.prototype.ValueBufferType=Float32Array,Zt.prototype.DefaultInterpolation=Nr;class bi extends Zt{}bi.prototype.ValueTypeName="bool",bi.prototype.ValueBufferType=Array,bi.prototype.DefaultInterpolation=Br,bi.prototype.InterpolantFactoryMethodLinear=void 0,bi.prototype.InterpolantFactoryMethodSmooth=void 0;class Nl extends Zt{}Nl.prototype.ValueTypeName="color";class us extends Zt{}us.prototype.ValueTypeName="number";class Lf extends Sn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t);let c=e*a;for(let u=c+a;c!==u;c+=4)Tt.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Mr extends Zt{InterpolantFactoryMethodLinear(e){return new Lf(this.times,this.values,this.getValueSize(),e)}}Mr.prototype.ValueTypeName="quaternion",Mr.prototype.DefaultInterpolation=Nr,Mr.prototype.InterpolantFactoryMethodSmooth=void 0;class wi extends Zt{}wi.prototype.ValueTypeName="string",wi.prototype.ValueBufferType=Array,wi.prototype.DefaultInterpolation=Br,wi.prototype.InterpolantFactoryMethodLinear=void 0,wi.prototype.InterpolantFactoryMethodSmooth=void 0;class hs extends Zt{}hs.prototype.ValueTypeName="vector";class fs{constructor(e,t=-1,n,i=Ls){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Bt(),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(by(n[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}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 s=0,o=n.length;s!==o;++s)t.push(Zt.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const u=$e.getKeyframeOrder(l);l=$e.sortedArray(l,1,u),c=$e.sortedArray(c,1,u),!i&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new us(".morphTargetInfluences["+t[a].name+"]",l,c).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={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],u=c.name.match(s);if(u&&u.length>1){const h=u[1];let f=i[h];f||(i[h]=f=[]),f.push(c)}}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,f,d,m,x){if(d.length!==0){const v=[],g=[];$e.flattenJSON(d,v,g,m),v.length!==0&&x.push(new h(f,v,g))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const f=c[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const d={};let m;for(m=0;m<f.length;m++)if(f[m].morphTargets)for(let x=0;x<f[m].morphTargets.length;x++)d[f[m].morphTargets[x]]=-1;for(const x in d){const v=[],g=[];for(let p=0;p!==f[m].morphTargets.length;++p){const _=f[m];v.push(_.time),g.push(_.morphTarget===x?1:0)}i.push(new us(".morphTargetInfluence["+x+"]",v,g))}l=d.length*(o||1)}else{const d=".bones["+t[h].name+"]";n(hs,d+".position",f,"pos",i),n(Mr,d+".quaternion",f,"rot",i),n(hs,d+".scale",f,"scl",i)}}return i.length===0?null:new this(s,l,i,a)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.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 My(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return us;case"vector":case"vector2":case"vector3":case"vector4":return hs;case"color":return Nl;case"quaternion":return Mr;case"bool":case"boolean":return bi;case"string":return wi}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function by(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=My(r.type);if(r.times===void 0){const t=[],n=[];$e.flattenJSON(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const Si={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class zl{constructor(e,t,n){const i=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){a++,s===!1&&i.onStart!==void 0&&i.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,i.onProgress!==void 0&&i.onProgress(u,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=c.length;h<f;h+=2){const d=c[h],m=c[h+1];if(d.global&&(d.lastIndex=0),d.test(u))return m}return null}}}const Rf=new zl;class It{constructor(e){this.manager=e!==void 0?e:Rf,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}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}}const Tn={};class an extends It{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 s=Si.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Tn[e]!==void 0){Tn[e].push({onLoad:t,onProgress:n,onError:i});return}Tn[e]=[],Tn[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"});fetch(o).then(a=>{if(a.status===200||a.status===0){if(a.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream=="undefined"||a.body.getReader===void 0)return a;const l=Tn[e],c=a.body.getReader(),u=a.headers.get("Content-Length"),h=u?parseInt(u):0,f=h!==0;let d=0;const m=new ReadableStream({start(x){v();function v(){c.read().then(({done:g,value:p})=>{if(g)x.close();else{d+=p.byteLength;const _=new ProgressEvent("progress",{lengthComputable:f,loaded:d,total:h});for(let y=0,M=l.length;y<M;y++){const b=l[y];b.onProgress&&b.onProgress(_)}x.enqueue(p),v()}})}}});return new Response(m)}else throw Error(`fetch for "${a.url}" responded with ${a.status}: ${a.statusText}`)}).then(a=>{switch(this.responseType){case"arraybuffer":return a.arrayBuffer();case"blob":return a.blob();case"document":return a.text().then(l=>new DOMParser().parseFromString(l,this.mimeType));case"json":return a.json();default:return a.text()}}).then(a=>{Si.add(e,a);const l=Tn[e];delete Tn[e];for(let c=0,u=l.length;c<u;c++){const h=l[c];h.onLoad&&h.onLoad(a)}}).catch(a=>{const l=Tn[e];if(l===void 0)throw this.manager.itemError(e),a;delete Tn[e];for(let c=0,u=l.length;c<u;c++){const h=l[c];h.onError&&h.onError(a)}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 wy extends It{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new an(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=fs.parse(e[n]);t.push(i)}return t}}class Sy extends It{constructor(e){super(e)}load(e,t,n,i){const s=this,o=[],a=new dl,l=new an(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(h){l.load(e[h],function(f){const d=s.parse(f,!0);o[h]={width:d.width,height:d.height,format:d.format,mipmaps:d.mipmaps},c+=1,c===6&&(d.mipmapCount===1&&(a.minFilter=Ke),a.image=o,a.format=d.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let h=0,f=e.length;h<f;++h)u(h);else l.load(e,function(h){const f=s.parse(h,!0);if(f.isCubemap){const d=f.mipmaps.length/f.mipmapCount;for(let m=0;m<d;m++){o[m]={mipmaps:[]};for(let x=0;x<f.mipmapCount;x++)o[m].mipmaps.push(f.mipmaps[m*f.mipmapCount+x]),o[m].format=f.format,o[m].width=f.width,o[m].height=f.height}a.image=o}else a.image.width=f.width,a.image.height=f.height,a.mipmaps=f.mipmaps;f.mipmapCount===1&&(a.minFilter=Ke),a.format=f.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}}class ds extends It{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Si.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Is("img");function l(){u(),Si.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),i&&i(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class Pf extends It{constructor(e){super(e)}load(e,t,n,i){const s=new Ki,o=new ds(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){s.images[c]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class If extends It{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new gi,a=new an(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){const c=s.parse(l);!c||(c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:bt,o.wrapT=c.wrapT!==void 0?c.wrapT:bt,o.magFilter=c.magFilter!==void 0?c.magFilter:Ke,o.minFilter=c.minFilter!==void 0?c.minFilter:Ke,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.encoding!==void 0&&(o.encoding=c.encoding),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=Kn),c.mipmapCount===1&&(o.minFilter=Ke),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c))},n,i),o}}class Df extends It{constructor(e){super(e)}load(e,t,n,i){const s=new ht,o=new ds(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class $t extends Ne{constructor(e,t=1){super(),this.type="Light",this.color=new le(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),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()),t}}$t.prototype.isLight=!0;class Ul extends $t{constructor(e,t,n){super(e,n),this.type="HemisphereLight",this.position.copy(Ne.DefaultUp),this.updateMatrix(),this.groundColor=new le(t)}copy(e){return $t.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}Ul.prototype.isHemisphereLight=!0;const Ff=new ge,Bf=new S,Nf=new S;class Ol{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new W(512,512),this.map=null,this.mapPass=null,this.matrix=new ge,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new qr,this._frameExtents=new W(1,1),this._viewportCount=1,this._viewports=[new We(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Bf.setFromMatrixPosition(e.matrixWorld),t.position.copy(Bf),Nf.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Nf),t.updateMatrixWorld(),Ff.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ff),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}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.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.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 zf extends Ol{constructor(){super(new _t(50,1,.5,500)),this.focus=1}updateMatrices(e){const t=this.camera,n=Ur*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}zf.prototype.isSpotLightShadow=!0;class Gl extends $t{constructor(e,t,n=0,i=Math.PI/3,s=0,o=1){super(e,t),this.type="SpotLight",this.position.copy(Ne.DefaultUp),this.updateMatrix(),this.target=new Ne,this.distance=n,this.angle=i,this.penumbra=s,this.decay=o,this.shadow=new zf}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),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}}Gl.prototype.isSpotLight=!0;const Uf=new ge,ps=new S,Hl=new S;class Of extends Ol{constructor(){super(new _t(90,1,.5,500)),this._frameExtents=new W(4,2),this._viewportCount=6,this._viewports=[new We(2,1,1,1),new We(0,1,1,1),new We(3,1,1,1),new We(1,1,1,1),new We(3,0,1,1),new We(1,0,1,1)],this._cubeDirections=[new S(1,0,0),new S(-1,0,0),new S(0,0,1),new S(0,0,-1),new S(0,1,0),new S(0,-1,0)],this._cubeUps=[new S(0,1,0),new S(0,1,0),new S(0,1,0),new S(0,1,0),new S(0,0,1),new S(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),ps.setFromMatrixPosition(e.matrixWorld),n.position.copy(ps),Hl.copy(n.position),Hl.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Hl),n.updateMatrixWorld(),i.makeTranslation(-ps.x,-ps.y,-ps.z),Uf.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Uf)}}Of.prototype.isPointLightShadow=!0;class Vl extends $t{constructor(e,t,n=0,i=1){super(e,t),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Of}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}Vl.prototype.isPointLight=!0;class Gf extends Ol{constructor(){super(new Xr(-5,5,5,-5,.5,500))}}Gf.prototype.isDirectionalLightShadow=!0;class kl extends $t{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(Ne.DefaultUp),this.updateMatrix(),this.target=new Ne,this.shadow=new Gf}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}kl.prototype.isDirectionalLight=!0;class Wl extends $t{constructor(e,t){super(e,t),this.type="AmbientLight"}}Wl.prototype.isAmbientLight=!0;class ql extends $t{constructor(e,t,n=10,i=10){super(e,t),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}}ql.prototype.isRectAreaLight=!0;class Xl{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new S)}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,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=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*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),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,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}Xl.prototype.isSphericalHarmonics3=!0;class ms extends $t{constructor(e=new Xl,t=1){super(void 0,t),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}}ms.prototype.isLightProbe=!0;class Hf extends It{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,o=new an(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const i=new _y[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 le().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.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.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.format!==void 0&&(i.format=e.format),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),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.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),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.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!==1&&(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.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 s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=n(o.value);break;case"c":i.uniforms[s].value=new le().setHex(o.value);break;case"v2":i.uniforms[s].value=new W().fromArray(o.value);break;case"v3":i.uniforms[s].value=new S().fromArray(o.value);break;case"v4":i.uniforms[s].value=new We().fromArray(o.value);break;case"m3":i.uniforms[s].value=new mt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new ge().fromArray(o.value);break;default:i.uniforms[s].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.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.shading!==void 0&&(i.flatShading=e.shading===1),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 s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new W().fromArray(s)}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.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 W().fromArray(e.clearcoatNormalScale)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),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}}class Uo{static decodeText(e){if(typeof TextDecoder!="undefined")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(n){return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.substr(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 Yl extends ve{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}Yl.prototype.isInstancedBufferGeometry=!0;class Vf extends It{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new an(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(d,m){if(t[m]!==void 0)return t[m];const v=d.interleavedBuffers[m],g=s(d,v.buffer),p=Oi(v.type,g),_=new mi(p,v.stride);return _.uuid=v.uuid,t[m]=_,_}function s(d,m){if(n[m]!==void 0)return n[m];const v=d.arrayBuffers[m],g=new Uint32Array(v).buffer;return n[m]=g,g}const o=e.isInstancedBufferGeometry?new Yl:new ve,a=e.data.index;if(a!==void 0){const d=Oi(a.type,a.array);o.setIndex(new ze(d,1))}const l=e.data.attributes;for(const d in l){const m=l[d];let x;if(m.isInterleavedBufferAttribute){const v=i(e.data,m.data);x=new Vn(v,m.itemSize,m.offset,m.normalized)}else{const v=Oi(m.type,m.array),g=m.isInstancedBufferAttribute?xi:ze;x=new g(v,m.itemSize,m.normalized)}m.name!==void 0&&(x.name=m.name),m.usage!==void 0&&x.setUsage(m.usage),m.updateRange!==void 0&&(x.updateRange.offset=m.updateRange.offset,x.updateRange.count=m.updateRange.count),o.setAttribute(d,x)}const c=e.data.morphAttributes;if(c)for(const d in c){const m=c[d],x=[];for(let v=0,g=m.length;v<g;v++){const p=m[v];let _;if(p.isInterleavedBufferAttribute){const y=i(e.data,p.data);_=new Vn(y,p.itemSize,p.offset,p.normalized)}else{const y=Oi(p.type,p.array);_=new ze(y,p.itemSize,p.normalized)}p.name!==void 0&&(_.name=p.name),x.push(_)}o.morphAttributes[d]=x}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let d=0,m=h.length;d!==m;++d){const x=h[d];o.addGroup(x.start,x.count,x.materialIndex)}const f=e.data.boundingSphere;if(f!==void 0){const d=new S;f.center!==void 0&&d.fromArray(f.center),o.boundingSphere=new Dn(d,f.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class Ty extends It{constructor(e){super(e)}load(e,t,n,i){const s=this,o=this.path===""?Uo.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new an(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(h){i!==void 0&&i(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},n,i)}loadAsync(e,t){return Er(this,null,function*(){const n=this,i=this.path===""?Uo.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new an(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=yield s.loadAsync(e,t),a=JSON.parse(o),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return yield n.parseAsync(a)})}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,n),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),t!==void 0){let h=!1;for(const f in o)if(o[f]instanceof HTMLImageElement){h=!0;break}h===!1&&t(c)}return c}parseAsync(e){return Er(this,null,function*(){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=yield this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,i,a,o,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),l})}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new Jt().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new Mo().fromJSON(e[s],i);n[a.uuid]=a}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new Vf;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(l);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:l.type in Ef?a=Ef[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),a.isBufferGeometry===!0&&l.userData!==void 0&&(a.userData=l.userData),n[l.uuid]=a}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new Hf;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const l=e[o];if(l.type==="MultiMaterial"){const c=[];for(let u=0;u<l.materials.length;u++){const h=l.materials[u];n[h.uuid]===void 0&&(n[h.uuid]=s.parse(h)),c.push(n[h.uuid])}i[l.uuid]=c}else n[l.uuid]===void 0&&(n[l.uuid]=s.parse(l)),i[l.uuid]=n[l.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=fs.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function o(l){return n.manager.itemStart(l),s.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:n.resourcePath+c;return o(u)}else return l.data?{data:Oi(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new zl(t);s=new ds(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const h=e[c],f=h.url;if(Array.isArray(f)){i[h.uuid]=[];for(let d=0,m=f.length;d<m;d++){const x=f[d],v=a(x);v!==null&&(v instanceof HTMLImageElement?i[h.uuid].push(v):i[h.uuid].push(new gi(v.data,v.width,v.height)))}}else{const d=a(h.url);d!==null&&(i[h.uuid]=d)}}}return i}parseImagesAsync(e){return Er(this,null,function*(){const t=this,n={};let i;function s(o){return Er(this,null,function*(){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return yield i.loadAsync(l)}else return o.data?{data:Oi(o.type,o.data),width:o.width,height:o.height}:null})}if(e!==void 0&&e.length>0){i=new ds(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],c=l.url;if(Array.isArray(c)){n[l.uuid]=[];for(let u=0,h=c.length;u<h;u++){const f=c[u],d=yield s(f);d!==null&&(d instanceof HTMLImageElement?n[l.uuid].push(d):n[l.uuid].push(new gi(d.data,d.width,d.height)))}}else{const u=yield s(l.url);u!==null&&(n[l.uuid]=u)}}}return n})}parseTextures(e,t){function n(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const i={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];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);let l;const c=t[a.image];Array.isArray(c)?(l=new Ki(c),c.length===6&&(l.needsUpdate=!0)):(c&&c.data?l=new gi(c.data,c.width,c.height):l=new ht(c),c&&(l.needsUpdate=!0)),l.uuid=a.uuid,a.name!==void 0&&(l.name=a.name),a.mapping!==void 0&&(l.mapping=n(a.mapping,Ey)),a.offset!==void 0&&l.offset.fromArray(a.offset),a.repeat!==void 0&&l.repeat.fromArray(a.repeat),a.center!==void 0&&l.center.fromArray(a.center),a.rotation!==void 0&&(l.rotation=a.rotation),a.wrap!==void 0&&(l.wrapS=n(a.wrap[0],kf),l.wrapT=n(a.wrap[1],kf)),a.format!==void 0&&(l.format=a.format),a.type!==void 0&&(l.type=a.type),a.encoding!==void 0&&(l.encoding=a.encoding),a.minFilter!==void 0&&(l.minFilter=n(a.minFilter,Wf)),a.magFilter!==void 0&&(l.magFilter=n(a.magFilter,Wf)),a.anisotropy!==void 0&&(l.anisotropy=a.anisotropy),a.flipY!==void 0&&(l.flipY=a.flipY),a.premultiplyAlpha!==void 0&&(l.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(l.unpackAlignment=a.unpackAlignment),a.userData!==void 0&&(l.userData=a.userData),i[a.uuid]=l}return i}parseObject(e,t,n,i,s){let o;function a(f){return t[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",f),t[f]}function l(f){if(f!==void 0){if(Array.isArray(f)){const d=[];for(let m=0,x=f.length;m<x;m++){const v=f[m];n[v]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",v),d.push(n[v])}return d}return n[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",f),n[f]}}function c(f){return i[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",f),i[f]}let u,h;switch(e.type){case"Scene":o=new ho,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new le(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new $r(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new Zr(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":o=new _t(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 Xr(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 Wl(e.color,e.intensity);break;case"DirectionalLight":o=new kl(e.color,e.intensity);break;case"PointLight":o=new Vl(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new ql(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new Gl(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new Ul(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new ms().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),h=l(e.material),o=new vo(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=l(e.material),o=new ft(u,h);break;case"InstancedMesh":u=a(e.geometry),h=l(e.material);const f=e.count,d=e.instanceMatrix,m=e.instanceColor;o=new cl(u,h,f),o.instanceMatrix=new xi(new Float32Array(d.array),16),m!==void 0&&(o.instanceColor=new xi(new Float32Array(m.array),m.itemSize));break;case"LOD":o=new jh;break;case"Line":o=new wn(a(e.geometry),l(e.material));break;case"LineLoop":o=new hl(a(e.geometry),l(e.material));break;case"LineSegments":o=new Dt(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new ts(a(e.geometry),l(e.material));break;case"Sprite":o=new go(l(e.material));break;case"Group":o=new pi;break;case"Bone":o=new _o;break;default:o=new Ne}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.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(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 f=e.children;for(let d=0;d<f.length;d++)o.add(this.parseObject(f[d],t,n,i,s))}if(e.animations!==void 0){const f=e.animations;for(let d=0;d<f.length;d++){const m=f[d];o.animations.push(s[m])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const f=e.levels;for(let d=0;d<f.length;d++){const m=f[d],x=o.getObjectByProperty("uuid",m.object);x!==void 0&&o.addLevel(x,m.distance)}}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)}})}setTexturePath(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}const Ey={UVMapping:Ts,CubeReflectionMapping:jn,CubeRefractionMapping:Qn,EquirectangularReflectionMapping:Lr,EquirectangularRefractionMapping:Rr,CubeUVReflectionMapping:Bi,CubeUVRefractionMapping:Pr},kf={RepeatWrapping:Ir,ClampToEdgeWrapping:bt,MirroredRepeatWrapping:Dr},Wf={NearestFilter:rt,NearestMipmapNearestFilter:Es,NearestMipmapLinearFilter:As,LinearFilter:Ke,LinearMipmapNearestFilter:ga,LinearMipmapLinearFilter:Kn};class qf extends It{constructor(e){super(e),typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&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 s=this,o=Si.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){Si.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}qf.prototype.isImageBitmapLoader=!0;let Oo;const Jl={getContext:function(){return Oo===void 0&&(Oo=new(window.AudioContext||window.webkitAudioContext)),Oo},setContext:function(r){Oo=r}};class Xf extends It{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new an(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{const l=a.slice(0);Jl.getContext().decodeAudioData(l,function(u){t(u)})}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}}class Yf extends ms{constructor(e,t,n=1){super(void 0,n);const i=new le().set(e),s=new le().set(t),o=new S(i.r,i.g,i.b),a=new S(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}}Yf.prototype.isHemisphereLightProbe=!0;class Jf extends ms{constructor(e,t=1){super(void 0,t);const n=new le().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}Jf.prototype.isAmbientLightProbe=!0;const Zf=new ge,$f=new ge,Ti=new ge;class Ay{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new _t,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new _t,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,Ti.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(oi*t.fov*.5)/t.zoom;let a,l;$f.elements[12]=-i,Zf.elements[12]=i,a=-o*t.aspect+s,l=o*t.aspect+s,Ti.elements[0]=2*t.near/(l-a),Ti.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Ti),a=-o*t.aspect-s,l=o*t.aspect-s,Ti.elements[0]=2*t.near/(l-a),Ti.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Ti)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply($f),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Zf)}}class jf{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Qf(),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=Qf();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Qf(){return(typeof performance=="undefined"?Date:performance).now()}const Ei=new S,Kf=new Tt,Cy=new S,Ai=new S;class Ly extends Ne{constructor(){super(),this.type="AudioListener",this.context=Jl.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new jf}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(Ei,Kf,Cy),Ai.set(0,0,-1).applyQuaternion(Kf),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Ei.x,i),t.positionY.linearRampToValueAtTime(Ei.y,i),t.positionZ.linearRampToValueAtTime(Ei.z,i),t.forwardX.linearRampToValueAtTime(Ai.x,i),t.forwardY.linearRampToValueAtTime(Ai.y,i),t.forwardZ.linearRampToValueAtTime(Ai.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Ei.x,Ei.y,Ei.z),t.setOrientation(Ai.x,Ai.y,Ai.z,n.x,n.y,n.z)}}class Zl extends Ne{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.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),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.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){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!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 Ci=new S,ed=new Tt,Ry=new S,Li=new S;class Py extends Zl{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(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(Ci,ed,Ry),Li.set(0,0,1).applyQuaternion(ed);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Ci.x,n),t.positionY.linearRampToValueAtTime(Ci.y,n),t.positionZ.linearRampToValueAtTime(Ci.z,n),t.orientationX.linearRampToValueAtTime(Li.x,n),t.orientationY.linearRampToValueAtTime(Li.y,n),t.orientationZ.linearRampToValueAtTime(Li.z,n)}else t.setPosition(Ci.x,Ci.y,Ci.z),t.setOrientation(Li.x,Li.y,Li.z)}}class td{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 nd{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,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,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)n[s+a]=n[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(n,s,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,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+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 s=n,o=i;s!==o;++s)t[s]=t[i+s%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,s){if(i>=.5)for(let o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){Tt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const o=this._workIndex*s;Tt.multiplyQuaternionsFlat(e,o,e,t,e,n),Tt.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const $l="\\[\\]\\.:\\/",Iy=new RegExp("["+$l+"]","g"),jl="[^"+$l+"]",Dy="[^"+$l.replace("\\.","")+"]",Fy=/((?:WC+[\/:])*)/.source.replace("WC",jl),By=/(WCOD+)?/.source.replace("WCOD",Dy),Ny=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",jl),zy=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",jl),Uy=new RegExp("^"+Fy+By+Ny+zy+"$"),Oy=["material","materials","bones"];class Gy{constructor(e,t,n){const i=n||He.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_,s=n.length;i!==s;++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 He{constructor(e,t,n){this.path=t,this.parsedPath=n||He.parseTrackName(t),this.node=He.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new He.Composite(e,t,n):new He(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Iy,"")}static parseTrackName(e){const t=Uy.exec(e);if(!t)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 s=n.nodeName.substring(i+1);Oy.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}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||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(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const l=n(a.children);if(l)return l}return null},i=n(e.children);if(i)return i}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,s=n.length;i!==s;++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,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++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 s=t.propertyIndex;if(e||(e=He.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){let c=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===c){c=u;break}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(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[i];if(o===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+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 l=this.BindingType.Direct;if(s!==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.isBufferGeometry){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[s]!==void 0&&(s=e.morphTargetDictionary[s])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}He.Composite=Gy,He.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},He.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},He.prototype.GetterByBindingType=[He.prototype._getValue_direct,He.prototype._getValue_array,He.prototype._getValue_arrayElement,He.prototype._getValue_toArray],He.prototype.SetterByBindingTypeAndVersioning=[[He.prototype._setValue_direct,He.prototype._setValue_direct_setNeedsUpdate,He.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[He.prototype._setValue_array,He.prototype._setValue_array_setNeedsUpdate,He.prototype._setValue_array_setMatrixWorldNeedsUpdate],[He.prototype._setValue_arrayElement,He.prototype._setValue_arrayElement_setNeedsUpdate,He.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[He.prototype._setValue_fromArray,He.prototype._setValue_fromArray_setNeedsUpdate,He.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class id{constructor(){this.uuid=Bt(),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,s=this._bindings,o=s.length;let a,l=e.length,c=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const f=arguments[u],d=f.uuid;let m=t[d];if(m===void 0){m=l++,t[d]=m,e.push(f);for(let x=0,v=o;x!==v;++x)s[x].push(new He(f,n[x],i[x]))}else if(m<c){a=e[m];const x=--c,v=e[x];t[v.uuid]=m,e[m]=v,t[d]=x,e[x]=f;for(let g=0,p=o;g!==p;++g){const _=s[g],y=_[x];let M=_[m];_[m]=y,M===void 0&&(M=new He(f,n[g],i[g])),_[x]=M}}else e[m]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const h=s++,f=e[h];t[f.uuid]=u,e[u]=f,t[c]=h,e[h]=l;for(let d=0,m=i;d!==m;++d){const x=n[d],v=x[h],g=x[u];x[u]=v,x[h]=g}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<s){const f=--s,d=e[f],m=--o,x=e[m];t[d.uuid]=h,e[h]=d,t[x.uuid]=f,e[f]=x,e.pop();for(let v=0,g=i;v!==g;++v){const p=n[v],_=p[f],y=p[m];p[h]=_,p[f]=y,p.pop()}}else{const f=--o,d=e[f];f>0&&(t[d.uuid]=h),e[h]=d,e.pop();for(let m=0,x=i;m!==x;++m){const v=n[m];v[h]=v[f],v.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);i=s.length,n[e]=i,o.push(e),a.push(t),s.push(h);for(let f=u,d=l.length;f!==d;++f){const m=l[f];h[f]=new He(m,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=n,o[n]=l,o.pop(),s[n]=s[a],s.pop(),i[n]=i[a],i.pop()}}}id.prototype.isAnimationObjectGroup=!0;class Hy{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:ni,endingEnd:ni};for(let c=0;c!==o;++c){const u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Iu,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,s=e._clip.duration,o=s/i,a=i/s;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,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+n,c[0]=e/o,c[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 s=this._startTime;if(s!==null){const l=(e-s)*n;if(l<0||n===0)return;this._startTime=null,t=n*l}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Aa:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Ls:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[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;n!==null&&(t*=n.evaluate(e)[0],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,s=this._loopCount;const o=n===Du;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(n===Pu){s===-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(s===-1&&(e>=0?(s=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,s+=Math.abs(a);const l=this.repetitions-s;if(l<=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(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=ii,i.endingEnd=ii):(e?i.endingStart=this.zeroSlopeAtStart?ii:ni:i.endingStart=zr,t?i.endingEnd=this.zeroSlopeAtEnd?ii:ni:i.endingEnd=zr)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=n,this}}class rd extends Rn{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,s=i.length,o=e._propertyBindings,a=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const f=i[h],d=f.name;let m=u[d];if(m!==void 0)o[h]=m;else{if(m=o[h],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,d));continue}const x=t&&t._propertyBindings[h].binding.parsedPath;m=new nd(He.create(n,d,x),f.ValueTypeName,f.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,d),o[h]=m}a[h].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.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 s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}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,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[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 s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,f=(e._localRoot||this._root).uuid;delete h[f],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,o=this._bindingsByRootAndName,a=o[i],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Bl(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let o=typeof e=="string"?fs.findByName(i,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(n===void 0&&(o!==null?n=o.blendMode:n=Ls),l!==void 0){const h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===n)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const u=new Hy(this,o,t,n);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?fs.findByName(n,e):e,o=s?s.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,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].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,s=i[n];if(s!==void 0){const o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];this._deactivateAction(c);const u=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const a=n[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}rd.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class Go{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new Go(this.value.clone===void 0?this.value:this.value.clone())}}class sd extends mi{constructor(e,t,n=1){super(e,t),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}}sd.prototype.isInstancedInterleavedBuffer=!0;class od{constructor(e,t,n,i,s){this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,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}}od.prototype.isGLBufferAttribute=!0;class Vy{constructor(e,t,n=0,i=1/0){this.ray=new Bn(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Gs,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){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&&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)}intersectObject(e,t=!0,n=[]){return Ql(e,this,n,t),n.sort(ad),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)Ql(e[i],this,n,t);return n.sort(ad),n}}function ad(r,e){return r.distance-e.distance}function Ql(r,e,t,n){if(r.layers.test(e.layers)&&r.raycast(e,t),n===!0){const i=r.children;for(let s=0,o=i.length;s<o;s++)Ql(i[s],e,t,!0)}}class ky{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(St(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Wy{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)}}const ld=new W;class br{constructor(e=new W(1/0,1/0),t=new W(-1/0,-1/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=ld.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 ld.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),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)}}br.prototype.isBox2=!0;const cd=new S,Ho=new S;class ud{constructor(e=new S,t=new S){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){cd.subVectors(e,this.start),Ho.subVectors(this.end,this.start);const n=Ho.dot(Ho);let s=Ho.dot(cd)/n;return t&&(s=St(s,0,1)),s}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 hd=new S;class qy extends Ne{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new ve,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,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,u=a/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}n.setAttribute("position",new de(i,3));const s=new Mt({fog:!1,toneMapped:!1});this.cone=new Dt(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),hd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(hd),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const qn=new S,Vo=new ge,Kl=new ge;class fd extends Dt{constructor(e){const t=dd(e),n=new ve,i=[],s=[],o=new le(0,0,1),a=new le(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}n.setAttribute("position",new de(i,3)),n.setAttribute("color",new de(s,3));const l=new Mt({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l),this.type="SkeletonHelper",this.isSkeletonHelper=!0,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");Kl.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(Vo.multiplyMatrices(Kl,a.matrixWorld),qn.setFromMatrixPosition(Vo),i.setXYZ(o,qn.x,qn.y,qn.z),Vo.multiplyMatrices(Kl,a.parent.matrixWorld),qn.setFromMatrixPosition(Vo),i.setXYZ(o+1,qn.x,qn.y,qn.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function dd(r){const e=[];r&&r.isBone&&e.push(r);for(let t=0;t<r.children.length;t++)e.push.apply(e,dd(r.children[t]));return e}class Xy extends ft{constructor(e,t,n){const i=new Mi(t,4,2),s=new _n({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.light.updateMatrixWorld(),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.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Yy=new S,pd=new le,md=new le;class Jy extends Ne{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new vi(t);i.rotateY(Math.PI*.5),this.material=new _n({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),o=new Float32Array(s.count*3);i.setAttribute("color",new ze(o,3)),this.add(new ft(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");pd.copy(this.light.color),md.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?pd:md;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}e.lookAt(Yy.setFromMatrixPosition(this.light.matrixWorld).negate())}}class gd extends Dt{constructor(e=10,t=10,n=4473924,i=8947848){n=new le(n),i=new le(i);const s=t/2,o=e/t,a=e/2,l=[],c=[];for(let f=0,d=0,m=-a;f<=t;f++,m+=o){l.push(-a,0,m,a,0,m),l.push(m,0,-a,m,0,a);const x=f===s?n:i;x.toArray(c,d),d+=3,x.toArray(c,d),d+=3,x.toArray(c,d),d+=3,x.toArray(c,d),d+=3}const u=new ve;u.setAttribute("position",new de(l,3)),u.setAttribute("color",new de(c,3));const h=new Mt({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}}class Zy extends Dt{constructor(e=10,t=16,n=8,i=64,s=4473924,o=8947848){s=new le(s),o=new le(o);const a=[],l=[];for(let h=0;h<=t;h++){const f=h/t*(Math.PI*2),d=Math.sin(f)*e,m=Math.cos(f)*e;a.push(0,0,0),a.push(d,0,m);const x=h&1?s:o;l.push(x.r,x.g,x.b),l.push(x.r,x.g,x.b)}for(let h=0;h<=n;h++){const f=h&1?s:o,d=e-e/n*h;for(let m=0;m<i;m++){let x=m/i*(Math.PI*2),v=Math.sin(x)*d,g=Math.cos(x)*d;a.push(v,0,g),l.push(f.r,f.g,f.b),x=(m+1)/i*(Math.PI*2),v=Math.sin(x)*d,g=Math.cos(x)*d,a.push(v,0,g),l.push(f.r,f.g,f.b)}}const c=new ve;c.setAttribute("position",new de(a,3)),c.setAttribute("color",new de(l,3));const u=new Mt({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}}const xd=new S,ko=new S,yd=new S;class $y extends Ne{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);let i=new ve;i.setAttribute("position",new de([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new Mt({fog:!1,toneMapped:!1});this.lightPlane=new wn(i,s),this.add(this.lightPlane),i=new ve,i.setAttribute("position",new de([0,0,0,0,0,1],3)),this.targetLine=new wn(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){xd.setFromMatrixPosition(this.light.matrixWorld),ko.setFromMatrixPosition(this.light.target.matrixWorld),yd.subVectors(ko,xd),this.lightPlane.lookAt(ko),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(ko),this.targetLine.scale.z=yd.length()}}const Wo=new S,et=new Wr;class jy extends Dt{constructor(e){const t=new ve,n=new Mt({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],o={},a=new le(16755200),l=new le(16711680),c=new le(43775),u=new le(16777215),h=new le(3355443);f("n1","n2",a),f("n2","n4",a),f("n4","n3",a),f("n3","n1",a),f("f1","f2",a),f("f2","f4",a),f("f4","f3",a),f("f3","f1",a),f("n1","f1",a),f("n2","f2",a),f("n3","f3",a),f("n4","f4",a),f("p","n1",l),f("p","n2",l),f("p","n3",l),f("p","n4",l),f("u1","u2",c),f("u2","u3",c),f("u3","u1",c),f("c","t",u),f("p","c",h),f("cn1","cn2",h),f("cn3","cn4",h),f("cf1","cf2",h),f("cf3","cf4",h);function f(m,x,v){d(m,v),d(x,v)}function d(m,x){i.push(0,0,0),s.push(x.r,x.g,x.b),o[m]===void 0&&(o[m]=[]),o[m].push(i.length/3-1)}t.setAttribute("position",new de(i,3)),t.setAttribute("color",new de(s,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()}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;et.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),at("c",t,e,et,0,0,-1),at("t",t,e,et,0,0,1),at("n1",t,e,et,-n,-i,-1),at("n2",t,e,et,n,-i,-1),at("n3",t,e,et,-n,i,-1),at("n4",t,e,et,n,i,-1),at("f1",t,e,et,-n,-i,1),at("f2",t,e,et,n,-i,1),at("f3",t,e,et,-n,i,1),at("f4",t,e,et,n,i,1),at("u1",t,e,et,n*.7,i*1.1,-1),at("u2",t,e,et,-n*.7,i*1.1,-1),at("u3",t,e,et,0,i*2,-1),at("cf1",t,e,et,-n,0,1),at("cf2",t,e,et,n,0,1),at("cf3",t,e,et,0,-i,1),at("cf4",t,e,et,0,i,1),at("cn1",t,e,et,-n,0,-1),at("cn2",t,e,et,n,0,-1),at("cn3",t,e,et,0,-i,-1),at("cn4",t,e,et,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function at(r,e,t,n,i,s,o){Wo.set(i,s,o).unproject(n);const a=e[r];if(a!==void 0){const l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],Wo.x,Wo.y,Wo.z)}}const qo=new Rt;class vd extends Dt{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(8*3),s=new ve;s.setIndex(new ze(n,1)),s.setAttribute("position",new ze(i,3)),super(s,new Mt({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&&qo.setFromObject(this.object),qo.isEmpty())return;const t=qo.min,n=qo.max,i=this.geometry.attributes.position,s=i.array;s[0]=n.x,s[1]=n.y,s[2]=n.z,s[3]=t.x,s[4]=n.y,s[5]=n.z,s[6]=t.x,s[7]=t.y,s[8]=n.z,s[9]=n.x,s[10]=t.y,s[11]=n.z,s[12]=n.x,s[13]=n.y,s[14]=t.z,s[15]=t.x,s[16]=n.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=n.x,s[22]=t.y,s[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e){return Dt.prototype.copy.call(this,e),this.object=e.object,this}}class Qy extends Dt{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],s=new ve;s.setIndex(new ze(n,1)),s.setAttribute("position",new de(i,3)),super(s,new Mt({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))}}class Ky extends wn{constructor(e,t=1,n=16776960){const i=n,s=[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,0,1,0,0,0],o=new ve;o.setAttribute("position",new de(s,3)),o.computeBoundingSphere(),super(o,new Mt({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],l=new ve;l.setAttribute("position",new de(a,3)),l.computeBoundingSphere(),this.add(new ft(l,new _n({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){let t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?it:Jn,this.lookAt(this.plane.normal),super.updateMatrixWorld(e)}}const _d=new S;let Xo,ec;class ev extends Ne{constructor(e=new S(0,0,1),t=new S(0,0,0),n=1,i=16776960,s=n*.2,o=s*.2){super(),this.type="ArrowHelper",Xo===void 0&&(Xo=new ve,Xo.setAttribute("position",new de([0,0,0,0,1,0],3)),ec=new kn(0,.5,1,5,1),ec.translate(0,-.5,0)),this.position.copy(t),this.line=new wn(Xo,new Mt({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ft(ec,new _n({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,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{_d.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(_d,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}}class Md extends Dt{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 ve;i.setAttribute("position",new de(t,3)),i.setAttribute("color",new de(n,3));const s=new Mt({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new le,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class tv{constructor(){this.type="ShapePath",this.color=new le,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new os,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,s,o){return this.currentPath.bezierCurveTo(e,t,n,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function n(p){const _=[];for(let y=0,M=p.length;y<M;y++){const b=p[y],E=new Jt;E.curves=b.curves,_.push(E)}return _}function i(p,_){const y=_.length;let M=!1;for(let b=y-1,E=0;E<y;b=E++){let P=_[b],z=_[E],N=z.x-P.x,I=z.y-P.y;if(Math.abs(I)>Number.EPSILON){if(I<0&&(P=_[E],N=-N,z=_[b],I=-I),p.y<P.y||p.y>z.y)continue;if(p.y===P.y){if(p.x===P.x)return!0}else{const w=I*(p.x-P.x)-N*(p.y-P.y);if(w===0)return!0;if(w<0)continue;M=!M}}else{if(p.y!==P.y)continue;if(z.x<=p.x&&p.x<=P.x||P.x<=p.x&&p.x<=z.x)return!0}}return M}const s=sn.isClockWise,o=this.subPaths;if(o.length===0)return[];if(t===!0)return n(o);let a,l,c;const u=[];if(o.length===1)return l=o[0],c=new Jt,c.curves=l.curves,u.push(c),u;let h=!s(o[0].getPoints());h=e?!h:h;const f=[],d=[];let m=[],x=0,v;d[x]=void 0,m[x]=[];for(let p=0,_=o.length;p<_;p++)l=o[p],v=l.getPoints(),a=s(v),a=e?!a:a,a?(!h&&d[x]&&x++,d[x]={s:new Jt,p:v},d[x].s.curves=l.curves,h&&x++,m[x]=[]):m[x].push({h:l,p:v[0]});if(!d[0])return n(o);if(d.length>1){let p=!1;const _=[];for(let y=0,M=d.length;y<M;y++)f[y]=[];for(let y=0,M=d.length;y<M;y++){const b=m[y];for(let E=0;E<b.length;E++){const P=b[E];let z=!0;for(let N=0;N<d.length;N++)i(P.p,d[N].p)&&(y!==N&&_.push({froms:y,tos:N,hole:E}),z?(z=!1,f[N].push(P)):p=!0);z&&f[y].push(P)}}_.length>0&&(p||(m=f))}let g;for(let p=0,_=d.length;p<_;p++){c=d[p].s,u.push(c),g=m[p];for(let y=0,M=g.length;y<M;y++)c.holes.push(g[y].h)}return u}}const bd=new Float32Array(1),nv=new Int32Array(bd.buffer);class iv{static toHalfFloat(e){e>65504&&(console.warn("THREE.DataUtils.toHalfFloat(): value exceeds 65504."),e=65504),bd[0]=e;const t=nv[0];let n=t>>16&32768,i=t>>12&2047;const s=t>>23&255;return s<103?n:s>142?(n|=31744,n|=(s==255?0:1)&&t&8388607,n):s<113?(i|=2048,n|=(i>>114-s)+(i>>113-s&1),n):(n|=s-112<<10|i>>1,n+=i&1,n)}}const rv=0,sv=1,ov=0,av=1,lv=2;function cv(r){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),r}function uv(r=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),r.isMultiMaterial=!0,r.materials=r,r.clone=function(){return r.slice()},r}function hv(r,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new ts(r,e)}function fv(r){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new go(r)}function dv(r,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new ts(r,e)}function pv(r){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new yi(r)}function mv(r){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new yi(r)}function gv(r){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new yi(r)}function xv(r,e,t){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new S(r,e,t)}function yv(r,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new ze(r,e).setUsage(Ui)}function vv(r,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new th(r,e)}function _v(r,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new nh(r,e)}function Mv(r,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new ih(r,e)}function bv(r,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new rh(r,e)}function wv(r,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ws(r,e)}function Sv(r,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new sh(r,e)}function Tv(r,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new qs(r,e)}function Ev(r,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new de(r,e)}function Av(r,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new ah(r,e)}Ot.create=function(r,e){return console.log("THREE.Curve.create() has been deprecated"),r.prototype=Object.create(Ot.prototype),r.prototype.constructor=r,r.prototype.getPoint=e,r},os.prototype.fromPoints=function(r){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(r)};function Cv(r){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Md(r)}function Lv(r,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new vd(r,e)}function Rv(r,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Dt(new ml(r.geometry),new Mt({color:e!==void 0?e:16777215}))}gd.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},fd.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};function Pv(r,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Dt(new El(r.geometry),new Mt({color:e!==void 0?e:16777215}))}It.prototype.extractUrlBase=function(r){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Uo.extractUrlBase(r)},It.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};function Iv(r){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new an(r)}function Dv(r){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new If(r)}br.prototype.center=function(r){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(r)},br.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},br.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},br.prototype.size=function(r){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(r)},Rt.prototype.center=function(r){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(r)},Rt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Rt.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},Rt.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)},Rt.prototype.size=function(r){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(r)},Dn.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},qr.prototype.setFromMatrix=function(r){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(r)},ud.prototype.center=function(r){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(r)},mt.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)},mt.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)},mt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},mt.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)},mt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},mt.prototype.getInverse=function(r){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()},ge.prototype.extractPosition=function(r){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(r)},ge.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)},ge.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new S().setFromMatrixColumn(this,3)},ge.prototype.setRotationFromQuaternion=function(r){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(r)},ge.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},ge.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},ge.prototype.multiplyVector4=function(r){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},ge.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},ge.prototype.rotateAxis=function(r){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),r.transformDirection(this)},ge.prototype.crossVector=function(r){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},ge.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},ge.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},ge.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},ge.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},ge.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},ge.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},ge.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},ge.prototype.makeFrustum=function(r,e,t,n,i,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(r,e,n,t,i,s)},ge.prototype.getInverse=function(r){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()},tn.prototype.isIntersectionLine=function(r){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(r)},Tt.prototype.multiplyVector3=function(r){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),r.applyQuaternion(this)},Tt.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Bn.prototype.isIntersectionBox=function(r){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},Bn.prototype.isIntersectionPlane=function(r){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(r)},Bn.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)},st.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},st.prototype.barycoordFromPoint=function(r,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(r,e)},st.prototype.midpoint=function(r){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(r)},st.prototypenormal=function(r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(r)},st.prototype.plane=function(r){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(r)},st.barycoordFromPoint=function(r,e,t,n,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),st.getBarycoord(r,e,t,n,i)},st.normal=function(r,e,t,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),st.getNormal(r,e,t,n)},Jt.prototype.extractAllPoints=function(r){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(r)},Jt.prototype.extrude=function(r){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new on(this,r)},Jt.prototype.makeGeometry=function(r){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new _i(this,r)},W.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)},W.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)},W.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},S.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},S.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},S.prototype.getPositionFromMatrix=function(r){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(r)},S.prototype.getScaleFromMatrix=function(r){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(r)},S.prototype.getColumnFromMatrix=function(r,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,r)},S.prototype.applyProjection=function(r){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(r)},S.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)},S.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)},S.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},We.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)},We.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Ne.prototype.getChildByName=function(r){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(r)},Ne.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Ne.prototype.translate=function(r,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,r)},Ne.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Ne.prototype.applyMatrix=function(r){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)},Object.defineProperties(Ne.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(r){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=r}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),ft.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(ft.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Fu},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),vo.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},_t.prototype.setLens=function(r,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(r)},Object.defineProperties($t.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(r){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=r}},shadowCameraLeft:{set:function(r){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=r}},shadowCameraRight:{set:function(r){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=r}},shadowCameraTop:{set:function(r){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=r}},shadowCameraBottom:{set:function(r){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=r}},shadowCameraNear:{set:function(r){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=r}},shadowCameraFar:{set:function(r){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=r}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(r){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=r}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(r){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=r}},shadowMapHeight:{set:function(r){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=r}}}),Object.defineProperties(ze.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Ui},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Ui)}}}),ze.prototype.setDynamic=function(r){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?Ui:zi),this},ze.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},ze.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},ve.prototype.addIndex=function(r){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(r)},ve.prototype.addAttribute=function(r,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(r,new ze(arguments[1],arguments[2]))):r==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(r,e)},ve.prototype.addDrawCall=function(r,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(r,e)},ve.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},ve.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},ve.prototype.removeAttribute=function(r){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(r)},ve.prototype.applyMatrix=function(r){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)},Object.defineProperties(ve.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),mi.prototype.setDynamic=function(r){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?Ui:zi),this},mi.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},on.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},on.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},on.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},ho.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Go.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(yt.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new le}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(r){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=r===la}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(r){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=r}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(bn.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(r){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=r}}}),qe.prototype.clearTarget=function(r,e,t,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(r),this.clear(e,t,n)},qe.prototype.animate=function(r){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(r)},qe.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},qe.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},qe.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},qe.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},qe.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},qe.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},qe.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},qe.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},qe.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},qe.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},qe.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},qe.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},qe.prototype.enableScissorTest=function(r){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(r)},qe.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},qe.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},qe.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},qe.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},qe.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},qe.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},qe.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},qe.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},qe.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},qe.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(qe.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=r}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=r}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(r){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=r===!0?ri:Ht}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}}),Object.defineProperties(Wh.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});function Fv(r,e,t){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new to(r,t)}Object.defineProperties(Nt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=r}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=r}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=r}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=r}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(r){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=r}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(r){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=r}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(r){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=r}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(r){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=r}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(r){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=r}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(r){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=r}}}),Zl.prototype.load=function(r){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return new Xf().load(r,function(n){e.setBuffer(n)}),this},td.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},eo.prototype.updateCubeMap=function(r,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(r,e)},eo.prototype.clear=function(r,e,t,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(r,e,t,n)},ai.crossOrigin=void 0,ai.loadTexture=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new Df;i.setCrossOrigin(this.crossOrigin);const s=i.load(r,t,void 0,n);return e&&(s.mapping=e),s},ai.loadTextureCube=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new Pf;i.setCrossOrigin(this.crossOrigin);const s=i.load(r,t,void 0,n);return e&&(s.mapping=e),s},ai.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},ai.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};function Bv(){console.error("THREE.CanvasRenderer has been removed")}function Nv(){console.error("THREE.JSONLoader has been removed.")}const zv={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function Uv(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}function Ov(){return console.error("THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"),new ve}function Gv(){return console.error("THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js"),new ve}function Hv(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")}function Vv(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")}function kv(){console.error("THREE.ImmediateRenderObject has been removed.")}typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Xn}})),typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Xn);function MM(r){r.computeTangents(),console.warn("THREE.BufferGeometryUtils: .computeTangents() has been removed. Use BufferGeometry.computeTangents() instead.")}function Wv(r,e=!1){const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},o={},a=r[0].morphTargetsRelative,l=new ve;let c=0;for(let u=0;u<r.length;++u){const h=r[u];let f=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const d in h.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;s[d]===void 0&&(s[d]=[]),s[d].push(h.attributes[d]),f++}if(f!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const d in h.morphAttributes){if(!i.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(h.morphAttributes[d])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(h.userData),e){let d;if(t)d=h.index.count;else if(h.attributes.position!==void 0)d=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,d,u),c+=d}}if(t){let u=0;const h=[];for(let f=0;f<r.length;++f){const d=r[f].index;for(let m=0;m<d.count;++m)h.push(d.getX(m)+u);u+=r[f].attributes.position.count}l.setIndex(h)}for(const u in s){const h=wd(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,h)}for(const u in o){const h=o[u][0].length;if(h===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let f=0;f<h;++f){const d=[];for(let x=0;x<o[u].length;++x)d.push(o[u][x][f]);const m=wd(d);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(m)}}return l}function wd(r){let e,t,n,i=0;for(let a=0;a<r.length;++a){const l=r[a];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=l.normalized),n!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=l.array.length}const s=new e(i);let o=0;for(let a=0;a<r.length;++a)s.set(r[a].array,o),o+=r[a].array.length;return new ze(s,t,n)}function bM(r){let e,t=0,n=0;for(let c=0,u=r.length;c<u;++c){const h=r[c];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;t+=h.array.length,n+=h.itemSize}const i=new InterleavedBuffer(new e(t),n);let s=0;const o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let c=0,u=r.length;c<u;c++){const h=r[c],f=h.itemSize,d=h.count,m=new InterleavedBufferAttribute(i,f,s,h.normalized);o.push(m),s+=f;for(let x=0;x<d;x++)for(let v=0;v<f;v++)m[l[v]](x,h[a[v]](x))}return o}function wM(r){let e=0;for(const n in r.attributes){const i=r.getAttribute(n);e+=i.count*i.itemSize*i.array.BYTES_PER_ELEMENT}const t=r.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function SM(r,e=1e-4){e=Math.max(e,Number.EPSILON);const t={},n=r.getIndex(),i=r.getAttribute("position"),s=n?n.count:i.count;let o=0;const a=Object.keys(r.attributes),l={},c={},u=[],h=["getX","getY","getZ","getW"];for(let x=0,v=a.length;x<v;x++){const g=a[x];l[g]=[];const p=r.morphAttributes[g];p&&(c[g]=new Array(p.length).fill().map(()=>[]))}const f=Math.log10(1/e),d=Math.pow(10,f);for(let x=0;x<s;x++){const v=n?n.getX(x):x;let g="";for(let p=0,_=a.length;p<_;p++){const y=a[p],M=r.getAttribute(y),b=M.itemSize;for(let E=0;E<b;E++)g+=`${~~(M[h[E]](v)*d)},`}if(g in t)u.push(t[g]);else{for(let p=0,_=a.length;p<_;p++){const y=a[p],M=r.getAttribute(y),b=r.morphAttributes[y],E=M.itemSize,P=l[y],z=c[y];for(let N=0;N<E;N++){const I=h[N];if(P.push(M[I](v)),b)for(let w=0,T=b.length;w<T;w++)z[w].push(b[w][I](v))}}t[g]=o,u.push(o),o++}}const m=r.clone();for(let x=0,v=a.length;x<v;x++){const g=a[x],p=r.getAttribute(g),_=new p.array.constructor(l[g]),y=new BufferAttribute(_,p.itemSize,p.normalized);if(m.setAttribute(g,y),g in c)for(let M=0;M<c[g].length;M++){const b=r.morphAttributes[g][M],E=new b.array.constructor(c[g][M]),P=new BufferAttribute(E,b.itemSize,b.normalized);m.morphAttributes[g][M]=P}}return m.setIndex(u),m}function TM(r,e){if(e===TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===TriangleFanDrawMode||e===TriangleStripDrawMode){let t=r.getIndex();if(t===null){const o=[],a=r.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);r.setIndex(o),t=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}const n=t.count-2,i=[];if(e===TriangleFanDrawMode)for(let o=1;o<=n;o++)i.push(t.getX(0)),i.push(t.getX(o)),i.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(i.push(t.getX(o)),i.push(t.getX(o+1)),i.push(t.getX(o+2))):(i.push(t.getX(o+2)),i.push(t.getX(o+1)),i.push(t.getX(o)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=r.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}function EM(r){if(r.geometry.isBufferGeometry!==!0)return console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry."),null;const e=new Vector3,t=new Vector3,n=new Vector3,i=new Vector3,s=new Vector3,o=new Vector3,a=new Vector3,l=new Vector3,c=new Vector3;function u(V,q,ne,K,he,Me,Y,be,pe){e.fromBufferAttribute(ne,Me),t.fromBufferAttribute(ne,Y),n.fromBufferAttribute(ne,be);const me=V.morphTargetInfluences;if(q.morphTargets&&K&&me){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let ye=0,Oe=K.length;ye<Oe;ye++){const k=me[ye],$=K[ye];k!==0&&(i.fromBufferAttribute($,Me),s.fromBufferAttribute($,Y),o.fromBufferAttribute($,be),he?(a.addScaledVector(i,k),l.addScaledVector(s,k),c.addScaledVector(o,k)):(a.addScaledVector(i.sub(e),k),l.addScaledVector(s.sub(t),k),c.addScaledVector(o.sub(n),k)))}e.add(a),t.add(l),n.add(c)}V.isSkinnedMesh&&(V.boneTransform(Me,e),V.boneTransform(Y,t),V.boneTransform(be,n)),pe[Me*3+0]=e.x,pe[Me*3+1]=e.y,pe[Me*3+2]=e.z,pe[Y*3+0]=t.x,pe[Y*3+1]=t.y,pe[Y*3+2]=t.z,pe[be*3+0]=n.x,pe[be*3+1]=n.y,pe[be*3+2]=n.z}const h=r.geometry,f=r.material;let d,m,x;const v=h.index,g=h.attributes.position,p=h.morphAttributes.position,_=h.morphTargetsRelative,y=h.attributes.normal,M=h.morphAttributes.position,b=h.groups,E=h.drawRange;let P,z,N,I,w,T,B,L;const F=new Float32Array(g.count*g.itemSize),U=new Float32Array(y.count*y.itemSize);if(v!==null)if(Array.isArray(f))for(P=0,N=b.length;P<N;P++)for(w=b[P],T=f[w.materialIndex],B=Math.max(w.start,E.start),L=Math.min(w.start+w.count,E.start+E.count),z=B,I=L;z<I;z+=3)d=v.getX(z),m=v.getX(z+1),x=v.getX(z+2),u(r,T,g,p,_,d,m,x,F),u(r,T,y,M,_,d,m,x,U);else for(B=Math.max(0,E.start),L=Math.min(v.count,E.start+E.count),P=B,N=L;P<N;P+=3)d=v.getX(P),m=v.getX(P+1),x=v.getX(P+2),u(r,f,g,p,_,d,m,x,F),u(r,f,y,M,_,d,m,x,U);else if(g!==void 0)if(Array.isArray(f))for(P=0,N=b.length;P<N;P++)for(w=b[P],T=f[w.materialIndex],B=Math.max(w.start,E.start),L=Math.min(w.start+w.count,E.start+E.count),z=B,I=L;z<I;z+=3)d=z,m=z+1,x=z+2,u(r,T,g,p,_,d,m,x,F),u(r,T,y,M,_,d,m,x,U);else for(B=Math.max(0,E.start),L=Math.min(g.count,E.start+E.count),P=B,N=L;P<N;P+=3)d=P,m=P+1,x=P+2,u(r,f,g,p,_,d,m,x,F),u(r,f,y,M,_,d,m,x,U);const Z=new Float32BufferAttribute(F,3),ee=new Float32BufferAttribute(U,3);return{positionAttribute:g,normalAttribute:y,morphedPositionAttribute:Z,morphedNormalAttribute:ee}}var Ri=new Map,qv=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(e,t,n,i,s){var o=t[n*3],a=t[n*3+1],l=t[i*3],c=t[i*3+1],u=t[s*3],h=t[s*3+1],f;if(Ri.has(e))f=Ri.get(e);else{var d=r.box3||new Rt;if(!r.box3){var m=e.parameters.shapes.getPoints();d.setFromArray(m.map(function(_){return[_.x,_.y,0]}).flat())}var x=d.getSize(new S);r.split&&(x.y/=r.split),f={box:d,size:x},Ri.set(e,f)}var v=f.box,g=f.size,p=r.split?1-r.split:0;return[new W((o-v.min.x)/g.x,(a-v.min.y)/g.y+p),new W((l-v.min.x)/g.x,(c-v.min.y)/g.y+p),new W((u-v.min.x)/g.x,(h-v.min.y)/g.y+p)]},generateSideWallUV:function(e,t,n,i,s,o){var a=t[n*3],l=t[n*3+1],c=t[n*3+2],u=t[i*3],h=t[i*3+1],f=t[i*3+2],d=t[s*3],m=t[s*3+1],x=t[s*3+2],v=t[o*3],g=t[o*3+1],p=t[o*3+2],_;if(Ri.has(t))_=Ri.get(t);else{var y=new Rt;y.setFromArray(t);var M=y.getSize(new S);r.split&&(M.z/=1-r.split),_={box:y,size:M},Ri.set(t,_)}var b=_.box,E=_.size;return Math.abs(l-h)<Math.abs(a-u)?[new W((a-b.min.x)/E.x,(c-b.min.z)/E.z),new W((u-b.min.x)/E.x,(f-b.min.z)/E.z),new W((d-b.min.x)/E.x,(x-b.min.z)/E.z),new W((v-b.min.x)/E.x,(p-b.min.z)/E.z)]:[new W((l-b.min.y)/E.x,(c-b.min.z)/E.z),new W((h-b.min.y)/E.x,(f-b.min.z)/E.z),new W((m-b.min.y)/E.x,(x-b.min.z)/E.z),new W((g-b.min.y)/E.x,(p-b.min.z)/E.z)]}}},Xv=function(){Ri.clear()},Yv=+Xn<144,Jv=Yv?"ExtrudeBufferGeometry":"ExtrudeGeometry",AM=null;function Zv(r){var e=r.split,t=r.depth,n=r.points,i=new pt[Jv](new Jt(n),{depth:t,bevelEnabled:!1,UVGenerator:qv({split:e})});return Xv(),i}function $v(r){if(Array.isArray(r))return r}function jv(r){if(typeof Symbol!="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function Qv(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Sd(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function Kv(r,e){if(!!r){if(typeof r=="string")return Sd(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Sd(r,e)}}function Td(r,e){return $v(r)||jv(r,e)||Kv(r,e)||Qv()}var Je=1e-6,e_=1e-12,Ue=Math.PI,Ft=Ue/2,Ed=Ue/4,kt=Ue*2,Gt=180/Ue,dt=Ue/180,lt=Math.abs,Ad=Math.atan,gs=Math.atan2,ct=Math.cos,CM=Math.ceil,t_=Math.exp,LM=Math.floor,RM=Math.hypot,n_=Math.log,PM=Math.pow,tt=Math.sin,i_=Math.sign||function(r){return r>0?1:r<0?-1:0},Yo=Math.sqrt,r_=Math.tan;function s_(r){return r>1?0:r<-1?Ue:Math.acos(r)}function xs(r){return r>1?Ft:r<-1?-Ft:Math.asin(r)}function IM(r){return(r=tt(r/2))*r}function tc(r,e){function t(n,i){return n=r(n,i),e(n[0],n[1])}return r.invert&&e.invert&&(t.invert=function(n,i){return n=e.invert(n,i),n&&r.invert(n[0],n[1])}),t}function nc(r,e){return[lt(r)>Ue?r+Math.round(-r/kt)*kt:r,e]}nc.invert=nc;function Cd(r,e,t){return(r%=kt)?e||t?tc(Rd(r),Pd(e,t)):Rd(r):e||t?Pd(e,t):nc}function Ld(r){return function(e,t){return e+=r,[e>Ue?e-kt:e<-Ue?e+kt:e,t]}}function Rd(r){var e=Ld(r);return e.invert=Ld(-r),e}function Pd(r,e){var t=ct(r),n=tt(r),i=ct(e),s=tt(e);function o(a,l){var c=ct(l),u=ct(a)*c,h=tt(a)*c,f=tt(l),d=f*t+u*n;return[gs(h*i-d*s,u*t-f*n),xs(d*i+h*s)]}return o.invert=function(a,l){var c=ct(l),u=ct(a)*c,h=tt(a)*c,f=tt(l),d=f*i-h*s;return[gs(h*i+f*s,u*t+d*n),xs(d*t-u*n)]},o}function o_(r){r=Cd(r[0]*dt,r[1]*dt,r.length>2?r[2]*dt:0);function e(t){return t=r(t[0]*dt,t[1]*dt),t[0]*=Gt,t[1]*=Gt,t}return e.invert=function(t){return t=r.invert(t[0]*dt,t[1]*dt),t[0]*=Gt,t[1]*=Gt,t},e}function ys(){}function Id(){var r=[],e;return{point:function(t,n,i){e.push([t,n,i])},lineStart:function(){r.push(e=[])},lineEnd:ys,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var t=r;return r=[],e=null,t}}}function Jo(r,e){return lt(r[0]-e[0])<Je&<(r[1]-e[1])<Je}function Zo(r,e,t,n){this.x=r,this.z=e,this.o=t,this.e=n,this.v=!1,this.n=this.p=null}function Dd(r,e,t,n,i){var s=[],o=[],a,l;if(r.forEach(function(m){if(!((x=m.length-1)<=0)){var x,v=m[0],g=m[x],p;if(Jo(v,g)){if(!v[2]&&!g[2]){for(i.lineStart(),a=0;a<x;++a)i.point((v=m[a])[0],v[1]);i.lineEnd();return}g[0]+=2*Je}s.push(p=new Zo(v,m,null,!0)),o.push(p.o=new Zo(v,null,p,!1)),s.push(p=new Zo(g,m,null,!1)),o.push(p.o=new Zo(g,null,p,!0))}}),!!s.length){for(o.sort(e),Fd(s),Fd(o),a=0,l=o.length;a<l;++a)o[a].e=t=!t;for(var c=s[0],u,h;;){for(var f=c,d=!0;f.v;)if((f=f.n)===c)return;u=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(d)for(a=0,l=u.length;a<l;++a)i.point((h=u[a])[0],h[1]);else n(f.x,f.n.x,1,i);f=f.n}else{if(d)for(u=f.p.z,a=u.length-1;a>=0;--a)i.point((h=u[a])[0],h[1]);else n(f.x,f.p.x,-1,i);f=f.p}f=f.o,u=f.z,d=!d}while(!f.v);i.lineEnd()}}}function Fd(r){if(!!(e=r.length)){for(var e,t=0,n=r[0],i;++t<e;)n.n=i=r[t],i.p=n,n=i;n.n=i=r[0],i.p=n}}class ic{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const t=this._partials;let n=0;for(let i=0;i<this._n&&i<32;i++){const s=t[i],o=e+s,a=Math.abs(e)<Math.abs(s)?e-(o-s):s-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){const e=this._partials;let t=this._n,n,i,s,o=0;if(t>0){for(o=e[--t];t>0&&(n=o,i=e[--t],o=n+i,s=i-(o-n),!s););t>0&&(s<0&&e[t-1]<0||s>0&&e[t-1]>0)&&(i=s*2,n=o+i,i==n-o&&(o=n))}return o}}function DM(r,e){const t=new ic;if(e===void 0)for(let n of r)(n=+n)&&t.add(n);else{let n=-1;for(let i of r)(i=+e(i,++n,r))&&t.add(i)}return+t}function FM(r,e){const t=new ic;let n=-1;return Float64Array.from(r,e===void 0?i=>t.add(+i||0):i=>t.add(+e(i,++n,r)||0))}function rc(r){return[gs(r[1],r[0]),xs(r[2])]}function wr(r){var e=r[0],t=r[1],n=ct(t);return[n*ct(e),n*tt(e),tt(t)]}function $o(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function jo(r,e){return[r[1]*e[2]-r[2]*e[1],r[2]*e[0]-r[0]*e[2],r[0]*e[1]-r[1]*e[0]]}function sc(r,e){r[0]+=e[0],r[1]+=e[1],r[2]+=e[2]}function Qo(r,e){return[r[0]*e,r[1]*e,r[2]*e]}function oc(r){var e=Yo(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=e,r[1]/=e,r[2]/=e}function ac(r){return lt(r[0])<=Ue?r[0]:i_(r[0])*((lt(r[0])+Ue)%kt-Ue)}function a_(r,e){var t=ac(e),n=e[1],i=tt(n),s=[tt(t),-ct(t),0],o=0,a=0,l=new ic;i===1?n=Ft+Je:i===-1&&(n=-Ft-Je);for(var c=0,u=r.length;c<u;++c)if(!!(f=(h=r[c]).length))for(var h,f,d=h[f-1],m=ac(d),x=d[1]/2+Ed,v=tt(x),g=ct(x),p=0;p<f;++p,m=y,v=b,g=E,d=_){var _=h[p],y=ac(_),M=_[1]/2+Ed,b=tt(M),E=ct(M),P=y-m,z=P>=0?1:-1,N=z*P,I=N>Ue,w=v*b;if(l.add(gs(w*z*tt(N),g*E+w*ct(N))),o+=I?P+z*kt:P,I^m>=t^y>=t){var T=jo(wr(d),wr(_));oc(T);var B=jo(s,T);oc(B);var L=(I^P>=0?-1:1)*xs(B[2]);(n>L||n===L&&(T[0]||T[1]))&&(a+=I^P>=0?1:-1)}}return(o<-Je||o<Je&&l<-e_)^a&1}function*l_(r){for(const e of r)yield*e}function Bd(r){return Array.from(l_(r))}function Nd(r,e,t,n){return function(i){var s=e(i),o=Id(),a=e(o),l=!1,c,u,h,f={point:d,lineStart:x,lineEnd:v,polygonStart:function(){f.point=g,f.lineStart=p,f.lineEnd=_,u=[],c=[]},polygonEnd:function(){f.point=d,f.lineStart=x,f.lineEnd=v,u=Bd(u);var y=a_(c,n);u.length?(l||(i.polygonStart(),l=!0),Dd(u,u_,y,t,i)):y&&(l||(i.polygonStart(),l=!0),i.lineStart(),t(null,null,1,i),i.lineEnd()),l&&(i.polygonEnd(),l=!1),u=c=null},sphere:function(){i.polygonStart(),i.lineStart(),t(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(y,M){r(y,M)&&i.point(y,M)}function m(y,M){s.point(y,M)}function x(){f.point=m,s.lineStart()}function v(){f.point=d,s.lineEnd()}function g(y,M){h.push([y,M]),a.point(y,M)}function p(){a.lineStart(),h=[]}function _(){g(h[0][0],h[0][1]),a.lineEnd();var y=a.clean(),M=o.result(),b,E=M.length,P,z,N;if(h.pop(),c.push(h),h=null,!!E){if(y&1){if(z=M[0],(P=z.length-1)>0){for(l||(i.polygonStart(),l=!0),i.lineStart(),b=0;b<P;++b)i.point((N=z[b])[0],N[1]);i.lineEnd()}return}E>1&&y&2&&M.push(M.pop().concat(M.shift())),u.push(M.filter(c_))}}return f}}function c_(r){return r.length>1}function u_(r,e){return((r=r.x)[0]<0?r[1]-Ft-Je:Ft-r[1])-((e=e.x)[0]<0?e[1]-Ft-Je:Ft-e[1])}var zd=Nd(function(){return!0},h_,d_,[-Ue,-Ft]);function h_(r){var e=NaN,t=NaN,n=NaN,i;return{lineStart:function(){r.lineStart(),i=1},point:function(s,o){var a=s>0?Ue:-Ue,l=lt(s-e);lt(l-Ue)<Je?(r.point(e,t=(t+o)/2>0?Ft:-Ft),r.point(n,t),r.lineEnd(),r.lineStart(),r.point(a,t),r.point(s,t),i=0):n!==a&&l>=Ue&&(lt(e-n)<Je&&(e-=n*Je),lt(s-a)<Je&&(s-=a*Je),t=f_(e,t,s,o),r.point(n,t),r.lineEnd(),r.lineStart(),r.point(a,t),i=0),r.point(e=s,t=o),n=a},lineEnd:function(){r.lineEnd(),e=t=NaN},clean:function(){return 2-i}}}function f_(r,e,t,n){var i,s,o=tt(r-t);return lt(o)>Je?Ad((tt(e)*(s=ct(n))*tt(t)-tt(n)*(i=ct(e))*tt(r))/(i*s*o)):(e+n)/2}function d_(r,e,t,n){var i;if(r==null)i=t*Ft,n.point(-Ue,i),n.point(0,i),n.point(Ue,i),n.point(Ue,0),n.point(Ue,-i),n.point(0,-i),n.point(-Ue,-i),n.point(-Ue,0),n.point(-Ue,i);else if(lt(r[0]-e[0])>Je){var s=r[0]<e[0]?Ue:-Ue;i=t*s/2,n.point(-s,i),n.point(0,i),n.point(s,i)}else n.point(e[0],e[1])}function Ud(r,e,t,n,i,s){if(!!t){var o=ct(e),a=tt(e),l=n*t;i==null?(i=e+n*kt,s=e-l/2):(i=Od(o,i),s=Od(o,s),(n>0?i<s:i>s)&&(i+=n*kt));for(var c,u=i;n>0?u>s:u<s;u-=l)c=rc([o,-a*ct(u),-a*tt(u)]),r.point(c[0],c[1])}}function Od(r,e){e=wr(e),e[0]-=r,oc(e);var t=s_(-e[1]);return((-e[2]<0?-t:t)+kt-Je)%kt}function BM(){var r=constant([0,0]),e=constant(90),t=constant(6),n,i,s={point:o};function o(l,c){n.push(l=i(l,c)),l[0]*=degrees,l[1]*=degrees}function a(){var l=r.apply(this,arguments),c=e.apply(this,arguments)*radians,u=t.apply(this,arguments)*radians;return n=[],i=rotateRadians(-l[0]*radians,-l[1]*radians,0).invert,Ud(s,c,u,1),l={type:"Polygon",coordinates:[n]},n=i=null,l}return a.center=function(l){return arguments.length?(r=typeof l=="function"?l:constant([+l[0],+l[1]]),a):r},a.radius=function(l){return arguments.length?(e=typeof l=="function"?l:constant(+l),a):e},a.precision=function(l){return arguments.length?(t=typeof l=="function"?l:constant(+l),a):t},a}function p_(r){var e=ct(r),t=6*dt,n=e>0,i=lt(e)>Je;function s(u,h,f,d){Ud(d,r,t,f,u,h)}function o(u,h){return ct(u)*ct(h)>e}function a(u){var h,f,d,m,x;return{lineStart:function(){m=d=!1,x=1},point:function(v,g){var p=[v,g],_,y=o(v,g),M=n?y?0:c(v,g):y?c(v+(v<0?Ue:-Ue),g):0;if(!h&&(m=d=y)&&u.lineStart(),y!==d&&(_=l(h,p),(!_||Jo(h,_)||Jo(p,_))&&(p[2]=1)),y!==d)x=0,y?(u.lineStart(),_=l(p,h),u.point(_[0],_[1])):(_=l(h,p),u.point(_[0],_[1],2),u.lineEnd()),h=_;else if(i&&h&&n^y){var b;!(M&f)&&(b=l(p,h,!0))&&(x=0,n?(u.lineStart(),u.point(b[0][0],b[0][1]),u.point(b[1][0],b[1][1]),u.lineEnd()):(u.point(b[1][0],b[1][1]),u.lineEnd(),u.lineStart(),u.point(b[0][0],b[0][1],3)))}y&&(!h||!Jo(h,p))&&u.point(p[0],p[1]),h=p,d=y,f=M},lineEnd:function(){d&&u.lineEnd(),h=null},clean:function(){return x|(m&&d)<<1}}}function l(u,h,f){var d=wr(u),m=wr(h),x=[1,0,0],v=jo(d,m),g=$o(v,v),p=v[0],_=g-p*p;if(!_)return!f&&u;var y=e*g/_,M=-e*p/_,b=jo(x,v),E=Qo(x,y),P=Qo(v,M);sc(E,P);var z=b,N=$o(E,z),I=$o(z,z),w=N*N-I*($o(E,E)-1);if(!(w<0)){var T=Yo(w),B=Qo(z,(-N-T)/I);if(sc(B,E),B=rc(B),!f)return B;var L=u[0],F=h[0],U=u[1],Z=h[1],ee;F<L&&(ee=L,L=F,F=ee);var V=F-L,q=lt(V-Ue)<Je,ne=q||V<Je;if(!q&&Z<U&&(ee=U,U=Z,Z=ee),ne?q?U+Z>0^B[1]<(lt(B[0]-L)<Je?U:Z):U<=B[1]&&B[1]<=Z:V>Ue^(L<=B[0]&&B[0]<=F)){var K=Qo(z,(-N+T)/I);return sc(K,E),[B,rc(K)]}}}function c(u,h){var f=n?r:Ue-r,d=0;return u<-f?d|=1:u>f&&(d|=2),h<-f?d|=4:h>f&&(d|=8),d}return Nd(o,a,s,n?[0,-r]:[-Ue,r-Ue])}function m_(r,e,t,n,i,s){var o=r[0],a=r[1],l=e[0],c=e[1],u=0,h=1,f=l-o,d=c-a,m;if(m=t-o,!(!f&&m>0)){if(m/=f,f<0){if(m<u)return;m<h&&(h=m)}else if(f>0){if(m>h)return;m>u&&(u=m)}if(m=i-o,!(!f&&m<0)){if(m/=f,f<0){if(m>h)return;m>u&&(u=m)}else if(f>0){if(m<u)return;m<h&&(h=m)}if(m=n-a,!(!d&&m>0)){if(m/=d,d<0){if(m<u)return;m<h&&(h=m)}else if(d>0){if(m>h)return;m>u&&(u=m)}if(m=s-a,!(!d&&m<0)){if(m/=d,d<0){if(m>h)return;m>u&&(u=m)}else if(d>0){if(m<u)return;m<h&&(h=m)}return u>0&&(r[0]=o+u*f,r[1]=a+u*d),h<1&&(e[0]=o+h*f,e[1]=a+h*d),!0}}}}}var vs=1e9,Ko=-vs;function g_(r,e,t,n){function i(c,u){return r<=c&&c<=t&&e<=u&&u<=n}function s(c,u,h,f){var d=0,m=0;if(c==null||(d=o(c,h))!==(m=o(u,h))||l(c,u)<0^h>0)do f.point(d===0||d===3?r:t,d>1?n:e);while((d=(d+h+4)%4)!==m);else f.point(u[0],u[1])}function o(c,u){return lt(c[0]-r)<Je?u>0?0:3:lt(c[0]-t)<Je?u>0?2:1:lt(c[1]-e)<Je?u>0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var h=o(c,1),f=o(u,1);return h!==f?h-f:h===0?u[1]-c[1]:h===1?c[0]-u[0]:h===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,h=Id(),f,d,m,x,v,g,p,_,y,M,b,E={point:P,lineStart:w,lineEnd:T,polygonStart:N,polygonEnd:I};function P(L,F){i(L,F)&&u.point(L,F)}function z(){for(var L=0,F=0,U=d.length;F<U;++F)for(var Z=d[F],ee=1,V=Z.length,q=Z[0],ne,K,he=q[0],Me=q[1];ee<V;++ee)ne=he,K=Me,q=Z[ee],he=q[0],Me=q[1],K<=n?Me>n&&(he-ne)*(n-K)>(Me-K)*(r-ne)&&++L:Me<=n&&(he-ne)*(n-K)<(Me-K)*(r-ne)&&--L;return L}function N(){u=h,f=[],d=[],b=!0}function I(){var L=z(),F=b&&L,U=(f=Bd(f)).length;(F||U)&&(c.polygonStart(),F&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),U&&Dd(f,a,L,s,c),c.polygonEnd()),u=c,f=d=m=null}function w(){E.point=B,d&&d.push(m=[]),M=!0,y=!1,p=_=NaN}function T(){f&&(B(x,v),g&&y&&h.rejoin(),f.push(h.result())),E.point=P,y&&u.lineEnd()}function B(L,F){var U=i(L,F);if(d&&m.push([L,F]),M)x=L,v=F,g=U,M=!1,U&&(u.lineStart(),u.point(L,F));else if(U&&y)u.point(L,F);else{var Z=[p=Math.max(Ko,Math.min(vs,p)),_=Math.max(Ko,Math.min(vs,_))],ee=[L=Math.max(Ko,Math.min(vs,L)),F=Math.max(Ko,Math.min(vs,F))];m_(Z,ee,r,e,t,n)?(y||(u.lineStart(),u.point(Z[0],Z[1])),u.point(ee[0],ee[1]),U||u.lineEnd(),b=!1):U&&(u.lineStart(),u.point(L,F),b=!1)}p=L,_=F,y=U}return E}}var Gd=r=>r;function NM(r){return{stream:ea(r)}}function ea(r){return function(e){var t=new lc;for(var n in r)t[n]=r[n];return t.stream=e,t}}function lc(){}lc.prototype={constructor:lc,point:function(r,e){this.stream.point(r,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function ta(r,e){r&&Vd.hasOwnProperty(r.type)&&Vd[r.type](r,e)}var Hd={Feature:function(r,e){ta(r.geometry,e)},FeatureCollection:function(r,e){for(var t=r.features,n=-1,i=t.length;++n<i;)ta(t[n].geometry,e)}},Vd={Sphere:function(r,e){e.sphere()},Point:function(r,e){r=r.coordinates,e.point(r[0],r[1],r[2])},MultiPoint:function(r,e){for(var t=r.coordinates,n=-1,i=t.length;++n<i;)r=t[n],e.point(r[0],r[1],r[2])},LineString:function(r,e){cc(r.coordinates,e,0)},MultiLineString:function(r,e){for(var t=r.coordinates,n=-1,i=t.length;++n<i;)cc(t[n],e,0)},Polygon:function(r,e){kd(r.coordinates,e)},MultiPolygon:function(r,e){for(var t=r.coordinates,n=-1,i=t.length;++n<i;)kd(t[n],e)},GeometryCollection:function(r,e){for(var t=r.geometries,n=-1,i=t.length;++n<i;)ta(t[n],e)}};function cc(r,e,t){var n=-1,i=r.length-t,s;for(e.lineStart();++n<i;)s=r[n],e.point(s[0],s[1],s[2]);e.lineEnd()}function kd(r,e){var t=-1,n=r.length;for(e.polygonStart();++t<n;)cc(r[t],e,1);e.polygonEnd()}function x_(r,e){r&&Hd.hasOwnProperty(r.type)?Hd[r.type](r,e):ta(r,e)}var Sr=1/0,na=Sr,_s=-Sr,ia=_s,y_={point:v_,lineStart:ys,lineEnd:ys,polygonStart:ys,polygonEnd:ys,result:function(){var r=[[Sr,na],[_s,ia]];return _s=ia=-(na=Sr=1/0),r}};function v_(r,e){r<Sr&&(Sr=r),r>_s&&(_s=r),e<na&&(na=e),e>ia&&(ia=e)}var Wd=y_;function uc(r,e,t){var n=r.clipExtent&&r.clipExtent();return r.scale(150).translate([0,0]),n!=null&&r.clipExtent(null),x_(t,r.stream(Wd)),e(Wd.result()),n!=null&&r.clipExtent(n),r}function qd(r,e,t){return uc(r,function(n){var i=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=Math.min(i/(n[1][0]-n[0][0]),s/(n[1][1]-n[0][1])),a=+e[0][0]+(i-o*(n[1][0]+n[0][0]))/2,l=+e[0][1]+(s-o*(n[1][1]+n[0][1]))/2;r.scale(150*o).translate([a,l])},t)}function __(r,e,t){return qd(r,[[0,0],e],t)}function M_(r,e,t){return uc(r,function(n){var i=+e,s=i/(n[1][0]-n[0][0]),o=(i-s*(n[1][0]+n[0][0]))/2,a=-s*n[0][1];r.scale(150*s).translate([o,a])},t)}function b_(r,e,t){return uc(r,function(n){var i=+e,s=i/(n[1][1]-n[0][1]),o=-s*n[0][0],a=(i-s*(n[1][1]+n[0][1]))/2;r.scale(150*s).translate([o,a])},t)}var Xd=16,w_=ct(30*dt);function Yd(r,e){return+e?T_(r,e):S_(r)}function S_(r){return ea({point:function(e,t){e=r(e,t),this.stream.point(e[0],e[1])}})}function T_(r,e){function t(n,i,s,o,a,l,c,u,h,f,d,m,x,v){var g=c-n,p=u-i,_=g*g+p*p;if(_>4*e&&x--){var y=o+f,M=a+d,b=l+m,E=Yo(y*y+M*M+b*b),P=xs(b/=E),z=lt(lt(b)-1)<Je||lt(s-h)<Je?(s+h)/2:gs(M,y),N=r(z,P),I=N[0],w=N[1],T=I-n,B=w-i,L=p*T-g*B;(L*L/_>e||lt((g*T+p*B)/_-.5)>.3||o*f+a*d+l*m<w_)&&(t(n,i,s,o,a,l,I,w,z,y/=E,M/=E,b,x,v),v.point(I,w),t(I,w,z,y,M,b,c,u,h,f,d,m,x,v))}}return function(n){var i,s,o,a,l,c,u,h,f,d,m,x,v={point:g,lineStart:p,lineEnd:y,polygonStart:function(){n.polygonStart(),v.lineStart=M},polygonEnd:function(){n.polygonEnd(),v.lineStart=p}};function g(P,z){P=r(P,z),n.point(P[0],P[1])}function p(){h=NaN,v.point=_,n.lineStart()}function _(P,z){var N=wr([P,z]),I=r(P,z);t(h,f,u,d,m,x,h=I[0],f=I[1],u=P,d=N[0],m=N[1],x=N[2],Xd,n),n.point(h,f)}function y(){v.point=g,n.lineEnd()}function M(){p(),v.point=b,v.lineEnd=E}function b(P,z){_(i=P,z),s=h,o=f,a=d,l=m,c=x,v.point=_}function E(){t(h,f,u,d,m,x,s,o,i,a,l,c,Xd,n),v.lineEnd=y,y()}return v}}var E_=ea({point:function(r,e){this.stream.point(r*dt,e*dt)}});function A_(r){return ea({point:function(e,t){var n=r(e,t);return this.stream.point(n[0],n[1])}})}function C_(r,e,t,n,i){function s(o,a){return o*=n,a*=i,[e+r*o,t-r*a]}return s.invert=function(o,a){return[(o-e)/r*n,(t-a)/r*i]},s}function Jd(r,e,t,n,i,s){if(!s)return C_(r,e,t,n,i);var o=ct(s),a=tt(s),l=o*r,c=a*r,u=o/r,h=a/r,f=(a*t-o*e)/r,d=(a*e+o*t)/r;function m(x,v){return x*=n,v*=i,[l*x-c*v+e,t-c*x-l*v]}return m.invert=function(x,v){return[n*(u*x-h*v+f),i*(d-h*x-u*v)]},m}function L_(r){return R_(function(){return r})()}function R_(r){var e,t=150,n=480,i=250,s=0,o=0,a=0,l=0,c=0,u,h=0,f=1,d=1,m=null,x=zd,v=null,g,p,_,y=Gd,M=.5,b,E,P,z,N;function I(L){return P(L[0]*dt,L[1]*dt)}function w(L){return L=P.invert(L[0],L[1]),L&&[L[0]*Gt,L[1]*Gt]}I.stream=function(L){return z&&N===L?z:z=E_(A_(u)(x(b(y(N=L)))))},I.preclip=function(L){return arguments.length?(x=L,m=void 0,B()):x},I.postclip=function(L){return arguments.length?(y=L,v=g=p=_=null,B()):y},I.clipAngle=function(L){return arguments.length?(x=+L?p_(m=L*dt):(m=null,zd),B()):m*Gt},I.clipExtent=function(L){return arguments.length?(y=L==null?(v=g=p=_=null,Gd):g_(v=+L[0][0],g=+L[0][1],p=+L[1][0],_=+L[1][1]),B()):v==null?null:[[v,g],[p,_]]},I.scale=function(L){return arguments.length?(t=+L,T()):t},I.translate=function(L){return arguments.length?(n=+L[0],i=+L[1],T()):[n,i]},I.center=function(L){return arguments.length?(s=L[0]%360*dt,o=L[1]%360*dt,T()):[s*Gt,o*Gt]},I.rotate=function(L){return arguments.length?(a=L[0]%360*dt,l=L[1]%360*dt,c=L.length>2?L[2]%360*dt:0,T()):[a*Gt,l*Gt,c*Gt]},I.angle=function(L){return arguments.length?(h=L%360*dt,T()):h*Gt},I.reflectX=function(L){return arguments.length?(f=L?-1:1,T()):f<0},I.reflectY=function(L){return arguments.length?(d=L?-1:1,T()):d<0},I.precision=function(L){return arguments.length?(b=Yd(E,M=L*L),B()):Yo(M)},I.fitExtent=function(L,F){return qd(I,L,F)},I.fitSize=function(L,F){return __(I,L,F)},I.fitWidth=function(L,F){return M_(I,L,F)},I.fitHeight=function(L,F){return b_(I,L,F)};function T(){var L=Jd(t,0,0,f,d,h).apply(null,e(s,o)),F=Jd(t,n-L[0],i-L[1],f,d,h);return u=Cd(a,l,c),E=tc(e,F),P=tc(u,E),b=Yd(E,M),B()}function B(){return z=N=null,I}return function(){return e=r.apply(this,arguments),I.invert=e.invert&&w,T()}}function hc(r,e){return[r,n_(r_((Ft+e)/2))]}hc.invert=function(r,e){return[r,2*Ad(t_(e))-Ft]};function P_(){return I_(hc).scale(961/kt)}function I_(r){var e=L_(r),t=e.center,n=e.scale,i=e.translate,s=e.clipExtent,o=null,a,l,c;e.scale=function(h){return arguments.length?(n(h),u()):n()},e.translate=function(h){return arguments.length?(i(h),u()):i()},e.center=function(h){return arguments.length?(t(h),u()):t()},e.clipExtent=function(h){return arguments.length?(h==null?o=a=l=c=null:(o=+h[0][0],a=+h[0][1],l=+h[1][0],c=+h[1][1]),u()):o==null?null:[[o,a],[l,c]]};function u(){var h=Ue*n(),f=e(o_(e.rotate()).invert([0,0]));return s(o==null?[[f[0]-h,f[1]-h],[f[0]+h,f[1]+h]]:r===hc?[[Math.max(f[0]-h,o),a],[Math.min(f[0]+h,l),c]]:[[o,Math.max(f[1]-h,a)],[l,Math.min(f[1]+h,c)]])}return u()}var D_=function(r){return P_().center(r.center).scale(r.scale).translate([0,0]).precision(.1)},F_=function(r,e){return e.map(function(t){var n=Td(t,2),i=n[0],s=n[1],o=Td(r([i,s]),2),a=o[0],l=o[1];return new W(a,-l)})};self.onmessage=function(r){var e=r.data,t=e.req,n=t.coordinatesArr,i=t.split,s=t.depth,o=t.projection,a=e.uuid,l=D_({center:o.center,scale:o.scale}),c=n.map(function(d){return F_(l,d)}),u=Wv(c.map(function(d){return Zv({points:d,split:i,depth:s})}),!1),h={},f=[];Object.keys(u.attributes).forEach(function(d){var m=u.attributes[d];h[d]={array:m.array,itemSize:m.itemSize},f.push(m.array.buffer)}),self.postMessage({res:h,uuid:a},f),u.dispose()},module.exports=Lt})();
|
|
3046
|
+
}`;function Wh(r,e,t){let n=new qr;const i=new W,s=new W,o=new We,a=new lo({depthPacking:Nu}),l=new co,c={},u=t.maxTextureSize,h={0:it,1:Jn,2:Zn},f=new bn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new W},radius:{value:4}},vertexShader:z0,fragmentShader:U0}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const m=new ve;m.setAttribute("position",new ze(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new ft(m,f),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=aa,this.render=function(y,M,b){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||y.length===0)return;const E=r.getRenderTarget(),P=r.getActiveCubeFace(),z=r.getActiveMipmapLevel(),N=r.state;N.setBlending(dn),N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);for(let I=0,w=y.length;I<w;I++){const T=y[I],B=T.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",T,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;i.copy(B.mapSize);const L=B.getFrameExtents();if(i.multiply(L),s.copy(B.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/L.x),i.x=s.x*L.x,B.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/L.y),i.y=s.y*L.y,B.mapSize.y=s.y)),B.map===null&&!B.isPointLightShadow&&this.type===Di){const U={minFilter:Ke,magFilter:Ke,format:ut};B.map=new Nt(i.x,i.y,U),B.map.texture.name=T.name+".shadowMap",B.mapPass=new Nt(i.x,i.y,U),B.camera.updateProjectionMatrix()}if(B.map===null){const U={minFilter:rt,magFilter:rt,format:ut};B.map=new Nt(i.x,i.y,U),B.map.texture.name=T.name+".shadowMap",B.camera.updateProjectionMatrix()}r.setRenderTarget(B.map),r.clear();const F=B.getViewportCount();for(let U=0;U<F;U++){const Z=B.getViewport(U);o.set(s.x*Z.x,s.y*Z.y,s.x*Z.z,s.y*Z.w),N.viewport(o),B.updateMatrices(T,U),n=B.getFrustum(),_(M,b,B.camera,T,this.type)}!B.isPointLightShadow&&this.type===Di&&g(B,b),B.needsUpdate=!1}v.needsUpdate=!1,r.setRenderTarget(E,P,z)};function g(y,M){const b=e.update(x);f.defines.VSM_SAMPLES!==y.blurSamples&&(f.defines.VSM_SAMPLES=y.blurSamples,d.defines.VSM_SAMPLES=y.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),f.uniforms.shadow_pass.value=y.map.texture,f.uniforms.resolution.value=y.mapSize,f.uniforms.radius.value=y.radius,r.setRenderTarget(y.mapPass),r.clear(),r.renderBufferDirect(M,null,b,f,x,null),d.uniforms.shadow_pass.value=y.mapPass.texture,d.uniforms.resolution.value=y.mapSize,d.uniforms.radius.value=y.radius,r.setRenderTarget(y.map),r.clear(),r.renderBufferDirect(M,null,b,d,x,null)}function p(y,M,b,E,P,z,N){let I=null;const w=E.isPointLight===!0?y.customDistanceMaterial:y.customDepthMaterial;if(w!==void 0?I=w:I=E.isPointLight===!0?l:a,r.localClippingEnabled&&b.clipShadows===!0&&b.clippingPlanes.length!==0||b.displacementMap&&b.displacementScale!==0||b.alphaMap&&b.alphaTest>0){const T=I.uuid,B=b.uuid;let L=c[T];L===void 0&&(L={},c[T]=L);let F=L[B];F===void 0&&(F=I.clone(),L[B]=F),I=F}return I.visible=b.visible,I.wireframe=b.wireframe,N===Di?I.side=b.shadowSide!==null?b.shadowSide:b.side:I.side=b.shadowSide!==null?b.shadowSide:h[b.side],I.alphaMap=b.alphaMap,I.alphaTest=b.alphaTest,I.clipShadows=b.clipShadows,I.clippingPlanes=b.clippingPlanes,I.clipIntersection=b.clipIntersection,I.displacementMap=b.displacementMap,I.displacementScale=b.displacementScale,I.displacementBias=b.displacementBias,I.wireframeLinewidth=b.wireframeLinewidth,I.linewidth=b.linewidth,E.isPointLight===!0&&I.isMeshDistanceMaterial===!0&&(I.referencePosition.setFromMatrixPosition(E.matrixWorld),I.nearDistance=P,I.farDistance=z),I}function _(y,M,b,E,P){if(y.visible===!1)return;if(y.layers.test(M.layers)&&(y.isMesh||y.isLine||y.isPoints)&&(y.castShadow||y.receiveShadow&&P===Di)&&(!y.frustumCulled||n.intersectsObject(y))){y.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,y.matrixWorld);const I=e.update(y),w=y.material;if(Array.isArray(w)){const T=I.groups;for(let B=0,L=T.length;B<L;B++){const F=T[B],U=w[F.materialIndex];if(U&&U.visible){const Z=p(y,I,U,E,b.near,b.far,P);r.renderBufferDirect(b,null,I,Z,y,F)}}}else if(w.visible){const T=p(y,I,w,E,b.near,b.far,P);r.renderBufferDirect(b,null,I,T,y,null)}}const N=y.children;for(let I=0,w=N.length;I<w;I++)_(N[I],M,b,E,P)}}function O0(r,e,t){const n=t.isWebGL2;function i(){let D=!1;const re=new We;let te=null;const Ce=new We(0,0,0,0);return{setMask:function(xe){te!==xe&&!D&&(r.colorMask(xe,xe,xe,xe),te=xe)},setLocked:function(xe){D=xe},setClear:function(xe,Pe,ue,Re,Ze){Ze===!0&&(xe*=Re,Pe*=Re,ue*=Re),re.set(xe,Pe,ue,Re),Ce.equals(re)===!1&&(r.clearColor(xe,Pe,ue,Re),Ce.copy(re))},reset:function(){D=!1,te=null,Ce.set(-1,0,0,0)}}}function s(){let D=!1,re=null,te=null,Ce=null;return{setTest:function(xe){xe?K(2929):he(2929)},setMask:function(xe){re!==xe&&!D&&(r.depthMask(xe),re=xe)},setFunc:function(xe){if(te!==xe){if(xe)switch(xe){case Ec:r.depthFunc(512);break;case Ac:r.depthFunc(519);break;case Cc:r.depthFunc(513);break;case Ss:r.depthFunc(515);break;case Lc:r.depthFunc(514);break;case Rc:r.depthFunc(518);break;case Pc:r.depthFunc(516);break;case Ic:r.depthFunc(517);break;default:r.depthFunc(515)}else r.depthFunc(515);te=xe}},setLocked:function(xe){D=xe},setClear:function(xe){Ce!==xe&&(r.clearDepth(xe),Ce=xe)},reset:function(){D=!1,re=null,te=null,Ce=null}}}function o(){let D=!1,re=null,te=null,Ce=null,xe=null,Pe=null,ue=null,Re=null,Ze=null;return{setTest:function(Xe){D||(Xe?K(2960):he(2960))},setMask:function(Xe){re!==Xe&&!D&&(r.stencilMask(Xe),re=Xe)},setFunc:function(Xe,ln,cn){(te!==Xe||Ce!==ln||xe!==cn)&&(r.stencilFunc(Xe,ln,cn),te=Xe,Ce=ln,xe=cn)},setOp:function(Xe,ln,cn){(Pe!==Xe||ue!==ln||Re!==cn)&&(r.stencilOp(Xe,ln,cn),Pe=Xe,ue=ln,Re=cn)},setLocked:function(Xe){D=Xe},setClear:function(Xe){Ze!==Xe&&(r.clearStencil(Xe),Ze=Xe)},reset:function(){D=!1,re=null,te=null,Ce=null,xe=null,Pe=null,ue=null,Re=null,Ze=null}}}const a=new i,l=new s,c=new o;let u={},h={},f=null,d=!1,m=null,x=null,v=null,g=null,p=null,_=null,y=null,M=!1,b=null,E=null,P=null,z=null,N=null;const I=r.getParameter(35661);let w=!1,T=0;const B=r.getParameter(7938);B.indexOf("WebGL")!==-1?(T=parseFloat(/^WebGL (\d)/.exec(B)[1]),w=T>=1):B.indexOf("OpenGL ES")!==-1&&(T=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),w=T>=2);let L=null,F={};const U=r.getParameter(3088),Z=r.getParameter(2978),ee=new We().fromArray(U),V=new We().fromArray(Z);function q(D,re,te){const Ce=new Uint8Array(4),xe=r.createTexture();r.bindTexture(D,xe),r.texParameteri(D,10241,9728),r.texParameteri(D,10240,9728);for(let Pe=0;Pe<te;Pe++)r.texImage2D(re+Pe,0,6408,1,1,0,6408,5121,Ce);return xe}const ne={};ne[3553]=q(3553,3553,1),ne[34067]=q(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),K(2929),l.setFunc(Ss),Oe(!1),k(Yn),K(2884),me(dn);function K(D){u[D]!==!0&&(r.enable(D),u[D]=!0)}function he(D){u[D]!==!1&&(r.disable(D),u[D]=!1)}function Me(D,re){return h[D]!==re?(r.bindFramebuffer(D,re),h[D]=re,n&&(D===36009&&(h[36160]=re),D===36160&&(h[36009]=re)),!0):!1}function Y(D){return f!==D?(r.useProgram(D),f=D,!0):!1}const be={[$n]:32774,[mc]:32778,[gc]:32779};if(n)be[fa]=32775,be[da]=32776;else{const D=e.get("EXT_blend_minmax");D!==null&&(be[fa]=D.MIN_EXT,be[da]=D.MAX_EXT)}const pe={[xc]:0,[yc]:1,[vc]:768,[pa]:770,[Tc]:776,[wc]:774,[Mc]:772,[_c]:769,[ma]:771,[Sc]:775,[bc]:773};function me(D,re,te,Ce,xe,Pe,ue,Re){if(D===dn){d===!0&&(he(3042),d=!1);return}if(d===!1&&(K(3042),d=!0),D!==pc){if(D!==m||Re!==M){if((x!==$n||p!==$n)&&(r.blendEquation(32774),x=$n,p=$n),Re)switch(D){case Fi:r.blendFuncSeparate(1,771,1,771);break;case ca:r.blendFunc(1,1);break;case ua:r.blendFuncSeparate(0,0,769,771);break;case ha:r.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}else switch(D){case Fi:r.blendFuncSeparate(770,771,1,771);break;case ca:r.blendFunc(770,1);break;case ua:r.blendFunc(0,769);break;case ha:r.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}v=null,g=null,_=null,y=null,m=D,M=Re}return}xe=xe||re,Pe=Pe||te,ue=ue||Ce,(re!==x||xe!==p)&&(r.blendEquationSeparate(be[re],be[xe]),x=re,p=xe),(te!==v||Ce!==g||Pe!==_||ue!==y)&&(r.blendFuncSeparate(pe[te],pe[Ce],pe[Pe],pe[ue]),v=te,g=Ce,_=Pe,y=ue),m=D,M=null}function ye(D,re){D.side===Zn?he(2884):K(2884);let te=D.side===it;re&&(te=!te),Oe(te),D.blending===Fi&&D.transparent===!1?me(dn):me(D.blending,D.blendEquation,D.blendSrc,D.blendDst,D.blendEquationAlpha,D.blendSrcAlpha,D.blendDstAlpha,D.premultipliedAlpha),l.setFunc(D.depthFunc),l.setTest(D.depthTest),l.setMask(D.depthWrite),a.setMask(D.colorWrite);const Ce=D.stencilWrite;c.setTest(Ce),Ce&&(c.setMask(D.stencilWriteMask),c.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),c.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),ie(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?K(32926):he(32926)}function Oe(D){b!==D&&(D?r.frontFace(2304):r.frontFace(2305),b=D)}function k(D){D!==ws?(K(2884),D!==E&&(D===Yn?r.cullFace(1029):D===Qt?r.cullFace(1028):r.cullFace(1032))):he(2884),E=D}function $(D){D!==P&&(w&&r.lineWidth(D),P=D)}function ie(D,re,te){D?(K(32823),(z!==re||N!==te)&&(r.polygonOffset(re,te),z=re,N=te)):he(32823)}function fe(D){D?K(3089):he(3089)}function ce(D){D===void 0&&(D=33984+I-1),L!==D&&(r.activeTexture(D),L=D)}function Ee(D,re){L===null&&ce();let te=F[L];te===void 0&&(te={type:void 0,texture:void 0},F[L]=te),(te.type!==D||te.texture!==re)&&(r.bindTexture(D,re||ne[D]),te.type=D,te.texture=re)}function Ae(){const D=F[L];D!==void 0&&D.type!==void 0&&(r.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function De(){try{r.compressedTexImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function je(){try{r.texSubImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function R(){try{r.texSubImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function C(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function J(){try{r.texStorage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Q(){try{r.texStorage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function ae(){try{r.texImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function j(){try{r.texImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function we(D){ee.equals(D)===!1&&(r.scissor(D.x,D.y,D.z,D.w),ee.copy(D))}function _e(D){V.equals(D)===!1&&(r.viewport(D.x,D.y,D.z,D.w),V.copy(D))}function se(){r.disable(3042),r.disable(2884),r.disable(2929),r.disable(32823),r.disable(3089),r.disable(2960),r.disable(32926),r.blendEquation(32774),r.blendFunc(1,0),r.blendFuncSeparate(1,0,1,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(513),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(519,0,4294967295),r.stencilOp(7680,7680,7680),r.clearStencil(0),r.cullFace(1029),r.frontFace(2305),r.polygonOffset(0,0),r.activeTexture(33984),r.bindFramebuffer(36160,null),n===!0&&(r.bindFramebuffer(36009,null),r.bindFramebuffer(36008,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),u={},L=null,F={},h={},f=null,d=!1,m=null,x=null,v=null,g=null,p=null,_=null,y=null,M=!1,b=null,E=null,P=null,z=null,N=null,ee.set(0,0,r.canvas.width,r.canvas.height),V.set(0,0,r.canvas.width,r.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:K,disable:he,bindFramebuffer:Me,useProgram:Y,setBlending:me,setMaterial:ye,setFlipSided:Oe,setCullFace:k,setLineWidth:$,setPolygonOffset:ie,setScissorTest:fe,activeTexture:ce,bindTexture:Ee,unbindTexture:Ae,compressedTexImage2D:De,texImage2D:ae,texImage3D:j,texStorage2D:J,texStorage3D:Q,texSubImage2D:je,texSubImage3D:R,compressedTexSubImage2D:C,scissor:we,viewport:_e,reset:se}}function G0(r,e,t,n,i,s,o){const a=i.isWebGL2,l=i.maxTextures,c=i.maxCubemapSize,u=i.maxTextureSize,h=i.maxSamples,d=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):void 0,m=new WeakMap;let x,v=!1;try{v=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(R){}function g(R,C){return v?new OffscreenCanvas(R,C):Is("canvas")}function p(R,C,J,Q){let ae=1;if((R.width>Q||R.height>Q)&&(ae=Q/Math.max(R.width,R.height)),ae<1||C===!0)if(typeof HTMLImageElement!="undefined"&&R instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&R instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&R instanceof ImageBitmap){const j=C?Gu:Math.floor,we=j(ae*R.width),_e=j(ae*R.height);x===void 0&&(x=g(we,_e));const se=J?g(we,_e):x;return se.width=we,se.height=_e,se.getContext("2d").drawImage(R,0,0,we,_e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+R.width+"x"+R.height+") to ("+we+"x"+_e+")."),se}else return"data"in R&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+R.width+"x"+R.height+")."),R;return R}function _(R){return Ra(R.width)&&Ra(R.height)}function y(R){return a?!1:R.wrapS!==bt||R.wrapT!==bt||R.minFilter!==rt&&R.minFilter!==Ke}function M(R,C){return R.generateMipmaps&&C&&R.minFilter!==rt&&R.minFilter!==Ke}function b(R){r.generateMipmap(R)}function E(R,C,J,Q){if(a===!1)return C;if(R!==null){if(r[R]!==void 0)return r[R];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let ae=C;return C===6403&&(J===5126&&(ae=33326),J===5131&&(ae=33325),J===5121&&(ae=33321)),C===6407&&(J===5126&&(ae=34837),J===5131&&(ae=34843),J===5121&&(ae=32849)),C===6408&&(J===5126&&(ae=34836),J===5131&&(ae=34842),J===5121&&(ae=Q===ri?35907:32856)),(ae===33325||ae===33326||ae===34842||ae===34836)&&e.get("EXT_color_buffer_float"),ae}function P(R,C,J){return M(R,J)===!0||R.isFramebufferTexture&&R.minFilter!==rt&&R.minFilter!==Ke?Math.log2(Math.max(C.width,C.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?C.mipmaps.length:1}function z(R){return R===rt||R===Es||R===As?9728:9729}function N(R){const C=R.target;C.removeEventListener("dispose",N),w(C),C.isVideoTexture&&m.delete(C),o.memory.textures--}function I(R){const C=R.target;C.removeEventListener("dispose",I),T(C)}function w(R){const C=n.get(R);C.__webglInit!==void 0&&(r.deleteTexture(C.__webglTexture),n.remove(R))}function T(R){const C=R.texture,J=n.get(R),Q=n.get(C);if(!!R){if(Q.__webglTexture!==void 0&&(r.deleteTexture(Q.__webglTexture),o.memory.textures--),R.depthTexture&&R.depthTexture.dispose(),R.isWebGLCubeRenderTarget)for(let ae=0;ae<6;ae++)r.deleteFramebuffer(J.__webglFramebuffer[ae]),J.__webglDepthbuffer&&r.deleteRenderbuffer(J.__webglDepthbuffer[ae]);else r.deleteFramebuffer(J.__webglFramebuffer),J.__webglDepthbuffer&&r.deleteRenderbuffer(J.__webglDepthbuffer),J.__webglMultisampledFramebuffer&&r.deleteFramebuffer(J.__webglMultisampledFramebuffer),J.__webglColorRenderbuffer&&r.deleteRenderbuffer(J.__webglColorRenderbuffer),J.__webglDepthRenderbuffer&&r.deleteRenderbuffer(J.__webglDepthRenderbuffer);if(R.isWebGLMultipleRenderTargets)for(let ae=0,j=C.length;ae<j;ae++){const we=n.get(C[ae]);we.__webglTexture&&(r.deleteTexture(we.__webglTexture),o.memory.textures--),n.remove(C[ae])}n.remove(C),n.remove(R)}}let B=0;function L(){B=0}function F(){const R=B;return R>=l&&console.warn("THREE.WebGLTextures: Trying to use "+R+" texture units while this GPU supports only "+l),B+=1,R}function U(R,C){const J=n.get(R);if(R.isVideoTexture&&ce(R),R.version>0&&J.__version!==R.version){const Q=R.image;if(Q===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(Q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Me(J,R,C);return}}t.activeTexture(33984+C),t.bindTexture(3553,J.__webglTexture)}function Z(R,C){const J=n.get(R);if(R.version>0&&J.__version!==R.version){Me(J,R,C);return}t.activeTexture(33984+C),t.bindTexture(35866,J.__webglTexture)}function ee(R,C){const J=n.get(R);if(R.version>0&&J.__version!==R.version){Me(J,R,C);return}t.activeTexture(33984+C),t.bindTexture(32879,J.__webglTexture)}function V(R,C){const J=n.get(R);if(R.version>0&&J.__version!==R.version){Y(J,R,C);return}t.activeTexture(33984+C),t.bindTexture(34067,J.__webglTexture)}const q={[Ir]:10497,[bt]:33071,[Dr]:33648},ne={[rt]:9728,[Es]:9984,[As]:9986,[Ke]:9729,[ga]:9985,[Kn]:9987};function K(R,C,J){if(J?(r.texParameteri(R,10242,q[C.wrapS]),r.texParameteri(R,10243,q[C.wrapT]),(R===32879||R===35866)&&r.texParameteri(R,32882,q[C.wrapR]),r.texParameteri(R,10240,ne[C.magFilter]),r.texParameteri(R,10241,ne[C.minFilter])):(r.texParameteri(R,10242,33071),r.texParameteri(R,10243,33071),(R===32879||R===35866)&&r.texParameteri(R,32882,33071),(C.wrapS!==bt||C.wrapT!==bt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(R,10240,z(C.magFilter)),r.texParameteri(R,10241,z(C.minFilter)),C.minFilter!==rt&&C.minFilter!==Ke&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const Q=e.get("EXT_texture_filter_anisotropic");if(C.type===en&&e.has("OES_texture_float_linear")===!1||a===!1&&C.type===An&&e.has("OES_texture_half_float_linear")===!1)return;(C.anisotropy>1||n.get(C).__currentAnisotropy)&&(r.texParameterf(R,Q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(C.anisotropy,i.getMaxAnisotropy())),n.get(C).__currentAnisotropy=C.anisotropy)}}function he(R,C){R.__webglInit===void 0&&(R.__webglInit=!0,C.addEventListener("dispose",N),R.__webglTexture=r.createTexture(),o.memory.textures++)}function Me(R,C,J){let Q=3553;C.isDataTexture2DArray&&(Q=35866),C.isDataTexture3D&&(Q=32879),he(R,C),t.activeTexture(33984+J),t.bindTexture(Q,R.__webglTexture),r.pixelStorei(37440,C.flipY),r.pixelStorei(37441,C.premultiplyAlpha),r.pixelStorei(3317,C.unpackAlignment),r.pixelStorei(37443,0);const ae=y(C)&&_(C.image)===!1,j=p(C.image,ae,!1,u),we=_(j)||a,_e=s.convert(C.format);let se=s.convert(C.type),D=E(C.internalFormat,_e,se,C.encoding);K(Q,C,we);let re;const te=C.mipmaps,Ce=a&&C.isVideoTexture!==!0,xe=R.__version===void 0,Pe=P(C,j,we);if(C.isDepthTexture)D=6402,a?C.type===en?D=36012:C.type===Fr?D=33190:C.type===ei?D=35056:D=33189:C.type===en&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),C.format===Ln&&D===6402&&C.type!==Ni&&C.type!==Fr&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),C.type=Ni,se=s.convert(C.type)),C.format===ti&&D===6402&&(D=34041,C.type!==ei&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),C.type=ei,se=s.convert(C.type))),Ce&&xe?t.texStorage2D(3553,1,D,j.width,j.height):t.texImage2D(3553,0,D,j.width,j.height,0,_e,se,null);else if(C.isDataTexture)if(te.length>0&&we){Ce&&xe&&t.texStorage2D(3553,Pe,D,te[0].width,te[0].height);for(let ue=0,Re=te.length;ue<Re;ue++)re=te[ue],Ce?t.texSubImage2D(3553,0,0,0,re.width,re.height,_e,se,re.data):t.texImage2D(3553,ue,D,re.width,re.height,0,_e,se,re.data);C.generateMipmaps=!1}else Ce?(xe&&t.texStorage2D(3553,Pe,D,j.width,j.height),t.texSubImage2D(3553,0,0,0,j.width,j.height,_e,se,j.data)):t.texImage2D(3553,0,D,j.width,j.height,0,_e,se,j.data);else if(C.isCompressedTexture){Ce&&xe&&t.texStorage2D(3553,Pe,D,te[0].width,te[0].height);for(let ue=0,Re=te.length;ue<Re;ue++)re=te[ue],C.format!==ut&&C.format!==Cn?_e!==null?Ce?t.compressedTexSubImage2D(3553,ue,0,0,re.width,re.height,_e,re.data):t.compressedTexImage2D(3553,ue,D,re.width,re.height,0,re.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ce?t.texSubImage2D(3553,ue,0,0,re.width,re.height,_e,se,re.data):t.texImage2D(3553,ue,D,re.width,re.height,0,_e,se,re.data)}else if(C.isDataTexture2DArray)Ce?(xe&&t.texStorage3D(35866,Pe,D,j.width,j.height,j.depth),t.texSubImage3D(35866,0,0,0,0,j.width,j.height,j.depth,_e,se,j.data)):t.texImage3D(35866,0,D,j.width,j.height,j.depth,0,_e,se,j.data);else if(C.isDataTexture3D)Ce?(xe&&t.texStorage3D(32879,Pe,D,j.width,j.height,j.depth),t.texSubImage3D(32879,0,0,0,0,j.width,j.height,j.depth,_e,se,j.data)):t.texImage3D(32879,0,D,j.width,j.height,j.depth,0,_e,se,j.data);else if(C.isFramebufferTexture)Ce&&xe?t.texStorage2D(3553,Pe,D,j.width,j.height):t.texImage2D(3553,0,D,j.width,j.height,0,_e,se,null);else if(te.length>0&&we){Ce&&xe&&t.texStorage2D(3553,Pe,D,te[0].width,te[0].height);for(let ue=0,Re=te.length;ue<Re;ue++)re=te[ue],Ce?t.texSubImage2D(3553,ue,0,0,_e,se,re):t.texImage2D(3553,ue,D,_e,se,re);C.generateMipmaps=!1}else Ce?(xe&&t.texStorage2D(3553,Pe,D,j.width,j.height),t.texSubImage2D(3553,0,0,0,_e,se,j)):t.texImage2D(3553,0,D,_e,se,j);M(C,we)&&b(Q),R.__version=C.version,C.onUpdate&&C.onUpdate(C)}function Y(R,C,J){if(C.image.length!==6)return;he(R,C),t.activeTexture(33984+J),t.bindTexture(34067,R.__webglTexture),r.pixelStorei(37440,C.flipY),r.pixelStorei(37441,C.premultiplyAlpha),r.pixelStorei(3317,C.unpackAlignment),r.pixelStorei(37443,0);const Q=C&&(C.isCompressedTexture||C.image[0].isCompressedTexture),ae=C.image[0]&&C.image[0].isDataTexture,j=[];for(let ue=0;ue<6;ue++)!Q&&!ae?j[ue]=p(C.image[ue],!1,!0,c):j[ue]=ae?C.image[ue].image:C.image[ue];const we=j[0],_e=_(we)||a,se=s.convert(C.format),D=s.convert(C.type),re=E(C.internalFormat,se,D,C.encoding),te=a&&C.isVideoTexture!==!0,Ce=R.__version===void 0;let xe=P(C,we,_e);K(34067,C,_e);let Pe;if(Q){te&&Ce&&t.texStorage2D(34067,xe,re,we.width,we.height);for(let ue=0;ue<6;ue++){Pe=j[ue].mipmaps;for(let Re=0;Re<Pe.length;Re++){const Ze=Pe[Re];C.format!==ut&&C.format!==Cn?se!==null?te?t.compressedTexSubImage2D(34069+ue,Re,0,0,Ze.width,Ze.height,se,Ze.data):t.compressedTexImage2D(34069+ue,Re,re,Ze.width,Ze.height,0,Ze.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):te?t.texSubImage2D(34069+ue,Re,0,0,Ze.width,Ze.height,se,D,Ze.data):t.texImage2D(34069+ue,Re,re,Ze.width,Ze.height,0,se,D,Ze.data)}}}else{Pe=C.mipmaps,te&&Ce&&(Pe.length>0&&xe++,t.texStorage2D(34067,xe,re,j[0].width,j[0].height));for(let ue=0;ue<6;ue++)if(ae){te?t.texSubImage2D(34069+ue,0,0,0,j[ue].width,j[ue].height,se,D,j[ue].data):t.texImage2D(34069+ue,0,re,j[ue].width,j[ue].height,0,se,D,j[ue].data);for(let Re=0;Re<Pe.length;Re++){const Xe=Pe[Re].image[ue].image;te?t.texSubImage2D(34069+ue,Re+1,0,0,Xe.width,Xe.height,se,D,Xe.data):t.texImage2D(34069+ue,Re+1,re,Xe.width,Xe.height,0,se,D,Xe.data)}}else{te?t.texSubImage2D(34069+ue,0,0,0,se,D,j[ue]):t.texImage2D(34069+ue,0,re,se,D,j[ue]);for(let Re=0;Re<Pe.length;Re++){const Ze=Pe[Re];te?t.texSubImage2D(34069+ue,Re+1,0,0,se,D,Ze.image[ue]):t.texImage2D(34069+ue,Re+1,re,se,D,Ze.image[ue])}}}M(C,_e)&&b(34067),R.__version=C.version,C.onUpdate&&C.onUpdate(C)}function be(R,C,J,Q,ae){const j=s.convert(J.format),we=s.convert(J.type),_e=E(J.internalFormat,j,we,J.encoding);n.get(C).__hasExternalTextures||(ae===32879||ae===35866?t.texImage3D(ae,0,_e,C.width,C.height,C.depth,0,j,we,null):t.texImage2D(ae,0,_e,C.width,C.height,0,j,we,null)),t.bindFramebuffer(36160,R),C.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,Q,ae,n.get(J).__webglTexture,0,fe(C)):r.framebufferTexture2D(36160,Q,ae,n.get(J).__webglTexture,0),t.bindFramebuffer(36160,null)}function pe(R,C,J){if(r.bindRenderbuffer(36161,R),C.depthBuffer&&!C.stencilBuffer){let Q=33189;if(J||C.useRenderToTexture){const ae=C.depthTexture;ae&&ae.isDepthTexture&&(ae.type===en?Q=36012:ae.type===Fr&&(Q=33190));const j=fe(C);C.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,j,Q,C.width,C.height):r.renderbufferStorageMultisample(36161,j,Q,C.width,C.height)}else r.renderbufferStorage(36161,Q,C.width,C.height);r.framebufferRenderbuffer(36160,36096,36161,R)}else if(C.depthBuffer&&C.stencilBuffer){const Q=fe(C);J&&C.useRenderbuffer?r.renderbufferStorageMultisample(36161,Q,35056,C.width,C.height):C.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,Q,35056,C.width,C.height):r.renderbufferStorage(36161,34041,C.width,C.height),r.framebufferRenderbuffer(36160,33306,36161,R)}else{const Q=C.isWebGLMultipleRenderTargets===!0?C.texture[0]:C.texture,ae=s.convert(Q.format),j=s.convert(Q.type),we=E(Q.internalFormat,ae,j,Q.encoding),_e=fe(C);J&&C.useRenderbuffer?r.renderbufferStorageMultisample(36161,_e,we,C.width,C.height):C.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,_e,we,C.width,C.height):r.renderbufferStorage(36161,we,C.width,C.height)}r.bindRenderbuffer(36161,null)}function me(R,C){if(C&&C.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,R),!(C.depthTexture&&C.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(C.depthTexture).__webglTexture||C.depthTexture.image.width!==C.width||C.depthTexture.image.height!==C.height)&&(C.depthTexture.image.width=C.width,C.depthTexture.image.height=C.height,C.depthTexture.needsUpdate=!0),U(C.depthTexture,0);const Q=n.get(C.depthTexture).__webglTexture,ae=fe(C);if(C.depthTexture.format===Ln)C.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,36096,3553,Q,0,ae):r.framebufferTexture2D(36160,36096,3553,Q,0);else if(C.depthTexture.format===ti)C.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,33306,3553,Q,0,ae):r.framebufferTexture2D(36160,33306,3553,Q,0);else throw new Error("Unknown depthTexture format")}function ye(R){const C=n.get(R),J=R.isWebGLCubeRenderTarget===!0;if(R.depthTexture&&!C.__autoAllocateDepthBuffer){if(J)throw new Error("target.depthTexture not supported in Cube render targets");me(C.__webglFramebuffer,R)}else if(J){C.__webglDepthbuffer=[];for(let Q=0;Q<6;Q++)t.bindFramebuffer(36160,C.__webglFramebuffer[Q]),C.__webglDepthbuffer[Q]=r.createRenderbuffer(),pe(C.__webglDepthbuffer[Q],R,!1)}else t.bindFramebuffer(36160,C.__webglFramebuffer),C.__webglDepthbuffer=r.createRenderbuffer(),pe(C.__webglDepthbuffer,R,!1);t.bindFramebuffer(36160,null)}function Oe(R,C,J){const Q=n.get(R);C!==void 0&&be(Q.__webglFramebuffer,R,R.texture,36064,3553),J!==void 0&&ye(R)}function k(R){const C=R.texture,J=n.get(R),Q=n.get(C);R.addEventListener("dispose",I),R.isWebGLMultipleRenderTargets!==!0&&(Q.__webglTexture===void 0&&(Q.__webglTexture=r.createTexture()),Q.__version=C.version,o.memory.textures++);const ae=R.isWebGLCubeRenderTarget===!0,j=R.isWebGLMultipleRenderTargets===!0,we=C.isDataTexture3D||C.isDataTexture2DArray,_e=_(R)||a;if(a&&C.format===Cn&&(C.type===en||C.type===An)&&(C.format=ut,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),ae){J.__webglFramebuffer=[];for(let se=0;se<6;se++)J.__webglFramebuffer[se]=r.createFramebuffer()}else if(J.__webglFramebuffer=r.createFramebuffer(),j)if(i.drawBuffers){const se=R.texture;for(let D=0,re=se.length;D<re;D++){const te=n.get(se[D]);te.__webglTexture===void 0&&(te.__webglTexture=r.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(R.useRenderbuffer)if(a){J.__webglMultisampledFramebuffer=r.createFramebuffer(),J.__webglColorRenderbuffer=r.createRenderbuffer(),r.bindRenderbuffer(36161,J.__webglColorRenderbuffer);const se=s.convert(C.format),D=s.convert(C.type),re=E(C.internalFormat,se,D,C.encoding),te=fe(R);r.renderbufferStorageMultisample(36161,te,re,R.width,R.height),t.bindFramebuffer(36160,J.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(36160,36064,36161,J.__webglColorRenderbuffer),r.bindRenderbuffer(36161,null),R.depthBuffer&&(J.__webglDepthRenderbuffer=r.createRenderbuffer(),pe(J.__webglDepthRenderbuffer,R,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(ae){t.bindTexture(34067,Q.__webglTexture),K(34067,C,_e);for(let se=0;se<6;se++)be(J.__webglFramebuffer[se],R,C,36064,34069+se);M(C,_e)&&b(34067),t.unbindTexture()}else if(j){const se=R.texture;for(let D=0,re=se.length;D<re;D++){const te=se[D],Ce=n.get(te);t.bindTexture(3553,Ce.__webglTexture),K(3553,te,_e),be(J.__webglFramebuffer,R,te,36064+D,3553),M(te,_e)&&b(3553)}t.unbindTexture()}else{let se=3553;we&&(a?se=C.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),t.bindTexture(se,Q.__webglTexture),K(se,C,_e),be(J.__webglFramebuffer,R,C,36064,se),M(C,_e)&&b(se),t.unbindTexture()}R.depthBuffer&&ye(R)}function $(R){const C=_(R)||a,J=R.isWebGLMultipleRenderTargets===!0?R.texture:[R.texture];for(let Q=0,ae=J.length;Q<ae;Q++){const j=J[Q];if(M(j,C)){const we=R.isWebGLCubeRenderTarget?34067:3553,_e=n.get(j).__webglTexture;t.bindTexture(we,_e),b(we),t.unbindTexture()}}}function ie(R){if(R.useRenderbuffer)if(a){const C=R.width,J=R.height;let Q=16384;const ae=[36064],j=R.stencilBuffer?33306:36096;R.depthBuffer&&ae.push(j),R.ignoreDepthForMultisampleCopy||(R.depthBuffer&&(Q|=256),R.stencilBuffer&&(Q|=1024));const we=n.get(R);t.bindFramebuffer(36008,we.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,we.__webglFramebuffer),R.ignoreDepthForMultisampleCopy&&(r.invalidateFramebuffer(36008,[j]),r.invalidateFramebuffer(36009,[j])),r.blitFramebuffer(0,0,C,J,0,0,C,J,Q,9728),r.invalidateFramebuffer(36008,ae),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,we.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function fe(R){return a&&(R.useRenderbuffer||R.useRenderToTexture)?Math.min(h,R.samples):0}function ce(R){const C=o.render.frame;m.get(R)!==C&&(m.set(R,C),R.update())}let Ee=!1,Ae=!1;function De(R,C){R&&R.isWebGLRenderTarget&&(Ee===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),Ee=!0),R=R.texture),U(R,C)}function je(R,C){R&&R.isWebGLCubeRenderTarget&&(Ae===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),Ae=!0),R=R.texture),V(R,C)}this.allocateTextureUnit=F,this.resetTextureUnits=L,this.setTexture2D=U,this.setTexture2DArray=Z,this.setTexture3D=ee,this.setTextureCube=V,this.rebindTextures=Oe,this.setupRenderTarget=k,this.updateRenderTargetMipmap=$,this.updateMultisampleRenderTarget=ie,this.setupDepthRenderbuffer=ye,this.setupFrameBufferTexture=be,this.safeSetTexture2D=De,this.safeSetTextureCube=je}function qh(r,e,t){const n=t.isWebGL2;function i(s){let o;if(s===Kt)return 5121;if(s===kc)return 32819;if(s===Wc)return 32820;if(s===qc)return 33635;if(s===Gc)return 5120;if(s===Hc)return 5122;if(s===Ni)return 5123;if(s===Vc)return 5124;if(s===Fr)return 5125;if(s===en)return 5126;if(s===An)return n?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===Xc)return 6406;if(s===Cn)return 6407;if(s===ut)return 6408;if(s===Yc)return 6409;if(s===Jc)return 6410;if(s===Ln)return 6402;if(s===ti)return 34041;if(s===Zc)return 6403;if(s===$c)return 36244;if(s===jc)return 33319;if(s===Qc)return 33320;if(s===Kc)return 36248;if(s===eu)return 36249;if(s===xa||s===ya||s===va||s===_a)if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===xa)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===ya)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===va)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===_a)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Ma||s===ba||s===wa||s===Sa)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===Ma)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===ba)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===wa)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Sa)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===tu)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if((s===Ta||s===Ea)&&(o=e.get("WEBGL_compressed_texture_etc"),o!==null)){if(s===Ta)return o.COMPRESSED_RGB8_ETC2;if(s===Ea)return o.COMPRESSED_RGBA8_ETC2_EAC}if(s===nu||s===iu||s===ru||s===su||s===ou||s===au||s===lu||s===cu||s===uu||s===hu||s===fu||s===du||s===pu||s===mu||s===xu||s===yu||s===vu||s===_u||s===Mu||s===bu||s===wu||s===Su||s===Tu||s===Eu||s===Au||s===Cu||s===Lu||s===Ru)return o=e.get("WEBGL_compressed_texture_astc"),o!==null?s:null;if(s===gu)return o=e.get("EXT_texture_compression_bptc"),o!==null?s:null;if(s===ei)return n?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:i}}class ol extends _t{constructor(e=[]){super(),this.cameras=e}}ol.prototype.isArrayCamera=!0;class pi extends Ne{constructor(){super(),this.type="Group"}}pi.prototype.isGroup=!0;const H0={type:"move"};class al{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new pi,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new pi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new S,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new S),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new pi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new S,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new S),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(i=t.getPose(e.targetRaySpace,n),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(H0))),c&&e.hand){o=!0;for(const x of e.hand.values()){const v=t.getJointPose(x,n);if(c.joints[x.jointName]===void 0){const p=new pi;p.matrixAutoUpdate=!1,p.visible=!1,c.joints[x.jointName]=p,c.add(p)}const g=c.joints[x.jointName];v!==null&&(g.matrix.fromArray(v.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.jointRadius=v.radius),g.visible=v!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),d=.02,m=.005;c.inputState.pinching&&f>d+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}}class uo extends ht{constructor(e,t,n,i,s,o,a,l,c,u){if(u=u!==void 0?u:Ln,u!==Ln&&u!==ti)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===Ln&&(n=Ni),n===void 0&&u===ti&&(n=ei),super(null,i,s,o,a,l,u,n,c),this.image={width:e,height:t},this.magFilter=a!==void 0?a:rt,this.minFilter=l!==void 0?l:rt,this.flipY=!1,this.generateMipmaps=!1}}uo.prototype.isDepthTexture=!0;class V0 extends Rn{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor";const l=e.extensions.has("WEBGL_multisampled_render_to_texture");let c=null,u=null,h=null,f=null,d=!1,m=null;const x=t.getContextAttributes();let v=null,g=null;const p=[],_=new Map,y=new _t;y.layers.enable(1),y.viewport=new We;const M=new _t;M.layers.enable(2),M.viewport=new We;const b=[y,M],E=new ol;E.layers.enable(1),E.layers.enable(2);let P=null,z=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let q=p[V];return q===void 0&&(q=new al,p[V]=q),q.getTargetRaySpace()},this.getControllerGrip=function(V){let q=p[V];return q===void 0&&(q=new al,p[V]=q),q.getGripSpace()},this.getHand=function(V){let q=p[V];return q===void 0&&(q=new al,p[V]=q),q.getHandSpace()};function N(V){const q=_.get(V.inputSource);q&&q.dispatchEvent({type:V.type,data:V.inputSource})}function I(){_.forEach(function(V,q){V.disconnect(q)}),_.clear(),P=null,z=null,e.setRenderTarget(v),f=null,h=null,u=null,i=null,g=null,ee.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(V){s=V,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(V){a=V,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){return u},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=function(V){return Er(this,null,function*(){if(i=V,i!==null){if(v=e.getRenderTarget(),i.addEventListener("select",N),i.addEventListener("selectstart",N),i.addEventListener("selectend",N),i.addEventListener("squeeze",N),i.addEventListener("squeezestart",N),i.addEventListener("squeezeend",N),i.addEventListener("end",I),i.addEventListener("inputsourceschange",w),x.xrCompatible!==!0&&(yield t.makeXRCompatible()),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const q={antialias:i.renderState.layers===void 0?x.antialias:!0,alpha:x.alpha,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,t,q),i.updateRenderState({baseLayer:f}),g=new Nt(f.framebufferWidth,f.framebufferHeight,{format:ut,type:Kt,encoding:e.outputEncoding})}else{d=x.antialias;let q=null,ne=null,K=null;x.depth&&(K=x.stencil?35056:33190,q=x.stencil?ti:Ln,ne=x.stencil?ei:Ni);const he={colorFormat:x.alpha||d?32856:32849,depthFormat:K,scaleFactor:s};u=new XRWebGLBinding(i,t),h=u.createProjectionLayer(he),i.updateRenderState({layers:[h]}),d?g=new Ds(h.textureWidth,h.textureHeight,{format:ut,type:Kt,depthTexture:new uo(h.textureWidth,h.textureHeight,ne,void 0,void 0,void 0,void 0,void 0,void 0,q),stencilBuffer:x.stencil,ignoreDepth:h.ignoreDepthValues,useRenderToTexture:l,encoding:e.outputEncoding}):g=new Nt(h.textureWidth,h.textureHeight,{format:x.alpha?ut:Cn,type:Kt,depthTexture:new uo(h.textureWidth,h.textureHeight,ne,void 0,void 0,void 0,void 0,void 0,void 0,q),stencilBuffer:x.stencil,ignoreDepth:h.ignoreDepthValues,encoding:e.outputEncoding})}this.setFoveation(1),o=yield i.requestReferenceSpace(a),ee.setContext(i),ee.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}})};function w(V){const q=i.inputSources;for(let ne=0;ne<p.length;ne++)_.set(q[ne],p[ne]);for(let ne=0;ne<V.removed.length;ne++){const K=V.removed[ne],he=_.get(K);he&&(he.dispatchEvent({type:"disconnected",data:K}),_.delete(K))}for(let ne=0;ne<V.added.length;ne++){const K=V.added[ne],he=_.get(K);he&&he.dispatchEvent({type:"connected",data:K})}}const T=new S,B=new S;function L(V,q,ne){T.setFromMatrixPosition(q.matrixWorld),B.setFromMatrixPosition(ne.matrixWorld);const K=T.distanceTo(B),he=q.projectionMatrix.elements,Me=ne.projectionMatrix.elements,Y=he[14]/(he[10]-1),be=he[14]/(he[10]+1),pe=(he[9]+1)/he[5],me=(he[9]-1)/he[5],ye=(he[8]-1)/he[0],Oe=(Me[8]+1)/Me[0],k=Y*ye,$=Y*Oe,ie=K/(-ye+Oe),fe=ie*-ye;q.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(fe),V.translateZ(ie),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert();const ce=Y+ie,Ee=be+ie,Ae=k-fe,De=$+(K-fe),je=pe*be/Ee*ce,R=me*be/Ee*ce;V.projectionMatrix.makePerspective(Ae,De,je,R,ce,Ee)}function F(V,q){q===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(q.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(i===null)return;E.near=M.near=y.near=V.near,E.far=M.far=y.far=V.far,(P!==E.near||z!==E.far)&&(i.updateRenderState({depthNear:E.near,depthFar:E.far}),P=E.near,z=E.far);const q=V.parent,ne=E.cameras;F(E,q);for(let he=0;he<ne.length;he++)F(ne[he],q);E.matrixWorld.decompose(E.position,E.quaternion,E.scale),V.position.copy(E.position),V.quaternion.copy(E.quaternion),V.scale.copy(E.scale),V.matrix.copy(E.matrix),V.matrixWorld.copy(E.matrixWorld);const K=V.children;for(let he=0,Me=K.length;he<Me;he++)K[he].updateMatrixWorld(!0);ne.length===2?L(E,y,M):E.projectionMatrix.copy(y.projectionMatrix)},this.getCamera=function(){return E},this.getFoveation=function(){if(h!==null)return h.fixedFoveation;if(f!==null)return f.fixedFoveation},this.setFoveation=function(V){h!==null&&(h.fixedFoveation=V),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=V)};let U=null;function Z(V,q){if(c=q.getViewerPose(o),m=q,c!==null){const K=c.views;f!==null&&(e.setRenderTargetFramebuffer(g,f.framebuffer),e.setRenderTarget(g));let he=!1;K.length!==E.cameras.length&&(E.cameras.length=0,he=!0);for(let Me=0;Me<K.length;Me++){const Y=K[Me];let be=null;if(f!==null)be=f.getViewport(Y);else{const me=u.getViewSubImage(h,Y);be=me.viewport,Me===0&&(e.setRenderTargetTextures(g,me.colorTexture,h.ignoreDepthValues?void 0:me.depthStencilTexture),e.setRenderTarget(g))}const pe=b[Me];pe.matrix.fromArray(Y.transform.matrix),pe.projectionMatrix.fromArray(Y.projectionMatrix),pe.viewport.set(be.x,be.y,be.width,be.height),Me===0&&E.matrix.copy(pe.matrix),he===!0&&E.cameras.push(pe)}}const ne=i.inputSources;for(let K=0;K<p.length;K++){const he=p[K],Me=ne[K];he.update(Me,q,o)}U&&U(V,q),m=null}const ee=new uh;ee.setAnimationLoop(Z),this.setAnimationLoop=function(V){U=V},this.dispose=function(){}}}function k0(r){function e(g,p){g.fogColor.value.copy(p.color),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function t(g,p,_,y,M){p.isMeshBasicMaterial?n(g,p):p.isMeshLambertMaterial?(n(g,p),l(g,p)):p.isMeshToonMaterial?(n(g,p),u(g,p)):p.isMeshPhongMaterial?(n(g,p),c(g,p)):p.isMeshStandardMaterial?(n(g,p),p.isMeshPhysicalMaterial?f(g,p,M):h(g,p)):p.isMeshMatcapMaterial?(n(g,p),d(g,p)):p.isMeshDepthMaterial?(n(g,p),m(g,p)):p.isMeshDistanceMaterial?(n(g,p),x(g,p)):p.isMeshNormalMaterial?(n(g,p),v(g,p)):p.isLineBasicMaterial?(i(g,p),p.isLineDashedMaterial&&s(g,p)):p.isPointsMaterial?o(g,p,_,y):p.isSpriteMaterial?a(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function n(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.specularMap&&(g.specularMap.value=p.specularMap),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);const _=r.get(p).envMap;_&&(g.envMap.value=_,g.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity);let y;p.map?y=p.map:p.specularMap?y=p.specularMap:p.displacementMap?y=p.displacementMap:p.normalMap?y=p.normalMap:p.bumpMap?y=p.bumpMap:p.roughnessMap?y=p.roughnessMap:p.metalnessMap?y=p.metalnessMap:p.alphaMap?y=p.alphaMap:p.emissiveMap?y=p.emissiveMap:p.clearcoatMap?y=p.clearcoatMap:p.clearcoatNormalMap?y=p.clearcoatNormalMap:p.clearcoatRoughnessMap?y=p.clearcoatRoughnessMap:p.specularIntensityMap?y=p.specularIntensityMap:p.specularColorMap?y=p.specularColorMap:p.transmissionMap?y=p.transmissionMap:p.thicknessMap?y=p.thicknessMap:p.sheenColorMap?y=p.sheenColorMap:p.sheenRoughnessMap&&(y=p.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),g.uvTransform.value.copy(y.matrix));let M;p.aoMap?M=p.aoMap:p.lightMap&&(M=p.lightMap),M!==void 0&&(M.isWebGLRenderTarget&&(M=M.texture),M.matrixAutoUpdate===!0&&M.updateMatrix(),g.uv2Transform.value.copy(M.matrix))}function i(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity}function s(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function o(g,p,_,y){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*_,g.scale.value=y*.5,p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);let M;p.map?M=p.map:p.alphaMap&&(M=p.alphaMap),M!==void 0&&(M.matrixAutoUpdate===!0&&M.updateMatrix(),g.uvTransform.value.copy(M.matrix))}function a(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);let _;p.map?_=p.map:p.alphaMap&&(_=p.alphaMap),_!==void 0&&(_.matrixAutoUpdate===!0&&_.updateMatrix(),g.uvTransform.value.copy(_.matrix))}function l(g,p){p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap)}function c(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===it&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===it&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===it&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===it&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function h(g,p){g.roughness.value=p.roughness,g.metalness.value=p.metalness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap),p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===it&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===it&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),r.get(p).envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,_){h(g,p),g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap)),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap),p.clearcoatNormalMap&&(g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),g.clearcoatNormalMap.value=p.clearcoatNormalMap,p.side===it&&g.clearcoatNormalScale.value.negate())),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=_.texture,g.transmissionSamplerSize.value.set(_.width,_.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap)}function d(g,p){p.matcap&&(g.matcap.value=p.matcap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===it&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===it&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function m(g,p){p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function x(g,p){p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),g.referencePosition.value.copy(p.referencePosition),g.nearDistance.value=p.nearDistance,g.farDistance.value=p.farDistance}function v(g,p){p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===it&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===it&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:t}}function W0(){const r=Is("canvas");return r.style.display="block",r}function qe(r={}){const e=r.canvas!==void 0?r.canvas:W0(),t=r.context!==void 0?r.context:null,n=r.alpha!==void 0?r.alpha:!1,i=r.depth!==void 0?r.depth:!0,s=r.stencil!==void 0?r.stencil:!0,o=r.antialias!==void 0?r.antialias:!1,a=r.premultipliedAlpha!==void 0?r.premultipliedAlpha:!0,l=r.preserveDrawingBuffer!==void 0?r.preserveDrawingBuffer:!1,c=r.powerPreference!==void 0?r.powerPreference:"default",u=r.failIfMajorPerformanceCaveat!==void 0?r.failIfMajorPerformanceCaveat:!1;let h=null,f=null;const d=[],m=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Ht,this.physicallyCorrectLights=!1,this.toneMapping=pn,this.toneMappingExposure=1;const x=this;let v=!1,g=0,p=0,_=null,y=-1,M=null;const b=new We,E=new We;let P=null,z=e.width,N=e.height,I=1,w=null,T=null;const B=new We(0,0,z,N),L=new We(0,0,z,N);let F=!1;const U=[],Z=new qr;let ee=!1,V=!1,q=null;const ne=new ge,K=new S,he={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Me(){return _===null?I:1}let Y=t;function be(A,O){for(let H=0;H<A.length;H++){const G=A[H],X=e.getContext(G,O);if(X!==null)return X}return null}try{const A={alpha:n,depth:i,stencil:s,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Xn}`),e.addEventListener("webglcontextlost",Ce,!1),e.addEventListener("webglcontextrestored",xe,!1),Y===null){const O=["webgl2","webgl","experimental-webgl"];if(x.isWebGL1Renderer===!0&&O.shift(),Y=be(O,A),Y===null)throw be(O)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}Y.getShaderPrecisionFormat===void 0&&(Y.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(A){throw console.error("THREE.WebGLRenderer: "+A.message),A}let pe,me,ye,Oe,k,$,ie,fe,ce,Ee,Ae,De,je,R,C,J,Q,ae,j,we,_e,se,D;function re(){pe=new hx(Y),me=new sx(Y,pe,r),pe.init(me),se=new qh(Y,pe,me),ye=new O0(Y,pe,me),U[0]=1029,Oe=new px(Y),k=new C0,$=new G0(Y,pe,ye,k,me,se,Oe),ie=new ax(x),fe=new ux(x),ce=new am(Y,me),D=new ix(Y,pe,ce,me),Ee=new fx(Y,ce,Oe,D),Ae=new yx(Y,Ee,ce,Oe),j=new xx(Y,me,$),J=new ox(k),De=new A0(x,ie,fe,pe,me,D,J),je=new k0(k),R=new R0,C=new N0(pe,me),ae=new nx(x,ie,ye,Ae,a),Q=new Wh(x,Ae,me),we=new rx(Y,pe,Oe,me),_e=new dx(Y,pe,Oe,me),Oe.programs=De.programs,x.capabilities=me,x.extensions=pe,x.properties=k,x.renderLists=R,x.shadowMap=Q,x.state=ye,x.info=Oe}re();const te=new V0(x,Y);this.xr=te,this.getContext=function(){return Y},this.getContextAttributes=function(){return Y.getContextAttributes()},this.forceContextLoss=function(){const A=pe.get("WEBGL_lose_context");A&&A.loseContext()},this.forceContextRestore=function(){const A=pe.get("WEBGL_lose_context");A&&A.restoreContext()},this.getPixelRatio=function(){return I},this.setPixelRatio=function(A){A!==void 0&&(I=A,this.setSize(z,N,!1))},this.getSize=function(A){return A.set(z,N)},this.setSize=function(A,O,H){if(te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}z=A,N=O,e.width=Math.floor(A*I),e.height=Math.floor(O*I),H!==!1&&(e.style.width=A+"px",e.style.height=O+"px"),this.setViewport(0,0,A,O)},this.getDrawingBufferSize=function(A){return A.set(z*I,N*I).floor()},this.setDrawingBufferSize=function(A,O,H){z=A,N=O,I=H,e.width=Math.floor(A*H),e.height=Math.floor(O*H),this.setViewport(0,0,A,O)},this.getCurrentViewport=function(A){return A.copy(b)},this.getViewport=function(A){return A.copy(B)},this.setViewport=function(A,O,H,G){A.isVector4?B.set(A.x,A.y,A.z,A.w):B.set(A,O,H,G),ye.viewport(b.copy(B).multiplyScalar(I).floor())},this.getScissor=function(A){return A.copy(L)},this.setScissor=function(A,O,H,G){A.isVector4?L.set(A.x,A.y,A.z,A.w):L.set(A,O,H,G),ye.scissor(E.copy(L).multiplyScalar(I).floor())},this.getScissorTest=function(){return F},this.setScissorTest=function(A){ye.setScissorTest(F=A)},this.setOpaqueSort=function(A){w=A},this.setTransparentSort=function(A){T=A},this.getClearColor=function(A){return A.copy(ae.getClearColor())},this.setClearColor=function(){ae.setClearColor.apply(ae,arguments)},this.getClearAlpha=function(){return ae.getClearAlpha()},this.setClearAlpha=function(){ae.setClearAlpha.apply(ae,arguments)},this.clear=function(A,O,H){let G=0;(A===void 0||A)&&(G|=16384),(O===void 0||O)&&(G|=256),(H===void 0||H)&&(G|=1024),Y.clear(G)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Ce,!1),e.removeEventListener("webglcontextrestored",xe,!1),R.dispose(),C.dispose(),k.dispose(),ie.dispose(),fe.dispose(),Ae.dispose(),D.dispose(),De.dispose(),te.dispose(),te.removeEventListener("sessionstart",ln),te.removeEventListener("sessionend",cn),q&&(q.dispose(),q=null),Pi.stop()};function Ce(A){A.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function xe(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;const A=Oe.autoReset,O=Q.enabled,H=Q.autoUpdate,G=Q.needsUpdate,X=Q.type;re(),Oe.autoReset=A,Q.enabled=O,Q.autoUpdate=H,Q.needsUpdate=G,Q.type=X}function Pe(A){const O=A.target;O.removeEventListener("dispose",Pe),ue(O)}function ue(A){Re(A),k.remove(A)}function Re(A){const O=k.get(A).programs;O!==void 0&&(O.forEach(function(H){De.releaseProgram(H)}),A.isShaderMaterial&&De.releaseShaderCache(A))}this.renderBufferDirect=function(A,O,H,G,X,Se){O===null&&(O=he);const Le=X.isMesh&&X.matrixWorld.determinant()<0,Fe=z_(A,O,H,G,X);ye.setMaterial(G,Le);let Te=H.index;const Ve=H.attributes.position;if(Te===null){if(Ve===void 0||Ve.count===0)return}else if(Te.count===0)return;let Be=1;G.wireframe===!0&&(Te=Ee.getWireframeAttribute(H),Be=2),D.setup(X,G,Fe,H,Te);let Ge,nt=we;Te!==null&&(Ge=ce.get(Te),nt=_e,nt.setIndex(Ge));const Ii=Te!==null?Te.count:Ve.count,Tr=H.drawRange.start*Be,ke=H.drawRange.count*Be,un=Se!==null?Se.start*Be:0,gt=Se!==null?Se.count*Be:1/0,hn=Math.max(Tr,un),sa=Math.min(Ii,Tr+ke,un+gt)-1,fn=Math.max(0,sa-hn+1);if(fn!==0){if(X.isMesh)G.wireframe===!0?(ye.setLineWidth(G.wireframeLinewidth*Me()),nt.setMode(1)):nt.setMode(4);else if(X.isLine){let En=G.linewidth;En===void 0&&(En=1),ye.setLineWidth(En*Me()),X.isLineSegments?nt.setMode(1):X.isLineLoop?nt.setMode(2):nt.setMode(3)}else X.isPoints?nt.setMode(0):X.isSprite&&nt.setMode(4);if(X.isInstancedMesh)nt.renderInstances(hn,fn,X.count);else if(H.isInstancedBufferGeometry){const En=Math.min(H.instanceCount,H._maxInstanceCount);nt.renderInstances(hn,fn,En)}else nt.render(hn,fn)}},this.compile=function(A,O){f=C.get(A),f.init(),m.push(f),A.traverseVisible(function(H){H.isLight&&H.layers.test(O.layers)&&(f.pushLight(H),H.castShadow&&f.pushShadow(H))}),f.setupLights(x.physicallyCorrectLights),A.traverse(function(H){const G=H.material;if(G)if(Array.isArray(G))for(let X=0;X<G.length;X++){const Se=G[X];fc(Se,A,H)}else fc(G,A,H)}),m.pop(),f=null};let Ze=null;function Xe(A){Ze&&Ze(A)}function ln(){Pi.stop()}function cn(){Pi.start()}const Pi=new uh;Pi.setAnimationLoop(Xe),typeof window!="undefined"&&Pi.setContext(window),this.setAnimationLoop=function(A){Ze=A,te.setAnimationLoop(A),A===null?Pi.stop():Pi.start()},te.addEventListener("sessionstart",ln),te.addEventListener("sessionend",cn),this.render=function(A,O){if(O!==void 0&&O.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;A.autoUpdate===!0&&A.updateMatrixWorld(),O.parent===null&&O.updateMatrixWorld(),te.enabled===!0&&te.isPresenting===!0&&(te.cameraAutoUpdate===!0&&te.updateCamera(O),O=te.getCamera()),A.isScene===!0&&A.onBeforeRender(x,A,O,_),f=C.get(A,m.length),f.init(),m.push(f),ne.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),Z.setFromProjectionMatrix(ne),V=this.localClippingEnabled,ee=J.init(this.clippingPlanes,V,O),h=R.get(A,d.length),h.init(),d.push(h),Zd(A,O,0,x.sortObjects),h.finish(),x.sortObjects===!0&&h.sort(w,T),ee===!0&&J.beginShadows();const H=f.state.shadowsArray;if(Q.render(H,A,O),ee===!0&&J.endShadows(),this.info.autoReset===!0&&this.info.reset(),ae.render(h,A),f.setupLights(x.physicallyCorrectLights),O.isArrayCamera){const G=O.cameras;for(let X=0,Se=G.length;X<Se;X++){const Le=G[X];$d(h,A,Le,Le.viewport)}}else $d(h,A,O);_!==null&&($.updateMultisampleRenderTarget(_),$.updateRenderTargetMipmap(_)),A.isScene===!0&&A.onAfterRender(x,A,O),ye.buffers.depth.setTest(!0),ye.buffers.depth.setMask(!0),ye.buffers.color.setMask(!0),ye.setPolygonOffset(!1),D.resetDefaultState(),y=-1,M=null,m.pop(),m.length>0?f=m[m.length-1]:f=null,d.pop(),d.length>0?h=d[d.length-1]:h=null};function Zd(A,O,H,G){if(A.visible===!1)return;if(A.layers.test(O.layers)){if(A.isGroup)H=A.renderOrder;else if(A.isLOD)A.autoUpdate===!0&&A.update(O);else if(A.isLight)f.pushLight(A),A.castShadow&&f.pushShadow(A);else if(A.isSprite){if(!A.frustumCulled||Z.intersectsSprite(A)){G&&K.setFromMatrixPosition(A.matrixWorld).applyMatrix4(ne);const Le=Ae.update(A),Fe=A.material;Fe.visible&&h.push(A,Le,Fe,H,K.z,null)}}else if((A.isMesh||A.isLine||A.isPoints)&&(A.isSkinnedMesh&&A.skeleton.frame!==Oe.render.frame&&(A.skeleton.update(),A.skeleton.frame=Oe.render.frame),!A.frustumCulled||Z.intersectsObject(A))){G&&K.setFromMatrixPosition(A.matrixWorld).applyMatrix4(ne);const Le=Ae.update(A),Fe=A.material;if(Array.isArray(Fe)){const Te=Le.groups;for(let Ve=0,Be=Te.length;Ve<Be;Ve++){const Ge=Te[Ve],nt=Fe[Ge.materialIndex];nt&&nt.visible&&h.push(A,Le,nt,H,K.z,Ge)}}else Fe.visible&&h.push(A,Le,Fe,H,K.z,null)}}const Se=A.children;for(let Le=0,Fe=Se.length;Le<Fe;Le++)Zd(Se[Le],O,H,G)}function $d(A,O,H,G){const X=A.opaque,Se=A.transmissive,Le=A.transparent;f.setupLightsView(H),Se.length>0&&B_(X,O,H),G&&ye.viewport(b.copy(G)),X.length>0&&ra(X,O,H),Se.length>0&&ra(Se,O,H),Le.length>0&&ra(Le,O,H)}function B_(A,O,H){if(q===null){const Le=o===!0&&me.isWebGL2===!0?Ds:Nt;q=new Le(1024,1024,{generateMipmaps:!0,type:se.convert(An)!==null?An:Kt,minFilter:Kn,magFilter:rt,wrapS:bt,wrapT:bt,useRenderToTexture:pe.has("WEBGL_multisampled_render_to_texture")})}const G=x.getRenderTarget();x.setRenderTarget(q),x.clear();const X=x.toneMapping;x.toneMapping=pn,ra(A,O,H),x.toneMapping=X,$.updateMultisampleRenderTarget(q),$.updateRenderTargetMipmap(q),x.setRenderTarget(G)}function ra(A,O,H){const G=O.isScene===!0?O.overrideMaterial:null;for(let X=0,Se=A.length;X<Se;X++){const Le=A[X],Fe=Le.object,Te=Le.geometry,Ve=G===null?Le.material:G,Be=Le.group;Fe.layers.test(H.layers)&&N_(Fe,O,H,Te,Ve,Be)}}function N_(A,O,H,G,X,Se){A.onBeforeRender(x,O,H,G,X,Se),A.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,A.matrixWorld),A.normalMatrix.getNormalMatrix(A.modelViewMatrix),X.onBeforeRender(x,O,H,G,A,Se),X.transparent===!0&&X.side===Zn?(X.side=it,X.needsUpdate=!0,x.renderBufferDirect(H,O,G,X,A,Se),X.side=Jn,X.needsUpdate=!0,x.renderBufferDirect(H,O,G,X,A,Se),X.side=Zn):x.renderBufferDirect(H,O,G,X,A,Se),A.onAfterRender(x,O,H,G,X,Se)}function fc(A,O,H){O.isScene!==!0&&(O=he);const G=k.get(A),X=f.state.lights,Se=f.state.shadowsArray,Le=X.state.version,Fe=De.getParameters(A,X.state,Se,O,H),Te=De.getProgramCacheKey(Fe);let Ve=G.programs;G.environment=A.isMeshStandardMaterial?O.environment:null,G.fog=O.fog,G.envMap=(A.isMeshStandardMaterial?fe:ie).get(A.envMap||G.environment),Ve===void 0&&(A.addEventListener("dispose",Pe),Ve=new Map,G.programs=Ve);let Be=Ve.get(Te);if(Be!==void 0){if(G.currentProgram===Be&&G.lightsStateVersion===Le)return jd(A,Fe),Be}else Fe.uniforms=De.getUniforms(A),A.onBuild(H,Fe,x),A.onBeforeCompile(Fe,x),Be=De.acquireProgram(Fe,Te),Ve.set(Te,Be),G.uniforms=Fe.uniforms;const Ge=G.uniforms;(!A.isShaderMaterial&&!A.isRawShaderMaterial||A.clipping===!0)&&(Ge.clippingPlanes=J.uniform),jd(A,Fe),G.needsLights=O_(A),G.lightsStateVersion=Le,G.needsLights&&(Ge.ambientLightColor.value=X.state.ambient,Ge.lightProbe.value=X.state.probe,Ge.directionalLights.value=X.state.directional,Ge.directionalLightShadows.value=X.state.directionalShadow,Ge.spotLights.value=X.state.spot,Ge.spotLightShadows.value=X.state.spotShadow,Ge.rectAreaLights.value=X.state.rectArea,Ge.ltc_1.value=X.state.rectAreaLTC1,Ge.ltc_2.value=X.state.rectAreaLTC2,Ge.pointLights.value=X.state.point,Ge.pointLightShadows.value=X.state.pointShadow,Ge.hemisphereLights.value=X.state.hemi,Ge.directionalShadowMap.value=X.state.directionalShadowMap,Ge.directionalShadowMatrix.value=X.state.directionalShadowMatrix,Ge.spotShadowMap.value=X.state.spotShadowMap,Ge.spotShadowMatrix.value=X.state.spotShadowMatrix,Ge.pointShadowMap.value=X.state.pointShadowMap,Ge.pointShadowMatrix.value=X.state.pointShadowMatrix);const nt=Be.getUniforms(),Ii=Hn.seqWithValue(nt.seq,Ge);return G.currentProgram=Be,G.uniformsList=Ii,Be}function jd(A,O){const H=k.get(A);H.outputEncoding=O.outputEncoding,H.instancing=O.instancing,H.skinning=O.skinning,H.morphTargets=O.morphTargets,H.morphNormals=O.morphNormals,H.morphTargetsCount=O.morphTargetsCount,H.numClippingPlanes=O.numClippingPlanes,H.numIntersection=O.numClipIntersection,H.vertexAlphas=O.vertexAlphas,H.vertexTangents=O.vertexTangents,H.toneMapping=O.toneMapping}function z_(A,O,H,G,X){O.isScene!==!0&&(O=he),$.resetTextureUnits();const Se=O.fog,Le=G.isMeshStandardMaterial?O.environment:null,Fe=_===null?x.outputEncoding:_.texture.encoding,Te=(G.isMeshStandardMaterial?fe:ie).get(G.envMap||Le),Ve=G.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,Be=!!G.normalMap&&!!H.attributes.tangent,Ge=!!H.morphAttributes.position,nt=!!H.morphAttributes.normal,Ii=H.morphAttributes.position?H.morphAttributes.position.length:0,Tr=G.toneMapped?x.toneMapping:pn,ke=k.get(G),un=f.state.lights;if(ee===!0&&(V===!0||A!==M)){const jt=A===M&&G.id===y;J.setState(G,A,jt)}let gt=!1;G.version===ke.__version?(ke.needsLights&&ke.lightsStateVersion!==un.state.version||ke.outputEncoding!==Fe||X.isInstancedMesh&&ke.instancing===!1||!X.isInstancedMesh&&ke.instancing===!0||X.isSkinnedMesh&&ke.skinning===!1||!X.isSkinnedMesh&&ke.skinning===!0||ke.envMap!==Te||G.fog&&ke.fog!==Se||ke.numClippingPlanes!==void 0&&(ke.numClippingPlanes!==J.numPlanes||ke.numIntersection!==J.numIntersection)||ke.vertexAlphas!==Ve||ke.vertexTangents!==Be||ke.morphTargets!==Ge||ke.morphNormals!==nt||ke.toneMapping!==Tr||me.isWebGL2===!0&&ke.morphTargetsCount!==Ii)&&(gt=!0):(gt=!0,ke.__version=G.version);let hn=ke.currentProgram;gt===!0&&(hn=fc(G,O,X));let sa=!1,fn=!1,En=!1;const Ct=hn.getUniforms(),Ms=ke.uniforms;if(ye.useProgram(hn.program)&&(sa=!0,fn=!0,En=!0),G.id!==y&&(y=G.id,fn=!0),sa||M!==A){if(Ct.setValue(Y,"projectionMatrix",A.projectionMatrix),me.logarithmicDepthBuffer&&Ct.setValue(Y,"logDepthBufFC",2/(Math.log(A.far+1)/Math.LN2)),M!==A&&(M=A,fn=!0,En=!0),G.isShaderMaterial||G.isMeshPhongMaterial||G.isMeshToonMaterial||G.isMeshStandardMaterial||G.envMap){const jt=Ct.map.cameraPosition;jt!==void 0&&jt.setValue(Y,K.setFromMatrixPosition(A.matrixWorld))}(G.isMeshPhongMaterial||G.isMeshToonMaterial||G.isMeshLambertMaterial||G.isMeshBasicMaterial||G.isMeshStandardMaterial||G.isShaderMaterial)&&Ct.setValue(Y,"isOrthographic",A.isOrthographicCamera===!0),(G.isMeshPhongMaterial||G.isMeshToonMaterial||G.isMeshLambertMaterial||G.isMeshBasicMaterial||G.isMeshStandardMaterial||G.isShaderMaterial||G.isShadowMaterial||X.isSkinnedMesh)&&Ct.setValue(Y,"viewMatrix",A.matrixWorldInverse)}if(X.isSkinnedMesh){Ct.setOptional(Y,X,"bindMatrix"),Ct.setOptional(Y,X,"bindMatrixInverse");const jt=X.skeleton;jt&&(me.floatVertexTextures?(jt.boneTexture===null&&jt.computeBoneTexture(),Ct.setValue(Y,"boneTexture",jt.boneTexture,$),Ct.setValue(Y,"boneTextureSize",jt.boneTextureSize)):Ct.setOptional(Y,jt,"boneMatrices"))}return!!H&&(H.morphAttributes.position!==void 0||H.morphAttributes.normal!==void 0)&&j.update(X,H,G,hn),(fn||ke.receiveShadow!==X.receiveShadow)&&(ke.receiveShadow=X.receiveShadow,Ct.setValue(Y,"receiveShadow",X.receiveShadow)),fn&&(Ct.setValue(Y,"toneMappingExposure",x.toneMappingExposure),ke.needsLights&&U_(Ms,En),Se&&G.fog&&je.refreshFogUniforms(Ms,Se),je.refreshMaterialUniforms(Ms,G,I,N,q),Hn.upload(Y,ke.uniformsList,Ms,$)),G.isShaderMaterial&&G.uniformsNeedUpdate===!0&&(Hn.upload(Y,ke.uniformsList,Ms,$),G.uniformsNeedUpdate=!1),G.isSpriteMaterial&&Ct.setValue(Y,"center",X.center),Ct.setValue(Y,"modelViewMatrix",X.modelViewMatrix),Ct.setValue(Y,"normalMatrix",X.normalMatrix),Ct.setValue(Y,"modelMatrix",X.matrixWorld),hn}function U_(A,O){A.ambientLightColor.needsUpdate=O,A.lightProbe.needsUpdate=O,A.directionalLights.needsUpdate=O,A.directionalLightShadows.needsUpdate=O,A.pointLights.needsUpdate=O,A.pointLightShadows.needsUpdate=O,A.spotLights.needsUpdate=O,A.spotLightShadows.needsUpdate=O,A.rectAreaLights.needsUpdate=O,A.hemisphereLights.needsUpdate=O}function O_(A){return A.isMeshLambertMaterial||A.isMeshToonMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isShadowMaterial||A.isShaderMaterial&&A.lights===!0}this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return p},this.getRenderTarget=function(){return _},this.setRenderTargetTextures=function(A,O,H){k.get(A.texture).__webglTexture=O,k.get(A.depthTexture).__webglTexture=H;const G=k.get(A);G.__hasExternalTextures=!0,G.__hasExternalTextures&&(G.__autoAllocateDepthBuffer=H===void 0,G.__autoAllocateDepthBuffer||A.useRenderToTexture&&(console.warn("render-to-texture extension was disabled because an external texture was provided"),A.useRenderToTexture=!1,A.useRenderbuffer=!0))},this.setRenderTargetFramebuffer=function(A,O){const H=k.get(A);H.__webglFramebuffer=O,H.__useDefaultFramebuffer=O===void 0},this.setRenderTarget=function(A,O=0,H=0){_=A,g=O,p=H;let G=!0;if(A){const Te=k.get(A);Te.__useDefaultFramebuffer!==void 0?(ye.bindFramebuffer(36160,null),G=!1):Te.__webglFramebuffer===void 0?$.setupRenderTarget(A):Te.__hasExternalTextures&&$.rebindTextures(A,k.get(A.texture).__webglTexture,k.get(A.depthTexture).__webglTexture)}let X=null,Se=!1,Le=!1;if(A){const Te=A.texture;(Te.isDataTexture3D||Te.isDataTexture2DArray)&&(Le=!0);const Ve=k.get(A).__webglFramebuffer;A.isWebGLCubeRenderTarget?(X=Ve[O],Se=!0):A.useRenderbuffer?X=k.get(A).__webglMultisampledFramebuffer:X=Ve,b.copy(A.viewport),E.copy(A.scissor),P=A.scissorTest}else b.copy(B).multiplyScalar(I).floor(),E.copy(L).multiplyScalar(I).floor(),P=F;if(ye.bindFramebuffer(36160,X)&&me.drawBuffers&&G){let Te=!1;if(A)if(A.isWebGLMultipleRenderTargets){const Ve=A.texture;if(U.length!==Ve.length||U[0]!==36064){for(let Be=0,Ge=Ve.length;Be<Ge;Be++)U[Be]=36064+Be;U.length=Ve.length,Te=!0}}else(U.length!==1||U[0]!==36064)&&(U[0]=36064,U.length=1,Te=!0);else(U.length!==1||U[0]!==1029)&&(U[0]=1029,U.length=1,Te=!0);Te&&(me.isWebGL2?Y.drawBuffers(U):pe.get("WEBGL_draw_buffers").drawBuffersWEBGL(U))}if(ye.viewport(b),ye.scissor(E),ye.setScissorTest(P),Se){const Te=k.get(A.texture);Y.framebufferTexture2D(36160,36064,34069+O,Te.__webglTexture,H)}else if(Le){const Te=k.get(A.texture),Ve=O||0;Y.framebufferTextureLayer(36160,36064,Te.__webglTexture,H||0,Ve)}y=-1},this.readRenderTargetPixels=function(A,O,H,G,X,Se,Le){if(!(A&&A.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Fe=k.get(A).__webglFramebuffer;if(A.isWebGLCubeRenderTarget&&Le!==void 0&&(Fe=Fe[Le]),Fe){ye.bindFramebuffer(36160,Fe);try{const Te=A.texture,Ve=Te.format,Be=Te.type;if(Ve!==ut&&se.convert(Ve)!==Y.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ge=Be===An&&(pe.has("EXT_color_buffer_half_float")||me.isWebGL2&&pe.has("EXT_color_buffer_float"));if(Be!==Kt&&se.convert(Be)!==Y.getParameter(35738)&&!(Be===en&&(me.isWebGL2||pe.has("OES_texture_float")||pe.has("WEBGL_color_buffer_float")))&&!Ge){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y.checkFramebufferStatus(36160)===36053?O>=0&&O<=A.width-G&&H>=0&&H<=A.height-X&&Y.readPixels(O,H,G,X,se.convert(Ve),se.convert(Be),Se):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const Te=_!==null?k.get(_).__webglFramebuffer:null;ye.bindFramebuffer(36160,Te)}}},this.copyFramebufferToTexture=function(A,O,H=0){if(O.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}const G=Math.pow(2,-H),X=Math.floor(O.image.width*G),Se=Math.floor(O.image.height*G);$.setTexture2D(O,0),Y.copyTexSubImage2D(3553,H,0,0,A.x,A.y,X,Se),ye.unbindTexture()},this.copyTextureToTexture=function(A,O,H,G=0){const X=O.image.width,Se=O.image.height,Le=se.convert(H.format),Fe=se.convert(H.type);$.setTexture2D(H,0),Y.pixelStorei(37440,H.flipY),Y.pixelStorei(37441,H.premultiplyAlpha),Y.pixelStorei(3317,H.unpackAlignment),O.isDataTexture?Y.texSubImage2D(3553,G,A.x,A.y,X,Se,Le,Fe,O.image.data):O.isCompressedTexture?Y.compressedTexSubImage2D(3553,G,A.x,A.y,O.mipmaps[0].width,O.mipmaps[0].height,Le,O.mipmaps[0].data):Y.texSubImage2D(3553,G,A.x,A.y,Le,Fe,O.image),G===0&&H.generateMipmaps&&Y.generateMipmap(3553),ye.unbindTexture()},this.copyTextureToTexture3D=function(A,O,H,G,X=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Se=A.max.x-A.min.x+1,Le=A.max.y-A.min.y+1,Fe=A.max.z-A.min.z+1,Te=se.convert(G.format),Ve=se.convert(G.type);let Be;if(G.isDataTexture3D)$.setTexture3D(G,0),Be=32879;else if(G.isDataTexture2DArray)$.setTexture2DArray(G,0),Be=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Y.pixelStorei(37440,G.flipY),Y.pixelStorei(37441,G.premultiplyAlpha),Y.pixelStorei(3317,G.unpackAlignment);const Ge=Y.getParameter(3314),nt=Y.getParameter(32878),Ii=Y.getParameter(3316),Tr=Y.getParameter(3315),ke=Y.getParameter(32877),un=H.isCompressedTexture?H.mipmaps[0]:H.image;Y.pixelStorei(3314,un.width),Y.pixelStorei(32878,un.height),Y.pixelStorei(3316,A.min.x),Y.pixelStorei(3315,A.min.y),Y.pixelStorei(32877,A.min.z),H.isDataTexture||H.isDataTexture3D?Y.texSubImage3D(Be,X,O.x,O.y,O.z,Se,Le,Fe,Te,Ve,un.data):H.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Y.compressedTexSubImage3D(Be,X,O.x,O.y,O.z,Se,Le,Fe,Te,un.data)):Y.texSubImage3D(Be,X,O.x,O.y,O.z,Se,Le,Fe,Te,Ve,un),Y.pixelStorei(3314,Ge),Y.pixelStorei(32878,nt),Y.pixelStorei(3316,Ii),Y.pixelStorei(3315,Tr),Y.pixelStorei(32877,ke),X===0&&G.generateMipmaps&&Y.generateMipmap(Be),ye.unbindTexture()},this.initTexture=function(A){$.setTexture2D(A,0),ye.unbindTexture()},this.resetState=function(){g=0,p=0,_=null,ye.reset(),D.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}qe.prototype.isWebGLRenderer=!0;class Xh extends qe{}Xh.prototype.isWebGL1Renderer=!0;class Zr{constructor(e,t=25e-5){this.name="",this.color=new le(e),this.density=t}clone(){return new Zr(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}Zr.prototype.isFogExp2=!0;class $r{constructor(e,t=1,n=1e3){this.name="",this.color=new le(e),this.near=t,this.far=n}clone(){return new $r(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}$r.prototype.isFog=!0;class ho extends Ne{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__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()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}}ho.prototype.isScene=!0;class mi{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=zi,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Bt()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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,s=this.stride;i<s;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=Bt()),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=Bt()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}mi.prototype.isInterleavedBuffer=!0;const ot=new S;class Vn{constructor(e,t,n,i=!1){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i===!0}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++)ot.x=this.getX(t),ot.y=this.getY(t),ot.z=this.getZ(t),ot.applyMatrix4(e),this.setXYZ(t,ot.x,ot.y,ot.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ot.x=this.getX(t),ot.y=this.getY(t),ot.z=this.getZ(t),ot.applyNormalMatrix(e),this.setXYZ(t,ot.x,ot.y,ot.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ot.x=this.getX(t),ot.y=this.getY(t),ot.z=this.getZ(t),ot.transformDirection(e),this.setXYZ(t,ot.x,ot.y,ot.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,n){return e=e*this.data.stride+this.offset,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.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new ze(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 Vn(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}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}}}Vn.prototype.isInterleavedBufferAttribute=!0;class fo extends yt{constructor(e){super(),this.type="SpriteMaterial",this.color=new le(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!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}}fo.prototype.isSpriteMaterial=!0;let or;const jr=new S,ar=new S,lr=new S,cr=new W,Qr=new W,Yh=new ge,po=new S,Kr=new S,mo=new S,Jh=new W,ll=new W,Zh=new W;class go extends Ne{constructor(e){if(super(),this.type="Sprite",or===void 0){or=new ve;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 mi(t,5);or.setIndex([0,1,2,0,2,3]),or.setAttribute("position",new Vn(n,3,0,!1)),or.setAttribute("uv",new Vn(n,2,3,!1))}this.geometry=or,this.material=e!==void 0?e:new fo,this.center=new W(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ar.setFromMatrixScale(this.matrixWorld),Yh.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),lr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&ar.multiplyScalar(-lr.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const o=this.center;xo(po.set(-.5,-.5,0),lr,o,ar,i,s),xo(Kr.set(.5,-.5,0),lr,o,ar,i,s),xo(mo.set(.5,.5,0),lr,o,ar,i,s),Jh.set(0,0),ll.set(1,0),Zh.set(1,1);let a=e.ray.intersectTriangle(po,Kr,mo,!1,jr);if(a===null&&(xo(Kr.set(-.5,.5,0),lr,o,ar,i,s),ll.set(0,1),a=e.ray.intersectTriangle(po,mo,Kr,!1,jr),a===null))return;const l=e.ray.origin.distanceTo(jr);l<e.near||l>e.far||t.push({distance:l,point:jr.clone(),uv:st.getUV(jr,po,Kr,mo,Jh,ll,Zh,new W),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}go.prototype.isSprite=!0;function xo(r,e,t,n,i,s){cr.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Qr.x=s*cr.x-i*cr.y,Qr.y=i*cr.x+s*cr.y):Qr.copy(cr),r.copy(e),r.x+=Qr.x,r.y+=Qr.y,r.applyMatrix4(Yh)}const yo=new S,$h=new S;class jh extends Ne{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 s=t[n];this.addLevel(s.object.clone(),s.distance)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0){t=Math.abs(t);const n=this.levels;let i;for(i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this}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&&!(e<t[n].distance);n++);return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){yo.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(yo);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){yo.setFromMatrixPosition(e.matrixWorld),$h.setFromMatrixPosition(this.matrixWorld);const n=yo.distanceTo($h)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<s;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,s=n.length;i<s;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance})}return t}}const Qh=new S,Kh=new We,ef=new We,q0=new S,tf=new ge;class vo extends ft{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new ge,this.bindMatrixInverse=new ge}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}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 We,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const n=this.skeleton,i=this.geometry;Kh.fromBufferAttribute(i.attributes.skinIndex,e),ef.fromBufferAttribute(i.attributes.skinWeight,e),Qh.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=ef.getComponent(s);if(o!==0){const a=Kh.getComponent(s);tf.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(q0.copy(Qh).applyMatrix4(tf),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}vo.prototype.isSkinnedMesh=!0;class _o extends Ne{constructor(){super(),this.type="Bone"}}_o.prototype.isBone=!0;class gi extends ht{constructor(e=null,t=1,n=1,i,s,o,a,l,c=rt,u=rt,h,f){super(null,o,a,l,c,u,i,s,h,f),this.image={data:e,width:t,height:n},this.magFilter=c,this.minFilter=u,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}gi.prototype.isDataTexture=!0;const nf=new ge,X0=new ge;class Mo{constructor(e=[],t=[]){this.uuid=Bt(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,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 ge)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new ge;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 s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:X0;nf.multiplyMatrices(a,t[s]),nf.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Mo(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Ou(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new gi(t,e,e,ut,en);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,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 s=e.bones[n];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new _o),this.bones.push(o),this.boneInverses.push(new ge().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const o=t[i];e.bones.push(o.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class xi extends ze{constructor(e,t,n,i=1){typeof n=="number"&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,n),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}}xi.prototype.isInstancedBufferAttribute=!0;const rf=new ge,sf=new ge,bo=[],es=new ft;class cl extends ft{constructor(e,t,n){super(e,t),this.instanceMatrix=new xi(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const n=this.matrixWorld,i=this.count;if(es.geometry=this.geometry,es.material=this.material,es.material!==void 0)for(let s=0;s<i;s++){this.getMatrixAt(s,rf),sf.multiplyMatrices(n,rf),es.matrixWorld=sf,es.raycast(e,bo);for(let o=0,a=bo.length;o<a;o++){const l=bo[o];l.instanceId=s,l.object=this,t.push(l)}bo.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new xi(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}cl.prototype.isInstancedMesh=!0;class Mt extends yt{constructor(e){super(),this.type="LineBasicMaterial",this.color=new le(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this}}Mt.prototype.isLineBasicMaterial=!0;const of=new S,af=new S,lf=new ge,ul=new Bn,wo=new Dn;class wn extends Ne{constructor(e=new ve,t=new Mt){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)of.fromBufferAttribute(t,i-1),af.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=of.distanceTo(af);e.setAttribute("lineDistance",new de(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),wo.copy(n.boundingSphere),wo.applyMatrix4(i),wo.radius+=s,e.ray.intersectsSphere(wo)===!1)return;lf.copy(i).invert(),ul.copy(e.ray).applyMatrix4(lf);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new S,u=new S,h=new S,f=new S,d=this.isLineSegments?2:1;if(n.isBufferGeometry){const m=n.index,v=n.attributes.position;if(m!==null){const g=Math.max(0,o.start),p=Math.min(m.count,o.start+o.count);for(let _=g,y=p-1;_<y;_+=d){const M=m.getX(_),b=m.getX(_+1);if(c.fromBufferAttribute(v,M),u.fromBufferAttribute(v,b),ul.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);const P=e.ray.origin.distanceTo(f);P<e.near||P>e.far||t.push({distance:P,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),p=Math.min(v.count,o.start+o.count);for(let _=g,y=p-1;_<y;_+=d){if(c.fromBufferAttribute(v,_),u.fromBufferAttribute(v,_+1),ul.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(f);b<e.near||b>e.far||t.push({distance:b,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}wn.prototype.isLine=!0;const cf=new S,uf=new S;class Dt extends wn{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)cf.fromBufferAttribute(t,i),uf.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+cf.distanceTo(uf);e.setAttribute("lineDistance",new de(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}Dt.prototype.isLineSegments=!0;class hl extends wn{constructor(e,t){super(e,t),this.type="LineLoop"}}hl.prototype.isLineLoop=!0;class yi extends yt{constructor(e){super(),this.type="PointsMaterial",this.color=new le(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!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}}yi.prototype.isPointsMaterial=!0;const hf=new ge,fl=new Bn,So=new Dn,To=new S;class ts extends Ne{constructor(e=new ve,t=new yi){super(),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),So.copy(n.boundingSphere),So.applyMatrix4(i),So.radius+=s,e.ray.intersectsSphere(So)===!1)return;hf.copy(i).invert(),fl.copy(e.ray).applyMatrix4(hf);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a;if(n.isBufferGeometry){const c=n.index,h=n.attributes.position;if(c!==null){const f=Math.max(0,o.start),d=Math.min(c.count,o.start+o.count);for(let m=f,x=d;m<x;m++){const v=c.getX(m);To.fromBufferAttribute(h,v),ff(To,v,l,i,e,t,this)}}else{const f=Math.max(0,o.start),d=Math.min(h.count,o.start+o.count);for(let m=f,x=d;m<x;m++)To.fromBufferAttribute(h,m),ff(To,m,l,i,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}ts.prototype.isPoints=!0;function ff(r,e,t,n,i,s,o){const a=fl.distanceSqToPoint(r);if(a<t){const l=new S;fl.closestPointToPoint(r,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class df extends ht{constructor(e,t,n,i,s,o,a,l,c){super(e,t,n,i,s,o,a,l,c),this.format=a!==void 0?a:Cn,this.minFilter=o!==void 0?o:Ke,this.magFilter=s!==void 0?s:Ke,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)}}df.prototype.isVideoTexture=!0;class pf extends ht{constructor(e,t,n){super({width:e,height:t}),this.format=n,this.magFilter=rt,this.minFilter=rt,this.generateMipmaps=!1,this.needsUpdate=!0}}pf.prototype.isFramebufferTexture=!0;class dl extends ht{constructor(e,t,n,i,s,o,a,l,c,u,h,f){super(null,o,a,l,c,u,i,s,h,f),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}dl.prototype.isCompressedTexture=!0;class mf extends ht{constructor(e,t,n,i,s,o,a,l,c){super(e,t,n,i,s,o,a,l,c),this.needsUpdate=!0}}mf.prototype.isCanvasTexture=!0;class ur extends ve{constructor(e=1,t=8,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 s=[],o=[],a=[],l=[],c=new S,u=new W;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let h=0,f=3;h<=t;h++,f+=3){const d=n+h/t*i;c.x=e*Math.cos(d),c.y=e*Math.sin(d),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[f]/e+1)/2,u.y=(o[f+1]/e+1)/2,l.push(u.x,u.y)}for(let h=1;h<=t;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new de(o,3)),this.setAttribute("normal",new de(a,3)),this.setAttribute("uv",new de(l,2))}static fromJSON(e){return new ur(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class kn extends ve{constructor(e=1,t=1,n=1,i=8,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const u=[],h=[],f=[],d=[];let m=0;const x=[],v=n/2;let g=0;p(),o===!1&&(e>0&&_(!0),t>0&&_(!1)),this.setIndex(u),this.setAttribute("position",new de(h,3)),this.setAttribute("normal",new de(f,3)),this.setAttribute("uv",new de(d,2));function p(){const y=new S,M=new S;let b=0;const E=(t-e)/n;for(let P=0;P<=s;P++){const z=[],N=P/s,I=N*(t-e)+e;for(let w=0;w<=i;w++){const T=w/i,B=T*l+a,L=Math.sin(B),F=Math.cos(B);M.x=I*L,M.y=-N*n+v,M.z=I*F,h.push(M.x,M.y,M.z),y.set(L,E,F).normalize(),f.push(y.x,y.y,y.z),d.push(T,1-N),z.push(m++)}x.push(z)}for(let P=0;P<i;P++)for(let z=0;z<s;z++){const N=x[z][P],I=x[z+1][P],w=x[z+1][P+1],T=x[z][P+1];u.push(N,I,T),u.push(I,w,T),b+=6}c.addGroup(g,b,0),g+=b}function _(y){const M=m,b=new W,E=new S;let P=0;const z=y===!0?e:t,N=y===!0?1:-1;for(let w=1;w<=i;w++)h.push(0,v*N,0),f.push(0,N,0),d.push(.5,.5),m++;const I=m;for(let w=0;w<=i;w++){const B=w/i*l+a,L=Math.cos(B),F=Math.sin(B);E.x=z*F,E.y=v*N,E.z=z*L,h.push(E.x,E.y,E.z),f.push(0,N,0),b.x=L*.5+.5,b.y=F*.5*N+.5,d.push(b.x,b.y),m++}for(let w=0;w<i;w++){const T=M+w,B=I+w;y===!0?u.push(B,B+1,T):u.push(B+1,B,T),P+=3}c.addGroup(g,P,y===!0?1:2),g+=P}}static fromJSON(e){return new kn(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class hr extends kn{constructor(e=1,t=1,n=8,i=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,n,i,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new hr(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class rn extends ve{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],o=[];a(i),c(n),u(),this.setAttribute("position",new de(s,3)),this.setAttribute("normal",new de(s.slice(),3)),this.setAttribute("uv",new de(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(p){const _=new S,y=new S,M=new S;for(let b=0;b<t.length;b+=3)d(t[b+0],_),d(t[b+1],y),d(t[b+2],M),l(_,y,M,p)}function l(p,_,y,M){const b=M+1,E=[];for(let P=0;P<=b;P++){E[P]=[];const z=p.clone().lerp(y,P/b),N=_.clone().lerp(y,P/b),I=b-P;for(let w=0;w<=I;w++)w===0&&P===b?E[P][w]=z:E[P][w]=z.clone().lerp(N,w/I)}for(let P=0;P<b;P++)for(let z=0;z<2*(b-P)-1;z++){const N=Math.floor(z/2);z%2===0?(f(E[P][N+1]),f(E[P+1][N]),f(E[P][N])):(f(E[P][N+1]),f(E[P+1][N+1]),f(E[P+1][N]))}}function c(p){const _=new S;for(let y=0;y<s.length;y+=3)_.x=s[y+0],_.y=s[y+1],_.z=s[y+2],_.normalize().multiplyScalar(p),s[y+0]=_.x,s[y+1]=_.y,s[y+2]=_.z}function u(){const p=new S;for(let _=0;_<s.length;_+=3){p.x=s[_+0],p.y=s[_+1],p.z=s[_+2];const y=v(p)/2/Math.PI+.5,M=g(p)/Math.PI+.5;o.push(y,1-M)}m(),h()}function h(){for(let p=0;p<o.length;p+=6){const _=o[p+0],y=o[p+2],M=o[p+4],b=Math.max(_,y,M),E=Math.min(_,y,M);b>.9&&E<.1&&(_<.2&&(o[p+0]+=1),y<.2&&(o[p+2]+=1),M<.2&&(o[p+4]+=1))}}function f(p){s.push(p.x,p.y,p.z)}function d(p,_){const y=p*3;_.x=e[y+0],_.y=e[y+1],_.z=e[y+2]}function m(){const p=new S,_=new S,y=new S,M=new S,b=new W,E=new W,P=new W;for(let z=0,N=0;z<s.length;z+=9,N+=6){p.set(s[z+0],s[z+1],s[z+2]),_.set(s[z+3],s[z+4],s[z+5]),y.set(s[z+6],s[z+7],s[z+8]),b.set(o[N+0],o[N+1]),E.set(o[N+2],o[N+3]),P.set(o[N+4],o[N+5]),M.copy(p).add(_).add(y).divideScalar(3);const I=v(M);x(b,N+0,p,I),x(E,N+2,_,I),x(P,N+4,y,I)}}function x(p,_,y,M){M<0&&p.x===1&&(o[_]=p.x-1),y.x===0&&y.z===0&&(o[_]=M/2/Math.PI+.5)}function v(p){return Math.atan2(p.z,-p.x)}function g(p){return Math.atan2(-p.y,Math.sqrt(p.x*p.x+p.z*p.z))}}static fromJSON(e){return new rn(e.vertices,e.indices,e.radius,e.details)}}class fr extends rn{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-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(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new fr(e.radius,e.detail)}}const Eo=new S,Ao=new S,pl=new S,Co=new st;class ml extends ve{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(oi*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],u=["a","b","c"],h=new Array(3),f={},d=[];for(let m=0;m<l;m+=3){o?(c[0]=o.getX(m),c[1]=o.getX(m+1),c[2]=o.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:x,b:v,c:g}=Co;if(x.fromBufferAttribute(a,c[0]),v.fromBufferAttribute(a,c[1]),g.fromBufferAttribute(a,c[2]),Co.getNormal(pl),h[0]=`${Math.round(x.x*i)},${Math.round(x.y*i)},${Math.round(x.z*i)}`,h[1]=`${Math.round(v.x*i)},${Math.round(v.y*i)},${Math.round(v.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 p=0;p<3;p++){const _=(p+1)%3,y=h[p],M=h[_],b=Co[u[p]],E=Co[u[_]],P=`${y}_${M}`,z=`${M}_${y}`;z in f&&f[z]?(pl.dot(f[z].normal)<=s&&(d.push(b.x,b.y,b.z),d.push(E.x,E.y,E.z)),f[z]=null):P in f||(f[P]={index0:c[p],index1:c[_],normal:pl.clone()})}}for(const m in f)if(f[m]){const{index0:x,index1:v}=f[m];Eo.fromBufferAttribute(a,x),Ao.fromBufferAttribute(a,v),d.push(Eo.x,Eo.y,Eo.z),d.push(Ao.x,Ao.y,Ao.z)}this.setAttribute("position",new de(d,3))}}}class Ot{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),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=n[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===o)return i/(s-1);const u=n[i],f=n[i+1]-u,d=(o-u)/f;return(i+d)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new W:new S);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new S,i=[],s=[],o=[],a=new S,l=new ge;for(let d=0;d<=e;d++){const m=d/e;i[d]=this.getTangentAt(m,new S)}s[0]=new S,o[0]=new S;let c=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),f=Math.abs(i[0].z);u<=c&&(c=u,n.set(1,0,0)),h<=c&&(c=h,n.set(0,1,0)),f<=c&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(St(i[d-1].dot(i[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(a,m))}o[d].crossVectors(i[d],s[d])}if(t===!0){let d=Math.acos(St(s[0].dot(s[e]),-1,1));d/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(i[m],d*m)),o[m].crossVectors(i[m],s[m])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class ns extends Ot{constructor(e=0,t=0,n=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const n=t||new W,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),f=l-this.aX,d=c-this.aY;l=f*u-d*h+this.aX,c=f*h+d*u+this.aY}return n.set(l,c)}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}}ns.prototype.isEllipseCurve=!0;class gl extends ns{constructor(e,t,n,i,s,o){super(e,t,n,n,i,s,o),this.type="ArcCurve"}}gl.prototype.isArcCurve=!0;function xl(){let r=0,e=0,t=0,n=0;function i(s,o,a,l){r=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){i(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,h){let f=(o-s)/c-(a-s)/(c+u)+(a-o)/u,d=(a-o)/u-(l-o)/(u+h)+(l-a)/h;f*=u,d*=u,i(o,a,f,d)},calc:function(s){const o=s*s,a=o*s;return r+e*s+t*o+n*a}}}const Lo=new S,yl=new xl,vl=new xl,_l=new xl;class Ml extends Ot{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new S){const n=t,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=i[(a-1)%s]:(Lo.subVectors(i[0],i[1]).add(i[0]),c=Lo);const h=i[a%s],f=i[(a+1)%s];if(this.closed||a+2<s?u=i[(a+2)%s]:(Lo.subVectors(i[s-1],i[s-2]).add(i[s-1]),u=Lo),this.curveType==="centripetal"||this.curveType==="chordal"){const d=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(h),d),x=Math.pow(h.distanceToSquared(f),d),v=Math.pow(f.distanceToSquared(u),d);x<1e-4&&(x=1),m<1e-4&&(m=x),v<1e-4&&(v=x),yl.initNonuniformCatmullRom(c.x,h.x,f.x,u.x,m,x,v),vl.initNonuniformCatmullRom(c.y,h.y,f.y,u.y,m,x,v),_l.initNonuniformCatmullRom(c.z,h.z,f.z,u.z,m,x,v)}else this.curveType==="catmullrom"&&(yl.initCatmullRom(c.x,h.x,f.x,u.x,this.tension),vl.initCatmullRom(c.y,h.y,f.y,u.y,this.tension),_l.initCatmullRom(c.z,h.z,f.z,u.z,this.tension));return n.set(yl.calc(l),vl.calc(l),_l.calc(l)),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 S().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}Ml.prototype.isCatmullRomCurve3=!0;function gf(r,e,t,n,i){const s=(n-e)*.5,o=(i-t)*.5,a=r*r,l=r*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*r+t}function Y0(r,e){const t=1-r;return t*t*e}function J0(r,e){return 2*(1-r)*r*e}function Z0(r,e){return r*r*e}function is(r,e,t,n){return Y0(r,e)+J0(r,t)+Z0(r,n)}function $0(r,e){const t=1-r;return t*t*t*e}function j0(r,e){const t=1-r;return 3*t*t*r*e}function Q0(r,e){return 3*(1-r)*r*r*e}function K0(r,e){return r*r*r*e}function rs(r,e,t,n,i){return $0(r,e)+j0(r,t)+Q0(r,n)+K0(r,i)}class Ro extends Ot{constructor(e=new W,t=new W,n=new W,i=new W){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new W){const n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(rs(e,i.x,s.x,o.x,a.x),rs(e,i.y,s.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}}Ro.prototype.isCubicBezierCurve=!0;class bl extends Ot{constructor(e=new S,t=new S,n=new S,i=new S){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new S){const n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(rs(e,i.x,s.x,o.x,a.x),rs(e,i.y,s.y,o.y,a.y),rs(e,i.z,s.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}}bl.prototype.isCubicBezierCurve3=!0;class ss extends Ot{constructor(e=new W,t=new W){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new W){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){const n=t||new W;return n.copy(this.v2).sub(this.v1).normalize(),n}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}}ss.prototype.isLineCurve=!0;class xf extends Ot{constructor(e=new S,t=new S){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new S){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)}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 Po extends Ot{constructor(e=new W,t=new W,n=new W){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new W){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(is(e,i.x,s.x,o.x),is(e,i.y,s.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}}Po.prototype.isQuadraticBezierCurve=!0;class Io extends Ot{constructor(e=new S,t=new S,n=new S){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new S){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(is(e,i.x,s.x,o.x),is(e,i.y,s.y,o.y),is(e,i.z,s.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}}Io.prototype.isQuadraticBezierCurve3=!0;class Do extends Ot{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new W){const n=t,i=this.points,s=(i.length-1)*e,o=Math.floor(s),a=s-o,l=i[o===0?o:o-1],c=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(gf(a,l.x,c.x,u.x,h.x),gf(a,l.y,c.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 W().fromArray(i))}return this}}Do.prototype.isSplineCurve=!0;var wl=Object.freeze({__proto__:null,ArcCurve:gl,CatmullRomCurve3:Ml,CubicBezierCurve:Ro,CubicBezierCurve3:bl,EllipseCurve:ns,LineCurve:ss,LineCurve3:xf,QuadraticBezierCurve:Po,QuadraticBezierCurve3:Io,SplineCurve:Do});class yf extends Ot{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);e.equals(t)||this.curves.push(new ss(t,e))}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const o=i[s]-n,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}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,s=this.curves;i<s.length;i++){const o=s[i],a=o&&o.isEllipseCurve?e*2:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const u=l[c];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 wl[i.type]().fromJSON(i))}return this}}class os extends yf{constructor(e){super(),this.type="Path",this.currentPoint=new W,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 ss(this.currentPoint.clone(),new W(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new Po(this.currentPoint.clone(),new W(e,t),new W(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,o){const a=new Ro(this.currentPoint.clone(),new W(e,t),new W(n,i),new W(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Do(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,i,s,o),this}absarc(e,t,n,i,s,o){return this.absellipse(e,t,n,n,i,s,o),this}ellipse(e,t,n,i,s,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,i,s,o,a,l),this}absellipse(e,t,n,i,s,o,a,l){const c=new ns(e,t,n,i,s,o,a,l);if(this.curves.length>0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.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 Jt extends os{constructor(e){super(e),this.uuid=Bt(),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 os().fromJSON(i))}return this}}const ey={triangulate:function(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=vf(r,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,h,f,d;if(n&&(s=sy(r,e,s,t)),r.length>80*t){a=c=r[0],l=u=r[1];for(let m=t;m<i;m+=t)h=r[m],f=r[m+1],h<a&&(a=h),f<l&&(l=f),h>c&&(c=h),f>u&&(u=f);d=Math.max(c-a,u-l),d=d!==0?1/d:0}return as(s,o,t,a,l,d),o}};function vf(r,e,t,n,i){let s,o;if(i===gy(r,e,t,n)>0)for(s=e;s<t;s+=n)o=bf(s,r[s],r[s+1],o);else for(s=t-n;s>=e;s-=n)o=bf(s,r[s],r[s+1],o);return o&&Fo(o,o.next)&&(cs(o),o=o.next),o}function Wn(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(Fo(t,t.next)||Qe(t.prev,t,t.next)===0)){if(cs(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function as(r,e,t,n,i,s,o){if(!r)return;!o&&s&&uy(r,n,i,s);let a=r,l,c;for(;r.prev!==r.next;){if(l=r.prev,c=r.next,s?ny(r,n,i,s):ty(r)){e.push(l.i/t),e.push(r.i/t),e.push(c.i/t),cs(r),r=c.next,a=c.next;continue}if(r=c,r===a){o?o===1?(r=iy(Wn(r),e,t),as(r,e,t,n,i,s,2)):o===2&&ry(r,e,t,n,i,s):as(Wn(r),e,t,n,i,s,1);break}}}function ty(r){const e=r.prev,t=r,n=r.next;if(Qe(e,t,n)>=0)return!1;let i=r.next.next;for(;i!==r.prev;){if(dr(e.x,e.y,t.x,t.y,n.x,n.y,i.x,i.y)&&Qe(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function ny(r,e,t,n){const i=r.prev,s=r,o=r.next;if(Qe(i,s,o)>=0)return!1;const a=i.x<s.x?i.x<o.x?i.x:o.x:s.x<o.x?s.x:o.x,l=i.y<s.y?i.y<o.y?i.y:o.y:s.y<o.y?s.y:o.y,c=i.x>s.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,u=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,h=Sl(a,l,e,t,n),f=Sl(c,u,e,t,n);let d=r.prevZ,m=r.nextZ;for(;d&&d.z>=h&&m&&m.z<=f;){if(d!==r.prev&&d!==r.next&&dr(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&Qe(d.prev,d,d.next)>=0||(d=d.prevZ,m!==r.prev&&m!==r.next&&dr(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&Qe(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;d&&d.z>=h;){if(d!==r.prev&&d!==r.next&&dr(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&Qe(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=f;){if(m!==r.prev&&m!==r.next&&dr(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&Qe(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function iy(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!Fo(i,s)&&_f(i,n,n.next,s)&&ls(i,s)&&ls(s,i)&&(e.push(i.i/t),e.push(n.i/t),e.push(s.i/t),cs(n),cs(n.next),n=r=s),n=n.next}while(n!==r);return Wn(n)}function ry(r,e,t,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&dy(o,a)){let l=Mf(o,a);o=Wn(o,o.next),l=Wn(l,l.next),as(o,e,t,n,i,s),as(l,e,t,n,i,s);return}a=a.next}o=o.next}while(o!==r)}function sy(r,e,t,n){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*n,l=s<o-1?e[s+1]*n:r.length,c=vf(r,a,l,n,!1),c===c.next&&(c.steiner=!0),i.push(fy(c));for(i.sort(oy),s=0;s<i.length;s++)ay(i[s],t),t=Wn(t,t.next);return t}function oy(r,e){return r.x-e.x}function ay(r,e){if(e=ly(r,e),e){const t=Mf(e,r);Wn(e,e.next),Wn(t,t.next)}}function ly(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,o;do{if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const f=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s){if(s=f,f===n){if(i===t.y)return t;if(i===t.next.y)return t.next}o=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!o)return null;if(n===s)return o;const a=o,l=o.x,c=o.y;let u=1/0,h;t=o;do n>=t.x&&t.x>=l&&n!==t.x&&dr(i<c?n:s,i,l,c,i<c?s:n,i,t.x,t.y)&&(h=Math.abs(i-t.y)/(n-t.x),ls(t,r)&&(h<u||h===u&&(t.x>o.x||t.x===o.x&&cy(o,t)))&&(o=t,u=h)),t=t.next;while(t!==a);return o}function cy(r,e){return Qe(r.prev,r,e.prev)<0&&Qe(e.next,r,r.next)<0}function uy(r,e,t,n){let i=r;do i.z===null&&(i.z=Sl(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,hy(i)}function hy(r){let e,t,n,i,s,o,a,l,c=1;do{for(t=r,r=null,s=null,o=0;t;){for(o++,n=t,a=0,e=0;e<c&&(a++,n=n.nextZ,!!n);e++);for(l=c;a>0||l>0&&n;)a!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,c*=2}while(o>1);return r}function Sl(r,e,t,n,i){return r=32767*(r-t)*i,e=32767*(e-n)*i,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function fy(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function dr(r,e,t,n,i,s,o,a){return(i-o)*(e-a)-(r-o)*(s-a)>=0&&(r-o)*(n-a)-(t-o)*(e-a)>=0&&(t-o)*(s-a)-(i-o)*(n-a)>=0}function dy(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!py(r,e)&&(ls(r,e)&&ls(e,r)&&my(r,e)&&(Qe(r.prev,r,e.prev)||Qe(r,e.prev,e))||Fo(r,e)&&Qe(r.prev,r,r.next)>0&&Qe(e.prev,e,e.next)>0)}function Qe(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Fo(r,e){return r.x===e.x&&r.y===e.y}function _f(r,e,t,n){const i=No(Qe(r,e,t)),s=No(Qe(r,e,n)),o=No(Qe(t,n,r)),a=No(Qe(t,n,e));return!!(i!==s&&o!==a||i===0&&Bo(r,t,e)||s===0&&Bo(r,n,e)||o===0&&Bo(t,r,n)||a===0&&Bo(t,e,n))}function Bo(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function No(r){return r>0?1:r<0?-1:0}function py(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&_f(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function ls(r,e){return Qe(r.prev,r,r.next)<0?Qe(r,e,r.next)>=0&&Qe(r,r.prev,e)>=0:Qe(r,e,r.prev)<0||Qe(r,r.next,e)<0}function my(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function Mf(r,e){const t=new Tl(r.i,r.x,r.y),n=new Tl(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function bf(r,e,t,n){const i=new Tl(r,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 cs(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Tl(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function gy(r,e,t,n){let i=0;for(let s=e,o=t-n;s<t;s+=n)i+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=s;return i}class sn{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return sn.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];wf(e),Sf(n,e);let o=e.length;t.forEach(wf);for(let l=0;l<t.length;l++)i.push(o),o+=t[l].length,Sf(n,t[l]);const a=ey.triangulate(n,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function wf(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function Sf(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class on extends ve{constructor(e=new Jt([new W(.5,.5),new W(-.5,.5),new W(-.5,-.5),new W(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new de(i,3)),this.setAttribute("uv",new de(s,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1;let h=t.depth!==void 0?t.depth:1,f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,m=t.bevelSize!==void 0?t.bevelSize:d-.1,x=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,p=t.UVGenerator!==void 0?t.UVGenerator:xy;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),h=t.amount);let _,y=!1,M,b,E,P;g&&(_=g.getSpacedPoints(u),y=!0,f=!1,M=g.computeFrenetFrames(u,!1),b=new S,E=new S,P=new S),f||(v=0,d=0,m=0,x=0);const z=a.extractPoints(c);let N=z.shape;const I=z.holes;if(!sn.isClockWise(N)){N=N.reverse();for(let k=0,$=I.length;k<$;k++){const ie=I[k];sn.isClockWise(ie)&&(I[k]=ie.reverse())}}const T=sn.triangulateShape(N,I),B=N;for(let k=0,$=I.length;k<$;k++){const ie=I[k];N=N.concat(ie)}function L(k,$,ie){return $||console.error("THREE.ExtrudeGeometry: vec does not exist"),$.clone().multiplyScalar(ie).add(k)}const F=N.length,U=T.length;function Z(k,$,ie){let fe,ce,Ee;const Ae=k.x-$.x,De=k.y-$.y,je=ie.x-k.x,R=ie.y-k.y,C=Ae*Ae+De*De,J=Ae*R-De*je;if(Math.abs(J)>Number.EPSILON){const Q=Math.sqrt(C),ae=Math.sqrt(je*je+R*R),j=$.x-De/Q,we=$.y+Ae/Q,_e=ie.x-R/ae,se=ie.y+je/ae,D=((_e-j)*R-(se-we)*je)/(Ae*R-De*je);fe=j+Ae*D-k.x,ce=we+De*D-k.y;const re=fe*fe+ce*ce;if(re<=2)return new W(fe,ce);Ee=Math.sqrt(re/2)}else{let Q=!1;Ae>Number.EPSILON?je>Number.EPSILON&&(Q=!0):Ae<-Number.EPSILON?je<-Number.EPSILON&&(Q=!0):Math.sign(De)===Math.sign(R)&&(Q=!0),Q?(fe=-De,ce=Ae,Ee=Math.sqrt(C)):(fe=Ae,ce=De,Ee=Math.sqrt(C/2))}return new W(fe/Ee,ce/Ee)}const ee=[];for(let k=0,$=B.length,ie=$-1,fe=k+1;k<$;k++,ie++,fe++)ie===$&&(ie=0),fe===$&&(fe=0),ee[k]=Z(B[k],B[ie],B[fe]);const V=[];let q,ne=ee.concat();for(let k=0,$=I.length;k<$;k++){const ie=I[k];q=[];for(let fe=0,ce=ie.length,Ee=ce-1,Ae=fe+1;fe<ce;fe++,Ee++,Ae++)Ee===ce&&(Ee=0),Ae===ce&&(Ae=0),q[fe]=Z(ie[fe],ie[Ee],ie[Ae]);V.push(q),ne=ne.concat(q)}for(let k=0;k<v;k++){const $=k/v,ie=d*Math.cos($*Math.PI/2),fe=m*Math.sin($*Math.PI/2)+x;for(let ce=0,Ee=B.length;ce<Ee;ce++){const Ae=L(B[ce],ee[ce],fe);be(Ae.x,Ae.y,-ie)}for(let ce=0,Ee=I.length;ce<Ee;ce++){const Ae=I[ce];q=V[ce];for(let De=0,je=Ae.length;De<je;De++){const R=L(Ae[De],q[De],fe);be(R.x,R.y,-ie)}}}const K=m+x;for(let k=0;k<F;k++){const $=f?L(N[k],ne[k],K):N[k];y?(E.copy(M.normals[0]).multiplyScalar($.x),b.copy(M.binormals[0]).multiplyScalar($.y),P.copy(_[0]).add(E).add(b),be(P.x,P.y,P.z)):be($.x,$.y,0)}for(let k=1;k<=u;k++)for(let $=0;$<F;$++){const ie=f?L(N[$],ne[$],K):N[$];y?(E.copy(M.normals[k]).multiplyScalar(ie.x),b.copy(M.binormals[k]).multiplyScalar(ie.y),P.copy(_[k]).add(E).add(b),be(P.x,P.y,P.z)):be(ie.x,ie.y,h/u*k)}for(let k=v-1;k>=0;k--){const $=k/v,ie=d*Math.cos($*Math.PI/2),fe=m*Math.sin($*Math.PI/2)+x;for(let ce=0,Ee=B.length;ce<Ee;ce++){const Ae=L(B[ce],ee[ce],fe);be(Ae.x,Ae.y,h+ie)}for(let ce=0,Ee=I.length;ce<Ee;ce++){const Ae=I[ce];q=V[ce];for(let De=0,je=Ae.length;De<je;De++){const R=L(Ae[De],q[De],fe);y?be(R.x,R.y+_[u-1].y,_[u-1].x+ie):be(R.x,R.y,h+ie)}}}he(),Me();function he(){const k=i.length/3;if(f){let $=0,ie=F*$;for(let fe=0;fe<U;fe++){const ce=T[fe];pe(ce[2]+ie,ce[1]+ie,ce[0]+ie)}$=u+v*2,ie=F*$;for(let fe=0;fe<U;fe++){const ce=T[fe];pe(ce[0]+ie,ce[1]+ie,ce[2]+ie)}}else{for(let $=0;$<U;$++){const ie=T[$];pe(ie[2],ie[1],ie[0])}for(let $=0;$<U;$++){const ie=T[$];pe(ie[0]+F*u,ie[1]+F*u,ie[2]+F*u)}}n.addGroup(k,i.length/3-k,0)}function Me(){const k=i.length/3;let $=0;Y(B,$),$+=B.length;for(let ie=0,fe=I.length;ie<fe;ie++){const ce=I[ie];Y(ce,$),$+=ce.length}n.addGroup(k,i.length/3-k,1)}function Y(k,$){let ie=k.length;for(;--ie>=0;){const fe=ie;let ce=ie-1;ce<0&&(ce=k.length-1);for(let Ee=0,Ae=u+v*2;Ee<Ae;Ee++){const De=F*Ee,je=F*(Ee+1),R=$+fe+De,C=$+ce+De,J=$+ce+je,Q=$+fe+je;me(R,C,J,Q)}}}function be(k,$,ie){l.push(k),l.push($),l.push(ie)}function pe(k,$,ie){ye(k),ye($),ye(ie);const fe=i.length/3,ce=p.generateTopUV(n,i,fe-3,fe-2,fe-1);Oe(ce[0]),Oe(ce[1]),Oe(ce[2])}function me(k,$,ie,fe){ye(k),ye($),ye(fe),ye($),ye(ie),ye(fe);const ce=i.length/3,Ee=p.generateSideWallUV(n,i,ce-6,ce-3,ce-2,ce-1);Oe(Ee[0]),Oe(Ee[1]),Oe(Ee[3]),Oe(Ee[1]),Oe(Ee[2]),Oe(Ee[3])}function ye(k){i.push(l[k*3+0]),i.push(l[k*3+1]),i.push(l[k*3+2])}function Oe(k){s.push(k.x),s.push(k.y)}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return yy(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];n.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new wl[i.type]().fromJSON(i)),new on(n,e.options)}}const xy={generateTopUV:function(r,e,t,n,i){const s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[i*3],u=e[i*3+1];return[new W(s,o),new W(a,l),new W(c,u)]},generateSideWallUV:function(r,e,t,n,i,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],h=e[n*3+2],f=e[i*3],d=e[i*3+1],m=e[i*3+2],x=e[s*3],v=e[s*3+1],g=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new W(o,1-l),new W(c,1-h),new W(f,1-m),new W(x,1-g)]:[new W(a,1-l),new W(u,1-h),new W(d,1-m),new W(v,1-g)]}};function yy(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class pr extends rn{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],s=[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,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new pr(e.radius,e.detail)}}class mr extends ve{constructor(e=[new W(0,.5),new W(.5,0),new W(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=St(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,h=new S,f=new W,d=new S,m=new S,x=new S;let v=0,g=0;for(let p=0;p<=e.length-1;p++)switch(p){case 0:v=e[p+1].x-e[p].x,g=e[p+1].y-e[p].y,d.x=g*1,d.y=-v,d.z=g*0,x.copy(d),d.normalize(),l.push(d.x,d.y,d.z);break;case e.length-1:l.push(x.x,x.y,x.z);break;default:v=e[p+1].x-e[p].x,g=e[p+1].y-e[p].y,d.x=g*1,d.y=-v,d.z=g*0,m.copy(d),d.x+=x.x,d.y+=x.y,d.z+=x.z,d.normalize(),l.push(d.x,d.y,d.z),x.copy(m)}for(let p=0;p<=t;p++){const _=n+p*u*i,y=Math.sin(_),M=Math.cos(_);for(let b=0;b<=e.length-1;b++){h.x=e[b].x*y,h.y=e[b].y,h.z=e[b].x*M,o.push(h.x,h.y,h.z),f.x=p/t,f.y=b/(e.length-1),a.push(f.x,f.y);const E=l[3*b+0]*y,P=l[3*b+1],z=l[3*b+0]*M;c.push(E,P,z)}}for(let p=0;p<t;p++)for(let _=0;_<e.length-1;_++){const y=_+p*e.length,M=y,b=y+e.length,E=y+e.length+1,P=y+1;s.push(M,b,P),s.push(b,E,P)}this.setIndex(s),this.setAttribute("position",new de(o,3)),this.setAttribute("uv",new de(a,2)),this.setAttribute("normal",new de(c,3))}static fromJSON(e){return new mr(e.points,e.segments,e.phiStart,e.phiLength)}}class vi extends rn{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 vi(e.radius,e.detail)}}class gr extends ve{constructor(e=.5,t=1,n=8,i=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const a=[],l=[],c=[],u=[];let h=e;const f=(t-e)/i,d=new S,m=new W;for(let x=0;x<=i;x++){for(let v=0;v<=n;v++){const g=s+v/n*o;d.x=h*Math.cos(g),d.y=h*Math.sin(g),l.push(d.x,d.y,d.z),c.push(0,0,1),m.x=(d.x/t+1)/2,m.y=(d.y/t+1)/2,u.push(m.x,m.y)}h+=f}for(let x=0;x<i;x++){const v=x*(n+1);for(let g=0;g<n;g++){const p=g+v,_=p,y=p+n+1,M=p+n+2,b=p+1;a.push(_,y,b),a.push(y,M,b)}}this.setIndex(a),this.setAttribute("position",new de(l,3)),this.setAttribute("normal",new de(c,3)),this.setAttribute("uv",new de(u,2))}static fromJSON(e){return new gr(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class _i extends ve{constructor(e=new Jt([new W(0,.5),new W(-.5,-.5),new W(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(n),this.setAttribute("position",new de(i,3)),this.setAttribute("normal",new de(s,3)),this.setAttribute("uv",new de(o,2));function c(u){const h=i.length/3,f=u.extractPoints(t);let d=f.shape;const m=f.holes;sn.isClockWise(d)===!1&&(d=d.reverse());for(let v=0,g=m.length;v<g;v++){const p=m[v];sn.isClockWise(p)===!0&&(m[v]=p.reverse())}const x=sn.triangulateShape(d,m);for(let v=0,g=m.length;v<g;v++){const p=m[v];d=d.concat(p)}for(let v=0,g=d.length;v<g;v++){const p=d[v];i.push(p.x,p.y,0),s.push(0,0,1),o.push(p.x,p.y)}for(let v=0,g=x.length;v<g;v++){const p=x[v],_=p[0]+h,y=p[1]+h,M=p[2]+h;n.push(_,y,M),l+=3}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return vy(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=t[e.shapes[i]];n.push(o)}return new _i(n,e.curveSegments)}}function vy(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class Mi extends ve{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(o+a,Math.PI);let c=0;const u=[],h=new S,f=new S,d=[],m=[],x=[],v=[];for(let g=0;g<=n;g++){const p=[],_=g/n;let y=0;g==0&&o==0?y=.5/t:g==n&&l==Math.PI&&(y=-.5/t);for(let M=0;M<=t;M++){const b=M/t;h.x=-e*Math.cos(i+b*s)*Math.sin(o+_*a),h.y=e*Math.cos(o+_*a),h.z=e*Math.sin(i+b*s)*Math.sin(o+_*a),m.push(h.x,h.y,h.z),f.copy(h).normalize(),x.push(f.x,f.y,f.z),v.push(b+y,1-_),p.push(c++)}u.push(p)}for(let g=0;g<n;g++)for(let p=0;p<t;p++){const _=u[g][p+1],y=u[g][p],M=u[g+1][p],b=u[g+1][p+1];(g!==0||o>0)&&d.push(_,y,b),(g!==n-1||l<Math.PI)&&d.push(y,M,b)}this.setIndex(d),this.setAttribute("position",new de(m,3)),this.setAttribute("normal",new de(x,3)),this.setAttribute("uv",new de(v,2))}static fromJSON(e){return new Mi(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class xr extends rn{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 xr(e.radius,e.detail)}}class yr extends ve{constructor(e=1,t=.4,n=8,i=6,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],l=[],c=[],u=new S,h=new S,f=new S;for(let d=0;d<=n;d++)for(let m=0;m<=i;m++){const x=m/i*s,v=d/n*Math.PI*2;h.x=(e+t*Math.cos(v))*Math.cos(x),h.y=(e+t*Math.cos(v))*Math.sin(x),h.z=t*Math.sin(v),a.push(h.x,h.y,h.z),u.x=e*Math.cos(x),u.y=e*Math.sin(x),f.subVectors(h,u).normalize(),l.push(f.x,f.y,f.z),c.push(m/i),c.push(d/n)}for(let d=1;d<=n;d++)for(let m=1;m<=i;m++){const x=(i+1)*d+m-1,v=(i+1)*(d-1)+m-1,g=(i+1)*(d-1)+m,p=(i+1)*d+m;o.push(x,v,p),o.push(v,g,p)}this.setIndex(o),this.setAttribute("position",new de(a,3)),this.setAttribute("normal",new de(l,3)),this.setAttribute("uv",new de(c,2))}static fromJSON(e){return new yr(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class vr extends ve{constructor(e=1,t=.4,n=64,i=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:o},n=Math.floor(n),i=Math.floor(i);const a=[],l=[],c=[],u=[],h=new S,f=new S,d=new S,m=new S,x=new S,v=new S,g=new S;for(let _=0;_<=n;++_){const y=_/n*s*Math.PI*2;p(y,s,o,e,d),p(y+.01,s,o,e,m),v.subVectors(m,d),g.addVectors(m,d),x.crossVectors(v,g),g.crossVectors(x,v),x.normalize(),g.normalize();for(let M=0;M<=i;++M){const b=M/i*Math.PI*2,E=-t*Math.cos(b),P=t*Math.sin(b);h.x=d.x+(E*g.x+P*x.x),h.y=d.y+(E*g.y+P*x.y),h.z=d.z+(E*g.z+P*x.z),l.push(h.x,h.y,h.z),f.subVectors(h,d).normalize(),c.push(f.x,f.y,f.z),u.push(_/n),u.push(M/i)}}for(let _=1;_<=n;_++)for(let y=1;y<=i;y++){const M=(i+1)*(_-1)+(y-1),b=(i+1)*_+(y-1),E=(i+1)*_+y,P=(i+1)*(_-1)+y;a.push(M,b,P),a.push(b,E,P)}this.setIndex(a),this.setAttribute("position",new de(l,3)),this.setAttribute("normal",new de(c,3)),this.setAttribute("uv",new de(u,2));function p(_,y,M,b,E){const P=Math.cos(_),z=Math.sin(_),N=M/y*_,I=Math.cos(N);E.x=b*(2+I)*.5*P,E.y=b*(2+I)*z*.5,E.z=b*Math.sin(N)*.5}}static fromJSON(e){return new vr(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class _r extends ve{constructor(e=new Io(new S(-1,-1,0),new S(-1,1,0),new S(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new S,l=new S,c=new W;let u=new S;const h=[],f=[],d=[],m=[];x(),this.setIndex(m),this.setAttribute("position",new de(h,3)),this.setAttribute("normal",new de(f,3)),this.setAttribute("uv",new de(d,2));function x(){for(let _=0;_<t;_++)v(_);v(s===!1?t:0),p(),g()}function v(_){u=e.getPointAt(_/t,u);const y=o.normals[_],M=o.binormals[_];for(let b=0;b<=i;b++){const E=b/i*Math.PI*2,P=Math.sin(E),z=-Math.cos(E);l.x=z*y.x+P*M.x,l.y=z*y.y+P*M.y,l.z=z*y.z+P*M.z,l.normalize(),f.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,h.push(a.x,a.y,a.z)}}function g(){for(let _=1;_<=t;_++)for(let y=1;y<=i;y++){const M=(i+1)*(_-1)+(y-1),b=(i+1)*_+(y-1),E=(i+1)*_+y,P=(i+1)*(_-1)+y;m.push(M,b,P),m.push(b,E,P)}}function p(){for(let _=0;_<=t;_++)for(let y=0;y<=i;y++)c.x=_/t,c.y=y/i,d.push(c.x,c.y)}}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new _r(new wl[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class El extends ve{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new S,s=new S;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const h=l[c],f=h.start,d=h.count;for(let m=f,x=f+d;m<x;m+=3)for(let v=0;v<3;v++){const g=a.getX(m+v),p=a.getX(m+(v+1)%3);i.fromBufferAttribute(o,g),s.fromBufferAttribute(o,p),Tf(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const u=3*a+c,h=3*a+(c+1)%3;i.fromBufferAttribute(o,u),s.fromBufferAttribute(o,h),Tf(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new de(t,3))}}}function Tf(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n,i),!0)}var Ef=Object.freeze({__proto__:null,BoxGeometry:Mn,BoxBufferGeometry:Mn,CircleGeometry:ur,CircleBufferGeometry:ur,ConeGeometry:hr,ConeBufferGeometry:hr,CylinderGeometry:kn,CylinderBufferGeometry:kn,DodecahedronGeometry:fr,DodecahedronBufferGeometry:fr,EdgesGeometry:ml,ExtrudeGeometry:on,ExtrudeBufferGeometry:on,IcosahedronGeometry:pr,IcosahedronBufferGeometry:pr,LatheGeometry:mr,LatheBufferGeometry:mr,OctahedronGeometry:vi,OctahedronBufferGeometry:vi,PlaneGeometry:hi,PlaneBufferGeometry:hi,PolyhedronGeometry:rn,PolyhedronBufferGeometry:rn,RingGeometry:gr,RingBufferGeometry:gr,ShapeGeometry:_i,ShapeBufferGeometry:_i,SphereGeometry:Mi,SphereBufferGeometry:Mi,TetrahedronGeometry:xr,TetrahedronBufferGeometry:xr,TorusGeometry:yr,TorusBufferGeometry:yr,TorusKnotGeometry:vr,TorusKnotBufferGeometry:vr,TubeGeometry:_r,TubeBufferGeometry:_r,WireframeGeometry:El});class Al extends yt{constructor(e){super(),this.type="ShadowMaterial",this.color=new le(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}}Al.prototype.isShadowMaterial=!0;class zo extends yt{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new le(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 le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=si,this.normalScale=new W(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,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.envMapIntensity=e.envMapIntensity,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}}zo.prototype.isMeshStandardMaterial=!0;class Cl extends zo{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new W(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return St(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new le(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new le(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new le(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=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.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.ior=e.ior,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}}Cl.prototype.isMeshPhysicalMaterial=!0;class Ll extends yt{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new le(16777215),this.specular=new le(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=si,this.normalScale=new W(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Cr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,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.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}}Ll.prototype.isMeshPhongMaterial=!0;class Rl extends yt{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new le(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=si,this.normalScale=new W(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.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}}Rl.prototype.isMeshToonMaterial=!0;class Pl extends yt{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=si,this.normalScale=new W(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!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}}Pl.prototype.isMeshNormalMaterial=!0;class Il extends yt{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Cr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",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.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,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}}Il.prototype.isMeshLambertMaterial=!0;class Dl extends yt{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new le(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=si,this.normalScale=new W(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,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}}Dl.prototype.isMeshMatcapMaterial=!0;class Fl extends Mt{constructor(e){super(),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}}Fl.prototype.isLineDashedMaterial=!0;var _y=Object.freeze({__proto__:null,ShadowMaterial:Al,SpriteMaterial:fo,RawShaderMaterial:tr,ShaderMaterial:bn,PointsMaterial:yi,MeshPhysicalMaterial:Cl,MeshStandardMaterial:zo,MeshPhongMaterial:Ll,MeshToonMaterial:Rl,MeshNormalMaterial:Pl,MeshLambertMaterial:Il,MeshDepthMaterial:lo,MeshDistanceMaterial:co,MeshBasicMaterial:_n,MeshMatcapMaterial:Dl,LineDashedMaterial:Fl,LineBasicMaterial:Mt,Material:yt});const $e={arraySlice:function(r,e,t){return $e.isTypedArray(r)?new r.constructor(r.subarray(e,t!==void 0?t:r.length)):r.slice(e,t)},convertArray:function(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)},isTypedArray:function(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)},getKeyframeOrder:function(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n},sortedArray:function(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=r[a+l]}return i},flattenJSON:function(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)},subclip:function(r,e,t,n,i=30){const s=r.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),h=[],f=[];for(let d=0;d<c.times.length;++d){const m=c.times[d]*i;if(!(m<t||m>=n)){h.push(c.times[d]);for(let x=0;x<u;++x)f.push(c.values[d*u+x])}}h.length!==0&&(c.times=$e.convertArray(h,c.times.constructor),c.values=$e.convertArray(f,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let o=0;o<i;++o){const a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=r.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===l});if(c===void 0)continue;let u=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let f=0;const d=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);const m=a.times.length-1;let x;if(s<=a.times[0]){const g=u,p=h-u;x=$e.arraySlice(a.values,g,p)}else if(s>=a.times[m]){const g=m*h+u,p=g+h-u;x=$e.arraySlice(a.values,g,p)}else{const g=a.createInterpolant(),p=u,_=h-u;g.evaluate(s),x=$e.arraySlice(g.resultBuffer,p,_)}l==="quaternion"&&new Tt().fromArray(x).normalize().conjugate().toArray(x);const v=c.times.length;for(let g=0;g<v;++g){const p=g*d+f;if(l==="quaternion")Tt.multiplyQuaternionsFlat(c.values,p,x,0,c.values,p);else{const _=d-f*2;for(let y=0;y<_;++y)c.values[p+y]-=x[y]}}}return r.blendMode=Aa,r}};class Sn{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],s=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,s)}if(n===a)break;if(s=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===l)break;if(i=s,s=t[--n-1],e>=s)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],s=t[n-1],s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(i===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,s,e)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let o=0;o!==i;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Sn.prototype.beforeStart_=Sn.prototype.copySampleValue_,Sn.prototype.afterEnd_=Sn.prototype.copySampleValue_;class Af extends Sn{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:ni,endingEnd:ni}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,o=e+1,a=i[s],l=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case ii:s=e,a=2*t-n;break;case zr:s=i.length-2,a=t+i[s]-i[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case ii:o=e,l=2*n-t;break;case zr:o=1,l=n+i[1]-i[0];break;default:o=e-1,l=t}const c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,d=this._weightNext,m=(n-t)/(i-t),x=m*m,v=x*m,g=-f*v+2*f*x-f*m,p=(1+f)*v+(-1.5-2*f)*x+(-.5+f)*m+1,_=(-1-d)*v+(1.5+d)*x+.5*m,y=d*v-d*x;for(let M=0;M!==a;++M)s[M]=g*o[u+M]+p*o[c+M]+_*o[l+M]+y*o[h+M];return s}}class Bl extends Sn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(i-t),h=1-u;for(let f=0;f!==a;++f)s[f]=o[c+f]*h+o[l+f]*u;return s}}class Cf extends Sn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Zt{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=$e.convertArray(t,this.TimeBufferType),this.values=$e.convertArray(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:$e.convertArray(e.times,Array),values:$e.convertArray(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Cf(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Bl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Af(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Br:t=this.InterpolantFactoryMethodDiscrete;break;case Nr:t=this.InterpolantFactoryMethodLinear;break;case Cs: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 Br;case this.InterpolantFactoryMethodLinear:return Nr;case this.InterpolantFactoryMethodSmooth:return Cs}}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 s=0,o=i-1;for(;s!==i&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=$e.arraySlice(n,s,o),this.values=$e.arraySlice(this.values,s*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,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=n[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&$e.isTypedArray(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=$e.arraySlice(this.times),t=$e.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Cs,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(i)l=!0;else{const h=a*n,f=h-n,d=h+n;for(let m=0;m!==n;++m){const x=t[h+m];if(x!==t[f+m]||x!==t[d+m]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const h=a*n,f=o*n;for(let d=0;d!==n;++d)t[f+d]=t[h+d]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=$e.arraySlice(e,0,o),this.values=$e.arraySlice(t,0,o*n)):(this.times=e,this.values=t),this}clone(){const e=$e.arraySlice(this.times,0),t=$e.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Zt.prototype.TimeBufferType=Float32Array,Zt.prototype.ValueBufferType=Float32Array,Zt.prototype.DefaultInterpolation=Nr;class bi extends Zt{}bi.prototype.ValueTypeName="bool",bi.prototype.ValueBufferType=Array,bi.prototype.DefaultInterpolation=Br,bi.prototype.InterpolantFactoryMethodLinear=void 0,bi.prototype.InterpolantFactoryMethodSmooth=void 0;class Nl extends Zt{}Nl.prototype.ValueTypeName="color";class us extends Zt{}us.prototype.ValueTypeName="number";class Lf extends Sn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t);let c=e*a;for(let u=c+a;c!==u;c+=4)Tt.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Mr extends Zt{InterpolantFactoryMethodLinear(e){return new Lf(this.times,this.values,this.getValueSize(),e)}}Mr.prototype.ValueTypeName="quaternion",Mr.prototype.DefaultInterpolation=Nr,Mr.prototype.InterpolantFactoryMethodSmooth=void 0;class wi extends Zt{}wi.prototype.ValueTypeName="string",wi.prototype.ValueBufferType=Array,wi.prototype.DefaultInterpolation=Br,wi.prototype.InterpolantFactoryMethodLinear=void 0,wi.prototype.InterpolantFactoryMethodSmooth=void 0;class hs extends Zt{}hs.prototype.ValueTypeName="vector";class fs{constructor(e,t=-1,n,i=Ls){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Bt(),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(by(n[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}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 s=0,o=n.length;s!==o;++s)t.push(Zt.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const u=$e.getKeyframeOrder(l);l=$e.sortedArray(l,1,u),c=$e.sortedArray(c,1,u),!i&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new us(".morphTargetInfluences["+t[a].name+"]",l,c).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={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],u=c.name.match(s);if(u&&u.length>1){const h=u[1];let f=i[h];f||(i[h]=f=[]),f.push(c)}}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,f,d,m,x){if(d.length!==0){const v=[],g=[];$e.flattenJSON(d,v,g,m),v.length!==0&&x.push(new h(f,v,g))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const f=c[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const d={};let m;for(m=0;m<f.length;m++)if(f[m].morphTargets)for(let x=0;x<f[m].morphTargets.length;x++)d[f[m].morphTargets[x]]=-1;for(const x in d){const v=[],g=[];for(let p=0;p!==f[m].morphTargets.length;++p){const _=f[m];v.push(_.time),g.push(_.morphTarget===x?1:0)}i.push(new us(".morphTargetInfluence["+x+"]",v,g))}l=d.length*(o||1)}else{const d=".bones["+t[h].name+"]";n(hs,d+".position",f,"pos",i),n(Mr,d+".quaternion",f,"rot",i),n(hs,d+".scale",f,"scl",i)}}return i.length===0?null:new this(s,l,i,a)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.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 My(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return us;case"vector":case"vector2":case"vector3":case"vector4":return hs;case"color":return Nl;case"quaternion":return Mr;case"bool":case"boolean":return bi;case"string":return wi}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function by(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=My(r.type);if(r.times===void 0){const t=[],n=[];$e.flattenJSON(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const Si={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class zl{constructor(e,t,n){const i=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){a++,s===!1&&i.onStart!==void 0&&i.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,i.onProgress!==void 0&&i.onProgress(u,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=c.length;h<f;h+=2){const d=c[h],m=c[h+1];if(d.global&&(d.lastIndex=0),d.test(u))return m}return null}}}const Rf=new zl;class It{constructor(e){this.manager=e!==void 0?e:Rf,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}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}}const Tn={};class an extends It{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 s=Si.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Tn[e]!==void 0){Tn[e].push({onLoad:t,onProgress:n,onError:i});return}Tn[e]=[],Tn[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"});fetch(o).then(a=>{if(a.status===200||a.status===0){if(a.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream=="undefined"||a.body.getReader===void 0)return a;const l=Tn[e],c=a.body.getReader(),u=a.headers.get("Content-Length"),h=u?parseInt(u):0,f=h!==0;let d=0;const m=new ReadableStream({start(x){v();function v(){c.read().then(({done:g,value:p})=>{if(g)x.close();else{d+=p.byteLength;const _=new ProgressEvent("progress",{lengthComputable:f,loaded:d,total:h});for(let y=0,M=l.length;y<M;y++){const b=l[y];b.onProgress&&b.onProgress(_)}x.enqueue(p),v()}})}}});return new Response(m)}else throw Error(`fetch for "${a.url}" responded with ${a.status}: ${a.statusText}`)}).then(a=>{switch(this.responseType){case"arraybuffer":return a.arrayBuffer();case"blob":return a.blob();case"document":return a.text().then(l=>new DOMParser().parseFromString(l,this.mimeType));case"json":return a.json();default:return a.text()}}).then(a=>{Si.add(e,a);const l=Tn[e];delete Tn[e];for(let c=0,u=l.length;c<u;c++){const h=l[c];h.onLoad&&h.onLoad(a)}}).catch(a=>{const l=Tn[e];if(l===void 0)throw this.manager.itemError(e),a;delete Tn[e];for(let c=0,u=l.length;c<u;c++){const h=l[c];h.onError&&h.onError(a)}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 wy extends It{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new an(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=fs.parse(e[n]);t.push(i)}return t}}class Sy extends It{constructor(e){super(e)}load(e,t,n,i){const s=this,o=[],a=new dl,l=new an(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(h){l.load(e[h],function(f){const d=s.parse(f,!0);o[h]={width:d.width,height:d.height,format:d.format,mipmaps:d.mipmaps},c+=1,c===6&&(d.mipmapCount===1&&(a.minFilter=Ke),a.image=o,a.format=d.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let h=0,f=e.length;h<f;++h)u(h);else l.load(e,function(h){const f=s.parse(h,!0);if(f.isCubemap){const d=f.mipmaps.length/f.mipmapCount;for(let m=0;m<d;m++){o[m]={mipmaps:[]};for(let x=0;x<f.mipmapCount;x++)o[m].mipmaps.push(f.mipmaps[m*f.mipmapCount+x]),o[m].format=f.format,o[m].width=f.width,o[m].height=f.height}a.image=o}else a.image.width=f.width,a.image.height=f.height,a.mipmaps=f.mipmaps;f.mipmapCount===1&&(a.minFilter=Ke),a.format=f.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}}class ds extends It{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Si.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Is("img");function l(){u(),Si.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),i&&i(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class Pf extends It{constructor(e){super(e)}load(e,t,n,i){const s=new Ki,o=new ds(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){s.images[c]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class If extends It{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new gi,a=new an(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){const c=s.parse(l);!c||(c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:bt,o.wrapT=c.wrapT!==void 0?c.wrapT:bt,o.magFilter=c.magFilter!==void 0?c.magFilter:Ke,o.minFilter=c.minFilter!==void 0?c.minFilter:Ke,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.encoding!==void 0&&(o.encoding=c.encoding),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=Kn),c.mipmapCount===1&&(o.minFilter=Ke),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c))},n,i),o}}class Df extends It{constructor(e){super(e)}load(e,t,n,i){const s=new ht,o=new ds(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class $t extends Ne{constructor(e,t=1){super(),this.type="Light",this.color=new le(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),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()),t}}$t.prototype.isLight=!0;class Ul extends $t{constructor(e,t,n){super(e,n),this.type="HemisphereLight",this.position.copy(Ne.DefaultUp),this.updateMatrix(),this.groundColor=new le(t)}copy(e){return $t.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}Ul.prototype.isHemisphereLight=!0;const Ff=new ge,Bf=new S,Nf=new S;class Ol{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new W(512,512),this.map=null,this.mapPass=null,this.matrix=new ge,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new qr,this._frameExtents=new W(1,1),this._viewportCount=1,this._viewports=[new We(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Bf.setFromMatrixPosition(e.matrixWorld),t.position.copy(Bf),Nf.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Nf),t.updateMatrixWorld(),Ff.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ff),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}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.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.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 zf extends Ol{constructor(){super(new _t(50,1,.5,500)),this.focus=1}updateMatrices(e){const t=this.camera,n=Ur*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}zf.prototype.isSpotLightShadow=!0;class Gl extends $t{constructor(e,t,n=0,i=Math.PI/3,s=0,o=1){super(e,t),this.type="SpotLight",this.position.copy(Ne.DefaultUp),this.updateMatrix(),this.target=new Ne,this.distance=n,this.angle=i,this.penumbra=s,this.decay=o,this.shadow=new zf}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),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}}Gl.prototype.isSpotLight=!0;const Uf=new ge,ps=new S,Hl=new S;class Of extends Ol{constructor(){super(new _t(90,1,.5,500)),this._frameExtents=new W(4,2),this._viewportCount=6,this._viewports=[new We(2,1,1,1),new We(0,1,1,1),new We(3,1,1,1),new We(1,1,1,1),new We(3,0,1,1),new We(1,0,1,1)],this._cubeDirections=[new S(1,0,0),new S(-1,0,0),new S(0,0,1),new S(0,0,-1),new S(0,1,0),new S(0,-1,0)],this._cubeUps=[new S(0,1,0),new S(0,1,0),new S(0,1,0),new S(0,1,0),new S(0,0,1),new S(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),ps.setFromMatrixPosition(e.matrixWorld),n.position.copy(ps),Hl.copy(n.position),Hl.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Hl),n.updateMatrixWorld(),i.makeTranslation(-ps.x,-ps.y,-ps.z),Uf.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Uf)}}Of.prototype.isPointLightShadow=!0;class Vl extends $t{constructor(e,t,n=0,i=1){super(e,t),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Of}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}Vl.prototype.isPointLight=!0;class Gf extends Ol{constructor(){super(new Xr(-5,5,5,-5,.5,500))}}Gf.prototype.isDirectionalLightShadow=!0;class kl extends $t{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(Ne.DefaultUp),this.updateMatrix(),this.target=new Ne,this.shadow=new Gf}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}kl.prototype.isDirectionalLight=!0;class Wl extends $t{constructor(e,t){super(e,t),this.type="AmbientLight"}}Wl.prototype.isAmbientLight=!0;class ql extends $t{constructor(e,t,n=10,i=10){super(e,t),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}}ql.prototype.isRectAreaLight=!0;class Xl{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new S)}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,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=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*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),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,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}Xl.prototype.isSphericalHarmonics3=!0;class ms extends $t{constructor(e=new Xl,t=1){super(void 0,t),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}}ms.prototype.isLightProbe=!0;class Hf extends It{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,o=new an(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const i=new _y[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 le().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.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.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.format!==void 0&&(i.format=e.format),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),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.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),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.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!==1&&(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.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 s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=n(o.value);break;case"c":i.uniforms[s].value=new le().setHex(o.value);break;case"v2":i.uniforms[s].value=new W().fromArray(o.value);break;case"v3":i.uniforms[s].value=new S().fromArray(o.value);break;case"v4":i.uniforms[s].value=new We().fromArray(o.value);break;case"m3":i.uniforms[s].value=new mt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new ge().fromArray(o.value);break;default:i.uniforms[s].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.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.shading!==void 0&&(i.flatShading=e.shading===1),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 s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new W().fromArray(s)}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.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 W().fromArray(e.clearcoatNormalScale)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),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}}class Uo{static decodeText(e){if(typeof TextDecoder!="undefined")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(n){return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.substr(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 Yl extends ve{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}Yl.prototype.isInstancedBufferGeometry=!0;class Vf extends It{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new an(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(d,m){if(t[m]!==void 0)return t[m];const v=d.interleavedBuffers[m],g=s(d,v.buffer),p=Oi(v.type,g),_=new mi(p,v.stride);return _.uuid=v.uuid,t[m]=_,_}function s(d,m){if(n[m]!==void 0)return n[m];const v=d.arrayBuffers[m],g=new Uint32Array(v).buffer;return n[m]=g,g}const o=e.isInstancedBufferGeometry?new Yl:new ve,a=e.data.index;if(a!==void 0){const d=Oi(a.type,a.array);o.setIndex(new ze(d,1))}const l=e.data.attributes;for(const d in l){const m=l[d];let x;if(m.isInterleavedBufferAttribute){const v=i(e.data,m.data);x=new Vn(v,m.itemSize,m.offset,m.normalized)}else{const v=Oi(m.type,m.array),g=m.isInstancedBufferAttribute?xi:ze;x=new g(v,m.itemSize,m.normalized)}m.name!==void 0&&(x.name=m.name),m.usage!==void 0&&x.setUsage(m.usage),m.updateRange!==void 0&&(x.updateRange.offset=m.updateRange.offset,x.updateRange.count=m.updateRange.count),o.setAttribute(d,x)}const c=e.data.morphAttributes;if(c)for(const d in c){const m=c[d],x=[];for(let v=0,g=m.length;v<g;v++){const p=m[v];let _;if(p.isInterleavedBufferAttribute){const y=i(e.data,p.data);_=new Vn(y,p.itemSize,p.offset,p.normalized)}else{const y=Oi(p.type,p.array);_=new ze(y,p.itemSize,p.normalized)}p.name!==void 0&&(_.name=p.name),x.push(_)}o.morphAttributes[d]=x}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let d=0,m=h.length;d!==m;++d){const x=h[d];o.addGroup(x.start,x.count,x.materialIndex)}const f=e.data.boundingSphere;if(f!==void 0){const d=new S;f.center!==void 0&&d.fromArray(f.center),o.boundingSphere=new Dn(d,f.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class Ty extends It{constructor(e){super(e)}load(e,t,n,i){const s=this,o=this.path===""?Uo.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new an(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(h){i!==void 0&&i(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},n,i)}loadAsync(e,t){return Er(this,null,function*(){const n=this,i=this.path===""?Uo.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new an(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=yield s.loadAsync(e,t),a=JSON.parse(o),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return yield n.parseAsync(a)})}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,n),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),t!==void 0){let h=!1;for(const f in o)if(o[f]instanceof HTMLImageElement){h=!0;break}h===!1&&t(c)}return c}parseAsync(e){return Er(this,null,function*(){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=yield this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,i,a,o,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),l})}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new Jt().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new Mo().fromJSON(e[s],i);n[a.uuid]=a}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new Vf;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(l);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:l.type in Ef?a=Ef[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),a.isBufferGeometry===!0&&l.userData!==void 0&&(a.userData=l.userData),n[l.uuid]=a}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new Hf;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const l=e[o];if(l.type==="MultiMaterial"){const c=[];for(let u=0;u<l.materials.length;u++){const h=l.materials[u];n[h.uuid]===void 0&&(n[h.uuid]=s.parse(h)),c.push(n[h.uuid])}i[l.uuid]=c}else n[l.uuid]===void 0&&(n[l.uuid]=s.parse(l)),i[l.uuid]=n[l.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=fs.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function o(l){return n.manager.itemStart(l),s.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:n.resourcePath+c;return o(u)}else return l.data?{data:Oi(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new zl(t);s=new ds(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const h=e[c],f=h.url;if(Array.isArray(f)){i[h.uuid]=[];for(let d=0,m=f.length;d<m;d++){const x=f[d],v=a(x);v!==null&&(v instanceof HTMLImageElement?i[h.uuid].push(v):i[h.uuid].push(new gi(v.data,v.width,v.height)))}}else{const d=a(h.url);d!==null&&(i[h.uuid]=d)}}}return i}parseImagesAsync(e){return Er(this,null,function*(){const t=this,n={};let i;function s(o){return Er(this,null,function*(){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return yield i.loadAsync(l)}else return o.data?{data:Oi(o.type,o.data),width:o.width,height:o.height}:null})}if(e!==void 0&&e.length>0){i=new ds(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],c=l.url;if(Array.isArray(c)){n[l.uuid]=[];for(let u=0,h=c.length;u<h;u++){const f=c[u],d=yield s(f);d!==null&&(d instanceof HTMLImageElement?n[l.uuid].push(d):n[l.uuid].push(new gi(d.data,d.width,d.height)))}}else{const u=yield s(l.url);u!==null&&(n[l.uuid]=u)}}}return n})}parseTextures(e,t){function n(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const i={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];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);let l;const c=t[a.image];Array.isArray(c)?(l=new Ki(c),c.length===6&&(l.needsUpdate=!0)):(c&&c.data?l=new gi(c.data,c.width,c.height):l=new ht(c),c&&(l.needsUpdate=!0)),l.uuid=a.uuid,a.name!==void 0&&(l.name=a.name),a.mapping!==void 0&&(l.mapping=n(a.mapping,Ey)),a.offset!==void 0&&l.offset.fromArray(a.offset),a.repeat!==void 0&&l.repeat.fromArray(a.repeat),a.center!==void 0&&l.center.fromArray(a.center),a.rotation!==void 0&&(l.rotation=a.rotation),a.wrap!==void 0&&(l.wrapS=n(a.wrap[0],kf),l.wrapT=n(a.wrap[1],kf)),a.format!==void 0&&(l.format=a.format),a.type!==void 0&&(l.type=a.type),a.encoding!==void 0&&(l.encoding=a.encoding),a.minFilter!==void 0&&(l.minFilter=n(a.minFilter,Wf)),a.magFilter!==void 0&&(l.magFilter=n(a.magFilter,Wf)),a.anisotropy!==void 0&&(l.anisotropy=a.anisotropy),a.flipY!==void 0&&(l.flipY=a.flipY),a.premultiplyAlpha!==void 0&&(l.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(l.unpackAlignment=a.unpackAlignment),a.userData!==void 0&&(l.userData=a.userData),i[a.uuid]=l}return i}parseObject(e,t,n,i,s){let o;function a(f){return t[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",f),t[f]}function l(f){if(f!==void 0){if(Array.isArray(f)){const d=[];for(let m=0,x=f.length;m<x;m++){const v=f[m];n[v]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",v),d.push(n[v])}return d}return n[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",f),n[f]}}function c(f){return i[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",f),i[f]}let u,h;switch(e.type){case"Scene":o=new ho,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new le(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new $r(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new Zr(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":o=new _t(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 Xr(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 Wl(e.color,e.intensity);break;case"DirectionalLight":o=new kl(e.color,e.intensity);break;case"PointLight":o=new Vl(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new ql(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new Gl(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new Ul(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new ms().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),h=l(e.material),o=new vo(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=l(e.material),o=new ft(u,h);break;case"InstancedMesh":u=a(e.geometry),h=l(e.material);const f=e.count,d=e.instanceMatrix,m=e.instanceColor;o=new cl(u,h,f),o.instanceMatrix=new xi(new Float32Array(d.array),16),m!==void 0&&(o.instanceColor=new xi(new Float32Array(m.array),m.itemSize));break;case"LOD":o=new jh;break;case"Line":o=new wn(a(e.geometry),l(e.material));break;case"LineLoop":o=new hl(a(e.geometry),l(e.material));break;case"LineSegments":o=new Dt(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new ts(a(e.geometry),l(e.material));break;case"Sprite":o=new go(l(e.material));break;case"Group":o=new pi;break;case"Bone":o=new _o;break;default:o=new Ne}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.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(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 f=e.children;for(let d=0;d<f.length;d++)o.add(this.parseObject(f[d],t,n,i,s))}if(e.animations!==void 0){const f=e.animations;for(let d=0;d<f.length;d++){const m=f[d];o.animations.push(s[m])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const f=e.levels;for(let d=0;d<f.length;d++){const m=f[d],x=o.getObjectByProperty("uuid",m.object);x!==void 0&&o.addLevel(x,m.distance)}}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)}})}setTexturePath(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}const Ey={UVMapping:Ts,CubeReflectionMapping:jn,CubeRefractionMapping:Qn,EquirectangularReflectionMapping:Lr,EquirectangularRefractionMapping:Rr,CubeUVReflectionMapping:Bi,CubeUVRefractionMapping:Pr},kf={RepeatWrapping:Ir,ClampToEdgeWrapping:bt,MirroredRepeatWrapping:Dr},Wf={NearestFilter:rt,NearestMipmapNearestFilter:Es,NearestMipmapLinearFilter:As,LinearFilter:Ke,LinearMipmapNearestFilter:ga,LinearMipmapLinearFilter:Kn};class qf extends It{constructor(e){super(e),typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&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 s=this,o=Si.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){Si.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}qf.prototype.isImageBitmapLoader=!0;let Oo;const Jl={getContext:function(){return Oo===void 0&&(Oo=new(window.AudioContext||window.webkitAudioContext)),Oo},setContext:function(r){Oo=r}};class Xf extends It{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new an(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{const l=a.slice(0);Jl.getContext().decodeAudioData(l,function(u){t(u)})}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}}class Yf extends ms{constructor(e,t,n=1){super(void 0,n);const i=new le().set(e),s=new le().set(t),o=new S(i.r,i.g,i.b),a=new S(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}}Yf.prototype.isHemisphereLightProbe=!0;class Jf extends ms{constructor(e,t=1){super(void 0,t);const n=new le().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}Jf.prototype.isAmbientLightProbe=!0;const Zf=new ge,$f=new ge,Ti=new ge;class Ay{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new _t,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new _t,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,Ti.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(oi*t.fov*.5)/t.zoom;let a,l;$f.elements[12]=-i,Zf.elements[12]=i,a=-o*t.aspect+s,l=o*t.aspect+s,Ti.elements[0]=2*t.near/(l-a),Ti.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Ti),a=-o*t.aspect-s,l=o*t.aspect-s,Ti.elements[0]=2*t.near/(l-a),Ti.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Ti)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply($f),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Zf)}}class jf{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Qf(),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=Qf();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Qf(){return(typeof performance=="undefined"?Date:performance).now()}const Ei=new S,Kf=new Tt,Cy=new S,Ai=new S;class Ly extends Ne{constructor(){super(),this.type="AudioListener",this.context=Jl.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new jf}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(Ei,Kf,Cy),Ai.set(0,0,-1).applyQuaternion(Kf),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Ei.x,i),t.positionY.linearRampToValueAtTime(Ei.y,i),t.positionZ.linearRampToValueAtTime(Ei.z,i),t.forwardX.linearRampToValueAtTime(Ai.x,i),t.forwardY.linearRampToValueAtTime(Ai.y,i),t.forwardZ.linearRampToValueAtTime(Ai.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Ei.x,Ei.y,Ei.z),t.setOrientation(Ai.x,Ai.y,Ai.z,n.x,n.y,n.z)}}class Zl extends Ne{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.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),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.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){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!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 Ci=new S,ed=new Tt,Ry=new S,Li=new S;class Py extends Zl{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(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(Ci,ed,Ry),Li.set(0,0,1).applyQuaternion(ed);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Ci.x,n),t.positionY.linearRampToValueAtTime(Ci.y,n),t.positionZ.linearRampToValueAtTime(Ci.z,n),t.orientationX.linearRampToValueAtTime(Li.x,n),t.orientationY.linearRampToValueAtTime(Li.y,n),t.orientationZ.linearRampToValueAtTime(Li.z,n)}else t.setPosition(Ci.x,Ci.y,Ci.z),t.setOrientation(Li.x,Li.y,Li.z)}}class td{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 nd{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,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,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)n[s+a]=n[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(n,s,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,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+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 s=n,o=i;s!==o;++s)t[s]=t[i+s%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,s){if(i>=.5)for(let o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){Tt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const o=this._workIndex*s;Tt.multiplyQuaternionsFlat(e,o,e,t,e,n),Tt.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const $l="\\[\\]\\.:\\/",Iy=new RegExp("["+$l+"]","g"),jl="[^"+$l+"]",Dy="[^"+$l.replace("\\.","")+"]",Fy=/((?:WC+[\/:])*)/.source.replace("WC",jl),By=/(WCOD+)?/.source.replace("WCOD",Dy),Ny=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",jl),zy=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",jl),Uy=new RegExp("^"+Fy+By+Ny+zy+"$"),Oy=["material","materials","bones"];class Gy{constructor(e,t,n){const i=n||He.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_,s=n.length;i!==s;++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 He{constructor(e,t,n){this.path=t,this.parsedPath=n||He.parseTrackName(t),this.node=He.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new He.Composite(e,t,n):new He(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Iy,"")}static parseTrackName(e){const t=Uy.exec(e);if(!t)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 s=n.nodeName.substring(i+1);Oy.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}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||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(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const l=n(a.children);if(l)return l}return null},i=n(e.children);if(i)return i}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,s=n.length;i!==s;++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,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++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 s=t.propertyIndex;if(e||(e=He.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){let c=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===c){c=u;break}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(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[i];if(o===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+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 l=this.BindingType.Direct;if(s!==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.isBufferGeometry){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[s]!==void 0&&(s=e.morphTargetDictionary[s])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}He.Composite=Gy,He.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},He.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},He.prototype.GetterByBindingType=[He.prototype._getValue_direct,He.prototype._getValue_array,He.prototype._getValue_arrayElement,He.prototype._getValue_toArray],He.prototype.SetterByBindingTypeAndVersioning=[[He.prototype._setValue_direct,He.prototype._setValue_direct_setNeedsUpdate,He.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[He.prototype._setValue_array,He.prototype._setValue_array_setNeedsUpdate,He.prototype._setValue_array_setMatrixWorldNeedsUpdate],[He.prototype._setValue_arrayElement,He.prototype._setValue_arrayElement_setNeedsUpdate,He.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[He.prototype._setValue_fromArray,He.prototype._setValue_fromArray_setNeedsUpdate,He.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class id{constructor(){this.uuid=Bt(),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,s=this._bindings,o=s.length;let a,l=e.length,c=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const f=arguments[u],d=f.uuid;let m=t[d];if(m===void 0){m=l++,t[d]=m,e.push(f);for(let x=0,v=o;x!==v;++x)s[x].push(new He(f,n[x],i[x]))}else if(m<c){a=e[m];const x=--c,v=e[x];t[v.uuid]=m,e[m]=v,t[d]=x,e[x]=f;for(let g=0,p=o;g!==p;++g){const _=s[g],y=_[x];let M=_[m];_[m]=y,M===void 0&&(M=new He(f,n[g],i[g])),_[x]=M}}else e[m]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const h=s++,f=e[h];t[f.uuid]=u,e[u]=f,t[c]=h,e[h]=l;for(let d=0,m=i;d!==m;++d){const x=n[d],v=x[h],g=x[u];x[u]=v,x[h]=g}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<s){const f=--s,d=e[f],m=--o,x=e[m];t[d.uuid]=h,e[h]=d,t[x.uuid]=f,e[f]=x,e.pop();for(let v=0,g=i;v!==g;++v){const p=n[v],_=p[f],y=p[m];p[h]=_,p[f]=y,p.pop()}}else{const f=--o,d=e[f];f>0&&(t[d.uuid]=h),e[h]=d,e.pop();for(let m=0,x=i;m!==x;++m){const v=n[m];v[h]=v[f],v.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);i=s.length,n[e]=i,o.push(e),a.push(t),s.push(h);for(let f=u,d=l.length;f!==d;++f){const m=l[f];h[f]=new He(m,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=n,o[n]=l,o.pop(),s[n]=s[a],s.pop(),i[n]=i[a],i.pop()}}}id.prototype.isAnimationObjectGroup=!0;class Hy{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:ni,endingEnd:ni};for(let c=0;c!==o;++c){const u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Iu,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,s=e._clip.duration,o=s/i,a=i/s;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,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+n,c[0]=e/o,c[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 s=this._startTime;if(s!==null){const l=(e-s)*n;if(l<0||n===0)return;this._startTime=null,t=n*l}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Aa:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Ls:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[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;n!==null&&(t*=n.evaluate(e)[0],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,s=this._loopCount;const o=n===Du;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(n===Pu){s===-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(s===-1&&(e>=0?(s=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,s+=Math.abs(a);const l=this.repetitions-s;if(l<=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(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=ii,i.endingEnd=ii):(e?i.endingStart=this.zeroSlopeAtStart?ii:ni:i.endingStart=zr,t?i.endingEnd=this.zeroSlopeAtEnd?ii:ni:i.endingEnd=zr)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=n,this}}class rd extends Rn{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,s=i.length,o=e._propertyBindings,a=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const f=i[h],d=f.name;let m=u[d];if(m!==void 0)o[h]=m;else{if(m=o[h],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,d));continue}const x=t&&t._propertyBindings[h].binding.parsedPath;m=new nd(He.create(n,d,x),f.ValueTypeName,f.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,d),o[h]=m}a[h].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.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 s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}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,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[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 s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,f=(e._localRoot||this._root).uuid;delete h[f],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,o=this._bindingsByRootAndName,a=o[i],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Bl(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let o=typeof e=="string"?fs.findByName(i,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(n===void 0&&(o!==null?n=o.blendMode:n=Ls),l!==void 0){const h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===n)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const u=new Hy(this,o,t,n);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?fs.findByName(n,e):e,o=s?s.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,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].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,s=i[n];if(s!==void 0){const o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];this._deactivateAction(c);const u=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const a=n[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}rd.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class Go{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new Go(this.value.clone===void 0?this.value:this.value.clone())}}class sd extends mi{constructor(e,t,n=1){super(e,t),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}}sd.prototype.isInstancedInterleavedBuffer=!0;class od{constructor(e,t,n,i,s){this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,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}}od.prototype.isGLBufferAttribute=!0;class Vy{constructor(e,t,n=0,i=1/0){this.ray=new Bn(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Gs,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){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&&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)}intersectObject(e,t=!0,n=[]){return Ql(e,this,n,t),n.sort(ad),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)Ql(e[i],this,n,t);return n.sort(ad),n}}function ad(r,e){return r.distance-e.distance}function Ql(r,e,t,n){if(r.layers.test(e.layers)&&r.raycast(e,t),n===!0){const i=r.children;for(let s=0,o=i.length;s<o;s++)Ql(i[s],e,t,!0)}}class ky{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(St(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Wy{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)}}const ld=new W;class br{constructor(e=new W(1/0,1/0),t=new W(-1/0,-1/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=ld.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 ld.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),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)}}br.prototype.isBox2=!0;const cd=new S,Ho=new S;class ud{constructor(e=new S,t=new S){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){cd.subVectors(e,this.start),Ho.subVectors(this.end,this.start);const n=Ho.dot(Ho);let s=Ho.dot(cd)/n;return t&&(s=St(s,0,1)),s}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 hd=new S;class qy extends Ne{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new ve,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,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,u=a/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}n.setAttribute("position",new de(i,3));const s=new Mt({fog:!1,toneMapped:!1});this.cone=new Dt(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),hd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(hd),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const qn=new S,Vo=new ge,Kl=new ge;class fd extends Dt{constructor(e){const t=dd(e),n=new ve,i=[],s=[],o=new le(0,0,1),a=new le(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}n.setAttribute("position",new de(i,3)),n.setAttribute("color",new de(s,3));const l=new Mt({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l),this.type="SkeletonHelper",this.isSkeletonHelper=!0,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");Kl.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(Vo.multiplyMatrices(Kl,a.matrixWorld),qn.setFromMatrixPosition(Vo),i.setXYZ(o,qn.x,qn.y,qn.z),Vo.multiplyMatrices(Kl,a.parent.matrixWorld),qn.setFromMatrixPosition(Vo),i.setXYZ(o+1,qn.x,qn.y,qn.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function dd(r){const e=[];r&&r.isBone&&e.push(r);for(let t=0;t<r.children.length;t++)e.push.apply(e,dd(r.children[t]));return e}class Xy extends ft{constructor(e,t,n){const i=new Mi(t,4,2),s=new _n({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.light.updateMatrixWorld(),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.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Yy=new S,pd=new le,md=new le;class Jy extends Ne{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new vi(t);i.rotateY(Math.PI*.5),this.material=new _n({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),o=new Float32Array(s.count*3);i.setAttribute("color",new ze(o,3)),this.add(new ft(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");pd.copy(this.light.color),md.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?pd:md;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}e.lookAt(Yy.setFromMatrixPosition(this.light.matrixWorld).negate())}}class gd extends Dt{constructor(e=10,t=10,n=4473924,i=8947848){n=new le(n),i=new le(i);const s=t/2,o=e/t,a=e/2,l=[],c=[];for(let f=0,d=0,m=-a;f<=t;f++,m+=o){l.push(-a,0,m,a,0,m),l.push(m,0,-a,m,0,a);const x=f===s?n:i;x.toArray(c,d),d+=3,x.toArray(c,d),d+=3,x.toArray(c,d),d+=3,x.toArray(c,d),d+=3}const u=new ve;u.setAttribute("position",new de(l,3)),u.setAttribute("color",new de(c,3));const h=new Mt({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}}class Zy extends Dt{constructor(e=10,t=16,n=8,i=64,s=4473924,o=8947848){s=new le(s),o=new le(o);const a=[],l=[];for(let h=0;h<=t;h++){const f=h/t*(Math.PI*2),d=Math.sin(f)*e,m=Math.cos(f)*e;a.push(0,0,0),a.push(d,0,m);const x=h&1?s:o;l.push(x.r,x.g,x.b),l.push(x.r,x.g,x.b)}for(let h=0;h<=n;h++){const f=h&1?s:o,d=e-e/n*h;for(let m=0;m<i;m++){let x=m/i*(Math.PI*2),v=Math.sin(x)*d,g=Math.cos(x)*d;a.push(v,0,g),l.push(f.r,f.g,f.b),x=(m+1)/i*(Math.PI*2),v=Math.sin(x)*d,g=Math.cos(x)*d,a.push(v,0,g),l.push(f.r,f.g,f.b)}}const c=new ve;c.setAttribute("position",new de(a,3)),c.setAttribute("color",new de(l,3));const u=new Mt({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}}const xd=new S,ko=new S,yd=new S;class $y extends Ne{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);let i=new ve;i.setAttribute("position",new de([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new Mt({fog:!1,toneMapped:!1});this.lightPlane=new wn(i,s),this.add(this.lightPlane),i=new ve,i.setAttribute("position",new de([0,0,0,0,0,1],3)),this.targetLine=new wn(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){xd.setFromMatrixPosition(this.light.matrixWorld),ko.setFromMatrixPosition(this.light.target.matrixWorld),yd.subVectors(ko,xd),this.lightPlane.lookAt(ko),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(ko),this.targetLine.scale.z=yd.length()}}const Wo=new S,et=new Wr;class jy extends Dt{constructor(e){const t=new ve,n=new Mt({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],o={},a=new le(16755200),l=new le(16711680),c=new le(43775),u=new le(16777215),h=new le(3355443);f("n1","n2",a),f("n2","n4",a),f("n4","n3",a),f("n3","n1",a),f("f1","f2",a),f("f2","f4",a),f("f4","f3",a),f("f3","f1",a),f("n1","f1",a),f("n2","f2",a),f("n3","f3",a),f("n4","f4",a),f("p","n1",l),f("p","n2",l),f("p","n3",l),f("p","n4",l),f("u1","u2",c),f("u2","u3",c),f("u3","u1",c),f("c","t",u),f("p","c",h),f("cn1","cn2",h),f("cn3","cn4",h),f("cf1","cf2",h),f("cf3","cf4",h);function f(m,x,v){d(m,v),d(x,v)}function d(m,x){i.push(0,0,0),s.push(x.r,x.g,x.b),o[m]===void 0&&(o[m]=[]),o[m].push(i.length/3-1)}t.setAttribute("position",new de(i,3)),t.setAttribute("color",new de(s,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()}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;et.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),at("c",t,e,et,0,0,-1),at("t",t,e,et,0,0,1),at("n1",t,e,et,-n,-i,-1),at("n2",t,e,et,n,-i,-1),at("n3",t,e,et,-n,i,-1),at("n4",t,e,et,n,i,-1),at("f1",t,e,et,-n,-i,1),at("f2",t,e,et,n,-i,1),at("f3",t,e,et,-n,i,1),at("f4",t,e,et,n,i,1),at("u1",t,e,et,n*.7,i*1.1,-1),at("u2",t,e,et,-n*.7,i*1.1,-1),at("u3",t,e,et,0,i*2,-1),at("cf1",t,e,et,-n,0,1),at("cf2",t,e,et,n,0,1),at("cf3",t,e,et,0,-i,1),at("cf4",t,e,et,0,i,1),at("cn1",t,e,et,-n,0,-1),at("cn2",t,e,et,n,0,-1),at("cn3",t,e,et,0,-i,-1),at("cn4",t,e,et,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function at(r,e,t,n,i,s,o){Wo.set(i,s,o).unproject(n);const a=e[r];if(a!==void 0){const l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],Wo.x,Wo.y,Wo.z)}}const qo=new Rt;class vd extends Dt{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(8*3),s=new ve;s.setIndex(new ze(n,1)),s.setAttribute("position",new ze(i,3)),super(s,new Mt({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&&qo.setFromObject(this.object),qo.isEmpty())return;const t=qo.min,n=qo.max,i=this.geometry.attributes.position,s=i.array;s[0]=n.x,s[1]=n.y,s[2]=n.z,s[3]=t.x,s[4]=n.y,s[5]=n.z,s[6]=t.x,s[7]=t.y,s[8]=n.z,s[9]=n.x,s[10]=t.y,s[11]=n.z,s[12]=n.x,s[13]=n.y,s[14]=t.z,s[15]=t.x,s[16]=n.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=n.x,s[22]=t.y,s[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e){return Dt.prototype.copy.call(this,e),this.object=e.object,this}}class Qy extends Dt{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],s=new ve;s.setIndex(new ze(n,1)),s.setAttribute("position",new de(i,3)),super(s,new Mt({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))}}class Ky extends wn{constructor(e,t=1,n=16776960){const i=n,s=[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,0,1,0,0,0],o=new ve;o.setAttribute("position",new de(s,3)),o.computeBoundingSphere(),super(o,new Mt({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],l=new ve;l.setAttribute("position",new de(a,3)),l.computeBoundingSphere(),this.add(new ft(l,new _n({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){let t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?it:Jn,this.lookAt(this.plane.normal),super.updateMatrixWorld(e)}}const _d=new S;let Xo,ec;class ev extends Ne{constructor(e=new S(0,0,1),t=new S(0,0,0),n=1,i=16776960,s=n*.2,o=s*.2){super(),this.type="ArrowHelper",Xo===void 0&&(Xo=new ve,Xo.setAttribute("position",new de([0,0,0,0,1,0],3)),ec=new kn(0,.5,1,5,1),ec.translate(0,-.5,0)),this.position.copy(t),this.line=new wn(Xo,new Mt({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ft(ec,new _n({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,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{_d.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(_d,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}}class Md extends Dt{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 ve;i.setAttribute("position",new de(t,3)),i.setAttribute("color",new de(n,3));const s=new Mt({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new le,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class tv{constructor(){this.type="ShapePath",this.color=new le,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new os,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,s,o){return this.currentPath.bezierCurveTo(e,t,n,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function n(p){const _=[];for(let y=0,M=p.length;y<M;y++){const b=p[y],E=new Jt;E.curves=b.curves,_.push(E)}return _}function i(p,_){const y=_.length;let M=!1;for(let b=y-1,E=0;E<y;b=E++){let P=_[b],z=_[E],N=z.x-P.x,I=z.y-P.y;if(Math.abs(I)>Number.EPSILON){if(I<0&&(P=_[E],N=-N,z=_[b],I=-I),p.y<P.y||p.y>z.y)continue;if(p.y===P.y){if(p.x===P.x)return!0}else{const w=I*(p.x-P.x)-N*(p.y-P.y);if(w===0)return!0;if(w<0)continue;M=!M}}else{if(p.y!==P.y)continue;if(z.x<=p.x&&p.x<=P.x||P.x<=p.x&&p.x<=z.x)return!0}}return M}const s=sn.isClockWise,o=this.subPaths;if(o.length===0)return[];if(t===!0)return n(o);let a,l,c;const u=[];if(o.length===1)return l=o[0],c=new Jt,c.curves=l.curves,u.push(c),u;let h=!s(o[0].getPoints());h=e?!h:h;const f=[],d=[];let m=[],x=0,v;d[x]=void 0,m[x]=[];for(let p=0,_=o.length;p<_;p++)l=o[p],v=l.getPoints(),a=s(v),a=e?!a:a,a?(!h&&d[x]&&x++,d[x]={s:new Jt,p:v},d[x].s.curves=l.curves,h&&x++,m[x]=[]):m[x].push({h:l,p:v[0]});if(!d[0])return n(o);if(d.length>1){let p=!1;const _=[];for(let y=0,M=d.length;y<M;y++)f[y]=[];for(let y=0,M=d.length;y<M;y++){const b=m[y];for(let E=0;E<b.length;E++){const P=b[E];let z=!0;for(let N=0;N<d.length;N++)i(P.p,d[N].p)&&(y!==N&&_.push({froms:y,tos:N,hole:E}),z?(z=!1,f[N].push(P)):p=!0);z&&f[y].push(P)}}_.length>0&&(p||(m=f))}let g;for(let p=0,_=d.length;p<_;p++){c=d[p].s,u.push(c),g=m[p];for(let y=0,M=g.length;y<M;y++)c.holes.push(g[y].h)}return u}}const bd=new Float32Array(1),nv=new Int32Array(bd.buffer);class iv{static toHalfFloat(e){e>65504&&(console.warn("THREE.DataUtils.toHalfFloat(): value exceeds 65504."),e=65504),bd[0]=e;const t=nv[0];let n=t>>16&32768,i=t>>12&2047;const s=t>>23&255;return s<103?n:s>142?(n|=31744,n|=(s==255?0:1)&&t&8388607,n):s<113?(i|=2048,n|=(i>>114-s)+(i>>113-s&1),n):(n|=s-112<<10|i>>1,n+=i&1,n)}}const rv=0,sv=1,ov=0,av=1,lv=2;function cv(r){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),r}function uv(r=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),r.isMultiMaterial=!0,r.materials=r,r.clone=function(){return r.slice()},r}function hv(r,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new ts(r,e)}function fv(r){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new go(r)}function dv(r,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new ts(r,e)}function pv(r){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new yi(r)}function mv(r){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new yi(r)}function gv(r){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new yi(r)}function xv(r,e,t){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new S(r,e,t)}function yv(r,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new ze(r,e).setUsage(Ui)}function vv(r,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new th(r,e)}function _v(r,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new nh(r,e)}function Mv(r,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new ih(r,e)}function bv(r,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new rh(r,e)}function wv(r,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ws(r,e)}function Sv(r,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new sh(r,e)}function Tv(r,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new qs(r,e)}function Ev(r,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new de(r,e)}function Av(r,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new ah(r,e)}Ot.create=function(r,e){return console.log("THREE.Curve.create() has been deprecated"),r.prototype=Object.create(Ot.prototype),r.prototype.constructor=r,r.prototype.getPoint=e,r},os.prototype.fromPoints=function(r){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(r)};function Cv(r){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Md(r)}function Lv(r,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new vd(r,e)}function Rv(r,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Dt(new ml(r.geometry),new Mt({color:e!==void 0?e:16777215}))}gd.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},fd.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};function Pv(r,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Dt(new El(r.geometry),new Mt({color:e!==void 0?e:16777215}))}It.prototype.extractUrlBase=function(r){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Uo.extractUrlBase(r)},It.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};function Iv(r){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new an(r)}function Dv(r){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new If(r)}br.prototype.center=function(r){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(r)},br.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},br.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},br.prototype.size=function(r){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(r)},Rt.prototype.center=function(r){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(r)},Rt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Rt.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},Rt.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)},Rt.prototype.size=function(r){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(r)},Dn.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},qr.prototype.setFromMatrix=function(r){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(r)},ud.prototype.center=function(r){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(r)},mt.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)},mt.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)},mt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},mt.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)},mt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},mt.prototype.getInverse=function(r){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()},ge.prototype.extractPosition=function(r){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(r)},ge.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)},ge.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new S().setFromMatrixColumn(this,3)},ge.prototype.setRotationFromQuaternion=function(r){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(r)},ge.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},ge.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},ge.prototype.multiplyVector4=function(r){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},ge.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},ge.prototype.rotateAxis=function(r){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),r.transformDirection(this)},ge.prototype.crossVector=function(r){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},ge.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},ge.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},ge.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},ge.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},ge.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},ge.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},ge.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},ge.prototype.makeFrustum=function(r,e,t,n,i,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(r,e,n,t,i,s)},ge.prototype.getInverse=function(r){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()},tn.prototype.isIntersectionLine=function(r){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(r)},Tt.prototype.multiplyVector3=function(r){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),r.applyQuaternion(this)},Tt.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Bn.prototype.isIntersectionBox=function(r){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},Bn.prototype.isIntersectionPlane=function(r){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(r)},Bn.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)},st.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},st.prototype.barycoordFromPoint=function(r,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(r,e)},st.prototype.midpoint=function(r){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(r)},st.prototypenormal=function(r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(r)},st.prototype.plane=function(r){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(r)},st.barycoordFromPoint=function(r,e,t,n,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),st.getBarycoord(r,e,t,n,i)},st.normal=function(r,e,t,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),st.getNormal(r,e,t,n)},Jt.prototype.extractAllPoints=function(r){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(r)},Jt.prototype.extrude=function(r){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new on(this,r)},Jt.prototype.makeGeometry=function(r){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new _i(this,r)},W.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)},W.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)},W.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},S.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},S.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},S.prototype.getPositionFromMatrix=function(r){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(r)},S.prototype.getScaleFromMatrix=function(r){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(r)},S.prototype.getColumnFromMatrix=function(r,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,r)},S.prototype.applyProjection=function(r){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(r)},S.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)},S.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)},S.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},We.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)},We.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Ne.prototype.getChildByName=function(r){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(r)},Ne.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Ne.prototype.translate=function(r,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,r)},Ne.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Ne.prototype.applyMatrix=function(r){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)},Object.defineProperties(Ne.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(r){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=r}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),ft.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(ft.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Fu},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),vo.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},_t.prototype.setLens=function(r,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(r)},Object.defineProperties($t.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(r){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=r}},shadowCameraLeft:{set:function(r){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=r}},shadowCameraRight:{set:function(r){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=r}},shadowCameraTop:{set:function(r){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=r}},shadowCameraBottom:{set:function(r){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=r}},shadowCameraNear:{set:function(r){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=r}},shadowCameraFar:{set:function(r){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=r}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(r){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=r}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(r){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=r}},shadowMapHeight:{set:function(r){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=r}}}),Object.defineProperties(ze.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Ui},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Ui)}}}),ze.prototype.setDynamic=function(r){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?Ui:zi),this},ze.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},ze.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},ve.prototype.addIndex=function(r){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(r)},ve.prototype.addAttribute=function(r,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(r,new ze(arguments[1],arguments[2]))):r==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(r,e)},ve.prototype.addDrawCall=function(r,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(r,e)},ve.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},ve.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},ve.prototype.removeAttribute=function(r){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(r)},ve.prototype.applyMatrix=function(r){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)},Object.defineProperties(ve.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),mi.prototype.setDynamic=function(r){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?Ui:zi),this},mi.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},on.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},on.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},on.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},ho.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Go.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(yt.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new le}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(r){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=r===la}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(r){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=r}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(bn.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(r){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=r}}}),qe.prototype.clearTarget=function(r,e,t,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(r),this.clear(e,t,n)},qe.prototype.animate=function(r){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(r)},qe.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},qe.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},qe.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},qe.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},qe.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},qe.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},qe.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},qe.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},qe.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},qe.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},qe.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},qe.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},qe.prototype.enableScissorTest=function(r){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(r)},qe.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},qe.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},qe.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},qe.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},qe.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},qe.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},qe.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},qe.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},qe.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},qe.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(qe.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=r}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=r}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(r){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=r===!0?ri:Ht}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}}),Object.defineProperties(Wh.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});function Fv(r,e,t){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new to(r,t)}Object.defineProperties(Nt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=r}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=r}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=r}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=r}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(r){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=r}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(r){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=r}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(r){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=r}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(r){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=r}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(r){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=r}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(r){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=r}}}),Zl.prototype.load=function(r){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return new Xf().load(r,function(n){e.setBuffer(n)}),this},td.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},eo.prototype.updateCubeMap=function(r,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(r,e)},eo.prototype.clear=function(r,e,t,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(r,e,t,n)},ai.crossOrigin=void 0,ai.loadTexture=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new Df;i.setCrossOrigin(this.crossOrigin);const s=i.load(r,t,void 0,n);return e&&(s.mapping=e),s},ai.loadTextureCube=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new Pf;i.setCrossOrigin(this.crossOrigin);const s=i.load(r,t,void 0,n);return e&&(s.mapping=e),s},ai.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},ai.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};function Bv(){console.error("THREE.CanvasRenderer has been removed")}function Nv(){console.error("THREE.JSONLoader has been removed.")}const zv={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function Uv(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}function Ov(){return console.error("THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"),new ve}function Gv(){return console.error("THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js"),new ve}function Hv(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")}function Vv(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")}function kv(){console.error("THREE.ImmediateRenderObject has been removed.")}typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Xn}})),typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Xn);function MM(r){r.computeTangents(),console.warn("THREE.BufferGeometryUtils: .computeTangents() has been removed. Use BufferGeometry.computeTangents() instead.")}function Wv(r,e=!1){const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},o={},a=r[0].morphTargetsRelative,l=new ve;let c=0;for(let u=0;u<r.length;++u){const h=r[u];let f=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const d in h.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;s[d]===void 0&&(s[d]=[]),s[d].push(h.attributes[d]),f++}if(f!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const d in h.morphAttributes){if(!i.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(h.morphAttributes[d])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(h.userData),e){let d;if(t)d=h.index.count;else if(h.attributes.position!==void 0)d=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,d,u),c+=d}}if(t){let u=0;const h=[];for(let f=0;f<r.length;++f){const d=r[f].index;for(let m=0;m<d.count;++m)h.push(d.getX(m)+u);u+=r[f].attributes.position.count}l.setIndex(h)}for(const u in s){const h=wd(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,h)}for(const u in o){const h=o[u][0].length;if(h===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let f=0;f<h;++f){const d=[];for(let x=0;x<o[u].length;++x)d.push(o[u][x][f]);const m=wd(d);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(m)}}return l}function wd(r){let e,t,n,i=0;for(let a=0;a<r.length;++a){const l=r[a];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=l.normalized),n!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=l.array.length}const s=new e(i);let o=0;for(let a=0;a<r.length;++a)s.set(r[a].array,o),o+=r[a].array.length;return new ze(s,t,n)}function bM(r){let e,t=0,n=0;for(let c=0,u=r.length;c<u;++c){const h=r[c];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;t+=h.array.length,n+=h.itemSize}const i=new InterleavedBuffer(new e(t),n);let s=0;const o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let c=0,u=r.length;c<u;c++){const h=r[c],f=h.itemSize,d=h.count,m=new InterleavedBufferAttribute(i,f,s,h.normalized);o.push(m),s+=f;for(let x=0;x<d;x++)for(let v=0;v<f;v++)m[l[v]](x,h[a[v]](x))}return o}function wM(r){let e=0;for(const n in r.attributes){const i=r.getAttribute(n);e+=i.count*i.itemSize*i.array.BYTES_PER_ELEMENT}const t=r.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function SM(r,e=1e-4){e=Math.max(e,Number.EPSILON);const t={},n=r.getIndex(),i=r.getAttribute("position"),s=n?n.count:i.count;let o=0;const a=Object.keys(r.attributes),l={},c={},u=[],h=["getX","getY","getZ","getW"];for(let x=0,v=a.length;x<v;x++){const g=a[x];l[g]=[];const p=r.morphAttributes[g];p&&(c[g]=new Array(p.length).fill().map(()=>[]))}const f=Math.log10(1/e),d=Math.pow(10,f);for(let x=0;x<s;x++){const v=n?n.getX(x):x;let g="";for(let p=0,_=a.length;p<_;p++){const y=a[p],M=r.getAttribute(y),b=M.itemSize;for(let E=0;E<b;E++)g+=`${~~(M[h[E]](v)*d)},`}if(g in t)u.push(t[g]);else{for(let p=0,_=a.length;p<_;p++){const y=a[p],M=r.getAttribute(y),b=r.morphAttributes[y],E=M.itemSize,P=l[y],z=c[y];for(let N=0;N<E;N++){const I=h[N];if(P.push(M[I](v)),b)for(let w=0,T=b.length;w<T;w++)z[w].push(b[w][I](v))}}t[g]=o,u.push(o),o++}}const m=r.clone();for(let x=0,v=a.length;x<v;x++){const g=a[x],p=r.getAttribute(g),_=new p.array.constructor(l[g]),y=new BufferAttribute(_,p.itemSize,p.normalized);if(m.setAttribute(g,y),g in c)for(let M=0;M<c[g].length;M++){const b=r.morphAttributes[g][M],E=new b.array.constructor(c[g][M]),P=new BufferAttribute(E,b.itemSize,b.normalized);m.morphAttributes[g][M]=P}}return m.setIndex(u),m}function TM(r,e){if(e===TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===TriangleFanDrawMode||e===TriangleStripDrawMode){let t=r.getIndex();if(t===null){const o=[],a=r.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);r.setIndex(o),t=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}const n=t.count-2,i=[];if(e===TriangleFanDrawMode)for(let o=1;o<=n;o++)i.push(t.getX(0)),i.push(t.getX(o)),i.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(i.push(t.getX(o)),i.push(t.getX(o+1)),i.push(t.getX(o+2))):(i.push(t.getX(o+2)),i.push(t.getX(o+1)),i.push(t.getX(o)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=r.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}function EM(r){if(r.geometry.isBufferGeometry!==!0)return console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry."),null;const e=new Vector3,t=new Vector3,n=new Vector3,i=new Vector3,s=new Vector3,o=new Vector3,a=new Vector3,l=new Vector3,c=new Vector3;function u(V,q,ne,K,he,Me,Y,be,pe){e.fromBufferAttribute(ne,Me),t.fromBufferAttribute(ne,Y),n.fromBufferAttribute(ne,be);const me=V.morphTargetInfluences;if(q.morphTargets&&K&&me){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let ye=0,Oe=K.length;ye<Oe;ye++){const k=me[ye],$=K[ye];k!==0&&(i.fromBufferAttribute($,Me),s.fromBufferAttribute($,Y),o.fromBufferAttribute($,be),he?(a.addScaledVector(i,k),l.addScaledVector(s,k),c.addScaledVector(o,k)):(a.addScaledVector(i.sub(e),k),l.addScaledVector(s.sub(t),k),c.addScaledVector(o.sub(n),k)))}e.add(a),t.add(l),n.add(c)}V.isSkinnedMesh&&(V.boneTransform(Me,e),V.boneTransform(Y,t),V.boneTransform(be,n)),pe[Me*3+0]=e.x,pe[Me*3+1]=e.y,pe[Me*3+2]=e.z,pe[Y*3+0]=t.x,pe[Y*3+1]=t.y,pe[Y*3+2]=t.z,pe[be*3+0]=n.x,pe[be*3+1]=n.y,pe[be*3+2]=n.z}const h=r.geometry,f=r.material;let d,m,x;const v=h.index,g=h.attributes.position,p=h.morphAttributes.position,_=h.morphTargetsRelative,y=h.attributes.normal,M=h.morphAttributes.position,b=h.groups,E=h.drawRange;let P,z,N,I,w,T,B,L;const F=new Float32Array(g.count*g.itemSize),U=new Float32Array(y.count*y.itemSize);if(v!==null)if(Array.isArray(f))for(P=0,N=b.length;P<N;P++)for(w=b[P],T=f[w.materialIndex],B=Math.max(w.start,E.start),L=Math.min(w.start+w.count,E.start+E.count),z=B,I=L;z<I;z+=3)d=v.getX(z),m=v.getX(z+1),x=v.getX(z+2),u(r,T,g,p,_,d,m,x,F),u(r,T,y,M,_,d,m,x,U);else for(B=Math.max(0,E.start),L=Math.min(v.count,E.start+E.count),P=B,N=L;P<N;P+=3)d=v.getX(P),m=v.getX(P+1),x=v.getX(P+2),u(r,f,g,p,_,d,m,x,F),u(r,f,y,M,_,d,m,x,U);else if(g!==void 0)if(Array.isArray(f))for(P=0,N=b.length;P<N;P++)for(w=b[P],T=f[w.materialIndex],B=Math.max(w.start,E.start),L=Math.min(w.start+w.count,E.start+E.count),z=B,I=L;z<I;z+=3)d=z,m=z+1,x=z+2,u(r,T,g,p,_,d,m,x,F),u(r,T,y,M,_,d,m,x,U);else for(B=Math.max(0,E.start),L=Math.min(g.count,E.start+E.count),P=B,N=L;P<N;P+=3)d=P,m=P+1,x=P+2,u(r,f,g,p,_,d,m,x,F),u(r,f,y,M,_,d,m,x,U);const Z=new Float32BufferAttribute(F,3),ee=new Float32BufferAttribute(U,3);return{positionAttribute:g,normalAttribute:y,morphedPositionAttribute:Z,morphedNormalAttribute:ee}}var Ri=new Map,qv=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(e,t,n,i,s){var o=t[n*3],a=t[n*3+1],l=t[i*3],c=t[i*3+1],u=t[s*3],h=t[s*3+1],f;if(Ri.has(e))f=Ri.get(e);else{var d=r.box3||new Rt;if(!r.box3){var m=e.parameters.shapes.getPoints();d.setFromArray(m.map(function(_){return[_.x,_.y,0]}).flat())}var x=d.getSize(new S);r.split&&(x.y/=r.split),f={box:d,size:x},Ri.set(e,f)}var v=f.box,g=f.size,p=r.split?1-r.split:0;return[new W((o-v.min.x)/g.x,(a-v.min.y)/g.y+p),new W((l-v.min.x)/g.x,(c-v.min.y)/g.y+p),new W((u-v.min.x)/g.x,(h-v.min.y)/g.y+p)]},generateSideWallUV:function(e,t,n,i,s,o){var a=t[n*3],l=t[n*3+1],c=t[n*3+2],u=t[i*3],h=t[i*3+1],f=t[i*3+2],d=t[s*3],m=t[s*3+1],x=t[s*3+2],v=t[o*3],g=t[o*3+1],p=t[o*3+2],_;if(Ri.has(t))_=Ri.get(t);else{var y=new Rt;y.setFromArray(t);var M=y.getSize(new S);r.split&&(M.z/=1-r.split),_={box:y,size:M},Ri.set(t,_)}var b=_.box,E=_.size;return Math.abs(l-h)<Math.abs(a-u)?[new W((a-b.min.x)/E.x,(c-b.min.z)/E.z),new W((u-b.min.x)/E.x,(f-b.min.z)/E.z),new W((d-b.min.x)/E.x,(x-b.min.z)/E.z),new W((v-b.min.x)/E.x,(p-b.min.z)/E.z)]:[new W((l-b.min.y)/E.y,(c-b.min.z)/E.z),new W((h-b.min.y)/E.y,(f-b.min.z)/E.z),new W((m-b.min.y)/E.y,(x-b.min.z)/E.z),new W((g-b.min.y)/E.y,(p-b.min.z)/E.z)]}}},Xv=function(){Ri.clear()},Yv=+Xn<144,Jv=Yv?"ExtrudeBufferGeometry":"ExtrudeGeometry",AM=null;function Zv(r){var e=r.split,t=r.depth,n=r.points,i=new pt[Jv](new Jt(n),{depth:t,bevelEnabled:!1,UVGenerator:qv({split:e})});return Xv(),i}function $v(r){if(Array.isArray(r))return r}function jv(r){if(typeof Symbol!="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function Qv(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Sd(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function Kv(r,e){if(!!r){if(typeof r=="string")return Sd(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Sd(r,e)}}function Td(r,e){return $v(r)||jv(r,e)||Kv(r,e)||Qv()}var Je=1e-6,e_=1e-12,Ue=Math.PI,Ft=Ue/2,Ed=Ue/4,kt=Ue*2,Gt=180/Ue,dt=Ue/180,lt=Math.abs,Ad=Math.atan,gs=Math.atan2,ct=Math.cos,CM=Math.ceil,t_=Math.exp,LM=Math.floor,RM=Math.hypot,n_=Math.log,PM=Math.pow,tt=Math.sin,i_=Math.sign||function(r){return r>0?1:r<0?-1:0},Yo=Math.sqrt,r_=Math.tan;function s_(r){return r>1?0:r<-1?Ue:Math.acos(r)}function xs(r){return r>1?Ft:r<-1?-Ft:Math.asin(r)}function IM(r){return(r=tt(r/2))*r}function tc(r,e){function t(n,i){return n=r(n,i),e(n[0],n[1])}return r.invert&&e.invert&&(t.invert=function(n,i){return n=e.invert(n,i),n&&r.invert(n[0],n[1])}),t}function nc(r,e){return[lt(r)>Ue?r+Math.round(-r/kt)*kt:r,e]}nc.invert=nc;function Cd(r,e,t){return(r%=kt)?e||t?tc(Rd(r),Pd(e,t)):Rd(r):e||t?Pd(e,t):nc}function Ld(r){return function(e,t){return e+=r,[e>Ue?e-kt:e<-Ue?e+kt:e,t]}}function Rd(r){var e=Ld(r);return e.invert=Ld(-r),e}function Pd(r,e){var t=ct(r),n=tt(r),i=ct(e),s=tt(e);function o(a,l){var c=ct(l),u=ct(a)*c,h=tt(a)*c,f=tt(l),d=f*t+u*n;return[gs(h*i-d*s,u*t-f*n),xs(d*i+h*s)]}return o.invert=function(a,l){var c=ct(l),u=ct(a)*c,h=tt(a)*c,f=tt(l),d=f*i-h*s;return[gs(h*i+f*s,u*t+d*n),xs(d*t-u*n)]},o}function o_(r){r=Cd(r[0]*dt,r[1]*dt,r.length>2?r[2]*dt:0);function e(t){return t=r(t[0]*dt,t[1]*dt),t[0]*=Gt,t[1]*=Gt,t}return e.invert=function(t){return t=r.invert(t[0]*dt,t[1]*dt),t[0]*=Gt,t[1]*=Gt,t},e}function ys(){}function Id(){var r=[],e;return{point:function(t,n,i){e.push([t,n,i])},lineStart:function(){r.push(e=[])},lineEnd:ys,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var t=r;return r=[],e=null,t}}}function Jo(r,e){return lt(r[0]-e[0])<Je&<(r[1]-e[1])<Je}function Zo(r,e,t,n){this.x=r,this.z=e,this.o=t,this.e=n,this.v=!1,this.n=this.p=null}function Dd(r,e,t,n,i){var s=[],o=[],a,l;if(r.forEach(function(m){if(!((x=m.length-1)<=0)){var x,v=m[0],g=m[x],p;if(Jo(v,g)){if(!v[2]&&!g[2]){for(i.lineStart(),a=0;a<x;++a)i.point((v=m[a])[0],v[1]);i.lineEnd();return}g[0]+=2*Je}s.push(p=new Zo(v,m,null,!0)),o.push(p.o=new Zo(v,null,p,!1)),s.push(p=new Zo(g,m,null,!1)),o.push(p.o=new Zo(g,null,p,!0))}}),!!s.length){for(o.sort(e),Fd(s),Fd(o),a=0,l=o.length;a<l;++a)o[a].e=t=!t;for(var c=s[0],u,h;;){for(var f=c,d=!0;f.v;)if((f=f.n)===c)return;u=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(d)for(a=0,l=u.length;a<l;++a)i.point((h=u[a])[0],h[1]);else n(f.x,f.n.x,1,i);f=f.n}else{if(d)for(u=f.p.z,a=u.length-1;a>=0;--a)i.point((h=u[a])[0],h[1]);else n(f.x,f.p.x,-1,i);f=f.p}f=f.o,u=f.z,d=!d}while(!f.v);i.lineEnd()}}}function Fd(r){if(!!(e=r.length)){for(var e,t=0,n=r[0],i;++t<e;)n.n=i=r[t],i.p=n,n=i;n.n=i=r[0],i.p=n}}class ic{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const t=this._partials;let n=0;for(let i=0;i<this._n&&i<32;i++){const s=t[i],o=e+s,a=Math.abs(e)<Math.abs(s)?e-(o-s):s-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){const e=this._partials;let t=this._n,n,i,s,o=0;if(t>0){for(o=e[--t];t>0&&(n=o,i=e[--t],o=n+i,s=i-(o-n),!s););t>0&&(s<0&&e[t-1]<0||s>0&&e[t-1]>0)&&(i=s*2,n=o+i,i==n-o&&(o=n))}return o}}function DM(r,e){const t=new ic;if(e===void 0)for(let n of r)(n=+n)&&t.add(n);else{let n=-1;for(let i of r)(i=+e(i,++n,r))&&t.add(i)}return+t}function FM(r,e){const t=new ic;let n=-1;return Float64Array.from(r,e===void 0?i=>t.add(+i||0):i=>t.add(+e(i,++n,r)||0))}function rc(r){return[gs(r[1],r[0]),xs(r[2])]}function wr(r){var e=r[0],t=r[1],n=ct(t);return[n*ct(e),n*tt(e),tt(t)]}function $o(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function jo(r,e){return[r[1]*e[2]-r[2]*e[1],r[2]*e[0]-r[0]*e[2],r[0]*e[1]-r[1]*e[0]]}function sc(r,e){r[0]+=e[0],r[1]+=e[1],r[2]+=e[2]}function Qo(r,e){return[r[0]*e,r[1]*e,r[2]*e]}function oc(r){var e=Yo(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=e,r[1]/=e,r[2]/=e}function ac(r){return lt(r[0])<=Ue?r[0]:i_(r[0])*((lt(r[0])+Ue)%kt-Ue)}function a_(r,e){var t=ac(e),n=e[1],i=tt(n),s=[tt(t),-ct(t),0],o=0,a=0,l=new ic;i===1?n=Ft+Je:i===-1&&(n=-Ft-Je);for(var c=0,u=r.length;c<u;++c)if(!!(f=(h=r[c]).length))for(var h,f,d=h[f-1],m=ac(d),x=d[1]/2+Ed,v=tt(x),g=ct(x),p=0;p<f;++p,m=y,v=b,g=E,d=_){var _=h[p],y=ac(_),M=_[1]/2+Ed,b=tt(M),E=ct(M),P=y-m,z=P>=0?1:-1,N=z*P,I=N>Ue,w=v*b;if(l.add(gs(w*z*tt(N),g*E+w*ct(N))),o+=I?P+z*kt:P,I^m>=t^y>=t){var T=jo(wr(d),wr(_));oc(T);var B=jo(s,T);oc(B);var L=(I^P>=0?-1:1)*xs(B[2]);(n>L||n===L&&(T[0]||T[1]))&&(a+=I^P>=0?1:-1)}}return(o<-Je||o<Je&&l<-e_)^a&1}function*l_(r){for(const e of r)yield*e}function Bd(r){return Array.from(l_(r))}function Nd(r,e,t,n){return function(i){var s=e(i),o=Id(),a=e(o),l=!1,c,u,h,f={point:d,lineStart:x,lineEnd:v,polygonStart:function(){f.point=g,f.lineStart=p,f.lineEnd=_,u=[],c=[]},polygonEnd:function(){f.point=d,f.lineStart=x,f.lineEnd=v,u=Bd(u);var y=a_(c,n);u.length?(l||(i.polygonStart(),l=!0),Dd(u,u_,y,t,i)):y&&(l||(i.polygonStart(),l=!0),i.lineStart(),t(null,null,1,i),i.lineEnd()),l&&(i.polygonEnd(),l=!1),u=c=null},sphere:function(){i.polygonStart(),i.lineStart(),t(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(y,M){r(y,M)&&i.point(y,M)}function m(y,M){s.point(y,M)}function x(){f.point=m,s.lineStart()}function v(){f.point=d,s.lineEnd()}function g(y,M){h.push([y,M]),a.point(y,M)}function p(){a.lineStart(),h=[]}function _(){g(h[0][0],h[0][1]),a.lineEnd();var y=a.clean(),M=o.result(),b,E=M.length,P,z,N;if(h.pop(),c.push(h),h=null,!!E){if(y&1){if(z=M[0],(P=z.length-1)>0){for(l||(i.polygonStart(),l=!0),i.lineStart(),b=0;b<P;++b)i.point((N=z[b])[0],N[1]);i.lineEnd()}return}E>1&&y&2&&M.push(M.pop().concat(M.shift())),u.push(M.filter(c_))}}return f}}function c_(r){return r.length>1}function u_(r,e){return((r=r.x)[0]<0?r[1]-Ft-Je:Ft-r[1])-((e=e.x)[0]<0?e[1]-Ft-Je:Ft-e[1])}var zd=Nd(function(){return!0},h_,d_,[-Ue,-Ft]);function h_(r){var e=NaN,t=NaN,n=NaN,i;return{lineStart:function(){r.lineStart(),i=1},point:function(s,o){var a=s>0?Ue:-Ue,l=lt(s-e);lt(l-Ue)<Je?(r.point(e,t=(t+o)/2>0?Ft:-Ft),r.point(n,t),r.lineEnd(),r.lineStart(),r.point(a,t),r.point(s,t),i=0):n!==a&&l>=Ue&&(lt(e-n)<Je&&(e-=n*Je),lt(s-a)<Je&&(s-=a*Je),t=f_(e,t,s,o),r.point(n,t),r.lineEnd(),r.lineStart(),r.point(a,t),i=0),r.point(e=s,t=o),n=a},lineEnd:function(){r.lineEnd(),e=t=NaN},clean:function(){return 2-i}}}function f_(r,e,t,n){var i,s,o=tt(r-t);return lt(o)>Je?Ad((tt(e)*(s=ct(n))*tt(t)-tt(n)*(i=ct(e))*tt(r))/(i*s*o)):(e+n)/2}function d_(r,e,t,n){var i;if(r==null)i=t*Ft,n.point(-Ue,i),n.point(0,i),n.point(Ue,i),n.point(Ue,0),n.point(Ue,-i),n.point(0,-i),n.point(-Ue,-i),n.point(-Ue,0),n.point(-Ue,i);else if(lt(r[0]-e[0])>Je){var s=r[0]<e[0]?Ue:-Ue;i=t*s/2,n.point(-s,i),n.point(0,i),n.point(s,i)}else n.point(e[0],e[1])}function Ud(r,e,t,n,i,s){if(!!t){var o=ct(e),a=tt(e),l=n*t;i==null?(i=e+n*kt,s=e-l/2):(i=Od(o,i),s=Od(o,s),(n>0?i<s:i>s)&&(i+=n*kt));for(var c,u=i;n>0?u>s:u<s;u-=l)c=rc([o,-a*ct(u),-a*tt(u)]),r.point(c[0],c[1])}}function Od(r,e){e=wr(e),e[0]-=r,oc(e);var t=s_(-e[1]);return((-e[2]<0?-t:t)+kt-Je)%kt}function BM(){var r=constant([0,0]),e=constant(90),t=constant(6),n,i,s={point:o};function o(l,c){n.push(l=i(l,c)),l[0]*=degrees,l[1]*=degrees}function a(){var l=r.apply(this,arguments),c=e.apply(this,arguments)*radians,u=t.apply(this,arguments)*radians;return n=[],i=rotateRadians(-l[0]*radians,-l[1]*radians,0).invert,Ud(s,c,u,1),l={type:"Polygon",coordinates:[n]},n=i=null,l}return a.center=function(l){return arguments.length?(r=typeof l=="function"?l:constant([+l[0],+l[1]]),a):r},a.radius=function(l){return arguments.length?(e=typeof l=="function"?l:constant(+l),a):e},a.precision=function(l){return arguments.length?(t=typeof l=="function"?l:constant(+l),a):t},a}function p_(r){var e=ct(r),t=6*dt,n=e>0,i=lt(e)>Je;function s(u,h,f,d){Ud(d,r,t,f,u,h)}function o(u,h){return ct(u)*ct(h)>e}function a(u){var h,f,d,m,x;return{lineStart:function(){m=d=!1,x=1},point:function(v,g){var p=[v,g],_,y=o(v,g),M=n?y?0:c(v,g):y?c(v+(v<0?Ue:-Ue),g):0;if(!h&&(m=d=y)&&u.lineStart(),y!==d&&(_=l(h,p),(!_||Jo(h,_)||Jo(p,_))&&(p[2]=1)),y!==d)x=0,y?(u.lineStart(),_=l(p,h),u.point(_[0],_[1])):(_=l(h,p),u.point(_[0],_[1],2),u.lineEnd()),h=_;else if(i&&h&&n^y){var b;!(M&f)&&(b=l(p,h,!0))&&(x=0,n?(u.lineStart(),u.point(b[0][0],b[0][1]),u.point(b[1][0],b[1][1]),u.lineEnd()):(u.point(b[1][0],b[1][1]),u.lineEnd(),u.lineStart(),u.point(b[0][0],b[0][1],3)))}y&&(!h||!Jo(h,p))&&u.point(p[0],p[1]),h=p,d=y,f=M},lineEnd:function(){d&&u.lineEnd(),h=null},clean:function(){return x|(m&&d)<<1}}}function l(u,h,f){var d=wr(u),m=wr(h),x=[1,0,0],v=jo(d,m),g=$o(v,v),p=v[0],_=g-p*p;if(!_)return!f&&u;var y=e*g/_,M=-e*p/_,b=jo(x,v),E=Qo(x,y),P=Qo(v,M);sc(E,P);var z=b,N=$o(E,z),I=$o(z,z),w=N*N-I*($o(E,E)-1);if(!(w<0)){var T=Yo(w),B=Qo(z,(-N-T)/I);if(sc(B,E),B=rc(B),!f)return B;var L=u[0],F=h[0],U=u[1],Z=h[1],ee;F<L&&(ee=L,L=F,F=ee);var V=F-L,q=lt(V-Ue)<Je,ne=q||V<Je;if(!q&&Z<U&&(ee=U,U=Z,Z=ee),ne?q?U+Z>0^B[1]<(lt(B[0]-L)<Je?U:Z):U<=B[1]&&B[1]<=Z:V>Ue^(L<=B[0]&&B[0]<=F)){var K=Qo(z,(-N+T)/I);return sc(K,E),[B,rc(K)]}}}function c(u,h){var f=n?r:Ue-r,d=0;return u<-f?d|=1:u>f&&(d|=2),h<-f?d|=4:h>f&&(d|=8),d}return Nd(o,a,s,n?[0,-r]:[-Ue,r-Ue])}function m_(r,e,t,n,i,s){var o=r[0],a=r[1],l=e[0],c=e[1],u=0,h=1,f=l-o,d=c-a,m;if(m=t-o,!(!f&&m>0)){if(m/=f,f<0){if(m<u)return;m<h&&(h=m)}else if(f>0){if(m>h)return;m>u&&(u=m)}if(m=i-o,!(!f&&m<0)){if(m/=f,f<0){if(m>h)return;m>u&&(u=m)}else if(f>0){if(m<u)return;m<h&&(h=m)}if(m=n-a,!(!d&&m>0)){if(m/=d,d<0){if(m<u)return;m<h&&(h=m)}else if(d>0){if(m>h)return;m>u&&(u=m)}if(m=s-a,!(!d&&m<0)){if(m/=d,d<0){if(m>h)return;m>u&&(u=m)}else if(d>0){if(m<u)return;m<h&&(h=m)}return u>0&&(r[0]=o+u*f,r[1]=a+u*d),h<1&&(e[0]=o+h*f,e[1]=a+h*d),!0}}}}}var vs=1e9,Ko=-vs;function g_(r,e,t,n){function i(c,u){return r<=c&&c<=t&&e<=u&&u<=n}function s(c,u,h,f){var d=0,m=0;if(c==null||(d=o(c,h))!==(m=o(u,h))||l(c,u)<0^h>0)do f.point(d===0||d===3?r:t,d>1?n:e);while((d=(d+h+4)%4)!==m);else f.point(u[0],u[1])}function o(c,u){return lt(c[0]-r)<Je?u>0?0:3:lt(c[0]-t)<Je?u>0?2:1:lt(c[1]-e)<Je?u>0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var h=o(c,1),f=o(u,1);return h!==f?h-f:h===0?u[1]-c[1]:h===1?c[0]-u[0]:h===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,h=Id(),f,d,m,x,v,g,p,_,y,M,b,E={point:P,lineStart:w,lineEnd:T,polygonStart:N,polygonEnd:I};function P(L,F){i(L,F)&&u.point(L,F)}function z(){for(var L=0,F=0,U=d.length;F<U;++F)for(var Z=d[F],ee=1,V=Z.length,q=Z[0],ne,K,he=q[0],Me=q[1];ee<V;++ee)ne=he,K=Me,q=Z[ee],he=q[0],Me=q[1],K<=n?Me>n&&(he-ne)*(n-K)>(Me-K)*(r-ne)&&++L:Me<=n&&(he-ne)*(n-K)<(Me-K)*(r-ne)&&--L;return L}function N(){u=h,f=[],d=[],b=!0}function I(){var L=z(),F=b&&L,U=(f=Bd(f)).length;(F||U)&&(c.polygonStart(),F&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),U&&Dd(f,a,L,s,c),c.polygonEnd()),u=c,f=d=m=null}function w(){E.point=B,d&&d.push(m=[]),M=!0,y=!1,p=_=NaN}function T(){f&&(B(x,v),g&&y&&h.rejoin(),f.push(h.result())),E.point=P,y&&u.lineEnd()}function B(L,F){var U=i(L,F);if(d&&m.push([L,F]),M)x=L,v=F,g=U,M=!1,U&&(u.lineStart(),u.point(L,F));else if(U&&y)u.point(L,F);else{var Z=[p=Math.max(Ko,Math.min(vs,p)),_=Math.max(Ko,Math.min(vs,_))],ee=[L=Math.max(Ko,Math.min(vs,L)),F=Math.max(Ko,Math.min(vs,F))];m_(Z,ee,r,e,t,n)?(y||(u.lineStart(),u.point(Z[0],Z[1])),u.point(ee[0],ee[1]),U||u.lineEnd(),b=!1):U&&(u.lineStart(),u.point(L,F),b=!1)}p=L,_=F,y=U}return E}}var Gd=r=>r;function NM(r){return{stream:ea(r)}}function ea(r){return function(e){var t=new lc;for(var n in r)t[n]=r[n];return t.stream=e,t}}function lc(){}lc.prototype={constructor:lc,point:function(r,e){this.stream.point(r,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function ta(r,e){r&&Vd.hasOwnProperty(r.type)&&Vd[r.type](r,e)}var Hd={Feature:function(r,e){ta(r.geometry,e)},FeatureCollection:function(r,e){for(var t=r.features,n=-1,i=t.length;++n<i;)ta(t[n].geometry,e)}},Vd={Sphere:function(r,e){e.sphere()},Point:function(r,e){r=r.coordinates,e.point(r[0],r[1],r[2])},MultiPoint:function(r,e){for(var t=r.coordinates,n=-1,i=t.length;++n<i;)r=t[n],e.point(r[0],r[1],r[2])},LineString:function(r,e){cc(r.coordinates,e,0)},MultiLineString:function(r,e){for(var t=r.coordinates,n=-1,i=t.length;++n<i;)cc(t[n],e,0)},Polygon:function(r,e){kd(r.coordinates,e)},MultiPolygon:function(r,e){for(var t=r.coordinates,n=-1,i=t.length;++n<i;)kd(t[n],e)},GeometryCollection:function(r,e){for(var t=r.geometries,n=-1,i=t.length;++n<i;)ta(t[n],e)}};function cc(r,e,t){var n=-1,i=r.length-t,s;for(e.lineStart();++n<i;)s=r[n],e.point(s[0],s[1],s[2]);e.lineEnd()}function kd(r,e){var t=-1,n=r.length;for(e.polygonStart();++t<n;)cc(r[t],e,1);e.polygonEnd()}function x_(r,e){r&&Hd.hasOwnProperty(r.type)?Hd[r.type](r,e):ta(r,e)}var Sr=1/0,na=Sr,_s=-Sr,ia=_s,y_={point:v_,lineStart:ys,lineEnd:ys,polygonStart:ys,polygonEnd:ys,result:function(){var r=[[Sr,na],[_s,ia]];return _s=ia=-(na=Sr=1/0),r}};function v_(r,e){r<Sr&&(Sr=r),r>_s&&(_s=r),e<na&&(na=e),e>ia&&(ia=e)}var Wd=y_;function uc(r,e,t){var n=r.clipExtent&&r.clipExtent();return r.scale(150).translate([0,0]),n!=null&&r.clipExtent(null),x_(t,r.stream(Wd)),e(Wd.result()),n!=null&&r.clipExtent(n),r}function qd(r,e,t){return uc(r,function(n){var i=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=Math.min(i/(n[1][0]-n[0][0]),s/(n[1][1]-n[0][1])),a=+e[0][0]+(i-o*(n[1][0]+n[0][0]))/2,l=+e[0][1]+(s-o*(n[1][1]+n[0][1]))/2;r.scale(150*o).translate([a,l])},t)}function __(r,e,t){return qd(r,[[0,0],e],t)}function M_(r,e,t){return uc(r,function(n){var i=+e,s=i/(n[1][0]-n[0][0]),o=(i-s*(n[1][0]+n[0][0]))/2,a=-s*n[0][1];r.scale(150*s).translate([o,a])},t)}function b_(r,e,t){return uc(r,function(n){var i=+e,s=i/(n[1][1]-n[0][1]),o=-s*n[0][0],a=(i-s*(n[1][1]+n[0][1]))/2;r.scale(150*s).translate([o,a])},t)}var Xd=16,w_=ct(30*dt);function Yd(r,e){return+e?T_(r,e):S_(r)}function S_(r){return ea({point:function(e,t){e=r(e,t),this.stream.point(e[0],e[1])}})}function T_(r,e){function t(n,i,s,o,a,l,c,u,h,f,d,m,x,v){var g=c-n,p=u-i,_=g*g+p*p;if(_>4*e&&x--){var y=o+f,M=a+d,b=l+m,E=Yo(y*y+M*M+b*b),P=xs(b/=E),z=lt(lt(b)-1)<Je||lt(s-h)<Je?(s+h)/2:gs(M,y),N=r(z,P),I=N[0],w=N[1],T=I-n,B=w-i,L=p*T-g*B;(L*L/_>e||lt((g*T+p*B)/_-.5)>.3||o*f+a*d+l*m<w_)&&(t(n,i,s,o,a,l,I,w,z,y/=E,M/=E,b,x,v),v.point(I,w),t(I,w,z,y,M,b,c,u,h,f,d,m,x,v))}}return function(n){var i,s,o,a,l,c,u,h,f,d,m,x,v={point:g,lineStart:p,lineEnd:y,polygonStart:function(){n.polygonStart(),v.lineStart=M},polygonEnd:function(){n.polygonEnd(),v.lineStart=p}};function g(P,z){P=r(P,z),n.point(P[0],P[1])}function p(){h=NaN,v.point=_,n.lineStart()}function _(P,z){var N=wr([P,z]),I=r(P,z);t(h,f,u,d,m,x,h=I[0],f=I[1],u=P,d=N[0],m=N[1],x=N[2],Xd,n),n.point(h,f)}function y(){v.point=g,n.lineEnd()}function M(){p(),v.point=b,v.lineEnd=E}function b(P,z){_(i=P,z),s=h,o=f,a=d,l=m,c=x,v.point=_}function E(){t(h,f,u,d,m,x,s,o,i,a,l,c,Xd,n),v.lineEnd=y,y()}return v}}var E_=ea({point:function(r,e){this.stream.point(r*dt,e*dt)}});function A_(r){return ea({point:function(e,t){var n=r(e,t);return this.stream.point(n[0],n[1])}})}function C_(r,e,t,n,i){function s(o,a){return o*=n,a*=i,[e+r*o,t-r*a]}return s.invert=function(o,a){return[(o-e)/r*n,(t-a)/r*i]},s}function Jd(r,e,t,n,i,s){if(!s)return C_(r,e,t,n,i);var o=ct(s),a=tt(s),l=o*r,c=a*r,u=o/r,h=a/r,f=(a*t-o*e)/r,d=(a*e+o*t)/r;function m(x,v){return x*=n,v*=i,[l*x-c*v+e,t-c*x-l*v]}return m.invert=function(x,v){return[n*(u*x-h*v+f),i*(d-h*x-u*v)]},m}function L_(r){return R_(function(){return r})()}function R_(r){var e,t=150,n=480,i=250,s=0,o=0,a=0,l=0,c=0,u,h=0,f=1,d=1,m=null,x=zd,v=null,g,p,_,y=Gd,M=.5,b,E,P,z,N;function I(L){return P(L[0]*dt,L[1]*dt)}function w(L){return L=P.invert(L[0],L[1]),L&&[L[0]*Gt,L[1]*Gt]}I.stream=function(L){return z&&N===L?z:z=E_(A_(u)(x(b(y(N=L)))))},I.preclip=function(L){return arguments.length?(x=L,m=void 0,B()):x},I.postclip=function(L){return arguments.length?(y=L,v=g=p=_=null,B()):y},I.clipAngle=function(L){return arguments.length?(x=+L?p_(m=L*dt):(m=null,zd),B()):m*Gt},I.clipExtent=function(L){return arguments.length?(y=L==null?(v=g=p=_=null,Gd):g_(v=+L[0][0],g=+L[0][1],p=+L[1][0],_=+L[1][1]),B()):v==null?null:[[v,g],[p,_]]},I.scale=function(L){return arguments.length?(t=+L,T()):t},I.translate=function(L){return arguments.length?(n=+L[0],i=+L[1],T()):[n,i]},I.center=function(L){return arguments.length?(s=L[0]%360*dt,o=L[1]%360*dt,T()):[s*Gt,o*Gt]},I.rotate=function(L){return arguments.length?(a=L[0]%360*dt,l=L[1]%360*dt,c=L.length>2?L[2]%360*dt:0,T()):[a*Gt,l*Gt,c*Gt]},I.angle=function(L){return arguments.length?(h=L%360*dt,T()):h*Gt},I.reflectX=function(L){return arguments.length?(f=L?-1:1,T()):f<0},I.reflectY=function(L){return arguments.length?(d=L?-1:1,T()):d<0},I.precision=function(L){return arguments.length?(b=Yd(E,M=L*L),B()):Yo(M)},I.fitExtent=function(L,F){return qd(I,L,F)},I.fitSize=function(L,F){return __(I,L,F)},I.fitWidth=function(L,F){return M_(I,L,F)},I.fitHeight=function(L,F){return b_(I,L,F)};function T(){var L=Jd(t,0,0,f,d,h).apply(null,e(s,o)),F=Jd(t,n-L[0],i-L[1],f,d,h);return u=Cd(a,l,c),E=tc(e,F),P=tc(u,E),b=Yd(E,M),B()}function B(){return z=N=null,I}return function(){return e=r.apply(this,arguments),I.invert=e.invert&&w,T()}}function hc(r,e){return[r,n_(r_((Ft+e)/2))]}hc.invert=function(r,e){return[r,2*Ad(t_(e))-Ft]};function P_(){return I_(hc).scale(961/kt)}function I_(r){var e=L_(r),t=e.center,n=e.scale,i=e.translate,s=e.clipExtent,o=null,a,l,c;e.scale=function(h){return arguments.length?(n(h),u()):n()},e.translate=function(h){return arguments.length?(i(h),u()):i()},e.center=function(h){return arguments.length?(t(h),u()):t()},e.clipExtent=function(h){return arguments.length?(h==null?o=a=l=c=null:(o=+h[0][0],a=+h[0][1],l=+h[1][0],c=+h[1][1]),u()):o==null?null:[[o,a],[l,c]]};function u(){var h=Ue*n(),f=e(o_(e.rotate()).invert([0,0]));return s(o==null?[[f[0]-h,f[1]-h],[f[0]+h,f[1]+h]]:r===hc?[[Math.max(f[0]-h,o),a],[Math.min(f[0]+h,l),c]]:[[o,Math.max(f[1]-h,a)],[l,Math.min(f[1]+h,c)]])}return u()}var D_=function(r){return P_().center(r.center).scale(r.scale).translate([0,0]).precision(.1)},F_=function(r,e){return e.map(function(t){var n=Td(t,2),i=n[0],s=n[1],o=Td(r([i,s]),2),a=o[0],l=o[1];return new W(a,-l)})};self.onmessage=function(r){var e=r.data,t=e.req,n=t.coordinatesArr,i=t.split,s=t.depth,o=t.projection,a=e.uuid,l=D_({center:o.center,scale:o.scale}),c=n.map(function(d){return F_(l,d)}),u=Wv(c.map(function(d){return Zv({points:d,split:i,depth:s})}),!1),h={},f=[];Object.keys(u.attributes).forEach(function(d){var m=u.attributes[d];h[d]={array:m.array,itemSize:m.itemSize},f.push(m.array.buffer)}),self.postMessage({res:h,uuid:a},f),u.dispose()},module.exports=Lt})();
|