@splinetool/runtime 0.9.52 → 0.9.53
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/build/runtime.js +3 -3
- package/package.json +1 -1
package/build/runtime.js
CHANGED
|
@@ -2983,7 +2983,7 @@ void main() {
|
|
|
2983
2983
|
squared_mean = squared_mean / samples;
|
|
2984
2984
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
2985
2985
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
2986
|
-
}`;function _b(i,e,t){let r=new Na,n=new B,s=new B,o=new Je,a=new Qc({depthPacking:LE}),l=new Jc,c={},h=t.maxTextureSize,u={0:Pr,1:ii,2:or},f=new Mt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new B},radius:{value:4}},vertexShader:SL,fragmentShader:ML}),d=f.clone();d.defines.HORIZONTAL_PASS=1;let p=new Le;p.setAttribute("position",new Ve(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new Vt(p,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ub,this.render=function(b,S,T){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;let A=i.getRenderTarget(),x=i.getActiveCubeFace(),E=i.getActiveMipmapLevel(),_=i.state;_.setBlending(Ht),_.buffers.color.setClear(1,1,1,1),_.buffers.depth.setTest(!0),_.setScissorTest(!1);for(let C=0,I=b.length;C<I;C++){let N=b[C],R=N.shadow;if(R===void 0){console.warn("THREE.WebGLShadowMap:",N,"has no shadow.");continue}if(R.autoUpdate===!1&&R.needsUpdate===!1)continue;n.copy(R.mapSize);let k=R.getFrameExtents();if(n.multiply(k),s.copy(R.mapSize),(n.x>h||n.y>h)&&(n.x>h&&(s.x=Math.floor(h/k.x),n.x=s.x*k.x,R.mapSize.x=s.x),n.y>h&&(s.y=Math.floor(h/k.y),n.y=s.y*k.y,R.mapSize.y=s.y)),R.map===null&&!R.isPointLightShadow&&this.type===Bc&&(R.map=new mt(n.x,n.y),R.map.texture.name=N.name+".shadowMap",R.mapPass=new mt(n.x,n.y),R.camera.updateProjectionMatrix()),R.map===null){let te={minFilter:hr,magFilter:hr,format:Fn};R.map=new mt(n.x,n.y,te),R.map.texture.name=N.name+".shadowMap",R.camera.updateProjectionMatrix()}i.setRenderTarget(R.map),i.clear();let G=R.getViewportCount();for(let te=0;te<G;te++){let Q=R.getViewport(te);o.set(s.x*Q.x,s.y*Q.y,s.x*Q.z,s.y*Q.w),_.viewport(o),R.updateMatrices(N,te),r=R.getFrustum(),w(S,T,R.camera,N,this.type)}!R.isPointLightShadow&&this.type===Bc&&v(R,T),R.needsUpdate=!1}g.needsUpdate=!1,i.setRenderTarget(A,x,E)};function v(b,S){let T=e.update(m);f.defines.VSM_SAMPLES!==b.blurSamples&&(f.defines.VSM_SAMPLES=b.blurSamples,d.defines.VSM_SAMPLES=b.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),f.uniforms.shadow_pass.value=b.map.texture,f.uniforms.resolution.value=b.mapSize,f.uniforms.radius.value=b.radius,i.setRenderTarget(b.mapPass),i.clear(),i.renderBufferDirect(S,null,T,f,m,null),d.uniforms.shadow_pass.value=b.mapPass.texture,d.uniforms.resolution.value=b.mapSize,d.uniforms.radius.value=b.radius,i.setRenderTarget(b.map),i.clear(),i.renderBufferDirect(S,null,T,d,m,null)}function y(b,S,T,A,x,E){let _=null,C=T.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(C!==void 0?_=C:_=T.isPointLight===!0?l:a,i.localClippingEnabled&&S.clipShadows===!0&&S.clippingPlanes.length!==0||S.displacementMap&&S.displacementScale!==0||S.alphaMap&&S.alphaTest>0){let I=_.uuid,N=S.uuid,R=c[I];R===void 0&&(R={},c[I]=R);let k=R[N];k===void 0&&(k=_.clone(),R[N]=k),_=k}return _.visible=S.visible,_.wireframe=S.wireframe,E===Bc?_.side=S.shadowSide!==null?S.shadowSide:S.side:_.side=S.shadowSide!==null?S.shadowSide:u[S.side],_.alphaMap=S.alphaMap,_.alphaTest=S.alphaTest,_.clipShadows=S.clipShadows,_.clippingPlanes=S.clippingPlanes,_.clipIntersection=S.clipIntersection,_.displacementMap=S.displacementMap,_.displacementScale=S.displacementScale,_.displacementBias=S.displacementBias,_.wireframeLinewidth=S.wireframeLinewidth,_.linewidth=S.linewidth,T.isPointLight===!0&&_.isMeshDistanceMaterial===!0&&(_.referencePosition.setFromMatrixPosition(T.matrixWorld),_.nearDistance=A,_.farDistance=x),_}function w(b,S,T,A,x){if(b.visible===!1)return;if(b.layers.test(S.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&x===Bc)&&(!b.frustumCulled||r.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,b.matrixWorld);let C=e.update(b),I=b.material;if(Array.isArray(I)){let N=C.groups;for(let R=0,k=N.length;R<k;R++){let G=N[R],te=I[G.materialIndex];if(te&&te.visible){let Q=y(b,te,A,T.near,T.far,x);i.renderBufferDirect(T,null,C,Q,b,G)}}}else if(I.visible){let N=y(b,I,A,T.near,T.far,x);i.renderBufferDirect(T,null,C,N,b,null)}}let _=b.children;for(let C=0,I=_.length;C<I;C++)w(_[C],S,T,A,x)}}function AL(i,e,t){let r=t.isWebGL2;function n(){let U=!1,Me=new Je,De=null,Ze=new Je(0,0,0,0);return{setMask:function(Oe){De!==Oe&&!U&&(i.colorMask(Oe,Oe,Oe,Oe),De=Oe)},setLocked:function(Oe){U=Oe},setClear:function(Oe,Qe,Te,$e,lt){lt===!0&&(Oe*=$e,Qe*=$e,Te*=$e),Me.set(Oe,Qe,Te,$e),Ze.equals(Me)===!1&&(i.clearColor(Oe,Qe,Te,$e),Ze.copy(Me))},reset:function(){U=!1,De=null,Ze.set(-1,0,0,0)}}}function s(){let U=!1,Me=null,De=null,Ze=null;return{setTest:function(Oe){Oe?J(2929):W(2929)},setMask:function(Oe){Me!==Oe&&!U&&(i.depthMask(Oe),Me=Oe)},setFunc:function(Oe){if(De!==Oe){if(Oe)switch(Oe){case ZT:i.depthFunc(512);break;case $T:i.depthFunc(519);break;case eE:i.depthFunc(513);break;case tg:i.depthFunc(515);break;case tE:i.depthFunc(514);break;case rE:i.depthFunc(518);break;case nE:i.depthFunc(516);break;case iE:i.depthFunc(517);break;default:i.depthFunc(515)}else i.depthFunc(515);De=Oe}},setLocked:function(Oe){U=Oe},setClear:function(Oe){Ze!==Oe&&(i.clearDepth(Oe),Ze=Oe)},reset:function(){U=!1,Me=null,De=null,Ze=null}}}function o(){let U=!1,Me=null,De=null,Ze=null,Oe=null,Qe=null,Te=null,$e=null,lt=null;return{setTest:function(dt){U||(dt?J(2960):W(2960))},setMask:function(dt){Me!==dt&&!U&&(i.stencilMask(dt),Me=dt)},setFunc:function(dt,Ut,Ur){(De!==dt||Ze!==Ut||Oe!==Ur)&&(i.stencilFunc(dt,Ut,Ur),De=dt,Ze=Ut,Oe=Ur)},setOp:function(dt,Ut,Ur){(Qe!==dt||Te!==Ut||$e!==Ur)&&(i.stencilOp(dt,Ut,Ur),Qe=dt,Te=Ut,$e=Ur)},setLocked:function(dt){U=dt},setClear:function(dt){lt!==dt&&(i.clearStencil(dt),lt=dt)},reset:function(){U=!1,Me=null,De=null,Ze=null,Oe=null,Qe=null,Te=null,$e=null,lt=null}}}let a=new n,l=new s,c=new o,h={},u={},f=new WeakMap,d=[],p=null,m=!1,g=null,v=null,y=null,w=null,b=null,S=null,T=null,A=!1,x=null,E=null,_=null,C=null,I=null,N=i.getParameter(35661),R=!1,k=0,G=i.getParameter(7938);G.indexOf("WebGL")!==-1?(k=parseFloat(/^WebGL (\d)/.exec(G)[1]),R=k>=1):G.indexOf("OpenGL ES")!==-1&&(k=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),R=k>=2);let te=null,Q={},Y=i.getParameter(3088),F=i.getParameter(2978),z=new Je().fromArray(Y),O=new Je().fromArray(F);function j(U,Me,De){let Ze=new Uint8Array(4),Oe=i.createTexture();i.bindTexture(U,Oe),i.texParameteri(U,10241,9728),i.texParameteri(U,10240,9728);for(let Qe=0;Qe<De;Qe++)i.texImage2D(Me+Qe,0,6408,1,1,0,6408,5121,Ze);return Oe}let q={};q[3553]=j(3553,3553,1),q[34067]=j(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),J(2929),l.setFunc(tg),Z(!1),ce(Ex),J(2884),K(Ht);function J(U){h[U]!==!0&&(i.enable(U),h[U]=!0)}function W(U){h[U]!==!1&&(i.disable(U),h[U]=!1)}function ge(U,Me){return u[U]!==Me?(i.bindFramebuffer(U,Me),u[U]=Me,r&&(U===36009&&(u[36160]=Me),U===36160&&(u[36009]=Me)),!0):!1}function oe(U,Me){let De=d,Ze=!1;if(U)if(De=f.get(Me),De===void 0&&(De=[],f.set(Me,De)),U.isWebGLMultipleRenderTargets){let Oe=U.texture;if(De.length!==Oe.length||De[0]!==36064){for(let Qe=0,Te=Oe.length;Qe<Te;Qe++)De[Qe]=36064+Qe;De.length=Oe.length,Ze=!0}}else De[0]!==36064&&(De[0]=36064,Ze=!0);else De[0]!==1029&&(De[0]=1029,Ze=!0);Ze&&(t.isWebGL2?i.drawBuffers(De):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(De))}function le(U){return p!==U?(i.useProgram(U),p=U,!0):!1}let H={[Ea]:32774,[kT]:32778,[VT]:32779};if(r)H[Px]=32775,H[Lx]=32776;else{let U=e.get("EXT_blend_minmax");U!==null&&(H[Px]=U.MIN_EXT,H[Lx]=U.MAX_EXT)}let he={[HT]:0,[WT]:1,[jT]:768,[db]:770,[KT]:776,[QT]:774,[YT]:772,[qT]:769,[pb]:771,[JT]:775,[XT]:773};function K(U,Me,De,Ze,Oe,Qe,Te,$e){if(U===Ht){m===!0&&(W(3042),m=!1);return}if(m===!1&&(J(3042),m=!0),U!==GT){if(U!==g||$e!==A){if((v!==Ea||b!==Ea)&&(i.blendEquation(32774),v=Ea,b=Ea),$e)switch(U){case Ps:i.blendFuncSeparate(1,771,1,771);break;case _x:i.blendFunc(1,1);break;case Cx:i.blendFuncSeparate(0,769,0,1);break;case Dx:i.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",U);break}else switch(U){case Ps:i.blendFuncSeparate(770,771,1,771);break;case _x:i.blendFunc(770,1);break;case Cx:i.blendFuncSeparate(0,769,0,1);break;case Dx:i.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",U);break}y=null,w=null,S=null,T=null,g=U,A=$e}return}Oe=Oe||Me,Qe=Qe||De,Te=Te||Ze,(Me!==v||Oe!==b)&&(i.blendEquationSeparate(H[Me],H[Oe]),v=Me,b=Oe),(De!==y||Ze!==w||Qe!==S||Te!==T)&&(i.blendFuncSeparate(he[De],he[Ze],he[Qe],he[Te]),y=De,w=Ze,S=Qe,T=Te),g=U,A=null}function V(U,Me){U.side===or?W(2884):J(2884);let De=U.side===Pr;Me&&(De=!De),Z(De),U.blending===Ps&&U.transparent===!1?K(Ht):K(U.blending,U.blendEquation,U.blendSrc,U.blendDst,U.blendEquationAlpha,U.blendSrcAlpha,U.blendDstAlpha,U.premultipliedAlpha),l.setFunc(U.depthFunc),l.setTest(U.depthTest),l.setMask(U.depthWrite),a.setMask(U.colorWrite);let Ze=U.stencilWrite;c.setTest(Ze),Ze&&(c.setMask(U.stencilWriteMask),c.setFunc(U.stencilFunc,U.stencilRef,U.stencilFuncMask),c.setOp(U.stencilFail,U.stencilZFail,U.stencilZPass)),pe(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),U.alphaToCoverage===!0?J(32926):W(32926)}function Z(U){x!==U&&(U?i.frontFace(2304):i.frontFace(2305),x=U)}function ce(U){U!==UT?(J(2884),U!==E&&(U===Ex?i.cullFace(1029):U===zT?i.cullFace(1028):i.cullFace(1032))):W(2884),E=U}function se(U){U!==_&&(R&&i.lineWidth(U),_=U)}function pe(U,Me,De){U?(J(32823),(C!==Me||I!==De)&&(i.polygonOffset(Me,De),C=Me,I=De)):W(32823)}function ve(U){U?J(3089):W(3089)}function me(U){U===void 0&&(U=33984+N-1),te!==U&&(i.activeTexture(U),te=U)}function Pe(U,Me){te===null&&me();let De=Q[te];De===void 0&&(De={type:void 0,texture:void 0},Q[te]=De),(De.type!==U||De.texture!==Me)&&(i.bindTexture(U,Me||q[U]),De.type=U,De.texture=Me)}function ke(){let U=Q[te];U!==void 0&&U.type!==void 0&&(i.bindTexture(U.type,null),U.type=void 0,U.texture=void 0)}function L(){try{i.compressedTexImage2D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function D(){try{i.texSubImage2D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function re(){try{i.texSubImage3D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function ye(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Se(){try{i.texStorage2D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Ie(){try{i.texStorage3D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Fe(){try{i.texImage2D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function ue(){try{i.texImage3D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function rt(U){z.equals(U)===!1&&(i.scissor(U.x,U.y,U.z,U.w),z.copy(U))}function st(U){O.equals(U)===!1&&(i.viewport(U.x,U.y,U.z,U.w),O.copy(U))}function Ee(){i.disable(3042),i.disable(2884),i.disable(2929),i.disable(32823),i.disable(3089),i.disable(2960),i.disable(32926),i.blendEquation(32774),i.blendFunc(1,0),i.blendFuncSeparate(1,0,1,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(513),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(519,0,4294967295),i.stencilOp(7680,7680,7680),i.clearStencil(0),i.cullFace(1029),i.frontFace(2305),i.polygonOffset(0,0),i.activeTexture(33984),i.bindFramebuffer(36160,null),r===!0&&(i.bindFramebuffer(36009,null),i.bindFramebuffer(36008,null)),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),h={},te=null,Q={},u={},f=new WeakMap,d=[],p=null,m=!1,g=null,v=null,y=null,w=null,b=null,S=null,T=null,A=!1,x=null,E=null,_=null,C=null,I=null,z.set(0,0,i.canvas.width,i.canvas.height),O.set(0,0,i.canvas.width,i.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:J,disable:W,bindFramebuffer:ge,drawBuffers:oe,useProgram:le,setBlending:K,setMaterial:V,setFlipSided:Z,setCullFace:ce,setLineWidth:se,setPolygonOffset:pe,setScissorTest:ve,activeTexture:me,bindTexture:Pe,unbindTexture:ke,compressedTexImage2D:L,texImage2D:Fe,texImage3D:ue,texStorage2D:Se,texStorage3D:Ie,texSubImage2D:D,texSubImage3D:re,compressedTexSubImage2D:ye,scissor:rt,viewport:st,reset:Ee}}function TL(i,e,t,r,n,s,o){let a=n.isWebGL2,l=n.maxTextures,c=n.maxCubemapSize,h=n.maxTextureSize,u=n.maxSamples,f=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,d=/OculusBrowser/g.test(navigator.userAgent),p=new WeakMap,m,g=new WeakMap,v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(L,D){return v?new OffscreenCanvas(L,D):jc("canvas")}function w(L,D,re,ye){let Se=1;if((L.width>ye||L.height>ye)&&(Se=ye/Math.max(L.width,L.height)),Se<1||D===!0)if(typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&L instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&L instanceof ImageBitmap){let Ie=D?mf:Math.floor,Fe=Ie(Se*L.width),ue=Ie(Se*L.height);m===void 0&&(m=y(Fe,ue));let rt=re?y(Fe,ue):m;return rt.width=Fe,rt.height=ue,rt.getContext("2d").drawImage(L,0,0,Fe,ue),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+L.width+"x"+L.height+") to ("+Fe+"x"+ue+")."),rt}else return"data"in L&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+L.width+"x"+L.height+")."),L;return L}function b(L){return og(L.width)&&og(L.height)}function S(L){return a?!1:L.wrapS!==Dr||L.wrapT!==Dr||L.minFilter!==hr&&L.minFilter!==ct}function T(L,D){return L.generateMipmaps&&D&&L.minFilter!==hr&&L.minFilter!==ct}function A(L){i.generateMipmap(L)}function x(L,D,re,ye,Se=!1){if(a===!1)return D;if(L!==null){if(i[L]!==void 0)return i[L];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+L+"'")}let Ie=D;return D===6403&&(re===5126&&(Ie=33326),re===5131&&(Ie=33325),re===5121&&(Ie=33321)),D===33319&&(re===5126&&(Ie=33328),re===5131&&(Ie=33327),re===5121&&(Ie=33323)),D===6408&&(re===5126&&(Ie=34836),re===5131&&(Ie=34842),re===5121&&(Ie=ye===je&&Se===!1?35907:32856),re===32819&&(Ie=32854),re===32820&&(Ie=32855)),(Ie===33325||Ie===33326||Ie===33327||Ie===33328||Ie===34842||Ie===34836)&&e.get("EXT_color_buffer_float"),Ie}function E(L,D,re){return T(L,re)===!0||L.isFramebufferTexture&&L.minFilter!==hr&&L.minFilter!==ct?Math.log2(Math.max(D.width,D.height))+1:L.mipmaps!==void 0&&L.mipmaps.length>0?L.mipmaps.length:L.isCompressedTexture&&Array.isArray(L.image)?D.mipmaps.length:1}function _(L){return L===hr||L===Ix||L===Rx?9728:9729}function C(L){let D=L.target;D.removeEventListener("dispose",C),N(D),D.isVideoTexture&&p.delete(D)}function I(L){let D=L.target;D.removeEventListener("dispose",I),k(D)}function N(L){let D=r.get(L);if(D.__webglInit===void 0)return;let re=L.source,ye=g.get(re);if(ye){let Se=ye[D.__cacheKey];Se.usedTimes--,Se.usedTimes===0&&R(L),Object.keys(ye).length===0&&g.delete(re)}r.remove(L)}function R(L){let D=r.get(L);i.deleteTexture(D.__webglTexture);let re=L.source,ye=g.get(re);delete ye[D.__cacheKey],o.memory.textures--}function k(L){let D=L.texture,re=r.get(L),ye=r.get(D);if(ye.__webglTexture!==void 0&&(i.deleteTexture(ye.__webglTexture),o.memory.textures--),L.depthTexture&&L.depthTexture.dispose(),L.isWebGLCubeRenderTarget)for(let Se=0;Se<6;Se++)i.deleteFramebuffer(re.__webglFramebuffer[Se]),re.__webglDepthbuffer&&i.deleteRenderbuffer(re.__webglDepthbuffer[Se]);else i.deleteFramebuffer(re.__webglFramebuffer),re.__webglDepthbuffer&&i.deleteRenderbuffer(re.__webglDepthbuffer),re.__webglMultisampledFramebuffer&&i.deleteFramebuffer(re.__webglMultisampledFramebuffer),re.__webglColorRenderbuffer&&i.deleteRenderbuffer(re.__webglColorRenderbuffer),re.__webglDepthRenderbuffer&&i.deleteRenderbuffer(re.__webglDepthRenderbuffer);if(L.isWebGLMultipleRenderTargets)for(let Se=0,Ie=D.length;Se<Ie;Se++){let Fe=r.get(D[Se]);Fe.__webglTexture&&(i.deleteTexture(Fe.__webglTexture),o.memory.textures--),r.remove(D[Se])}r.remove(D),r.remove(L)}let G=0;function te(){G=0}function Q(){let L=G;return L>=l&&console.warn("THREE.WebGLTextures: Trying to use "+L+" texture units while this GPU supports only "+l),G+=1,L}function Y(L){let D=[];return D.push(L.wrapS),D.push(L.wrapT),D.push(L.magFilter),D.push(L.minFilter),D.push(L.anisotropy),D.push(L.internalFormat),D.push(L.format),D.push(L.type),D.push(L.generateMipmaps),D.push(L.premultiplyAlpha),D.push(L.flipY),D.push(L.unpackAlignment),D.push(L.encoding),D.join()}function F(L,D){let re=r.get(L);if(L.isVideoTexture&&Pe(L),L.isRenderTargetTexture===!1&&L.version>0&&re.__version!==L.version){let ye=L.image;if(ye===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ye.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{oe(re,L,D);return}}t.activeTexture(33984+D),t.bindTexture(3553,re.__webglTexture)}function z(L,D){let re=r.get(L);if(L.version>0&&re.__version!==L.version){oe(re,L,D);return}t.activeTexture(33984+D),t.bindTexture(35866,re.__webglTexture)}function O(L,D){let re=r.get(L);if(L.version>0&&re.__version!==L.version){oe(re,L,D);return}t.activeTexture(33984+D),t.bindTexture(32879,re.__webglTexture)}function j(L,D){let re=r.get(L);if(L.version>0&&re.__version!==L.version){le(re,L,D);return}t.activeTexture(33984+D),t.bindTexture(34067,re.__webglTexture)}let q={[Ia]:10497,[Dr]:33071,[ig]:33648},J={[hr]:9728,[Ix]:9984,[Rx]:9986,[ct]:9729,[fE]:9985,[js]:9987};function W(L,D,re){if(re?(i.texParameteri(L,10242,q[D.wrapS]),i.texParameteri(L,10243,q[D.wrapT]),(L===32879||L===35866)&&i.texParameteri(L,32882,q[D.wrapR]),i.texParameteri(L,10240,J[D.magFilter]),i.texParameteri(L,10241,J[D.minFilter])):(i.texParameteri(L,10242,33071),i.texParameteri(L,10243,33071),(L===32879||L===35866)&&i.texParameteri(L,32882,33071),(D.wrapS!==Dr||D.wrapT!==Dr)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),i.texParameteri(L,10240,_(D.magFilter)),i.texParameteri(L,10241,_(D.minFilter)),D.minFilter!==hr&&D.minFilter!==ct&&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){let ye=e.get("EXT_texture_filter_anisotropic");if(D.type===Ds&&e.has("OES_texture_float_linear")===!1||a===!1&&D.type===Vc&&e.has("OES_texture_half_float_linear")===!1)return;(D.anisotropy>1||r.get(D).__currentAnisotropy)&&(i.texParameterf(L,ye.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(D.anisotropy,n.getMaxAnisotropy())),r.get(D).__currentAnisotropy=D.anisotropy)}}function ge(L,D){let re=!1;L.__webglInit===void 0&&(L.__webglInit=!0,D.addEventListener("dispose",C));let ye=D.source,Se=g.get(ye);Se===void 0&&(Se={},g.set(ye,Se));let Ie=Y(D);if(Ie!==L.__cacheKey){Se[Ie]===void 0&&(Se[Ie]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,re=!0),Se[Ie].usedTimes++;let Fe=Se[L.__cacheKey];Fe!==void 0&&(Se[L.__cacheKey].usedTimes--,Fe.usedTimes===0&&R(D)),L.__cacheKey=Ie,L.__webglTexture=Se[Ie].texture}return re}function oe(L,D,re){let ye=3553;D.isDataArrayTexture&&(ye=35866),D.isData3DTexture&&(ye=32879);let Se=ge(L,D),Ie=D.source;if(t.activeTexture(33984+re),t.bindTexture(ye,L.__webglTexture),Ie.version!==Ie.__currentVersion||Se===!0){i.pixelStorei(37440,D.flipY),i.pixelStorei(37441,D.premultiplyAlpha),i.pixelStorei(3317,D.unpackAlignment),i.pixelStorei(37443,0);let Fe=S(D)&&b(D.image)===!1,ue=w(D.image,Fe,!1,h);ue=ke(D,ue);let rt=b(ue)||a,st=s.convert(D.format,D.encoding),Ee=s.convert(D.type),U=x(D.internalFormat,st,Ee,D.encoding,D.isVideoTexture);W(ye,D,rt);let Me,De=D.mipmaps,Ze=a&&D.isVideoTexture!==!0,Oe=L.__version===void 0||Se===!0,Qe=E(D,ue,rt);if(D.isDepthTexture)U=6402,a?D.type===Ds?U=36012:D.type===La?U=33190:D.type===Ls?U=35056:U=33189:D.type===Ds&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),D.format===Eo&&U===6402&&D.type!==kc&&D.type!==La&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),D.type=kc,Ee=s.convert(D.type)),D.format===Ns&&U===6402&&(U=34041,D.type!==Ls&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),D.type=Ls,Ee=s.convert(D.type))),Oe&&(Ze?t.texStorage2D(3553,1,U,ue.width,ue.height):t.texImage2D(3553,0,U,ue.width,ue.height,0,st,Ee,null));else if(D.isDataTexture)if(De.length>0&&rt){Ze&&Oe&&t.texStorage2D(3553,Qe,U,De[0].width,De[0].height);for(let Te=0,$e=De.length;Te<$e;Te++)Me=De[Te],Ze?t.texSubImage2D(3553,Te,0,0,Me.width,Me.height,st,Ee,Me.data):t.texImage2D(3553,Te,U,Me.width,Me.height,0,st,Ee,Me.data);D.generateMipmaps=!1}else Ze?(Oe&&t.texStorage2D(3553,Qe,U,ue.width,ue.height),t.texSubImage2D(3553,0,0,0,ue.width,ue.height,st,Ee,ue.data)):t.texImage2D(3553,0,U,ue.width,ue.height,0,st,Ee,ue.data);else if(D.isCompressedTexture){Ze&&Oe&&t.texStorage2D(3553,Qe,U,De[0].width,De[0].height);for(let Te=0,$e=De.length;Te<$e;Te++)Me=De[Te],D.format!==Fn?st!==null?Ze?t.compressedTexSubImage2D(3553,Te,0,0,Me.width,Me.height,st,Me.data):t.compressedTexImage2D(3553,Te,U,Me.width,Me.height,0,Me.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ze?t.texSubImage2D(3553,Te,0,0,Me.width,Me.height,st,Ee,Me.data):t.texImage2D(3553,Te,U,Me.width,Me.height,0,st,Ee,Me.data)}else if(D.isDataArrayTexture)Ze?(Oe&&t.texStorage3D(35866,Qe,U,ue.width,ue.height,ue.depth),t.texSubImage3D(35866,0,0,0,0,ue.width,ue.height,ue.depth,st,Ee,ue.data)):t.texImage3D(35866,0,U,ue.width,ue.height,ue.depth,0,st,Ee,ue.data);else if(D.isData3DTexture)Ze?(Oe&&t.texStorage3D(32879,Qe,U,ue.width,ue.height,ue.depth),t.texSubImage3D(32879,0,0,0,0,ue.width,ue.height,ue.depth,st,Ee,ue.data)):t.texImage3D(32879,0,U,ue.width,ue.height,ue.depth,0,st,Ee,ue.data);else if(D.isFramebufferTexture){if(Oe)if(Ze)t.texStorage2D(3553,Qe,U,ue.width,ue.height);else{let Te=ue.width,$e=ue.height;for(let lt=0;lt<Qe;lt++)t.texImage2D(3553,lt,U,Te,$e,0,st,Ee,null),Te>>=1,$e>>=1}}else if(De.length>0&&rt){Ze&&Oe&&t.texStorage2D(3553,Qe,U,De[0].width,De[0].height);for(let Te=0,$e=De.length;Te<$e;Te++)Me=De[Te],Ze?t.texSubImage2D(3553,Te,0,0,st,Ee,Me):t.texImage2D(3553,Te,U,st,Ee,Me);D.generateMipmaps=!1}else Ze?(Oe&&t.texStorage2D(3553,Qe,U,ue.width,ue.height),t.texSubImage2D(3553,0,0,0,st,Ee,ue)):t.texImage2D(3553,0,U,st,Ee,ue);T(D,rt)&&A(ye),Ie.__currentVersion=Ie.version,D.onUpdate&&D.onUpdate(D)}L.__version=D.version}function le(L,D,re){if(D.image.length!==6)return;let ye=ge(L,D),Se=D.source;if(t.activeTexture(33984+re),t.bindTexture(34067,L.__webglTexture),Se.version!==Se.__currentVersion||ye===!0){i.pixelStorei(37440,D.flipY),i.pixelStorei(37441,D.premultiplyAlpha),i.pixelStorei(3317,D.unpackAlignment),i.pixelStorei(37443,0);let Ie=D.isCompressedTexture||D.image[0].isCompressedTexture,Fe=D.image[0]&&D.image[0].isDataTexture,ue=[];for(let Te=0;Te<6;Te++)!Ie&&!Fe?ue[Te]=w(D.image[Te],!1,!0,c):ue[Te]=Fe?D.image[Te].image:D.image[Te],ue[Te]=ke(D,ue[Te]);let rt=ue[0],st=b(rt)||a,Ee=s.convert(D.format,D.encoding),U=s.convert(D.type),Me=x(D.internalFormat,Ee,U,D.encoding),De=a&&D.isVideoTexture!==!0,Ze=L.__version===void 0,Oe=E(D,rt,st);W(34067,D,st);let Qe;if(Ie){De&&Ze&&t.texStorage2D(34067,Oe,Me,rt.width,rt.height);for(let Te=0;Te<6;Te++){Qe=ue[Te].mipmaps;for(let $e=0;$e<Qe.length;$e++){let lt=Qe[$e];D.format!==Fn?Ee!==null?De?t.compressedTexSubImage2D(34069+Te,$e,0,0,lt.width,lt.height,Ee,lt.data):t.compressedTexImage2D(34069+Te,$e,Me,lt.width,lt.height,0,lt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):De?t.texSubImage2D(34069+Te,$e,0,0,lt.width,lt.height,Ee,U,lt.data):t.texImage2D(34069+Te,$e,Me,lt.width,lt.height,0,Ee,U,lt.data)}}}else{Qe=D.mipmaps,De&&Ze&&(Qe.length>0&&Oe++,t.texStorage2D(34067,Oe,Me,ue[0].width,ue[0].height));for(let Te=0;Te<6;Te++)if(Fe){De?t.texSubImage2D(34069+Te,0,0,0,ue[Te].width,ue[Te].height,Ee,U,ue[Te].data):t.texImage2D(34069+Te,0,Me,ue[Te].width,ue[Te].height,0,Ee,U,ue[Te].data);for(let $e=0;$e<Qe.length;$e++){let dt=Qe[$e].image[Te].image;De?t.texSubImage2D(34069+Te,$e+1,0,0,dt.width,dt.height,Ee,U,dt.data):t.texImage2D(34069+Te,$e+1,Me,dt.width,dt.height,0,Ee,U,dt.data)}}else{De?t.texSubImage2D(34069+Te,0,0,0,Ee,U,ue[Te]):t.texImage2D(34069+Te,0,Me,Ee,U,ue[Te]);for(let $e=0;$e<Qe.length;$e++){let lt=Qe[$e];De?t.texSubImage2D(34069+Te,$e+1,0,0,Ee,U,lt.image[Te]):t.texImage2D(34069+Te,$e+1,Me,Ee,U,lt.image[Te])}}}T(D,st)&&A(34067),Se.__currentVersion=Se.version,D.onUpdate&&D.onUpdate(D)}L.__version=D.version}function H(L,D,re,ye,Se){let Ie=s.convert(re.format,re.encoding),Fe=s.convert(re.type),ue=x(re.internalFormat,Ie,Fe,re.encoding);r.get(D).__hasExternalTextures||(Se===32879||Se===35866?t.texImage3D(Se,0,ue,D.width,D.height,D.depth,0,Ie,Fe,null):t.texImage2D(Se,0,ue,D.width,D.height,0,Ie,Fe,null)),t.bindFramebuffer(36160,L),me(D)?f.framebufferTexture2DMultisampleEXT(36160,ye,Se,r.get(re).__webglTexture,0,ve(D)):i.framebufferTexture2D(36160,ye,Se,r.get(re).__webglTexture,0),t.bindFramebuffer(36160,null)}function he(L,D,re){if(i.bindRenderbuffer(36161,L),D.depthBuffer&&!D.stencilBuffer){let ye=33189;if(re||me(D)){let Se=D.depthTexture;Se&&Se.isDepthTexture&&(Se.type===Ds?ye=36012:Se.type===La&&(ye=33190));let Ie=ve(D);me(D)?f.renderbufferStorageMultisampleEXT(36161,Ie,ye,D.width,D.height):i.renderbufferStorageMultisample(36161,Ie,ye,D.width,D.height)}else i.renderbufferStorage(36161,ye,D.width,D.height);i.framebufferRenderbuffer(36160,36096,36161,L)}else if(D.depthBuffer&&D.stencilBuffer){let ye=ve(D);re&&me(D)===!1?i.renderbufferStorageMultisample(36161,ye,35056,D.width,D.height):me(D)?f.renderbufferStorageMultisampleEXT(36161,ye,35056,D.width,D.height):i.renderbufferStorage(36161,34041,D.width,D.height),i.framebufferRenderbuffer(36160,33306,36161,L)}else{let ye=D.isWebGLMultipleRenderTargets===!0?D.texture[0]:D.texture,Se=s.convert(ye.format,ye.encoding),Ie=s.convert(ye.type),Fe=x(ye.internalFormat,Se,Ie,ye.encoding),ue=ve(D);re&&me(D)===!1?i.renderbufferStorageMultisample(36161,ue,Fe,D.width,D.height):me(D)?f.renderbufferStorageMultisampleEXT(36161,ue,Fe,D.width,D.height):i.renderbufferStorage(36161,Fe,D.width,D.height)}i.bindRenderbuffer(36161,null)}function K(L,D){if(D&&D.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,L),!(D.depthTexture&&D.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(D.depthTexture).__webglTexture||D.depthTexture.image.width!==D.width||D.depthTexture.image.height!==D.height)&&(D.depthTexture.image.width=D.width,D.depthTexture.image.height=D.height,D.depthTexture.needsUpdate=!0),F(D.depthTexture,0);let ye=r.get(D.depthTexture).__webglTexture,Se=ve(D);if(D.depthTexture.format===Eo)me(D)?f.framebufferTexture2DMultisampleEXT(36160,36096,3553,ye,0,Se):i.framebufferTexture2D(36160,36096,3553,ye,0);else if(D.depthTexture.format===Ns)me(D)?f.framebufferTexture2DMultisampleEXT(36160,33306,3553,ye,0,Se):i.framebufferTexture2D(36160,33306,3553,ye,0);else throw new Error("Unknown depthTexture format")}function V(L){let D=r.get(L),re=L.isWebGLCubeRenderTarget===!0;if(L.depthTexture&&!D.__autoAllocateDepthBuffer){if(re)throw new Error("target.depthTexture not supported in Cube render targets");K(D.__webglFramebuffer,L)}else if(re){D.__webglDepthbuffer=[];for(let ye=0;ye<6;ye++)t.bindFramebuffer(36160,D.__webglFramebuffer[ye]),D.__webglDepthbuffer[ye]=i.createRenderbuffer(),he(D.__webglDepthbuffer[ye],L,!1)}else t.bindFramebuffer(36160,D.__webglFramebuffer),D.__webglDepthbuffer=i.createRenderbuffer(),he(D.__webglDepthbuffer,L,!1);t.bindFramebuffer(36160,null)}function Z(L,D,re){let ye=r.get(L);D!==void 0&&H(ye.__webglFramebuffer,L,L.texture,36064,3553),re!==void 0&&V(L)}function ce(L){let D=L.texture,re=r.get(L),ye=r.get(D);L.addEventListener("dispose",I),L.isWebGLMultipleRenderTargets!==!0&&(ye.__webglTexture===void 0&&(ye.__webglTexture=i.createTexture()),ye.__version=D.version,o.memory.textures++);let Se=L.isWebGLCubeRenderTarget===!0,Ie=L.isWebGLMultipleRenderTargets===!0,Fe=b(L)||a;if(Se){re.__webglFramebuffer=[];for(let ue=0;ue<6;ue++)re.__webglFramebuffer[ue]=i.createFramebuffer()}else if(re.__webglFramebuffer=i.createFramebuffer(),Ie)if(n.drawBuffers){let ue=L.texture;for(let rt=0,st=ue.length;rt<st;rt++){let Ee=r.get(ue[rt]);Ee.__webglTexture===void 0&&(Ee.__webglTexture=i.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(a&&L.samples>0&&me(L)===!1){re.__webglMultisampledFramebuffer=i.createFramebuffer(),re.__webglColorRenderbuffer=i.createRenderbuffer(),i.bindRenderbuffer(36161,re.__webglColorRenderbuffer);let ue=s.convert(D.format,D.encoding),rt=s.convert(D.type),st=x(D.internalFormat,ue,rt,D.encoding),Ee=ve(L);i.renderbufferStorageMultisample(36161,Ee,st,L.width,L.height),t.bindFramebuffer(36160,re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(36160,36064,36161,re.__webglColorRenderbuffer),i.bindRenderbuffer(36161,null),L.depthBuffer&&(re.__webglDepthRenderbuffer=i.createRenderbuffer(),he(re.__webglDepthRenderbuffer,L,!0)),t.bindFramebuffer(36160,null)}if(Se){t.bindTexture(34067,ye.__webglTexture),W(34067,D,Fe);for(let ue=0;ue<6;ue++)H(re.__webglFramebuffer[ue],L,D,36064,34069+ue);T(D,Fe)&&A(34067),t.unbindTexture()}else if(Ie){let ue=L.texture;for(let rt=0,st=ue.length;rt<st;rt++){let Ee=ue[rt],U=r.get(Ee);t.bindTexture(3553,U.__webglTexture),W(3553,Ee,Fe),H(re.__webglFramebuffer,L,Ee,36064+rt,3553),T(Ee,Fe)&&A(3553)}t.unbindTexture()}else{let ue=3553;(L.isWebGL3DRenderTarget||L.isWebGLArrayRenderTarget)&&(a?ue=L.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(ue,ye.__webglTexture),W(ue,D,Fe),H(re.__webglFramebuffer,L,D,36064,ue),T(D,Fe)&&A(ue),t.unbindTexture()}L.depthBuffer&&V(L)}function se(L){let D=b(L)||a,re=L.isWebGLMultipleRenderTargets===!0?L.texture:[L.texture];for(let ye=0,Se=re.length;ye<Se;ye++){let Ie=re[ye];if(T(Ie,D)){let Fe=L.isWebGLCubeRenderTarget?34067:3553,ue=r.get(Ie).__webglTexture;t.bindTexture(Fe,ue),A(Fe),t.unbindTexture()}}}function pe(L){if(a&&L.samples>0&&me(L)===!1){let D=L.width,re=L.height,ye=16384,Se=[36064],Ie=L.stencilBuffer?33306:36096;L.depthBuffer&&Se.push(Ie);let Fe=r.get(L),ue=Fe.__ignoreDepthValues!==void 0?Fe.__ignoreDepthValues:!1;ue===!1&&(L.depthBuffer&&(ye|=256),L.stencilBuffer&&(ye|=1024)),t.bindFramebuffer(36008,Fe.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,Fe.__webglFramebuffer),ue===!0&&(i.invalidateFramebuffer(36008,[Ie]),i.invalidateFramebuffer(36009,[Ie])),i.blitFramebuffer(0,0,D,re,0,0,D,re,ye,9728),d&&i.invalidateFramebuffer(36008,Se),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,Fe.__webglMultisampledFramebuffer)}}function ve(L){return Math.min(u,L.samples)}function me(L){let D=r.get(L);return a&&L.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&D.__useRenderToTexture!==!1}function Pe(L){let D=o.render.frame;p.get(L)!==D&&(p.set(L,D),L.update())}function ke(L,D){let re=L.encoding,ye=L.format,Se=L.type;return L.isCompressedTexture===!0||L.isVideoTexture===!0||L.format===sg||re!==gn&&(re===je?a===!1?e.has("EXT_sRGB")===!0&&ye===Fn?(L.format=sg,L.minFilter=ct,L.generateMipmaps=!1):D=ns.sRGBToLinear(D):(ye!==Fn||Se!==qt)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",re)),D}this.allocateTextureUnit=Q,this.resetTextureUnits=te,this.setTexture2D=F,this.setTexture2DArray=z,this.setTexture3D=O,this.setTextureCube=j,this.rebindTextures=Z,this.setupRenderTarget=ce,this.updateRenderTargetMipmap=se,this.updateMultisampleRenderTarget=pe,this.setupDepthRenderbuffer=V,this.setupFrameBufferTexture=H,this.useMultisampledRTT=me}function EL(i,e,t){let r=t.isWebGL2;function n(s,o=null){let a;if(s===qt)return 5121;if(s===gE)return 32819;if(s===yE)return 32820;if(s===dE)return 5120;if(s===pE)return 5122;if(s===kc)return 5123;if(s===mE)return 5124;if(s===La)return 5125;if(s===Ds)return 5126;if(s===Vc)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===vE)return 6406;if(s===Fn)return 6408;if(s===bE)return 6409;if(s===wE)return 6410;if(s===Eo)return 6402;if(s===Ns)return 34041;if(s===SE)return 6403;if(s===xE)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===sg)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===ME)return 36244;if(s===AE)return 33319;if(s===TE)return 33320;if(s===EE)return 36249;if(s===ym||s===vm||s===xm||s===bm)if(o===je)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===ym)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===vm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===xm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===bm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===ym)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===vm)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===xm)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===bm)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Bx||s===Nx||s===Ox||s===Fx)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===Bx)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Nx)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Ox)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Fx)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===_E)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Ux||s===zx)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===Ux)return o===je?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===zx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Gx||s===kx||s===Vx||s===Hx||s===Wx||s===jx||s===qx||s===Yx||s===Xx||s===Qx||s===Jx||s===Kx||s===Zx||s===$x)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Gx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===kx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Vx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Hx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Wx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===jx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===qx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Yx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Xx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Qx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Jx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Kx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===Zx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===$x)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===e0)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===e0)return o===je?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return s===Ls?r?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):i[s]!==void 0?i[s]:null}return{convert:n}}var bf=class extends sr{constructor(e=[]){super(),this.cameras=e}};bf.prototype.isArrayCamera=!0;var ts=class extends ot{constructor(){super(),this.type="Group"}};ts.prototype.isGroup=!0;var _L={type:"move"},Uc=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ts,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 ts,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new M,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new M),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ts,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new M,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new M),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,r){let n=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(n=t.getPose(e.targetRaySpace,r),n!==null&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(_L))),c&&e.hand){o=!0;for(let m of e.hand.values()){let g=t.getJointPose(m,r);if(c.joints[m.jointName]===void 0){let y=new ts;y.matrixAutoUpdate=!1,y.visible=!1,c.joints[m.jointName]=y,c.add(y)}let v=c.joints[m.jointName];g!==null&&(v.matrix.fromArray(g.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.jointRadius=g.radius),v.visible=g!==null}let h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],f=h.position.distanceTo(u.position),d=.02,p=.005;c.inputState.pinching&&f>d+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),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=n!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}},oi=class extends Dt{constructor(e,t,r,n,s,o,a,l,c,h){if(h=h!==void 0?h:Eo,h!==Eo&&h!==Ns)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&h===Eo&&(r=kc),r===void 0&&h===Ns&&(r=Ls),super(null,n,s,o,a,l,h,r,c),this.image={width:e,height:t},this.magFilter=a!==void 0?a:hr,this.minFilter=l!==void 0?l:hr,this.flipY=!1,this.generateMipmaps=!1}};oi.prototype.isDepthTexture=!0;var pg=class extends Yt{constructor(e,t){super();let r=this,n=null,s=1,o=null,a="local-floor",l=null,c=null,h=null,u=null,f=null,d=null,p=t.getContextAttributes(),m=null,g=null,v=[],y=new Map,w=new sr;w.layers.enable(1),w.viewport=new Je;let b=new sr;b.layers.enable(2),b.viewport=new Je;let S=[w,b],T=new bf;T.layers.enable(1),T.layers.enable(2);let A=null,x=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let F=v[Y];return F===void 0&&(F=new Uc,v[Y]=F),F.getTargetRaySpace()},this.getControllerGrip=function(Y){let F=v[Y];return F===void 0&&(F=new Uc,v[Y]=F),F.getGripSpace()},this.getHand=function(Y){let F=v[Y];return F===void 0&&(F=new Uc,v[Y]=F),F.getHandSpace()};function E(Y){let F=y.get(Y.inputSource);F&&F.dispatchEvent({type:Y.type,data:Y.inputSource})}function _(){y.forEach(function(Y,F){Y.disconnect(F)}),y.clear(),A=null,x=null,e.setRenderTarget(m),f=null,u=null,h=null,n=null,g=null,Q.stop(),r.isPresenting=!1,r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){s=Y,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){a=Y,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(Y){l=Y},this.getBaseLayer=function(){return u!==null?u:f},this.getBinding=function(){return h},this.getFrame=function(){return d},this.getSession=function(){return n},this.setSession=async function(Y){if(n=Y,n!==null){if(m=e.getRenderTarget(),n.addEventListener("select",E),n.addEventListener("selectstart",E),n.addEventListener("selectend",E),n.addEventListener("squeeze",E),n.addEventListener("squeezestart",E),n.addEventListener("squeezeend",E),n.addEventListener("end",_),n.addEventListener("inputsourceschange",C),p.xrCompatible!==!0&&await t.makeXRCompatible(),n.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let F={antialias:n.renderState.layers===void 0?p.antialias:!0,alpha:p.alpha,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(n,t,F),n.updateRenderState({baseLayer:f}),g=new mt(f.framebufferWidth,f.framebufferHeight,{format:Fn,type:qt,encoding:e.outputEncoding})}else{let F=null,z=null,O=null;p.depth&&(O=p.stencil?35056:33190,F=p.stencil?Ns:Eo,z=p.stencil?Ls:kc);let j={colorFormat:e.outputEncoding===je?35907:32856,depthFormat:O,scaleFactor:s};h=new XRWebGLBinding(n,t),u=h.createProjectionLayer(j),n.updateRenderState({layers:[u]}),g=new mt(u.textureWidth,u.textureHeight,{format:Fn,type:qt,depthTexture:new oi(u.textureWidth,u.textureHeight,z,void 0,void 0,void 0,void 0,void 0,void 0,F),stencilBuffer:p.stencil,encoding:e.outputEncoding,samples:p.antialias?4:0});let q=e.properties.get(g);q.__ignoreDepthValues=u.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(1),o=await n.requestReferenceSpace(a),Q.setContext(n),Q.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}};function C(Y){let F=n.inputSources;for(let z=0;z<F.length;z++){let O=F[z].handedness==="right"?1:0;y.set(F[z],v[O])}for(let z=0;z<Y.removed.length;z++){let O=Y.removed[z],j=y.get(O);j&&(j.dispatchEvent({type:"disconnected",data:O}),y.delete(O))}for(let z=0;z<Y.added.length;z++){let O=Y.added[z],j=y.get(O);j&&j.dispatchEvent({type:"connected",data:O})}}let I=new M,N=new M;function R(Y,F,z){I.setFromMatrixPosition(F.matrixWorld),N.setFromMatrixPosition(z.matrixWorld);let O=I.distanceTo(N),j=F.projectionMatrix.elements,q=z.projectionMatrix.elements,J=j[14]/(j[10]-1),W=j[14]/(j[10]+1),ge=(j[9]+1)/j[5],oe=(j[9]-1)/j[5],le=(j[8]-1)/j[0],H=(q[8]+1)/q[0],he=J*le,K=J*H,V=O/(-le+H),Z=V*-le;F.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(Z),Y.translateZ(V),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert();let ce=J+V,se=W+V,pe=he-Z,ve=K+(O-Z),me=ge*W/se*ce,Pe=oe*W/se*ce;Y.projectionMatrix.makePerspective(pe,ve,me,Pe,ce,se)}function k(Y,F){F===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(F.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(n===null)return;T.near=b.near=w.near=Y.near,T.far=b.far=w.far=Y.far,(A!==T.near||x!==T.far)&&(n.updateRenderState({depthNear:T.near,depthFar:T.far}),A=T.near,x=T.far);let F=Y.parent,z=T.cameras;k(T,F);for(let j=0;j<z.length;j++)k(z[j],F);T.matrixWorld.decompose(T.position,T.quaternion,T.scale),Y.position.copy(T.position),Y.quaternion.copy(T.quaternion),Y.scale.copy(T.scale),Y.matrix.copy(T.matrix),Y.matrixWorld.copy(T.matrixWorld);let O=Y.children;for(let j=0,q=O.length;j<q;j++)O[j].updateMatrixWorld(!0);z.length===2?R(T,w,b):T.projectionMatrix.copy(w.projectionMatrix)},this.getCamera=function(){return T},this.getFoveation=function(){if(u!==null)return u.fixedFoveation;if(f!==null)return f.fixedFoveation},this.setFoveation=function(Y){u!==null&&(u.fixedFoveation=Y),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=Y)};let G=null;function te(Y,F){if(c=F.getViewerPose(l||o),d=F,c!==null){let O=c.views;f!==null&&(e.setRenderTargetFramebuffer(g,f.framebuffer),e.setRenderTarget(g));let j=!1;O.length!==T.cameras.length&&(T.cameras.length=0,j=!0);for(let q=0;q<O.length;q++){let J=O[q],W=null;if(f!==null)W=f.getViewport(J);else{let oe=h.getViewSubImage(u,J);W=oe.viewport,q===0&&(e.setRenderTargetTextures(g,oe.colorTexture,u.ignoreDepthValues?void 0:oe.depthStencilTexture),e.setRenderTarget(g))}let ge=S[q];ge.matrix.fromArray(J.transform.matrix),ge.projectionMatrix.fromArray(J.projectionMatrix),ge.viewport.set(W.x,W.y,W.width,W.height),q===0&&T.matrix.copy(ge.matrix),j===!0&&T.cameras.push(ge)}}let z=n.inputSources;for(let O=0;O<v.length;O++){let j=z[O],q=y.get(j);q!==void 0&&q.update(j,F,l||o)}G&&G(Y,F),d=null}let Q=new bb;Q.setAnimationLoop(te),this.setAnimationLoop=function(Y){G=Y},this.dispose=function(){}}};function CL(i,e){function t(m,g){m.fogColor.value.copy(g.color),g.isFog?(m.fogNear.value=g.near,m.fogFar.value=g.far):g.isFogExp2&&(m.fogDensity.value=g.density)}function r(m,g,v,y,w){g.isMeshBasicMaterial||g.isMeshLambertMaterial?n(m,g):g.isMeshToonMaterial?(n(m,g),h(m,g)):g.isMeshPhongMaterial?(n(m,g),c(m,g)):g.isMeshStandardMaterial?(n(m,g),u(m,g),g.isMeshPhysicalMaterial&&f(m,g,w)):g.isMeshMatcapMaterial?(n(m,g),d(m,g)):g.isMeshDepthMaterial?n(m,g):g.isMeshDistanceMaterial?(n(m,g),p(m,g)):g.isMeshNormalMaterial?n(m,g):g.isLineBasicMaterial?(s(m,g),g.isLineDashedMaterial&&o(m,g)):g.isPointsMaterial?a(m,g,v,y):g.isSpriteMaterial?l(m,g):g.isShadowMaterial?(m.color.value.copy(g.color),m.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function n(m,g){m.opacity.value=g.opacity,g.color&&m.diffuse.value.copy(g.color),g.emissive&&m.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.bumpMap&&(m.bumpMap.value=g.bumpMap,m.bumpScale.value=g.bumpScale,g.side===Pr&&(m.bumpScale.value*=-1)),g.displacementMap&&(m.displacementMap.value=g.displacementMap,m.displacementScale.value=g.displacementScale,m.displacementBias.value=g.displacementBias),g.emissiveMap&&(m.emissiveMap.value=g.emissiveMap),g.normalMap&&(m.normalMap.value=g.normalMap,m.normalScale.value.copy(g.normalScale),g.side===Pr&&m.normalScale.value.negate()),g.specularMap&&(m.specularMap.value=g.specularMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let v=e.get(g).envMap;if(v&&(m.envMap.value=v,m.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=g.reflectivity,m.ior.value=g.ior,m.refractionRatio.value=g.refractionRatio),g.lightMap){m.lightMap.value=g.lightMap;let b=i.physicallyCorrectLights!==!0?Math.PI:1;m.lightMapIntensity.value=g.lightMapIntensity*b}g.aoMap&&(m.aoMap.value=g.aoMap,m.aoMapIntensity.value=g.aoMapIntensity);let y;g.map?y=g.map:g.specularMap?y=g.specularMap:g.displacementMap?y=g.displacementMap:g.normalMap?y=g.normalMap:g.bumpMap?y=g.bumpMap:g.roughnessMap?y=g.roughnessMap:g.metalnessMap?y=g.metalnessMap:g.alphaMap?y=g.alphaMap:g.emissiveMap?y=g.emissiveMap:g.clearcoatMap?y=g.clearcoatMap:g.clearcoatNormalMap?y=g.clearcoatNormalMap:g.clearcoatRoughnessMap?y=g.clearcoatRoughnessMap:g.specularIntensityMap?y=g.specularIntensityMap:g.specularColorMap?y=g.specularColorMap:g.transmissionMap?y=g.transmissionMap:g.thicknessMap?y=g.thicknessMap:g.sheenColorMap?y=g.sheenColorMap:g.sheenRoughnessMap&&(y=g.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),m.uvTransform.value.copy(y.matrix));let w;g.aoMap?w=g.aoMap:g.lightMap&&(w=g.lightMap),w!==void 0&&(w.isWebGLRenderTarget&&(w=w.texture),w.matrixAutoUpdate===!0&&w.updateMatrix(),m.uv2Transform.value.copy(w.matrix))}function s(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity}function o(m,g){m.dashSize.value=g.dashSize,m.totalSize.value=g.dashSize+g.gapSize,m.scale.value=g.scale}function a(m,g,v,y){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.size.value=g.size*v,m.scale.value=y*.5,g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let w;g.map?w=g.map:g.alphaMap&&(w=g.alphaMap),w!==void 0&&(w.matrixAutoUpdate===!0&&w.updateMatrix(),m.uvTransform.value.copy(w.matrix))}function l(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.rotation.value=g.rotation,g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let v;g.map?v=g.map:g.alphaMap&&(v=g.alphaMap),v!==void 0&&(v.matrixAutoUpdate===!0&&v.updateMatrix(),m.uvTransform.value.copy(v.matrix))}function c(m,g){m.specular.value.copy(g.specular),m.shininess.value=Math.max(g.shininess,1e-4)}function h(m,g){g.gradientMap&&(m.gradientMap.value=g.gradientMap)}function u(m,g){m.roughness.value=g.roughness,m.metalness.value=g.metalness,g.roughnessMap&&(m.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(m.metalnessMap.value=g.metalnessMap),e.get(g).envMap&&(m.envMapIntensity.value=g.envMapIntensity)}function f(m,g,v){m.ior.value=g.ior,g.sheen>0&&(m.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),m.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(m.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(m.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(m.clearcoat.value=g.clearcoat,m.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(m.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(m.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),m.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===Pr&&m.clearcoatNormalScale.value.negate())),g.transmission>0&&(m.transmission.value=g.transmission,m.transmissionSamplerMap.value=v.texture,m.transmissionSamplerSize.value.set(v.width,v.height),g.transmissionMap&&(m.transmissionMap.value=g.transmissionMap),m.thickness.value=g.thickness,g.thicknessMap&&(m.thicknessMap.value=g.thicknessMap),m.attenuationDistance.value=g.attenuationDistance,m.attenuationColor.value.copy(g.attenuationColor)),m.specularIntensity.value=g.specularIntensity,m.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(m.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(m.specularColorMap.value=g.specularColorMap)}function d(m,g){g.matcap&&(m.matcap.value=g.matcap)}function p(m,g){m.referencePosition.value.copy(g.referencePosition),m.nearDistance.value=g.nearDistance,m.farDistance.value=g.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:r}}function DL(){let i=jc("canvas");return i.style.display="block",i}function Pt(i={}){let e=i.canvas!==void 0?i.canvas:DL(),t=i.context!==void 0?i.context:null,r=i.depth!==void 0?i.depth:!0,n=i.stencil!==void 0?i.stencil:!0,s=i.antialias!==void 0?i.antialias:!1,o=i.premultipliedAlpha!==void 0?i.premultipliedAlpha:!0,a=i.preserveDrawingBuffer!==void 0?i.preserveDrawingBuffer:!1,l=i.powerPreference!==void 0?i.powerPreference:"default",c=i.failIfMajorPerformanceCaveat!==void 0?i.failIfMajorPerformanceCaveat:!1,h;t!==null?h=t.getContextAttributes().alpha:h=i.alpha!==void 0?i.alpha:!1;let u=null,f=null,d=[],p=[];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=gn,this.physicallyCorrectLights=!1,this.toneMapping=rs,this.toneMappingExposure=1;let m=this,g=!1,v=0,y=0,w=null,b=-1,S=null,T=new Je,A=new Je,x=null,E=e.width,_=e.height,C=1,I=null,N=null,R=new Je(0,0,E,_),k=new Je(0,0,E,_),G=!1,te=new Na,Q=!1,Y=!1,F=null,z=new Ae,O=new B,j=new M,q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function J(){return w===null?C:1}let W=t;function ge(P,X){for(let ne=0;ne<P.length;ne++){let ee=P[ne],fe=e.getContext(ee,X);if(fe!==null)return fe}return null}try{let P={alpha:!0,depth:r,stencil:n,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:a,powerPreference:l,failIfMajorPerformanceCaveat:c};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Uo}`),e.addEventListener("webglcontextlost",U,!1),e.addEventListener("webglcontextrestored",Me,!1),W===null){let X=["webgl2","webgl","experimental-webgl"];if(m.isWebGL1Renderer===!0&&X.shift(),W=ge(X,P),W===null)throw ge(X)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}W.getShaderPrecisionFormat===void 0&&(W.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(P){throw console.error("THREE.WebGLRenderer: "+P.message),P}let oe,le,H,he,K,V,Z,ce,se,pe,ve,me,Pe,ke,L,D,re,ye,Se,Ie,Fe,ue,rt;function st(){oe=new QD(W),le=new HD(W,oe,i),oe.init(le),ue=new EL(W,oe,le),H=new AL(W,oe,le),he=new ZD(W),K=new dL,V=new TL(W,oe,H,K,le,ue,he),Z=new jD(m),ce=new XD(m),se=new f_(W,le),rt=new kD(W,oe,se,le),pe=new JD(W,se,he,rt),ve=new rP(W,pe,se,he),Se=new tP(W,le,V),D=new WD(K),me=new fL(m,Z,ce,oe,le,rt,D),Pe=new CL(m,K),ke=new mL,L=new wL(oe,le),ye=new GD(m,Z,H,ve,h,o),re=new _b(m,ve,le),Ie=new VD(W,oe,he,le),Fe=new KD(W,oe,he,le),he.programs=me.programs,m.capabilities=le,m.extensions=oe,m.properties=K,m.renderLists=ke,m.shadowMap=re,m.state=H,m.info=he}st();let Ee=new pg(m,W);this.xr=Ee,this.getContext=function(){return W},this.getContextAttributes=function(){return W.getContextAttributes()},this.forceContextLoss=function(){let P=oe.get("WEBGL_lose_context");P&&P.loseContext()},this.forceContextRestore=function(){let P=oe.get("WEBGL_lose_context");P&&P.restoreContext()},this.getPixelRatio=function(){return C},this.setPixelRatio=function(P){P!==void 0&&(C=P,this.setSize(E,_,!1))},this.getSize=function(P){return P.set(E,_)},this.setSize=function(P,X,ne){if(Ee.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}E=P,_=X,e.width=Math.floor(P*C),e.height=Math.floor(X*C),ne!==!1&&(e.style.width=P+"px",e.style.height=X+"px"),this.setViewport(0,0,P,X)},this.getDrawingBufferSize=function(P){return P.set(E*C,_*C).floor()},this.setDrawingBufferSize=function(P,X,ne){E=P,_=X,C=ne,e.width=Math.floor(P*ne),e.height=Math.floor(X*ne),this.setViewport(0,0,P,X)},this.getCurrentViewport=function(P){return P.copy(T)},this.getViewport=function(P){return P.copy(R)},this.setViewport=function(P,X,ne,ee){P.isVector4?R.set(P.x,P.y,P.z,P.w):R.set(P,X,ne,ee),H.viewport(T.copy(R).multiplyScalar(C).floor())},this.getScissor=function(P){return P.copy(k)},this.setScissor=function(P,X,ne,ee){P.isVector4?k.set(P.x,P.y,P.z,P.w):k.set(P,X,ne,ee),H.scissor(A.copy(k).multiplyScalar(C).floor())},this.getScissorTest=function(){return G},this.setScissorTest=function(P){H.setScissorTest(G=P)},this.setOpaqueSort=function(P){I=P},this.setTransparentSort=function(P){N=P},this.getClearColor=function(P){return P.copy(ye.getClearColor())},this.setClearColor=function(){ye.setClearColor.apply(ye,arguments)},this.getClearAlpha=function(){return ye.getClearAlpha()},this.setClearAlpha=function(){ye.setClearAlpha.apply(ye,arguments)},this.clear=function(P=!0,X=!0,ne=!0){let ee=0;P&&(ee|=16384),X&&(ee|=256),ne&&(ee|=1024),W.clear(ee)},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",U,!1),e.removeEventListener("webglcontextrestored",Me,!1),ke.dispose(),L.dispose(),K.dispose(),Z.dispose(),ce.dispose(),ve.dispose(),rt.dispose(),me.dispose(),Ee.dispose(),Ee.removeEventListener("sessionstart",$e),Ee.removeEventListener("sessionend",lt),F&&(F.dispose(),F=null),dt.stop()};function U(P){P.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function Me(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;let P=he.autoReset,X=re.enabled,ne=re.autoUpdate,ee=re.needsUpdate,fe=re.type;st(),he.autoReset=P,re.enabled=X,re.autoUpdate=ne,re.needsUpdate=ee,re.type=fe}function De(P){let X=P.target;X.removeEventListener("dispose",De),Ze(X)}function Ze(P){Oe(P),K.remove(P)}function Oe(P){let X=K.get(P).programs;X!==void 0&&(X.forEach(function(ne){me.releaseProgram(ne)}),P.isShaderMaterial&&me.releaseShaderCache(P))}this.renderBufferDirect=function(P,X,ne,ee,fe,Ue){X===null&&(X=q);let He=fe.isMesh&&fe.matrixWorld.determinant()<0,nt=pt(P,X,ne,ee,fe);H.setMaterial(ee,He);let it=ne.index,Et=ne.attributes.position;if(it===null){if(Et===void 0||Et.count===0)return}else if(it.count===0)return;let St=1;ee.wireframe===!0&&(it=pe.getWireframeAttribute(ne),St=2),rt.setup(fe,ee,nt,ne,it);let _t,nr=Ie;it!==null&&(_t=se.get(it),nr=Fe,nr.setIndex(_t));let xo=it!==null?it.count:Et.count,sa=ne.drawRange.start*St,oa=ne.drawRange.count*St,wi=Ue!==null?Ue.start*St:0,Rt=Ue!==null?Ue.count*St:1/0,aa=Math.max(sa,wi),yr=Math.min(xo,sa+oa,wi+Rt)-1,Si=Math.max(0,yr-aa+1);if(Si!==0){if(fe.isMesh)ee.wireframe===!0?(H.setLineWidth(ee.wireframeLinewidth*J()),nr.setMode(1)):nr.setMode(4);else if(fe.isLine){let bs=ee.linewidth;bs===void 0&&(bs=1),H.setLineWidth(bs*J()),fe.isLineSegments?nr.setMode(1):fe.isLineLoop?nr.setMode(2):nr.setMode(3)}else fe.isPoints?nr.setMode(0):fe.isSprite&&nr.setMode(4);if(fe.isInstancedMesh)nr.renderInstances(aa,Si,fe.count);else if(ne.isInstancedBufferGeometry){let bs=Math.min(ne.instanceCount,ne._maxInstanceCount);nr.renderInstances(aa,Si,bs)}else nr.render(aa,Si)}},this.compile=function(P,X){f=L.get(P),f.init(),p.push(f),P.traverseVisible(function(ne){ne.isLight&&ne.layers.test(X.layers)&&(f.pushLight(ne),ne.castShadow&&f.pushShadow(ne))}),f.setupLights(m.physicallyCorrectLights),P.traverse(function(ne){let ee=ne.material;if(ee)if(Array.isArray(ee))for(let fe=0;fe<ee.length;fe++){let Ue=ee[fe];ut(Ue,P,ne)}else ut(ee,P,ne)}),p.pop(),f=null};let Qe=null;function Te(P){Qe&&Qe(P)}function $e(){dt.stop()}function lt(){dt.start()}let dt=new bb;dt.setAnimationLoop(Te),typeof self<"u"&&dt.setContext(self),this.setAnimationLoop=function(P){Qe=P,Ee.setAnimationLoop(P),P===null?dt.stop():dt.start()},Ee.addEventListener("sessionstart",$e),Ee.addEventListener("sessionend",lt),this.render=function(P,X){if(X!==void 0&&X.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(g===!0)return;P.autoUpdate===!0&&P.updateMatrixWorld(),X.parent===null&&X.updateMatrixWorld(),Ee.enabled===!0&&Ee.isPresenting===!0&&(Ee.cameraAutoUpdate===!0&&Ee.updateCamera(X),X=Ee.getCamera()),P.isScene===!0&&P.onBeforeRender(m,P,X,w),f=L.get(P,p.length),f.init(),p.push(f),z.multiplyMatrices(X.projectionMatrix,X.matrixWorldInverse),te.setFromProjectionMatrix(z),Y=this.localClippingEnabled,Q=D.init(this.clippingPlanes,Y,X),u=ke.get(P,d.length),u.init(),d.push(u),Ut(P,X,0,m.sortObjects),u.finish(),m.sortObjects===!0&&u.sort(I,N),Q===!0&&D.beginShadows();let ne=f.state.shadowsArray;if(re.render(ne,P,X),Q===!0&&D.endShadows(),this.info.autoReset===!0&&this.info.reset(),ye.render(u,P),f.setupLights(m.physicallyCorrectLights),X.isArrayCamera){let ee=X.cameras;for(let fe=0,Ue=ee.length;fe<Ue;fe++){let He=ee[fe];Ur(u,P,He,He.viewport)}}else Ur(u,P,X);w!==null&&(V.updateMultisampleRenderTarget(w),V.updateRenderTargetMipmap(w)),P.isScene===!0&&P.onAfterRender(m,P,X),rt.resetDefaultState(),b=-1,S=null,p.pop(),p.length>0?f=p[p.length-1]:f=null,d.pop(),d.length>0?u=d[d.length-1]:u=null};function Ut(P,X,ne,ee){if(P.visible===!1)return;if(P.layers.test(X.layers)){if(P.isGroup)ne=P.renderOrder;else if(P.isLOD)P.autoUpdate===!0&&P.update(X);else if(P.isLight)f.pushLight(P),P.castShadow&&f.pushShadow(P);else if(P.isSprite){if(!P.frustumCulled||te.intersectsSprite(P)){ee&&j.setFromMatrixPosition(P.matrixWorld).applyMatrix4(z);let He=ve.update(P),nt=P.material;nt.visible&&u.push(P,He,nt,ne,j.z,null)}}else if((P.isMesh||P.isLine||P.isPoints)&&(P.isSkinnedMesh&&P.skeleton.frame!==he.render.frame&&(P.skeleton.update(),P.skeleton.frame=he.render.frame),!P.frustumCulled||te.intersectsObject(P))){ee&&j.setFromMatrixPosition(P.matrixWorld).applyMatrix4(z);let He=ve.update(P),nt=P.material;if(Array.isArray(nt)){let it=He.groups;for(let Et=0,St=it.length;Et<St;Et++){let _t=it[Et],nr=nt[_t.materialIndex];nr&&nr.visible&&u.push(P,He,nr,ne,j.z,_t)}}else nt.visible&&u.push(P,He,nt,ne,j.z,null)}}let Ue=P.children;for(let He=0,nt=Ue.length;He<nt;He++)Ut(Ue[He],X,ne,ee)}function Ur(P,X,ne,ee){let fe=P.opaque,Ue=P.transmissive,He=P.transparent;f.setupLightsView(ne),Ue.length>0&&ia(fe,X,ne),ee&&H.viewport(T.copy(ee)),fe.length>0&&Nn(fe,X,ne),Ue.length>0&&Nn(Ue,X,ne),He.length>0&&Nn(He,X,ne),H.buffers.depth.setTest(!0),H.buffers.depth.setMask(!0),H.buffers.color.setMask(!0),H.setPolygonOffset(!1)}function ia(P,X,ne){let ee=le.isWebGL2;F===null&&(F=new mt(1,1,{generateMipmaps:!0,type:oe.has("EXT_color_buffer_half_float")?Vc:qt,minFilter:js,samples:ee&&s===!0?4:0})),m.getDrawingBufferSize(O),ee?F.setSize(O.x,O.y):F.setSize(mf(O.x),mf(O.y));let fe=m.getRenderTarget();m.setRenderTarget(F),m.clear();let Ue=m.toneMapping;m.toneMapping=rs,Nn(P,X,ne),m.toneMapping=Ue,V.updateMultisampleRenderTarget(F),V.updateRenderTargetMipmap(F),m.setRenderTarget(fe)}function Nn(P,X,ne){let ee=X.isScene===!0?X.overrideMaterial:null;for(let fe=0,Ue=P.length;fe<Ue;fe++){let He=P[fe],nt=He.object,it=He.geometry,Et=ee===null?He.material:ee,St=He.group;nt.layers.test(ne.layers)&&at(nt,X,ne,it,Et,St)}}function at(P,X,ne,ee,fe,Ue){P.onBeforeRender(m,X,ne,ee,fe,Ue),P.modelViewMatrix.multiplyMatrices(ne.matrixWorldInverse,P.matrixWorld),P.normalMatrix.getNormalMatrix(P.modelViewMatrix),fe.onBeforeRender(m,X,ne,ee,P,Ue),fe.transparent===!0&&fe.side===or?(fe.side=Pr,fe.needsUpdate=!0,m.renderBufferDirect(ne,X,ee,fe,P,Ue),fe.side=ii,fe.needsUpdate=!0,m.renderBufferDirect(ne,X,ee,fe,P,Ue),fe.side=or):m.renderBufferDirect(ne,X,ee,fe,P,Ue),P.onAfterRender(m,X,ne,ee,fe,Ue)}function ut(P,X,ne){X.isScene!==!0&&(X=q);let ee=K.get(P),fe=f.state.lights,Ue=f.state.shadowsArray,He=fe.state.version,nt=me.getParameters(P,fe.state,Ue,X,ne),it=me.getProgramCacheKey(nt),Et=ee.programs;ee.environment=P.isMeshStandardMaterial?X.environment:null,ee.fog=X.fog,ee.envMap=(P.isMeshStandardMaterial?ce:Z).get(P.envMap||ee.environment),Et===void 0&&(P.addEventListener("dispose",De),Et=new Map,ee.programs=Et);let St=Et.get(it);if(St!==void 0){if(ee.currentProgram===St&&ee.lightsStateVersion===He)return ft(P,nt),St}else nt.uniforms=me.getUniforms(P),P.onBuild(ne,nt,m),P.onBeforeCompile(nt,m),St=me.acquireProgram(nt,it),Et.set(it,St),ee.uniforms=nt.uniforms;let _t=ee.uniforms;(!P.isShaderMaterial&&!P.isRawShaderMaterial||P.clipping===!0)&&(_t.clippingPlanes=D.uniform),ft(P,nt),ee.needsLights=It(P),ee.lightsStateVersion=He,ee.needsLights&&(_t.ambientLightColor.value=fe.state.ambient,_t.lightProbe.value=fe.state.probe,_t.directionalLights.value=fe.state.directional,_t.directionalLightShadows.value=fe.state.directionalShadow,_t.spotLights.value=fe.state.spot,_t.spotLightShadows.value=fe.state.spotShadow,_t.rectAreaLights.value=fe.state.rectArea,_t.ltc_1.value=fe.state.rectAreaLTC1,_t.ltc_2.value=fe.state.rectAreaLTC2,_t.pointLights.value=fe.state.point,_t.pointLightShadows.value=fe.state.pointShadow,_t.hemisphereLights.value=fe.state.hemi,_t.directionalShadowMap.value=fe.state.directionalShadowMap,_t.directionalShadowMatrix.value=fe.state.directionalShadowMatrix,_t.spotShadowMap.value=fe.state.spotShadowMap,_t.spotShadowMatrix.value=fe.state.spotShadowMatrix,_t.pointShadowMap.value=fe.state.pointShadowMap,_t.pointShadowMatrix.value=fe.state.pointShadowMatrix);let nr=St.getUniforms(),xo=Is.seqWithValue(nr.seq,_t);return ee.currentProgram=St,ee.uniformsList=xo,St}function ft(P,X){let ne=K.get(P);ne.outputEncoding=X.outputEncoding,ne.instancing=X.instancing,ne.skinning=X.skinning,ne.morphTargets=X.morphTargets,ne.morphNormals=X.morphNormals,ne.morphColors=X.morphColors,ne.morphTargetsCount=X.morphTargetsCount,ne.numClippingPlanes=X.numClippingPlanes,ne.numIntersection=X.numClipIntersection,ne.vertexAlphas=X.vertexAlphas,ne.vertexTangents=X.vertexTangents,ne.toneMapping=X.toneMapping}function pt(P,X,ne,ee,fe){X.isScene!==!0&&(X=q),V.resetTextureUnits();let Ue=X.fog,He=ee.isMeshStandardMaterial?X.environment:null,nt=w===null?m.outputEncoding:w.isXRRenderTarget===!0?w.texture.encoding:gn,it=(ee.isMeshStandardMaterial?ce:Z).get(ee.envMap||He),Et=ee.vertexColors===!0&&!!ne.attributes.color&&ne.attributes.color.itemSize===4,St=!!ee.normalMap&&!!ne.attributes.tangent,_t=!!ne.morphAttributes.position,nr=!!ne.morphAttributes.normal,xo=!!ne.morphAttributes.color,sa=ee.toneMapped?m.toneMapping:rs,oa=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,wi=oa!==void 0?oa.length:0,Rt=K.get(ee),aa=f.state.lights;if(Q===!0&&(Y===!0||P!==S)){let Mi=P===S&&ee.id===b;D.setState(ee,P,Mi)}let yr=!1;ee.version===Rt.__version?(Rt.needsLights&&Rt.lightsStateVersion!==aa.state.version||Rt.outputEncoding!==nt||fe.isInstancedMesh&&Rt.instancing===!1||!fe.isInstancedMesh&&Rt.instancing===!0||fe.isSkinnedMesh&&Rt.skinning===!1||!fe.isSkinnedMesh&&Rt.skinning===!0||Rt.envMap!==it||ee.fog===!0&&Rt.fog!==Ue||Rt.numClippingPlanes!==void 0&&(Rt.numClippingPlanes!==D.numPlanes||Rt.numIntersection!==D.numIntersection)||Rt.vertexAlphas!==Et||Rt.vertexTangents!==St||Rt.morphTargets!==_t||Rt.morphNormals!==nr||Rt.morphColors!==xo||Rt.toneMapping!==sa||le.isWebGL2===!0&&Rt.morphTargetsCount!==wi)&&(yr=!0):(yr=!0,Rt.__version=ee.version);let Si=Rt.currentProgram;yr===!0&&(Si=ut(ee,X,fe));let bs=!1,Ac=!1,pm=!1,en=Si.getUniforms(),Tc=Rt.uniforms;if(H.useProgram(Si.program)&&(bs=!0,Ac=!0,pm=!0),ee.id!==b&&(b=ee.id,Ac=!0),bs||S!==P){if(en.setValue(W,"projectionMatrix",P.projectionMatrix),le.logarithmicDepthBuffer&&en.setValue(W,"logDepthBufFC",2/(Math.log(P.far+1)/Math.LN2)),S!==P&&(S=P,Ac=!0,pm=!0),ee.isShaderMaterial||ee.isMeshPhongMaterial||ee.isMeshToonMaterial||ee.isMeshStandardMaterial||ee.envMap){let Mi=en.map.cameraPosition;Mi!==void 0&&Mi.setValue(W,j.setFromMatrixPosition(P.matrixWorld))}(ee.isMeshPhongMaterial||ee.isMeshToonMaterial||ee.isMeshLambertMaterial||ee.isMeshBasicMaterial||ee.isMeshStandardMaterial||ee.isShaderMaterial)&&en.setValue(W,"isOrthographic",P.isOrthographicCamera===!0),(ee.isMeshPhongMaterial||ee.isMeshToonMaterial||ee.isMeshLambertMaterial||ee.isMeshBasicMaterial||ee.isMeshStandardMaterial||ee.isShaderMaterial||ee.isShadowMaterial||fe.isSkinnedMesh)&&en.setValue(W,"viewMatrix",P.matrixWorldInverse)}if(fe.isSkinnedMesh){en.setOptional(W,fe,"bindMatrix"),en.setOptional(W,fe,"bindMatrixInverse");let Mi=fe.skeleton;Mi&&(le.floatVertexTextures?(Mi.boneTexture===null&&Mi.computeBoneTexture(),en.setValue(W,"boneTexture",Mi.boneTexture,V),en.setValue(W,"boneTextureSize",Mi.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}let mm=ne.morphAttributes;return(mm.position!==void 0||mm.normal!==void 0||mm.color!==void 0&&le.isWebGL2===!0)&&Se.update(fe,ne,ee,Si),(Ac||Rt.receiveShadow!==fe.receiveShadow)&&(Rt.receiveShadow=fe.receiveShadow,en.setValue(W,"receiveShadow",fe.receiveShadow)),Ac&&(en.setValue(W,"toneMappingExposure",m.toneMappingExposure),Rt.needsLights&&xt(Tc,pm),Ue&&ee.fog===!0&&Pe.refreshFogUniforms(Tc,Ue),Pe.refreshMaterialUniforms(Tc,ee,C,_,F),Is.upload(W,Rt.uniformsList,Tc,V)),ee.isShaderMaterial&&ee.uniformsNeedUpdate===!0&&(Is.upload(W,Rt.uniformsList,Tc,V),ee.uniformsNeedUpdate=!1),ee.isSpriteMaterial&&en.setValue(W,"center",fe.center),en.setValue(W,"modelViewMatrix",fe.modelViewMatrix),en.setValue(W,"normalMatrix",fe.normalMatrix),en.setValue(W,"modelMatrix",fe.matrixWorld),Si}function xt(P,X){P.ambientLightColor.needsUpdate=X,P.lightProbe.needsUpdate=X,P.directionalLights.needsUpdate=X,P.directionalLightShadows.needsUpdate=X,P.pointLights.needsUpdate=X,P.pointLightShadows.needsUpdate=X,P.spotLights.needsUpdate=X,P.spotLightShadows.needsUpdate=X,P.rectAreaLights.needsUpdate=X,P.hemisphereLights.needsUpdate=X}function It(P){return P.isMeshLambertMaterial||P.isMeshToonMaterial||P.isMeshPhongMaterial||P.isMeshStandardMaterial||P.isShadowMaterial||P.isShaderMaterial&&P.lights===!0}this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(P,X,ne){K.get(P.texture).__webglTexture=X,K.get(P.depthTexture).__webglTexture=ne;let ee=K.get(P);ee.__hasExternalTextures=!0,ee.__hasExternalTextures&&(ee.__autoAllocateDepthBuffer=ne===void 0,ee.__autoAllocateDepthBuffer||oe.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ee.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(P,X){let ne=K.get(P);ne.__webglFramebuffer=X,ne.__useDefaultFramebuffer=X===void 0},this.setRenderTarget=function(P,X=0,ne=0){w=P,v=X,y=ne;let ee=!0;if(P){let it=K.get(P);it.__useDefaultFramebuffer!==void 0?(H.bindFramebuffer(36160,null),ee=!1):it.__webglFramebuffer===void 0?V.setupRenderTarget(P):it.__hasExternalTextures&&V.rebindTextures(P,K.get(P.texture).__webglTexture,K.get(P.depthTexture).__webglTexture)}let fe=null,Ue=!1,He=!1;if(P){let it=P.texture;(it.isData3DTexture||it.isDataArrayTexture)&&(He=!0);let Et=K.get(P).__webglFramebuffer;P.isWebGLCubeRenderTarget?(fe=Et[X],Ue=!0):le.isWebGL2&&P.samples>0&&V.useMultisampledRTT(P)===!1?fe=K.get(P).__webglMultisampledFramebuffer:fe=Et,T.copy(P.viewport),A.copy(P.scissor),x=P.scissorTest}else T.copy(R).multiplyScalar(C).floor(),A.copy(k).multiplyScalar(C).floor(),x=G;if(H.bindFramebuffer(36160,fe)&&le.drawBuffers&&ee&&H.drawBuffers(P,fe),H.viewport(T),H.scissor(A),H.setScissorTest(x),Ue){let it=K.get(P.texture);W.framebufferTexture2D(36160,36064,34069+X,it.__webglTexture,ne)}else if(He){let it=K.get(P.texture),Et=X||0;W.framebufferTextureLayer(36160,36064,it.__webglTexture,ne||0,Et)}b=-1},this.readRenderTargetPixels=function(P,X,ne,ee,fe,Ue,He){if(!(P&&P.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let nt=K.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&He!==void 0&&(nt=nt[He]),nt){H.bindFramebuffer(36160,nt);try{let it=P.texture,Et=it.format,St=it.type;if(Et!==Fn&&ue.convert(Et)!==W.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let _t=St===Vc&&(oe.has("EXT_color_buffer_half_float")||le.isWebGL2&&oe.has("EXT_color_buffer_float"));if(St!==qt&&ue.convert(St)!==W.getParameter(35738)&&!(St===Ds&&(le.isWebGL2||oe.has("OES_texture_float")||oe.has("WEBGL_color_buffer_float")))&&!_t){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}X>=0&&X<=P.width-ee&&ne>=0&&ne<=P.height-fe&&W.readPixels(X,ne,ee,fe,ue.convert(Et),ue.convert(St),Ue)}finally{let it=w!==null?K.get(w).__webglFramebuffer:null;H.bindFramebuffer(36160,it)}}},this.copyFramebufferToTexture=function(P,X,ne=0){if(X.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}let ee=Math.pow(2,-ne),fe=Math.floor(X.image.width*ee),Ue=Math.floor(X.image.height*ee);V.setTexture2D(X,0),W.copyTexSubImage2D(3553,ne,0,0,P.x,P.y,fe,Ue),H.unbindTexture()},this.copyTextureToTexture=function(P,X,ne,ee=0){let fe=X.image.width,Ue=X.image.height,He=ue.convert(ne.format),nt=ue.convert(ne.type);V.setTexture2D(ne,0),W.pixelStorei(37440,ne.flipY),W.pixelStorei(37441,ne.premultiplyAlpha),W.pixelStorei(3317,ne.unpackAlignment),X.isDataTexture?W.texSubImage2D(3553,ee,P.x,P.y,fe,Ue,He,nt,X.image.data):X.isCompressedTexture?W.compressedTexSubImage2D(3553,ee,P.x,P.y,X.mipmaps[0].width,X.mipmaps[0].height,He,X.mipmaps[0].data):W.texSubImage2D(3553,ee,P.x,P.y,He,nt,X.image),ee===0&&ne.generateMipmaps&&W.generateMipmap(3553),H.unbindTexture()},this.copyTextureToTexture3D=function(P,X,ne,ee,fe=0){if(m.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Ue=P.max.x-P.min.x+1,He=P.max.y-P.min.y+1,nt=P.max.z-P.min.z+1,it=ue.convert(ee.format),Et=ue.convert(ee.type),St;if(ee.isData3DTexture)V.setTexture3D(ee,0),St=32879;else if(ee.isDataArrayTexture)V.setTexture2DArray(ee,0),St=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}W.pixelStorei(37440,ee.flipY),W.pixelStorei(37441,ee.premultiplyAlpha),W.pixelStorei(3317,ee.unpackAlignment);let _t=W.getParameter(3314),nr=W.getParameter(32878),xo=W.getParameter(3316),sa=W.getParameter(3315),oa=W.getParameter(32877),wi=ne.isCompressedTexture?ne.mipmaps[0]:ne.image;W.pixelStorei(3314,wi.width),W.pixelStorei(32878,wi.height),W.pixelStorei(3316,P.min.x),W.pixelStorei(3315,P.min.y),W.pixelStorei(32877,P.min.z),ne.isDataTexture||ne.isData3DTexture?W.texSubImage3D(St,fe,X.x,X.y,X.z,Ue,He,nt,it,Et,wi.data):ne.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),W.compressedTexSubImage3D(St,fe,X.x,X.y,X.z,Ue,He,nt,it,wi.data)):W.texSubImage3D(St,fe,X.x,X.y,X.z,Ue,He,nt,it,Et,wi),W.pixelStorei(3314,_t),W.pixelStorei(32878,nr),W.pixelStorei(3316,xo),W.pixelStorei(3315,sa),W.pixelStorei(32877,oa),fe===0&&ee.generateMipmaps&&W.generateMipmap(St),H.unbindTexture()},this.initTexture=function(P){V.setTexture2D(P,0),H.unbindTexture()},this.resetState=function(){v=0,y=0,w=null,H.reset(),rt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Pt.prototype.isWebGLRenderer=!0;var mg=class extends Pt{};mg.prototype.isWebGL1Renderer=!0;var Kc=class{constructor(e,t=25e-5){this.name="",this.color=new be(e),this.density=t}clone(){return new Kc(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}};Kc.prototype.isFogExp2=!0;var Do=class{constructor(e,t=1,r=1e3){this.name="",this.color=new be(e),this.near=t,this.far=r}clone(){return new Do(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}};Do.prototype.isFog=!0;var on=class extends ot{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}};on.prototype.isScene=!0;var ss=class{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Hc,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Un()}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,r){e*=this.stride,r*=t.stride;for(let n=0,s=this.stride;n<s;n++)this.array[e+n]=t.array[r+n];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=Un()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(t,this.stride);return r.setUsage(this.usage),r}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=Un()),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}}};ss.prototype.isInterleavedBuffer=!0;var tn=new M,_i=class{constructor(e,t,r,n=!1){this.name="",this.data=e,this.itemSize=t,this.offset=r,this.normalized=n===!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,r=this.data.count;t<r;t++)tn.fromBufferAttribute(this,t),tn.applyMatrix4(e),this.setXYZ(t,tn.x,tn.y,tn.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)tn.fromBufferAttribute(this,t),tn.applyNormalMatrix(e),this.setXYZ(t,tn.x,tn.y,tn.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)tn.fromBufferAttribute(this,t),tn.transformDirection(e),this.setXYZ(t,tn.x,tn.y,tn.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,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this}setXYZ(e,t,r,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this}setXYZW(e,t,r,n,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,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.");let t=[];for(let r=0;r<this.count;r++){let n=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+s])}return new Ve(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 _i(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.");let t=[];for(let r=0;r<this.count;r++){let n=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+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}}};_i.prototype.isInterleavedBufferAttribute=!0;var Zc=class extends ur{constructor(e){super(),this.type="SpriteMaterial",this.color=new be(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}};Zc.prototype.isSpriteMaterial=!0;var Sa,Dc=new M,Ma=new M,Aa=new M,Ta=new B,Pc=new B,Cb=new Ae,Xu=new M,Lc=new M,Qu=new M,N0=new B,Xm=new B,O0=new B,gg=class extends ot{constructor(e){if(super(),this.type="Sprite",Sa===void 0){Sa=new Le;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new ss(t,5);Sa.setIndex([0,1,2,0,2,3]),Sa.setAttribute("position",new _i(r,3,0,!1)),Sa.setAttribute("uv",new _i(r,2,3,!1))}this.geometry=Sa,this.material=e!==void 0?e:new Zc,this.center=new B(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ma.setFromMatrixScale(this.matrixWorld),Cb.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Aa.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Ma.multiplyScalar(-Aa.z);let r=this.material.rotation,n,s;r!==0&&(s=Math.cos(r),n=Math.sin(r));let o=this.center;Ju(Xu.set(-.5,-.5,0),Aa,o,Ma,n,s),Ju(Lc.set(.5,-.5,0),Aa,o,Ma,n,s),Ju(Qu.set(.5,.5,0),Aa,o,Ma,n,s),N0.set(0,0),Xm.set(1,0),O0.set(1,1);let a=e.ray.intersectTriangle(Xu,Lc,Qu,!1,Dc);if(a===null&&(Ju(Lc.set(-.5,.5,0),Aa,o,Ma,n,s),Xm.set(0,1),a=e.ray.intersectTriangle(Xu,Qu,Lc,!1,Dc),a===null))return;let l=e.ray.origin.distanceTo(Dc);l<e.near||l>e.far||t.push({distance:l,point:Dc.clone(),uv:Jt.getUV(Dc,Xu,Lc,Qu,N0,Xm,O0,new B),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};gg.prototype.isSprite=!0;function Ju(i,e,t,r,n,s){Ta.subVectors(i,t).addScalar(.5).multiply(r),n!==void 0?(Pc.x=s*Ta.x-n*Ta.y,Pc.y=n*Ta.x+s*Ta.y):Pc.copy(Ta),i.copy(e),i.x+=Pc.x,i.y+=Pc.y,i.applyMatrix4(Cb)}var F0=new M,U0=new Je,z0=new Je,PL=new M,G0=new Ae,wf=class extends Vt{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Ae,this.bindMatrixInverse=new Ae}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(){let e=new Je,t=this.geometry.attributes.skinWeight;for(let r=0,n=t.count;r<n;r++){e.fromBufferAttribute(t,r);let s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(r,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){let r=this.skeleton,n=this.geometry;U0.fromBufferAttribute(n.attributes.skinIndex,e),z0.fromBufferAttribute(n.attributes.skinWeight,e),F0.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){let o=z0.getComponent(s);if(o!==0){let a=U0.getComponent(s);G0.multiplyMatrices(r.bones[a].matrixWorld,r.boneInverses[a]),t.addScaledVector(PL.copy(F0).applyMatrix4(G0),o)}}return t.applyMatrix4(this.bindMatrixInverse)}};wf.prototype.isSkinnedMesh=!0;var yg=class extends ot{constructor(){super(),this.type="Bone"}};yg.prototype.isBone=!0;var Sf=class extends Dt{constructor(e=null,t=1,r=1,n,s,o,a,l,c=hr,h=hr,u,f){super(null,o,a,l,c,h,n,s,u,f),this.image={data:e,width:t,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};Sf.prototype.isDataTexture=!0;var Oa=class extends Ve{constructor(e,t,r,n=1){typeof r=="number"&&(n=r,r=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,r),this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};Oa.prototype.isInstancedBufferAttribute=!0;var k0=new Ae,V0=new Ae,Ku=[],Ic=new Vt,vg=class extends Vt{constructor(e,t,r){super(e,t),this.instanceMatrix=new Oa(new Float32Array(r*16),16),this.instanceColor=null,this.count=r,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){let r=this.matrixWorld,n=this.count;if(Ic.geometry=this.geometry,Ic.material=this.material,Ic.material!==void 0)for(let s=0;s<n;s++){this.getMatrixAt(s,k0),V0.multiplyMatrices(r,k0),Ic.matrixWorld=V0,Ic.raycast(e,Ku);for(let o=0,a=Ku.length;o<a;o++){let l=Ku[o];l.instanceId=s,l.object=this,t.push(l)}Ku.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Oa(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"})}};vg.prototype.isInstancedMesh=!0;var kr=class extends ur{constructor(e){super(),this.type="LineBasicMaterial",this.color=new be(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}};kr.prototype.isLineBasicMaterial=!0;var H0=new M,W0=new M,j0=new Ae,Qm=new si,Zu=new Lr,os=class extends ot{constructor(e=new Le,t=new kr){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(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,r=[0];for(let n=1,s=t.count;n<s;n++)H0.fromBufferAttribute(t,n-1),W0.fromBufferAttribute(t,n),r[n]=r[n-1],r[n]+=H0.distanceTo(W0);e.setAttribute("lineDistance",new Ce(r,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){let r=this.geometry,n=this.matrixWorld,s=e.params.Line.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),Zu.copy(r.boundingSphere),Zu.applyMatrix4(n),Zu.radius+=s,e.ray.intersectsSphere(Zu)===!1)return;j0.copy(n).invert(),Qm.copy(e.ray).applyMatrix4(j0);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new M,h=new M,u=new M,f=new M,d=this.isLineSegments?2:1;if(r.isBufferGeometry){let p=r.index,g=r.attributes.position;if(p!==null){let v=Math.max(0,o.start),y=Math.min(p.count,o.start+o.count);for(let w=v,b=y-1;w<b;w+=d){let S=p.getX(w),T=p.getX(w+1);if(c.fromBufferAttribute(g,S),h.fromBufferAttribute(g,T),Qm.distanceSqToSegment(c,h,f,u)>l)continue;f.applyMatrix4(this.matrixWorld);let x=e.ray.origin.distanceTo(f);x<e.near||x>e.far||t.push({distance:x,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}else{let v=Math.max(0,o.start),y=Math.min(g.count,o.start+o.count);for(let w=v,b=y-1;w<b;w+=d){if(c.fromBufferAttribute(g,w),h.fromBufferAttribute(g,w+1),Qm.distanceSqToSegment(c,h,f,u)>l)continue;f.applyMatrix4(this.matrixWorld);let T=e.ray.origin.distanceTo(f);T<e.near||T>e.far||t.push({distance:T,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}else r.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,r=Object.keys(t);if(r.length>0){let n=t[r[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=n.length;s<o;s++){let a=n[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};os.prototype.isLine=!0;var q0=new M,Y0=new M,ai=class extends os{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,r=[];for(let n=0,s=t.count;n<s;n+=2)q0.fromBufferAttribute(t,n),Y0.fromBufferAttribute(t,n+1),r[n]=n===0?0:r[n-1],r[n+1]=r[n]+q0.distanceTo(Y0);e.setAttribute("lineDistance",new Ce(r,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}};ai.prototype.isLineSegments=!0;var xg=class extends os{constructor(e,t){super(e,t),this.type="LineLoop"}};xg.prototype.isLineLoop=!0;var $c=class extends ur{constructor(e){super(),this.type="PointsMaterial",this.color=new be(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}};$c.prototype.isPointsMaterial=!0;var X0=new Ae,bg=new si,$u=new Lr,ef=new M,wg=class extends ot{constructor(e=new Le,t=new $c){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){let r=this.geometry,n=this.matrixWorld,s=e.params.Points.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),$u.copy(r.boundingSphere),$u.applyMatrix4(n),$u.radius+=s,e.ray.intersectsSphere($u)===!1)return;X0.copy(n).invert(),bg.copy(e.ray).applyMatrix4(X0);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a;if(r.isBufferGeometry){let c=r.index,u=r.attributes.position;if(c!==null){let f=Math.max(0,o.start),d=Math.min(c.count,o.start+o.count);for(let p=f,m=d;p<m;p++){let g=c.getX(p);ef.fromBufferAttribute(u,g),Q0(ef,g,l,n,e,t,this)}}else{let f=Math.max(0,o.start),d=Math.min(u.count,o.start+o.count);for(let p=f,m=d;p<m;p++)ef.fromBufferAttribute(u,p),Q0(ef,p,l,n,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,r=Object.keys(t);if(r.length>0){let n=t[r[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=n.length;s<o;s++){let a=n[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};wg.prototype.isPoints=!0;function Q0(i,e,t,r,n,s,o){let a=bg.distanceSqToPoint(i);if(a<t){let l=new M;bg.closestPointToPoint(i,l),l.applyMatrix4(r);let c=n.ray.origin.distanceTo(l);if(c<n.near||c>n.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}var eh=class extends Dt{constructor(e,t,r,n,s,o,a,l,c){super(e,t,r,n,s,o,a,l,c),this.minFilter=o!==void 0?o:ct,this.magFilter=s!==void 0?s:ct,this.generateMipmaps=!1;let h=this;function u(){h.needsUpdate=!0,e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(u)}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}};eh.prototype.isVideoTexture=!0;var Sg=class extends Dt{constructor(e,t,r){super({width:e,height:t}),this.format=r,this.magFilter=hr,this.minFilter=hr,this.generateMipmaps=!1,this.needsUpdate=!0}};Sg.prototype.isFramebufferTexture=!0;var Mg=class extends Dt{constructor(e,t,r,n,s,o,a,l,c,h,u,f){super(null,o,a,l,c,h,n,s,u,f),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};Mg.prototype.isCompressedTexture=!0;var Ag=class extends Dt{constructor(e,t,r,n,s,o,a,l,c){super(e,t,r,n,s,o,a,l,c),this.needsUpdate=!0}};Ag.prototype.isCanvasTexture=!0;var xn=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){let 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;let t=[],r,n=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(n),t.push(s),n=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let r=this.getLengths(),n=0,s=r.length,o;t?o=t:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),c=r[n]-o,c<0)a=n+1;else if(c>0)l=n-1;else{l=n;break}if(n=l,r[n]===o)return n/(s-1);let h=r[n],f=r[n+1]-h,d=(o-h)/f;return(n+d)/(s-1)}getTangent(e,t){let n=e-1e-4,s=e+1e-4;n<0&&(n=0),s>1&&(s=1);let o=this.getPoint(n),a=this.getPoint(s),l=t||(o.isVector2?new B:new M);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){let r=new M,n=[],s=[],o=[],a=new M,l=new Ae;for(let d=0;d<=e;d++){let p=d/e;n[d]=this.getTangentAt(p,new M)}s[0]=new M,o[0]=new M;let c=Number.MAX_VALUE,h=Math.abs(n[0].x),u=Math.abs(n[0].y),f=Math.abs(n[0].z);h<=c&&(c=h,r.set(1,0,0)),u<=c&&(c=u,r.set(0,1,0)),f<=c&&r.set(0,0,1),a.crossVectors(n[0],r).normalize(),s[0].crossVectors(n[0],a),o[0].crossVectors(n[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(n[d-1],n[d]),a.length()>Number.EPSILON){a.normalize();let p=Math.acos(xr(n[d-1].dot(n[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(a,p))}o[d].crossVectors(n[d],s[d])}if(t===!0){let d=Math.acos(xr(s[0].dot(s[e]),-1,1));d/=e,n[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(n[p],d*p)),o[p].crossVectors(n[p],s[p])}return{tangents:n,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let 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}},Us=class extends xn{constructor(e=0,t=0,r=1,n=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=n,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){let r=t||new B,n=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=n;for(;s>n;)s-=n;s<Number.EPSILON&&(o?s=0:s=n),this.aClockwise===!0&&!o&&(s===n?s=-n:s=s-n);let a=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),f=l-this.aX,d=c-this.aY;l=f*h-d*u+this.aX,c=f*u+d*h+this.aY}return r.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(){let 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}};Us.prototype.isEllipseCurve=!0;var Mf=class extends Us{constructor(e,t,r,n,s,o){super(e,t,r,r,n,s,o),this.type="ArcCurve"}};Mf.prototype.isArcCurve=!0;function ry(){let i=0,e=0,t=0,r=0;function n(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,r=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){n(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,h,u){let f=(o-s)/c-(a-s)/(c+h)+(a-o)/h,d=(a-o)/h-(l-o)/(h+u)+(l-a)/u;f*=h,d*=h,n(o,a,f,d)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+r*a}}}var tf=new M,Jm=new ry,Km=new ry,Zm=new ry,Af=class extends xn{constructor(e=[],t=!1,r="centripetal",n=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=n}getPoint(e,t=new M){let r=t,n=this.points,s=n.length,o=(s-(this.closed?0:1))*e,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,h;this.closed||a>0?c=n[(a-1)%s]:(tf.subVectors(n[0],n[1]).add(n[0]),c=tf);let u=n[a%s],f=n[(a+1)%s];if(this.closed||a+2<s?h=n[(a+2)%s]:(tf.subVectors(n[s-1],n[s-2]).add(n[s-1]),h=tf),this.curveType==="centripetal"||this.curveType==="chordal"){let d=this.curveType==="chordal"?.5:.25,p=Math.pow(c.distanceToSquared(u),d),m=Math.pow(u.distanceToSquared(f),d),g=Math.pow(f.distanceToSquared(h),d);m<1e-4&&(m=1),p<1e-4&&(p=m),g<1e-4&&(g=m),Jm.initNonuniformCatmullRom(c.x,u.x,f.x,h.x,p,m,g),Km.initNonuniformCatmullRom(c.y,u.y,f.y,h.y,p,m,g),Zm.initNonuniformCatmullRom(c.z,u.z,f.z,h.z,p,m,g)}else this.curveType==="catmullrom"&&(Jm.initCatmullRom(c.x,u.x,f.x,h.x,this.tension),Km.initCatmullRom(c.y,u.y,f.y,h.y,this.tension),Zm.initCatmullRom(c.z,u.z,f.z,h.z,this.tension));return r.set(Jm.calc(l),Km.calc(l),Zm.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let n=this.points[t];e.points.push(n.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,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(new M().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};Af.prototype.isCatmullRomCurve3=!0;function J0(i,e,t,r,n){let s=(r-e)*.5,o=(n-t)*.5,a=i*i,l=i*a;return(2*t-2*r+s+o)*l+(-3*t+3*r-2*s-o)*a+s*i+t}function LL(i,e){let t=1-i;return t*t*e}function IL(i,e){return 2*(1-i)*i*e}function RL(i,e){return i*i*e}function zc(i,e,t,r){return LL(i,e)+IL(i,t)+RL(i,r)}function BL(i,e){let t=1-i;return t*t*t*e}function NL(i,e){let t=1-i;return 3*t*t*i*e}function OL(i,e){return 3*(1-i)*i*i*e}function FL(i,e){return i*i*i*e}function Gc(i,e,t,r,n){return BL(i,e)+NL(i,t)+OL(i,r)+FL(i,n)}var an=class extends xn{constructor(e=new B,t=new B,r=new B,n=new B){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new B){let r=t,n=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Gc(e,n.x,s.x,o.x,a.x),Gc(e,n.y,s.y,o.y,a.y)),r}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(){let 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}};an.prototype.isCubicBezierCurve=!0;var Tf=class extends xn{constructor(e=new M,t=new M,r=new M,n=new M){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new M){let r=t,n=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Gc(e,n.x,s.x,o.x,a.x),Gc(e,n.y,s.y,o.y,a.y),Gc(e,n.z,s.z,o.z,a.z)),r}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(){let 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}};Tf.prototype.isCubicBezierCurve3=!0;var ln=class extends xn{constructor(e=new B,t=new B){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new B){let r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){let r=t||new B;return r.copy(this.v2).sub(this.v1).normalize(),r}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}};ln.prototype.isLineCurve=!0;var th=class extends xn{constructor(e=new M,t=new M){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new M){let r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}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(){let 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}},kn=class extends xn{constructor(e=new B,t=new B,r=new B){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new B){let r=t,n=this.v0,s=this.v1,o=this.v2;return r.set(zc(e,n.x,s.x,o.x),zc(e,n.y,s.y,o.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}};kn.prototype.isQuadraticBezierCurve=!0;var Ef=class extends xn{constructor(e=new M,t=new M,r=new M){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new M){let r=t,n=this.v0,s=this.v1,o=this.v2;return r.set(zc(e,n.x,s.x,o.x),zc(e,n.y,s.y,o.y),zc(e,n.z,s.z,o.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}};Ef.prototype.isQuadraticBezierCurve3=!0;var Po=class extends xn{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new B){let r=t,n=this.points,s=(n.length-1)*e,o=Math.floor(s),a=s-o,l=n[o===0?o:o-1],c=n[o],h=n[o>n.length-2?n.length-1:o+1],u=n[o>n.length-3?n.length-1:o+2];return r.set(J0(a,l.x,c.x,h.x,u.x),J0(a,l.y,c.y,h.y,u.y)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(new B().fromArray(n))}return this}};Po.prototype.isSplineCurve=!0;var Db=Object.freeze({__proto__:null,ArcCurve:Mf,CatmullRomCurve3:Af,CubicBezierCurve:an,CubicBezierCurve3:Tf,EllipseCurve:Us,LineCurve:ln,LineCurve3:th,QuadraticBezierCurve:kn,QuadraticBezierCurve3:Ef,SplineCurve:Po}),Tg=class extends xn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new ln(t,e))}getPoint(e,t){let r=e*this.getLength(),n=this.getCurveLengths(),s=0;for(;s<n.length;){if(n[s]>=r){let o=n[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){let 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;let e=[],t=0;for(let r=0,n=this.curves.length;r<n;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],r;for(let n=0,s=this.curves;n<s.length;n++){let o=s[n],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){let h=l[c];r&&r.equals(h)||(t.push(h),r=h)}}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,r=e.curves.length;t<r;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,r=this.curves.length;t<r;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){let n=e.curves[t];this.curves.push(new Db[n.type]().fromJSON(n))}return this}},Fa=class extends Tg{constructor(e){super(),this.type="Path",this.currentPoint=new B,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let r=new ln(this.currentPoint.clone(),new B(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,n){let s=new kn(this.currentPoint.clone(),new B(e,t),new B(r,n));return this.curves.push(s),this.currentPoint.set(r,n),this}bezierCurveTo(e,t,r,n,s,o){let a=new an(this.currentPoint.clone(),new B(e,t),new B(r,n),new B(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),r=new Po(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,n,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,r,n,s,o),this}absarc(e,t,r,n,s,o){return this.absellipse(e,t,r,r,n,s,o),this}ellipse(e,t,r,n,s,o,a,l){let c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+c,t+h,r,n,s,o,a,l),this}absellipse(e,t,r,n,s,o,a,l){let c=new Us(e,t,r,n,s,o,a,l);if(this.curves.length>0){let u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);let h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Ua=class extends Le{constructor(e=[new B(0,.5),new B(.5,0),new B(0,-.5)],t=12,r=0,n=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},t=Math.floor(t),n=xr(n,0,Math.PI*2);let s=[],o=[],a=[],l=[],c=[],h=1/t,u=new M,f=new B,d=new M,p=new M,m=new M,g=0,v=0;for(let y=0;y<=e.length-1;y++)switch(y){case 0:g=e[y+1].x-e[y].x,v=e[y+1].y-e[y].y,d.x=v*1,d.y=-g,d.z=v*0,m.copy(d),d.normalize(),l.push(d.x,d.y,d.z);break;case e.length-1:l.push(m.x,m.y,m.z);break;default:g=e[y+1].x-e[y].x,v=e[y+1].y-e[y].y,d.x=v*1,d.y=-g,d.z=v*0,p.copy(d),d.x+=m.x,d.y+=m.y,d.z+=m.z,d.normalize(),l.push(d.x,d.y,d.z),m.copy(p)}for(let y=0;y<=t;y++){let w=r+y*h*n,b=Math.sin(w),S=Math.cos(w);for(let T=0;T<=e.length-1;T++){u.x=e[T].x*b,u.y=e[T].y,u.z=e[T].x*S,o.push(u.x,u.y,u.z),f.x=y/t,f.y=T/(e.length-1),a.push(f.x,f.y);let A=l[3*T+0]*b,x=l[3*T+1],E=l[3*T+0]*S;c.push(A,x,E)}}for(let y=0;y<t;y++)for(let w=0;w<e.length-1;w++){let b=w+y*e.length,S=b,T=b+e.length,A=b+e.length+1,x=b+1;s.push(S,T,x),s.push(A,x,T)}this.setIndex(s),this.setAttribute("position",new Ce(o,3)),this.setAttribute("uv",new Ce(a,2)),this.setAttribute("normal",new Ce(c,3))}static fromJSON(e){return new Ua(e.points,e.segments,e.phiStart,e.phiLength)}};var Lo=class extends Le{constructor(e=1,t=1,r=1,n=8,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;n=Math.floor(n),s=Math.floor(s);let h=[],u=[],f=[],d=[],p=0,m=[],g=r/2,v=0;y(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(h),this.setAttribute("position",new Ce(u,3)),this.setAttribute("normal",new Ce(f,3)),this.setAttribute("uv",new Ce(d,2));function y(){let b=new M,S=new M,T=0,A=(t-e)/r;for(let x=0;x<=s;x++){let E=[],_=x/s,C=_*(t-e)+e;for(let I=0;I<=n;I++){let N=I/n,R=N*l+a,k=Math.sin(R),G=Math.cos(R);S.x=C*k,S.y=-_*r+g,S.z=C*G,u.push(S.x,S.y,S.z),b.set(k,A,G).normalize(),f.push(b.x,b.y,b.z),d.push(N,1-_),E.push(p++)}m.push(E)}for(let x=0;x<n;x++)for(let E=0;E<s;E++){let _=m[E][x],C=m[E+1][x],I=m[E+1][x+1],N=m[E][x+1];h.push(_,C,N),h.push(C,I,N),T+=6}c.addGroup(v,T,0),v+=T}function w(b){let S=p,T=new B,A=new M,x=0,E=b===!0?e:t,_=b===!0?1:-1;for(let I=1;I<=n;I++)u.push(0,g*_,0),f.push(0,_,0),d.push(.5,.5),p++;let C=p;for(let I=0;I<=n;I++){let R=I/n*l+a,k=Math.cos(R),G=Math.sin(R);A.x=E*G,A.y=g*_,A.z=E*k,u.push(A.x,A.y,A.z),f.push(0,_,0),T.x=k*.5+.5,T.y=G*.5*_+.5,d.push(T.x,T.y),p++}for(let I=0;I<n;I++){let N=S+I,R=C+I;b===!0?h.push(R,R+1,N):h.push(R+1,R,N),x+=3}c.addGroup(v,x,b===!0?1:2),v+=x}}static fromJSON(e){return new Lo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},za=class extends Lo{constructor(e=1,t=1,r=8,n=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,r,n,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:n,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new za(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Ga=class extends Le{constructor(e=[],t=[],r=1,n=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:n};let s=[],o=[];a(n),c(r),h(),this.setAttribute("position",new Ce(s,3)),this.setAttribute("normal",new Ce(s.slice(),3)),this.setAttribute("uv",new Ce(o,2)),n===0?this.computeVertexNormals():this.normalizeNormals();function a(y){let w=new M,b=new M,S=new M;for(let T=0;T<t.length;T+=3)d(t[T+0],w),d(t[T+1],b),d(t[T+2],S),l(w,b,S,y)}function l(y,w,b,S){let T=S+1,A=[];for(let x=0;x<=T;x++){A[x]=[];let E=y.clone().lerp(b,x/T),_=w.clone().lerp(b,x/T),C=T-x;for(let I=0;I<=C;I++)I===0&&x===T?A[x][I]=E:A[x][I]=E.clone().lerp(_,I/C)}for(let x=0;x<T;x++)for(let E=0;E<2*(T-x)-1;E++){let _=Math.floor(E/2);E%2===0?(f(A[x][_+1]),f(A[x+1][_]),f(A[x][_])):(f(A[x][_+1]),f(A[x+1][_+1]),f(A[x+1][_]))}}function c(y){let w=new M;for(let b=0;b<s.length;b+=3)w.x=s[b+0],w.y=s[b+1],w.z=s[b+2],w.normalize().multiplyScalar(y),s[b+0]=w.x,s[b+1]=w.y,s[b+2]=w.z}function h(){let y=new M;for(let w=0;w<s.length;w+=3){y.x=s[w+0],y.y=s[w+1],y.z=s[w+2];let b=g(y)/2/Math.PI+.5,S=v(y)/Math.PI+.5;o.push(b,1-S)}p(),u()}function u(){for(let y=0;y<o.length;y+=6){let w=o[y+0],b=o[y+2],S=o[y+4],T=Math.max(w,b,S),A=Math.min(w,b,S);T>.9&&A<.1&&(w<.2&&(o[y+0]+=1),b<.2&&(o[y+2]+=1),S<.2&&(o[y+4]+=1))}}function f(y){s.push(y.x,y.y,y.z)}function d(y,w){let b=y*3;w.x=e[b+0],w.y=e[b+1],w.z=e[b+2]}function p(){let y=new M,w=new M,b=new M,S=new M,T=new B,A=new B,x=new B;for(let E=0,_=0;E<s.length;E+=9,_+=6){y.set(s[E+0],s[E+1],s[E+2]),w.set(s[E+3],s[E+4],s[E+5]),b.set(s[E+6],s[E+7],s[E+8]),T.set(o[_+0],o[_+1]),A.set(o[_+2],o[_+3]),x.set(o[_+4],o[_+5]),S.copy(y).add(w).add(b).divideScalar(3);let C=g(S);m(T,_+0,y,C),m(A,_+2,w,C),m(x,_+4,b,C)}}function m(y,w,b,S){S<0&&y.x===1&&(o[w]=y.x-1),b.x===0&&b.z===0&&(o[w]=S/2/Math.PI+.5)}function g(y){return Math.atan2(y.z,-y.x)}function v(y){return Math.atan2(-y.y,Math.sqrt(y.x*y.x+y.z*y.z))}}static fromJSON(e){return new Ga(e.vertices,e.indices,e.radius,e.details)}},ka=class extends Ga{constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,n=1/r,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,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],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 ka(e.radius,e.detail)}},dG=new M,pG=new M,mG=new M,gG=new Jt;var rn=class extends Fa{constructor(e){super(e),this.uuid=Un(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let r=0,n=this.holes.length;r<n;r++)t[r]=this.holes[r].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,r=e.holes.length;t<r;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,r=this.holes.length;t<r;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){let n=e.holes[t];this.holes.push(new Fa().fromJSON(n))}return this}},UL={triangulate:function(i,e,t=2){let r=e&&e.length,n=r?e[0]*t:i.length,s=Pb(i,0,n,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c,h,u,f,d;if(r&&(s=HL(i,e,s,t)),i.length>80*t){a=c=i[0],l=h=i[1];for(let p=t;p<n;p+=t)u=i[p],f=i[p+1],u<a&&(a=u),f<l&&(l=f),u>c&&(c=u),f>h&&(h=f);d=Math.max(c-a,h-l),d=d!==0?1/d:0}return rh(s,o,t,a,l,d),o}};function Pb(i,e,t,r,n){let s,o;if(n===e2(i,e,t,r)>0)for(s=e;s<t;s+=r)o=K0(s,i[s],i[s+1],o);else for(s=t-r;s>=e;s-=r)o=K0(s,i[s],i[s+1],o);return o&&td(o,o.next)&&(ih(o),o=o.next),o}function zs(i,e){if(!i)return i;e||(e=i);let t=i,r;do if(r=!1,!t.steiner&&(td(t,t.next)||tr(t.prev,t,t.next)===0)){if(ih(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function rh(i,e,t,r,n,s,o){if(!i)return;!o&&s&&XL(i,r,n,s);let a=i,l,c;for(;i.prev!==i.next;){if(l=i.prev,c=i.next,s?GL(i,r,n,s):zL(i)){e.push(l.i/t),e.push(i.i/t),e.push(c.i/t),ih(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=kL(zs(i),e,t),rh(i,e,t,r,n,s,2)):o===2&&VL(i,e,t,r,n,s):rh(zs(i),e,t,r,n,s,1);break}}}function zL(i){let e=i.prev,t=i,r=i.next;if(tr(e,t,r)>=0)return!1;let n=i.next.next;for(;n!==i.prev;){if(Pa(e.x,e.y,t.x,t.y,r.x,r.y,n.x,n.y)&&tr(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function GL(i,e,t,r){let n=i.prev,s=i,o=i.next;if(tr(n,s,o)>=0)return!1;let a=n.x<s.x?n.x<o.x?n.x:o.x:s.x<o.x?s.x:o.x,l=n.y<s.y?n.y<o.y?n.y:o.y:s.y<o.y?s.y:o.y,c=n.x>s.x?n.x>o.x?n.x:o.x:s.x>o.x?s.x:o.x,h=n.y>s.y?n.y>o.y?n.y:o.y:s.y>o.y?s.y:o.y,u=Eg(a,l,e,t,r),f=Eg(c,h,e,t,r),d=i.prevZ,p=i.nextZ;for(;d&&d.z>=u&&p&&p.z<=f;){if(d!==i.prev&&d!==i.next&&Pa(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tr(d.prev,d,d.next)>=0||(d=d.prevZ,p!==i.prev&&p!==i.next&&Pa(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&tr(p.prev,p,p.next)>=0))return!1;p=p.nextZ}for(;d&&d.z>=u;){if(d!==i.prev&&d!==i.next&&Pa(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tr(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=f;){if(p!==i.prev&&p!==i.next&&Pa(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&tr(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function kL(i,e,t){let r=i;do{let n=r.prev,s=r.next.next;!td(n,s)&&Lb(n,r,r.next,s)&&nh(n,s)&&nh(s,n)&&(e.push(n.i/t),e.push(r.i/t),e.push(s.i/t),ih(r),ih(r.next),r=i=s),r=r.next}while(r!==i);return zs(r)}function VL(i,e,t,r,n,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&KL(o,a)){let l=Ib(o,a);o=zs(o,o.next),l=zs(l,l.next),rh(o,e,t,r,n,s),rh(l,e,t,r,n,s);return}a=a.next}o=o.next}while(o!==i)}function HL(i,e,t,r){let n=[],s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*r,l=s<o-1?e[s+1]*r:i.length,c=Pb(i,a,l,r,!1),c===c.next&&(c.steiner=!0),n.push(JL(c));for(n.sort(WL),s=0;s<n.length;s++)jL(n[s],t),t=zs(t,t.next);return t}function WL(i,e){return i.x-e.x}function jL(i,e){if(e=qL(i,e),e){let t=Ib(e,i);zs(e,e.next),zs(t,t.next)}}function qL(i,e){let t=e,r=i.x,n=i.y,s=-1/0,o;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){let f=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=r&&f>s){if(s=f,f===r){if(n===t.y)return t;if(n===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(r===s)return o;let a=o,l=o.x,c=o.y,h=1/0,u;t=o;do r>=t.x&&t.x>=l&&r!==t.x&&Pa(n<c?r:s,n,l,c,n<c?s:r,n,t.x,t.y)&&(u=Math.abs(n-t.y)/(r-t.x),nh(t,i)&&(u<h||u===h&&(t.x>o.x||t.x===o.x&&YL(o,t)))&&(o=t,h=u)),t=t.next;while(t!==a);return o}function YL(i,e){return tr(i.prev,i,e.prev)<0&&tr(e.next,i,i.next)<0}function XL(i,e,t,r){let n=i;do n.z===null&&(n.z=Eg(n.x,n.y,e,t,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==i);n.prevZ.nextZ=null,n.prevZ=null,QL(n)}function QL(i){let e,t,r,n,s,o,a,l,c=1;do{for(t=i,i=null,s=null,o=0;t;){for(o++,r=t,a=0,e=0;e<c&&(a++,r=r.nextZ,!!r);e++);for(l=c;a>0||l>0&&r;)a!==0&&(l===0||!r||t.z<=r.z)?(n=t,t=t.nextZ,a--):(n=r,r=r.nextZ,l--),s?s.nextZ=n:i=n,n.prevZ=s,s=n;t=r}s.nextZ=null,c*=2}while(o>1);return i}function Eg(i,e,t,r,n){return i=32767*(i-t)*n,e=32767*(e-r)*n,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function JL(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function Pa(i,e,t,r,n,s,o,a){return(n-o)*(e-a)-(i-o)*(s-a)>=0&&(i-o)*(r-a)-(t-o)*(e-a)>=0&&(t-o)*(s-a)-(n-o)*(r-a)>=0}function KL(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!ZL(i,e)&&(nh(i,e)&&nh(e,i)&&$L(i,e)&&(tr(i.prev,i,e.prev)||tr(i,e.prev,e))||td(i,e)&&tr(i.prev,i,i.next)>0&&tr(e.prev,e,e.next)>0)}function tr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function td(i,e){return i.x===e.x&&i.y===e.y}function Lb(i,e,t,r){let n=nf(tr(i,e,t)),s=nf(tr(i,e,r)),o=nf(tr(t,r,i)),a=nf(tr(t,r,e));return!!(n!==s&&o!==a||n===0&&rf(i,t,e)||s===0&&rf(i,r,e)||o===0&&rf(t,i,r)||a===0&&rf(t,e,r))}function rf(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function nf(i){return i>0?1:i<0?-1:0}function ZL(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&Lb(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function nh(i,e){return tr(i.prev,i,i.next)<0?tr(i,e,i.next)>=0&&tr(i,i.prev,e)>=0:tr(i,e,i.prev)<0||tr(i,i.next,e)<0}function $L(i,e){let t=i,r=!1,n=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&n<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==i);return r}function Ib(i,e){let t=new _g(i.i,i.x,i.y),r=new _g(e.i,e.x,e.y),n=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=n,n.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function K0(i,e,t,r){let n=new _g(i,e,t);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function ih(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function _g(i,e,t){this.i=i,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 e2(i,e,t,r){let n=0;for(let s=e,o=t-r;s<t;s+=r)n+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return n}var ni=class{static area(e){let t=e.length,r=0;for(let n=t-1,s=0;s<t;n=s++)r+=e[n].x*e[s].y-e[s].x*e[n].y;return r*.5}static isClockWise(e){return ni.area(e)<0}static triangulateShape(e,t){let r=[],n=[],s=[];Z0(e),$0(r,e);let o=e.length;t.forEach(Z0);for(let l=0;l<t.length;l++)n.push(o),o+=t[l].length,$0(r,t[l]);let a=UL.triangulate(r,n);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function Z0(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function $0(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var Gs=class extends Le{constructor(e=new rn([new B(.5,.5),new B(-.5,.5),new B(-.5,-.5),new B(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let r=this,n=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new Ce(n,3)),this.setAttribute("uv",new Ce(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,u=t.depth!==void 0?t.depth:1,f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,p=t.bevelSize!==void 0?t.bevelSize:d-.1,m=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3,v=t.extrudePath,y=t.UVGenerator!==void 0?t.UVGenerator:t2;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),u=t.amount);let w,b=!1,S,T,A,x;v&&(w=v.getSpacedPoints(h),b=!0,f=!1,S=v.computeFrenetFrames(h,!1),T=new M,A=new M,x=new M),f||(g=0,d=0,p=0,m=0);let E=a.extractPoints(c),_=E.shape,C=E.holes;if(!ni.isClockWise(_)){_=_.reverse();for(let K=0,V=C.length;K<V;K++){let Z=C[K];ni.isClockWise(Z)&&(C[K]=Z.reverse())}}let N=ni.triangulateShape(_,C),R=_;for(let K=0,V=C.length;K<V;K++){let Z=C[K];_=_.concat(Z)}function k(K,V,Z){return V||console.error("THREE.ExtrudeGeometry: vec does not exist"),V.clone().multiplyScalar(Z).add(K)}let G=_.length,te=N.length;function Q(K,V,Z){let ce,se,pe,ve=K.x-V.x,me=K.y-V.y,Pe=Z.x-K.x,ke=Z.y-K.y,L=ve*ve+me*me,D=ve*ke-me*Pe;if(Math.abs(D)>Number.EPSILON){let re=Math.sqrt(L),ye=Math.sqrt(Pe*Pe+ke*ke),Se=V.x-me/re,Ie=V.y+ve/re,Fe=Z.x-ke/ye,ue=Z.y+Pe/ye,rt=((Fe-Se)*ke-(ue-Ie)*Pe)/(ve*ke-me*Pe);ce=Se+ve*rt-K.x,se=Ie+me*rt-K.y;let st=ce*ce+se*se;if(st<=2)return new B(ce,se);pe=Math.sqrt(st/2)}else{let re=!1;ve>Number.EPSILON?Pe>Number.EPSILON&&(re=!0):ve<-Number.EPSILON?Pe<-Number.EPSILON&&(re=!0):Math.sign(me)===Math.sign(ke)&&(re=!0),re?(ce=-me,se=ve,pe=Math.sqrt(L)):(ce=ve,se=me,pe=Math.sqrt(L/2))}return new B(ce/pe,se/pe)}let Y=[];for(let K=0,V=R.length,Z=V-1,ce=K+1;K<V;K++,Z++,ce++)Z===V&&(Z=0),ce===V&&(ce=0),Y[K]=Q(R[K],R[Z],R[ce]);let F=[],z,O=Y.concat();for(let K=0,V=C.length;K<V;K++){let Z=C[K];z=[];for(let ce=0,se=Z.length,pe=se-1,ve=ce+1;ce<se;ce++,pe++,ve++)pe===se&&(pe=0),ve===se&&(ve=0),z[ce]=Q(Z[ce],Z[pe],Z[ve]);F.push(z),O=O.concat(z)}for(let K=0;K<g;K++){let V=K/g,Z=d*Math.cos(V*Math.PI/2),ce=p*Math.sin(V*Math.PI/2)+m;for(let se=0,pe=R.length;se<pe;se++){let ve=k(R[se],Y[se],ce);ge(ve.x,ve.y,-Z)}for(let se=0,pe=C.length;se<pe;se++){let ve=C[se];z=F[se];for(let me=0,Pe=ve.length;me<Pe;me++){let ke=k(ve[me],z[me],ce);ge(ke.x,ke.y,-Z)}}}let j=p+m;for(let K=0;K<G;K++){let V=f?k(_[K],O[K],j):_[K];b?(A.copy(S.normals[0]).multiplyScalar(V.x),T.copy(S.binormals[0]).multiplyScalar(V.y),x.copy(w[0]).add(A).add(T),ge(x.x,x.y,x.z)):ge(V.x,V.y,0)}for(let K=1;K<=h;K++)for(let V=0;V<G;V++){let Z=f?k(_[V],O[V],j):_[V];b?(A.copy(S.normals[K]).multiplyScalar(Z.x),T.copy(S.binormals[K]).multiplyScalar(Z.y),x.copy(w[K]).add(A).add(T),ge(x.x,x.y,x.z)):ge(Z.x,Z.y,u/h*K)}for(let K=g-1;K>=0;K--){let V=K/g,Z=d*Math.cos(V*Math.PI/2),ce=p*Math.sin(V*Math.PI/2)+m;for(let se=0,pe=R.length;se<pe;se++){let ve=k(R[se],Y[se],ce);ge(ve.x,ve.y,u+Z)}for(let se=0,pe=C.length;se<pe;se++){let ve=C[se];z=F[se];for(let me=0,Pe=ve.length;me<Pe;me++){let ke=k(ve[me],z[me],ce);b?ge(ke.x,ke.y+w[h-1].y,w[h-1].x+Z):ge(ke.x,ke.y,u+Z)}}}q(),J();function q(){let K=n.length/3;if(f){let V=0,Z=G*V;for(let ce=0;ce<te;ce++){let se=N[ce];oe(se[2]+Z,se[1]+Z,se[0]+Z)}V=h+g*2,Z=G*V;for(let ce=0;ce<te;ce++){let se=N[ce];oe(se[0]+Z,se[1]+Z,se[2]+Z)}}else{for(let V=0;V<te;V++){let Z=N[V];oe(Z[2],Z[1],Z[0])}for(let V=0;V<te;V++){let Z=N[V];oe(Z[0]+G*h,Z[1]+G*h,Z[2]+G*h)}}r.addGroup(K,n.length/3-K,0)}function J(){let K=n.length/3,V=0;W(R,V),V+=R.length;for(let Z=0,ce=C.length;Z<ce;Z++){let se=C[Z];W(se,V),V+=se.length}r.addGroup(K,n.length/3-K,1)}function W(K,V){let Z=K.length;for(;--Z>=0;){let ce=Z,se=Z-1;se<0&&(se=K.length-1);for(let pe=0,ve=h+g*2;pe<ve;pe++){let me=G*pe,Pe=G*(pe+1),ke=V+ce+me,L=V+se+me,D=V+se+Pe,re=V+ce+Pe;le(ke,L,D,re)}}}function ge(K,V,Z){l.push(K),l.push(V),l.push(Z)}function oe(K,V,Z){H(K),H(V),H(Z);let ce=n.length/3,se=y.generateTopUV(r,n,ce-3,ce-2,ce-1);he(se[0]),he(se[1]),he(se[2])}function le(K,V,Z,ce){H(K),H(V),H(ce),H(V),H(Z),H(ce);let se=n.length/3,pe=y.generateSideWallUV(r,n,se-6,se-3,se-2,se-1);he(pe[0]),he(pe[1]),he(pe[3]),he(pe[1]),he(pe[2]),he(pe[3])}function H(K){n.push(l[K*3+0]),n.push(l[K*3+1]),n.push(l[K*3+2])}function he(K){s.push(K.x),s.push(K.y)}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,r=this.parameters.options;return r2(t,r,e)}static fromJSON(e,t){let r=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];r.push(a)}let n=e.options.extrudePath;return n!==void 0&&(e.options.extrudePath=new Db[n.type]().fromJSON(n)),new Gs(r,e.options)}},t2={generateTopUV:function(i,e,t,r,n){let s=e[t*3],o=e[t*3+1],a=e[r*3],l=e[r*3+1],c=e[n*3],h=e[n*3+1];return[new B(s,o),new B(a,l),new B(c,h)]},generateSideWallUV:function(i,e,t,r,n,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[r*3],h=e[r*3+1],u=e[r*3+2],f=e[n*3],d=e[n*3+1],p=e[n*3+2],m=e[s*3],g=e[s*3+1],v=e[s*3+2];return Math.abs(a-h)<Math.abs(o-c)?[new B(o,1-l),new B(c,1-u),new B(f,1-p),new B(m,1-v)]:[new B(a,1-l),new B(h,1-u),new B(d,1-p),new B(g,1-v)]}};function r2(i,e,t){if(t.shapes=[],Array.isArray(i))for(let r=0,n=i.length;r<n;r++){let s=i[r];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var Va=class extends Ga{constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,n=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,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(n,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Va(e.radius,e.detail)}};var Io=class extends Le{constructor(e=new rn([new B(0,.5),new B(-.5,-.5),new B(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let r=[],n=[],s=[],o=[],a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let h=0;h<e.length;h++)c(e[h]),this.addGroup(a,l,h),a+=l,l=0;this.setIndex(r),this.setAttribute("position",new Ce(n,3)),this.setAttribute("normal",new Ce(s,3)),this.setAttribute("uv",new Ce(o,2));function c(h){let u=n.length/3,f=h.extractPoints(t),d=f.shape,p=f.holes;ni.isClockWise(d)===!1&&(d=d.reverse());for(let g=0,v=p.length;g<v;g++){let y=p[g];ni.isClockWise(y)===!0&&(p[g]=y.reverse())}let m=ni.triangulateShape(d,p);for(let g=0,v=p.length;g<v;g++){let y=p[g];d=d.concat(y)}for(let g=0,v=d.length;g<v;g++){let y=d[g];n.push(y.x,y.y,0),s.push(0,0,1),o.push(y.x,y.y)}for(let g=0,v=m.length;g<v;g++){let y=m[g],w=y[0]+u,b=y[1]+u,S=y[2]+u;r.push(w,b,S),l+=3}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return n2(t,e)}static fromJSON(e,t){let r=[];for(let n=0,s=e.shapes.length;n<s;n++){let o=t[e.shapes[n]];r.push(o)}return new Io(r,e.curveSegments)}};function n2(i,e){if(e.shapes=[],Array.isArray(i))for(let t=0,r=i.length;t<r;t++){let n=i[t];e.shapes.push(n.uuid)}else e.shapes.push(i.uuid);return e}var Ro=class extends Le{constructor(e=1,t=32,r=16,n=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),r=Math.max(2,Math.floor(r));let l=Math.min(o+a,Math.PI),c=0,h=[],u=new M,f=new M,d=[],p=[],m=[],g=[];for(let v=0;v<=r;v++){let y=[],w=v/r,b=0;v==0&&o==0?b=.5/t:v==r&&l==Math.PI&&(b=-.5/t);for(let S=0;S<=t;S++){let T=S/t;u.x=-e*Math.cos(n+T*s)*Math.sin(o+w*a),u.y=e*Math.cos(o+w*a),u.z=e*Math.sin(n+T*s)*Math.sin(o+w*a),p.push(u.x,u.y,u.z),f.copy(u).normalize(),m.push(f.x,f.y,f.z),g.push(T+b,1-w),y.push(c++)}h.push(y)}for(let v=0;v<r;v++)for(let y=0;y<t;y++){let w=h[v][y+1],b=h[v][y],S=h[v+1][y],T=h[v+1][y+1];(v!==0||o>0)&&d.push(w,b,T),(v!==r-1||l<Math.PI)&&d.push(b,S,T)}this.setIndex(d),this.setAttribute("position",new Ce(p,3)),this.setAttribute("normal",new Ce(m,3)),this.setAttribute("uv",new Ce(g,2))}static fromJSON(e){return new Ro(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var Ha=class extends Le{constructor(e=1,t=.4,r=64,n=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:s,q:o},r=Math.floor(r),n=Math.floor(n);let a=[],l=[],c=[],h=[],u=new M,f=new M,d=new M,p=new M,m=new M,g=new M,v=new M;for(let w=0;w<=r;++w){let b=w/r*s*Math.PI*2;y(b,s,o,e,d),y(b+.01,s,o,e,p),g.subVectors(p,d),v.addVectors(p,d),m.crossVectors(g,v),v.crossVectors(m,g),m.normalize(),v.normalize();for(let S=0;S<=n;++S){let T=S/n*Math.PI*2,A=-t*Math.cos(T),x=t*Math.sin(T);u.x=d.x+(A*v.x+x*m.x),u.y=d.y+(A*v.y+x*m.y),u.z=d.z+(A*v.z+x*m.z),l.push(u.x,u.y,u.z),f.subVectors(u,d).normalize(),c.push(f.x,f.y,f.z),h.push(w/r),h.push(S/n)}}for(let w=1;w<=r;w++)for(let b=1;b<=n;b++){let S=(n+1)*(w-1)+(b-1),T=(n+1)*w+(b-1),A=(n+1)*w+b,x=(n+1)*(w-1)+b;a.push(S,T,x),a.push(T,A,x)}this.setIndex(a),this.setAttribute("position",new Ce(l,3)),this.setAttribute("normal",new Ce(c,3)),this.setAttribute("uv",new Ce(h,2));function y(w,b,S,T,A){let x=Math.cos(w),E=Math.sin(w),_=S/b*w,C=Math.cos(_);A.x=T*(2+C)*.5*x,A.y=T*(2+C)*E*.5,A.z=T*Math.sin(_)*.5}}static fromJSON(e){return new Ha(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}};var _f=class extends ur{constructor(e){super(),this.type="ShadowMaterial",this.color=new be(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};_f.prototype.isShadowMaterial=!0;var Cf=class extends Mt{constructor(e){super(e),this.type="RawShaderMaterial"}};Cf.prototype.isRawShaderMaterial=!0;var sh=class extends ur{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new be(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 be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xa,this.normalScale=new B(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.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};sh.prototype.isMeshStandardMaterial=!0;var Df=class extends sh{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new B(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return xr(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new be(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 be(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new be(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}};Df.prototype.isMeshPhysicalMaterial=!0;var Pf=class extends ur{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new be(16777215),this.specular=new be(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xa,this.normalScale=new B(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=$f,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};Pf.prototype.isMeshPhongMaterial=!0;var Lf=class extends ur{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new be(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xa,this.normalScale=new B(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};Lf.prototype.isMeshToonMaterial=!0;var If=class extends ur{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xa,this.normalScale=new B(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}};If.prototype.isMeshNormalMaterial=!0;var Rf=class extends ur{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new be(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=$f,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.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.fog=e.fog,this}};Rf.prototype.isMeshLambertMaterial=!0;var Bf=class extends ur{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new be(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xa,this.normalScale=new B(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}};Bf.prototype.isMeshMatcapMaterial=!0;var Nf=class extends kr{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}};Nf.prototype.isLineDashedMaterial=!0;var i2={ShadowMaterial:_f,SpriteMaterial:Zc,RawShaderMaterial:Cf,ShaderMaterial:Mt,PointsMaterial:$c,MeshPhysicalMaterial:Df,MeshStandardMaterial:sh,MeshPhongMaterial:Pf,MeshToonMaterial:Lf,MeshNormalMaterial:If,MeshLambertMaterial:Rf,MeshDepthMaterial:Qc,MeshDistanceMaterial:Jc,MeshBasicMaterial:zn,MeshMatcapMaterial:Bf,LineDashedMaterial:Nf,LineBasicMaterial:kr,Material:ur};ur.fromType=function(i){return new i2[i]};var Qt={arraySlice:function(i,e,t){return Qt.isTypedArray(i)?new i.constructor(i.subarray(e,t!==void 0?t:i.length)):i.slice(e,t)},convertArray:function(i,e,t){return!i||!t&&i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)},isTypedArray:function(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)},getKeyframeOrder:function(i){function e(n,s){return i[n]-i[s]}let t=i.length,r=new Array(t);for(let n=0;n!==t;++n)r[n]=n;return r.sort(e),r},sortedArray:function(i,e,t){let r=i.length,n=new i.constructor(r);for(let s=0,o=0;o!==r;++s){let a=t[s]*e;for(let l=0;l!==e;++l)n[o++]=i[a+l]}return n},flattenJSON:function(i,e,t,r){let n=1,s=i[0];for(;s!==void 0&&s[r]===void 0;)s=i[n++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=i[n++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=i[n++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),t.push(o)),s=i[n++];while(s!==void 0)},subclip:function(i,e,t,r,n=30){let s=i.clone();s.name=e;let o=[];for(let l=0;l<s.tracks.length;++l){let c=s.tracks[l],h=c.getValueSize(),u=[],f=[];for(let d=0;d<c.times.length;++d){let p=c.times[d]*n;if(!(p<t||p>=r)){u.push(c.times[d]);for(let m=0;m<h;++m)f.push(c.values[d*h+m])}}u.length!==0&&(c.times=Qt.convertArray(u,c.times.constructor),c.values=Qt.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(i,e=0,t=i,r=30){r<=0&&(r=30);let n=t.tracks.length,s=e/r;for(let o=0;o<n;++o){let a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;let c=i.tracks.find(function(v){return v.name===a.name&&v.ValueTypeName===l});if(c===void 0)continue;let h=0,u=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=u/3);let f=0,d=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);let p=a.times.length-1,m;if(s<=a.times[0]){let v=h,y=u-h;m=Qt.arraySlice(a.values,v,y)}else if(s>=a.times[p]){let v=p*u+h,y=v+u-h;m=Qt.arraySlice(a.values,v,y)}else{let v=a.createInterpolant(),y=h,w=u-h;v.evaluate(s),m=Qt.arraySlice(v.resultBuffer,y,w)}l==="quaternion"&&new zt().fromArray(m).normalize().conjugate().toArray(m);let g=c.times.length;for(let v=0;v<g;++v){let y=v*d+f;if(l==="quaternion")zt.multiplyQuaternionsFlat(c.values,y,m,0,c.values,y);else{let w=d-f*2;for(let b=0;b<w;++b)c.values[y+b]-=m[b]}}}return i.blendMode=gb,i}},Ci=class{constructor(e,t,r,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=n!==void 0?n:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,r=this._cachedIndex,n=t[r],s=t[r-1];e:{t:{let o;r:{n:if(!(e<n)){for(let a=r+2;;){if(n===void 0){if(e<s)break n;return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,e,s)}if(r===a)break;if(s=n,n=t[++r],e<n)break t}o=t.length;break r}if(!(e>=s)){let a=t[1];e<a&&(r=2,s=a);for(let l=r-2;;){if(s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(r===l)break;if(n=s,s=t[--r-1],e>=s)break t}o=r,r=0;break r}break e}for(;r<o;){let a=r+o>>>1;e<t[a]?o=a:r=a+1}if(n=t[r],s=t[r-1],s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(n===void 0)return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,s,e)}this._cachedIndex=r,this.intervalChanged_(r,s,n)}return this.interpolate_(r,s,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,s=e*n;for(let o=0;o!==n;++o)t[o]=r[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}};Ci.prototype.beforeStart_=Ci.prototype.copySampleValue_;Ci.prototype.afterEnd_=Ci.prototype.copySampleValue_;var Cg=class extends Ci{constructor(e,t,r,n){super(e,t,r,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:_a,endingEnd:_a}}intervalChanged_(e,t,r){let n=this.parameterPositions,s=e-2,o=e+1,a=n[s],l=n[o];if(a===void 0)switch(this.getSettings_().endingStart){case Ca:s=e,a=2*t-r;break;case df:s=n.length-2,a=t+n[s]-n[s+1];break;default:s=e,a=r}if(l===void 0)switch(this.getSettings_().endingEnd){case Ca:o=e,l=2*r-t;break;case df:o=1,l=r+n[1]-n[0];break;default:o=e-1,l=t}let c=(r-t)*.5,h=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-r),this._offsetPrev=s*h,this._offsetNext=o*h}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,h=this._offsetPrev,u=this._offsetNext,f=this._weightPrev,d=this._weightNext,p=(r-t)/(n-t),m=p*p,g=m*p,v=-f*g+2*f*m-f*p,y=(1+f)*g+(-1.5-2*f)*m+(-.5+f)*p+1,w=(-1-d)*g+(1.5+d)*m+.5*p,b=d*g-d*m;for(let S=0;S!==a;++S)s[S]=v*o[h+S]+y*o[c+S]+w*o[l+S]+b*o[u+S];return s}},Of=class extends Ci{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,h=(r-t)/(n-t),u=1-h;for(let f=0;f!==a;++f)s[f]=o[c+f]*u+o[l+f]*h;return s}},Dg=class extends Ci{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e){return this.copySampleValue_(e-1)}},Vn=class{constructor(e,t,r,n){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=Qt.convertArray(t,this.TimeBufferType),this.values=Qt.convertArray(r,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,r;if(t.toJSON!==this.toJSON)r=t.toJSON(e);else{r={name:e.name,times:Qt.convertArray(e.times,Array),values:Qt.convertArray(e.values,Array)};let n=e.getInterpolation();n!==e.DefaultInterpolation&&(r.interpolation=n)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new Dg(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Of(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Cg(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case uf:t=this.InterpolantFactoryMethodDiscrete;break;case ff:t=this.InterpolantFactoryMethodLinear;break;case wm:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let r="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(r);return console.warn("THREE.KeyframeTrack:",r),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return uf;case this.InterpolantFactoryMethodLinear:return ff;case this.InterpolantFactoryMethodSmooth:return wm}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let r=0,n=t.length;r!==n;++r)t[r]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let r=0,n=t.length;r!==n;++r)t[r]*=e}return this}trim(e,t){let r=this.times,n=r.length,s=0,o=n-1;for(;s!==n&&r[s]<e;)++s;for(;o!==-1&&r[o]>t;)--o;if(++o,s!==0||o!==n){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=Qt.arraySlice(r,s,o),this.values=Qt.arraySlice(this.values,s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let r=this.times,n=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=r[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(n!==void 0&&Qt.isTypedArray(n))for(let a=0,l=n.length;a!==l;++a){let c=n[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=Qt.arraySlice(this.times),t=Qt.arraySlice(this.values),r=this.getValueSize(),n=this.getInterpolation()===wm,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],h=e[a+1];if(c!==h&&(a!==1||c!==e[0]))if(n)l=!0;else{let u=a*r,f=u-r,d=u+r;for(let p=0;p!==r;++p){let m=t[u+p];if(m!==t[f+p]||m!==t[d+p]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let u=a*r,f=o*r;for(let d=0;d!==r;++d)t[f+d]=t[u+d]}++o}}if(s>0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=Qt.arraySlice(e,0,o),this.values=Qt.arraySlice(t,0,o*r)):(this.times=e,this.values=t),this}clone(){let e=Qt.arraySlice(this.times,0),t=Qt.arraySlice(this.values,0),r=this.constructor,n=new r(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}};Vn.prototype.TimeBufferType=Float32Array;Vn.prototype.ValueBufferType=Float32Array;Vn.prototype.DefaultInterpolation=ff;var ks=class extends Vn{};ks.prototype.ValueTypeName="bool";ks.prototype.ValueBufferType=Array;ks.prototype.DefaultInterpolation=uf;ks.prototype.InterpolantFactoryMethodLinear=void 0;ks.prototype.InterpolantFactoryMethodSmooth=void 0;var Ff=class extends Vn{};Ff.prototype.ValueTypeName="color";var Wa=class extends Vn{};Wa.prototype.ValueTypeName="number";var Pg=class extends Ci{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-t)/(n-t),c=e*a;for(let h=c+a;c!==h;c+=4)zt.slerpFlat(s,0,o,c-a,o,c,l);return s}},Bo=class extends Vn{InterpolantFactoryMethodLinear(e){return new Pg(this.times,this.values,this.getValueSize(),e)}};Bo.prototype.ValueTypeName="quaternion";Bo.prototype.DefaultInterpolation=ff;Bo.prototype.InterpolantFactoryMethodSmooth=void 0;var Vs=class extends Vn{};Vs.prototype.ValueTypeName="string";Vs.prototype.ValueBufferType=Array;Vs.prototype.DefaultInterpolation=uf;Vs.prototype.InterpolantFactoryMethodLinear=void 0;Vs.prototype.InterpolantFactoryMethodSmooth=void 0;var ja=class extends Vn{};ja.prototype.ValueTypeName="vector";var Uf=class{constructor(e,t=-1,r,n=$g){this.name=e,this.tracks=r,this.duration=t,this.blendMode=n,this.uuid=Un(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],r=e.tracks,n=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)t.push(o2(r[o]).scale(n));let s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){let t=[],r=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)t.push(Vn.toJSON(r[s]));return n}static CreateFromMorphTargetSequence(e,t,r,n){let 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);let h=Qt.getKeyframeOrder(l);l=Qt.sortedArray(l,1,h),c=Qt.sortedArray(c,1,h),!n&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new Wa(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/r))}return new this(e,-1,o)}static findByName(e,t){let r=e;if(!Array.isArray(e)){let n=e;r=n.geometry&&n.geometry.animations||n.animations}for(let n=0;n<r.length;n++)if(r[n].name===t)return r[n];return null}static CreateClipsFromMorphTargetSequences(e,t,r){let n={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){let c=e[a],h=c.name.match(s);if(h&&h.length>1){let u=h[1],f=n[u];f||(n[u]=f=[]),f.push(c)}}let o=[];for(let a in n)o.push(this.CreateFromMorphTargetSequence(a,n[a],t,r));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let r=function(u,f,d,p,m){if(d.length!==0){let g=[],v=[];Qt.flattenJSON(d,g,v,p),g.length!==0&&m.push(new u(f,g,v))}},n=[],s=e.name||"default",o=e.fps||30,a=e.blendMode,l=e.length||-1,c=e.hierarchy||[];for(let u=0;u<c.length;u++){let f=c[u].keys;if(!(!f||f.length===0))if(f[0].morphTargets){let d={},p;for(p=0;p<f.length;p++)if(f[p].morphTargets)for(let m=0;m<f[p].morphTargets.length;m++)d[f[p].morphTargets[m]]=-1;for(let m in d){let g=[],v=[];for(let y=0;y!==f[p].morphTargets.length;++y){let w=f[p];g.push(w.time),v.push(w.morphTarget===m?1:0)}n.push(new Wa(".morphTargetInfluence["+m+"]",g,v))}l=d.length*o}else{let d=".bones["+t[u].name+"]";r(ja,d+".position",f,"pos",n),r(Bo,d+".quaternion",f,"rot",n),r(ja,d+".scale",f,"scl",n)}}return n.length===0?null:new this(s,l,n,a)}resetDuration(){let e=this.tracks,t=0;for(let r=0,n=e.length;r!==n;++r){let s=this.tracks[r];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(){let 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 s2(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Wa;case"vector":case"vector2":case"vector3":case"vector4":return ja;case"color":return Ff;case"quaternion":return Bo;case"bool":case"boolean":return ks;case"string":return Vs}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function o2(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=s2(i.type);if(i.times===void 0){let t=[],r=[];Qt.flattenJSON(i.keys,t,r,"value"),i.times=t,i.values=r}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}var qa={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}},No=class{constructor(e,t,r){let n=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(h){a++,s===!1&&n.onStart!==void 0&&n.onStart(h,o,a),s=!0},this.itemEnd=function(h){o++,n.onProgress!==void 0&&n.onProgress(h,o,a),o===a&&(s=!1,n.onLoad!==void 0&&n.onLoad())},this.itemError=function(h){n.onError!==void 0&&n.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){let u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,f=c.length;u<f;u+=2){let d=c[u],p=c[u+1];if(d.global&&(d.lastIndex=0),d.test(h))return p}return null}}},a2=new No,cn=class{constructor(e){this.manager=e!==void 0?e:a2,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let r=this;return new Promise(function(n,s){r.load(e,n,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}},$i={},as=class extends cn{constructor(e){super(e)}load(e,t,r,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=qa.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if($i[e]!==void 0){$i[e].push({onLoad:t,onProgress:r,onError:n});return}$i[e]=[],$i[e].push({onLoad:t,onProgress:r,onError:n});let o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;let h=$i[e],u=c.body.getReader(),f=c.headers.get("Content-Length"),d=f?parseInt(f):0,p=d!==0,m=0,g=new ReadableStream({start(v){y();function y(){u.read().then(({done:w,value:b})=>{if(w)v.close();else{m+=b.byteLength;let S=new ProgressEvent("progress",{lengthComputable:p,loaded:m,total:d});for(let T=0,A=h.length;T<A;T++){let x=h[T];x.onProgress&&x.onProgress(S)}v.enqueue(b),y()}})}}});return new Response(g)}else throw Error(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,a));case"json":return c.json();default:if(a===void 0)return c.text();{let u=/charset="?([^;"\s]*)"?/i.exec(a),f=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(f);return c.arrayBuffer().then(p=>d.decode(p))}}}).then(c=>{qa.add(e,c);let h=$i[e];delete $i[e];for(let u=0,f=h.length;u<f;u++){let d=h[u];d.onLoad&&d.onLoad(c)}}).catch(c=>{let h=$i[e];if(h===void 0)throw this.manager.itemError(e),c;delete $i[e];for(let u=0,f=h.length;u<f;u++){let d=h[u];d.onError&&d.onError(c)}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}};var zf=class extends cn{constructor(e){super(e)}load(e,t,r,n){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=qa.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;let a=jc("img");function l(){h(),qa.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(u){h(),n&&n(u),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}},Lg=class extends cn{constructor(e){super(e)}load(e,t,r,n){let s=new Fs,o=new zf(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(h){s.images[c]=h,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,n)}for(let c=0;c<e.length;++c)l(c);return s}};var Ig=class extends cn{constructor(e){super(e)}load(e,t,r,n){let s=new Dt,o=new zf(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)},r,n),s}},bn=class extends ot{constructor(e,t=1){super(),this.type="Light",this.color=new be(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let 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}};bn.prototype.isLight=!0;var Hs=class extends bn{constructor(e,t,r){super(e,r),this.type="HemisphereLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.groundColor=new be(t)}copy(e){return bn.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}};Hs.prototype.isHemisphereLight=!0;var eb=new Ae,tb=new M,rb=new M,oh=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new B(512,512),this.map=null,this.mapPass=null,this.matrix=new Ae,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Na,this._frameExtents=new B(1,1),this._viewportCount=1,this._viewports=[new Je(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,r=this.matrix;tb.setFromMatrixPosition(e.matrixWorld),t.position.copy(tb),rb.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(rb),t.updateMatrixWorld(),eb.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(eb),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(t.projectionMatrix),r.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(){let 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}},Gf=class extends oh{constructor(){super(new sr(50,1,.5,500)),this.focus=1}updateMatrices(e){let t=this.camera,r=Wc*2*e.angle*this.focus,n=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(r!==t.fov||n!==t.aspect||s!==t.far)&&(t.fov=r,t.aspect=n,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}};Gf.prototype.isSpotLightShadow=!0;var ah=class extends bn{constructor(e,t,r=0,n=Math.PI/3,s=0,o=1){super(e,t),this.type="SpotLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.target=new ot,this.distance=r,this.angle=n,this.penumbra=s,this.decay=o,this.shadow=new Gf}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}};ah.prototype.isSpotLight=!0;var nb=new Ae,Rc=new M,$m=new M,kf=class extends oh{constructor(){super(new sr(90,1,.5,500)),this._frameExtents=new B(4,2),this._viewportCount=6,this._viewports=[new Je(2,1,1,1),new Je(0,1,1,1),new Je(3,1,1,1),new Je(1,1,1,1),new Je(3,0,1,1),new Je(1,0,1,1)],this._cubeDirections=[new M(1,0,0),new M(-1,0,0),new M(0,0,1),new M(0,0,-1),new M(0,1,0),new M(0,-1,0)],this._cubeUps=[new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,0,1),new M(0,0,-1)]}updateMatrices(e,t=0){let r=this.camera,n=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),Rc.setFromMatrixPosition(e.matrixWorld),r.position.copy(Rc),$m.copy(r.position),$m.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt($m),r.updateMatrixWorld(),n.makeTranslation(-Rc.x,-Rc.y,-Rc.z),nb.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(nb)}};kf.prototype.isPointLightShadow=!0;var lh=class extends bn{constructor(e,t,r=0,n=1){super(e,t),this.type="PointLight",this.distance=r,this.decay=n,this.shadow=new kf}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}};lh.prototype.isPointLight=!0;var Vf=class extends oh{constructor(){super(new Co(-5,5,5,-5,.5,500))}};Vf.prototype.isDirectionalLightShadow=!0;var ch=class extends bn{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.target=new ot,this.shadow=new Vf}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};ch.prototype.isDirectionalLight=!0;var Rg=class extends bn{constructor(e,t){super(e,t),this.type="AmbientLight"}};Rg.prototype.isAmbientLight=!0;var Bg=class extends bn{constructor(e,t,r=10,n=10){super(e,t),this.type="RectAreaLight",this.width=r,this.height=n}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){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}};Bg.prototype.isRectAreaLight=!0;var Hf=class{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new M)}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){let r=e.x,n=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*n),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*r),t.addScaledVector(o[4],1.092548*(r*n)),t.addScaledVector(o[5],1.092548*(n*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(r*s)),t.addScaledVector(o[8],.546274*(r*r-n*n)),t}getIrradianceAt(e,t){let r=e.x,n=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*n),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*r),t.addScaledVector(o[4],2*.429043*r*n),t.addScaledVector(o[5],2*.429043*n*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*r*s),t.addScaledVector(o[8],.429043*(r*r-n*n)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],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){let r=this.coefficients;for(let n=0;n<9;n++)r[n].fromArray(e,t+n*3);return this}toArray(e=[],t=0){let r=this.coefficients;for(let n=0;n<9;n++)r[n].toArray(e,t+n*3);return e}static getBasisAt(e,t){let r=e.x,n=e.y,s=e.z;t[0]=.282095,t[1]=.488603*n,t[2]=.488603*s,t[3]=.488603*r,t[4]=1.092548*r*n,t[5]=1.092548*n*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*r*s,t[8]=.546274*(r*r-n*n)}};Hf.prototype.isSphericalHarmonics3=!0;var hh=class extends bn{constructor(e=new Hf,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){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};hh.prototype.isLightProbe=!0;var Ng=class{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,n=e.length;r<n;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},Wf=class extends Le{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(){let e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};Wf.prototype.isInstancedBufferGeometry=!0;var Ws=class extends cn{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new as(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){n?n(l):console.error(l),s.manager.itemError(e)}},r,n)}parse(e){let t={},r={};function n(d,p){if(t[p]!==void 0)return t[p];let g=d.interleavedBuffers[p],v=s(d,g.buffer),y=_u(g.type,v),w=new ss(y,g.stride);return w.uuid=g.uuid,t[p]=w,w}function s(d,p){if(r[p]!==void 0)return r[p];let g=d.arrayBuffers[p],v=new Uint32Array(g).buffer;return r[p]=v,v}let o=e.isInstancedBufferGeometry?new Wf:new Le,a=e.data.index;if(a!==void 0){let d=_u(a.type,a.array);o.setIndex(new Ve(d,1))}let l=e.data.attributes;for(let d in l){let p=l[d],m;if(p.isInterleavedBufferAttribute){let g=n(e.data,p.data);m=new _i(g,p.itemSize,p.offset,p.normalized)}else{let g=_u(p.type,p.array),v=p.isInstancedBufferAttribute?Oa:Ve;m=new v(g,p.itemSize,p.normalized)}p.name!==void 0&&(m.name=p.name),p.usage!==void 0&&m.setUsage(p.usage),p.updateRange!==void 0&&(m.updateRange.offset=p.updateRange.offset,m.updateRange.count=p.updateRange.count),o.setAttribute(d,m)}let c=e.data.morphAttributes;if(c)for(let d in c){let p=c[d],m=[];for(let g=0,v=p.length;g<v;g++){let y=p[g],w;if(y.isInterleavedBufferAttribute){let b=n(e.data,y.data);w=new _i(b,y.itemSize,y.offset,y.normalized)}else{let b=_u(y.type,y.array);w=new Ve(b,y.itemSize,y.normalized)}y.name!==void 0&&(w.name=y.name),m.push(w)}o.morphAttributes[d]=m}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);let u=e.data.groups||e.data.drawcalls||e.data.offsets;if(u!==void 0)for(let d=0,p=u.length;d!==p;++d){let m=u[d];o.addGroup(m.start,m.count,m.materialIndex)}let f=e.data.boundingSphere;if(f!==void 0){let d=new M;f.center!==void 0&&d.fromArray(f.center),o.boundingSphere=new Lr(d,f.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}};var Og=class extends cn{constructor(e){super(e),typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=qa.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;let 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){qa.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){n&&n(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}};Og.prototype.isImageBitmapLoader=!0;var sf,l2={getContext:function(){return sf===void 0&&(sf=new(window.AudioContext||window.webkitAudioContext)),sf},setContext:function(i){sf=i}},Fg=class extends cn{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new as(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{let l=a.slice(0);l2.getContext().decodeAudioData(l,function(h){t(h)})}catch(l){n?n(l):console.error(l),s.manager.itemError(e)}},r,n)}},Ug=class extends hh{constructor(e,t,r=1){super(void 0,r);let n=new be().set(e),s=new be().set(t),o=new M(n.r,n.g,n.b),a=new M(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)}};Ug.prototype.isHemisphereLightProbe=!0;var zg=class extends hh{constructor(e,t=1){super(void 0,t);let r=new be().set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}};zg.prototype.isAmbientLightProbe=!0;var jf=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=ib(),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){let t=ib();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function ib(){return(typeof performance>"u"?Date:performance).now()}var Gg=class extends ot{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;let 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}};var kg=class{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,t=this.getFrequencyData();for(let r=0;r<t.length;r++)e+=t[r];return e/t.length}},Vg=class{constructor(e,t,r){this.binding=e,this.valueSize=r;let n,s,o;switch(t){case"quaternion":n=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":n=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:n=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=n,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){let r=this.buffer,n=this.valueSize,s=e*n+n,o=this.cumulativeWeight;if(o===0){for(let a=0;a!==n;++a)r[s+a]=r[a];o=t}else{o+=t;let a=t/o;this._mixBufferRegion(r,s,0,a,n)}this.cumulativeWeight=o}accumulateAdditive(e){let t=this.buffer,r=this.valueSize,n=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,n,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,r=this.buffer,n=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){let l=t*this._origIndex;this._mixBufferRegion(r,n,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(r,n,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(r[l]!==r[l+t]){a.setValue(r,n);break}}saveOriginalState(){let e=this.binding,t=this.buffer,r=this.valueSize,n=r*this._origIndex;e.getValue(t,n);for(let s=r,o=n;s!==o;++s)t[s]=t[n+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r<t;r++)this.buffer[r]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let r=0;r<this.valueSize;r++)this.buffer[t+r]=this.buffer[e+r]}_select(e,t,r,n,s){if(n>=.5)for(let o=0;o!==s;++o)e[t+o]=e[r+o]}_slerp(e,t,r,n){zt.slerpFlat(e,t,e,t,e,r,n)}_slerpAdditive(e,t,r,n,s){let o=this._workIndex*s;zt.multiplyQuaternionsFlat(e,o,e,t,e,r),zt.slerpFlat(e,t,e,t,e,o,n)}_lerp(e,t,r,n,s){let o=1-n;for(let a=0;a!==s;++a){let l=t+a;e[l]=e[l]*o+e[r+a]*n}}_lerpAdditive(e,t,r,n,s){for(let o=0;o!==s;++o){let a=t+o;e[a]=e[a]+e[r+o]*n}}},ny="\\[\\]\\.:\\/",c2=new RegExp("["+ny+"]","g"),iy="[^"+ny+"]",h2="[^"+ny.replace("\\.","")+"]",u2=/((?:WC+[\/:])*)/.source.replace("WC",iy),f2=/(WCOD+)?/.source.replace("WCOD",h2),d2=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",iy),p2=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",iy),m2=new RegExp("^"+u2+f2+d2+p2+"$"),g2=["material","materials","bones"],Hg=class{constructor(e,t,r){let n=r||bt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}getValue(e,t){this.bind();let r=this._targetGroup.nCachedObjects_,n=this._bindings[r];n!==void 0&&n.getValue(e,t)}setValue(e,t){let r=this._bindings;for(let n=this._targetGroup.nCachedObjects_,s=r.length;n!==s;++n)r[n].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},bt=class{constructor(e,t,r){this.path=t,this.parsedPath=r||bt.parseTrackName(t),this.node=bt.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new bt.Composite(e,t,r):new bt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(c2,"")}static parseTrackName(e){let t=m2.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=r.nodeName&&r.nodeName.lastIndexOf(".");if(n!==void 0&&n!==-1){let s=r.nodeName.substring(n+1);g2.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,n),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){let r=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=r(a.children);if(l)return l}return null},n=r(e.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)e[t++]=r[n]}_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){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=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,t=this.parsedPath,r=t.objectName,n=t.propertyName,s=t.propertyIndex;if(e||(e=bt.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(r){let c=t.objectIndex;switch(r){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 h=0;h<e.length;h++)if(e[h].name===c){c=h;break}break;default:if(e[r]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}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]}}let o=e[n];if(o===void 0){let c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+n+" 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(n==="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=n;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}};bt.Composite=Hg;bt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};bt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};bt.prototype.GetterByBindingType=[bt.prototype._getValue_direct,bt.prototype._getValue_array,bt.prototype._getValue_arrayElement,bt.prototype._getValue_toArray];bt.prototype.SetterByBindingTypeAndVersioning=[[bt.prototype._setValue_direct,bt.prototype._setValue_direct_setNeedsUpdate,bt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[bt.prototype._setValue_array,bt.prototype._setValue_array_setNeedsUpdate,bt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[bt.prototype._setValue_arrayElement,bt.prototype._setValue_arrayElement_setNeedsUpdate,bt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[bt.prototype._setValue_fromArray,bt.prototype._setValue_fromArray_setNeedsUpdate,bt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Wg=class{constructor(){this.uuid=Un(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let r=0,n=arguments.length;r!==n;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let 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(){let e=this._objects,t=this._indicesByUUID,r=this._paths,n=this._parsedPaths,s=this._bindings,o=s.length,a,l=e.length,c=this.nCachedObjects_;for(let h=0,u=arguments.length;h!==u;++h){let f=arguments[h],d=f.uuid,p=t[d];if(p===void 0){p=l++,t[d]=p,e.push(f);for(let m=0,g=o;m!==g;++m)s[m].push(new bt(f,r[m],n[m]))}else if(p<c){a=e[p];let m=--c,g=e[m];t[g.uuid]=p,e[p]=g,t[d]=m,e[m]=f;for(let v=0,y=o;v!==y;++v){let w=s[v],b=w[m],S=w[p];w[p]=b,S===void 0&&(S=new bt(f,r[v],n[v])),w[m]=S}}else e[p]!==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(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,n=r.length,s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){let l=arguments[o],c=l.uuid,h=t[c];if(h!==void 0&&h>=s){let u=s++,f=e[u];t[f.uuid]=h,e[h]=f,t[c]=u,e[u]=l;for(let d=0,p=n;d!==p;++d){let m=r[d],g=m[u],v=m[h];m[h]=g,m[u]=v}}}this.nCachedObjects_=s}uncache(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,n=r.length,s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){let c=arguments[a],h=c.uuid,u=t[h];if(u!==void 0)if(delete t[h],u<s){let f=--s,d=e[f],p=--o,m=e[p];t[d.uuid]=u,e[u]=d,t[m.uuid]=f,e[f]=m,e.pop();for(let g=0,v=n;g!==v;++g){let y=r[g],w=y[f],b=y[p];y[u]=w,y[f]=b,y.pop()}}else{let f=--o,d=e[f];f>0&&(t[d.uuid]=u),e[u]=d,e.pop();for(let p=0,m=n;p!==m;++p){let g=r[p];g[u]=g[f],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){let r=this._bindingsIndicesByPath,n=r[e],s=this._bindings;if(n!==void 0)return s[n];let o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,h=this.nCachedObjects_,u=new Array(c);n=s.length,r[e]=n,o.push(e),a.push(t),s.push(u);for(let f=h,d=l.length;f!==d;++f){let p=l[f];u[f]=new bt(p,e,t)}return u}unsubscribe_(e){let t=this._bindingsIndicesByPath,r=t[e];if(r!==void 0){let n=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),n[r]=n[a],n.pop()}}};Wg.prototype.isAnimationObjectGroup=!0;var jg=class{constructor(e,t,r=null,n=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=n;let s=t.tracks,o=s.length,a=new Array(o),l={endingStart:_a,endingEnd:_a};for(let c=0;c!==o;++c){let h=s[c].createInterpolant(null);a[c]=h,h.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=DE,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,r){if(e.fadeOut(t),this.fadeIn(t),r){let n=this._clip.duration,s=e._clip.duration,o=s/n,a=n/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,r){return e.crossFadeFrom(this,t,r)}stopFading(){let 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,r){let n=this._mixer,s=n.time,o=this.timeScale,a=this._timeScaleInterpolant;a===null&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);let l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/o,c[1]=t/o,this}stopWarping(){let 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,r,n){if(!this.enabled){this._updateWeight(e);return}let s=this._startTime;if(s!==null){let l=(e-s)*r;if(l<0||r===0)return;this._startTime=null,t=r*l}t*=this._updateTimeScale(e);let o=this._updateTime(t),a=this._updateWeight(e);if(a>0){let l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case gb:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(o),c[h].accumulateAdditive(a);break;case $g:default:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(o),c[h].accumulate(n,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let r=this._weightInterpolant;if(r!==null){let n=r.evaluate(e)[0];t*=n,e>r.parameterPositions[1]&&(this.stopFading(),n===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let r=this._timeScaleInterpolant;r!==null&&(t*=r.evaluate(e)[0],e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,r=this.loop,n=this.time+e,s=this._loopCount,o=r===PE;if(e===0)return s===-1?n:o&&(s&1)===1?t-n:n;if(r===CE){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n>=t)n=t;else if(n<0)n=0;else{this.time=n;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,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)),n>=t||n<0){let a=Math.floor(n/t);n-=t*a,s+=Math.abs(a);let l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=e>0?t:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){let c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=n;if(o&&(s&1)===1)return t-n}return n}_setEndings(e,t,r){let n=this._interpolantSettings;r?(n.endingStart=Ca,n.endingEnd=Ca):(e?n.endingStart=this.zeroSlopeAtStart?Ca:_a:n.endingStart=df,t?n.endingEnd=this.zeroSlopeAtEnd?Ca:_a:n.endingEnd=df)}_scheduleFading(e,t,r){let n=this._mixer,s=n.time,o=this._weightInterpolant;o===null&&(o=n._lendControlInterpolant(),this._weightInterpolant=o);let a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=r,this}},qg=class extends Yt{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let r=e._localRoot||this._root,n=e._clip.tracks,s=n.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName,h=c[l];h===void 0&&(h={},c[l]=h);for(let u=0;u!==s;++u){let f=n[u],d=f.name,p=h[d];if(p!==void 0)++p.referenceCount,o[u]=p;else{if(p=o[u],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,d));continue}let m=t&&t._propertyBindings[u].binding.parsedPath;p=new Vg(bt.create(r,d,m),f.ValueTypeName,f.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,d),o[u]=p}a[u].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let r=(e._localRoot||this._root).uuid,n=e._clip.uuid,s=this._actionsByClip[n];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,n,r)}let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];--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;let 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){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,r){let n=this._actions,s=this._actionsByClip,o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{let a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=n.length,n.push(e),o.actionByRoot[r]=e}_removeInactiveAction(e){let t=this._actions,r=t[t.length-1],n=e._cacheIndex;r._cacheIndex=n,t[n]=r,t.pop(),e._cacheIndex=null;let s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],h=e._byClipCacheIndex;c._byClipCacheIndex=h,l[h]=c,l.pop(),e._byClipCacheIndex=null;let u=a.actionByRoot,f=(e._localRoot||this._root).uuid;delete u[f],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){let t=this._actions,r=e._cacheIndex,n=this._nActiveActions++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_takeBackAction(e){let t=this._actions,r=e._cacheIndex,n=--this._nActiveActions,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_addInactiveBinding(e,t,r){let n=this._bindingsByRootAndName,s=this._bindings,o=n[t];o===void 0&&(o={},n[t]=o),o[r]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){let t=this._bindings,r=e.binding,n=r.rootNode.uuid,s=r.path,o=this._bindingsByRootAndName,a=o[n],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[n]}_lendBinding(e){let t=this._bindings,r=e._cacheIndex,n=this._nActiveBindings++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_takeBackBinding(e){let t=this._bindings,r=e._cacheIndex,n=--this._nActiveBindings,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return r===void 0&&(r=new Of(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=t,e[t]=r),r}_takeBackControlInterpolant(e){let t=this._controlInterpolants,r=e.__cacheIndex,n=--this._nActiveControlInterpolants,s=t[n];e.__cacheIndex=n,t[n]=e,s.__cacheIndex=r,t[r]=s}clipAction(e,t,r){let n=t||this._root,s=n.uuid,o=typeof e=="string"?Uf.findByName(n,e):e,a=o!==null?o.uuid:e,l=this._actionsByClip[a],c=null;if(r===void 0&&(o!==null?r=o.blendMode:r=$g),l!==void 0){let u=l.actionByRoot[s];if(u!==void 0&&u.blendMode===r)return u;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;let h=new jg(this,o,t,r);return this._bindAction(h,c),this._addInactiveAction(h,a,s),h}existingAction(e,t){let r=t||this._root,n=r.uuid,s=typeof e=="string"?Uf.findByName(r,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[n]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let r=t-1;r>=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;let t=this._actions,r=this._nActiveActions,n=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)t[c]._update(n,e,s,o);let 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){let t=this._actions,r=e.uuid,n=this._actionsByClip,s=n[r];if(s!==void 0){let o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){let c=o[a];this._deactivateAction(c);let h=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=h,t[h]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete n[r]}}uncacheRoot(e){let t=e.uuid,r=this._actionsByClip;for(let o in r){let a=r[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}let n=this._bindingsByRootAndName,s=n[t];if(s!==void 0)for(let o in s){let a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){let r=this.existingAction(e,t);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}};qg.prototype._controlInterpolantsResultBuffer=new Float32Array(1);var _e=class{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new _e(this.value.clone===void 0?this.value:this.value.clone())}},Yg=class extends ss{constructor(e,t,r=1){super(e,t),this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};Yg.prototype.isInstancedInterleavedBuffer=!0;var Xg=class{constructor(e,t,r,n,s){this.buffer=e,this.type=t,this.itemSize=r,this.elementSize=n,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}};Xg.prototype.isGLBufferAttribute=!0;var qf=class{constructor(e,t,r=0,n=1/0){this.ray=new si(e,t),this.near=r,this.far=n,this.camera=null,this.layers=new Yc,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,r=[]){return Qg(e,this,r,t),r.sort(sb),r}intersectObjects(e,t=!0,r=[]){for(let n=0,s=e.length;n<s;n++)Qg(e[n],this,r,t);return r.sort(sb),r}};function sb(i,e){return i.distance-e.distance}function Qg(i,e,t,r){if(i.layers.test(e.layers)&&i.raycast(e,t),r===!0){let n=i.children;for(let s=0,o=n.length;s<o;s++)Qg(n[s],e,t,!0)}}var uh=class{constructor(e=1,t=0,r=0){return this.radius=e,this.phi=t,this.theta=r,this}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,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,r){return this.radius=Math.sqrt(e*e+t*t+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(xr(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var ob=new B,Oo=class{constructor(e=new B(1/0,1/0),t=new B(-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,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=ob.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),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 ob.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)}};Oo.prototype.isBox2=!0;var ab=new M,of=new M,Jr=class{constructor(e=new M,t=new M){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){ab.subVectors(e,this.start),of.subVectors(this.end,this.start);let r=of.dot(of),s=of.dot(ab)/r;return t&&(s=xr(s,0,1)),s}closestPointToPoint(e,t,r){let n=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(n).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)}},lb=new M,Yf=class extends ot{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;let r=new Le,n=[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++){let c=o/l*Math.PI*2,h=a/l*Math.PI*2;n.push(Math.cos(c),Math.sin(c),1,Math.cos(h),Math.sin(h),1)}r.setAttribute("position",new Ce(n,3));let s=new kr({fog:!1,toneMapped:!1});this.cone=new ai(r,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),lb.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(lb),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Cs=new M,af=new Ae,eg=new Ae,Jg=class extends ai{constructor(e){let t=Rb(e),r=new Le,n=[],s=[],o=new be(0,0,1),a=new be(0,1,0);for(let c=0;c<t.length;c++){let h=t[c];h.parent&&h.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}r.setAttribute("position",new Ce(n,3)),r.setAttribute("color",new Ce(s,3));let l=new kr({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,l),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){let t=this.bones,r=this.geometry,n=r.getAttribute("position");eg.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){let a=t[s];a.parent&&a.parent.isBone&&(af.multiplyMatrices(eg,a.matrixWorld),Cs.setFromMatrixPosition(af),n.setXYZ(o,Cs.x,Cs.y,Cs.z),af.multiplyMatrices(eg,a.parent.matrixWorld),Cs.setFromMatrixPosition(af),n.setXYZ(o+1,Cs.x,Cs.y,Cs.z),o+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}};function Rb(i){let e=[];i.isBone===!0&&e.push(i);for(let t=0;t<i.children.length;t++)e.push.apply(e,Rb(i.children[t]));return e}var Xf=class extends Vt{constructor(e,t,r){let n=new Ro(t,4,2),s=new zn({wireframe:!0,fog:!1,toneMapped:!1});super(n,s),this.light=e,this.light.updateMatrixWorld(),this.color=r,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)}};var Kg=class extends ai{constructor(e=10,t=10,r=4473924,n=8947848){r=new be(r),n=new be(n);let s=t/2,o=e/t,a=e/2,l=[],c=[];for(let f=0,d=0,p=-a;f<=t;f++,p+=o){l.push(-a,0,p,a,0,p),l.push(p,0,-a,p,0,a);let m=f===s?r:n;m.toArray(c,d),d+=3,m.toArray(c,d),d+=3,m.toArray(c,d),d+=3,m.toArray(c,d),d+=3}let h=new Le;h.setAttribute("position",new Ce(l,3)),h.setAttribute("color",new Ce(c,3));let u=new kr({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}};var cb=new M,lf=new M,hb=new M,Qf=class extends ot{constructor(e,t,r){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,t===void 0&&(t=1);let n=new Le;n.setAttribute("position",new Ce([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let s=new kr({fog:!1,toneMapped:!1});this.lightPlane=new os(n,s),this.add(this.lightPlane),n=new Le,n.setAttribute("position",new Ce([0,0,0,0,0,1],3)),this.targetLine=new os(n,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(){cb.setFromMatrixPosition(this.light.matrixWorld),lf.setFromMatrixPosition(this.light.target.matrixWorld),hb.subVectors(lf,cb),this.lightPlane.lookAt(lf),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(lf),this.targetLine.scale.z=hb.length()}},cf=new M,ir=new Gn,Hn=class extends ai{constructor(e){let t=new Le,r=new kr({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],o={},a=new be(16755200),l=new be(16711680),c=new be(43775),h=new be(16777215),u=new be(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",h),f("p","c",u),f("cn1","cn2",u),f("cn3","cn4",u),f("cf1","cf2",u),f("cf3","cf4",u);function f(p,m,g){d(p,g),d(m,g)}function d(p,m){n.push(0,0,0),s.push(m.r,m.g,m.b),o[p]===void 0&&(o[p]=[]),o[p].push(n.length/3-1)}t.setAttribute("position",new Ce(n,3)),t.setAttribute("color",new Ce(s,3)),super(t,r),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(){let e=this.geometry,t=this.pointMap,r=1,n=1;ir.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),cr("c",t,e,ir,0,0,-1),cr("t",t,e,ir,0,0,1),cr("n1",t,e,ir,-r,-n,-1),cr("n2",t,e,ir,r,-n,-1),cr("n3",t,e,ir,-r,n,-1),cr("n4",t,e,ir,r,n,-1),cr("f1",t,e,ir,-r,-n,1),cr("f2",t,e,ir,r,-n,1),cr("f3",t,e,ir,-r,n,1),cr("f4",t,e,ir,r,n,1),cr("u1",t,e,ir,r*.7,n*1.1,-1),cr("u2",t,e,ir,-r*.7,n*1.1,-1),cr("u3",t,e,ir,0,n*2,-1),cr("cf1",t,e,ir,-r,0,1),cr("cf2",t,e,ir,r,0,1),cr("cf3",t,e,ir,0,-n,1),cr("cf4",t,e,ir,0,n,1),cr("cn1",t,e,ir,-r,0,-1),cr("cn2",t,e,ir,r,0,-1),cr("cn3",t,e,ir,0,-n,-1),cr("cn4",t,e,ir,0,n,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function cr(i,e,t,r,n,s,o){cf.set(n,s,o).unproject(r);let a=e[i];if(a!==void 0){let l=t.getAttribute("position");for(let c=0,h=a.length;c<h;c++)l.setXYZ(a[c],cf.x,cf.y,cf.z)}}var Fo=class extends ai{constructor(e,t=16776960){let r=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]),n=[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 Le;s.setIndex(new Ve(r,1)),s.setAttribute("position",new Ce(n,3)),super(s,new kr({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){let t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}};var Jf=class extends ai{constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],n=new Le;n.setAttribute("position",new Ce(t,3)),n.setAttribute("color",new Ce(r,3));let s=new kr({vertexColors:!0,toneMapped:!1});super(n,s),this.type="AxesHelper"}setColors(e,t,r){let n=new be,s=this.geometry.attributes.color.array;return n.set(e),n.toArray(s,0),n.toArray(s,3),n.set(t),n.toArray(s,6),n.toArray(s,9),n.set(r),n.toArray(s,12),n.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},Kf=class{constructor(){this.type="ShapePath",this.color=new be,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Fa,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,n){return this.currentPath.quadraticCurveTo(e,t,r,n),this}bezierCurveTo(e,t,r,n,s,o){return this.currentPath.bezierCurveTo(e,t,r,n,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function r(y){let w=[];for(let b=0,S=y.length;b<S;b++){let T=y[b],A=new rn;A.curves=T.curves,w.push(A)}return w}function n(y,w){let b=w.length,S=!1;for(let T=b-1,A=0;A<b;T=A++){let x=w[T],E=w[A],_=E.x-x.x,C=E.y-x.y;if(Math.abs(C)>Number.EPSILON){if(C<0&&(x=w[A],_=-_,E=w[T],C=-C),y.y<x.y||y.y>E.y)continue;if(y.y===x.y){if(y.x===x.x)return!0}else{let I=C*(y.x-x.x)-_*(y.y-x.y);if(I===0)return!0;if(I<0)continue;S=!S}}else{if(y.y!==x.y)continue;if(E.x<=y.x&&y.x<=x.x||x.x<=y.x&&y.x<=E.x)return!0}}return S}let s=ni.isClockWise,o=this.subPaths;if(o.length===0)return[];if(t===!0)return r(o);let a,l,c,h=[];if(o.length===1)return l=o[0],c=new rn,c.curves=l.curves,h.push(c),h;let u=!s(o[0].getPoints());u=e?!u:u;let f=[],d=[],p=[],m=0,g;d[m]=void 0,p[m]=[];for(let y=0,w=o.length;y<w;y++)l=o[y],g=l.getPoints(),a=s(g),a=e?!a:a,a?(!u&&d[m]&&m++,d[m]={s:new rn,p:g},d[m].s.curves=l.curves,u&&m++,p[m]=[]):p[m].push({h:l,p:g[0]});if(!d[0])return r(o);if(d.length>1){let y=!1,w=0;for(let b=0,S=d.length;b<S;b++)f[b]=[];for(let b=0,S=d.length;b<S;b++){let T=p[b];for(let A=0;A<T.length;A++){let x=T[A],E=!0;for(let _=0;_<d.length;_++)n(x.p,d[_].p)&&(b!==_&&w++,E?(E=!1,f[_].push(x)):y=!0);E&&f[b].push(x)}}w>0&&y===!1&&(p=f)}let v;for(let y=0,w=d.length;y<w;y++){c=d[y].s,h.push(c),v=p[y];for(let b=0,S=v.length;b<S;b++)c.holes.push(v[b].h)}return h}};var Bb=new ArrayBuffer(4),yG=new Float32Array(Bb),vG=new Uint32Array(Bb),Ai=new Uint32Array(512),Ti=new Uint32Array(512);for(let i=0;i<256;++i){let e=i-127;e<-27?(Ai[i]=0,Ai[i|256]=32768,Ti[i]=24,Ti[i|256]=24):e<-14?(Ai[i]=1024>>-e-14,Ai[i|256]=1024>>-e-14|32768,Ti[i]=-e-1,Ti[i|256]=-e-1):e<=15?(Ai[i]=e+15<<10,Ai[i|256]=e+15<<10|32768,Ti[i]=13,Ti[i|256]=13):e<128?(Ai[i]=31744,Ai[i|256]=64512,Ti[i]=24,Ti[i|256]=24):(Ai[i]=31744,Ai[i|256]=64512,Ti[i]=13,Ti[i|256]=13)}var Nb=new Uint32Array(2048),fh=new Uint32Array(64),y2=new Uint32Array(64);for(let i=1;i<1024;++i){let e=i<<13,t=0;for(;(e&8388608)===0;)e<<=1,t-=8388608;e&=-8388609,t+=947912704,Nb[i]=e|t}for(let i=1024;i<2048;++i)Nb[i]=939524096+(i-1024<<13);for(let i=1;i<31;++i)fh[i]=i<<23;fh[31]=1199570944;fh[32]=2147483648;for(let i=33;i<63;++i)fh[i]=2147483648+(i-32<<23);fh[63]=3347054592;for(let i=1;i<64;++i)i!==32&&(y2[i]=1024);xn.create=function(i,e){return console.log("THREE.Curve.create() has been deprecated"),i.prototype=Object.create(xn.prototype),i.prototype.constructor=i,i.prototype.getPoint=e,i};Fa.prototype.fromPoints=function(i){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(i)};Kg.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Jg.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};cn.prototype.extractUrlBase=function(i){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Ng.extractUrlBase(i)};cn.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.")}};Oo.prototype.center=function(i){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(i)};Oo.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Oo.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};Oo.prototype.size=function(i){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(i)};Kt.prototype.center=function(i){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Kt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Kt.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};Kt.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};Kt.prototype.size=function(i){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(i)};yn.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")};Lr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Na.prototype.setFromMatrix=function(i){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(i)};Jr.prototype.center=function(i){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Ft.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Ft.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Ft.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Ft.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Ft.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Ft.prototype.getInverse=function(i){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};Ae.prototype.extractPosition=function(i){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(i)};Ae.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Ae.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new M().setFromMatrixColumn(this,3)};Ae.prototype.setRotationFromQuaternion=function(i){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(i)};Ae.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};Ae.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ae.prototype.multiplyVector4=function(i){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ae.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};Ae.prototype.rotateAxis=function(i){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),i.transformDirection(this)};Ae.prototype.crossVector=function(i){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ae.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};Ae.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};Ae.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};Ae.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};Ae.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};Ae.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ae.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};Ae.prototype.makeFrustum=function(i,e,t,r,n,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(i,e,r,t,n,s)};Ae.prototype.getInverse=function(i){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};Gr.prototype.isIntersectionLine=function(i){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(i)};zt.prototype.multiplyVector3=function(i){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),i.applyQuaternion(this)};zt.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};si.prototype.isIntersectionBox=function(i){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};si.prototype.isIntersectionPlane=function(i){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(i)};si.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};Jt.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};Jt.prototype.barycoordFromPoint=function(i,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(i,e)};Jt.prototype.midpoint=function(i){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(i)};Jt.prototypenormal=function(i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(i)};Jt.prototype.plane=function(i){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(i)};Jt.barycoordFromPoint=function(i,e,t,r,n){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Jt.getBarycoord(i,e,t,r,n)};Jt.normal=function(i,e,t,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Jt.getNormal(i,e,t,r)};rn.prototype.extractAllPoints=function(i){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(i)};rn.prototype.extrude=function(i){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Gs(this,i)};rn.prototype.makeGeometry=function(i){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Io(this,i)};B.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};B.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};B.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};M.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};M.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};M.prototype.getPositionFromMatrix=function(i){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(i)};M.prototype.getScaleFromMatrix=function(i){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(i)};M.prototype.getColumnFromMatrix=function(i,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,i)};M.prototype.applyProjection=function(i){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(i)};M.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};M.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};M.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Je.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};Je.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};ot.prototype.getChildByName=function(i){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(i)};ot.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};ot.prototype.translate=function(i,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,i)};ot.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};ot.prototype.applyMatrix=function(i){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(ot.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(i){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=i}},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.")}}});Vt.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(Vt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),yb},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.")}}});wf.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};sr.prototype.setLens=function(i,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(i)};Object.defineProperties(bn.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(i){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=i}},shadowCameraLeft:{set:function(i){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=i}},shadowCameraRight:{set:function(i){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=i}},shadowCameraTop:{set:function(i){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=i}},shadowCameraBottom:{set:function(i){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=i}},shadowCameraNear:{set:function(i){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=i}},shadowCameraFar:{set:function(i){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=i}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(i){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=i}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(i){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=i}},shadowMapHeight:{set:function(i){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=i}}});Object.defineProperties(Ve.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===pf},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(pf)}}});Ve.prototype.setDynamic=function(i){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?pf:Hc),this};Ve.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Ve.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Le.prototype.addIndex=function(i){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(i)};Le.prototype.addAttribute=function(i,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(i,new Ve(arguments[1],arguments[2]))):i==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(i,e)};Le.prototype.addDrawCall=function(i,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(i,e)};Le.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};Le.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};Le.prototype.removeAttribute=function(i){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(i)};Le.prototype.applyMatrix=function(i){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(Le.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}}});ss.prototype.setDynamic=function(i){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?pf:Hc),this};ss.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Gs.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};Gs.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};Gs.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};on.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};_e.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(ur.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 be}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(i){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=i===fb}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(i){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=i}},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(Mt.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(i){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=i}}});Pt.prototype.clearTarget=function(i,e,t,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(i),this.clear(e,t,r)};Pt.prototype.animate=function(i){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(i)};Pt.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};Pt.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};Pt.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};Pt.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};Pt.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};Pt.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};Pt.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};Pt.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};Pt.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};Pt.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};Pt.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};Pt.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};Pt.prototype.enableScissorTest=function(i){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(i)};Pt.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};Pt.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};Pt.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};Pt.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Pt.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};Pt.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};Pt.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};Pt.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};Pt.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};Pt.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(Pt.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(i){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=i}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(i){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=i}},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(i){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=i===!0?je:gn}},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(_b.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.")}}});Object.defineProperties(mt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(i){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=i}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(i){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=i}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(i){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=i}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(i){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=i}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(i){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=i}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(i){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=i}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(i){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=i}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(i){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=i}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(i){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=i}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(i){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=i}}});Gg.prototype.load=function(i){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");let e=this;return new Fg().load(i,function(r){e.setBuffer(r)}),this};kg.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Xc.prototype.updateCubeMap=function(i,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(i,e)};Xc.prototype.clear=function(i,e,t,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(i,e,t,r)};ns.crossOrigin=void 0;ns.loadTexture=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");let n=new Ig;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};ns.loadTextureCube=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");let n=new Lg;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};ns.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};ns.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var Zf=class extends mt{constructor(e,t,r){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,r),this.samples=4}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Uo}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Uo);var Ja=".",dh=Symbol("target"),sy=Symbol("unsubscribe");function ph(i){return i instanceof Date||i instanceof Set||i instanceof Map||i instanceof WeakSet||i instanceof WeakMap||ArrayBuffer.isView(i)}function Ob(i){return(typeof i=="object"?i===null:typeof i!="function")||i instanceof RegExp}var Dn=Array.isArray;function zo(i){return typeof i=="symbol"}var v2={after:(i,e)=>Dn(i)?i.slice(e.length):e===""?i:i.slice(e.length+1),concat:(i,e)=>Dn(i)?(i=[...i],e&&i.push(e),i):e&&e.toString!==void 0?(i!==""&&(i+=Ja),zo(e)?i+e.toString():i+e):i,initial:i=>{if(Dn(i))return i.slice(0,-1);if(i==="")return i;let e=i.lastIndexOf(Ja);return e===-1?"":i.slice(0,e)},last:i=>{if(Dn(i))return i[i.length-1]||"";if(i==="")return i;let e=i.lastIndexOf(Ja);return e===-1?i:i.slice(e+1)},walk:(i,e)=>{if(Dn(i))for(let t of i)e(t);else if(i!==""){let t=0,r=i.indexOf(Ja);if(r===-1)e(i);else for(;t<i.length;)r===-1&&(r=i.length),e(i.slice(t,r)),t=r+1,r=i.indexOf(Ja,t)}},get(i,e){return this.walk(e,t=>{i&&(i=i[t])}),i}},hn=v2;function oy(i){return typeof i=="object"&&typeof i.next=="function"}function ay(i,e,t,r,n){let s=i.next;if(e.name==="entries")i.next=function(){let o=s.call(this);return o.done===!1&&(o.value[0]=n(o.value[0],e,o.value[0],r),o.value[1]=n(o.value[1],e,o.value[0],r)),o};else if(e.name==="values"){let o=t[dh].keys();i.next=function(){let a=s.call(this);return a.done===!1&&(a.value=n(a.value,e,o.next().value,r)),a}}else i.next=function(){let o=s.call(this);return o.done===!1&&(o.value=n(o.value,e,o.value,r)),o};return i}function rd(i,e,t){return i.isUnsubscribed||e.ignoreSymbols&&zo(t)||e.ignoreUnderscores&&t.charAt(0)==="_"||"ignoreKeys"in e&&e.ignoreKeys.includes(t)}var mh=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return this._descriptorCache===void 0&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),r=t.get(e);return r===void 0&&(r={},t.set(e,r)),r}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let r=this._getProperties(e),n=r[t];return n===void 0&&(n=Reflect.getOwnPropertyDescriptor(e,t),r[t]=n),n}getProxy(e,t,r,n){if(this.isUnsubscribed)return e;let s=e[n],o=s||e;this._pathCache.set(o,t);let a=this._proxyCache.get(o);return a===void 0&&(a=s===void 0?new Proxy(e,r):e,this._proxyCache.set(o,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,hn.get(t,this.getPath(e)))}defineProperty(e,t,r){return Reflect.defineProperty(e,t,r)?(this.isUnsubscribed||(this._getProperties(e)[t]=r),!0):!1}setProperty(e,t,r,n,s){if(!this._equals(s,r)||!(t in e)){let o=this._getOwnPropertyDescriptor(e,t);return o!==void 0&&"set"in o?Reflect.set(e,t,r,n):Reflect.set(e,t,r)}return!0}deleteProperty(e,t,r){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let n=this._getDescriptorCache().get(e);n&&(delete n[t],this._pathCache.delete(r))}return!0}return!1}isSameDescriptor(e,t,r){let n=this._getOwnPropertyDescriptor(t,r);return e!==void 0&&n!==void 0&&Object.is(e.value,n.value)&&(e.writable||!1)===(n.writable||!1)&&(e.enumerable||!1)===(n.enumerable||!1)&&(e.configurable||!1)===(n.configurable||!1)&&e.get===n.get&&e.set===n.set}isGetInvariant(e,t){let r=this._getOwnPropertyDescriptor(e,t);return r!==void 0&&r.configurable!==!0&&r.writable!==!0}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function Ka(i){return toString.call(i)==="[object Object]"}function Za(){return!0}function qs(i,e){return i.length!==e.length||i.some((t,r)=>e[r]!==t)}var nd=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]);var x2=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),ly={push:Za,pop:Za,shift:Za,unshift:Za,copyWithin:qs,reverse:qs,sort:qs,splice:qs,flat:qs,fill:qs},Fb=new Set([...nd,...x2,...Object.keys(ly)]);function $a(i,e){if(i.size!==e.size)return!0;for(let t of i)if(!e.has(t))return!0;return!1}var cy=["keys","values","entries"],hy=new Set(["has","toString"]),uy={add:$a,clear:$a,delete:$a,forEach:$a},Ub=new Set([...hy,...Object.keys(uy),...cy]);function el(i,e){if(i.size!==e.size)return!0;let t;for(let[r,n]of i)if(t=e.get(r),t!==n||t===void 0&&!e.has(r))return!0;return!1}var b2=new Set([...hy,"get"]),fy={set:el,clear:el,delete:el,forEach:el},zb=new Set([...b2,...Object.keys(fy),...cy]);var Rr=class{constructor(e,t,r,n){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=n,this._changes=n?[]:null,this.clone=t===void 0?e:this._shallowClone(e)}static isHandledMethod(e){return nd.has(e)}_shallowClone(e){let t=e;if(Ka(e))t=ie({},e);else if(Dn(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(r=>this._shallowClone(r)));else if(e instanceof Map){t=new Map;for(let[r,n]of e.entries())t.set(r,this._shallowClone(n))}return this._clonedCache.add(t),t}preferredThisArg(e,t,r,n){return e?(Dn(n)?this._onIsChanged=ly[t]:n instanceof Set?this._onIsChanged=uy[t]:n instanceof Map&&(this._onIsChanged=fy[t]),n):r}update(e,t,r){let n=hn.after(e,this._path);if(t!=="length"){let s=this.clone;hn.walk(n,o=>{s&&s[o]&&(this._clonedCache.has(s[o])||(s[o]=this._shallowClone(s[o])),s=s[o])}),this._hasOnValidate&&this._changes.push({path:n,property:t,previous:r}),s&&s[t]&&(s[t]=r)}this._isChanged=!0}undo(e){let t;for(let r=this._changes.length-1;r!==-1;r--)t=this._changes[r],hn.get(e,t.path)[t.property]=t.previous}isChanged(e){return this._onIsChanged===void 0?this._isChanged:this._onIsChanged(this.clone,e)}};var tl=class extends Rr{static isHandledMethod(e){return Fb.has(e)}};var gh=class extends Rr{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}};var rl=class extends Rr{static isHandledMethod(e){return Ub.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}};var nl=class extends Rr{static isHandledMethod(e){return zb.has(e)}undo(e){for(let[t,r]of this.clone.entries())e.set(t,r);for(let t of e.keys())this.clone.has(t)||e.delete(t)}};var yh=class extends Rr{constructor(e,t,r,n){super(void 0,t,r,n),this._arg1=r[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}};var vh=class extends Rr{constructor(e,t,r,n){super(void 0,t,r,n),this._weakKey=r[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}};var ci=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return Ka(e)||Dn(e)||ph(e)}static isHandledMethod(e,t){return Ka(e)?Rr.isHandledMethod(t):Dn(e)?tl.isHandledMethod(t):e instanceof Set?rl.isHandledMethod(t):e instanceof Map?nl.isHandledMethod(t):ph(e)}get isCloning(){return this._stack.length>0}start(e,t,r){let n=Rr;Dn(e)?n=tl:e instanceof Date?n=gh:e instanceof Set?n=rl:e instanceof Map?n=nl:e instanceof WeakSet?n=yh:e instanceof WeakMap&&(n=vh),this._stack.push(new n(e,t,r,this._hasOnValidate))}update(e,t,r){this._stack[this._stack.length-1].update(e,t,r)}preferredThisArg(e,t,r){let{name:n}=e,s=ci.isHandledMethod(r,n);return this._stack[this._stack.length-1].preferredThisArg(s,n,t,r)}isChanged(e,t,r){return this._stack[this._stack.length-1].isChanged(e,t,r)}undo(e){this._previousClone!==void 0&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}};var w2={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},dy=(i,e,t={})=>{t=ie(ie({},w2),t);let r=Symbol("ProxyTarget"),{equals:n,isShallow:s,ignoreDetached:o,details:a}=t,l=new mh(n),c=typeof t.onValidate=="function",h=new ci(c),u=(y,w,b,S,T)=>!c||h.isCloning||t.onValidate(hn.concat(l.getPath(y),w),b,S,T)===!0,f=(y,w,b,S)=>{!rd(l,t,w)&&!(o&&l.isDetached(y,i))&&d(l.getPath(y),w,b,S)},d=(y,w,b,S,T)=>{h.isCloning?h.update(y,w,S):e(hn.concat(y,w),b,S,T)},p=y=>y&&(y[r]||y),m=(y,w,b,S)=>Ob(y)||b==="constructor"||s&&!ci.isHandledMethod(w,b)||rd(l,t,b)||l.isGetInvariant(w,b)||o&&l.isDetached(w,i)?y:(S===void 0&&(S=l.getPath(w)),l.getProxy(y,hn.concat(S,b),g,r)),g={get(y,w,b){if(zo(w)){if(w===r||w===dh)return y;if(w===sy&&!l.isUnsubscribed&&l.getPath(y).length===0)return l.unsubscribe(),y}let S=ph(y)?Reflect.get(y,w):Reflect.get(y,w,b);return m(S,y,w)},set(y,w,b,S){b=p(b);let T=y[r]||y,A=T[w];if(n(A,b)&&w in y)return!0;let x=u(y,w,b,A);return x&&l.setProperty(T,w,b,S,A)?(f(y,w,y[w],A),!0):!x},defineProperty(y,w,b){if(!l.isSameDescriptor(b,y,w)){let S=y[w];u(y,w,b.value,S)&&l.defineProperty(y,w,b,S)&&f(y,w,b.value,S)}return!0},deleteProperty(y,w){if(!Reflect.has(y,w))return!0;let b=Reflect.get(y,w),S=u(y,w,void 0,b);return S&&l.deleteProperty(y,w,b)?(f(y,w,void 0,b),!0):!S},apply(y,w,b){let S=w[r]||w;if(l.isUnsubscribed)return Reflect.apply(y,S,b);if((a===!1||a!==!0&&!a.includes(y.name))&&ci.isHandledType(S)){let T=hn.initial(l.getPath(y)),A=ci.isHandledMethod(S,y.name);h.start(S,T,b);let x=Reflect.apply(y,h.preferredThisArg(y,w,S),A?b.map(C=>p(C)):b),E=h.isChanged(S,n),_=h.stop();if(ci.isHandledType(x)&&A&&(w instanceof Map&&y.name==="get"&&(T=hn.concat(T,b[0])),x=l.getProxy(x,T,g)),E){let C={name:y.name,args:b,result:x},I=h.isCloning?hn.initial(T):T,N=h.isCloning?hn.last(T):"";u(hn.get(i,I),N,S,_,C)?d(I,N,S,_,C):h.undo(S)}return(w instanceof Map||w instanceof Set)&&oy(x)?ay(x,y,w,T,m):x}return Reflect.apply(y,w,b)}},v=l.getProxy(i,t.pathAsArray?[]:"",g);return e=e.bind(v),c&&(t.onValidate=t.onValidate.bind(v)),v};dy.target=i=>i&&i[dh]||i;dy.unsubscribe=i=>i[sy]||i;var py=dy;var S2=typeof global=="object"&&global&&global.Object===Object&&global,id=S2;var M2=typeof self=="object"&&self&&self.Object===Object&&self,A2=id||M2||Function("return this")(),ar=A2;var T2=ar.Symbol,un=T2;var Gb=Object.prototype,E2=Gb.hasOwnProperty,_2=Gb.toString,xh=un?un.toStringTag:void 0;function C2(i){var e=E2.call(i,xh),t=i[xh];try{i[xh]=void 0;var r=!0}catch{}var n=_2.call(i);return r&&(e?i[xh]=t:delete i[xh]),n}var kb=C2;var D2=Object.prototype,P2=D2.toString;function L2(i){return P2.call(i)}var Vb=L2;var I2="[object Null]",R2="[object Undefined]",Hb=un?un.toStringTag:void 0;function B2(i){return i==null?i===void 0?R2:I2:Hb&&Hb in Object(i)?kb(i):Vb(i)}var Pn=B2;function N2(i){return i!=null&&typeof i=="object"}var Kr=N2;var O2="[object Symbol]";function F2(i){return typeof i=="symbol"||Kr(i)&&Pn(i)==O2}var Ys=F2;function U2(i,e){for(var t=-1,r=i==null?0:i.length,n=Array(r);++t<r;)n[t]=e(i[t],t,i);return n}var sd=U2;var z2=Array.isArray,Vr=z2;var G2=1/0,Wb=un?un.prototype:void 0,jb=Wb?Wb.toString:void 0;function qb(i){if(typeof i=="string")return i;if(Vr(i))return sd(i,qb)+"";if(Ys(i))return jb?jb.call(i):"";var e=i+"";return e=="0"&&1/i==-G2?"-0":e}var Yb=qb;var k2=/\s/;function V2(i){for(var e=i.length;e--&&k2.test(i.charAt(e)););return e}var Xb=V2;var H2=/^\s+/;function W2(i){return i&&i.slice(0,Xb(i)+1).replace(H2,"")}var Qb=W2;function j2(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var fr=j2;var Jb=0/0,q2=/^[-+]0x[0-9a-f]+$/i,Y2=/^0b[01]+$/i,X2=/^0o[0-7]+$/i,Q2=parseInt;function J2(i){if(typeof i=="number")return i;if(Ys(i))return Jb;if(fr(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=fr(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=Qb(i);var t=Y2.test(i);return t||X2.test(i)?Q2(i.slice(2),t?2:8):q2.test(i)?Jb:+i}var my=J2;function K2(i){return i}var od=K2;var Z2="[object AsyncFunction]",$2="[object Function]",eI="[object GeneratorFunction]",tI="[object Proxy]";function rI(i){if(!fr(i))return!1;var e=Pn(i);return e==$2||e==eI||e==Z2||e==tI}var il=rI;var nI=ar["__core-js_shared__"],ad=nI;var Kb=function(){var i=/[^.]+$/.exec(ad&&ad.keys&&ad.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function iI(i){return!!Kb&&Kb in i}var Zb=iI;var sI=Function.prototype,oI=sI.toString;function aI(i){if(i!=null){try{return oI.call(i)}catch{}try{return i+""}catch{}}return""}var ls=aI;var lI=/[\\^$.*+?()[\]{}|]/g,cI=/^\[object .+?Constructor\]$/,hI=Function.prototype,uI=Object.prototype,fI=hI.toString,dI=uI.hasOwnProperty,pI=RegExp("^"+fI.call(dI).replace(lI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function mI(i){if(!fr(i)||Zb(i))return!1;var e=il(i)?pI:cI;return e.test(ls(i))}var $b=mI;function gI(i,e){return i==null?void 0:i[e]}var ew=gI;function yI(i,e){var t=ew(i,e);return $b(t)?t:void 0}var wn=yI;var vI=wn(ar,"WeakMap"),ld=vI;var tw=Object.create,xI=function(){function i(){}return function(e){if(!fr(e))return{};if(tw)return tw(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}}(),rw=xI;function bI(i,e,t){switch(t.length){case 0:return i.call(e);case 1:return i.call(e,t[0]);case 2:return i.call(e,t[0],t[1]);case 3:return i.call(e,t[0],t[1],t[2])}return i.apply(e,t)}var nw=bI;function wI(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e}var cd=wI;var SI=800,MI=16,AI=Date.now;function TI(i){var e=0,t=0;return function(){var r=AI(),n=MI-(r-t);if(t=r,n>0){if(++e>=SI)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}var iw=TI;function EI(i){return function(){return i}}var sw=EI;var _I=function(){try{var i=wn(Object,"defineProperty");return i({},"",{}),i}catch{}}(),sl=_I;var CI=sl?function(i,e){return sl(i,"toString",{configurable:!0,enumerable:!1,value:sw(e),writable:!0})}:od,ow=CI;var DI=iw(ow),hd=DI;function PI(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i}var aw=PI;var LI=9007199254740991,II=/^(?:0|[1-9]\d*)$/;function RI(i,e){var t=typeof i;return e=e==null?LI:e,!!e&&(t=="number"||t!="symbol"&&II.test(i))&&i>-1&&i%1==0&&i<e}var ud=RI;function BI(i,e,t){e=="__proto__"&&sl?sl(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}var ol=BI;function NI(i,e){return i===e||i!==i&&e!==e}var Xs=NI;var OI=Object.prototype,FI=OI.hasOwnProperty;function UI(i,e,t){var r=i[e];(!(FI.call(i,e)&&Xs(r,t))||t===void 0&&!(e in i))&&ol(i,e,t)}var fd=UI;function zI(i,e,t,r){var n=!t;t||(t={});for(var s=-1,o=e.length;++s<o;){var a=e[s],l=r?r(t[a],i[a],a,t,i):void 0;l===void 0&&(l=i[a]),n?ol(t,a,l):fd(t,a,l)}return t}var Wn=zI;var lw=Math.max;function GI(i,e,t){return e=lw(e===void 0?i.length-1:e,0),function(){for(var r=arguments,n=-1,s=lw(r.length-e,0),o=Array(s);++n<s;)o[n]=r[e+n];n=-1;for(var a=Array(e+1);++n<e;)a[n]=r[n];return a[e]=t(o),nw(i,this,a)}}var dd=GI;function kI(i,e){return hd(dd(i,e,od),i+"")}var cw=kI;var VI=9007199254740991;function HI(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=VI}var pd=HI;function WI(i){return i!=null&&pd(i.length)&&!il(i)}var Qs=WI;function jI(i,e,t){if(!fr(t))return!1;var r=typeof e;return(r=="number"?Qs(t)&&ud(e,t.length):r=="string"&&e in t)?Xs(t[e],i):!1}var hw=jI;function qI(i){return cw(function(e,t){var r=-1,n=t.length,s=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(s=i.length>3&&typeof s=="function"?(n--,s):void 0,o&&hw(t[0],t[1],o)&&(s=n<3?void 0:s,n=1),e=Object(e);++r<n;){var a=t[r];a&&i(e,a,r,s)}return e})}var uw=qI;var YI=Object.prototype;function XI(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||YI;return i===t}var al=XI;function QI(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}var fw=QI;var JI="[object Arguments]";function KI(i){return Kr(i)&&Pn(i)==JI}var gy=KI;var dw=Object.prototype,ZI=dw.hasOwnProperty,$I=dw.propertyIsEnumerable,eR=gy(function(){return arguments}())?gy:function(i){return Kr(i)&&ZI.call(i,"callee")&&!$I.call(i,"callee")},Go=eR;function tR(){return!1}var pw=tR;var yw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,mw=yw&&typeof module=="object"&&module&&!module.nodeType&&module,rR=mw&&mw.exports===yw,gw=rR?ar.Buffer:void 0,nR=gw?gw.isBuffer:void 0,iR=nR||pw,ll=iR;var sR="[object Arguments]",oR="[object Array]",aR="[object Boolean]",lR="[object Date]",cR="[object Error]",hR="[object Function]",uR="[object Map]",fR="[object Number]",dR="[object Object]",pR="[object RegExp]",mR="[object Set]",gR="[object String]",yR="[object WeakMap]",vR="[object ArrayBuffer]",xR="[object DataView]",bR="[object Float32Array]",wR="[object Float64Array]",SR="[object Int8Array]",MR="[object Int16Array]",AR="[object Int32Array]",TR="[object Uint8Array]",ER="[object Uint8ClampedArray]",_R="[object Uint16Array]",CR="[object Uint32Array]",Xt={};Xt[bR]=Xt[wR]=Xt[SR]=Xt[MR]=Xt[AR]=Xt[TR]=Xt[ER]=Xt[_R]=Xt[CR]=!0;Xt[sR]=Xt[oR]=Xt[vR]=Xt[aR]=Xt[xR]=Xt[lR]=Xt[cR]=Xt[hR]=Xt[uR]=Xt[fR]=Xt[dR]=Xt[pR]=Xt[mR]=Xt[gR]=Xt[yR]=!1;function DR(i){return Kr(i)&&pd(i.length)&&!!Xt[Pn(i)]}var vw=DR;function PR(i){return function(e){return i(e)}}var cl=PR;var xw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,bh=xw&&typeof module=="object"&&module&&!module.nodeType&&module,LR=bh&&bh.exports===xw,yy=LR&&id.process,IR=function(){try{var i=bh&&bh.require&&bh.require("util").types;return i||yy&&yy.binding&&yy.binding("util")}catch{}}(),cs=IR;var bw=cs&&cs.isTypedArray,RR=bw?cl(bw):vw,md=RR;var BR=Object.prototype,NR=BR.hasOwnProperty;function OR(i,e){var t=Vr(i),r=!t&&Go(i),n=!t&&!r&&ll(i),s=!t&&!r&&!n&&md(i),o=t||r||n||s,a=o?fw(i.length,String):[],l=a.length;for(var c in i)(e||NR.call(i,c))&&!(o&&(c=="length"||n&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||ud(c,l)))&&a.push(c);return a}var gd=OR;function FR(i,e){return function(t){return i(e(t))}}var yd=FR;var UR=yd(Object.keys,Object),ww=UR;var zR=Object.prototype,GR=zR.hasOwnProperty;function kR(i){if(!al(i))return ww(i);var e=[];for(var t in Object(i))GR.call(i,t)&&t!="constructor"&&e.push(t);return e}var Sw=kR;function VR(i){return Qs(i)?gd(i):Sw(i)}var hl=VR;function HR(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var Mw=HR;var WR=Object.prototype,jR=WR.hasOwnProperty;function qR(i){if(!fr(i))return Mw(i);var e=al(i),t=[];for(var r in i)r=="constructor"&&(e||!jR.call(i,r))||t.push(r);return t}var Aw=qR;function YR(i){return Qs(i)?gd(i,!0):Aw(i)}var Di=YR;var XR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,QR=/^\w*$/;function JR(i,e){if(Vr(i))return!1;var t=typeof i;return t=="number"||t=="symbol"||t=="boolean"||i==null||Ys(i)?!0:QR.test(i)||!XR.test(i)||e!=null&&i in Object(e)}var Tw=JR;var KR=wn(Object,"create"),hs=KR;function ZR(){this.__data__=hs?hs(null):{},this.size=0}var Ew=ZR;function $R(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var _w=$R;var eB="__lodash_hash_undefined__",tB=Object.prototype,rB=tB.hasOwnProperty;function nB(i){var e=this.__data__;if(hs){var t=e[i];return t===eB?void 0:t}return rB.call(e,i)?e[i]:void 0}var Cw=nB;var iB=Object.prototype,sB=iB.hasOwnProperty;function oB(i){var e=this.__data__;return hs?e[i]!==void 0:sB.call(e,i)}var Dw=oB;var aB="__lodash_hash_undefined__";function lB(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=hs&&e===void 0?aB:e,this}var Pw=lB;function ul(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}ul.prototype.clear=Ew;ul.prototype.delete=_w;ul.prototype.get=Cw;ul.prototype.has=Dw;ul.prototype.set=Pw;var vy=ul;function cB(){this.__data__=[],this.size=0}var Lw=cB;function hB(i,e){for(var t=i.length;t--;)if(Xs(i[t][0],e))return t;return-1}var Js=hB;var uB=Array.prototype,fB=uB.splice;function dB(i){var e=this.__data__,t=Js(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():fB.call(e,t,1),--this.size,!0}var Iw=dB;function pB(i){var e=this.__data__,t=Js(e,i);return t<0?void 0:e[t][1]}var Rw=pB;function mB(i){return Js(this.__data__,i)>-1}var Bw=mB;function gB(i,e){var t=this.__data__,r=Js(t,i);return r<0?(++this.size,t.push([i,e])):t[r][1]=e,this}var Nw=gB;function fl(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}fl.prototype.clear=Lw;fl.prototype.delete=Iw;fl.prototype.get=Rw;fl.prototype.has=Bw;fl.prototype.set=Nw;var Ks=fl;var yB=wn(ar,"Map"),Zs=yB;function vB(){this.size=0,this.__data__={hash:new vy,map:new(Zs||Ks),string:new vy}}var Ow=vB;function xB(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}var Fw=xB;function bB(i,e){var t=i.__data__;return Fw(e)?t[typeof e=="string"?"string":"hash"]:t.map}var $s=bB;function wB(i){var e=$s(this,i).delete(i);return this.size-=e?1:0,e}var Uw=wB;function SB(i){return $s(this,i).get(i)}var zw=SB;function MB(i){return $s(this,i).has(i)}var Gw=MB;function AB(i,e){var t=$s(this,i),r=t.size;return t.set(i,e),this.size+=t.size==r?0:1,this}var kw=AB;function dl(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}dl.prototype.clear=Ow;dl.prototype.delete=Uw;dl.prototype.get=zw;dl.prototype.has=Gw;dl.prototype.set=kw;var wh=dl;var TB="Expected a function";function xy(i,e){if(typeof i!="function"||e!=null&&typeof e!="function")throw new TypeError(TB);var t=function(){var r=arguments,n=e?e.apply(this,r):r[0],s=t.cache;if(s.has(n))return s.get(n);var o=i.apply(this,r);return t.cache=s.set(n,o)||s,o};return t.cache=new(xy.Cache||wh),t}xy.Cache=wh;var Vw=xy;var EB=500;function _B(i){var e=Vw(i,function(r){return t.size===EB&&t.clear(),r}),t=e.cache;return e}var Hw=_B;var CB=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,DB=/\\(\\)?/g,PB=Hw(function(i){var e=[];return i.charCodeAt(0)===46&&e.push(""),i.replace(CB,function(t,r,n,s){e.push(n?s.replace(DB,"$1"):r||t)}),e}),Ww=PB;function LB(i){return i==null?"":Yb(i)}var jw=LB;function IB(i,e){return Vr(i)?i:Tw(i,e)?[i]:Ww(jw(i))}var pl=IB;var RB=1/0;function BB(i){if(typeof i=="string"||Ys(i))return i;var e=i+"";return e=="0"&&1/i==-RB?"-0":e}var vd=BB;function NB(i,e){e=pl(e,i);for(var t=0,r=e.length;i!=null&&t<r;)i=i[vd(e[t++])];return t&&t==r?i:void 0}var qw=NB;function OB(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i}var ml=OB;var Yw=un?un.isConcatSpreadable:void 0;function FB(i){return Vr(i)||Go(i)||!!(Yw&&i&&i[Yw])}var Xw=FB;function Qw(i,e,t,r,n){var s=-1,o=i.length;for(t||(t=Xw),n||(n=[]);++s<o;){var a=i[s];e>0&&t(a)?e>1?Qw(a,e-1,t,r,n):ml(n,a):r||(n[n.length]=a)}return n}var Jw=Qw;function UB(i){var e=i==null?0:i.length;return e?Jw(i,1):[]}var Kw=UB;function zB(i){return hd(dd(i,void 0,Kw),i+"")}var Zw=zB;var GB=yd(Object.getPrototypeOf,Object),gl=GB;var kB="[object Object]",VB=Function.prototype,HB=Object.prototype,$w=VB.toString,WB=HB.hasOwnProperty,jB=$w.call(Object);function qB(i){if(!Kr(i)||Pn(i)!=kB)return!1;var e=gl(i);if(e===null)return!0;var t=WB.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&$w.call(t)==jB}var xd=qB;function YB(i,e,t){var r=-1,n=i.length;e<0&&(e=-e>n?0:n+e),t=t>n?n:t,t<0&&(t+=n),n=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(n);++r<n;)s[r]=i[r+e];return s}var eS=YB;function XB(){this.__data__=new Ks,this.size=0}var tS=XB;function QB(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}var rS=QB;function JB(i){return this.__data__.get(i)}var nS=JB;function KB(i){return this.__data__.has(i)}var iS=KB;var ZB=200;function $B(i,e){var t=this.__data__;if(t instanceof Ks){var r=t.__data__;if(!Zs||r.length<ZB-1)return r.push([i,e]),this.size=++t.size,this;t=this.__data__=new wh(r)}return t.set(i,e),this.size=t.size,this}var sS=$B;function yl(i){var e=this.__data__=new Ks(i);this.size=e.size}yl.prototype.clear=tS;yl.prototype.delete=rS;yl.prototype.get=nS;yl.prototype.has=iS;yl.prototype.set=sS;var bd=yl;function eN(i,e){return i&&Wn(e,hl(e),i)}var oS=eN;function tN(i,e){return i&&Wn(e,Di(e),i)}var aS=tN;var uS=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lS=uS&&typeof module=="object"&&module&&!module.nodeType&&module,rN=lS&&lS.exports===uS,cS=rN?ar.Buffer:void 0,hS=cS?cS.allocUnsafe:void 0;function nN(i,e){if(e)return i.slice();var t=i.length,r=hS?hS(t):new i.constructor(t);return i.copy(r),r}var wd=nN;function iN(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var o=i[t];e(o,t,i)&&(s[n++]=o)}return s}var fS=iN;function sN(){return[]}var Sd=sN;var oN=Object.prototype,aN=oN.propertyIsEnumerable,dS=Object.getOwnPropertySymbols,lN=dS?function(i){return i==null?[]:(i=Object(i),fS(dS(i),function(e){return aN.call(i,e)}))}:Sd,vl=lN;function cN(i,e){return Wn(i,vl(i),e)}var pS=cN;var hN=Object.getOwnPropertySymbols,uN=hN?function(i){for(var e=[];i;)ml(e,vl(i)),i=gl(i);return e}:Sd,Md=uN;function fN(i,e){return Wn(i,Md(i),e)}var mS=fN;function dN(i,e,t){var r=e(i);return Vr(i)?r:ml(r,t(i))}var Ad=dN;function pN(i){return Ad(i,hl,vl)}var gS=pN;function mN(i){return Ad(i,Di,Md)}var Td=mN;var gN=wn(ar,"DataView"),Ed=gN;var yN=wn(ar,"Promise"),_d=yN;var vN=wn(ar,"Set"),Cd=vN;var yS="[object Map]",xN="[object Object]",vS="[object Promise]",xS="[object Set]",bS="[object WeakMap]",wS="[object DataView]",bN=ls(Ed),wN=ls(Zs),SN=ls(_d),MN=ls(Cd),AN=ls(ld),ko=Pn;(Ed&&ko(new Ed(new ArrayBuffer(1)))!=wS||Zs&&ko(new Zs)!=yS||_d&&ko(_d.resolve())!=vS||Cd&&ko(new Cd)!=xS||ld&&ko(new ld)!=bS)&&(ko=function(i){var e=Pn(i),t=e==xN?i.constructor:void 0,r=t?ls(t):"";if(r)switch(r){case bN:return wS;case wN:return yS;case SN:return vS;case MN:return xS;case AN:return bS}return e});var xl=ko;var TN=Object.prototype,EN=TN.hasOwnProperty;function _N(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&EN.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var SS=_N;var CN=ar.Uint8Array,by=CN;function DN(i){var e=new i.constructor(i.byteLength);return new by(e).set(new by(i)),e}var bl=DN;function PN(i,e){var t=e?bl(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var MS=PN;var LN=/\w*$/;function IN(i){var e=new i.constructor(i.source,LN.exec(i));return e.lastIndex=i.lastIndex,e}var AS=IN;var TS=un?un.prototype:void 0,ES=TS?TS.valueOf:void 0;function RN(i){return ES?Object(ES.call(i)):{}}var _S=RN;function BN(i,e){var t=e?bl(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var Dd=BN;var NN="[object Boolean]",ON="[object Date]",FN="[object Map]",UN="[object Number]",zN="[object RegExp]",GN="[object Set]",kN="[object String]",VN="[object Symbol]",HN="[object ArrayBuffer]",WN="[object DataView]",jN="[object Float32Array]",qN="[object Float64Array]",YN="[object Int8Array]",XN="[object Int16Array]",QN="[object Int32Array]",JN="[object Uint8Array]",KN="[object Uint8ClampedArray]",ZN="[object Uint16Array]",$N="[object Uint32Array]";function e3(i,e,t){var r=i.constructor;switch(e){case HN:return bl(i);case NN:case ON:return new r(+i);case WN:return MS(i,t);case jN:case qN:case YN:case XN:case QN:case JN:case KN:case ZN:case $N:return Dd(i,t);case FN:return new r;case UN:case kN:return new r(i);case zN:return AS(i);case GN:return new r;case VN:return _S(i)}}var CS=e3;function t3(i){return typeof i.constructor=="function"&&!al(i)?rw(gl(i)):{}}var Pd=t3;var r3="[object Map]";function n3(i){return Kr(i)&&xl(i)==r3}var DS=n3;var PS=cs&&cs.isMap,i3=PS?cl(PS):DS,LS=i3;var s3="[object Set]";function o3(i){return Kr(i)&&xl(i)==s3}var IS=o3;var RS=cs&&cs.isSet,a3=RS?cl(RS):IS,BS=a3;var l3=1,c3=2,h3=4,NS="[object Arguments]",u3="[object Array]",f3="[object Boolean]",d3="[object Date]",p3="[object Error]",OS="[object Function]",m3="[object GeneratorFunction]",g3="[object Map]",y3="[object Number]",FS="[object Object]",v3="[object RegExp]",x3="[object Set]",b3="[object String]",w3="[object Symbol]",S3="[object WeakMap]",M3="[object ArrayBuffer]",A3="[object DataView]",T3="[object Float32Array]",E3="[object Float64Array]",_3="[object Int8Array]",C3="[object Int16Array]",D3="[object Int32Array]",P3="[object Uint8Array]",L3="[object Uint8ClampedArray]",I3="[object Uint16Array]",R3="[object Uint32Array]",Wt={};Wt[NS]=Wt[u3]=Wt[M3]=Wt[A3]=Wt[f3]=Wt[d3]=Wt[T3]=Wt[E3]=Wt[_3]=Wt[C3]=Wt[D3]=Wt[g3]=Wt[y3]=Wt[FS]=Wt[v3]=Wt[x3]=Wt[b3]=Wt[w3]=Wt[P3]=Wt[L3]=Wt[I3]=Wt[R3]=!0;Wt[p3]=Wt[OS]=Wt[S3]=!1;function Ld(i,e,t,r,n,s){var o,a=e&l3,l=e&c3,c=e&h3;if(t&&(o=n?t(i,r,n,s):t(i)),o!==void 0)return o;if(!fr(i))return i;var h=Vr(i);if(h){if(o=SS(i),!a)return cd(i,o)}else{var u=xl(i),f=u==OS||u==m3;if(ll(i))return wd(i,a);if(u==FS||u==NS||f&&!n){if(o=l||f?{}:Pd(i),!a)return l?mS(i,aS(o,i)):pS(i,oS(o,i))}else{if(!Wt[u])return n?i:{};o=CS(i,u,a)}}s||(s=new bd);var d=s.get(i);if(d)return d;s.set(i,o),BS(i)?i.forEach(function(g){o.add(Ld(g,e,t,g,i,s))}):LS(i)&&i.forEach(function(g,v){o.set(v,Ld(g,e,t,v,i,s))});var p=c?l?Td:gS:l?Di:hl,m=h?void 0:p(i);return aw(m||i,function(g,v){m&&(v=g,g=i[v]),fd(o,v,Ld(g,e,t,v,i,s))}),o}var Id=Ld;var B3=1,N3=4;function O3(i){return Id(i,B3|N3)}var Sh=O3;function F3(i){return function(e,t,r){for(var n=-1,s=Object(e),o=r(e),a=o.length;a--;){var l=o[i?a:++n];if(t(s[l],l,s)===!1)break}return e}}var US=F3;var U3=US(),zS=U3;var z3=function(){return ar.Date.now()},Rd=z3;var G3="Expected a function",k3=Math.max,V3=Math.min;function H3(i,e,t){var r,n,s,o,a,l,c=0,h=!1,u=!1,f=!0;if(typeof i!="function")throw new TypeError(G3);e=my(e)||0,fr(t)&&(h=!!t.leading,u="maxWait"in t,s=u?k3(my(t.maxWait)||0,e):s,f="trailing"in t?!!t.trailing:f);function d(T){var A=r,x=n;return r=n=void 0,c=T,o=i.apply(x,A),o}function p(T){return c=T,a=setTimeout(v,e),h?d(T):o}function m(T){var A=T-l,x=T-c,E=e-A;return u?V3(E,s-x):E}function g(T){var A=T-l,x=T-c;return l===void 0||A>=e||A<0||u&&x>=s}function v(){var T=Rd();if(g(T))return y(T);a=setTimeout(v,m(T))}function y(T){return a=void 0,f&&r?d(T):(r=n=void 0,o)}function w(){a!==void 0&&clearTimeout(a),c=0,r=l=n=a=void 0}function b(){return a===void 0?o:y(Rd())}function S(){var T=Rd(),A=g(T);if(r=arguments,n=this,l=T,A){if(a===void 0)return p(l);if(u)return clearTimeout(a),a=setTimeout(v,e),d(l)}return a===void 0&&(a=setTimeout(v,e)),o}return S.cancel=w,S.flush=b,S}var Mh=H3;function W3(i,e,t){(t!==void 0&&!Xs(i[e],t)||t===void 0&&!(e in i))&&ol(i,e,t)}var Ah=W3;function j3(i){return Kr(i)&&Qs(i)}var GS=j3;function q3(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}var Th=q3;function Y3(i){return Wn(i,Di(i))}var kS=Y3;function X3(i,e,t,r,n,s,o){var a=Th(i,t),l=Th(e,t),c=o.get(l);if(c){Ah(i,t,c);return}var h=s?s(a,l,t+"",i,e,o):void 0,u=h===void 0;if(u){var f=Vr(l),d=!f&&ll(l),p=!f&&!d&&md(l);h=l,f||d||p?Vr(a)?h=a:GS(a)?h=cd(a):d?(u=!1,h=wd(l,!0)):p?(u=!1,h=Dd(l,!0)):h=[]:xd(l)||Go(l)?(h=a,Go(a)?h=kS(a):(!fr(a)||il(a))&&(h=Pd(l))):u=!1}u&&(o.set(l,h),n(h,l,r,s,o),o.delete(l)),Ah(i,t,h)}var VS=X3;function HS(i,e,t,r,n){i!==e&&zS(e,function(s,o){if(n||(n=new bd),fr(s))VS(i,e,o,t,HS,r,n);else{var a=r?r(Th(i,o),s,o+"",i,e,n):void 0;a===void 0&&(a=s),Ah(i,o,a)}},Di)}var WS=HS;function Q3(i){var e=i==null?0:i.length;return e?i[e-1]:void 0}var jS=Q3;function J3(i,e){return e.length<2?i:qw(i,eS(e,0,-1))}var qS=J3;var K3=uw(function(i,e,t){WS(i,e,t)}),Vo=K3;function Z3(i,e){return e=pl(e,i),i=qS(i,e),i==null||delete i[vd(jS(e))]}var YS=Z3;function $3(i){return xd(i)?void 0:i}var XS=$3;var eO=1,tO=2,rO=4,nO=Zw(function(i,e){var t={};if(i==null)return t;var r=!1;e=sd(e,function(s){return s=pl(s,i),r||(r=s.length>1),s}),Wn(i,Td(i),t),r&&(t=Id(t,eO|tO|rO,XS));for(var n=e.length;n--;)YS(t,e[n]);return t}),wl=nO;var QS=i=>new Promise(e=>setTimeout(e,i));var iO=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().includes(" electron/"),sO=()=>typeof window>"u"?!1:window.navigator.platform.toUpperCase().includes("MAC"),oO=()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(window.navigator.userAgent)||Eh&&"ontouchend"in document,aO=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,lO=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0,cO=()=>{let i=navigator.userAgent,e=navigator.vendor;return/Safari/i.test(i)&&/Apple Computer/.test(e)},e9=iO(),Eh=sO(),Ho=oO(),JS=aO(),Bd=lO(),KS=cO();function ZS(i){return Array.isArray(i)?i:[i]}function _h(i){return Eh?i.metaKey:i.ctrlKey}var eo;(t=>{t.all=["PerspectiveCamera","OrthographicCamera"];function e(r){return t.all.includes(r)}t.is=e})(eo||(eo={}));var Wo;(n=>{n.DefaultUp=[0,1,0],n.DefaultTargetOffset=1e3,n.defaultData={far:1e5,type:"OrthographicCamera",perspective:{near:5,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:n.DefaultUp,isUpVectorFlipped:!1,targetOffset:n.DefaultTargetOffset};function r(s){return s.type==="PerspectiveCamera"?s.perspective.zoom:s.orthographic.zoom}n.getZoom=r})(Wo||(Wo={}));var us;(t=>{function i(r,n){return r[0]===n[0]&&r[1]===n[1]}t.isEqual=i;function e(r,n,s){return[r[0]+(n[0]-r[0])*s,r[1]+(n[1]-r[1])*s]}t.lerp=e})(us||(us={}));var br;(n=>{function i(s,o){return s[0]===o[0]&&s[1]===o[1]&&s[2]===o[2]}n.isEqual=i;function e(s,o){return[s[0]+o[0],s[1]+o[1],s[2]+o[2]]}n.add=e;function t(s,o){return[s[0]-o[0],s[1]-o[1],s[2]-o[2]]}n.sub=t;function r(s,o,a){return[s[0]+(o[0]-s[0])*a,s[1]+(o[1]-s[1])*a,s[2]+(o[2]-s[2])*a]}n.lerp=r})(br||(br={}));var Ch;(t=>{function i(r,n){return r[0]===n[0]&&r[1]===n[1]&&r[2]===n[2]&&r[3]===n[3]}t.isEqual=i;function e(r,n,s){return[r[0]+(n[0]-r[0])*s,r[1]+(n[1]-r[1])*s,r[2]+(n[2]-r[2])*s,r[3]+(n[3]-r[3])*s]}t.lerp=e})(Ch||(Ch={}));var Pi;(n=>{n.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function e(s,o){for(let a=0;a<16;a++)if(s[a]!==o[a])return!1;return!0}n.isEqual=e;function t(s){return s!=null?s:n.identity}n.simplify=t;function r(s,o){let a=o.slice(0);for(var l=0,c=o.length;l<c;l+=3){let h=s[3]*o[l]+s[7]*o[l+1]+s[11]*o[l+2]+s[15];a[l]=(s[0]*o[l]+s[4]*o[l+1]+s[8]*o[l+2]+s[12])/h,a[l+1]=(s[1]*o[l]+s[5]*o[l+1]+s[9]*o[l+2]+s[13])/h,a[l+2]=(s[2]*o[l]+s[6]*o[l+1]+s[10]*o[l+2]+s[14])/h}return a}n.applyMatrix4=r})(Pi||(Pi={}));var Ar;(l=>{l.white={r:1,g:1,b:1},l.red={r:1,g:0,b:0},l.black={r:0,g:0,b:0};function r(c){return{r:Math.round(c.r*255),g:Math.round(c.g*255),b:Math.round(c.b*255),a:1}}l.toRgb255a1=r;function n(c){return{r:c.r,g:c.g,b:c.b}}l.clone=n;function s(c){return c=Math.floor(c),{r:(c>>16&255)/255,g:(c>>8&255)/255,b:(c&255)/255}}l.fromHex=s;function o(c,h){return c.r===h.r&&c.g===h.g&&c.b===h.b}l.equals=o;function a(c,h,u){return{r:c.r+(h.r-c.r)*u,g:c.g+(h.g-c.g)*u,b:c.b+(h.b-c.b)*u}}l.lerp=a})(Ar||(Ar={}));var Ln;(o=>{o.white=xe(ie({},Ar.white),{a:1});function e(a){return{r:a[0],g:a[1],b:a[2],a:a[3]}}o.from0to1=e;function t(a,l){return xe(ie({},Ar.fromHex(a)),{a:l})}o.fromHexAndA=t;function r(a){return{r:Math.round(a.r*255),g:Math.round(a.g*255),b:Math.round(a.b*255),a:a.a}}o.toRgb255a1=r;function n(a,l){return Ar.equals(a,l)&&a.a===l.a}o.equals=n;function s(a,l,c){return{r:a.r+(l.r-a.r)*c,g:a.g+(l.g-a.g)*c,b:a.b+(l.b-a.b)*c,a:a.a+(l.a-a.a)*c}}o.lerp=s})(Ln||(Ln={}));var Nd;(e=>e.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]})(Nd||(Nd={}));var Od;(e=>e.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(Od||(Od={}));var Fd;(e=>e.defaultData={control1:[.5,.05],control2:[.1,.3]})(Fd||(Fd={}));var Ud;(e=>{function i(t,r=.1){return{type:"radial",hideBase:!1,count:3,radial:{radius:Math.max(t[0],t[1])*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[t[0]+t[0]*r,0,0]},grid:{count:[2,2,2],size:t.map(n=>n*(1+r)),useCenter:!0}}}e.defaultData=i})(Ud||(Ud={}));var jn=class{modifyById(e,t){let r=this;if(r[e]===void 0)throw new Error("not expected");{let s=xe(ie({},r),{[e]:t});return Object.setPrototypeOf(s,jn.prototype),s}}add(e,t){var n;let r=this.runOp({type:1,id:e,data:t});return(n=r==null?void 0:r.data)!=null?n:this}runOp(e){let t=this;if(e.type===1){let r=t[e.id],n;r===void 0?n={type:2,id:e.id}:n={type:1,id:e.id,data:r};let{id:s,data:o}=e,a=xe(ie({},t),{[s]:o});return Object.setPrototypeOf(a,jn.prototype),{data:a,actual:e,reverse:n}}else if(e.type===2){let{id:r}=e,n=t[r];if(n===void 0)return null;{let s=ie({},t);return Object.setPrototypeOf(s,jn.prototype),delete s[r],{data:s,actual:e,reverse:{type:1,id:r,data:n}}}}throw new Error("illegal arg")}};function Dh(i){if(i.deepFreeze!==void 0){i.deepFreeze(i);return}let e=Object.getOwnPropertyNames(i);for(let t of e){let r=i[t];r&&typeof r=="object"&&Dh(r)}return Object.freeze(i)}function $S(i,e){let t=0;for(;t<i.length&&t<e.length;){if(i[t]<e[t])return-1;if(i[t]>e[t])return 1;t+=1}return t!==e.length?-1:t!==i.length?1:0}var zd=class extends Error{};function Li(i,e,t){if(i===void 0?e===void 0?(i=0,e=10):i=e-10:e===void 0&&(e=i+10),i>e){let s=i;i=e,e=s}let r=[],n=1/(t+1);for(let s=0;s<t;s++){let o=i+(e-i)*(s+.75+Math.random()*.5)*n;r.push(o)}return r}function eM(i){return i instanceof Uint8Array||i instanceof Uint16Array||i instanceof Uint32Array||i instanceof Int8Array||i instanceof Int16Array||i instanceof Int32Array||i instanceof Float32Array||i instanceof Float64Array}function tM(){return typeof process<"u"}function rM(i,e){for(let t of i)e(t.id,t.data),rM(t.children,e)}function nM(i,e){e(i.id,i.data);for(let t of i.children)nM(t,e)}var qn=class extends Array{constructor(...t){super(...t);Object.setPrototypeOf(this,qn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)Dh(this[t]),t++}fillCaches0(t,r){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,r);for(let n of t.children)this.fillCaches0(n,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}isDescendantOf(t,r){for(;t;){let n=this.parent(t);if(n===r)return!0;t=n}return!1}data(t){var r;return(r=this.get(t))==null?void 0:r.data}has(t){return this.childrenOf(t)!==void 0}get(t){return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){var r;return t===null?this:(r=this.get(t))==null?void 0:r.children}traverseFrom(t,r){if(t===null)this.traverse(r);else{let n=this.get(t);n&&nM(n,r)}}traverse(t){rM(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,r){if(this.get(t)===void 0)throw new Error("not expected");{let s=this.parent(t),o=this.childrenArray(s),a=o.findIndex(h=>h.id===t);if(a<0)throw new Error("not expected");let l=o[a];return o=[...o],o[a]=xe(ie({},l),{data:r}),this.modifyArrayBy(s,o)}}modifyArrayBy(t,r){let n=t,s=r;for(;n!==null;){let a=s,l=n;if(n=this.parent(n),n===void 0)throw new Error;s=this.childrenArray(n);let c=s.findIndex(h=>h.id===l);if(c<0)throw new Error;s=[...s],s[c]=xe(ie({},s[c]),{children:a})}Object.setPrototypeOf(s,qn.prototype);let o=s;return o.fillCaches(),o}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}}checkDuplicatedIdRec({id:t,children:r}){if(this.get(t)!==void 0)return!0;for(let n of r)if(this.checkDuplicatedIdRec(n))return!0;return!1}addOp(t){let{parent:r,fi:n,id:s,data:o,children:a}=t;if(r!==null&&this.get(r)===void 0)return null;if(this.checkDuplicatedIdRec(t))return null;{let l=r,c=this.childrenArray(l),h={fi:n,id:s,data:o,children:a};return c=[...c,h],c.sort((f,d)=>f.fi-d.fi),t.localIndex=c.indexOf(h),{data:this.modifyArrayBy(l,c),actual:t,reverse:{type:8,id:s}}}}deleteOp(t){let{id:r}=t;if(this.get(r)===null)return null;{let n=this.parent(r);if(n===void 0)return null;let s=this.childrenArray(n),o=s.findIndex(c=>c.id===r);t.localIndex=o,s=[...s];let a=s.splice(o,1)[0];return{data:this.modifyArrayBy(n,s),actual:t,reverse:xe(ie({type:7},a),{parent:n})}}}moveOp(t){let{parent:r,fi:n,id:s}=t;if(r!==null&&this.get(r)===void 0)return this.deleteOp({type:8,id:s});if(r!==null){let d=r;for(;d!==null;){if(d===void 0)throw new Error;if(d===s)throw new zd("cyclic tree");d=this.parent(d)}}let o=this.parent(s);if(o===void 0)return null;let a=o,l=this.childrenArray(o),c=l.findIndex(d=>d.id===s);l=[...l];let h=l.splice(c,1)[0],u=this.modifyArrayBy(o,l);o=r,l=u.childrenArray(o);let f=h.fi;return h=xe(ie({},h),{fi:n}),l=[...l,h],l.sort((d,p)=>d.fi-p.fi),t.localIndex=l.indexOf(h),u=u.modifyArrayBy(o,l),{data:u,actual:t,reverse:{type:9,parent:a,fi:f,id:s}}}previous(t,r){if(r===null){let s=this.childrenArray(t);return s.length===0?null:s[s.length-1].id}let n=null;for(let s of this.childrenArray(t)){if(s.id===r)return n;n=s.id}return null}traverseSortNext(t){let r=this.parent(t);if(r!==void 0){let n=this.childrenArray(r),s=n.findIndex(o=>o.id===t)+1;if(s<n.length)return n[s].id;if(r)return this.traverseSortNext(r)}}sortNext(t){let r=this.childrenArray(t);return r.length>0?r[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let r=this.childrenArray(t);return r.length>0?this.traverseSortPrevious(r[r.length-1].id):t}sortPrevious(t){let r=this.parent(t);if(r!==void 0){let n=this.childrenArray(r),s=n.findIndex(o=>o.id===t)-1;return s>=0?this.traverseSortPrevious(n[s].id):r}}getAllSorted(t){let r=[];for(let n of t){let s=this.getWithSortKey(n.id);s!==void 0&&r.push(ie(ie({},n),s))}r.sort((n,s)=>$S(n.sortKey,s.sortKey));for(let n of r)delete n.sortKey;return r}getWithSortKey(t){var r=t;let n=[],s=this.get(r),o=s;if(s!==void 0){for(;r;)n.splice(0,0,s.fi),r=this.parent(r),r!==null&&(s=this.get(r));return xe(ie({},o),{sortKey:n})}}insertBeforeHelper(t,r,n){return this.insertAfterHelper(t,this.previous(t,r),n)}insertAfterHelper(t,r,n){let s=this.childrenArray(t);if(r===null){if(s.length===0)return Li(0,n,n);{let o=s[0].fi;return Li(o-n,o,n)}}else{let o=this.get(r);if(o===void 0||this.parent(r)!==t)throw new Error("illegal args");let a=s.find(l=>l.fi>o.fi);if(a===void 0){let l=s[s.length-1].fi;return Li(l,l+n,n)}else return Li(o.fi,a.fi,n)}}};var Gd;(e=>{function i(t,r){if(Array.isArray(t)){let n=r.props,s={},o=[...t],a=!1;if(n)for(let l of Object.keys(n)){let c=parseInt(l);if(isNaN(c))throw new Error("wrong index");s[l]=o[c],o[c]=n[l],a=!0}return a?{data:o,actual:r,reverse:{type:0,props:s}}:null}else{let n=r.props,s={},o=ie({},t),a=!1;if(n)for(let l of Object.keys(n)){s[l]=o[l];let c=n[l];c===void 0?delete o[l]:o[l]=c,a=!0}return a?{data:o,actual:r,reverse:{type:0,props:s}}:null}}e.runOp=i})(Gd||(Gd={}));var rr=class extends Array{constructor(...t){super(...t);Object.setPrototypeOf(this,rr.prototype)}deepFreeze(){let t=0;for(;t<this.length;)Dh(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){var r;return(r=this.get(t))==null?void 0:r.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,r){if(this.get(t)===void 0)throw new Error("not expected");{let s=this,o=s.findIndex(c=>c.id===t);if(o<0)throw new Error("not expected");let a=s[o];return s=[...s],s[o]=xe(ie({},a),{data:r}),this.modifyArrayBy(s)}}modifyArrayBy(t){Object.setPrototypeOf(t,rr.prototype);let r=t;return tM()||r.fillCaches(),r}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}}addOp(t){let{fi:r,id:n,data:s}=t,o=this,a={fi:r,id:n,data:s};return o=[...o,a],o.sort((c,h)=>c.fi-h.fi),t.localIndex=o.indexOf(a),{data:this.modifyArrayBy(o),actual:t,reverse:{type:5,id:n}}}deleteOp(t){let{id:r}=t,n=this,s=n.findIndex(l=>l.id===r);if(s===-1)return null;t.localIndex=s,n=[...n];let o=n.splice(s,1)[0];return{data:this.modifyArrayBy(n),actual:t,reverse:ie({type:4},o)}}moveOp(t){let{fi:r,id:n}=t,s=this;s=[...s];let o=s.findIndex(h=>h.id===n);if(o===-1)return null;let a=s[o].fi,l=xe(ie({},s[o]),{fi:r});return s[o]=l,s.sort((h,u)=>h.fi-u.fi),t.localIndex=s.indexOf(l),{data:this.modifyArrayBy(s),actual:t,reverse:{type:6,fi:a,id:n}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let r=null;for(let n of this){if(n.id===t)return r;r=n.id}return null}insertBeforeHelper(t,r){return this.insertAfterHelper(this.previous(t),r)}insertAfterHelper(t,r){let n=this;if(t===null){if(n.length===0)return Li(0,r,r);{let s=n[0].fi;return Li(s-r,s,r)}}else{let s=this.get(t);if(s===void 0)throw new Error("illegal args");let o=n.find(a=>a.fi>s.fi);if(o===void 0){let a=n[n.length-1].fi;return Li(a,a+r,r)}else return Li(s.fi,o.fi,r)}}};var iM=Symbol(),Vd=Symbol(),Sl=class{reportOp(e,t){let r=this;if(t===null)return;r._current=t.data;let n=[];for(;!(r instanceof kd);){let s=r._path,o=r._current;if(s!==""&&n.splice(0,0,s),r=r._parent,r===null)return;r.update(s,o)}r.push(n,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let r=t[Vd];r&&r(),delete this._children[e]}}}},Sy=class extends Sl{constructor(e,t,r){super(),this._parent=e,this._path=t,this._current=r}update(e,t){if(Array.isArray(this._current)){if(typeof e=="string"&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid path");this._current=[...this._current],this._current[e]=t}else this._current=xe(ie({},this._current),{[e]:t})}runOp(e){this.reportOp(e,Gd.runOp(this._current,e))}},My=class extends Sl{constructor(e,t,r){super(),this._parent=e,this._path=t,this._current=r}update(e,t){this._current=xe(ie({},this._current),{[e]:t}),Object.setPrototypeOf(this._current,jn.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},sM={get(i,e){if(e===Vd)return()=>{i._parent=null};if(e===iM)return i._current;let{_current:t,_children:r}=i;if(e==="push"&&Array.isArray(t))throw new Error("not supported to expand array");let n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=t[e],o=Hd(i,e,s);return o!==s?(r===void 0&&(r={},i._children=r),r[e]=o,o):s},has(i,e){return e in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,e){let t=i._current,r=Reflect.getOwnPropertyDescriptor(t,e);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:t[e]}}},hO=xe(ie({},sM),{set(i,e,t){var n;let r={type:0,props:{[e]:(n=Ey(t))!=null?n:t}};return i.deleteChildren(e),i.runOp(r),!0},deleteProperty(i,e){let t={type:0,props:{[e]:void 0}};return i.deleteChildren(e),i.runOp(t),!0}}),uO=xe(ie({},sM),{set(i,e,t){return t===void 0?this.deleteProperty(i,e):(i.deleteChildren(e),i.runOp({type:1,id:e,data:t})),!0},deleteProperty(i,e){return i.runOp({type:2,id:e}),!0}}),Ml=class extends Sl{constructor(e,t,r){super(),this._children={},this._parent=e,this._path=t,this._current=r,this[Vd]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}traverse(e){return this._current.traverse(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse((t,r)=>{e(t,this.data(t))})}data(e){var a;let{_current:t,_children:r}=this,n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=(a=t.get(e))==null?void 0:a.data,o=Hd(this,e,s);return o!==s?(r===void 0&&(r={},this._children=r),r[e]=o,o):s}add(e,t,r,n,s){this.runOp({type:7,parent:e,fi:t,id:r,data:n,children:s})}move(e,t,r){this.runOp({type:9,parent:e,fi:t,id:r})}insertAfter(e,t,r){let n=this._current.insertAfterHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.add(e,n[s],o.id,o.data,o.children)}}insertBefore(e,t,r){let n=this._current.insertBeforeHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.add(e,n[s],o.id,o.data,o.children)}}moveAfter(e,t,r){let n=this._current.insertAfterHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.move(e,n[s],o)}}moveBefore(e,t,r){let n=this._current.insertBeforeHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.move(e,n[s],o)}}delete(e){this.deleteChildren(e),this.runOp({type:8,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},Al=class extends Sl{constructor(e,t,r){super(),this._children={},this._parent=e,this._path=t,this._current=r,this[Vd]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(e){let t=this.length;for(let r=0;r<t;r++){let n=this._current[r].id;e(this.data(this._current[r].id),n)}}update(e,t){this._current=this._current.modifyById(e,t)}randomId(){return this._current.randomId()}get(e){return xe(ie({},this._current.get(e)),{data:this.data(e)})}data(e){var a;let{_current:t,_children:r}=this,n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=(a=t.get(e))==null?void 0:a.data,o=Hd(this,e,s);return o!==s?(r===void 0&&(r={},this._children=r),r[e]=o,o):s}runOp(e){this.reportOp(e,this._current.runOp(e))}add(e,t,r){this.runOp({type:4,fi:e,id:t,data:r})}move(e,t){this.runOp({type:6,fi:e,id:t})}insertAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.add(r[n],s.id,s.data)}}insertBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.add(r[n],s.id,s.data)}}moveAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.move(r[n],s)}}moveBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.move(r[n],s)}}delete(e){this.deleteChildren(e),this.runOp({type:5,id:e})}};function wy(i,e,t){if(i.length>0){let r=i[i.length-1];if(r.type===0&&e.type===0&&Wd.equal(r.path,t)){Object.assign(r.props,e.props);return}}i.push(xe(ie({},e),{path:t}))}var kd=class{constructor(e){this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(e!=="")throw new Error("");this._current=t}push(e,t,r,n){wy(this.ts,t,e),wy(this.actual,r,e),wy(this.reverse,n,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function Hd(i,e,t){return t instanceof qn?new Ml(i,e,t):t instanceof rr?new Al(i,e,t):t instanceof jn?new Proxy(new My(i,e,t),uO):t!==null&&typeof t=="object"?eM(t)?t:new Proxy(new Sy(i,e,t),hO):t}function Ay(i){let e=new kd(i);return[Hd(e,"",i),e]}function Ty(i,e){let[t,r]=Ay(i);return e(t),r.result()}function Ey(i){return i instanceof Ml||i instanceof Al?i._current:i!==null&&typeof i=="object"?i[iM]:i}var Wd;(r=>{function i(n,s){if(s.length===n.length)for(var o=0;o<n.length;){if(n[o]!==s[o])return!1;o+=1}else return!1;return!0}r.equal=i;function e(n,s,o){let a=t(o,n);if(a!==void 0&&typeof a=="object"&&a!==null){let l=ie({},s);return Object.keys(a).forEach(c=>{delete l[c]}),l}else return s}r.removeOverridden=e;function t(n,s,o=0){if(s.length<=o)return n;if((n instanceof qn||n instanceof Ml)&&typeof s[o]=="string")return t(n.data(s[o]),s,o+1);if((n instanceof rr||n instanceof Al)&&typeof s[o]=="string")return t(n.data(s[o]),s,o+1);if(typeof s[o]=="number"&&Array.isArray(n))return t(n[s[o]],s,o+1);if(typeof s[o]=="string"&&typeof n=="object")return t(n[s[o]],s,o+1)}r.zoom=t})(Wd||(Wd={}));var jd=class{},Ph=class extends jd{constructor(t){super();this.id=t}},Lh=class extends jd{constructor(t){super();this.data=t}};var Cy;try{Cy=new TextDecoder}catch{}var Re,ro,$=0;var dM=[],Dy=dM,Py=0,Sn={},Ct,to,Yn=0,Ii=0,In,fs,fn=[],Bt,oM={useRecords:!1,mapsAsObjects:!0},Ih=class{},Iy=new Ih;Iy.name="MessagePack 0xC1";var Tl=!1,Ri=class{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0)),Object.assign(this,e)}unpack(e,t){if(Re)return vM(()=>(Yd(),this?this.unpack(e,t):Ri.prototype.unpack.call(oM,e,t)));ro=t>-1?t:e.length,$=0,Py=0,Ii=0,to=null,Dy=dM,In=null,Re=e;try{Bt=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(r){throw Re=null,e instanceof Uint8Array?r:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof Ri){if(Sn=this,this.structures)return Ct=this.structures,qd();(!Ct||Ct.length>0)&&(Ct=[])}else Sn=oM,(!Ct||Ct.length>0)&&(Ct=[]);return qd()}unpackMultiple(e,t){let r,n=0;try{Tl=!0;let s=e.length,o=this?this.unpack(e,s):Jd.unpack(e,s);if(t){for(t(o);$<s;)if(n=$,t(qd())===!1)return}else{for(r=[o];$<s;)n=$,r.push(qd());return r}}catch(s){throw s.lastPosition=n,s.values=r,s}finally{Tl=!1,Yd()}}_mergeStructures(e,t){e=e||[];for(let r=0,n=e.length;r<n;r++){let s=e[r];s&&(s.isShared=!0,r>=32&&(s.highByte=r-32>>5))}e.sharedLength=e.length;for(let r in t||[])if(r>=0){let n=e[r],s=t[r];s&&(n&&((e.restoreStructures||(e.restoreStructures=[]))[r]=n),e[r]=s)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function qd(){try{if(!Sn.trusted&&!Tl){let e=Ct.sharedLength||0;e<Ct.length&&(Ct.length=e)}let i=lr();if($==ro)Ct.restoreStructures&&aM(),Ct=null,Re=null,fs&&(fs=null);else if($>ro){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}else if(!Tl)throw new Error("Data read, but end of buffer not reached");return i}catch(i){throw Ct.restoreStructures&&aM(),Yd(),(i instanceof RangeError||i.message.startsWith("Unexpected end of buffer"))&&(i.incomplete=!0),i}}function aM(){for(let i in Ct.restoreStructures)Ct[i]=Ct.restoreStructures[i];Ct.restoreStructures=null}function lr(){let i=Re[$++];if(i<160)if(i<128){if(i<64)return i;{let e=Ct[i&63]||Sn.getStructures&&pM()[i&63];return e?(e.read||(e.read=Ry(e,i&63)),e.read()):i}}else if(i<144)if(i-=128,Sn.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[gM()]=lr();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(lr(),lr());return e}else{i-=144;let e=new Array(i);for(let t=0;t<i;t++)e[t]=lr();return e}else if(i<192){let e=i-160;if(Ii>=$)return to.slice($-Yn,($+=e)-Yn);if(Ii==0&&ro<140){let t=e<16?By(e):mM(e);if(t!=null)return t}return Ly(e)}else{let e;switch(i){case 192:return null;case 193:return In?(e=lr(),e>0?In[1].slice(In.position1,In.position1+=e):In[0].slice(In.position0,In.position0-=e)):Iy;case 194:return!1;case 195:return!0;case 196:return _y(Re[$++]);case 197:return e=Bt.getUint16($),$+=2,_y(e);case 198:return e=Bt.getUint32($),$+=4,_y(e);case 199:return jo(Re[$++]);case 200:return e=Bt.getUint16($),$+=2,jo(e);case 201:return e=Bt.getUint32($),$+=4,jo(e);case 202:if(e=Bt.getFloat32($),Sn.useFloat32>2){let t=Qd[(Re[$]&127)<<1|Re[$+1]>>7];return $+=4,(t*e+(e>0?.5:-.5)>>0)/t}return $+=4,e;case 203:return e=Bt.getFloat64($),$+=8,e;case 204:return Re[$++];case 205:return e=Bt.getUint16($),$+=2,e;case 206:return e=Bt.getUint32($),$+=4,e;case 207:return Sn.int64AsNumber?(e=Bt.getUint32($)*4294967296,e+=Bt.getUint32($+4)):e=Bt.getBigUint64($),$+=8,e;case 208:return Bt.getInt8($++);case 209:return e=Bt.getInt16($),$+=2,e;case 210:return e=Bt.getInt32($),$+=4,e;case 211:return Sn.int64AsNumber?(e=Bt.getInt32($)*4294967296,e+=Bt.getUint32($+4)):e=Bt.getBigInt64($),$+=8,e;case 212:if(e=Re[$++],e==114)return fM(Re[$++]&63);{let t=fn[e];if(t)return t.read?($++,t.read(lr())):t.noBuffer?($++,t()):t(Re.subarray($,++$));throw new Error("Unknown extension "+e)}case 213:return e=Re[$],e==114?($++,fM(Re[$++]&63,Re[$++])):jo(2);case 214:return jo(4);case 215:return jo(8);case 216:return jo(16);case 217:return e=Re[$++],Ii>=$?to.slice($-Yn,($+=e)-Yn):dO(e);case 218:return e=Bt.getUint16($),$+=2,Ii>=$?to.slice($-Yn,($+=e)-Yn):pO(e);case 219:return e=Bt.getUint32($),$+=4,Ii>=$?to.slice($-Yn,($+=e)-Yn):mO(e);case 220:return e=Bt.getUint16($),$+=2,cM(e);case 221:return e=Bt.getUint32($),$+=4,cM(e);case 222:return e=Bt.getUint16($),$+=2,hM(e);case 223:return e=Bt.getUint32($),$+=4,hM(e);default:if(i>=224)return i-256;if(i===void 0){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}throw new Error("Unknown MessagePack token "+i)}}}var fO=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Ry(i,e){function t(){if(t.count++>2){let n=i.read=new Function("r","return function(){return {"+i.map(s=>fO.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"}}")(lr);return i.highByte===0&&(i.read=lM(e,i.read)),n()}let r={};for(let n=0,s=i.length;n<s;n++){let o=i[n];r[o]=lr()}return r}return t.count=0,i.highByte===0?lM(e,t):t}var lM=(i,e)=>function(){let t=Re[$++];if(t===0)return e();let r=i<32?-(i+(t<<5)):i+(t<<5),n=Ct[r]||pM()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=Ry(n,i)),n.read()};function pM(){let i=vM(()=>(Re=null,Sn.getStructures()));return Ct=Sn._mergeStructures(i,Ct)}var Ly=Xd,dO=Xd,pO=Xd,mO=Xd;function Xd(i){let e;if(i<16&&(e=By(i)))return e;if(i>64&&Cy)return Cy.decode(Re.subarray($,$+=i));let t=$+i,r=[];for(e="";$<t;){let n=Re[$++];if((n&128)===0)r.push(n);else if((n&224)===192){let s=Re[$++]&63;r.push((n&31)<<6|s)}else if((n&240)===224){let s=Re[$++]&63,o=Re[$++]&63;r.push((n&31)<<12|s<<6|o)}else if((n&248)===240){let s=Re[$++]&63,o=Re[$++]&63,a=Re[$++]&63,l=(n&7)<<18|s<<12|o<<6|a;l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|l&1023),r.push(l)}else r.push(n);r.length>=4096&&(e+=Br.apply(String,r),r.length=0)}return r.length>0&&(e+=Br.apply(String,r)),e}function cM(i){let e=new Array(i);for(let t=0;t<i;t++)e[t]=lr();return e}function hM(i){if(Sn.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[gM()]=lr();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(lr(),lr());return e}}var Br=String.fromCharCode;function mM(i){let e=$,t=new Array(i);for(let r=0;r<i;r++){let n=Re[$++];if((n&128)>0){$=e;return}t[r]=n}return Br.apply(String,t)}function By(i){if(i<4)if(i<2){if(i===0)return"";{let e=Re[$++];if((e&128)>1){$-=1;return}return Br(e)}}else{let e=Re[$++],t=Re[$++];if((e&128)>0||(t&128)>0){$-=2;return}if(i<3)return Br(e,t);let r=Re[$++];if((r&128)>0){$-=3;return}return Br(e,t,r)}else{let e=Re[$++],t=Re[$++],r=Re[$++],n=Re[$++];if((e&128)>0||(t&128)>0||(r&128)>0||(n&128)>0){$-=4;return}if(i<6){if(i===4)return Br(e,t,r,n);{let s=Re[$++];if((s&128)>0){$-=5;return}return Br(e,t,r,n,s)}}else if(i<8){let s=Re[$++],o=Re[$++];if((s&128)>0||(o&128)>0){$-=6;return}if(i<7)return Br(e,t,r,n,s,o);let a=Re[$++];if((a&128)>0){$-=7;return}return Br(e,t,r,n,s,o,a)}else{let s=Re[$++],o=Re[$++],a=Re[$++],l=Re[$++];if((s&128)>0||(o&128)>0||(a&128)>0||(l&128)>0){$-=8;return}if(i<10){if(i===8)return Br(e,t,r,n,s,o,a,l);{let c=Re[$++];if((c&128)>0){$-=9;return}return Br(e,t,r,n,s,o,a,l,c)}}else if(i<12){let c=Re[$++],h=Re[$++];if((c&128)>0||(h&128)>0){$-=10;return}if(i<11)return Br(e,t,r,n,s,o,a,l,c,h);let u=Re[$++];if((u&128)>0){$-=11;return}return Br(e,t,r,n,s,o,a,l,c,h,u)}else{let c=Re[$++],h=Re[$++],u=Re[$++],f=Re[$++];if((c&128)>0||(h&128)>0||(u&128)>0||(f&128)>0){$-=12;return}if(i<14){if(i===12)return Br(e,t,r,n,s,o,a,l,c,h,u,f);{let d=Re[$++];if((d&128)>0){$-=13;return}return Br(e,t,r,n,s,o,a,l,c,h,u,f,d)}}else{let d=Re[$++],p=Re[$++];if((d&128)>0||(p&128)>0){$-=14;return}if(i<15)return Br(e,t,r,n,s,o,a,l,c,h,u,f,d,p);let m=Re[$++];if((m&128)>0){$-=15;return}return Br(e,t,r,n,s,o,a,l,c,h,u,f,d,p,m)}}}}}function _y(i){return Sn.copyBuffers?Uint8Array.prototype.slice.call(Re,$,$+=i):Re.subarray($,$+=i)}function jo(i){let e=Re[$++];if(fn[e])return fn[e](Re.subarray($,$+=i));throw new Error("Unknown extension type "+e)}var uM=new Array(4096);function gM(){let i=Re[$++];if(i>=160&&i<192){if(i=i-160,Ii>=$)return to.slice($-Yn,($+=i)-Yn);if(!(Ii==0&&ro<180))return Ly(i)}else return $--,lr();let e=(i<<5^(i>1?Bt.getUint16($):i>0?Re[$]:0))&4095,t=uM[e],r=$,n=$+i-3,s,o=0;if(t&&t.bytes==i){for(;r<n;){if(s=Bt.getUint32(r),s!=t[o++]){r=1879048192;break}r+=4}for(n+=3;r<n;)if(s=Re[r++],s!=t[o++]){r=1879048192;break}if(r===n)return $=r,t.string;n-=3,r=$}for(t=[],uM[e]=t,t.bytes=i;r<n;)s=Bt.getUint32(r),t.push(s),r+=4;for(n+=3;r<n;)s=Re[r++],t.push(s);let a=i<16?By(i):mM(i);return a!=null?t.string=a:t.string=Ly(i)}var fM=(i,e)=>{var t=lr();let r=i;e!==void 0&&(i=i<32?-((e<<5)+i):(e<<5)+i,t.highByte=e);let n=Ct[i];return n&&n.isShared&&((Ct.restoreStructures||(Ct.restoreStructures=[]))[i]=n),Ct[i]=t,t.read=Ry(t,r),t.read()},yM=typeof self=="object"?self:global;fn[0]=()=>{};fn[0].noBuffer=!0;fn[101]=()=>{let i=lr();return(yM[i[0]]||Error)(i[1])};fn[105]=i=>{let e=Bt.getUint32($-4);fs||(fs=new Map);let t=Re[$],r;t>=144&&t<160||t==220||t==221?r=[]:r={};let n={target:r};fs.set(e,n);let s=lr();return n.used?Object.assign(r,s):(n.target=s,s)};fn[112]=i=>{let e=Bt.getUint32($-4),t=fs.get(e);return t.used=!0,t.target};fn[115]=()=>new Set(lr());var Ny=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array");fn[116]=i=>{let e=i[0],t=Ny[e];if(!t)throw new Error("Could not find typed array for code "+e);return new yM[t](Uint8Array.prototype.slice.call(i,1).buffer)};fn[120]=()=>{let i=lr();return new RegExp(i[0],i[1])};fn[98]=i=>{let e=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],t=$;$+=e-4,In=[lr(),lr()],In.position0=0,In.position1=0;let r=$;$=t;try{return lr()}finally{$=r}};fn[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");function vM(i){let e=ro,t=$,r=Py,n=Yn,s=Ii,o=to,a=Dy,l=fs,c=In,h=new Uint8Array(Re.slice(0,ro)),u=Ct,f=Ct.slice(0,Ct.length),d=Sn,p=Tl,m=i();return ro=e,$=t,Py=r,Yn=n,Ii=s,to=o,Dy=a,fs=l,In=c,Re=h,Tl=p,Ct=u,Ct.splice(0,Ct.length,...f),Sn=d,Bt=new DataView(Re.buffer,Re.byteOffset,Re.byteLength),m}function Yd(){Re=null,fs=null,Ct=null}function xM(i){i.unpack?fn[i.type]=i.unpack:fn[i.type]=i}var Qd=new Array(147);for(let i=0;i<256;i++)Qd[i]=+("1e"+Math.floor(45.15-i*.30103));var Jd=new Ri({useRecords:!1}),gO=Jd.unpack,yO=Jd.unpackMultiple,vO=Jd.unpack,Kd={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},xO=new Float32Array(1),I9=new Uint8Array(xO.buffer,0,4);var Zd;try{Zd=new TextEncoder}catch{}var $d,Fy,ep=typeof Buffer<"u",Oy=ep?Buffer.allocUnsafeSlow:Uint8Array,MM=ep?Buffer:Uint8Array,bM=ep?4294967296:2144337920,de,dr,ae=0,Bi,Ni=null,bO=/[\u0080-\uFFFF]/,Rh=Symbol("record-id"),qo=class extends Ri{constructor(e){super(e),this.offset=0;let t,r,n,s,o,a,l=0,c=MM.prototype.utf8Write?function(x,E,_){return de.utf8Write(x,E,_)}:Zd&&Zd.encodeInto?function(x,E){return Zd.encodeInto(x,de.subarray(E)).written}:!1,h=this;e||(e={});let u=e&&e.sequential,f=e.structures||e.saveStructures,d=e.maxSharedStructures;if(d==null&&(d=f?32:0),d>8160)throw new Error("Maximum maxSharedStructure is 8160");let p=e.maxOwnStructures;p==null&&(p=f?32:64),u&&!e.saveStructures&&(this.structures=[]);let m=d>32||p+d>64,g=d+64,v=d+p+64;if(v>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let y=[],w=0,b=0;this.pack=this.encode=function(x,E){if(de||(de=new Oy(8192),dr=new DataView(de.buffer,0,8192),ae=0),Bi=de.length-10,Bi-ae<2048?(de=new Oy(de.length),dr=new DataView(de.buffer,0,de.length),Bi=de.length-10,ae=0):ae=ae+7&2147483640,r=ae,a=h.structuredClone?new Map:null,h.bundleStrings?(Ni=["",""],de[ae++]=214,de[ae++]=98,Ni.position=ae-r,ae+=4):Ni=null,n=h.structures,n){n.uninitialized&&(n=h._mergeStructures(h.getStructures()));let _=n.sharedLength||0;if(_>d)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+n.sharedLength);if(!n.transitions){n.transitions=Object.create(null);for(let C=0;C<_;C++){let I=n[C];if(!I)continue;let N,R=n.transitions;for(let k=0,G=I.length;k<G;k++){let te=I[k];N=R[te],N||(N=R[te]=Object.create(null)),R=N}R[Rh]=C+64}l=_}u||(n.nextId=_+64)}s&&(s=!1),o=n||[];try{if(S(x),Ni){dr.setUint32(Ni.position+r,ae-Ni.position-r);let _=Ni;Ni=null,S(_[0]),S(_[1])}if(h.offset=ae,a&&a.idsToInsert){ae+=a.idsToInsert.length*6,ae>Bi&&A(ae),h.offset=ae;let _=SO(de.subarray(r,ae),a.idsToInsert);return a=null,_}return E&TM?(de.start=r,de.end=ae,de):de.subarray(r,ae)}finally{if(n){if(b<10&&b++,w>1e4)n.transitions=null,b=0,w=0,y.length>0&&(y=[]);else if(y.length>0&&!u){for(let _=0,C=y.length;_<C;_++)y[_][Rh]=0;y=[]}if(s&&h.saveStructures){let _=n.sharedLength||d;n.length>_&&(n=n.slice(0,_));let C=de.subarray(r,ae);return h.saveStructures(n,l)===!1?(h._mergeStructures(h.getStructures()),h.pack(x)):(l=_,C)}}E&DO&&(ae=r)}};let S=x=>{ae>Bi&&(de=A(ae));var E=typeof x,_;if(E==="string"){let C=x.length;if(Ni&&C>=8&&C<4096){let R=bO.test(x);Ni[R?0:1]+=x,de[ae++]=193,S(R?-C:C);return}let I;C<32?I=1:C<256?I=2:C<65536?I=3:I=5;let N=C*3;if(ae+N>Bi&&(de=A(ae+N)),C<64||!c){let R,k,G,te=ae+I;for(R=0;R<C;R++)k=x.charCodeAt(R),k<128?de[te++]=k:k<2048?(de[te++]=k>>6|192,de[te++]=k&63|128):(k&64512)===55296&&((G=x.charCodeAt(R+1))&64512)===56320?(k=65536+((k&1023)<<10)+(G&1023),R++,de[te++]=k>>18|240,de[te++]=k>>12&63|128,de[te++]=k>>6&63|128,de[te++]=k&63|128):(de[te++]=k>>12|224,de[te++]=k>>6&63|128,de[te++]=k&63|128);_=te-ae-I}else _=c(x,ae+I,N);_<32?de[ae++]=160|_:_<256?(I<2&&de.copyWithin(ae+2,ae+1,ae+1+_),de[ae++]=217,de[ae++]=_):_<65536?(I<3&&de.copyWithin(ae+3,ae+2,ae+2+_),de[ae++]=218,de[ae++]=_>>8,de[ae++]=_&255):(I<5&&de.copyWithin(ae+5,ae+3,ae+3+_),de[ae++]=219,dr.setUint32(ae,_),ae+=4),ae+=_}else if(E==="number")if(x>>>0===x)x<64?de[ae++]=x:x<256?(de[ae++]=204,de[ae++]=x):x<65536?(de[ae++]=205,de[ae++]=x>>8,de[ae++]=x&255):(de[ae++]=206,dr.setUint32(ae,x),ae+=4);else if(x>>0===x)x>=-32?de[ae++]=256+x:x>=-128?(de[ae++]=208,de[ae++]=x+256):x>=-32768?(de[ae++]=209,dr.setInt16(ae,x),ae+=2):(de[ae++]=210,dr.setInt32(ae,x),ae+=4);else{let C;if((C=this.useFloat32)>0&&x<4294967296&&x>=-2147483648){de[ae++]=202,dr.setFloat32(ae,x);let I;if(C<4||(I=x*Qd[(de[ae]&127)<<1|de[ae+1]>>7])>>0===I){ae+=4;return}else ae--}de[ae++]=203,dr.setFloat64(ae,x),ae+=8}else if(E==="object")if(!x)de[ae++]=192;else{if(a){let I=a.get(x);if(I){if(!I.id){let N=a.idsToInsert||(a.idsToInsert=[]);I.id=N.push(I)}de[ae++]=214,de[ae++]=112,dr.setUint32(ae,I.id),ae+=4;return}else a.set(x,{offset:ae-r})}let C=x.constructor;if(C===Object)T(x,!0);else if(C===Array){_=x.length,_<16?de[ae++]=144|_:_<65536?(de[ae++]=220,de[ae++]=_>>8,de[ae++]=_&255):(de[ae++]=221,dr.setUint32(ae,_),ae+=4);for(let I=0;I<_;I++)S(x[I])}else if(C===Map){_=x.size,_<16?de[ae++]=128|_:_<65536?(de[ae++]=222,de[ae++]=_>>8,de[ae++]=_&255):(de[ae++]=223,dr.setUint32(ae,_),ae+=4);for(let[I,N]of x)S(I),S(N)}else{for(let I=0,N=$d.length;I<N;I++){let R=Fy[I];if(x instanceof R){let k=$d[I];if(k.write){k.type&&(de[ae++]=212,de[ae++]=k.type,de[ae++]=0),S(k.write.call(this,x));return}let G=de,te=dr,Q=ae;de=null;let Y;try{Y=k.pack.call(this,x,F=>(de=G,G=null,ae+=F,ae>Bi&&A(ae),{target:de,targetView:dr,position:ae-F}),S)}finally{G&&(de=G,dr=te,ae=Q,Bi=de.length-10)}Y&&(Y.length+ae>Bi&&A(Y.length+ae),ae=wO(Y,de,ae,k.type));return}}T(x,!x.hasOwnProperty)}}else if(E==="boolean")de[ae++]=x?195:194;else if(E==="bigint"){if(x<BigInt(1)<<BigInt(63)&&x>=-(BigInt(1)<<BigInt(63)))de[ae++]=211,dr.setBigInt64(ae,x);else if(x<BigInt(1)<<BigInt(64)&&x>0)de[ae++]=207,dr.setBigUint64(ae,x);else if(this.largeBigIntToFloat)de[ae++]=203,dr.setFloat64(ae,Number(x));else throw new RangeError(x+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");ae+=8}else if(E==="undefined")this.encodeUndefinedAsNil?de[ae++]=192:(de[ae++]=212,de[ae++]=0,de[ae++]=0);else if(E==="function")S(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+E)},T=this.useRecords===!1?this.variableMapSize?x=>{let E=Object.keys(x),_=E.length;_<16?de[ae++]=128|_:_<65536?(de[ae++]=222,de[ae++]=_>>8,de[ae++]=_&255):(de[ae++]=223,dr.setUint32(ae,_),ae+=4);let C;for(let I=0;I<_;I++)S(C=E[I]),S(x[C])}:(x,E)=>{de[ae++]=222;let _=ae-r;ae+=2;let C=0;for(let I in x)(E||x.hasOwnProperty(I))&&(S(I),S(x[I]),C++);de[_+++r]=C>>8,de[_+r]=C&255}:x=>{let E=Object.keys(x),_,C=o.transitions||(o.transitions=Object.create(null)),I=0;for(let R=0,k=E.length;R<k;R++){let G=E[R];_=C[G],_||(_=C[G]=Object.create(null),I++),C=_}let N=C[Rh];if(N)N>=96&&m?(de[ae++]=((N-=96)&31)+96,de[ae++]=N>>5):de[ae++]=N;else{N=o.nextId,N||(N=64),N<g&&this.shouldShareStructure&&!this.shouldShareStructure(E)?(N=o.nextOwnId,N<v||(N=g),o.nextOwnId=N+1):(N>=v&&(N=g),o.nextId=N+1);let R=E.highByte=N>=96&&m?N-96>>5:-1;C[Rh]=N,o[N-64]=E,N<g?(E.isShared=!0,o.sharedLength=N-63,s=!0,R>=0?(de[ae++]=(N&31)+96,de[ae++]=R):de[ae++]=N):(R>=0?(de[ae++]=213,de[ae++]=114,de[ae++]=(N&31)+96,de[ae++]=R):(de[ae++]=212,de[ae++]=114,de[ae++]=N),I&&(w+=b*I),y.length>=p&&(y.shift()[Rh]=0),y.push(C),S(E))}for(let R=0,k=E.length;R<k;R++)S(x[E[R]])},A=x=>{let E;if(x>16777216){if(x-r>bM)throw new Error("Packed buffer would be larger than maximum buffer size");E=Math.min(bM,Math.round(Math.max((x-r)*(x>67108864?1.25:2),4194304)/4096)*4096)}else E=(Math.max(x-r<<2,de.length-1)>>12)+1<<12;let _=new Oy(E);return dr=new DataView(_.buffer,0,E),de.copy?de.copy(_,0,r,x):_.set(de.slice(r,x)),ae-=r,r=0,Bi=_.length-10,de=_}}useBuffer(e){de=e,dr=new DataView(de.buffer,de.byteOffset,de.byteLength),ae=0}};Fy=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Ih];$d=[{pack(i,e,t){let r=i.getTime()/1e3;if((this.useTimestamp32||i.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:n,targetView:s,position:o}=e(6);n[o++]=214,n[o++]=255,s.setUint32(o,r)}else if(r>0&&r<17179869184){let{target:n,targetView:s,position:o}=e(10);n[o++]=215,n[o++]=255,s.setUint32(o,i.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),s.setUint32(o+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return e(0),t(this.onInvalidDate());let{target:n,targetView:s,position:o}=e(3);n[o++]=212,n[o++]=255,n[o++]=255}else{let{target:n,targetView:s,position:o}=e(15);n[o++]=199,n[o++]=12,n[o++]=255,s.setUint32(o,i.getMilliseconds()*1e6),s.setBigInt64(o+4,BigInt(Math.floor(r)))}}},{pack(i,e,t){let r=Array.from(i),{target:n,position:s}=e(this.structuredClone?3:0);this.structuredClone&&(n[s++]=212,n[s++]=115,n[s++]=0),t(r)}},{pack(i,e,t){let{target:r,position:n}=e(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=101,r[n++]=0),t([i.name,i.message])}},{pack(i,e,t){let{target:r,position:n}=e(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=120,r[n++]=0),t([i.source,i.flags])}},{pack(i,e){this.structuredClone?wM(i,16,e):SM(ep?Buffer.from(i):new Uint8Array(i),e)}},{pack(i,e){let t=i.constructor;t!==MM&&this.structuredClone?wM(i,Ny.indexOf(t.name),e):SM(i,e)}},{pack(i,e){let{target:t,position:r}=e(1);t[r]=193}}];function wM(i,e,t,r){let n=i.byteLength;if(n+1<256){var{target:s,position:o}=t(4+n);s[o++]=199,s[o++]=n+1}else if(n+1<65536){var{target:s,position:o}=t(5+n);s[o++]=200,s[o++]=n+1>>8,s[o++]=n+1&255}else{var{target:s,position:o,targetView:a}=t(7+n);s[o++]=201,a.setUint32(o,n+1),o+=4}s[o++]=116,s[o++]=e,s.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),o)}function SM(i,e){let t=i.byteLength;var r,n;if(t<256){var{target:r,position:n}=e(t+2);r[n++]=196,r[n++]=t}else if(t<65536){var{target:r,position:n}=e(t+3);r[n++]=197,r[n++]=t>>8,r[n++]=t&255}else{var{target:r,position:n,targetView:s}=e(t+5);r[n++]=198,s.setUint32(n,t),n+=4}r.set(i,n)}function wO(i,e,t,r){let n=i.length;switch(n){case 1:e[t++]=212;break;case 2:e[t++]=213;break;case 4:e[t++]=214;break;case 8:e[t++]=215;break;case 16:e[t++]=216;break;default:n<256?(e[t++]=199,e[t++]=n):n<65536?(e[t++]=200,e[t++]=n>>8,e[t++]=n&255):(e[t++]=201,e[t++]=n>>24,e[t++]=n>>16&255,e[t++]=n>>8&255,e[t++]=n&255)}return e[t++]=r,e.set(i,t),t+=n,t}function SO(i,e){let t,r=e.length*6,n=i.length-r;for(e.sort((s,o)=>s.offset>o.offset?1:-1);t=e.pop();){let s=t.offset,o=t.id;i.copyWithin(s+r,s,n),r-=6;let a=s+r;i[a++]=214,i[a++]=105,i[a++]=o>>24,i[a++]=o>>16&255,i[a++]=o>>8&255,i[a++]=o&255,n=s}return i}function Yo(i){if(i.Class){if(!i.pack&&!i.write)throw new Error("Extension has no pack or write function");if(i.pack&&!i.type)throw new Error("Extension has no type (numeric code to identify the extension)");Fy.unshift(i.Class),$d.unshift(i)}xM(i)}var AM=new qo({useRecords:!1}),MO=AM.pack,AO=AM.pack;var{NEVER:TO,ALWAYS:EO,DECIMAL_ROUND:_O,DECIMAL_FIT:CO}=Kd,TM=512,DO=1024;var EM=new qo({structuredClone:!0});Yo({Class:jn.prototype.constructor,type:1,write(i){return ie({},i)},read(i){return Object.setPrototypeOf(i,jn.prototype),i}});Yo({Class:rr.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,rr.prototype),i}});Yo({Class:qn.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,qn.prototype),i}});Yo({Class:Ph.prototype.constructor,type:4,write(i){return i.id},read(i){return new Ph(i)}});Yo({Class:Lh.prototype.constructor,type:5,write(i){return i.data},read(i){return new Lh(i)}});function PO(i){var e=0;if(i.length===0)return e;for(let t=0;t<i.length;t++){let r=i[t];e=(e<<5)-e+r,e=e&e}return e}var tp;(r=>{function i(n){return EM.pack(n)}r.serialize=i;function e(n){return EM.unpack(n)}r.deserialize=e;function t(n){return PO(i(n)).toString()}r.checksum=t})(tp||(tp={}));var rp;(t=>{t.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function e(r){return t.all.includes(r)}t.is=e})(rp||(rp={}));var np;(t=>{function i(r){return e(r)}t.defaultData=i;function e(r){if(r==="PointLight")return{type:r,color:Ln.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,depth:2500,helper:!0};if(r==="SpotLight")return{type:r,color:Ln.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:2500,helper:!0};if(r==="DirectionalLight")return{type:r,color:Ln.white,intensity:1,shadows:!0,size:2500,depth:2500,helper:!0};throw new Error("not implemented")}})(np||(np={}));var Uy;(t=>{t.defaultData={castShadow:!0,receiveShadow:!0};function e(r,n){return r.castShadow===n.castShadow&&r.receiveShadow===n.receiveShadow}t.equals=e})(Uy||(Uy={}));var zy;(t=>{t.defaultData={flatShading:!1,wireframe:!1,side:0};function e(r,n){return r.flatShading===n.flatShading&&r.side===n.side&&r.wireframe===n.wireframe}t.equals=e})(zy||(zy={}));var ip;(e=>e.defaultData=xe(ie(ie({},zy.defaultData),Uy.defaultData),{cloner:null,booleanExclude:null}))(ip||(ip={}));var Gy=(n=>(n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.Center=3]="Center",n[n.Justify=4]="Justify",n))(Gy||{}),ky=(r=>(r[r.Top=1]="Top",r[r.Center=2]="Center",r[r.Bottom=3]="Bottom",r))(ky||{}),Vy=(r=>(r[r.None=1]="None",r[r.Upper=2]="Upper",r[r.Lower=3]="Lower",r))(Vy||{}),sp;(e=>e.defaultData={width:100,height:100,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.5,letterSpacing:1,text:"",textTransform:1,color:Ln.fromHexAndA(6974058,1),alpha:1,font:"roboto_regular"})(sp||(sp={}));var _M=["mode","gradientType","noiseType","displacementType","projection","cnormal","crop","axis","side"];var El;(r=>{function i(n,s){return n==="light"&&s?e(s):t(n)}r.defaultData=i;function e(n){switch(n){case"basic":return{type:"light",category:"basic",alpha:1,visible:!0,mode:0};case"phong":return{category:"phong",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"toon":return{category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"lambert":return{category:"lambert",emissive:{r:0,g:0,b:0,a:1},type:"light",alpha:1,visible:!0,mode:0};case"physical":return{category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0}}}function t(n){switch(n){case"texture":return{alpha:1,visible:!0,size:[128,128],mode:0,axis:"x",side:2,type:"texture",projection:0,texture:{image:"image_0",wrapping:1001,repeat:[1,1],offset:[0,0]},crop:!0};case"color":return{type:"color",alpha:1,visible:!0,mode:0,color:Ar.fromHex(4737101)};case"depth":return{type:"depth",alpha:1,visible:!0,mode:0,gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,near:50,far:200};case"normal":return{type:"normal",alpha:1,visible:!0,mode:0,cnormal:[1,1,1]};case"gradient":return{type:"gradient",alpha:1,visible:!0,mode:0,gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{type:"noise",alpha:1,visible:!0,mode:0,size:[100,100,100],noiseType:0,scale:1,move:1,colorA:xe(ie({},Ar.fromHex(6710886)),{a:1}),colorB:xe(ie({},Ar.fromHex(6710886)),{a:1}),colorC:xe(ie({},Ar.fromHex(16777215)),{a:1}),colorD:xe(ie({},Ar.fromHex(16777215)),{a:1}),distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8]};case"fresnel":return{type:"fresnel",alpha:1,visible:!0,mode:0,color:Ln.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{type:"rainbow",alpha:1,visible:!0,mode:0,filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"matcap":return{type:"matcap",alpha:1,visible:!0,mode:0,texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0]}};case"transmission":return{type:"transmission",alpha:1,visible:!0,mode:0,thickness:10,ior:1.5,roughness:1};case"displace":return{type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,visible:!0}}}})(El||(El={}));var hi;(a=>{function i(l){return!l.layers.some(h=>{if(h.data.type==="texture"&&h.data.projection!==0||h.data.type==="depth"&&!h.data.isWorldSpace||h.data.type==="noise"||h.data.type==="displace")return!0})&&!t(l)}a.isMergable=i;function e(l){let c="";return l.layers.forEach(h=>{Object.entries(h.data).forEach(([u,f])=>{c+=`${u}${f}`,Array.isArray(f)?f.forEach(d=>c+=`${d}`):typeof f=="object"?Object.values(f).forEach(d=>{typeof d=="number"?c+=`${d.toFixed(4)}`:c+=`${d}`}):c+=`${f}`})}),c}a.getHash=e;function t(l){let c=0;for(let h of l.layers)"alpha"in h.data&&h.data.type!=="light"&&h.data.type!=="fresnel"&&(c+=(1-c)*h.data.alpha);return c<1}a.isTransparent=t;function r(){return{layers:new rr}}a.defaultEmptyData=r;function n(l="layer1",c="layer2"){return s("phong",l,c)}a.defaultData=n;function s(l,c="layer1",h="layer2"){let u=new rr;return u.push({fi:0,data:El.defaultData("light",l),id:c}),u.push({fi:1,data:El.defaultData("color"),id:h}),{layers:u}}a.defaultTwoLayerData=s;function o(l,c="basic",h="layer1",u="layer2"){let f=El.defaultData("texture");Object.assign(f.texture,{image:l});let d=new rr;return d.push({fi:0,data:f,id:h}),d.push({fi:1,data:El.defaultData("light",c),id:u}),{layers:d}}a.defaultTwoLayerTextureData=o})(hi||(hi={}));var _l;(e=>{function i(){return{points:new rr,roundness:0,shapeHoles:[],isClosed:!1}}e.defaultData=i})(_l||(_l={}));var op;(e=>{function i(t){return t==="PolygonGeometry"||t==="RectangleGeometry"||t==="StarGeometry"||t==="TriangleGeometry"||t==="EllipseGeometry"}e.is2DParametricMesh=i})(op||(op={}));var Bh;(e=>{function i(t){if(t==="RectangleGeometry")return{width:320,height:320,type:t,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(t==="VectorGeometry")return{width:1,height:1,type:t,subdivisions:12,shape:_l.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(t==="BooleanGeometry")return{type:t,operation:2,width:0,height:0,depth:0};throw new Error("not implemented")}e.defaultData=i})(Bh||(Bh={}));var Nh;(n=>{n.identity=xe(ie({},Nd.identity),{hiddenMatrix:Pi.identity});function e(s){return{position:s.position,rotation:s.rotation,scale:s.scale,hiddenMatrix:s.hiddenMatrix}}n.fromObject=e;function t(s,o){return{position:(o==null?void 0:o.position)||s.position,rotation:(o==null?void 0:o.rotation)||s.rotation,scale:(o==null?void 0:o.scale)||s.scale,hiddenMatrix:(o==null?void 0:o.hiddenMatrix)||s.hiddenMatrix}}n.merge=t;function r(s,o){return{position:br.isEqual(s.position,o.position)?null:o.position,rotation:br.isEqual(s.rotation,o.rotation)?null:o.rotation,scale:br.isEqual(s.scale,o.scale)?null:o.scale,hiddenMatrix:Pi.isEqual(s.hiddenMatrix,o.hiddenMatrix)?null:o.hiddenMatrix}}n.diff=r})(Nh||(Nh={}));var ds;(e=>e.defaultData=ie({states:new rr,events:new rr,visible:!0,raycastLock:!1},Nh.identity))(ds||(ds={}));var CM;(e=>e.defaultData=ie({type:"Empty"},ds.defaultData))(CM||(CM={}));var ap;(e=>e.defaultData=ie(ie({type:"Mesh"},ds.defaultData),ip.defaultData))(ap||(ap={}));var DM;(e=>e.defaultData=ie(ie({type:"TextFrame"},ds.defaultData),sp.defaultData))(DM||(DM={}));var lp;(e=>e.defaultData=ie(ie(ie({},ds.defaultData),Nh.identity),Wo.defaultData))(lp||(lp={}));var PM;(e=>{function i(t){return ie(ie({},ds.defaultData),np.defaultData(t))}e.defaultData=i})(PM||(PM={}));var LM;(r=>(r.defaultCamera=ie({position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:Pi.identity,name:"Play Camera",visible:!0,raycastLock:!1,states:new rr,events:new rr},Wo.defaultData),r.defaultMeshObject=xe(ie(ie({name:"Rectangle"},ds.defaultData),ap.defaultData),{geometry:Bh.defaultData("RectangleGeometry"),material:hi.defaultTwoLayerData("basic","layer1","layer2")}),r.defaultBooleanObject=xe(ie(ie({name:"Boolean"},ds.defaultData),ap.defaultData),{geometry:Bh.defaultData("BooleanGeometry"),material:hi.defaultTwoLayerData("phong","layer1","layer2")})))(LM||(LM={}));var Oh;(t=>{function i(r,n){if(n===void 0)return r;let s=ie({},r);return"material"in s&&"material"in n&&n.material&&(s.material=Ty(s.material,o=>{if(typeof o!="string")for(let[a,l]of Object.entries(n.material.layers)){let c=o.layers.data(a);c&&Vo(c,l)}}).data),s.materials&&n.materials&&(s.materials=Ty(s.materials,o=>{var a,l;for(let c=0;c<s.materials.length;c++){let h=n.materials[c];if(typeof h!="string")for(let[u,f]of Object.entries(h.layers)){let d=(l=(a=o[c])==null?void 0:a.layers)==null?void 0:l.data(u);d&&Vo(d,f)}}}).data),s}t.patchMaterialState=i;function e(r,n){var o,a;if(n===void 0)return r;let s=ie({},r);if(Object.assign(s,Nh.merge(s,n)),eo.is(r.type)){s.orthographic=ie({},s.orthographic),s.perspective=ie({},s.perspective);let l=n;((o=l.orthographic)==null?void 0:o.zoom)!==void 0&&(s.orthographic.zoom=l.orthographic.zoom),((a=l.perspective)==null?void 0:a.zoom)!==void 0&&(s.perspective.zoom=l.perspective.zoom)}else if(r.type==="Mesh")s.geometry=ie({},s.geometry),Object.assign(s.geometry,n.geometry),s=i(s,n);else if(rp.is(r.type)){let l=n;s.intensity!==void 0&&(s.intensity=l.intensity),l.color!==void 0&&(typeof l.color=="string"?s.color=l.color:s.color=Ar.clone(l.color))}return s}t.patch=e})(Oh||(Oh={}));function RM(i,e=!1){let t=i[0].index!==null,r=new Set(Object.keys(i[0].attributes)),n=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Le,c=0;for(let h=0;h<i.length;++h){let u=i[h],f=0;if(t!==(u.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let d in u.attributes){if(!r.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. 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(u.attributes[d]),f++}if(f!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let d in u.morphAttributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(u.morphAttributes[d])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(u.userData),e){let d;if(t)d=u.index.count;else if(u.attributes.position!==void 0)d=u.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,d,h),c+=d}}if(t){let h=0,u=[];for(let f=0;f<i.length;++f){let d=i[f].index;for(let p=0;p<d.count;++p)u.push(d.getX(p)+h);h+=i[f].attributes.position.count}l.setIndex(u)}for(let h in s){let u=IM(s[h]);if(!u)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,u)}for(let h in o){let u=o[h][0].length;if(u===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let f=0;f<u;++f){let d=[];for(let m=0;m<o[h].length;++m)d.push(o[h][m][f]);let p=IM(d);if(!p)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(p)}}return l}function IM(i){let e,t,r,n=0;for(let a=0;a<i.length;++a){let l=i[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(r===void 0&&(r=l.normalized),r!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;n+=l.array.length}let s=new e(n),o=0;for(let a=0;a<i.length;++a)s.set(i[a].array,o),o+=i[a].array.length;return new Ve(s,t,r)}var Hy={type:"change"},BM={type:"changeZoom"},LO={type:"changePan"},Cl={type:"start"},Fh={type:"end"},Wy=new zt,IO=new B,RO=2*Math.PI,BO=1e-8,NO=.01,NM=2,jy=.125,OM=2,qy=1,Yy=1,Xy=.1;var cp=class extends Yt{constructor(t,r){super();this.object=t;this.domElement=r;this.enabled=!0;this.useKeyEvents=!0;this.enableDamping=!1;this.enableZoom=!0;this.enableRotate=!0;this.enablePan=!0;this.autoRotate=!1;this.rotationLimitsMode=0;this.panLimitsMode=0;this.rotationSoftLimit=2;this.panSoftLimit=2;this.hoverRotatePanMode=0;this.zoomLimitsEnabled=!1;this.preventScroll=!0;this.mouseButtons=[0,5];this.mouseButtonsPlay=[3,4,5];this.touches=[null,Cn.DOLLY_ROTATE,Cn.PAN];this.offset=new M;this.eye=new M;this.lastPosition=new M;this.lastQuaternion=new zt;this.current=new B;this.overShoot=new B;this.overRatio=new B;this.spherical=new uh;this.sphericalDelta=new uh;this.panOffset=new M;this.panLeftV=new M;this.panUpV=new M;this.panV=new M;this.rotateStart=new B;this.rotateEnd=new B;this.rotateDelta=new B;this.panStart=new B;this.panEnd=new B;this.panDelta=new B;this.dollyStart=new B;this.dollyEnd=new B;this.dollyDelta=new B;this.rotationRangeFactor=new B;this.panRangeFactor=new B;this.state=-1;this.zoomChanged=!1;this.isPointerDown=!1;this.isFirstHover=!0;this.isThetaFlipped=!1;this.prevScale=0;this.scale=1;this.gesture=!1;this.timer=-1;this.timerHover=-1;this.minDistance=0;this.maxDistance=1/0;this.minZoom=0;this.maxZoom=1/0;this.minPhi=0;this.maxPhi=Math.PI;this.minTheta=-1/0;this.maxTheta=1/0;this.minH=0;this.maxH=Math.PI;this.minV=-1/0;this.maxV=1/0;this.autoRotateClockwise=!0;this.isPanOverShoot=!1;this.isRotateOverShoot=!1;this.update=()=>{let t=this.object.position;this.offset.copy(t).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.autoRotate&&this.state===-1&&this.rotateLeft((this.autoRotateClockwise===!0?1:-1)*this.getAutoRotationAngle()),this.rotationLimitsMode!==0&&this.applyLimits(this.sphericalDelta,this.rotationLimitsMode,this.rotationSoftLimit,this.maxTheta,this.minTheta,this.maxPhi,this.minPhi,this.rotationRangeFactor),this.rotationLimitsMode!==2&&(this.spherical.phi+=this.sphericalDelta.phi),(this.rotationLimitsMode!==1||this.autoRotate===!0)&&(this.spherical.theta+=this.sphericalDelta.theta),this.spherical.radius*=this.scale,this.zoomLimitsEnabled&&(this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius))),this.panLimitsMode!==0&&(this.target.applyQuaternion(Wy.copy(this.object.quaternion).invert()),this.panOffset.applyQuaternion(Wy),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(this.object.quaternion),this.panOffset.applyQuaternion(this.object.quaternion)),this.panLimitsMode===2&&(this.panOffset.y=0),this.panLimitsMode===1&&(this.panOffset.x=0),this.state===-1&&!this.gesture?(this.panOffset.multiplyScalar(1-jy),this.target.add(this.panOffset)):(this.target.add(this.panOffset),this.panOffset.set(0,0,0)),this.offset.setFromSpherical(this.spherical),t.copy(this.target).add(this.offset);let r=this.spherical.phi%RO;return this.eye.copy(this.offset).normalize(),this.object.up.copy(ot.DefaultUp).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),r>0&&r>Math.PI||r<0&&r>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),this.state===-1||this.enableDamping===!0?(this.sphericalDelta.theta*=1-jy,this.sphericalDelta.phi*=1-jy):this.sphericalDelta.set(0,0,0),this.scale=1,this.zoomChanged||this.lastPosition.distanceToSquared(this.object.position)>NO||8*(1-this.lastQuaternion.dot(this.object.quaternion))>BO?(this.dispatchEvent(Hy),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),this.zoomChanged=!1,!0):(this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),!1)};this.onPointerDown=t=>{this.enabled!==!1&&(this.isPointerDown=!0,At.length===0&&(this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)),FO(t),t.pointerType==="touch"?this.onPointerDownTouch(t):this.onPointerDownMouse(t))};this.onPointerMove=t=>{this.enabled!==!1&&(t.pointerType==="touch"?this.onPointerMoveTouch(t):this.onPointerMoveMouse(t))};this.onPointerUp=t=>{UM(t),this.isPointerDown=!1,At.length===0&&(this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp)),this.dispatchEvent(Fh),this.state=-1};this.onPointerCancel=t=>{UM(t)};this.onPointerDownMouse=t=>{let r;switch(this.useKeyEvents?r=this.mouseButtons[t.button]:r=this.mouseButtonsPlay[t.button],r){case 0:if(t.altKey===!0&&!t.shiftKey&&!_h(t)){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else if(this.key===" "){if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}break;case 4:if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2;break;case 3:if(_h(t)||t.shiftKey){if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}break;case 5:if(_h(t)||t.shiftKey){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else{if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}break;default:this.state=-1}this.state!==-1&&this.dispatchEvent(Cl)};this.onPointerMoveMouse=t=>{switch(this.state){case 0:if(this.enableRotate===!1)return;this.handleMouseMoveRotate(t);break;case 1:if(this.enableZoom===!1)return;this.handleMouseMoveDolly(t);break;case 2:if(this.enablePan===!1)return;this.handleMouseMovePan(t);break}};this.onPointerDownTouch=t=>{switch(zM(t),this.touches[At.length-1]){case Cn.ROTATE:if(this.enableRotate===!1){this.state=-1;return}this.handleTouchStartRotate(),this.state=3;break;case Cn.PAN:if(this.enablePan===!1){this.state=-1;return}this.handleTouchStartPan(),this.state=4;break;case Cn.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchStartDollyPan(),this.state=5;break;case Cn.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}this.state!==-1&&this.dispatchEvent(Cl)};this.onPointerMoveTouch=t=>{switch(zM(t),this.state){case 3:if(this.enableRotate===!1)return;this.handleTouchMoveRotate(t),this.update();break;case 4:if(this.enablePan===!1)return;this.handleTouchMovePan(t),this.update();break;case 5:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchMoveDollyPan(t),this.update();break;case 6:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchMoveDollyRotate(t),this.update();break;default:this.state=-1}};this.dispatchEndDebounced=Mh(()=>this.dispatchEvent(Fh),33);this.onMouseWheel=t=>{this.enabled===!1||this.enableZoom===!1&&this.enablePan===!1||((this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth||this.preventScroll)&&t.preventDefault(),this.dispatchEvent(Cl),this.handleMouseWheel(t),this.dispatchEndDebounced())};this.onGesture=t=>{if(this.enabled!==!1)if(t.preventDefault(),t.type==="gesturechange"){if(this.enableZoom===!1)return;this.dispatchEvent(Cl),t.scale>this.prevScale?this.dollyIn(this.getZoomScale()):t.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=t.scale,this.update()}else this.dispatchEvent(Fh)};this.onContextMenu=t=>{this.enabled!==!1&&t.preventDefault()};this.onTouchMove=t=>{(t.touches.length>1||this.preventScroll)&&t.preventDefault()};this.onTouchEnd=t=>{t.preventDefault()};this.onKeyDown=t=>{this.enabled!==!1&&(this.key=t.key)};this.onKeyUp=()=>{this.enabled!==!1&&(this.key=void 0,this.state!==-1&&this.onPointerUp(At[0]))};this.onPointerHover=t=>{if(!(Bd||this.enabled===!1||this.state!==-1||this.hoverRotatePanMode===2&&this.isPanOverShoot||this.hoverRotatePanMode===1&&this.isRotateOverShoot)){if(window.clearTimeout(this.timerHover),this.isPointerDown=!0,this.isFirstHover){let r={clientX:window.innerWidth/2,clientY:window.innerHeight/2};this.hoverRotatePanMode===2?this.handleMouseDownPan(r):this.hoverRotatePanMode===1&&this.handleMouseDownRotate(r),this.isFirstHover=!1}this.hoverRotatePanMode===2?this.handleMouseMovePan(t,Xy):this.hoverRotatePanMode===1&&this.handleMouseMoveRotate(t,Xy),this.timerHover=window.setTimeout(()=>{this.isPointerDown=!1},30)}};this.object=t,this.domElement=r,this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.connect(),this.update()}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Hy),this.isFirstHover=!0,this.update(),this.state=-1}resetTo(t,r,n){this.target.copy(t),this.object.position.copy(r),this.object.zoom=n,this.object.updateProjectionMatrix(),this.dispatchEvent(Hy),this.update(),this.state=-1}fromJSON(t){this.setEnableDampingSpeed(t.enableDamping),this.enablePan=t.enablePan,this.enableZoom=t.enableZoom,this.enableRotate=t.enableRotate,this.rotationLimitsMode=t.rotationLimitsMode,this.panLimitsMode=t.panLimitsMode,this.panSoftLimit=t.panSoftLimit,this.rotationSoftLimit=t.rotationSoftLimit,this.hoverRotatePanMode=t.hoverRotatePanMode,this.isFirstHover=!0,this.hoverRotatePanMode!==0&&this.domElement.addEventListener("pointermove",this.onPointerHover),Xy=(t.hoverRotatePanStrength/100)**2,this.zoomLimitsEnabled=t.zoomLimitsEnabled,this.minZoom=t.zoomLimits.min,this.maxZoom=Math.max(t.zoomLimits.min,t.zoomLimits.max),this.minDistance=1e3/t.zoomLimits.max,this.maxDistance=Math.max(this.minDistance,1e3/t.zoomLimits.min),this.autoRotate=t.autoRotate,NM=t.autoRotateSpeed,this.autoRotateClockwise=t.autoRotateClockwise;let n=this.object.getTarget().applyQuaternion(Wy.copy(this.object.quaternion).invert());this.minV=-t.panVerticalOffset.min+n.y,this.maxV=t.panVerticalOffset.max+n.y,this.minH=-t.panHorizontalOffset.min+n.x,this.maxH=t.panHorizontalOffset.max+n.x,this.panRangeFactor.set(this.maxH-this.minH,this.maxV-this.minV).divideScalar(2),this.rotationRangeFactor.setScalar(Math.PI).divideScalar(4),this.minPhi=no(this.spherical.phi-t.rotationVerticalOffset.min),this.maxPhi=no(this.spherical.phi+t.rotationVerticalOffset.max),this.minTheta=no(this.spherical.theta-t.rotationHorizontalOffset.min),this.maxTheta=no(this.spherical.theta+t.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,this.preventScroll=t.preventScroll,t.orbitTouches===1&&(this.touches[0]=Cn.ROTATE),t.panTouches===1&&(this.touches[0]=Cn.PAN),t.orbitTouches===2&&(this.touches[1]=Cn.DOLLY_ROTATE),t.panTouches===2&&(this.touches[1]=Cn.DOLLY_PAN),t.orbitTouches===3&&(this.touches[2]=Cn.ROTATE),t.panTouches===3&&(this.touches[2]=Cn.PAN)}connect(){this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointercancel",this.onPointerCancel),this.domElement.addEventListener("wheel",this.onMouseWheel),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keyup",this.onKeyUp,!1),Ho||(this.domElement.addEventListener("gesturestart",this.onGesture),this.domElement.addEventListener("gesturechange",this.onGesture),this.domElement.addEventListener("gestureend",this.onGesture)),this.domElement.addEventListener("touchmove",this.onTouchMove),this.domElement.addEventListener("touchend",this.onTouchEnd)}dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerCancel),this.domElement.removeEventListener("wheel",this.onMouseWheel),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keyup",this.onKeyUp,!1),this.domElement.removeEventListener("pointermove",this.onPointerHover),Ho||(this.domElement.removeEventListener("gesturestart",this.onGesture),this.domElement.removeEventListener("gesturechange",this.onGesture),this.domElement.removeEventListener("gestureend",this.onGesture)),this.domElement.removeEventListener("touchmove",this.onTouchMove),this.domElement.removeEventListener("touchend",this.onTouchEnd),this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp)}applyLimits(t,r,n,s,o,a,l,c){this.overShoot.set(0,0);let h,u,f;t instanceof M?(h=t.x,u=t.y,this.current.set(this.target.x,this.target.y),f=!0):(h=t.theta,u=t.phi,this.current.set(no(this.spherical.theta),no(this.spherical.phi)),f=!1),n===0&&(this.current.x+=h,this.current.y+=u),(r===3||r===2)&&(!f&&this.isThetaFlipped?this.current.x>s&&this.current.x<0?this.overShoot.x=s-this.current.x:this.current.x<o&&this.current.x>0&&(this.overShoot.x=o-this.current.x):this.current.x>s?this.overShoot.x=s-this.current.x:this.current.x<o&&(this.overShoot.x=o-this.current.x),s===o&&(h=0)),(r===3||r===1)&&(this.current.y>a?this.overShoot.y=a-this.current.y:this.current.y<l&&(this.overShoot.y=l-this.current.y),a===l&&(u=0)),f||(this.overShoot.x=no(this.overShoot.x),this.overShoot.y=no(this.overShoot.y)),n!==0?(this.overRatio.copy(this.overShoot).divide(c),this.overRatio.x=Math.min(Math.abs(this.overRatio.x),1),this.overRatio.y=Math.min(Math.abs(this.overRatio.y),1),n===1&&(this.overRatio.x=FM(Math.abs(this.overRatio.x)),this.overRatio.y=FM(Math.abs(this.overRatio.y))),this.isPointerDown||n===1?n===2&&(this.overRatio.x>.9||this.overRatio.y>.9)?this.isPointerDown=!1:(h*this.overShoot.x<0&&(h*=1-this.overRatio.x),u*this.overShoot.y<0&&(u*=1-this.overRatio.y)):n===2&&(!f&&(this.overRatio.x>.002||this.overRatio.y>.002)||f&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(h=this.overShoot.x*.05,u=this.overShoot.y*.05,f?this.isPanOverShoot=!0:this.isRotateOverShoot=!0):f?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(h+=this.overShoot.x,u+=this.overShoot.y),t instanceof M?(t.x=h,t.y=u):(t.theta=h,t.phi=u)}setEnableDampingSpeed(t){this.enableDamping=t,qy=t===!0?.2:1}stopDamping(){this.sphericalDelta.theta=0,this.sphericalDelta.phi=0}getAutoRotationAngle(){return 2*Math.PI/60/60*NM}getZoomScale(){return Math.pow(.95,OM)}rotateLeft(t){this.sphericalDelta.theta-=t}rotateUp(t){this.sphericalDelta.phi-=t}panLeft(t,r){this.panLeftV.setFromMatrixColumn(r,0),this.panLeftV.multiplyScalar(-t),this.panOffset.add(this.panLeftV)}panUp(t,r){this.panUpV.setFromMatrixColumn(r,1),this.panUpV.multiplyScalar(t),this.panOffset.add(this.panUpV)}pan(t,r){let n=this.domElement;if(n&&this.object.isPerspectiveCamera){let s=this.object.position;this.panV.copy(s).sub(this.target);let o=this.panV.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*t*o/n.clientHeight,this.object.matrix),this.panUp(2*r*o/n.clientHeight,this.object.matrix)}else n&&this.object.isOrthographicCamera&&(this.panLeft(t*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this.panUp(r*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix));this.dispatchEvent(LO)}dollyOut(t){this.object.isPerspectiveCamera?this.scale/=t:this.object.isOrthographicCamera&&(this.object.zoom*=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(BM)}dollyIn(t){this.object.isPerspectiveCamera?this.scale*=t:this.object.isOrthographicCamera&&(this.object.zoom/=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(BM)}zoomOut(t=this.getZoomScale()){this.dispatchEvent(Cl),this.dollyOut(t),this.dispatchEvent(Fh)}zoomIn(t=this.getZoomScale()){this.dispatchEvent(Cl),this.dollyIn(t),this.dispatchEvent(Fh)}handleMouseDownRotate(t){this.rotateStart.set(t.clientX,t.clientY)}handleMouseDownDolly(t){this.dollyStart.set(t.clientX,t.clientY)}handleMouseDownPan(t){this.panStart.set(t.clientX,t.clientY)}handleMouseMoveRotate(t,r=1){this.rotateEnd.set(t.clientX,t.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(qy*r).rotateAround(IO,-this.object.angleOffsetFromUp);let n=this.domElement;this.rotateLeft(2*Math.PI*this.rotateDelta.x/n.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/n.clientHeight),this.rotateStart.copy(this.rotateEnd),this.update()}handleMouseMoveDolly(t){this.dollyEnd.set(t.clientX,t.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyOut(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyIn(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(t,r=1){this.panEnd.set(t.clientX,t.clientY),this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(Yy*r),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd),this.update()}handleMouseWheel(t){if(JS===!1&&_h(t)===!1&&OO(t)===!0){if(this.enablePan===!1)return;this.gesture?(this.panDelta.set(-t.deltaX,-t.deltaY).multiplyScalar(Yy),this.panDelta.x=Math.min(Math.abs(this.panDelta.x),100)*(this.panDelta.x<0?-1:1),this.panDelta.y=Math.min(Math.abs(this.panDelta.y),100)*(this.panDelta.y<0?-1:1),t.altKey?this.pan(0,this.panDelta.y):t.shiftKey?this.pan(this.panDelta.x,0):this.pan(this.panDelta.x,this.panDelta.y),this.update()):(this.gesture=!0,this.isPointerDown=!0),window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.gesture=!1,this.isPointerDown=!1},30)}else{if(this.enableZoom===!1)return;t.deltaY===0?t.deltaX<0?this.dollyIn(this.getZoomScale()):t.deltaX>0&&this.dollyOut(this.getZoomScale()):t.deltaY<0?this.dollyIn(this.getZoomScale()):t.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update(),this.gesture=!1,this.isPointerDown=!1}}handleTouchStartRotate(){if(At.length===2){let t=.5*(At[0].pageX+At[1].pageX),r=.5*(At[0].pageY+At[1].pageY);this.rotateStart.set(t,r)}else this.rotateStart.set(At[0].pageX,At[0].pageY)}handleTouchStartPan(){if(At.length===2){let t=.5*(At[0].pageX+At[1].pageX),r=.5*(At[0].pageY+At[1].pageY);this.panStart.set(t,r)}else this.panStart.set(At[0].pageX,At[0].pageY)}handleTouchStartDolly(){let t=At[0].pageX-At[1].pageX,r=At[0].pageY-At[1].pageY,n=Math.sqrt(t*t+r*r);this.dollyStart.set(0,n)}handleTouchStartDollyPan(){this.enableZoom&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(t){if(At.length===2){let n=Qy(t),s=.5*(t.pageX+n.x),o=.5*(t.pageY+n.y);this.rotateEnd.set(s,o)}else{if(t.pointerId!==At[0].pointerId)return;this.rotateEnd.set(t.pageX,t.pageY)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(qy);let r=this.domElement;r&&(this.rotateLeft(2*Math.PI*this.rotateDelta.x/r.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/r.clientHeight)),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(t){if(At.length===2){let r=Qy(t),n=.5*(t.pageX+r.x),s=.5*(t.pageY+r.y);this.panEnd.set(n,s)}else{if(t.pointerId!==At[0].pointerId)return;this.panEnd.set(t.pageX,t.pageY)}this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(Yy),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(t){let r=Qy(t),n=t.pageX-r.x,s=t.pageY-r.y,o=Math.sqrt(n*n+s*s);this.dollyEnd.set(0,o),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,OM)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t)}handleTouchMoveDollyRotate(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enableRotate&&this.handleTouchMoveRotate(t)}};function no(i){let e=Math.PI*2;for(;i<=-Math.PI;)i+=e;for(;i>Math.PI;)i-=e;return i}function FM(i){return 1-Math.pow(1-i,4)}function OO(i){return i.wheelDeltaY===0||i.deltaY===0?Eh&&i.shiftKey&&Math.abs(i.wheelDeltaX)>=120?!1:i.wheelDeltaX?i.wheelDeltaX===-3*i.deltaX:i.deltaMode===0:i.wheelDeltaY?i.wheelDeltaY===-3*i.deltaY:i.deltaMode===0}var At=[],hp={};function FO(i){At.push(i)}function UM(i){delete hp[i.pointerId];for(let e=0;e<At.length;e++)if(At[e].pointerId===i.pointerId){At.splice(e,1);return}}function zM(i){let e=hp[i.pointerId];e===void 0&&(e=new B,hp[i.pointerId]=e),e.set(i.pageX,i.pageY)}function Qy(i){let e=i.pointerId===At[0].pointerId?At[1]:At[0];return hp[e.pointerId]}var io=class extends qf{constructor(){super(),this.layers.enable(3)}setFromCamera(e,t){t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):t.isPerspectiveCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):console.error("Raycaster: Unsupported camera type.")}intersectVisibleObjects(e,t=!0,r=[]){return e.forEach(n=>{n.visible&&this.intersectObject(n,t,r)}),r}createRaycastLineHelper(){let e=new kr({color:65280,linewidth:10}),t=new M(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),r=new M(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),n=this.camera.far-this.camera.near,s=new M().addVectors(t,r.multiplyScalar(n)),o=new Le;return o.setFromPoints([t,s]),new os(o,e)}};var kM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var o,a,l,c,h;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:0,cornerSegments:8,hollow:0},i.parameters),r=t.width/2,n=(a=t.radiusTop)!=null?a:r,s=(l=t.radiusBottom)!=null?l:r;return n===s?(n=r,s=r):n>s?(n=r,s=s*r/n):(n=n*r/s,s=r),{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((c=t.height)!=null?c:t.width),depth:Math.abs((h=t.depth)!=null?h:t.width),radiusTop:n,radiusBottom:s})}}static build(i){let{width:e,depth:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,radiusTop:c,radiusBottom:h,cornerRadius:u,cornerSegments:f,hollow:d}=i.parameters,p;return u||d?p=new Uh(c,h,r,n,s,o,a,l*Math.PI/180,u,u,f,d):p=new Lo(c,h,r,n,s,o,a,l*Math.PI/180),p.scale(1,1,t/e),Object.assign(p,{userData:xe(ie({},i),{type:"CylinderGeometry"})})}};function so(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function GM(i){return new B(i.y,-i.x)}var Uh=class extends Le{constructor(e,t,r,n,s,o,a,l,c,h,u,f,d=!1){super(),this.type="RoundedCylinderBufferGeometry",e=e!==void 0?e:1,t=t!==void 0?t:1,r=r||1,n=Math.floor(n)||8,s=Math.floor(s)||1,o=o!==void 0?o:!1,a=a!==void 0?a:0,l=l!==void 0?l:Math.PI*2,o&&(c=0,h=0);let p=[],m=[],g=[],v=[],y=0,w=r/2,b=new M,S=new M;d&&e==0&&(e=c),d&&t==0&&(t=h);let T=new B(e,w),A=new B(t,-w),x=null,E=null,_=null,C=null,I=T.clone().sub(A),N=0,R=0,k=0;f>0&&(N=Math.min(e,t)*(1-f),R=e-N,k=t-N);let G=T.clone();G.x-=N;let te=Math.PI-I.angle(),Q=I.angle(),Y=Math.tan(Q/2),F=Math.tan(te/2),z=Y+F,O=f?z:F,j=f?z:Y;if(c=Math.min(c,(e-R)/O,I.length()/z),h=Math.min(h,(t-k)/j,I.length()/z),c>0){let le=c/Y;x=T.clone().sub(new B(le,c)),f&&(_=x.clone(),_.x-=N-z*c),T.sub(I.clone().setLength(le))}if(h>0){let le=h/F;E=A.clone().sub(new B(le,-h)),A.add(I.clone().setLength(le)),f&&(C=E.clone(),C.x-=N-z*h,G.sub(I.clone().setLength(le)))}I=T.clone().sub(A);let q=I.length()<.5,J=[];for(let le=0;le<=n;le++){let H=[],he=le/n,K=he*l+a,V=new B(Math.sin(K),Math.cos(K));C&&E?(W(H,he,V,te,h,C,-1,!0),W(H,he,V,Q,h,E,-1,!1)):E?(ge(H,V,E.x,0,-1),W(H,he,V,Q,h,E,-1,!1)):o||ge(H,V,t,k,-1);let Z=GM(I).normalize();if(so(Z,V,b),!q)for(let ce=0;ce<=s;ce++){let se=ce/s,pe=I.clone().multiplyScalar(se).add(A);so(pe,V,S),m.push(S.x,S.y,S.z),g.push(b.x,b.y,b.z),v.push(he,.5+S.y/r),H.push(y++)}if(_&&x?(W(H,he,V,te,c,x,1,!1),W(H,he,V,Q,c,_,1,!0)):x?(W(H,he,V,te,c,x,1,!1),ge(H,V,x.x,0,1)):o||ge(H,V,e,R,1),f&&!q){let ce=GM(I).multiplyScalar(-1).normalize();so(ce,V,b);for(let se=0;se<=s;se++){let pe=se/s,ve=I.clone().multiplyScalar(-pe).add(G);so(ve,V,S),m.push(S.x,S.y,S.z),g.push(b.x,b.y,b.z),v.push(he,.5+S.y/r),H.push(y++)}}f&&!o&&H.push(H[0]),J.push(H)}for(let le=0;le<J.length-1;le++)for(let H=0;H<J[0].length-1;H++){if(o&&f&&H==s)continue;let he=J[le][H],K=J[le+1][H],V=J[le+1][H+1],Z=J[le][H+1],ce=m[V*3+0],se=m[V*3+2];p.push(he,K,Z),(ce!=0||se!=0)&&p.push(K,V,Z)}l<Math.PI*2&&(oe(-1,J[0],a),oe(1,J[J.length-1],a+l)),this.setIndex(p),this.setAttribute("position",new Ce(m,3)),this.setAttribute("normal",new Ce(g,3)),this.setAttribute("uv",new Ce(v,2));function W(le,H,he,K,V,Z,ce,se){for(let pe=0;pe<u+1;pe++){let ve=pe/u,me=ce<0?ve:1-ve;se&&(me-=1),me*=K;let Pe=new B(Math.sin(me),Math.cos(me)*ce),ke=Pe.clone().multiplyScalar(V).add(Z);so(ke,he,S),m.push(S.x,S.y,S.z),so(Pe,he,b),g.push(b.x,b.y,b.z),v.push(H,.5+S.y/r),le.push(y++)}}function ge(le,H,he,K,V){let Z=new M,ce=new B,se=[he,K];V<0&&se.reverse();for(let pe of se)ce.set(pe,w*V),so(ce,H,Z),m.push(Z.x,Z.y,Z.z),g.push(0,V,0),v.push(.5,.5),le.push(y++)}function oe(le,H,he){let K=new B(Math.sin(he),Math.cos(he)),V=new B(-Math.cos(he),Math.sin(he)),Z=new M,ce=le<0?(ve,me,Pe)=>p.push(ve,me,Pe):(ve,me,Pe)=>p.push(ve,Pe,me),se=new B((e+t+R+k)/4,0);so(se,K,Z),m.push(Z.x,Z.y,Z.z),g.push(V.x,0,V.y),v.push(.5,.5);let pe=y++;for(let ve of H){let me=m.slice(ve*3,ve*3+3);m.push(...me),g.push(V.x,0,V.y);let Pe=v.slice(ve*2,ve*2+2);v.push(...Pe),y++}for(let ve=pe+1;ve<y-1;ve++)ce(pe,ve,ve+1);ce(pe,y-1,pe+1)}}};var VM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:0,cornerRadiusBottom:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,depth:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,cornerRadiusTop:c,cornerRadiusBottom:h,cornerSegments:u}=i.parameters,f;return c>0||h>0||l<360?f=new Uh(0,e/2,r,n,s,o,a,l*Math.PI/180,c,h,u,0,!0):f=new za(e/2,r,n,s,o),f.scale(1,1,t/e),Object.assign(f,{userData:xe(ie({},i),{type:"ConeGeometry"})})}};var HM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,widthSegments:n,heightSegments:s,depthSegments:o,cornerRadius:a,cornerSegments:l}=i.parameters,c;return a==0?c=new vn(e,t,r,n,s,o):c=new Ky(e,t,r,n,s,o,a,l),Object.assign(c,{userData:xe(ie({},i),{type:"CubeGeometry"})})}},Jy=Math.PI/2,Ky=class extends Le{constructor(e=1,t=1,r=1,n=1,s=1,o=1,a=0,l=4){super(),this.type="BoxBufferGeometry";let c=this;n=Math.floor(n),s=Math.floor(s),o=Math.floor(o),l=Math.floor(l),a=Math.min(a,e/2,t/2,r/2);let h=[],u=[],f=[],d=[],p=0,m=0;g("z","y","x",-1,-1,r,t,e,o,s,0),g("z","y","x",1,-1,r,t,-e,o,s,1),g("x","z","y",1,1,e,r,t,n,o,2),g("x","z","y",1,-1,e,r,-t,n,o,3),g("x","y","z",1,-1,e,t,r,n,s,4),g("x","y","z",-1,-1,e,t,-r,n,s,5),a>0&&(v("z","y","x",-1,-1,1,r,t,e,o,0),v("z","y","x",1,-1,-1,r,t,e,o,1),v("z","y","x",-1,1,-1,r,t,e,o,1),v("z","y","x",1,1,1,r,t,e,o,0),v("x","y","z",-1,-1,-1,e,t,r,n,0),v("x","y","z",1,-1,1,e,t,r,n,1),v("x","y","z",-1,1,1,e,t,r,n,0),v("x","y","z",1,1,-1,e,t,r,n,1),v("y","x","z",-1,-1,1,t,e,r,s,0),v("y","x","z",1,-1,-1,t,e,r,s,1),v("y","x","z",1,1,1,t,e,r,s,1),v("y","x","z",-1,1,-1,t,e,r,s,0),y(1,1,1),y(-1,1,1),y(1,-1,1),y(-1,-1,1),y(1,1,-1),y(-1,1,-1),y(1,-1,-1),y(-1,-1,-1)),this.setIndex(h),this.setAttribute("position",new Ce(u,3)),this.setAttribute("normal",new Ce(f,3)),this.setAttribute("uv",new Ce(d,2));function g(w,b,S,T,A,x,E,_,C,I,N){let R=(x-2*a)/C,k=(E-2*a)/I,G=x/2-a,te=E/2-a,Q=_/2,Y=C+1,F=I+1,z=0,O=0,j=new M;for(let q=0;q<F;q++){let J=q*k-te;for(let W=0;W<Y;W++){let ge=W*R-G;j[w]=ge*T,j[b]=J*A,j[S]=Q,u.push(j.x,j.y,j.z),j[w]=0,j[b]=0,j[S]=_>0?1:-1,f.push(j.x,j.y,j.z),d.push(W/C),d.push(1-q/I),z+=1}}for(let q=0;q<I;q++)for(let J=0;J<C;J++){let W=p+J+Y*q,ge=p+J+Y*(q+1),oe=p+(J+1)+Y*(q+1),le=p+(J+1)+Y*q;h.push(W,ge,le),h.push(ge,oe,le),O+=6}c.addGroup(m,O,N),m+=O,p+=z}function v(w,b,S,T,A,x,E,_,C,I,N){let R=(E-2*a)/I,k=E/2-a,G=_/2-a,te=C/2,Q=I+1,Y=0,F=0,z=new M,O=new M;for(let j=0;j<l+1;j++){let q=j/l*Jy,J=Math.sin(q)*a,W=(1-Math.cos(q))*a,ge=Math.sin(q),oe=Math.cos(q);z[b]=(G+J)*A,z[S]=(te-W)*x,O[w]=0,O[b]=ge*Math.sign(z[b]),O[S]=oe*Math.sign(z[S]);for(let le=0;le<Q;le++){let H=le*R-k;z[w]=H*T,u.push(z.x,z.y,z.z),f.push(O.x,O.y,O.z),d.push(le/I),d.push(0),Y+=1}}for(let j=0;j<l;j++)for(let q=0;q<I;q++){let J=p+q+Q*j,W=p+q+Q*(j+1),ge=p+(q+1)+Q*(j+1),oe=p+(q+1)+Q*j;h.push(J,W,oe),h.push(W,ge,oe),F+=6}c.addGroup(m,F,N),m+=F,p+=Y}function y(w,b,S){let T=new M,A=new M(e/2,t/2,r/2);A.subScalar(a);let x=[],E=w*b*S>0?(C,I,N)=>h.push(C,I,N):(C,I,N)=>h.push(C,N,I);for(let C=0;C<=l;C++){let I=[],N=Jy*(1-C/l),R=Math.cos(N),k=Math.sin(N),G=0;for(let te=0;te<=C;te++){let Q=Math.cos(G),Y=Math.sin(G);T.x=R*Q,T.y=k,T.z=R*Y;let F=A.clone().addScaledVector(T,a);u.push(w*F.x,b*F.y,S*F.z),f.push(w*T.x,b*T.y,S*T.z),d.push(0,0),I.push(p++),G+=Jy/C}x.push(I)}let _=x.length-1;for(let C=0;C<_;C++){let I=x[C],N=x[C+1],R=I.length-1;E(I[0],N[1],N[0]);for(let k=1;k<=R;k++)E(I[k-1],I[k],N[k]),E(I[k],N[k+1],N[k])}}}};var oo=class extends Le{constructor(e=[],t=[],r="",n=1,s=.2,o=4){super(),this.type="PolyhedronGeometryRound";let a=[],l=[],c=[];h(),u(),this.setAttribute("position",new Ce(a,3)),this.setAttribute("normal",new Ce(c,3)),this.setAttribute("uv",new Ce(l,2));return;function h(){var Y;s=Math.min(1-1e-5,s),s==0&&(o=0);let d={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[r],p=new M,m=p.clone(),g=new Jt,v=s*n,y=n-v,w=o+1,b=new M,S=(F,z)=>b.subVectors(F,z).normalize(),T=(F,z)=>Array(F).fill(void 0).map(z),A=T(e.length/3,(F,z)=>new M().fromArray(e,z*3).setLength(n)),x=[],E=1e6;for(let F=0;F<A.length;F++){let z=A[F],O=[],j,q,J,W=1e10,ge=-1;for(;(ge=t.indexOf(F,ge+1))!=-1;){let he=ge-ge%3;j=t[he+(ge+1)%3],q=t[he+(ge+2)%3],J=z.distanceToSquared(A[j]),W=Math.min(W,J),O.push([j,q,J])}W+=1e-6;let oe=[],le=0,H=O.length;for(let he=0;he<H;he++){[j,q,J]=O[le];let K=((Y=x[j])==null?void 0:Y.includes(F))==!0;J<=W&&oe.push(j+ +K*E),le=O.findIndex(V=>V[0]==q)}x.push(oe)}let _=[];{let F=0,z=0,O,j,q=d==3;for(let J=0;J<=o;J++){O=J*(J+1)/2,j=(J+1)*(J+2)/2;for(let W=0;W<o-J;W++)[F,z]=[O+W+J+2,j+W+J+3],_.push(O,j,...q?[z,O]:[F,j],z,F),[O,j]=[F,z];_.push(O,j,O+o+2)}}let C=p.clone(),I=p.clone(),N=p.clone(),R=p.clone(),k=p.clone(),G=[],te=T(A.length,()=>T(d,()=>p.clone()));for(let F=0;F<A.length;F++){p.copy(A[F]).normalize(),C.copy(p).multiplyScalar(y);let z=x[F];for(let oe=0;oe<z.length;oe++){let le=z[oe],H=z[(oe+1)%d];g.setFromPointsAndIndices(A,F,le%E,H%E),g.b.sub(g.a).setLength(1e10).add(g.a),g.c.sub(g.a).setLength(1e10).add(g.a),g.closestPointToPoint(C,te[F][oe])}let O=[],j=[],q=[],J=new M;o==0&&[...te[F]].reduce((oe,le)=>oe.add(le),J).multiplyScalar(1/d);for(let oe=0;oe<d;oe++){let le=[],H=(oe-1+d)%d,he=te[F][H],K=te[F][oe];p.copy(he).sub(C),m.copy(K).sub(C);let V=C.angleTo(p),Z=p.angleTo(m),ce=Math.cos(V)*v;o==0?I.copy(J):I.copy(C).setLength(y+ce),j.push(ce);let se=[I,he,K];for(let pe=0;pe<2;pe++){let ve=se[pe],me=se[pe+1];R.subVectors(ve,C),k.subVectors(me,C),N.crossVectors(R,k).normalize();for(let Pe=0;Pe<w;Pe++){let ke=[V,Z][pe]*Pe/w;p.copy(R).applyAxisAngle(N,ke).add(C),O.push(p.clone()),pe&&(S(p,C),le.push([Pe==0?ve:p.clone(),b.clone()]))}pe&&(S(me,C),le.push([me,b.clone()]))}q.push(le)}G.push(q);let W=2*w,ge=2;for(let oe=0;oe<d;oe++){let le=W*oe,H=W*((oe+1)%d),he=[O[le]];for(let V=1;V<w;V++){R=O[le+V],k=O[H+V],he.push(R);for(let Z=1,ce=V-ge+1;Z<=ce;Z++)p.lerpVectors(R,k,Z/(ce+1)),p.sub(C).setLength(j[oe]).add(C),he.push(p.clone());he.push(k)}for(let V=0;V<w;V++)he.push(O[V+w+le]);he.push(O[H+w]);let K=_.map(V=>he[V]);a.push(...K.map(V=>[V.x,V.y,V.z]).flat()),c.push(...K.map(V=>(S(V,C),[b.x,b.y,b.z])).flat())}}let Q=[];for(let F=0;F<x.length;F++)for(let z=0;z<d;z++){let O=x[F][z];if(O<E){let j=x[O].findIndex(W=>W%E==F),q=G[F][z],J=G[O][j];for(let W=0;W<w;W++){let ge=q[W],oe=J[w-W],le=q[W+1],H=J[w-(W+1)];[ge,oe,le,le,oe,H].forEach(he=>{a.push(he[0].x,he[0].y,he[0].z),c.push(he[1].x,he[1].y,he[1].z)})}Q.push(q[0][0],J[w][0],q[w][0],J[0][0])}}for(;Q.length;){let F,z,O,j;[F,z]=Q.splice(0,2);let q=[F];for(;F!=z;)q.push(z),O=Q.indexOf(z),j=O%2,z=Q.splice(O-j,2)[1-j];b.subVectors(q[0],q[1]).cross(p.subVectors(q[0],q[2])).normalize();let J=b.dot(q[0])<0;J&&b.negate();for(let W=1;W<=q.length-2;W++)[q[W+ +J],q[W+1-+J],q[0]].forEach(ge=>{a.push(ge.x,ge.y,ge.z),c.push(b.x,b.y,b.z)})}}function u(){let f=new M;for(let A=0;A<a.length;A+=3){f.x=a[A+0],f.y=a[A+1],f.z=a[A+2];let x=S(f)/2/Math.PI+.5,E=T(f)/Math.PI+.5;l.push(x,1-E)}let d=new M,p=new M,m=new M,g=new M,v=new B,y=new B,w=new B,b=(A,x,E,_)=>{_<0&&A.x===1&&(l[x]=A.x-1),E.x===0&&E.z===0&&(l[x]=_/2/Math.PI+.5)};for(let A=0,x=0;A<a.length;A+=9,x+=6){d.set(a[A+0],a[A+1],a[A+2]),p.set(a[A+3],a[A+4],a[A+5]),m.set(a[A+6],a[A+7],a[A+8]),v.set(l[x+0],l[x+1]),y.set(l[x+2],l[x+3]),w.set(l[x+4],l[x+5]),g.copy(d).add(p).add(m).divideScalar(3);let E=S(g);b(v,x+0,d,E),b(y,x+2,p,E),b(w,x+4,m,E)}for(let A=0;A<l.length;A+=6){let x=l[A+0],E=l[A+2],_=l[A+4],C=Math.max(x,E,_),I=Math.min(x,E,_);C>.9&&I<.1&&(x<.2&&(l[A+0]+=1),E<.2&&(l[A+2]+=1),_<.2&&(l[A+4]+=1))}function S(A){return Math.atan2(A.z,-A.x)}function T(A){return Math.atan2(-A.y,Math.sqrt(A.x*A.x+A.z*A.z))}}}static fromJSON(e){return new oo(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}};var WM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:o}=i.parameters,a=n===0&&s!==0?new zh(e*.5,s,o):new ka(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:xe(ie({},i),{type:"DodecahedronGeometry"})})}},zh=class extends oo{constructor(e=1,t=.2,r=4){let n=(1+Math.sqrt(5))/2,s=1/n,o=[-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,-s,-n,0,-s,n,0,s,-n,0,s,n,-s,-n,0,-s,n,0,s,-n,0,s,n,0,-n,0,-s,n,0,-s,-n,0,s,n,0,s],a=[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],l="DodecahedronGeometry";super(o,a,l,e,t,r),this.type=l}static fromJSON(e){return new zh(e.radius,e.corner,e.cornerSides)}};var Gh=1e-12,Dl=class{constructor(e){this.position=new B;this.startPosition=new B;this.uuid=et.generateUUID();this.position=e.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(e){this.position.copy(this.startPosition).add(e)}copy(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}clone(){return new Dl(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},Pl=class extends Dl{constructor(t){super(t.position);this.parent=t}copy(t){return super.copy(t),this}clone(){return new Pl(this.parent).copy(this)}},ui=class extends Dl{constructor(t,r){super(r);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=t,this.controls.push(new Pl(this),new Pl(this))}static create(t,r){let n=new ui(t,new B(...r.position));return n.controls[0].position.set(...r.controlPrevious.position),n.controls[1].position.set(...r.controlNext.position),n.roundness=r.roundness,n.areControlsDirectionsMirrored=r.areControlsDirectionsMirrored,n}getOppositeControl(t){let r=this.controls.indexOf(t);return r===0?this.controls[1]:r===1?this.controls[0]:null}applyOffsetToControls(t,r=1){for(let n=0,s=this.controls.length;n<s;n++){let o=this.controls[n];this.position.distanceTo(o.position)<=r?o.position.copy(this.position):o.applyOffset(t)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(t){return super.copy(t),this.controls[0].copy(t.controls[0]),this.controls[1].copy(t.controls[1]),this.roundness=t.roundness,this.uuid=t.uuid,this}clone(){return new ui(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}},Zy=i=>i,Vh=new B,$y=new B,UO=new B,zO=new B,GO=new B,kO=new B,jM=new M,qM=new M;function YM(i){let e=new B;e.addVectors(i.v0,Vh.subVectors(i.v1,i.v0).multiplyScalar(2/3));let t=new B;return t.addVectors(i.v2,$y.subVectors(i.v1,i.v2).multiplyScalar(2/3)),new an(i.v0,e,t,i.v2)}function kh(i,e,t=Number.EPSILON){return Math.abs(i-e)<t}function VO(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function HO(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function ev(i,e,t){let r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),s=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2));return Math.acos((n*n+r*r-s*s)/(2*n*r))}function XM(i,e,t,r,n){let s=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),o=(i.y+e.y)/2,a=(i.x+e.x)/2,l=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(i.y-e.y)/s,c=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(e.x-i.x)/s;return r.set(a+l,o+c),n.set(a-l,o-c),[r,n]}function QM(i,e,t){let r=i.distanceTo(t),n=e.distanceTo(t);return r<n?e:i}function JM(i,e,t,r,n,s){let o=e.x-i.x,a=e.y-i.y,l=t.x-i.x,c=t.y-i.y,h=Math.sqrt((o+l)*(o+l)+(a+c)*(a+c)),u;return ev(e,i,t)>Math.PI&&(h*=-1),kh(c,a)?u=(a+c)*(r/h-.5)*8/3/(o-l):u=(o+l)*(r/h-.5)*8/3/(c-a),n.set(e.x-u*a,e.y+u*o),s.set(t.x+u*c,t.y-u*l),[n,s]}function tv(i,e){return i.position.equals(i.controls[1].position)&&e.position.equals(e.controls[0].position)}function KM(i,e,t,r,n=.5){let s=Vh.subVectors(e,i).multiplyScalar(n).add(i),o=$y.subVectors(t,e).multiplyScalar(n).add(e),a=UO.subVectors(r,t).multiplyScalar(n).add(t),l=s,c=zO.subVectors(o,s).multiplyScalar(n).add(s),h=GO.subVectors(a,o).multiplyScalar(n).add(o),u=a,f=kO.subVectors(h,c).multiplyScalar(n).add(c);return[i.x,i.y,l.x,l.y,c.x,c.y,f.x,f.y,h.x,h.y,u.x,u.y,r.x,r.y]}function ZM(i,e,t=12,r=!0){let n=qM.set(0,0,0),s,o=0,a=[];for(let l=0;l<e.length;l++){let c=Zy(e[l]),h=Vh,u=ao(c,t);a.push(u);for(let f=0;f<=u;f++)if(c instanceof an||c instanceof kn||c instanceof ln){if(c.getPoint(f/u,h),n.set(h.x,h.y,0),s!==void 0&&HO(s,n))continue;s===void 0&&(s=jM),s.copy(n),i.setXYZ(o,n.x,n.y,n.z),o++}}return r&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),i}function $M(i,e,t,r=12,n=!0){let s=qM.set(0,0,0),o=0,a=[];for(let l=0;l<e.length;l++){if(t[l]===!1)continue;let c,h=Zy(e[l]),u=Vh,f=ao(h,r);a.push(f);for(let d=0;d<=f;d++)if(h instanceof an||h instanceof kn||h instanceof ln){if(h.getPoint(d/f,u),s.set(u.x,u.y,0),c!=null&&c.equals(s))continue;c===void 0?c=jM:(i.setXYZ(o,c.x,c.y,c.z),o++,i.setXYZ(o,s.x,s.y,s.z),o++),c.copy(s)}}return n&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),a}function rv(i,e=12,t=!1){let r=[];for(let n=0,s=i.length;n<s;n++){let o=i[n],a=0;if(t&&o.roundedCurveCorner!==void 0){let l=ao(o.roundedCurveCorner,e)*.5;n>0&&(r[n-1]+=l),a+=l}o.curveAfter!==void 0&&(a+=ao(o.curveAfter,e)),r.push(a)}return i.length>0&&t&&i[0].roundedCurveCorner!==void 0&&(r[i.length-1]+=ao(i[0].roundedCurveCorner,e)*.5),r}function ao(i,e=12){return i&&i instanceof Us?e*2:i&&(i instanceof ln||i instanceof th)?1:i&&i instanceof Po?e*i.points.length:e}function e1(i,e,t=12,r=!0){let n,s=0;for(let o=0;o<e.length;o++){let a=Zy(e[o]),l=ao(a,t),c=Vh;for(let h=0;h<=l;h++)if(a instanceof an||a instanceof kn||a instanceof ln){if(a.getPoint(h/l,c),n!==void 0&&VO(n,c,Gh))continue;n===void 0&&(n=$y),n.copy(c),i.push(c.x,c.y),s++}}return kh(i[0],i[i.length-2],Gh)&&kh(i[1],i[i.length-1],Gh)&&(i.pop(),i.pop()),r&&s>1&&!(kh(i[s-1],i[1],Gh)&&kh(i[s-2],i[0],Gh))&&(i.push(i[0],i[1]),s++),i}var nv=new B,WO=new B,jO=new B,qO=new B,YO=new B,XO=new B,Tt=class extends rn{constructor(t=100,r=100){super();this.points=[];this.shapeHoles=[];this.eventDispatcher=new Yt;this.plane=new Gr(new M(0,0,-1));this.subdivision=0;this.controlSnapDistance=4;this.pointIDs=0;this.isMesh2D=!1;this._roundness=0;this.isClosed=!1;this.useCubicForRoundedCorners=!0;this.uuid=et.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=t,this._height=r}static createFromState(t,r,n){let s=new Tt;return s.isClosed=t.isClosed,s.points=t.points.map(o=>ui.create(o.id,o.data)),typeof t.roundness=="number"&&(s.roundness=t.roundness),s.shapeHoles=t.shapeHoles.map(o=>Tt.createFromState(o)),r!==void 0&&n!==void 0&&s.applySize(r,n),s.update(),s}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(t){if(this._roundness!==t){this._roundness=t;for(let r=0,n=this.points.length;r<n;r++)this.points[r].roundness=t;this.needsUpdate=!0}}getPointsIndexesByIds(t){return t.map(r=>this.getPointIndexById(r)).filter(r=>r>=0)}getPointIndexById(t){let r=this.points.length,n=this.points.findIndex(s=>s.uuid===t);if(n<0){let s=r;for(let o=0,a=this.shapeHoles.length;o<a;o++){let l=this.shapeHoles[o],c=l.points.length-1,h=l.getPointIndexById(t);if(h<0)s+=c;else return h+s}}return n}getLineIndexById(t){return this.getPointIndexById(t)}getBezierPoint(t){if(t<=this.points.length-1)return this.points[t];if(this.shapeHoles.length>0)for(let r=0,n=this.shapeHoles.length;r<n;r++){let s=this.shapeHoles[r],o=t-this.points.length;if(o<=s.points.length-1)return s.points[o]}throw new Error("This shape does not have a point for this index: "+t)}getBezierPointIndex(t){let r=this.points.indexOf(t);if(r>=0)return r;if(r=this.points.length,this.shapeHoles.length>0)for(let n=0,s=this.shapeHoles.length;n<s;n++){let o=this.shapeHoles[n],a=o.points.indexOf(t);if(a>=0)return r+a;r+=o.points.length}return-1}getAllPoints(){let t=[].concat(...this.shapeHoles.map(r=>r.points));return[...this.points,...t]}applySize(t,r){t===0&&(t=.001),r===0&&(r=.001),this._width=t,this._height=r}applyScale(t,r){let n=nv.set(t,r);for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];a.position.multiply(n),a.controls[0].position.multiply(n),a.controls[1].position.multiply(n)}for(let s=0,o=this.shapeHoles.length;s<o;s++)this.shapeHoles[s].applyScale(t,r);this._update(!1)}createPoint(t,r=0,n=et.generateUUID()){let s;t instanceof B?s=t:s=new B(t,r);let o=new ui(n,s);return o.roundness=this.roundness,o}addPoint(t){this.points.push(t),this.needsUpdate=!0}addPointAt(t,r){this.points.splice(r,0,t),this.needsUpdate=!0}getPointByUuid(t){for(let r=0,n=this.points.length;r<n;r++){let s=this.points[r];if(s.uuid===t)return s}for(let r=0,n=this.shapeHoles.length;r<n;r++){let o=this.shapeHoles[r].getPointByUuid(t);if(o)return o}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(t){let r=this.points.indexOf(t);r>=0&&this.points.splice(r,1),this.needsUpdate=!0}removePointById(t){let r=this.points.find(n=>n.uuid===t);r&&this.removePoint(r)}update(t=!0){for(let r=0,n=this.shapeHoles.length;r<n;r++)this.shapeHoles[r].update(!1);this._update(t)}extractShapePointsToBuffer(t,r=12,n=!1){this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r);let s=n?this.roundedCurveDivisions:this.curveDivisions;return ZM(t,n?this.roundedCurves:this.curves,r,this.autoClose),s.reduce((o,a)=>o+a,0)+1}computeCurveDivisions(t=12){return this.curveDivisions=rv(this.points,t,!1),this.roundedCurveDivisions=rv(this.points,t,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(t,r,n=12){return $M(t,this.curves,r,n,this.autoClose).reduce((o,a)=>o+a,0)*2}extractShapePointsToFlatArray(t,r=12){return this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r),e1(t,this.roundedCurves,r,this.autoClose)}getCurveIndexFromVertexId(t,r=!1){let n=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let s=r?this.roundedCurveDivisions:this.curveDivisions,o=0;r&&this.points[0].roundedCurveCorner!==void 0&&(o=ao(this.points[0].roundedCurveCorner,this.subdivision)*.5);let a=t-o;a<0&&(a+=s.reduce((l,c)=>l+c,0));for(let l=0,c=s.length;l<c;l++){let h=s[l];if(a<n+h)return[l,(a-n+1)/h];n+=h}return[0,1]}getCurveT(t,r,n){let s=this.points[t],o=this.points[t>=this.points.length-1?0:t+1],a=this.curveDivisions,l=a[t];if(tv(s,o)){let u=s.position.distanceTo(o.position);return s.position.distanceTo(nv.set(n.x,n.y))/u}let c=0;for(let u=0;u<t;u++)c+=a[u];return(r-c)/l}dispose(){this.eventDispatcher=null}_applyCurveForPoint(t,r){tv(r,t)?this.lineTo(t.position.x,t.position.y):this.bezierCurveTo(r.controls[1].position.x,r.controls[1].position.y,t.controls[0].position.x,t.controls[0].position.y,t.position.x,t.position.y);let n=this.curves[this.curves.length-1];t.curveBefore=n,r.curveAfter=n;let s=n.clone();t.roundedCurveBefore=s,r.roundedCurveAfter=s,t.roundedCurveCorner=void 0,this.roundedCurves.push(s)}_update(t=!0){var n;if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];if(s===0)this.moveTo(a.position.x,a.position.y);else{let l=this.points[s-1];this._applyCurveForPoint(a,l)}}let r=this.getLastPoint();if(r!=null&&r.curveAfter&&(r.curveAfter=void 0),this.isClosed){let s=this.points[0],o=this.points[this.points.length-1];this._applyCurveForPoint(s,o)}if(this.points.length>2){let s=0;for(let o=0,a=this.points.length;o<a;o++){let l=this.points[o],c=l.roundness;if(!l.controlsMoved()&&c>0){let h=l.curveBefore,u=l.curveAfter;if(h===void 0||u===void 0)continue;let f=l.roundedCurveBefore,d=l.roundedCurveAfter,p=h.getLength(),m=u.getLength(),g=Math.min(c,p*.499),v=Math.min(c,m*.499),y=Math.min(g,v),w=1-y/p,b=y/m,S=h.getPointAt(w,nv),T=u.getPointAt(b,WO);this._subSplitCurve(h,f,w,S,void 0),this._subSplitCurve(u,d,b,void 0,T);let A;if(this.useCubicForRoundedCorners){let x=ev(S,l.position,T)/2,E=Math.tan(x)*S.distanceTo(l.position),[_,C]=XM(S,T,E,jO,qO),I=QM(_,C,l.position),[N,R]=JM(I,S,T,E,YO,XO);A=new an(S.clone(),N.clone(),R.clone(),T.clone())}else A=new kn(S.clone(),l.position.clone(),T.clone());l.roundedCurveCorner=A,this.roundedCurves.splice(o+s,0,A),s++}}}t&&((n=this.eventDispatcher)==null||n.dispatchEvent({type:"update"}))}_subSplitCurve(t,r,n,s,o){if(t instanceof ln)s!==void 0&&r.v2.copy(s),o!==void 0&&r.v1.copy(o);else{let a=t,l=r,c=a.getUtoTmapping(n,0),h=KM(a.v0,a.v1,a.v2,a.v3,c);return s!==void 0&&(l.v0.set(h[0],h[1]),l.v1.set(h[2],h[3]),l.v2.set(h[4],h[5]),l.v3.set(h[6],h[7])),o!==void 0&&(l.v0.set(h[6],h[7]),l.v1.set(h[8],h[9]),l.v2.set(h[10],h[11]),l.v3.set(h[12],h[13])),l}return r}clone(){let t=new Tt(this._width,this._height);return t.points=this.points.map(r=>r.clone()),t.isClosed=this.isClosed,t.roundness=this.roundness,t.isMesh2D=this.isMesh2D,t.shapeHoles=this.shapeHoles.map(r=>r.clone()),t}toJSON(){return{points:this.points.reduce((t,r)=>t.concat(r.toJSON()),[]),shapeHoles:this.shapeHoles.map(t=>t.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(t){var n;this.points=[],this.pointIDs=0;let r=t.points.length/7;for(let s=0;s<r;s++){let o=s*7,a=t.points[o+0],l=t.points[o+1],c=t.points[o+2],h=t.points[o+3],u=t.points[o+4],f=t.points[o+5],d=t.points[o+6],p=new ui(et.generateUUID(),new B(a,l));p.controls[0].position.set(c,h),p.controls[1].position.set(u,f),p.roundness=d,this.points.push(p)}return this.shapeHoles=(n=t.shapeHoles)!=null&&n.length?t.shapeHoles.map(s=>{let o=new Tt;return o.fromJSON(s),o}):[],this.isClosed=t.isClosed,this._roundness=t.roundness,this._update(),this}fromShape(t){let r=(s,o)=>{o instanceof an&&o.v3.equals(s.position)&&s.controls[0].position.copy(o.v2)},n=s=>{let o=[],a,l;for(a=0,l=s.length;a<l;a++)s[a]instanceof kn&&(s[a]=YM(s[a]));for(a=0,l=s.length;a<l;a++){let u=s[a],f=a>0?s[a-1]:null,d;u instanceof an?(d=this.createPoint(u.v0),d.controls[1].position.copy(u.v1)):u instanceof ln&&(d=this.createPoint(u.v1)),d!==void 0&&(f!==null&&r(d,f),o.push(d))}let c=s[s.length-1],h=!1;return c instanceof an?c.v3.equals(o[0].position)&&(o[0].controls[0].position.copy(c.v2),h=!0):c instanceof ln&&c.v2.equals(o[0].position)&&(h=!0),this.isClosed=h,o};return this.points=n(t.curves),t instanceof rn&&(this.shapeHoles=t.holes.map(s=>{let o=new Tt;return o.fromShape(s),o})),this.update(),this}};var sv=Math.PI*2;function iv({x:i,y:e},t,r,n,s){return{x:i*t+n,y:e*r+s}}function QO(i,e){let t=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),r=Math.cos(i),n=Math.sin(i),s=Math.cos(i+e),o=Math.sin(i+e);return[{x:r-n*t,y:n+r*t},{x:s+o*t,y:o-s*t},{x:s,y:o}]}function t1(i,e,t,r){let n=i*r-e*t<0?-1:1,s=Math.min(1,Math.max(-1,i*t+e*r));return n*Math.acos(s)}function JO(i,e,t,r,n,s,o,a,l,c){let h=Math.pow(n,2),u=Math.pow(s,2),f=Math.pow(o,2),d=Math.pow(a,2),p=h*u-h*d-u*f;p<0&&(p=0),p/=h*d+u*f,p=Math.sqrt(p)*(l===c?-1:1);let m=p*n/s*a,g=p*-s/n*o,v=m+(i+t)/2,y=g+(e+r)/2,w=(o-m)/n,b=(a-g)/s,S=(-o-m)/n,T=(-a-g)/s,A=t1(1,0,w,b),x=t1(w,b,S,T);return!c&&x>0&&(x-=sv),c&&x<0&&(x+=sv),{centerx:v,centery:y,ang1:A,ang2:x}}function r1({px:i,py:e,cx:t,cy:r,rx:n,ry:s,largeArcFlag:o,sweepFlag:a}){let l=[];if(n===0||s===0)return[];let c=(i-t)/2,h=(e-r)/2;if(c===0&&h===0)return[];n=Math.abs(n),s=Math.abs(s);let u=Math.pow(c,2)/Math.pow(n,2)+Math.pow(h,2)/Math.pow(s,2);u>1&&(n*=Math.sqrt(u),s*=Math.sqrt(u));let f=JO(i,e,t,r,n,s,c,h,o,a),{ang1:d,ang2:p}=f,{centerx:m,centery:g}=f,v=Math.abs(p)/(sv/4);Math.abs(1-v)<1e-7&&(v=1);let y=Math.max(Math.ceil(v),1);p/=y;for(let w=0;w<y;w++)l.push(QO(d,p)),d+=p;return l.map(w=>{let{x:b,y:S}=iv(w[0],n,s,m,g),{x:T,y:A}=iv(w[1],n,s,m,g),{x,y:E}=iv(w[2],n,s,m,g);return{x1:b,y1:S,x2:T,y2:A,x,y:E}})}var Zt;(function(i){i[i.ODD=0]="ODD",i[i.NONZERO=1]="NONZERO",i[i.POSITIVE=2]="POSITIVE",i[i.NEGATIVE=3]="NEGATIVE",i[i.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(Zt||(Zt={}));var Tr;(function(i){i[i.POLYGONS=0]="POLYGONS",i[i.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",i[i.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(Tr||(Tr={}));function qe(i,e){if(!i)throw e||"Assertion Failed!"}var ze=function(){function i(){}return i.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},i.vertLeq=function(e,t){return e.s<t.s||e.s===t.s&&e.t<=t.t},i.transLeq=function(e,t){return e.t<t.t||e.t===t.t&&e.s<=t.s},i.edgeGoesLeft=function(e){return i.vertLeq(e.Dst,e.Org)},i.edgeGoesRight=function(e){return i.vertLeq(e.Org,e.Dst)},i.vertL1dist=function(e,t){return Math.abs(e.s-t.s)+Math.abs(e.t-t.t)},i.edgeEval=function(e,t,r){qe(i.vertLeq(e,t)&&i.vertLeq(t,r));var n=t.s-e.s,s=r.s-t.s;return n+s>0?n<s?t.t-e.t+(e.t-r.t)*(n/(n+s)):t.t-r.t+(r.t-e.t)*(s/(n+s)):0},i.edgeSign=function(e,t,r){qe(i.vertLeq(e,t)&&i.vertLeq(t,r));var n=t.s-e.s,s=r.s-t.s;return n+s>0?(t.t-r.t)*n+(t.t-e.t)*s:0},i.transEval=function(e,t,r){qe(i.transLeq(e,t)&&i.transLeq(t,r));var n=t.t-e.t,s=r.t-t.t;return n+s>0?n<s?t.s-e.s+(e.s-r.s)*(n/(n+s)):t.s-r.s+(r.s-e.s)*(s/(n+s)):0},i.transSign=function(e,t,r){qe(i.transLeq(e,t)&&i.transLeq(t,r));var n=t.t-e.t,s=r.t-t.t;return n+s>0?(t.s-r.s)*n+(t.s-e.s)*s:0},i.vertCCW=function(e,t,r){return e.s*(t.t-r.t)+t.s*(r.t-e.t)+r.s*(e.t-t.t)>=0},i.interpolate=function(e,t,r,n){return e=e<0?0:e,r=r<0?0:r,e<=r?r===0?(t+n)/2:t+(n-t)*(e/(e+r)):n+(t-n)*(r/(e+r))},i.intersect=function(e,t,r,n,s){var o,a,l;i.vertLeq(e,t)||(l=e,e=t,t=l),i.vertLeq(r,n)||(l=r,r=n,n=l),i.vertLeq(e,r)||(l=e,e=r,r=l,l=t,t=n,n=l),i.vertLeq(r,t)?i.vertLeq(t,n)?(o=i.edgeEval(e,r,t),a=i.edgeEval(r,t,n),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,r.s,a,t.s)):(o=i.edgeSign(e,r,t),a=-i.edgeSign(e,n,t),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,r.s,a,n.s)):s.s=(r.s+t.s)/2,i.transLeq(e,t)||(l=e,e=t,t=l),i.transLeq(r,n)||(l=r,r=n,n=l),i.transLeq(e,r)||(l=e,e=r,r=l,l=t,t=n,n=l),i.transLeq(r,t)?i.transLeq(t,n)?(o=i.transEval(e,r,t),a=i.transEval(r,t,n),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,r.t,a,t.t)):(o=i.transSign(e,r,t),a=-i.transSign(e,n,t),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,r.t,a,n.t)):s.t=(r.t+t.t)/2},i}(),Hh=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}return i}(),up=function(){function i(e){this.side=e,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(i.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),i}(),Ll=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0}return i}(),n1=function(){function i(){var e=new Ll,t=new Hh,r=new up(0),n=new up(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,r.next=r,r.Sym=n,n.next=n,n.Sym=r,this.vHead=e,this.fHead=t,this.eHead=r,this.eHeadSym=n}return i.prototype.makeEdge_=function(e){var t=new up(0),r=new up(1);e.Sym.side<e.side&&(e=e.Sym);var n=e.Sym.next;return r.next=n,n.Sym.next=t,t.next=e,e.Sym.next=r,t.Sym=r,t.Onext=t,t.Lnext=r,t.Org=null,t.Lface=null,t.winding=0,t.activeRegion=null,r.Sym=t,r.Onext=r,r.Lnext=t,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,t},i.prototype.splice_=function(e,t){var r=e.Onext,n=t.Onext;r.Sym.Lnext=t,n.Sym.Lnext=e,e.Onext=n,t.Onext=r},i.prototype.makeVertex_=function(e,t,r){var n=e;qe(n,"Vertex can't be null!");var s=r.prev;n.prev=s,s.next=n,n.next=r,r.prev=n,n.anEdge=t;var o=t;do o.Org=n,o=o.Onext;while(o!==t)},i.prototype.makeFace_=function(e,t,r){var n=e;qe(n,"Face can't be null");var s=r.prev;n.prev=s,s.next=n,n.next=r,r.prev=n,n.anEdge=t,n.trail=null,n.marked=!1,n.inside=r.inside;var o=t;do o.Lface=n,o=o.Lnext;while(o!==t)},i.prototype.killEdge_=function(e){e.Sym.side<e.side&&(e=e.Sym);var t=e.next,r=e.Sym.next;t.Sym.next=r,r.Sym.next=t},i.prototype.killVertex_=function(e,t){var r=e.anEdge,n=r;do n.Org=t,n=n.Onext;while(n!==r);var s=e.prev,o=e.next;o.prev=s,s.next=o},i.prototype.killFace_=function(e,t){var r=e.anEdge,n=r;do n.Lface=t,n=n.Lnext;while(n!==r);var s=e.prev,o=e.next;o.prev=s,s.next=o},i.prototype.makeEdge=function(){var e=new Ll,t=new Ll,r=new Hh,n=this.makeEdge_(this.eHead);return this.makeVertex_(e,n,this.vHead),this.makeVertex_(t,n.Sym,this.vHead),this.makeFace_(r,n,this.fHead),n},i.prototype.splice=function(e,t){var r=!1,n=!1;if(e!==t){if(t.Org!==e.Org&&(n=!0,this.killVertex_(t.Org,e.Org)),t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(t,e),!n){var s=new Ll;this.makeVertex_(s,t,e.Org),e.Org.anEdge=e}if(!r){var o=new Hh;this.makeFace_(o,t,e.Lface),e.Lface.anEdge=e}}},i.prototype.delete=function(e){var t=e.Sym,r=!1;if(e.Lface!==e.Rface&&(r=!0,this.killFace_(e.Lface,e.Rface)),e.Onext===e)this.killVertex_(e.Org,null);else if(e.Rface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev),!r){var n=new Hh;this.makeFace_(n,e,e.Lface)}t.Onext===t?(this.killVertex_(t.Org,null),this.killFace_(t.Lface,null)):(e.Lface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev)),this.killEdge_(e)},i.prototype.addEdgeVertex=function(e){var t=this.makeEdge_(e),r=t.Sym;this.splice_(t,e.Lnext),t.Org=e.Dst;var n=new Ll;return this.makeVertex_(n,r,t.Org),t.Lface=r.Lface=e.Lface,t},i.prototype.splitEdge=function(e){var t=this.addEdgeVertex(e),r=t.Sym;return this.splice_(e.Sym,e.Sym.Oprev),this.splice_(e.Sym,r),e.Dst=r.Org,r.Dst.anEdge=r.Sym,r.Rface=e.Rface,r.winding=e.winding,r.Sym.winding=e.Sym.winding,r.idx=e.idx,r.Sym.idx=e.Sym.idx,r},i.prototype.connect=function(e,t){var r=!1,n=this.makeEdge_(e),s=n.Sym;if(t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(n,e.Lnext),this.splice_(s,t),n.Org=e.Dst,s.Org=t.Org,n.Lface=s.Lface=e.Lface,e.Lface.anEdge=s,!r){var o=new Hh;this.makeFace_(o,n,e.Lface)}return n},i.prototype.zapFace=function(e){var t=e.anEdge,r,n,s,o,a;n=t.Lnext;do r=n,n=r.Lnext,r.Lface=null,r.Rface===null&&(r.Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),s=r.Sym,s.Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(r));while(r!=t);o=e.prev,a=e.next,a.prev=o,o.next=a},i.prototype.countFaceVerts_=function(e){var t=e.anEdge,r=0;do r++,t=t.Lnext;while(t!==e.anEdge);return r},i.prototype.mergeConvexFaces=function(e){var t,r,n,s,o,a,l;for(t=this.fHead.next;t!==this.fHead;t=t.next)if(!!t.inside)for(r=t.anEdge,o=r.Org;n=r.Lnext,s=r.Sym,s&&s.Lface&&s.Lface.inside&&(a=this.countFaceVerts_(t),l=this.countFaceVerts_(s.Lface),a+l-2<=e&&ze.vertCCW(r.Lprev.Org,r.Org,s.Lnext.Lnext.Org)&&ze.vertCCW(s.Lprev.Org,s.Org,r.Lnext.Lnext.Org)&&(n=s.Lnext,this.delete(s),r=null,s=null)),!(r&&r.Lnext.Org===o);)r=n;return!0},i.prototype.check=function(){var e=this.fHead,t=this.vHead,r=this.eHead,n,s,o,a,l,c;for(s=e,s=e;(n=s.next)!==e;s=n){qe(n.prev===s),l=n.anEdge;do qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l),qe(l.Lface===n),l=l.Lnext;while(l!==n.anEdge)}for(qe(n.prev===s&&n.anEdge===null),a=t,a=t;(o=a.next)!==t;a=o){qe(o.prev===a),l=o.anEdge;do qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l),qe(l.Org===o),l=l.Onext;while(l!==o.anEdge)}for(qe(o.prev===a&&o.anEdge===null),c=r,c=r;(l=c.next)!==r;c=l)qe(l.Sym.next===c.Sym),qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Org!==null),qe(l.Dst!==null),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l);qe(l.Sym.next===c.Sym&&l.Sym===this.eHeadSym&&l.Sym.Sym===l&&l.Org===null&&l.Dst===null&&l.Lface===null&&l.Rface===null)},i}(),i1=function(){function i(){this.handle=null}return i}(),s1=function(){function i(){this.key=null,this.node=0}return i}(),KO=function(){function i(e,t){this.leq=t,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=e,this.nodes=[],this.handles=[];for(var r=0;r<e+1;r++)this.nodes[r]=new i1,this.handles[r]=new s1;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return i.prototype.floatDown_=function(e){var t=this.nodes,r=this.handles,n,s,o;for(n=t[e].handle;;){if(o=e<<1,o<this.size&&this.leq(r[t[o+1].handle].key,r[t[o].handle].key)&&++o,qe(o<=this.max),s=t[o].handle,o>this.size||this.leq(r[n].key,r[s].key)){t[e].handle=n,r[n].node=e;break}t[e].handle=s,r[s].node=e,e=o}},i.prototype.floatUp_=function(e){var t=this.nodes,r=this.handles,n,s,o;for(n=t[e].handle;;){if(o=e>>1,s=t[o].handle,o===0||this.leq(r[s].key,r[n].key)){t[e].handle=n,r[n].node=e;break}t[e].handle=s,r[s].node=e,e=o}},i.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},i.prototype.min=function(){return this.handles[this.nodes[1].handle].key},i.prototype.insert=function(e){var t,r;if(t=++this.size,t*2>this.max){this.max*=2;var n,s;for(s=this.nodes.length,this.nodes.length=this.max+1,n=s;n<this.nodes.length;n++)this.nodes[n]=new i1;for(s=this.handles.length,this.handles.length=this.max+1,n=s;n<this.handles.length;n++)this.handles[n]=new s1}return this.freeList===0?r=t:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[t].handle=r,this.handles[r].node=t,this.handles[r].key=e,this.initialized&&this.floatUp_(t),r},i.prototype.extractMin=function(){var e=this.nodes,t=this.handles,r=e[1].handle,n=t[r].key;return this.size>0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[r].key=null,t[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),n},i.prototype.delete=function(e){var t=this.nodes,r=this.handles,n;qe(e>=1&&e<=this.max&&r[e].key!==null),n=r[e].node,t[n].handle=t[this.size].handle,r[t[n].handle].node=n,--this.size,n<=this.size&&(n<=1||this.leq(r[t[n>>1].handle].key,r[t[n].handle].key)?this.floatDown_(n):this.floatUp_(n)),r[e].key=null,r[e].node=this.freeList,this.freeList=e},i}(),ov=function(){function i(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}return i}(),o1=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),ZO=function(){function i(e,t){this.frame=e,this.leq=t,this.head=new o1,this.head.next=this.head,this.head.prev=this.head}return i.prototype.min=function(){return this.head.next},i.prototype.max=function(){return this.head.prev},i.prototype.insert=function(e){return this.insertBefore(this.head,e)},i.prototype.search=function(e){var t=this.head;do t=t.next;while(t.key!==null&&!this.leq(this.frame,e,t.key));return t},i.prototype.insertBefore=function(e,t){do e=e.prev;while(e.key!==null&&!this.leq(this.frame,e.key,t));var r=new o1;return r.key=t,r.next=e.next,e.next.prev=r,r.prev=e,e.next=r,r},i.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},i}(),$O=function(){function i(){}return i.regionBelow=function(e){return e.nodeUp.prev.key},i.regionAbove=function(e){return e.nodeUp.next.key},i.debugEvent=function(e){},i.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.edgeLeq=function(e,t,r){var n=e.event,s=t.eUp,o=r.eUp;if(s.Dst===n)return o.Dst===n?ze.vertLeq(s.Org,o.Org)?ze.edgeSign(o.Dst,s.Org,o.Org)<=0:ze.edgeSign(s.Dst,o.Org,s.Org)>=0:ze.edgeSign(o.Dst,n,o.Org)<=0;if(o.Dst===n)return ze.edgeSign(s.Dst,n,s.Org)>=0;var a=ze.edgeEval(s.Dst,n,s.Org),l=ze.edgeEval(o.Dst,n,o.Org);return a>=l},i.deleteRegion=function(e,t){t.fixUpperEdge&&qe(t.eUp.winding===0),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},i.fixUpperEdge=function(e,t,r){qe(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=r,r.activeRegion=t},i.topLeftRegion=function(e,t){var r=t.eUp.Org,n;do t=i.regionAbove(t);while(t.eUp.Org===r);if(t.fixUpperEdge){if(n=e.mesh.connect(i.regionBelow(t).eUp.Sym,t.eUp.Lnext),n===null)return null;i.fixUpperEdge(e,t,n),t=i.regionAbove(t)}return t},i.topRightRegion=function(e){var t=e.eUp.Dst;do e=i.regionAbove(e);while(e.eUp.Dst===t);return e},i.addRegionBelow=function(e,t,r){var n=new ov;return n.eUp=r,n.nodeUp=e.dict.insertBefore(t.nodeUp,n),n.fixUpperEdge=!1,n.sentinel=!1,n.dirty=!1,r.activeRegion=n,n},i.isWindingInside=function(e,t){switch(e.windingRule){case Zt.ODD:return(t&1)!==0;case Zt.NONZERO:return t!==0;case Zt.POSITIVE:return t>0;case Zt.NEGATIVE:return t<0;case Zt.ABS_GEQ_TWO:return t>=2||t<=-2}throw new Error("Invalid winding rulle")},i.computeWinding=function(e,t){t.windingNumber=i.regionAbove(t).windingNumber+t.eUp.winding,t.inside=i.isWindingInside(e,t.windingNumber)},i.finishRegion=function(e,t){var r=t.eUp,n=r.Lface;n.inside=t.inside,n.anEdge=r,i.deleteRegion(e,t)},i.finishLeftRegions=function(e,t,r){for(var n,s=null,o=t,a=t.eUp;o!==r;){if(o.fixUpperEdge=!1,s=i.regionBelow(o),n=s.eUp,n.Org!=a.Org){if(!s.fixUpperEdge){i.finishRegion(e,o);break}n=e.mesh.connect(a.Lprev,n.Sym),i.fixUpperEdge(e,s,n)}a.Onext!==n&&(e.mesh.splice(n.Oprev,n),e.mesh.splice(a,n)),i.finishRegion(e,o),a=s.eUp,o=s}return a},i.addRightEdges=function(e,t,r,n,s,o){var a,l,c,h,u=!0;c=r;do qe(ze.vertLeq(c.Org,c.Dst)),i.addRegionBelow(e,t,c.Sym),c=c.Onext;while(c!==n);for(s===null&&(s=i.regionBelow(t).eUp.Rprev),l=t,h=s;a=i.regionBelow(l),c=a.eUp.Sym,c.Org===h.Org;)c.Onext!==h&&(e.mesh.splice(c.Oprev,c),e.mesh.splice(h.Oprev,c)),a.windingNumber=l.windingNumber-c.winding,a.inside=i.isWindingInside(e,a.windingNumber),l.dirty=!0,!u&&i.checkForRightSplice(e,l)&&(i.addWinding(c,h),i.deleteRegion(e,l),e.mesh.delete(h)),u=!1,l=a,h=c;l.dirty=!0,qe(l.windingNumber-c.winding===a.windingNumber),o&&i.walkDirtyRegions(e,l)},i.spliceMergeVertices=function(e,t,r){e.mesh.splice(t,r)},i.vertexWeights=function(e,t,r){var n=ze.vertL1dist(t,e),s=ze.vertL1dist(r,e),o=.5*s/(n+s),a=.5*n/(n+s);e.coords[0]+=o*t.coords[0]+a*r.coords[0],e.coords[1]+=o*t.coords[1]+a*r.coords[1],e.coords[2]+=o*t.coords[2]+a*r.coords[2]},i.getIntersectData=function(e,t,r,n,s,o){t.coords[0]=t.coords[1]=t.coords[2]=0,t.idx=-1,i.vertexWeights(t,r,n),i.vertexWeights(t,s,o)},i.checkForRightSplice=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp;if(ze.vertLeq(n.Org,s.Org)){if(ze.edgeSign(s.Dst,n.Org,s.Org)>0)return!1;ze.vertEq(n.Org,s.Org)?n.Org!==s.Org&&(e.pq.delete(n.Org.pqHandle),i.spliceMergeVertices(e,s.Oprev,n)):(e.mesh.splitEdge(s.Sym),e.mesh.splice(n,s.Oprev),t.dirty=r.dirty=!0)}else{if(ze.edgeSign(n.Dst,s.Org,n.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(n.Sym),e.mesh.splice(s.Oprev,n)}return!0},i.checkForLeftSplice=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp,o;if(qe(!ze.vertEq(n.Dst,s.Dst)),ze.vertLeq(n.Dst,s.Dst)){if(ze.edgeSign(n.Dst,s.Dst,n.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,o=e.mesh.splitEdge(n),e.mesh.splice(s.Sym,o),o.Lface.inside=t.inside}else{if(ze.edgeSign(s.Dst,n.Dst,s.Org)>0)return!1;t.dirty=r.dirty=!0,o=e.mesh.splitEdge(s),e.mesh.splice(n.Lnext,s.Sym),o.Rface.inside=t.inside}return!0},i.checkForIntersect=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp,o=n.Org,a=s.Org,l=n.Dst,c=s.Dst,h,u,f=new Ll,d,p;if(qe(!ze.vertEq(c,l)),qe(ze.edgeSign(l,e.event,o)<=0),qe(ze.edgeSign(c,e.event,a)>=0),qe(o!==e.event&&a!==e.event),qe(!t.fixUpperEdge&&!r.fixUpperEdge),o===a||(h=Math.min(o.t,l.t),u=Math.max(a.t,c.t),h>u))return!1;if(ze.vertLeq(o,a)){if(ze.edgeSign(c,o,a)>0)return!1}else if(ze.edgeSign(l,a,o)<0)return!1;return i.debugEvent(e),ze.intersect(l,o,c,a,f),qe(Math.min(o.t,l.t)<=f.t),qe(f.t<=Math.max(a.t,c.t)),qe(Math.min(c.s,l.s)<=f.s),qe(f.s<=Math.max(a.s,o.s)),ze.vertLeq(f,e.event)&&(f.s=e.event.s,f.t=e.event.t),d=ze.vertLeq(o,a)?o:a,ze.vertLeq(d,f)&&(f.s=d.s,f.t=d.t),ze.vertEq(f,o)||ze.vertEq(f,a)?(i.checkForRightSplice(e,t),!1):!ze.vertEq(l,e.event)&&ze.edgeSign(l,e.event,f)>=0||!ze.vertEq(c,e.event)&&ze.edgeSign(c,e.event,f)<=0?c===e.event?(e.mesh.splitEdge(n.Sym),e.mesh.splice(s.Sym,n),t=i.topLeftRegion(e,t),n=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),r),i.addRightEdges(e,t,n.Oprev,n,n,!0),!0):l===e.event?(e.mesh.splitEdge(s.Sym),e.mesh.splice(n.Lnext,s.Oprev),r=t,t=i.topRightRegion(t),p=i.regionBelow(t).eUp.Rprev,r.eUp=s.Oprev,s=i.finishLeftRegions(e,r,null),i.addRightEdges(e,t,s.Onext,n.Rprev,p,!0),!0):(ze.edgeSign(l,e.event,f)>=0&&(i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(n.Sym),n.Org.s=e.event.s,n.Org.t=e.event.t),ze.edgeSign(c,e.event,f)<=0&&(t.dirty=r.dirty=!0,e.mesh.splitEdge(s.Sym),s.Org.s=e.event.s,s.Org.t=e.event.t),!1):(e.mesh.splitEdge(n.Sym),e.mesh.splitEdge(s.Sym),e.mesh.splice(s.Oprev,n),n.Org.s=f.s,n.Org.t=f.t,n.Org.pqHandle=e.pq.insert(n.Org),i.getIntersectData(e,n.Org,o,l,a,c),i.regionAbove(t).dirty=t.dirty=r.dirty=!0,!1)},i.walkDirtyRegions=function(e,t){for(var r=i.regionBelow(t),n,s;;){for(;r.dirty;)t=r,r=i.regionBelow(r);if(!t.dirty&&(r=t,t=i.regionAbove(t),t===null||!t.dirty))return;if(t.dirty=!1,n=t.eUp,s=r.eUp,n.Dst!==s.Dst&&i.checkForLeftSplice(e,t)&&(r.fixUpperEdge?(i.deleteRegion(e,r),e.mesh.delete(s),r=i.regionBelow(t),s=r.eUp):t.fixUpperEdge&&(i.deleteRegion(e,t),e.mesh.delete(n),t=i.regionAbove(r),n=t.eUp)),n.Org!==s.Org)if(n.Dst!==s.Dst&&!t.fixUpperEdge&&!r.fixUpperEdge&&(n.Dst===e.event||s.Dst===e.event)){if(i.checkForIntersect(e,t))return}else i.checkForRightSplice(e,t);n.Org===s.Org&&n.Dst===s.Dst&&(i.addWinding(s,n),i.deleteRegion(e,t),e.mesh.delete(n),t=i.regionAbove(r))}},i.connectRightVertex=function(e,t,r){var n,s=r.Onext,o=i.regionBelow(t),a=t.eUp,l=o.eUp,c=!1;if(a.Dst!==l.Dst&&i.checkForIntersect(e,t),ze.vertEq(a.Org,e.event)&&(e.mesh.splice(s.Oprev,a),t=i.topLeftRegion(e,t),s=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),o),c=!0),ze.vertEq(l.Org,e.event)&&(e.mesh.splice(r,l.Oprev),r=i.finishLeftRegions(e,o,null),c=!0),c){i.addRightEdges(e,t,r.Onext,s,s,!0);return}ze.vertLeq(l.Org,a.Org)?n=l.Oprev:n=a,n=e.mesh.connect(r.Lprev,n),i.addRightEdges(e,t,n,n.Onext,n.Onext,!1),n.Sym.activeRegion.fixUpperEdge=!0,i.walkDirtyRegions(e,t)},i.connectLeftDegenerate=function(e,t,r){var n,s,o,a,l;if(n=t.eUp,ze.vertEq(n.Org,r)){qe(!1),i.spliceMergeVertices(e,n,r.anEdge);return}if(!ze.vertEq(n.Dst,r)){e.mesh.splitEdge(n.Sym),t.fixUpperEdge&&(e.mesh.delete(n.Onext),t.fixUpperEdge=!1),e.mesh.splice(r.anEdge,n),i.sweepEvent(e,r);return}qe(!1),t=i.topRightRegion(t),l=i.regionBelow(t),o=l.eUp.Sym,s=a=o.Onext,l.fixUpperEdge&&(qe(s!==o),i.deleteRegion(e,l),e.mesh.delete(o),o=s.Oprev),e.mesh.splice(r.anEdge,o),ze.edgeGoesLeft(s)||(s=null),i.addRightEdges(e,t,o.Onext,a,s,!0)},i.connectLeftVertex=function(e,t){var r,n,s,o,a,l,c=new ov;if(c.eUp=t.anEdge.Sym,r=e.dict.search(c).key,n=i.regionBelow(r),!!n){if(o=r.eUp,a=n.eUp,ze.edgeSign(o.Dst,t,o.Org)===0){i.connectLeftDegenerate(e,r,t);return}if(s=ze.vertLeq(a.Dst,o.Dst)?r:n,r.inside||s.fixUpperEdge){if(s===r)l=e.mesh.connect(t.anEdge.Sym,o.Lnext);else{var h=e.mesh.connect(a.Dnext,t.anEdge);l=h.Sym}s.fixUpperEdge?i.fixUpperEdge(e,s,l):i.computeWinding(e,i.addRegionBelow(e,r,l)),i.sweepEvent(e,t)}else i.addRightEdges(e,r,t.anEdge,t.anEdge,null,!0)}},i.sweepEvent=function(e,t){e.event=t,i.debugEvent(e);for(var r=t.anEdge;r.activeRegion===null;)if(r=r.Onext,r===t.anEdge){i.connectLeftVertex(e,t);return}var n=i.topLeftRegion(e,r.activeRegion);qe(n!==null);var s=i.regionBelow(n),o=s.eUp,a=i.finishLeftRegions(e,s,null);a.Onext===o?i.connectRightVertex(e,n,a):i.addRightEdges(e,n,a.Onext,o,o,!0)},i.addSentinel=function(e,t,r,n){var s=new ov,o=e.mesh.makeEdge();o.Org.s=r,o.Org.t=n,o.Dst.s=t,o.Dst.t=n,e.event=o.Dst,s.eUp=o,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=e.dict.insert(s)},i.initEdgeDict=function(e){e.dict=new ZO(e,i.edgeLeq);var t=e.bmax[0]-e.bmin[0],r=e.bmax[1]-e.bmin[1],n=e.bmin[0]-t,s=e.bmax[0]+t,o=e.bmin[1]-r,a=e.bmax[1]+r;i.addSentinel(e,n,s,o),i.addSentinel(e,n,s,a)},i.doneEdgeDict=function(e){for(var t,r=0;(t=e.dict.min().key)!==null;)t.sentinel||(qe(t.fixUpperEdge),qe(++r===1)),qe(t.windingNumber===0),i.deleteRegion(e,t)},i.removeDegenerateEdges=function(e){var t,r,n,s=e.mesh.eHead;for(t=s.next;t!==s;t=r)r=t.next,n=t.Lnext,ze.vertEq(t.Org,t.Dst)&&t.Lnext.Lnext!==t&&(i.spliceMergeVertices(e,n,t),e.mesh.delete(t),t=n,n=t.Lnext),n.Lnext===t&&(n!==t&&((n===r||n===r.Sym)&&(r=r.next),e.mesh.delete(n)),(t===r||t===r.Sym)&&(r=r.next),e.mesh.delete(t))},i.initPriorityQ=function(e){var t,r,n,s=0;for(n=e.mesh.vHead,r=n.next;r!==n;r=r.next)s++;for(s+=8,t=e.pq=new KO(s,ze.vertLeq),n=e.mesh.vHead,r=n.next;r!==n;r=r.next)r.pqHandle=t.insert(r);return r!==n?!1:(t.init(),!0)},i.donePriorityQ=function(e){e.pq=null},i.removeDegenerateFaces=function(e,t){var r,n,s;for(r=t.fHead.next;r!==t.fHead;r=n)n=r.next,s=r.anEdge,qe(s.Lnext!==s),s.Lnext.Lnext===s&&(i.addWinding(s.Onext,s),e.mesh.delete(s));return!0},i.computeInterior=function(e,t){t===void 0&&(t=!0);var r,n;if(i.removeDegenerateEdges(e),!i.initPriorityQ(e))return!1;for(i.initEdgeDict(e);(r=e.pq.extractMin())!==null;){for(;n=e.pq.min(),!(n===null||!ze.vertEq(n,r));)n=e.pq.extractMin(),i.spliceMergeVertices(e,r.anEdge,n.anEdge);i.sweepEvent(e,r)}return e.event=e.dict.min().key.eUp.Org,i.debugEvent(e),i.doneEdgeDict(e),i.donePriorityQ(e),i.removeDegenerateFaces(e,e.mesh)?(t&&e.mesh.check(),!0):!1},i}(),eF=function(){function i(){this.mesh=new n1,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=Zt.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return i.prototype.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},i.prototype.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];if(!t)throw"Zero-size vector!";t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},i.prototype.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},i.prototype.computeNormal_=function(e){var t,r,n,s,o,a,l=[0,0,0],c=[0,0,0],h=[0,0,0],u=[0,0,0],f=[0,0,0],d=[null,null,null],p=[null,null,null],m=this.mesh.vHead;t=m.next;for(var g=0;g<3;++g)s=t.coords[g],c[g]=s,p[g]=t,l[g]=s,d[g]=t;for(t=m.next;t!==m;t=t.next)for(var v=0;v<3;++v)s=t.coords[v],s<c[v]&&(c[v]=s,p[v]=t),s>l[v]&&(l[v]=s,d[v]=t);var y=0;if(l[1]-c[1]>l[0]-c[0]&&(y=1),l[2]-c[2]>l[y]-c[y]&&(y=2),c[y]>=l[y]){e[0]=0,e[1]=0,e[2]=1;return}for(a=0,r=p[y],n=d[y],h[0]=r.coords[0]-n.coords[0],h[1]=r.coords[1]-n.coords[1],h[2]=r.coords[2]-n.coords[2],t=m.next;t!==m;t=t.next)u[0]=t.coords[0]-n.coords[0],u[1]=t.coords[1]-n.coords[1],u[2]=t.coords[2]-n.coords[2],f[0]=h[1]*u[2]-h[2]*u[1],f[1]=h[2]*u[0]-h[0]*u[2],f[2]=h[0]*u[1]-h[1]*u[0],o=f[0]*f[0]+f[1]*f[1]+f[2]*f[2],o>a&&(a=o,e[0]=f[0],e[1]=f[1],e[2]=f[2]);a<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(h)]=1)},i.prototype.checkOrientation_=function(){for(var e=this.mesh.fHead,t,r=this.mesh.vHead,n,s=0,o=e.next;o!==e;o=o.next)if(n=o.anEdge,!(n.winding<=0))do s+=(n.Org.s-n.Dst.s)*(n.Org.t+n.Dst.t),n=n.Lnext;while(n!==o.anEdge);if(s<0){for(t=r.next;t!==r;t=t.next)t.t=-t.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},i.prototype.projectPolygon_=function(){var e=this.mesh.vHead,t=[0,0,0],r,n,s=!1;t[0]=this.normal[0],t[1]=this.normal[1],t[2]=this.normal[2],!t[0]&&!t[1]&&!t[2]&&(this.computeNormal_(t),s=!0),r=this.sUnit,n=this.tUnit;var o=this.longAxis_(t);r[o]=0,r[(o+1)%3]=1,r[(o+2)%3]=0,n[o]=0,n[(o+1)%3]=0,n[(o+2)%3]=t[o]>0?1:-1;for(var a=e.next;a!==e;a=a.next)a.s=this.dot_(a.coords,r),a.t=this.dot_(a.coords,n);s&&this.checkOrientation_();for(var l=!0,c=e.next;c!==e;c=c.next)l?(this.bmin[0]=this.bmax[0]=c.s,this.bmin[1]=this.bmax[1]=c.t,l=!1):(c.s<this.bmin[0]&&(this.bmin[0]=c.s),c.s>this.bmax[0]&&(this.bmax[0]=c.s),c.t<this.bmin[1]&&(this.bmin[1]=c.t),c.t>this.bmax[1]&&(this.bmax[1]=c.t))},i.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.prototype.tessellateMonoRegion_=function(e,t){var r,n;if(r=t.anEdge,!(r.Lnext!==r&&r.Lnext.Lnext!==r))throw"Mono region invalid";for(;ze.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;ze.vertLeq(r.Org,r.Dst);r=r.Lnext);n=r.Lprev;for(var s=void 0;r.Lnext!==n;)if(ze.vertLeq(r.Dst,n.Org)){for(;n.Lnext!==r&&(ze.edgeGoesLeft(n.Lnext)||ze.edgeSign(n.Org,n.Dst,n.Lnext.Dst)<=0);)s=e.connect(n.Lnext,n),n=s.Sym;n=n.Lprev}else{for(;n.Lnext!==r&&(ze.edgeGoesRight(r.Lprev)||ze.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)s=e.connect(r,r.Lprev),r=s.Sym;r=r.Lnext}if(n.Lnext===r)throw"Mono region invalid";for(;n.Lnext.Lnext!==r;)s=e.connect(n.Lnext,n),n=s.Sym;return!0},i.prototype.tessellateInterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)if(t=r.next,r.inside&&!this.tessellateMonoRegion_(e,r))return!1;return!0},i.prototype.discardExterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)t=r.next,r.inside||e.zapFace(r)},i.prototype.setWindingNumber_=function(e,t,r){for(var n,s=e.eHead.next;s!==e.eHead;s=n)n=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?t:-t:r?e.delete(s):s.winding=0},i.prototype.getNeighbourFace_=function(e){return!e.Rface||!e.Rface.inside?-1:e.Rface.n},i.prototype.outputPolymesh_=function(e,t,r,n){var s,o=0,a=0,l;r>3&&e.mergeConvexFaces(r);for(var c=e.vHead.next;c!==e.vHead;c=c.next)c.n=-1;for(var h=e.fHead.next;h!==e.fHead;h=h.next)if(h.n=-1,!!h.inside){s=h.anEdge,l=0;do{var c=s.Org;c.n===-1&&(c.n=a,a++),l++,s=s.Lnext}while(s!==h.anEdge);if(l>r)throw"Face vertex greater that support polygon";h.n=o,++o}this.elementCount=o,t===Tr.CONNECTED_POLYGONS&&(o*=2),this.elements=[],this.elements.length=o*r,this.vertexCount=a,this.vertices=[],this.vertices.length=a*n,this.vertexIndices=[],this.vertexIndices.length=a;for(var c=e.vHead.next;c!==e.vHead;c=c.next)if(c.n!==-1){var u=c.n*n;this.vertices[u+0]=c.coords[0],this.vertices[u+1]=c.coords[1],n>2&&(this.vertices[u+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var f=0,h=e.fHead.next;h!==e.fHead;h=h.next)if(!!h.inside){s=h.anEdge,l=0;do{var c=s.Org;this.elements[f++]=c.n,l++,s=s.Lnext}while(s!==h.anEdge);for(var d=l;d<r;++d)this.elements[f++]=-1;if(t===Tr.CONNECTED_POLYGONS){s=h.anEdge;do this.elements[f++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==h.anEdge);for(var p=l;p<r;++p)this.elements[f++]=-1}}},i.prototype.outputContours_=function(e,t){var r,n,s=0,o=0;this.vertexCount=0,this.elementCount=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(!!a.inside){n=r=a.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==n);this.elementCount++}this.elements=[],this.elements.length=this.elementCount*2,this.vertices=[],this.vertices.length=this.vertexCount*t,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var l=0,c=0,h=0;s=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(!!a.inside){o=0,n=r=a.anEdge;do this.vertices[l++]=r.Org.coords[0],this.vertices[l++]=r.Org.coords[1],t>2&&(this.vertices[l++]=r.Org.coords[2]),this.vertexIndices[c++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,o++,r=r.Lnext;while(r!==n);this.elements[h++]=s,this.elements[h++]=o,s+=o}},i.prototype.addContour=function(e,t){this.mesh===null&&(this.mesh=new n1),e<2&&(e=2),e>3&&(e=3);for(var r=null,n=0;n<t.length;n+=e)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=t[n+0],r.Org.coords[1]=t[n+1],e>2?r.Org.coords[2]=t[n+2]:r.Org.coords[2]=0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},i.prototype.tesselate=function(e,t,r,n,s,o){if(e===void 0&&(e=Zt.ODD),t===void 0&&(t=Tr.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,s&&(this.normal[0]=s[0],this.normal[1]=s[1],this.normal[2]=s[2]),this.windingRule=e,n<2&&(n=2),n>3&&(n=3),!this.mesh)return!1;this.projectPolygon_(),$O.computeInterior(this,o);var a=this.mesh;return t===Tr.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),o&&a.check(),t===Tr.BOUNDARY_CONTOURS?this.outputContours_(a,n):this.outputPolymesh_(a,t,r,n),!0},i}();function Xo(i){var e=i.windingRule,t=e===void 0?Zt.ODD:e,r=i.elementType,n=r===void 0?Tr.POLYGONS:r,s=i.polySize,o=s===void 0?3:s,a=i.vertexSize,l=a===void 0?2:a,c=i.normal,h=c===void 0?[0,0,1]:c,u=i.contours,f=u===void 0?[]:u,d=i.strict,p=d===void 0?!0:d,m=i.debug,g=m===void 0?!1:m;if(!f&&p)throw new Error("Contours can't be empty");if(!!f){var v=new eF;i.edgeCreateCallback&&(v.edgeCreateCallback=i.edgeCreateCallback),i.vertexIdCallback&&(v.vertexIdCallback=i.vertexIdCallback);for(var y=0;y<f.length;y++)v.addContour(l||2,f[y]);return v.tesselate(t,n,o,l,h,p),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:g?v.mesh:void 0}}}var B7=Zt.ODD,N7=Zt.NONZERO,O7=Zt.POSITIVE,F7=Zt.NEGATIVE,U7=Zt.ABS_GEQ_TWO,z7=Tr.POLYGONS,G7=Tr.CONNECTED_POLYGONS,k7=Tr.BOUNDARY_CONTOURS;var Il=class extends Le{constructor(t,r=12,n={}){var p,m,g;super();this.type="ShapeGeometry";this.windingRule=Zt.ODD;this.elementType=Tr.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._shape=t,this._curveSegments=r,this._triangulationOptions=Object.assign({windingRule:Zt.ODD,elementType:Tr.POLYGONS,polySize:3,vertexSize:2,strict:!0},n);let s=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(v=>v.extractShapePointsToFlatArray([],this._curveSegments)),a,l=!0,c=!0,h,u;for(let v=0,y=s.length/2;v<y;v++){let w=v*2,b=s[w+0],S=s[w+1];if(h!==void 0&&b!==h&&(l=!1),u!==void 0&&S!==u&&(c=!1),h=b,u=S,!l&&!c)break}!l&&!c&&(a=Xo({contours:[s,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict}));let f=(p=a==null?void 0:a.vertexCount)!=null?p:1,d=(m=a==null?void 0:a.elementCount)!=null?m:1;if(this._positionAttribute=new Ve(new Float32Array(f*3),3),this._normalAttribute=new Ve(new Float32Array(f*3),3),this._uvAttribute=new Ve(new Float32Array(f*2),2),this._indexAttribute=new Ve(new Uint32Array(d*3),1),a){let v=1/0,y=-1/0,w=1/0,b=-1/0;for(let A=0,x=f;A<x;A++){let E=A*2,_=a.vertices[E+0],C=a.vertices[E+1];_<v&&(v=_),_>y&&(y=_),C<w&&(w=C),C>b&&(b=C)}let S=y-v,T=b-w;for(let A=0,x=f;A<x;A++){let E=A*2,_=a.vertices[E+0],C=a.vertices[E+1],I=(_-v)/S,N=(C-w)/T;this._positionAttribute.setXYZ(A,_,C,0),this._normalAttribute.setXYZ(A,0,0,1),this._uvAttribute.setXY(A,I,N)}for(let A=0,x=d;A<x;A++){let E=A*3,_=a.elements[E+0],C=a.elements[E+1],I=a.elements[E+2];this._indexAttribute.setX(E+0,_),this._indexAttribute.setX(E+1,C),this._indexAttribute.setX(E+2,I)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,((g=a==null?void 0:a.elementCount)!=null?g:1)*3)}clone(){let t=new Il(this._shape,this._curveSegments);return t.userData=Sh(this.userData),t}};var fp=class{constructor(e=256,t=!1){this.capacity=e,this.size=0,this.debug=t,this.debug&&console.log(`allocating with cap ${e}`);let r=e*fp.eSize;this.buffer=new ArrayBuffer(r);let n=Float32Array.BYTES_PER_ELEMENT,s=0;this.positions=new Float32Array(this.buffer,s*n,3*e),s+=3*e,this.normals=new Float32Array(this.buffer,s*n,3*e),s+=3*e,this.uvs=new Float32Array(this.buffer,s*n,2*e)}realloc(e,t=!1){if(e<this.size)throw Error("cannot shrink buffer");if(e<=this.capacity&&!t)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${e}`);let r=e*fp.eSize,n=new ArrayBuffer(r),s=Float32Array.BYTES_PER_ELEMENT,o=0,a=new Float32Array(n,o*s,3*e);o+=3*e;let l=new Float32Array(n,o*s,3*e);o+=3*e;let c=new Float32Array(n,o*s,2*e);a.set(this.positions.slice(0,this.size*3)),l.set(this.normals.slice(0,this.size*3)),c.set(this.uvs.slice(0,this.size*2)),this.buffer=n,this.positions=a,this.normals=l,this.uvs=c,this.capacity=e}get(e=1){let t=this.size+e;if(t>this.capacity){let n=this.capacity;for(;t>n;)n*=2;this.realloc(n)}let r=this.size;return this.size=t,r}reserve(e){let t=this.size+e;t>this.capacity&&this.realloc(t)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}},Wh=fp;Wh.eSize=(3+3+2)*Float32Array.BYTES_PER_ELEMENT;var av=(i,e)=>([t,r])=>(r<t&&(r+=e),(i>=t?i:i+e)<=r),Rl=class extends Le{constructor(t,r,n=0,s=12,o=3){super();this.type="ShapeGeometry";this.vertexCache={};this._shape=t,this._depth=r,this._bevel=n,this._curveSegments=s,this._bevelSegmentsInput=o,n<=0?(this._bevelSize=0,this._bevelSegments=0):(this._bevelSize=Math.min(n,r/2-1e-12),this._bevelSegments=Math.floor(o));let a=this._shape.extractShapePointsToFlatArray([],s),l=this._shape.shapeHoles.map(A=>{let x=A.extractShapePointsToFlatArray([],s),E=[];for(let _=x.length-1;_>=1;_-=2){let C=x[_-1],I=x[_-0];E.push(C,I)}return E}),c=Xo({windingRule:Zt.ODD,elementType:Tr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[a]}),h=Xo({windingRule:Zt.ODD,elementType:Tr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...l]});if(!c)throw new Error("error generating geometry");let u=c.elementCount;if(h){c.elementCount+=h.elementCount;for(let A=0;A<h.elements.length;A++){let x=h.elements[A],E=A%2===0?c.vertexCount:0;c.elements.push(x+E)}for(let A=0;A<h.vertexIndices.length;A++){let x=h.vertexIndices[A],E=c.vertexCount;c.vertexIndices.push(x+E)}for(let A=0;A<h.vertices.length;A++){let x=h.vertices[A];c.vertices.push(x)}}let f=1/0,d=-1/0,p=1/0,m=-1/0;for(let A=0,x=c.vertexCount;A<x;A++){let E=A*2,_=c.vertices[E+0],C=c.vertices[E+1];_<f&&(f=_),_>d&&(d=_),C<p&&(p=C),C>m&&(m=C)}this._minX=f,this._minY=p,this._width=d-f,this._height=m-p;let g=c.vertexCount*2*(2+this._bevelSegments);this._buffer=new Wh(g);let v=[],y=[];for(let A=c.elementCount-1;A>=0;A--){let x=A>=u,E=A*2,_=c.elements[E+0],C=c.elements[E+1],I=_+C,N={start:_,count:C,normals:[],continuous:[],concave:[]},R=_,k=I-1,G=_+1,te=this._shape.roundedCurves.length;do{let z=R-_,O=c.vertices[k*2+0],j=c.vertices[k*2+1],q=c.vertices[R*2+0],J=c.vertices[R*2+1],W=c.vertices[G*2+0],ge=c.vertices[G*2+1],oe=q-O,le=J-j,H=Math.sqrt(oe*oe+le*le);oe/=H,le/=H;let he=q-W,K=J-ge,V=Math.sqrt(he*he+K*K);he/=V,K/=V,N.normals[z*2+0]=-K,N.normals[z*2+1]=he,N.concave[z]=oe*K-le*he>0;let Z=c.vertexIndices[R];if(Array.isArray(Z))N.continuous[z]=!1;else{let[ce,se]=this._shape.getCurveIndexFromVertexId(Z-1,!0);if(se>0&&se<1)N.continuous[z]=!0;else{let pe=se===1?ce+1:ce-1;pe=(pe+te)%te;let ve=se===1?0:1,me=this._shape.roundedCurves[ce].getTangent(se),Pe=this._shape.roundedCurves[pe].getTangent(ve);N.continuous[z]=me.dot(Pe)>.95}}x&&(N.normals[z*2+0]*=-1,N.normals[z*2+1]*=-1),[k,R,G]=[R,G,G+1],G>=I&&(G-=C)}while(G!==_+1);let Q=[];Q.push({bevelI:0,angle:0,size:0,boundary:{vertices:c.vertices.slice(_*2,I*2),vertexCount:C,vertexIndices:new Array(C).fill(!0).map((z,O)=>[O,O]),elements:[0,C],elementCount:1,mesh:null},reverseMap:[],insetPoints:c.vertices.slice(_*2,I*2)});for(let z=1;z<=this._bevelSegments;z++){let O=z/this._bevelSegments*Math.PI/2,j=(1-Math.cos(O))*this._bevelSize,q=[],J=[],W=[],ge=[],oe=0;for(let H=0;H<C;H++){let he=H*2,K=(H-1+C)%C*2,V=c.vertices[N.start*2+he+0],Z=c.vertices[N.start*2+he+1],ce=-N.normals[K+0]*j,se=-N.normals[K+1]*j,pe=-N.normals[he+0]*j,ve=-N.normals[he+1]*j;if(N.concave[H]||!N.concave[H]&&x){let me=Math.atan2(se,ce),Pe=Math.atan2(ve,pe);Pe>me&&(Pe-=Math.PI*2);let ke=Pe-me;if(N.continuous[H]||x){let L=me+ke/2,D=Math.cos(L)*j,re=Math.sin(L)*j;q[2*oe+0]=V+D*(x?-1:1),q[2*oe+1]=Z+re*(x?-1:1),ge[oe]=H,oe++}else{let L=Math.max(1,Math.floor(s/4*Math.abs(ke)/Math.PI));for(let D=0;D<=L;D++){let re=me+ke*(D/L),ye=Math.cos(re)*j,Se=Math.sin(re)*j;q[2*oe+0]=V+ye,q[2*oe+1]=Z+Se,ge[oe]=H,oe++}}}else q[2*oe+0]=V+ce,q[2*oe+1]=Z+se,ge[oe]=H,J[H]=oe,oe++,q[2*oe+0]=V,q[2*oe+1]=Z,ge[oe]=H,oe++,q[2*oe+0]=V+pe,q[2*oe+1]=Z+ve,ge[oe]=H,W[H]=oe,oe++}let le=Xo({windingRule:Zt.POSITIVE,elementType:Tr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[q],edgeCreateCallback:H=>{let K=H.Org.idx,V=ge[K],Z=ge[(K+1)%ge.length];H.idx=[V,Z],H.Sym.idx=[Z,V]},vertexIdCallback:H=>{let he=H.Lprev.idx;return[he?he[1]:0,H.idx[0]]}});if(!le)throw console.log("Error"),new Error(`error generating bevel geometry for ${z}'th loop`);if(!le.vertexCount)break;for(let H=0;H<le.vertexIndices.length;H++){let[he,K]=le.vertexIndices[H];if(he===K)continue;let V=K;K<he&&(V+=C);for(let Z=he;Z<V;Z++){let ce=Z%C,se=(Z+1)%C;if(!N.continuous[ce]||!N.continuous[se]){le.vertexIndices[H]=[he,ce],le.vertexIndices.splice(H+1,0,[se,K]),le.vertices.splice((H+1)*2,0,le.vertices[H*2],le.vertices[H*2+1]);break}}}Q.push({bevelI:z,angle:O,size:j,boundary:le,reverseMap:ge,insetPoints:q})}let Y=(z,O,j)=>{let q=0,J=z.boundary.vertexIndices.length;for(;q<J&&j(z.boundary.vertexIndices[O]);)O=(O+1)%J,q++;return q},F=v.length;for(let z=1;z<Q.length;z++){let O=Q[z-1],j=Q[z],q=O.boundary.vertexIndices.length,J=j.boundary.vertexIndices.length;if(!q||!J)break;let W=N.concave.length,ge=0,oe=av(ge,C);for(;!O.boundary.vertexIndices.filter(oe).length||!j.boundary.vertexIndices.filter(oe).length;)ge++,oe=av(ge,C);let le=O.boundary.vertexIndices.findIndex(oe),H=j.boundary.vertexIndices.findIndex(oe);do le=(le+1)%q;while(oe(O.boundary.vertexIndices[le]));do H=(H+1)%J;while(oe(j.boundary.vertexIndices[H]));ge=(ge+1)%C;let he=ge,K=this.buildBevelVert(N,O,(le-1+q)%q),V=this.buildBevelVert(N,j,(H-1+J)%J),Z=K,ce=V,se,pe,ve=!1;do{oe=av(ge,C);let me=Y(O,le,oe),Pe=Y(j,H,oe),ke=ve;if(ve=!1,me&&!Pe){for(let L=0;L<me;L++)se=this.buildBevelVert(N,O,(le+L)%q,L/(me-1)),v.push(Z.topN,se.topP,ce.topN),v.push(se.bottomP,Z.bottomN,ce.bottomN),Z=se;ve=!0}else if(!me&&Pe)for(let L=0;L<Pe;L++)pe=this.buildBevelVert(N,j,(H+L)%J,L/(Pe-1)),v.push(ce.topN,Z.topP,pe.topP),v.push(Z.bottomP,ce.bottomN,pe.bottomP),ce=pe;else if(me&&Pe)if(se=this.buildBevelVert(N,O,le,0),pe=this.buildBevelVert(N,j,H,0),ke?(v.push(Z.topN,pe.topP,ce.topN),v.push(Z.topN,se.topP,pe.topP),v.push(pe.bottomP,Z.bottomN,ce.bottomN),v.push(pe.bottomP,se.bottomP,Z.bottomN)):(v.push(ce.topN,Z.topN,se.topP),v.push(ce.topN,se.topP,pe.topP),v.push(se.bottomP,Z.bottomN,ce.bottomN),v.push(se.bottomP,ce.bottomN,pe.bottomP)),Z=se,ce=pe,me===Pe)for(let L=1;L<me;L++)se=this.buildBevelVert(N,O,(le+L)%q,L/(me-1)),pe=this.buildBevelVert(N,j,(H+L)%J,L/(Pe-1)),v.push(Z.topN,se.topP,ce.topN),v.push(ce.topN,se.topP,pe.topP),v.push(se.bottomP,Z.bottomN,ce.bottomN),v.push(se.bottomP,ce.bottomN,pe.bottomP),Z=se,ce=pe;else if(me>Pe){let L=me/Pe,D=0;for(let re=1;re<me;re++)se=this.buildBevelVert(N,O,(le+re)%q,re/(me-1)),v.push(Z.topN,se.topP,ce.topN),v.push(se.bottomP,Z.bottomN,ce.bottomN),Z=se,re>(D+1)*L&&(D++,pe=this.buildBevelVert(N,j,(H+D)%J,D/(Pe-1)),v.push(ce.topN,se.topP,pe.topP),v.push(se.bottomP,ce.bottomN,pe.bottomP),ce=pe)}else{let L=Pe/me,D=0;for(let re=1;re<Pe;re++)pe=this.buildBevelVert(N,j,(H+re)%J,re/(Pe-1)),v.push(ce.topN,se.topP,pe.topP),v.push(se.bottomP,ce.bottomN,pe.bottomP),ce=pe,re>(D+1)*L&&(D++,se=this.buildBevelVert(N,O,(le+D)%q,D/(me-1)),v.push(Z.topN,se.topP,ce.topN),v.push(se.bottomP,Z.bottomN,ce.bottomN),Z=se)}le=(le+me)%q,H=(H+Pe)%J,ge=(ge+1)%W}while(ge!==he)}{let z=Q[0];for(let O=0,j=z.boundary.vertexCount;O<j;O++){let q=this.buildBevelVert(N,z,O),J=this.buildBevelVert(N,z,(O+1)%j);v.push(J.topP,q.topN,q.bottomN),v.push(J.topP,q.bottomN,J.bottomP)}}if(x){let z=[];for(let O=v.length-1;O>=F+2;O-=3){let j=v[O-2],q=v[O-1],J=v[O-0];z.push(J,q,j)}v.splice(F,v.length-F,...z)}if(x){let z=[];for(let O=Q[Q.length-1].boundary.vertices.length-1;O>=1;O-=2){let j=Q[Q.length-1].boundary.vertices[O-1],q=Q[Q.length-1].boundary.vertices[O-0];z.push(j,q)}y.push(z)}if(!x){let z=Q[Q.length-1],O=Xo({windingRule:Q.length>1?Zt.POSITIVE:Zt.ODD,elementType:Tr.POLYGONS,vertexSize:2,strict:!0,contours:[z.insetPoints,...y]});if(!O)throw new Error("Error generating geometry for surface");Object.assign(this,{capStartIndex:v.length});for(let j=0;j<O.elementCount*3;j+=3){let q=this.buildSurfaceVert(O,O.elements[j+0]),J=this.buildSurfaceVert(O,O.elements[j+1]),W=this.buildSurfaceVert(O,O.elements[j+2]);v.push(q.top,J.top,W.top),v.push(W.bottom,J.bottom,q.bottom)}}this.vertexCache={}}this._buffer.shrink();let w=new Ve(Uint32Array.from(v),1),b=new Ve(this._buffer.positions,3),S=new Ve(this._buffer.normals,3),T=new Ve(this._buffer.uvs,2);b.needsUpdate=!0,S.needsUpdate=!0,T.needsUpdate=!0,w.needsUpdate=!0,this.setAttribute("position",b),this.setAttribute("normal",S),this.setAttribute("uv",T),this.setIndex(w)}buildSurfaceVert(t,r){let n=r.toString();if(n in this.vertexCache)return this.vertexCache[n];let s=t.vertices[r*2+0],o=t.vertices[r*2+1],a=(s-this._minX)/this._width,l=(o-this._minY)/this._height,c=this._buffer.get(2),h=c*3,u=c*2,f={top:c+0,bottom:c+1};return this._buffer.positions[h+0]=s,this._buffer.positions[h+1]=o,this._buffer.positions[h+2]=this._depth,this._buffer.normals[h+0]=0,this._buffer.normals[h+1]=0,this._buffer.normals[h+2]=1,this._buffer.uvs[u+0]=a,this._buffer.uvs[u+1]=l,this._buffer.positions[h+3]=s,this._buffer.positions[h+4]=o,this._buffer.positions[h+5]=0,this._buffer.normals[h+3]=0,this._buffer.normals[h+4]=0,this._buffer.normals[h+5]=-1,this._buffer.uvs[u+2]=a,this._buffer.uvs[u+3]=l,this.vertexCache[n]=f,f}buildBevelVert(t,r,n,s=1){let o=`${r.bevelI}:${n}`;if(o in this.vertexCache)return this.vertexCache[o];let[a,l]=r.boundary.vertexIndices[n],c,h,u,f;a!==l?(h=a,c=l,f=!1,u=t.continuous[h]&&t.continuous[c]):(c=a,h=(c-1+t.count)%t.count,f=t.concave[c]&&r.bevelI>0,u=t.continuous[c]||f);let d=Math.cos(r.angle),p=Math.sin(r.angle),m=n*2,g=c*2,v=h*2,y=r.boundary.vertices[m+0],w=r.boundary.vertices[m+1],b=(1-p)*this._bevelSize,S=(y-this._minX)/this._width,T=(w-this._minY)/this._height,A=t.normals[g+0],x=t.normals[g+1],E=t.normals[v+0],_=t.normals[v+1];if(f){let k=E-A,G=_-x;A=A+k*(1-s),x=x+G*(1-s);let te=Math.sqrt(A*A+x*x);A/=te,x/=te}let C=this._buffer.get(u?2:4),I=C*3,N=C*2,R={i:n,fi:c,topP:C+0,topN:C+0,bottomP:C+1,bottomN:C+1};return this._buffer.positions[I+0]=y,this._buffer.positions[I+1]=w,this._buffer.positions[I+2]=this._depth-b,this._buffer.normals[I+0]=A*d,this._buffer.normals[I+1]=x*d,this._buffer.normals[I+2]=p,this._buffer.uvs[N+0]=S,this._buffer.uvs[N+1]=T,this._buffer.positions[I+3]=y,this._buffer.positions[I+4]=w,this._buffer.positions[I+5]=b,this._buffer.normals[I+3]=A*d,this._buffer.normals[I+4]=x*d,this._buffer.normals[I+5]=-p,this._buffer.uvs[N+2]=T,this._buffer.uvs[N+3]=S,u||(C+=2,I+=6,N+=4,R.topP=C+0,R.bottomP=C+1,this._buffer.positions[I+0]=y,this._buffer.positions[I+1]=w,this._buffer.positions[I+2]=this._depth-b,this._buffer.normals[I+0]=E*d,this._buffer.normals[I+1]=_*d,this._buffer.normals[I+2]=p,this._buffer.uvs[N+0]=S,this._buffer.uvs[N+1]=T,this._buffer.positions[I+3]=y,this._buffer.positions[I+4]=w,this._buffer.positions[I+5]=b,this._buffer.normals[I+3]=E*d,this._buffer.normals[I+4]=_*d,this._buffer.normals[I+5]=-p,this._buffer.uvs[N+2]=T,this._buffer.uvs[N+3]=S),this.vertexCache[o]=R,R}clone(){let t=new Rl(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return t.userData=Sh(this.userData),t}};var Hr=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var c,h,u,f,d,p,m;let t=Object.assign({},(c=e==null?void 0:e.parameters)!=null?c:{width:100,subdivisions:40,roundness:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),r=Math.abs(t.width),n=Math.abs((h=t.height)!=null?h:t.width),s=Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(u=t.depth)!=null?u:0),o=(f=i.shape)!=null?f:e==null?void 0:e.shape,a=(d=o==null?void 0:o.roundness)!=null?d:t.roundness;o!==void 0&&(o instanceof Tt?(o.width!==r||o.height!==n)&&o.applySize(r,n):o=new Tt(r,n).fromJSON(o),((p=i.parameters)==null?void 0:p.roundness)!==void 0&&((m=i.parameters)==null?void 0:m.roundness)>0&&o.update(!1));let l=o!=null?o:new Tt(r,n);return{parameters:Object.assign(t,{width:r,height:n,depth:s,extrudeDepth:s,roundness:a}),shape:l}}static build(i){let{extrudeDepth:e,extrudeBevelSize:t,extrudeBevelSegments:r,subdivisions:n,roundness:s}=i.parameters;i.shape.roundness=s;let o;return e<=0?o=new Il(i.shape,n):o=new Rl(i.shape,e,t,n,r),Object.assign(o,{userData:xe(ie({},i),{type:"VectorGeometry"})})}};var l1=Math.PI*2,c1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof Tt?i.shape:new Tt,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(o=t.depth)!=null?o:0)})}}static build(i){let{width:e,height:t,spikes:r,angle:n,innerRadius:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}=i.parameters,c=i.shape,h=e*.5,u=t*.5,f=tF(c,h,u,n*Math.PI/180,r,s);c.isClosed=!0,c.update();let d=Hr.create({shape:c,parameters:{subdivisions:f,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(d,{userData:xe(ie({},i),{type:"EllipseGeometry"})})}};function tF(i,e,t,r,n,s){if(r>=l1)return n>30||n%4===0?(nF(i,e,t,s),Math.round(n/4)):a1(i,r,n,e,t,s);let o={x:0,y:t},a=r+Math.PI*.5,l={x:Math.cos(a)*e,y:Math.sin(a)*t},c=r1({px:o.x,py:o.y,cx:l.x,cy:l.y,rx:e,ry:t,largeArcFlag:r>Math.PI,sweepFlag:!0});return n>30||n%c.length===0?rF(i,o.x,o.y,c,n,e,t,s):a1(i,r,n,e,t,s)}function rF(i,e,t,r,n,s,o,a){let l=Math.round(n/r.length);i.addPoint(Bl(e,t));for(let c=0,h=r.length;c<h;c++){let u=r[c],f=i.points[c],d=Bl(u.x,u.y);f.controls[1].position.set(u.x1,u.y1),d.controls[0].position.set(u.x2,u.y2),i.addPoint(d)}return a>0?h1(i,s,o,a):i.addPoint(Bl(0,0)),l}function a1(i,e,t,r,n,s){let o=-e/t;for(let a=0;a<=t;a++){let l=o*a,c=Math.sin(l)*r,h=Math.cos(l)*n;i.addPoint(Bl(c,h))}return e<l1?s>0?h1(i,r,n,s):i.addPoint(Bl(0,0)):(i.removePoint(i.points[i.points.length-1]),s>0&&u1(i,r,n,s)),1}function nF(i,e,t,r=0,n=0,s=0){let o=.5522847498,a=e*o,l=t*o;i.addPoint(dp(n-e,s,n-e,s-l,n-e,s+l)),i.addPoint(dp(n,s+t,n-a,s+t,n+a,s+t)),i.addPoint(dp(n+e,s,n+e,s+l,n+e,s-l)),i.addPoint(dp(n,s-t,n+a,s-t,n-a,s-t)),r>0&&u1(i,e,t,r)}function Bl(i,e){return new ui(et.generateUUID(),new B(i,e))}function dp(i,e,t,r,n,s){let o=Bl(i,e);return o.controls[0].position.set(t,r),o.controls[1].position.set(n,s),o}function h1(i,e,t,r){f1(i,e,t,r).forEach(s=>i.addPoint(s))}function u1(i,e,t,r){let n=f1(i,e,t,r),s=new Tt;n.forEach(o=>s.addPoint(o)),s.isClosed=!0,i.shapeHoles.push(s)}function f1(i,e,t,r){let n=r*e/100,s=n*(Math.abs(t)/Math.abs(e)),o=new B(n/e,s/t),a=i.points.map(l=>{let c=l.clone();return c.uuid=et.generateUUID(),c}).reverse();return a.forEach(l=>{l.position.multiply(o);let c=l.controls[0].position.clone().multiply(o),h=l.controls[1].position.clone().multiply(o);l.controls[0].position.copy(h),l.controls[1].position.copy(c)}),a}var d1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var a,l,c;let t=Object.assign({},(a=e==null?void 0:e.parameters)!=null?a:{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},i.parameters),r=Math.abs(t.width),n=Math.abs((l=t.height)!=null?l:r),s=Math.abs((c=t.depth)!=null?c:r),o=Math.abs(Math.min(r,s))/2;return{parameters:Object.assign(t,{width:r,height:n,depth:s,radius:o,segments:Math.round(t.segments),pathSegments:Math.round(t.pathSegments),cornerSegments:Math.round(t.cornerSegments)})}}static build(i){let{width:e,height:t,depth:r,radius:n,revolutions:s,segments:o,pathRadius:a,pathType:l,pathSegments:c,cornerRadius:h,cornerSegments:u}=i.parameters,f=new jh(!1,e,t,r,n,s,o,a,l,c,h,u);return Object.assign(f,{userData:xe(ie({},i),{type:"HelixGeometry"})})}},jh=class extends Le{constructor(e=!0,t=1,r=1,n=1,s=1,o=1,a=1,l=1,c=1,h=1,u=1,f=1){super();let d=e&&o===1;d&&(f=0),u>100&&(u=100);let p=()=>new M,m=new M,g=p(),v=p(),y=p(),w,b,S,T,A,x,E,_,C=p(),I=p(),N=p(),R=p(),k=p(),G=p(),te=p(),Q=p(),Y=r-2*l+.001,F=Y/o,z=Math.ceil(a*o),O=z+1,j=Y/z,q=-Y/2,J=h+1,W=2*Math.PI/h,ge=Math.PI/2/f,oe=.01,le=Math.min((1-u/100)*l,l-oe),H=l-le,he=0,K=2,V=f*K+K,Z=J*V/K,ce=Z+J*O,se=J*(O+V),[pe,ve,me]=[3,3,2].map(Ee=>Array(se*Ee).fill(0)),Pe=[],ke=s-l;function L(Ee,U){let Me=Math.PI/2;x=U*j,_=2*Math.PI*(x%F)/F+Me,x+=q,E=Math.sin(_)*ke,A=Math.cos(_)*ke,e?Ee.set(A,E,x):Ee.set(A,x,E)}L(m,-1e-10),L(g,0),C.copy(m),L(m,1);let D=m.distanceTo(g),re=H+le,ye=D*z+2*re,Se=le,Ie=ye-re;for(let Ee=0;Ee<=z;Ee++){L(v,Ee),Q.subVectors(v,C).normalize(),C.copy(v),G.copy(v).setComponent(+e+1,0).normalize(),te.crossVectors(Q,G).normalize();let U=Ee===0,Me=Ee===z,De=U?3*Math.PI/2:ge,Ze=U?Se:Ie,Oe=U?J:ce,Qe=U?0:se-J,Te=Q.clone().multiplyScalar(U?-H:H).add(v),$e=Q.clone().multiplyScalar(U?-1:1).normalize();for(let lt=0;lt<J;lt++){let dt=lt*W;if(I.addVectors(m.copy(G).multiplyScalar(l*Math.cos(dt)),g.copy(te).multiplyScalar(l*Math.sin(dt))),N.copy(I).normalize(),U||Me){d||(he=Qe+lt,[0,1,2].forEach(Ut=>{pe[he*3+Ut]=Te.getComponent(Ut),ve[he*3+Ut]=$e.getComponent(Ut)}),me[he*2]=+Me,me[he*2+1]=lt/h),g.copy(N).multiplyScalar(le),y.addVectors(v,g);for(let Ut=0;Ut<f;Ut++){let Ur=Ut*ge+De;R.addVectors(m.copy(Q).multiplyScalar(H*Math.sin(Ur)),g.copy(N).multiplyScalar(H*Math.cos(Ur))),k.copy(R).normalize(),g.addVectors(y,R),R.normalize(),he=Oe+Ut*J+lt,[0,1,2].forEach(Nn=>{pe[he*3+Nn]=g.getComponent(Nn),ve[he*3+Nn]=k.getComponent(Nn)});let ia=+U+Math.sin(Ur);me[he*2]=(Ze+H*ia)/ye,me[he*2+1]=lt/h}}g.addVectors(v,I),he=Z+Ee*J+lt,[0,1,2].forEach(Ut=>{pe[he*3+Ut]=g.getComponent(Ut),ve[he*3+Ut]=N.getComponent(Ut)}),me[he*2]=(re+Ee*D)/ye,me[he*2+1]=lt/h}}let Fe=O+2*f+K,ue=1,[rt,st]=d?[ue,ue+O-1]:[0,Fe-1];for(let Ee=rt;Ee<=st-1;Ee++){let U=d&&Ee===st-1;for(let Me=0;Me<J-1;Me++)w=Ee*J+Me,b=w+1,S=(U?Me:w)+J,T=(U?Me+1:b)+J,Ee===0?Pe.push(b,T,S):Ee===Fe-2?Pe.push(w,b,S):Pe.push(w,b,S,b,T,S)}this.setIndex(Pe),this.setAttribute("position",new Ce(pe,3)),this.setAttribute("normal",new Ce(ve,3)),this.setAttribute("uv",new Ce(me,2))}};var p1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:o}=i.parameters,a=n===0&&s!==0?new qh(e*.5,s,o):new Va(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:xe(ie({},i),{type:"IcosahedronGeometry"})})}},qh=class extends oo{constructor(e=1,t=.2,r=4){let n=(1+Math.sqrt(5))/2,s=[-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],o=[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],a="IcosahedronGeometry";super(s,o,a,e,t,r),this.type=a}static fromJSON(e){return new qh(e.radius,e.corner,e.cornerSides)}};var m1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s,o,a;((n=(r=i.parameters)==null?void 0:r.points)!=null?n:[]).forEach(l=>{Array.isArray(l)&&(l.x=l[0],l.y=l[1])});let t=Object.assign({},(s=e==null?void 0:e.parameters)!=null?s:{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs((a=t.depth)!=null?a:t.width)})}}static build(i){let{points:e,segments:t,verticalSegments:r}=i.parameters,n=new rn;n.moveTo(e[0].x,e[0].y),n.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let s=new Ua(n.extractPoints(r).shape,t);return s.rotateZ(Math.PI),Object.assign(s,{userData:xe(ie({},i),{type:"LatheGeometry"})})}};var Oi=new Ae,lv=new ot,pp=new M,lo=class extends Yt{constructor(){super(),this.uuid=et.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}applyMatrix4(e){let t=new Ft().getNormalMatrix(e);for(let r=0,n=this.vertices.length;r<n;r++)this.vertices[r].applyMatrix4(e);for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r];s.normal.applyMatrix3(t).normalize();for(let o=0,a=s.vertexNormals.length;o<a;o++)s.vertexNormals[o].applyMatrix3(t).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this}rotateX(e){return Oi.makeRotationX(e),this.applyMatrix4(Oi),this}rotateY(e){return Oi.makeRotationY(e),this.applyMatrix4(Oi),this}rotateZ(e){return Oi.makeRotationZ(e),this.applyMatrix4(Oi),this}translate(e,t,r){return Oi.makeTranslation(e,t,r),this.applyMatrix4(Oi),this}scale(e,t,r){return Oi.makeScale(e,t,r),this.applyMatrix4(Oi),this}lookAt(e){return lv.lookAt(e),lv.updateMatrix(),this.applyMatrix4(lv.matrix),this}fromBufferGeometry(e){let t=this,r=e.index!==null?e.index:void 0,n=e.attributes;if(n.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;let s=n.position,o=n.normal,a=n.color,l=n.uv,c=n.uv2;c!==void 0&&(this.faceVertexUvs[1]=[]);for(let f=0;f<s.count;f++)t.vertices.push(new M().fromBufferAttribute(s,f)),a!==void 0&&t.colors.push(new be().fromBufferAttribute(a,f));function h(f,d,p,m){let g=a===void 0?[]:[t.colors[f].clone(),t.colors[d].clone(),t.colors[p].clone()],v=o===void 0?[]:[new M().fromBufferAttribute(o,f),new M().fromBufferAttribute(o,d),new M().fromBufferAttribute(o,p)],y=new Nl(f,d,p,v,g,m);t.faces.push(y),l!==void 0&&t.faceVertexUvs[0].push([new B().fromBufferAttribute(l,f),new B().fromBufferAttribute(l,d),new B().fromBufferAttribute(l,p)]),c!==void 0&&t.faceVertexUvs[1].push([new B().fromBufferAttribute(c,f),new B().fromBufferAttribute(c,d),new B().fromBufferAttribute(c,p)])}let u=e.groups;if(u.length>0)for(let f=0;f<u.length;f++){let d=u[f],p=d.start,m=d.count;for(let g=p,v=p+m;g<v;g+=3)r!==void 0?h(r.getX(g),r.getX(g+1),r.getX(g+2),d.materialIndex):h(g,g+1,g+2,d.materialIndex)}else if(r!==void 0)for(let f=0;f<r.count;f+=3)h(r.getX(f),r.getX(f+1),r.getX(f+2));else for(let f=0;f<s.count;f+=3)h(f,f+1,f+2);return this.computeFaceNormals(),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(pp).negate(),this.translate(pp.x,pp.y,pp.z),this}normalize(){this.computeBoundingSphere();let e=this.boundingSphere.center,t=this.boundingSphere.radius,r=t===0?1:1/t,n=new Ae;return n.set(r,0,0,-r*e.x,0,r,0,-r*e.y,0,0,r,-r*e.z,0,0,0,1),this.applyMatrix4(n),this}computeFaceNormals(){let e=new M,t=new M;for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],o=this.vertices[s.a],a=this.vertices[s.b],l=this.vertices[s.c];e.subVectors(l,a),t.subVectors(o,a),e.cross(t),e.normalize(),s.normal.copy(e)}}computeVertexNormals(e=!0){let t=new Array(this.vertices.length);for(let r=0,n=this.vertices.length;r<n;r++)t[r]=new M;if(e){let r=new M,n=new M;for(let s=0,o=this.faces.length;s<o;s++){let a=this.faces[s],l=this.vertices[a.a],c=this.vertices[a.b],h=this.vertices[a.c];r.subVectors(h,c),n.subVectors(l,c),r.cross(n),t[a.a].add(r),t[a.b].add(r),t[a.c].add(r)}}else{this.computeFaceNormals();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r];t[s.a].add(s.normal),t[s.b].add(s.normal),t[s.c].add(s.normal)}}for(let r=0,n=this.vertices.length;r<n;r++)t[r].normalize();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],o=s.vertexNormals;o.length===3?(o[0].copy(t[s.a]),o[1].copy(t[s.b]),o[2].copy(t[s.c])):(o[0]=t[s.a].clone(),o[1]=t[s.b].clone(),o[2]=t[s.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let r=this.faces[e],n=r.vertexNormals;n.length===3?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let t=0,r=this.faces.length;t<r;t++){let n=this.faces[t];n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]);for(let s=0,o=n.vertexNormals.length;s<o;s++)n.__originalVertexNormals[s]?n.__originalVertexNormals[s].copy(n.vertexNormals[s]):n.__originalVertexNormals[s]=n.vertexNormals[s].clone()}let e=new lo;e.faces=this.faces;for(let t=0,r=this.morphTargets.length;t<r;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];let s=this.morphNormals[t].faceNormals,o=this.morphNormals[t].vertexNormals;for(let a=0,l=this.faces.length;a<l;a++){let c=new M,h={a:new M,b:new M,c:new M};s.push(c),o.push(h)}}let n=this.morphNormals[t];e.vertices=this.morphTargets[t].vertices,e.computeFaceNormals(),e.computeVertexNormals();for(let s=0,o=this.faces.length;s<o;s++){let a=this.faces[s],l=n.faceNormals[s],c=n.vertexNormals[s];l.copy(a.normal),c.a.copy(a.vertexNormals[0]),c.b.copy(a.vertexNormals[1]),c.c.copy(a.vertexNormals[2])}}for(let t=0,r=this.faces.length;t<r;t++){let n=this.faces[t];n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals}}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Kt),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Lr),this.boundingSphere.setFromPoints(this.vertices)}merge(e,t,r=0){if(!(e&&e.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);return}let n,s=this.vertices.length,o=this.vertices,a=e.vertices,l=this.faces,c=e.faces,h=this.colors,u=e.colors;t!==void 0&&(n=new Ft().getNormalMatrix(t));for(let f=0,d=a.length;f<d;f++){let m=a[f].clone();t!==void 0&&m.applyMatrix4(t),o.push(m)}for(let f=0,d=u.length;f<d;f++)h.push(u[f].clone());for(let f=0,d=c.length;f<d;f++){let p=c[f],m,g,v=p.vertexNormals,y=p.vertexColors,w=new Nl(p.a+s,p.b+s,p.c+s);w.normal.copy(p.normal),n!==void 0&&w.normal.applyMatrix3(n).normalize();for(let b=0,S=v.length;b<S;b++)m=v[b].clone(),n!==void 0&&m.applyMatrix3(n).normalize(),w.vertexNormals.push(m);w.color.copy(p.color);for(let b=0,S=y.length;b<S;b++)g=y[b],w.vertexColors.push(g.clone());w.materialIndex=p.materialIndex+r,l.push(w)}for(let f=0,d=e.faceVertexUvs.length;f<d;f++){let p=e.faceVertexUvs[f];this.faceVertexUvs[f]===void 0&&(this.faceVertexUvs[f]=[]);for(let m=0,g=p.length;m<g;m++){let v=p[m],y=[];for(let w=0,b=v.length;w<b;w++)y.push(v[w].clone());this.faceVertexUvs[f].push(y)}}}mergeMesh(e){if(!(e&&e.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)}mergeVertices(e=4){let t={},r=[],n=[],s=Math.pow(10,e);for(let l=0,c=this.vertices.length;l<c;l++){let h=this.vertices[l],u=Math.round(h.x*s)+"_"+Math.round(h.y*s)+"_"+Math.round(h.z*s);t[u]===void 0?(t[u]=l,r.push(this.vertices[l]),n[l]=r.length-1):n[l]=n[t[u]]}let o=[];for(let l=0,c=this.faces.length;l<c;l++){let h=this.faces[l];h.a=n[h.a],h.b=n[h.b],h.c=n[h.c];let u=[h.a,h.b,h.c];for(let f=0;f<3;f++)if(u[f]===u[(f+1)%3]){o.push(l);break}}for(let l=o.length-1;l>=0;l--){let c=o[l];this.faces.splice(c,1);for(let h=0,u=this.faceVertexUvs.length;h<u;h++)this.faceVertexUvs[h].splice(c,1)}let a=this.vertices.length-r.length;return this.vertices=r,a}setFromPoints(e){this.vertices=[];for(let t=0,r=e.length;t<r;t++){let n=e[t];this.vertices.push(new M(n.x,n.y,n.z||0))}return this}sortFacesByMaterialIndex(){let e=this.faces,t=e.length;for(let l=0;l<t;l++)e[l]._id=l;function r(l,c){return l.materialIndex-c.materialIndex}e.sort(r);let n=this.faceVertexUvs[0],s=this.faceVertexUvs[1],o,a;n&&n.length===t&&(o=[]),s&&s.length===t&&(a=[]);for(let l=0;l<t;l++){let c=e[l]._id;o&&o.push(n[c]),a&&a.push(s[c])}o&&(this.faceVertexUvs[0]=o),a&&(this.faceVertexUvs[1]=a)}toJSON(){let e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),this.parameters!==void 0){let p=this.parameters;for(let m in p)p[m]!==void 0&&(e[m]=p[m]);return e}let t=[];for(let p=0;p<this.vertices.length;p++){let m=this.vertices[p];t.push(m.x,m.y,m.z)}let r=[],n=[],s={},o=[],a={},l=[],c={};for(let p=0;p<this.faces.length;p++){let m=this.faces[p],g=!0,v=!1,y=this.faceVertexUvs[0][p]!==void 0,w=m.normal.length()>0,b=m.vertexNormals.length>0,S=m.color.r!==1||m.color.g!==1||m.color.b!==1,T=m.vertexColors.length>0,A=0;if(A=h(A,0,0),A=h(A,1,g),A=h(A,2,v),A=h(A,3,y),A=h(A,4,w),A=h(A,5,b),A=h(A,6,S),A=h(A,7,T),r.push(A),r.push(m.a,m.b,m.c),r.push(m.materialIndex),y){let x=this.faceVertexUvs[0][p];r.push(d(x[0]),d(x[1]),d(x[2]))}if(w&&r.push(u(m.normal)),b){let x=m.vertexNormals;r.push(u(x[0]),u(x[1]),u(x[2]))}if(S&&r.push(f(m.color)),T){let x=m.vertexColors;r.push(f(x[0]),f(x[1]),f(x[2]))}}function h(p,m,g){return g?p|1<<m:p&~(1<<m)}function u(p){let m=p.x.toString()+p.y.toString()+p.z.toString();return s[m]!==void 0||(s[m]=n.length/3,n.push(p.x,p.y,p.z)),s[m]}function f(p){let m=p.r.toString()+p.g.toString()+p.b.toString();return a[m]!==void 0||(a[m]=o.length,o.push(p.getHex())),a[m]}function d(p){let m=p.x.toString()+p.y.toString();return c[m]!==void 0||(c[m]=l.length/2,l.push(p.x,p.y)),c[m]}return e.data={},e.data.vertices=t,e.data.normals=n,o.length>0&&(e.data.colors=o),l.length>0&&(e.data.uvs=[l]),e.data.faces=r,e}clone(){return new lo().copy(this)}copy(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;let t=e.vertices;for(let f=0,d=t.length;f<d;f++)this.vertices.push(t[f].clone());let r=e.colors;for(let f=0,d=r.length;f<d;f++)this.colors.push(r[f].clone());let n=e.faces;for(let f=0,d=n.length;f<d;f++)this.faces.push(n[f].clone());for(let f=0,d=e.faceVertexUvs.length;f<d;f++){let p=e.faceVertexUvs[f];this.faceVertexUvs[f]===void 0&&(this.faceVertexUvs[f]=[]);for(let m=0,g=p.length;m<g;m++){let v=p[m],y=[];for(let w=0,b=v.length;w<b;w++){let S=v[w];y.push(S.clone())}this.faceVertexUvs[f].push(y)}}let s=e.morphTargets;for(let f=0,d=s.length;f<d;f++){let p={};if(p.name=s[f].name,s[f].vertices!==void 0){p.vertices=[];for(let m=0,g=s[f].vertices.length;m<g;m++)p.vertices.push(s[f].vertices[m].clone())}if(s[f].normals!==void 0){p.normals=[];for(let m=0,g=s[f].normals.length;m<g;m++)p.normals.push(s[f].normals[m].clone())}this.morphTargets.push(p)}let o=e.morphNormals;for(let f=0,d=o.length;f<d;f++){let p={};if(o[f].vertexNormals!==void 0){p.vertexNormals=[];for(let m=0,g=o[f].vertexNormals.length;m<g;m++){let v=o[f].vertexNormals[m],y={};y.a=v.a.clone(),y.b=v.b.clone(),y.c=v.c.clone(),p.vertexNormals.push(y)}}if(o[f].faceNormals!==void 0){p.faceNormals=[];for(let m=0,g=o[f].faceNormals.length;m<g;m++)p.faceNormals.push(o[f].faceNormals[m].clone())}this.morphNormals.push(p)}let a=e.skinWeights;for(let f=0,d=a.length;f<d;f++)this.skinWeights.push(a[f].clone());let l=e.skinIndices;for(let f=0,d=l.length;f<d;f++)this.skinIndices.push(l[f].clone());let c=e.lineDistances;for(let f=0,d=c.length;f<d;f++)this.lineDistances.push(c[f]);let h=e.boundingBox;h!==null&&(this.boundingBox=h.clone());let u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this}toBufferGeometry(){let e=new cv().fromGeometry(this),t=new Le,r=new Float32Array(e.vertices.length*3);if(t.setAttribute("position",new Ve(r,3).copyVector3sArray(e.vertices)),e.normals.length>0){let n=new Float32Array(e.normals.length*3);t.setAttribute("normal",new Ve(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){let n=new Float32Array(e.colors.length*3);t.setAttribute("color",new Ve(n,3).copyColorsArray(e.colors))}if(e.uvs.length>0){let n=new Float32Array(e.uvs.length*2);t.setAttribute("uv",new Ve(n,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){let n=new Float32Array(e.uvs2.length*2);t.setAttribute("uv2",new Ve(n,2).copyVector2sArray(e.uvs2))}t.groups=e.groups;for(let n in e.morphTargets){let s=[],o=e.morphTargets[n];for(let a=0,l=o.length;a<l;a++){let c=o[a],h=new Ce(c.data.length*3,3);h.name=c.name,s.push(h.copyVector3sArray(c.data))}t.morphAttributes[n]=s}if(e.skinIndices.length>0){let n=new Ce(e.skinIndices.length*4,4);t.setAttribute("skinIndex",n.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){let n=new Ce(e.skinWeights.length*4,4);t.setAttribute("skinWeight",n.copyVector4sArray(e.skinWeights))}return e.boundingSphere!==null&&(t.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(t.boundingBox=e.boundingBox.clone()),t}computeTangents(){console.error("THREE.Geometry: .computeTangents() has been removed.")}computeLineDistances(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}applyMatrix(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}dispose(){this.dispatchEvent({type:"dispose"})}static createBufferGeometryFromObject(e){let t=new Le,r=e.geometry;if(e.isPoints||e.isLine){let n=new Ce(r.vertices.length*3,3),s=new Ce(r.colors.length*3,3);if(t.setAttribute("position",n.copyVector3sArray(r.vertices)),t.setAttribute("color",s.copyColorsArray(r.colors)),r.lineDistances&&r.lineDistances.length===r.vertices.length){let o=new Ce(r.lineDistances.length,1);t.setAttribute("lineDistance",o.copyArray(r.lineDistances))}r.boundingSphere!==null&&(t.boundingSphere=r.boundingSphere.clone()),r.boundingBox!==null&&(t.boundingBox=r.boundingBox.clone())}else e.isMesh&&(t=r.toBufferGeometry());return t}};lo.prototype.isGeometry=!0;var cv=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){let t=[],r,n,s,o=e.faces;for(n=0;n<o.length;n++){let a=o[n];a.materialIndex!==s&&(s=a.materialIndex,r!==void 0&&(r.count=n*3-r.start,t.push(r)),r={start:n*3,materialIndex:s})}r!==void 0&&(r.count=n*3-r.start,t.push(r)),this.groups=t}fromGeometry(e){let t=e.faces,r=e.vertices,n=e.faceVertexUvs,s=n[0]&&n[0].length>0,o=n[1]&&n[1].length>0,a=e.morphTargets,l=a.length,c;if(l>0){c=[];for(let v=0;v<l;v++)c[v]={name:a[v].name,data:[]};this.morphTargets.position=c}let h=e.morphNormals,u=h.length,f;if(u>0){f=[];for(let v=0;v<u;v++)f[v]={name:h[v].name,data:[]};this.morphTargets.normal=f}let d=e.skinIndices,p=e.skinWeights,m=d.length===r.length,g=p.length===r.length;r.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let v=0;v<t.length;v++){let y=t[v];this.vertices.push(r[y.a],r[y.b],r[y.c]);let w=y.vertexNormals;if(w.length===3)this.normals.push(w[0],w[1],w[2]);else{let S=y.normal;this.normals.push(S,S,S)}let b=y.vertexColors;if(b.length===3)this.colors.push(b[0],b[1],b[2]);else{let S=y.color;this.colors.push(S,S,S)}if(s===!0){let S=n[0][v];S!==void 0?this.uvs.push(S[0],S[1],S[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",v),this.uvs.push(new B,new B,new B))}if(o===!0){let S=n[1][v];S!==void 0?this.uvs2.push(S[0],S[1],S[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",v),this.uvs2.push(new B,new B,new B))}for(let S=0;S<l;S++){let T=a[S].vertices;c[S].data.push(T[y.a],T[y.b],T[y.c])}for(let S=0;S<u;S++){let T=h[S].vertexNormals[v];f[S].data.push(T.a,T.b,T.c)}m&&this.skinIndices.push(d[y.a],d[y.b],d[y.c]),g&&this.skinWeights.push(p[y.a],p[y.b],p[y.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}},Nl=class{constructor(e,t,r,n,s,o=0){this.a=e,this.b=t,this.c=r,this.normal=n&&n.isVector3?n:new M,this.vertexNormals=Array.isArray(n)?n:[],this.color=s&&s.isColor?s:new be,this.vertexColors=Array.isArray(s)?s:[],this.materialIndex=o}clone(){return new this.constructor().copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,r=e.vertexNormals.length;t<r;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,r=e.vertexColors.length;t<r;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}};var iF=["a","b","c"];function sF(i,e){switch(e){case"c":return i.c;case"b":return i.b;case"a":default:return i.a}}function hv(i,e,t){let r=Math.min(i,e),n=Math.max(i,e),s=r+"_"+n;return t.get(s)}function uv(i,e,t,r,n,s){let o=Math.min(i,e),a=Math.max(i,e),l=o+"_"+a,c;if(r.has(l))c=r.get(l);else{let h=t[o],u=t[a];c={a:h,b:u,newEdge:null,faces:[]},r.set(l,c)}c.faces.push(n),s[i].edges.push(c),s[e].edges.push(c)}function oF(i,e,t,r){let n,s,o;for(n=0,s=i.length;n<s;n++)t[n]={edges:[]};for(n=0,s=e.length;n<s;n++)o=e[n],uv(o.a,o.b,i,r,o,t),uv(o.b,o.c,i,r,o,t),uv(o.c,o.a,i,r,o,t)}function mp(i,e,t,r,n){i.push(new Nl(e,t,r,void 0,void 0,n))}function Ol(i,e){return Math.abs(e-i)/2+Math.min(i,e)}function gp(i,e,t,r){i.push([e.clone(),t.clone(),r.clone()])}var yp=class{constructor(e=1){this.subdivisions=e}modify(e){e instanceof Le?e=new lo().fromBufferGeometry(e):e=e.clone(),e.mergeVertices();let t=this.subdivisions;for(;t-- >0;)this._smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e}_smooth(e){let t=new M,r,n,s,o,a,l=e.vertices,c=e.faces,h=e.faceVertexUvs[0],u=h!==void 0&&h.length>0,f=[],d=new Map;oF(l,c,f,d);let p=[],m,g,v,y,w,b,S;for(let oe of Array.from(d.keys())){for(g=d.get(oe),v=new M,w=3/8,b=1/8,S=g.faces.length,S!=2&&(w=.5,b=0,S!=1),v.addVectors(g.a,g.b).multiplyScalar(w),t.set(0,0,0),o=0;o<S;o++){for(y=g.faces[o],a=0;a<3&&(m=l[sF(y,iF[a])],!(m!==g.a&&m!==g.b));a++);m&&t.add(m)}t.multiplyScalar(b),v.add(t),g.newEdge=p.length,p.push(v)}let T,A,x,E,_,C,I,N=[];for(n=0,s=l.length;n<s;n++){for(C=l[n],_=f[n].edges,r=_.length,r==3?T=3/16:r>3&&(T=3/(8*r)),A=1-r*Number(T),x=T,r<=2&&(r==2?(A=3/4,x=1/8):r==1||r==0),I=C.clone().multiplyScalar(A),t.set(0,0,0),o=0;o<r;o++)E=_[o],m=E.a!==C?E.a:E.b,t.add(m);t.multiplyScalar(Number(x)),I.add(t),N.push(I)}let R=N.concat(p),k=N.length,G,te,Q,Y=[],F=[],z,O,j,q,J=new B,W=new B,ge=new B;for(n=0,s=c.length;n<s;n++)y=c[n],G=Number(hv(y.a,y.b,d).newEdge)+k,te=Number(hv(y.b,y.c,d).newEdge)+k,Q=Number(hv(y.c,y.a,d).newEdge)+k,mp(Y,G,te,Q,y.materialIndex),mp(Y,y.a,G,Q,y.materialIndex),mp(Y,y.b,te,G,y.materialIndex),mp(Y,y.c,Q,te,y.materialIndex),u&&(z=h[n],O=z[0],j=z[1],q=z[2],J.set(Ol(O.x,j.x),Ol(O.y,j.y)),W.set(Ol(j.x,q.x),Ol(j.y,q.y)),ge.set(Ol(O.x,q.x),Ol(O.y,q.y)),gp(F,J,W,ge),gp(F,O,J,ge),gp(F,j,W,J),gp(F,q,ge,W));e.vertices=R,e.faces=Y,u&&(e.faceVertexUvs[0]=F)}};var Er=new M,g1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var s,o;let t=(o=(s=i.geometry)!=null?s:e==null?void 0:e.geometry)!=null?o:new Le().copy(new vn(100,100,100)),r;e===void 0?(t.computeBoundingBox(),t.boundingBox.getSize(Er),r={width:Er.x,height:Er.y,depth:Er.z,subdivisions:0}):r=e.parameters;let n=ie(ie({},r),i.parameters);return{parameters:{width:Math.abs(n.width),height:Math.abs(n.height),depth:Math.abs(n.depth),subdivisions:Math.abs(n.subdivisions)},geometry:t}}static build(i){var l;let{width:e,height:t,depth:r,subdivisions:n}=i.parameters,s=(l=i.geometry)!=null?l:new Le().copy(new vn(100,100,100)),o=s.userData.parameters;o===void 0?(s.computeBoundingBox(),s.boundingBox.getSize(Er)):Er.set(o.width,o.height,o.depth),(e!==Er.x||t!==Er.y||r!==Er.z)&&s.scale(Er.x===0?1:e/Er.x,Er.y===0?1:t/Er.y,Er.z===0?1:r/Er.z);let a=s.originalGeometry;return n>0?(a===void 0||(o==null?void 0:o.subdivisions)!==n)&&(a===void 0&&(a=s),s=new yp(n).modify(a).toBufferGeometry()):(a!==void 0&&(s=a),a=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()),a!==void 0&&Object.assign(s,{originalGeometry:a}),delete i.geometry,Object.assign(s,{userData:xe(ie({},i),{type:"NonParametricGeometry"})})}static loadFromUrl(i,e,t){new Ws(t).load(i,n=>{let s=this.normalizeInputs({geometry:n});n.boundingBox.getSize(Er);let o=100/Er.x;Object.assign(s.parameters,{width:100,height:Er.y*o,depth:Er.z*o}),e(this.build(s))})}};var y1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters);return{shape:i.shape&&i.shape instanceof Tt?i.shape:new Tt,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(o=t.depth)!=null?o:0)})}}static build(i){let{width:e,height:t,spikes:r,cornerRadius:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}=i.parameters,l=i.shape,c=e*.5,h=t*.5,u=0,f=0,d=2*Math.PI/r;for(let m=0;m<r;m++){let g=d*m,v=u+Math.sin(g)*c,y=f+Math.cos(g)*h;l.addPoint(l.createPoint(v,y))}l.isClosed=!0;for(let m=0,g=l.points.length;m<g;m++)l.points[m].roundness=n;l.roundness=n,l.update();let p=Hr.create({shape:l,parameters:{roundness:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}});return Object.assign(p,{userData:xe(ie({},i),{type:"PolygonGeometry"})})}};var v1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,radialSegments:n,heightSegments:s,openEnded:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=new dv(e*.5,t,n,s,o,a,l);return c.scale(1,1,r/e),Object.assign(c,{userData:xe(ie({},i),{type:"PyramidGeometry"})})}};function Yh(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function fv(i,e,t,r,n,s){let o=e.clone().sub(i),a=t.clone().sub(i),l=o.angleTo(a);if(o.normalize(),a.normalize(),r===n){let c=o.add(a).normalize();s.copy(i).addScaledVector(c,r/Math.sin(l/2))}else{let c=o.angleTo(a);s.copy(i),s.addScaledVector(o,n/Math.sin(c)),s.addScaledVector(a,r/Math.sin(c))}}function aF(i,e,t){let r=i.clone().sub(e),n=t.clone().sub(e);return r.projectOnVector(n),r.add(e)}var dv=class extends Le{constructor(e=.5,t=1,r=4,n=1,s=!1,o=0,a=4){super(),r=Math.floor(Math.max(3,r)),n=Math.floor(n),a=Math.floor(a);let l=[],c=[],h=[],u=[],f=0,d=t/2,p=Math.PI/r,m=e*Math.cos(Math.PI/r),g=2*Math.PI/r,v=(r-2)*Math.PI/r,y=Math.PI-v,w=new M(0,-d,0),b=new M(0,d,0),S=new B(e,-d),T=new B(m,-d),A=new B(0,b.y).sub(T),x=new B(0,b.y).sub(S),E=new B(A.y,-A.x).normalize(),_=new B(x.y,-x.x).normalize(),I=e*Math.cos(Math.PI/r)*Math.tan((Math.PI-A.angle())/2)-1e-8;o=Math.min(o,I);let N;{let F=new M(E.x,E.y,0),z=new M(Math.cos(g)*F.x,F.y,Math.sin(g)*F.x);N=F.angleTo(z)}let R=o/Math.tan((Math.PI-A.angle())/2),k=o/Math.tan((Math.PI-N)/2),G=new M;if(!s){c.push(w.x,w.y,w.z),h.push(0,-1,0),u.push(0,0);let F=f++,z=[],O=S.clone(),j=R/Math.cos(Math.PI/r);O.x-=j;for(let q=0;q<r;q++){let J=q/r*Math.PI*2+p,W=new B(Math.sin(J),Math.cos(J));Yh(O,W,G),c.push(G.x,G.y,G.z),h.push(0,-1,0),u.push(0,0),z.push(f++)}for(let q=0;q<z.length;q++)l.push(z[q],F,z[(q+1)%z.length])}let te=[];{let F=new M,z=new M,O=new M,j=new M,q=new M,J=new M;for(let W=0;W<r;W++){let ge=W/r*Math.PI*2+p,oe=(W+.5)/r*Math.PI*2+p,le=(W+1)/r*Math.PI*2+p,H=new B(Math.sin(ge),Math.cos(ge)),he=new B(Math.sin(oe),Math.cos(oe)),K=new B(Math.sin(le),Math.cos(le));Yh(S,H,z),Yh(S,K,O),Yh(E,he,F),fv(b,z,O,k,k,j),c.push(j.x,j.y,j.z),fv(z,b,O,k,R,q),c.push(q.x,q.y,q.z),fv(O,z,b,R,k,J),c.push(J.x,J.y,J.z),h.push(F.x,F.y,F.z),h.push(F.x,F.y,F.z),h.push(F.x,F.y,F.z),u.push(0,0),u.push(0,0),u.push(0,0);let V=f++,Z=f++,ce=f++;if(l.push(V,Z,ce),o>0){{let ve=z.clone().add(O).multiplyScalar(.5),me=b.clone().sub(ve).normalize(),ke=w.clone().sub(ve).normalize().add(me).normalize().multiplyScalar(-1),L=J.clone().sub(q);Q(ve,L,ke,A.angle())}let se,pe;{let ve=new M;Yh(_,K,ve);let me=J.clone().add(j).multiplyScalar(.5);me=aF(me,O,b);let Pe=J.clone().sub(j);[se,pe]=Q(me,Pe,ve,N,j.y)}{let ve=se,me=ve.clone().setY(0).normalize(),Pe=new M(0,-1,0),ke=me.clone().cross(Pe);Y(ve,me,Pe,ke)}te.concat(pe);{let ve=A.angle(),me=Math.PI-ve,Pe=b.clone();Pe.y-=o/Math.sin(ve-Math.PI/2);let ke=new M,L=[];for(let re=0;re<a;re++){let ye=[],Se=Math.PI/2-me*re/a,Ie=Math.cos(Se),Fe=Math.sin(Se),ue=oe;for(let rt=0;rt<=re;rt++){let st=Math.cos(ue),Ee=Math.sin(ue);F.x=Ie*Ee,F.y=Fe,F.z=Ie*st,ke.copy(Pe).addScaledVector(F,o),c.push(ke.x,ke.y,ke.z),h.push(F.x,F.y,F.z),u.push(0,0),ye.push(f++),ue+=Math.PI*2/re/r}L.push(ye)}pe.reverse(),L.push(pe);let D=L.length-1;for(let re=0;re<D;re++){let ye=L[re],Se=L[re+1],Ie=ye.length-1;l.push(Se[1],ye[0],Se[0]);for(let Fe=1;Fe<=Ie;Fe++)l.push(ye[Fe],ye[Fe-1],Se[Fe]),l.push(Se[Fe+1],ye[Fe],Se[Fe])}}}}}this.setIndex(l),this.setAttribute("position",new Ce(c,3)),this.setAttribute("normal",new Ce(h,3)),this.setAttribute("uv",new Ce(u,2));function Q(F,z,O,j,q){let J=-j/2,W=(Math.PI-j)/2,ge=z.clone().normalize().cross(O);F.addScaledVector(O,-o/Math.sin(W));let oe=new M,le=new M,H=1,he=f,K=[];for(let V=0;V<=a;V++){let Z=J+V/a*j;le.set(0,0,0),le.addScaledVector(ge,Math.sin(Z)),le.addScaledVector(O,Math.cos(Z));for(let ce=0;ce<=H;ce++){let se=ce/H-.5;if(oe.copy(F),oe.addScaledVector(z,se),oe.addScaledVector(le,o),q!=null){let pe=Math.max(0,oe.y-q);oe.addScaledVector(z,-pe/z.y)}c.push(oe.x,oe.y,oe.z),h.push(le.x,le.y,le.z),u.push(0,0),ce===0&&K.push(f),f++}}for(let V=0;V<a;V++)for(let Z=0;Z<H;Z++){let ce=he+Z+(H+1)*V,se=ce+(H+1),pe=se+1,ve=ce+1;l.push(ce,se,ve),l.push(se,pe,ve)}return[F.clone().addScaledVector(z,.5),K]}function Y(F,z,O,j){let q=Math.PI/2,J=x.angle()-q,W=[],ge=new M,oe=new M;for(let H=0;H<=a;H++){let he=[],K=H/a;for(let V=0;V<=H;V++){let ce=((H?V/H:0)-.5)*y,se=Math.cos(ce),pe=Math.sin(ce),ve=Math.atan(Math.tan(J)*se),me=(q+ve)*K,Pe=Math.cos(me),ke=Math.sin(me);ge.set(0,0,0),ge.addScaledVector(z,ke*se),ge.addScaledVector(O,Pe),ge.addScaledVector(j,ke*pe),oe.copy(F).addScaledVector(ge,o),c.push(oe.x,oe.y,oe.z),h.push(ge.x,ge.y,ge.z),u.push(0,0),he.push(f++)}W.push(he)}let le=W.length-1;for(let H=0;H<le;H++){let he=W[H],K=W[H+1],V=he.length-1;l.push(he[0],K[1],K[0]);for(let Z=1;Z<=V;Z++)l.push(he[Z-1],he[Z],K[Z]),l.push(he[Z],K[Z+1],K[Z])}}}};var vp=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var s,o,a,l;let t=Object.assign({},(s=e==null?void 0:e.parameters)!=null?s:{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters),r=Object.assign((o=e==null?void 0:e.ui)!=null?o:{enabledIndieCorners:!1},i.ui);return{shape:i.shape&&i.shape instanceof Tt?i.shape:new Tt,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((a=t.height)!=null?a:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(l=t.depth)!=null?l:0)}),ui:r}}static build(i){let e=i.shape,{width:t,height:r,cornerRadius:n,cornerType:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}=i.parameters,c={x:t*.5,y:r*.5},h={x:-c.x,y:-c.y},u={x:c.x,y:c.y};function f(b,S,T){return S>t&&T>r?Math.min(b*t/S,b*r/T):S>t?b*t/S:T>r?b*r/T:b}let d=[];d[0]=n[0]===0?0:f(n[0],n[0]+n[3],n[0]+n[1]),d[1]=n[1]===0?0:f(n[1],n[1]+n[2],n[1]+n[0]),d[2]=n[2]===0?0:f(n[2],n[2]+n[1],n[2]+n[3]),d[3]=n[3]===0?0:f(n[3],n[3]+n[0],n[3]+n[2]);let p=h.x,m=u.x,g=u.y,v=h.y;e.addPoint(e.createPoint(p,g)),e.addPoint(e.createPoint(m,g)),e.addPoint(e.createPoint(m,v)),e.addPoint(e.createPoint(p,v)),e.isClosed=!0;let y=!0;for(let b=0,S=e.points.length;b<S;b++)e.points[b].roundness=d[b],b>0&&d[b]!==d[b-1]&&(y=!1);y&&(e.roundness=d[0]),e.useCubicForRoundedCorners=s!==1,e.update();let w=Hr.create({shape:e,parameters:{depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(w,{userData:xe(ie({},i),{type:"RectangleGeometry"})})}};var x1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:Math.PI},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e=100,height:t=e,depth:r=e,widthSegments:n=64,heightSegments:s=64,phiStart:o,phiLength:a,thetaStart:l,thetaLength:c}=i.parameters,h=new Ro(.5*e,n,s,o,a,l,c);return h.scale(1,t/e,r/e),Object.assign(h,{userData:xe(ie({},i),{type:"SphereGeometry"})})}};var b1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0,widthSegments:8,heightSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:0})}}static build(i){let{width:e=100,height:t=e,widthSegments:r=8,heightSegments:n=8}=i.parameters,s=new is(e,t,r,n);return s.scale(1,1,1),Object.assign(s,{userData:xe(ie({},i),{type:"PlaneGeometry"})})}};var w1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof Tt?i.shape:new Tt,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(o=t.depth)!=null?o:0)})}}static build(i){let{width:e,height:t,innerRadiusPercent:r,spikes:n,cornerRadius:s,angle:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}=i.parameters,h=i.shape,u=e*.5,f=t*.5,d=0,p=0,m=o*Math.PI/360/n,g=Math.PI/2*3*-1,v=u*r/100,y=f*r/100;if(n===3&&r===50){m=2*Math.PI/n;for(let b=0;b<n;b++){let S=m*b,T=d+Math.sin(S)*u,A=p+Math.cos(S)*f;h.addPoint(h.createPoint(T,A))}}else for(let b=0;b<n;b++){let S=d+Math.cos(g)*u,T=p+Math.sin(g)*f;h.addPoint(h.createPoint(S,T)),g+=m,S=d+Math.cos(g)*v,T=p+Math.sin(g)*y,b<=n,h.addPoint(h.createPoint(S,T)),g+=m}h.isClosed=!0;for(let b=0,S=h.points.length;b<S;b++)h.points[b].roundness=s;h.roundness=s,h.update();let w=Hr.create({shape:h,parameters:{roundness:s,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}});return Object.assign(w,{userData:xe(ie({},i),{type:"StarGeometry"})})}};var xp=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:0)})}}static build(i){let{width:e,height:t}=i.parameters,r=new is(e,t);return Object.assign(r,{userData:xe(ie({},i),{type:"TextFrameGeometry"})})}};var S1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var o,a,l;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,radialSegments:32,tubularSegments:64,arc:Math.PI*2,cornerRadius:30,cornerSegments:8},i.parameters),r=Math.abs(t.width),n=Math.abs((a=t.height)!=null?a:t.width),s=Math.abs((l=t.depth)!=null?l:t.width*.25);return{parameters:Object.assign(t,{width:r,height:n,depth:s})}}static build(i){let{width:e,height:t,depth:r,radialSegments:n,tubularSegments:s,arc:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=lF(e,t,r,e*.5,o,s,0,0,n,a,l);return c.scale(1,t/e,1),Object.assign(c,{userData:xe(ie({},i),{type:"TorusGeometry"})})}};function lF(i,e,t,r,n,s,o,a,l,c,h){return[e,t]=[t,e],o=e/2,n/=2*Math.PI,n==1&&(c=0),new jh(!0,i,e,t,r,n,s,o,a,l,c,h)}var M1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s,o;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width),tube:(o=t.tube)!=null?o:t.width*.125})}}static build(i){let{width:e,tube:t,tubularSegments:r,radialSegments:n,p:s,q:o}=i.parameters,a=e*.5;a!==t&&(a-=t);let l=new Ha(a,t,r,n,s,o);return Object.assign(l,{userData:xe(ie({},i),{type:"TorusKnotGeometry"})})}};var A1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},i.parameters);return{shape:i.shape&&i.shape instanceof Tt?i.shape:new Tt,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width*(t.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(o=t.depth)!=null?o:0)})}}static build(i){let{width:e=100,height:t,cornerRadius:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o,isRect:a}=i.parameters,l=i.shape,c=e*.5,h=t*.5;a?(l.addPoint(l.createPoint(-c,h)),l.addPoint(l.createPoint(c,-h)),l.addPoint(l.createPoint(-c,-h))):(l.addPoint(l.createPoint(0,h)),l.addPoint(l.createPoint(c,-h)),l.addPoint(l.createPoint(-c,-h))),l.isClosed=!0;for(let f=0,d=l.points.length;f<d;f++)l.points[f].roundness=r;l.roundness=r,l.update();let u=Hr.create({shape:l,parameters:{roundness:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o}});return Object.assign(u,{userData:xe(ie({},i),{type:"TriangleGeometry"})})}};var Xh={};Tx(Xh,{addBarycentricAttribute:()=>uF,fixUvs:()=>dF,loadFromUrl:()=>fF,resizeGeometry:()=>hF,roundShapePolygon:()=>cF});var T1=function(i,e){let t=e.x-i.x,r=e.y-i.y,n=Math.sqrt(t*t+r*r),s=t/n,o=r/n,a=Math.atan2(o,s);return{x:t,y:r,len:n,nx:s,ny:o,ang:a}},cF=(i,e,t)=>{let r,n,s,o,a,l,c,h,u,f,d,p,m,g,v=e.length;for(o=e[v-2],i.curves=[],r=1;r<v-1;r++){a=e[r%v],l=e[(r+1)%v];let y=T1(a,o),w=T1(a,l);c=y.nx*w.ny-y.ny*w.nx,h=y.nx*w.nx-y.ny*-w.ny,d=Math.asin(c),u=1,f=!1,h<0?d<0?d=Math.PI+d:(d=Math.PI-d,u=-1,f=!0):d>0&&(u=-1,f=!0),p=d/2,g=Math.abs(Math.cos(p)*t/Math.sin(p)),g>Math.min(y.len/2,w.len/2)?(g=Math.min(y.len/2,w.len/2),m=Math.abs(g*Math.sin(p)/Math.cos(p))):m=t,n=a.x+w.nx*g,s=a.y+w.ny*g,n+=-w.ny*m*u,s+=w.nx*m*u,i.absarc(n,s,m,y.ang+Math.PI/2*u,w.ang-Math.PI/2*u,f),o=a,a=l}i.closePath()},hF=(i,{width:e,height:t,depth:r})=>{e=Math.abs(e),t=Math.abs(t),r=Math.abs(r);let n=i.userData.parameters,s,o,a;e===0?(e=n.width,s=1):s=e/n.width,t===0?(t=n.height,o=1):o=t/n.height,r===0?(r=n.depth,a=1):a=r/n.depth,i.scale(s,o,a),n.width=e,n.height=t,n.depth=r},uF=(i,e)=>{let t=[new M(1,0,0),new M(0,1,0),new M(0,0,1)],r=i.attributes.position,n=new Float32Array(r.count*3);for(let s=0,o=r.count;s<o;s++)t[s%3].toArray(n,s*3);i.setAttribute(e,new Ce(n,3))},fF=i=>new Promise(e=>{new Ws().load(i,r=>e(r))}),dF=(i,e,t)=>{let r=i.getAttribute("uv");if(r)for(let n=0;n<r.count;n++){let s=r.getX(n),o=r.getY(n);r.setXY(n,(s+e/2)/e,1-(o-t/2)/t*-1)}};var pF,bp=new Promise(i=>{pF=i});var Qh=class{constructor(e){e=e!=null?e:{},this.name=e.name,this.type=e.type,this.node=e.node,this.size=e.size,this.needsUpdate=e.needsUpdate}get value(){return this.node.value}set value(e){this.node.value=e}};var We=class{constructor(e){this.hashProperties=void 0;this.isNode=!0;this.shortcuts={};this.uuid=et.generateUUID(),this.type=e,this.name="",this.userData={}}analyze(e,t){t=t!=null?t:{},e.analyzing=!0,this.build(e.addFlow(t.slot,t.cache,t.context),"v4"),e.clearVertexNodeCode(),e.clearFragmentNodeCode(),e.removeFlow(),e.analyzing=!1}analyzeAndFlow(e,t,r){return r=r!=null?r:{},this.analyze(e,r),this.flow(e,t,r)}flow(e,t,r){r=r!=null?r:{},e.addFlow(r.slot,r.cache,r.context);let n={result:this.build(e,t),code:e.clearNodeCode(),extra:e.context.extra};return e.removeFlow(),n}build(e,t,r){t=t!=null?t:this.getType(e,t);let n=e.getNodeData(r!=null?r:this);return e.analyzing&&this.appendDepsNode(e,n,t),e.nodes.indexOf(this)===-1&&e.nodes.push(this),this.updateFrame!==void 0&&e.updaters.indexOf(this)===-1&&e.updaters.push(this),this.generate(e,t,r)}updateFrame(e){}generateReadonly(e,t,r,n,s,o){return""}generate(e,t,r,n,s){return""}parse(e,t,r,n){}appendDepsNode(e,t,r){t.deps=(t.deps||0)+1;let n=e.getTypeLength(r);(n>(t.outputMax||0)||this.getType(e,r))&&(t.outputMax=n,t.output=r)}setName(e){this.name=e}getName(){return this.name}getType(e,t){return t==="sampler2D"||t==="samplerCube"?t:this.type}getJSONNode(e){if((e==null?void 0:e.materials)&&(e==null?void 0:e.materials[this.uuid])!==void 0)return e.materials[this.uuid]}getHash(){let e="{",t,r;for(t in this)r=this[t],r instanceof We&&(e+='"'+t+'":'+r.getHash()+",");if(this.hashProperties)for(let n=0;n<this.hashProperties.length;n++)t=this.hashProperties[n],r=this[t],e+='"'+t+'":"'+String(r)+'",';return e+='"id":"'+this.uuid+'"}',e}copy(e){return this.name=e.name,e.type&&(this.type=e.type),e.frameId&&(this.frameId=e.frameId),e.hashProperties&&(this.hashProperties=e.hashProperties.map(t=>t)),this.userData=JSON.parse(JSON.stringify(e.userData)),this.shortcuts=JSON.parse(JSON.stringify(e.shortcuts)),this}clone(){return new this.constructor().copy(this)}createJSONNode(e){let t=e===void 0||typeof e=="string";if(typeof this.type!="string")throw new Error("Node does not allow serialization.");let r={};return r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),!t&&e&&(e.nodes[this.uuid]=r),r}toJSON(e){var t;return(t=this.getJSONNode(e))!=null?t:this.createJSONNode(e)}fromJSON(e,t){return this.uuid=e.uuid,this.type=e.type,e.name&&(this.name=e.name),e.userData&&(this.userData=e.userData),this}};var pv=class{constructor(){this.nodes={};this.keywords={}}add(e){this.nodes[e.name]=e}addKeyword(e,t,r){r=r!==void 0?r:!0,this.keywords[e]={callback:t,cache:r}}remove(e){delete this.nodes[e.name]}removeKeyword(e){delete this.keywords[e]}get(e){return this.nodes[e]}getKeyword(e,t){return this.keywords[e].callback(t)}getKeywordData(e){return this.keywords[e]}contains(e){return this.nodes[e]!==void 0}containsKeyword(e){return this.keywords[e]!==void 0}},_r=new pv;var Ye=class extends We{constructor(t,r){super(t);this.scope="";r=r!=null?r:{},this.shared=r.shared!==void 0?r.shared:!0,this.unique=r.unique!==void 0?r.unique:!1}build(t,r,n,s){if(r=r!=null?r:this.getType(t),this.getShared(t,r)){let o=this.getUnique(t,r);o&&this.uuid===void 0&&(this.uuid=et.generateUUID()),n=t.getUUID(n!=null?n:this.getUUID(),!o);let a=t.getNodeData(n),l=a.output||this.getType(t);if(t.analyzing)return(a.deps||0)>0||this.getLabel()?(this.appendDepsNode(t,a,r),this.generate(t,r,n)):super.build(t,r,n);if(o)return a.name=a.name||super.build(t,r,n),a.name;if(!this.getLabel()&&(!this.getShared(t,l)||t.context.ignoreCache||a.deps===1))return super.build(t,r,n);n=this.getUUID(!1);let c=this.getTemp(t,n);if(c)return t.format(c,l,r);{c=super.generate(t,r,n,a.output,s);let h=this.generate(t,l,n);return t.addNodeCode(c+" = "+h+";"),t.format(c,l,r)}}return super.build(t,r,n)}getShared(t,r){return r!=="sampler2D"&&r!=="samplerCube"&&this.shared}getUnique(t,r){return this.unique}setLabel(t){return this.label=t,this}getLabel(){return this.label}getUUID(t){let r=this.uuid;return typeof this.scope=="string"&&(r=this.scope+"-"+r),r}getTemp(t,r){r=r||this.uuid;let n=t.getVars()[r];return n?n.name:void 0}generate(t,r,n,s,o){return this.getShared(t,r)||console.error("TempNode is not shared"),n=n!=null?n:this.uuid,t.getTempVar(n,s!=null?s:this.getType(t),o,this.getLabel()).name}};var jt=class extends Ye{constructor(t,r){r=r!=null?r:{},r.shared=r.shared!==void 0?r.shared:!1;super(t,r);this.readonly=!1}setReadonly(t){return this.readonly=t,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}createJSONNode(t){let r=super.createJSONNode(t);return this.readonly===!0&&(r.readonly=this.readonly),r}fromJSON(t,r){return super.fromJSON(t,r),t.readonly!==void 0&&this.setReadonly(t.readonly),this}generate(t,r,n,s,o,a){n=t.getUUID(n!=null?n:this.getUUID()),s=s!=null?s:this.getType(t);let l=t.getNodeData(n);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(t,r,n,s,o,a):t.isShader("vertex")?(l.vertex||(l.vertex=t.createVertexUniform(s,this,o,a,this.getLabel())),t.format(l.vertex.name,s,r)):(l.fragment||(l.fragment=t.createFragmentUniform(s,this,o,a,this.getLabel())),t.format(l.fragment.name,s,r))}copy(t){return super.copy(t),this.readonly=t.readonly,this}};var Nr=class extends jt{constructor(t=0,r){super("v2");this.nodeType="Vector2";this.value=t instanceof B?t:new B(t,r)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}generateReadonly(t,r,n,s,o,a){return t.format("vec2("+this.value.x+", "+this.value.y+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var Or=class extends jt{constructor(t=0,r,n){super("v3");this.nodeType="Vector3";this.value=t instanceof M?t:new M(t,r,n)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}get z(){return this.value.z}set z(t){this.value.z=t}generateReadonly(t,r,n,s,o,a){return t.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var Wr=class extends be{constructor(t,r,n,s){super(t,r,n);this.isColorA=!0;this.a=s}setRGBA(t,r,n,s){super.setRGB(t,r,n),this.a=s}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}};var fi=class extends jt{constructor(t){super("v4");this.nodeType="Vector4";this.value=t instanceof Wr?t:new Wr(t.r,t.g,t.b,t.a)}generateReadonly(t,r,n,s,o,a){return t.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var mF=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,E1=/[a-z_0-9]+/gi,Ne=class extends Ye{constructor(t,r,n,s,o){super(o);this.src="";this.nodeType="Function";this.useKeywords=!0;this.includes=[];this.extensions={};this.keywords={};this.isMethod=o===void 0,this.isInterface=!1,this.parse(t,r,n,s)}getShared(t,r){return!this.isMethod}getType(t){return t.getTypeByFormat(this.type)}getInputByName(t){if(this.inputs){let r=this.inputs.length;for(;r--;)if(this.inputs[r].name===t)return this.inputs[r]}}getIncludeByName(t){if(this.includes){let r=this.includes.length;for(;r--;)if(this.includes[r].name===t)return this.includes[r]}}generate(t,r,n,s,o){let a,l=0,c=this.src;if(this.includes)for(let u=0;u<this.includes.length;u++)t.include(this.includes[u],this);for(let u in this.extensions)t.extensions[u]=!0;let h=[];for(;a=E1.exec(this.src);)h.push(a);for(let u=0;u<h.length;u++){let f=h[u],d=f[0],p=this.isMethod?!this.getInputByName(d):!0,m=d;if(this.keywords[d]||this.useKeywords&&p&&_r.containsKeyword(d)){let g=this.keywords[d];if(!g){let v=_r.getKeywordData(d);v.cache&&(g=t.keywords[d]),g=g||_r.getKeyword(d,t),v.cache&&(t.keywords[d]=g)}m=g.build(t)}d!==m&&(c=c.substring(0,f.index+l)+m+c.substring(f.index+d.length+l),l+=m.length-d.length),this.getIncludeByName(m)===void 0&&_r.contains(m)&&t.include(_r.get(m))}return r==="source"?c:this.isMethod?(this.isInterface||t.include(this,void 0,c),this.name):t.format("( "+c+" )",this.getType(t),r)}parse(t,r,n,s){if(this.src=t||"",this.includes=r!=null?r:[],this.extensions=n!=null?n:{},this.keywords=s!=null?s:{},this.isMethod){let o=mF.exec(this.src);if(this.inputs=[],o&&o.length==4){this.type=o[1],this.name=o[2];let a=o[3].match(E1);if(a){let l=0;for(;l<a.length;){let c=a[l++],h;c==="in"||c==="out"||c==="inout"?h=a[l++]:(h=c,c="");let u=a[l++];this.inputs.push({name:u,type:h,qualifier:c})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}copy(t){return super.copy(t),this.isMethod=t.isMethod,this.useKeywords=t.useKeywords,t.type!==void 0&&(this.type=t.type),this.parse(t.src,t.includes,t.extensions,t.keywords),this}toJSON(t){var n;let r=this.getJSONNode(t);if(!r){r=this.createJSONNode(t),r.src=this.src,r.isMethod=this.isMethod,r.useKeywords=this.useKeywords,this.isMethod||(r.type=this.type),r.extensions=JSON.parse(JSON.stringify(this.extensions));let s={};for(let o in this.keywords)s[o]=this.keywords[o].toJSON(t).uuid;if(r.keywords=s,(n=this.includes)!=null&&n.length){let o=[];for(let a=0;a<this.includes.length;a++)o.push(this.includes[a].toJSON(t).uuid);r.includes=o}r.isMethod=this.isMethod,r.inputs=this.inputs}return r.nodeType=this.nodeType,r}fromJSON(t,r){if(super.fromJSON(t,r),t.inputs!==void 0&&(this.inputs=t.inputs),t.isMethod!==void 0&&(this.isMethod=t.isMethod),t.src&&(this.src=t.src),t.isMethod&&(this.isMethod=t.isMethod),t.useKeywords&&(this.useKeywords=t.useKeywords),t.type&&(this.type=t.type),t.extensions&&(this.extensions=t.extensions),t.keywords&&r){this.keywords={};for(let n in t.keywords)this.keywords[n]=r.getNode(t.keywords[n])}return t.includes&&r&&(this.includes=t.includes.map(n=>r.getNode(n))),this}};var gF=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,mv=class extends Ye{constructor(t="",r){super();this.src="";this.useDefine=!1;this.nodeType="Const";this.parse(t||mv.PI,void 0,void 0,void 0,r)}getType(t){return t.getTypeByFormat(this.type)}parse(t,r,n,s,o){this.src=t||"";let a,l,c="",h=gF.exec(t);this.useDefine=o!=null?o:this.src.charAt(0)==="#",h&&h.length>1?(l=h[1],a=h[2],c=h[3]):(a=this.src,l="f"),this.name=a,this.type=l,this.value=c}build(t,r){if(r==="source"){if(this.value)return this.useDefine?"#define "+this.name+" "+this.value:"const "+this.type+" "+this.name+" = "+this.value+";";if(this.useDefine)return this.src}return t.include(this),t.format(this.name,this.getType(t),r)}generate(t,r,n,s,o){return t.format(this.name,this.getType(t),r)}copy(t){return super.copy(t),this.parse(t.src,void 0,void 0,void 0,t.useDefine),this}},wt=mv;wt.PI="PI",wt.PI2="PI2",wt.RECIPROCAL_PI="RECIPROCAL_PI",wt.RECIPROCAL_PI2="RECIPROCAL_PI2",wt.LOG2="LOG2",wt.EPSILON="EPSILON";var yF=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
|
|
2986
|
+
}`;function _b(i,e,t){let r=new Na,n=new B,s=new B,o=new Je,a=new Qc({depthPacking:LE}),l=new Jc,c={},h=t.maxTextureSize,u={0:Pr,1:ii,2:or},f=new Mt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new B},radius:{value:4}},vertexShader:SL,fragmentShader:ML}),d=f.clone();d.defines.HORIZONTAL_PASS=1;let p=new Le;p.setAttribute("position",new Ve(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new Vt(p,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ub,this.render=function(b,S,T){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;let A=i.getRenderTarget(),x=i.getActiveCubeFace(),E=i.getActiveMipmapLevel(),_=i.state;_.setBlending(Ht),_.buffers.color.setClear(1,1,1,1),_.buffers.depth.setTest(!0),_.setScissorTest(!1);for(let C=0,I=b.length;C<I;C++){let N=b[C],R=N.shadow;if(R===void 0){console.warn("THREE.WebGLShadowMap:",N,"has no shadow.");continue}if(R.autoUpdate===!1&&R.needsUpdate===!1)continue;n.copy(R.mapSize);let k=R.getFrameExtents();if(n.multiply(k),s.copy(R.mapSize),(n.x>h||n.y>h)&&(n.x>h&&(s.x=Math.floor(h/k.x),n.x=s.x*k.x,R.mapSize.x=s.x),n.y>h&&(s.y=Math.floor(h/k.y),n.y=s.y*k.y,R.mapSize.y=s.y)),R.map===null&&!R.isPointLightShadow&&this.type===Bc&&(R.map=new mt(n.x,n.y),R.map.texture.name=N.name+".shadowMap",R.mapPass=new mt(n.x,n.y),R.camera.updateProjectionMatrix()),R.map===null){let te={minFilter:hr,magFilter:hr,format:Fn};R.map=new mt(n.x,n.y,te),R.map.texture.name=N.name+".shadowMap",R.camera.updateProjectionMatrix()}i.setRenderTarget(R.map),i.clear();let G=R.getViewportCount();for(let te=0;te<G;te++){let Q=R.getViewport(te);o.set(s.x*Q.x,s.y*Q.y,s.x*Q.z,s.y*Q.w),_.viewport(o),R.updateMatrices(N,te),r=R.getFrustum(),w(S,T,R.camera,N,this.type)}!R.isPointLightShadow&&this.type===Bc&&v(R,T),R.needsUpdate=!1}g.needsUpdate=!1,i.setRenderTarget(A,x,E)};function v(b,S){let T=e.update(m);f.defines.VSM_SAMPLES!==b.blurSamples&&(f.defines.VSM_SAMPLES=b.blurSamples,d.defines.VSM_SAMPLES=b.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),f.uniforms.shadow_pass.value=b.map.texture,f.uniforms.resolution.value=b.mapSize,f.uniforms.radius.value=b.radius,i.setRenderTarget(b.mapPass),i.clear(),i.renderBufferDirect(S,null,T,f,m,null),d.uniforms.shadow_pass.value=b.mapPass.texture,d.uniforms.resolution.value=b.mapSize,d.uniforms.radius.value=b.radius,i.setRenderTarget(b.map),i.clear(),i.renderBufferDirect(S,null,T,d,m,null)}function y(b,S,T,A,x,E){let _=null,C=T.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(C!==void 0?_=C:_=T.isPointLight===!0?l:a,i.localClippingEnabled&&S.clipShadows===!0&&S.clippingPlanes.length!==0||S.displacementMap&&S.displacementScale!==0||S.alphaMap&&S.alphaTest>0){let I=_.uuid,N=S.uuid,R=c[I];R===void 0&&(R={},c[I]=R);let k=R[N];k===void 0&&(k=_.clone(),R[N]=k),_=k}return _.visible=S.visible,_.wireframe=S.wireframe,E===Bc?_.side=S.shadowSide!==null?S.shadowSide:S.side:_.side=S.shadowSide!==null?S.shadowSide:u[S.side],_.alphaMap=S.alphaMap,_.alphaTest=S.alphaTest,_.clipShadows=S.clipShadows,_.clippingPlanes=S.clippingPlanes,_.clipIntersection=S.clipIntersection,_.displacementMap=S.displacementMap,_.displacementScale=S.displacementScale,_.displacementBias=S.displacementBias,_.wireframeLinewidth=S.wireframeLinewidth,_.linewidth=S.linewidth,T.isPointLight===!0&&_.isMeshDistanceMaterial===!0&&(_.referencePosition.setFromMatrixPosition(T.matrixWorld),_.nearDistance=A,_.farDistance=x),_}function w(b,S,T,A,x){if(b.visible===!1)return;if(b.layers.test(S.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&x===Bc)&&(!b.frustumCulled||r.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,b.matrixWorld);let C=e.update(b),I=b.material;if(Array.isArray(I)){let N=C.groups;for(let R=0,k=N.length;R<k;R++){let G=N[R],te=I[G.materialIndex];if(te&&te.visible){let Q=y(b,te,A,T.near,T.far,x);i.renderBufferDirect(T,null,C,Q,b,G)}}}else if(I.visible){let N=y(b,I,A,T.near,T.far,x);i.renderBufferDirect(T,null,C,N,b,null)}}let _=b.children;for(let C=0,I=_.length;C<I;C++)w(_[C],S,T,A,x)}}function AL(i,e,t){let r=t.isWebGL2;function n(){let U=!1,Me=new Je,De=null,Ze=new Je(0,0,0,0);return{setMask:function(Oe){De!==Oe&&!U&&(i.colorMask(Oe,Oe,Oe,Oe),De=Oe)},setLocked:function(Oe){U=Oe},setClear:function(Oe,Qe,Te,$e,lt){lt===!0&&(Oe*=$e,Qe*=$e,Te*=$e),Me.set(Oe,Qe,Te,$e),Ze.equals(Me)===!1&&(i.clearColor(Oe,Qe,Te,$e),Ze.copy(Me))},reset:function(){U=!1,De=null,Ze.set(-1,0,0,0)}}}function s(){let U=!1,Me=null,De=null,Ze=null;return{setTest:function(Oe){Oe?J(2929):W(2929)},setMask:function(Oe){Me!==Oe&&!U&&(i.depthMask(Oe),Me=Oe)},setFunc:function(Oe){if(De!==Oe){if(Oe)switch(Oe){case ZT:i.depthFunc(512);break;case $T:i.depthFunc(519);break;case eE:i.depthFunc(513);break;case tg:i.depthFunc(515);break;case tE:i.depthFunc(514);break;case rE:i.depthFunc(518);break;case nE:i.depthFunc(516);break;case iE:i.depthFunc(517);break;default:i.depthFunc(515)}else i.depthFunc(515);De=Oe}},setLocked:function(Oe){U=Oe},setClear:function(Oe){Ze!==Oe&&(i.clearDepth(Oe),Ze=Oe)},reset:function(){U=!1,Me=null,De=null,Ze=null}}}function o(){let U=!1,Me=null,De=null,Ze=null,Oe=null,Qe=null,Te=null,$e=null,lt=null;return{setTest:function(dt){U||(dt?J(2960):W(2960))},setMask:function(dt){Me!==dt&&!U&&(i.stencilMask(dt),Me=dt)},setFunc:function(dt,Ut,Ur){(De!==dt||Ze!==Ut||Oe!==Ur)&&(i.stencilFunc(dt,Ut,Ur),De=dt,Ze=Ut,Oe=Ur)},setOp:function(dt,Ut,Ur){(Qe!==dt||Te!==Ut||$e!==Ur)&&(i.stencilOp(dt,Ut,Ur),Qe=dt,Te=Ut,$e=Ur)},setLocked:function(dt){U=dt},setClear:function(dt){lt!==dt&&(i.clearStencil(dt),lt=dt)},reset:function(){U=!1,Me=null,De=null,Ze=null,Oe=null,Qe=null,Te=null,$e=null,lt=null}}}let a=new n,l=new s,c=new o,h={},u={},f=new WeakMap,d=[],p=null,m=!1,g=null,v=null,y=null,w=null,b=null,S=null,T=null,A=!1,x=null,E=null,_=null,C=null,I=null,N=i.getParameter(35661),R=!1,k=0,G=i.getParameter(7938);G.indexOf("WebGL")!==-1?(k=parseFloat(/^WebGL (\d)/.exec(G)[1]),R=k>=1):G.indexOf("OpenGL ES")!==-1&&(k=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),R=k>=2);let te=null,Q={},Y=i.getParameter(3088),F=i.getParameter(2978),z=new Je().fromArray(Y),O=new Je().fromArray(F);function j(U,Me,De){let Ze=new Uint8Array(4),Oe=i.createTexture();i.bindTexture(U,Oe),i.texParameteri(U,10241,9728),i.texParameteri(U,10240,9728);for(let Qe=0;Qe<De;Qe++)i.texImage2D(Me+Qe,0,6408,1,1,0,6408,5121,Ze);return Oe}let q={};q[3553]=j(3553,3553,1),q[34067]=j(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),J(2929),l.setFunc(tg),Z(!1),ce(Ex),J(2884),K(Ht);function J(U){h[U]!==!0&&(i.enable(U),h[U]=!0)}function W(U){h[U]!==!1&&(i.disable(U),h[U]=!1)}function ge(U,Me){return u[U]!==Me?(i.bindFramebuffer(U,Me),u[U]=Me,r&&(U===36009&&(u[36160]=Me),U===36160&&(u[36009]=Me)),!0):!1}function oe(U,Me){let De=d,Ze=!1;if(U)if(De=f.get(Me),De===void 0&&(De=[],f.set(Me,De)),U.isWebGLMultipleRenderTargets){let Oe=U.texture;if(De.length!==Oe.length||De[0]!==36064){for(let Qe=0,Te=Oe.length;Qe<Te;Qe++)De[Qe]=36064+Qe;De.length=Oe.length,Ze=!0}}else De[0]!==36064&&(De[0]=36064,Ze=!0);else De[0]!==1029&&(De[0]=1029,Ze=!0);Ze&&(t.isWebGL2?i.drawBuffers(De):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(De))}function le(U){return p!==U?(i.useProgram(U),p=U,!0):!1}let H={[Ea]:32774,[kT]:32778,[VT]:32779};if(r)H[Px]=32775,H[Lx]=32776;else{let U=e.get("EXT_blend_minmax");U!==null&&(H[Px]=U.MIN_EXT,H[Lx]=U.MAX_EXT)}let he={[HT]:0,[WT]:1,[jT]:768,[db]:770,[KT]:776,[QT]:774,[YT]:772,[qT]:769,[pb]:771,[JT]:775,[XT]:773};function K(U,Me,De,Ze,Oe,Qe,Te,$e){if(U===Ht){m===!0&&(W(3042),m=!1);return}if(m===!1&&(J(3042),m=!0),U!==GT){if(U!==g||$e!==A){if((v!==Ea||b!==Ea)&&(i.blendEquation(32774),v=Ea,b=Ea),$e)switch(U){case Ps:i.blendFuncSeparate(1,771,1,771);break;case _x:i.blendFunc(1,1);break;case Cx:i.blendFuncSeparate(0,769,0,1);break;case Dx:i.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",U);break}else switch(U){case Ps:i.blendFuncSeparate(770,771,1,771);break;case _x:i.blendFunc(770,1);break;case Cx:i.blendFuncSeparate(0,769,0,1);break;case Dx:i.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",U);break}y=null,w=null,S=null,T=null,g=U,A=$e}return}Oe=Oe||Me,Qe=Qe||De,Te=Te||Ze,(Me!==v||Oe!==b)&&(i.blendEquationSeparate(H[Me],H[Oe]),v=Me,b=Oe),(De!==y||Ze!==w||Qe!==S||Te!==T)&&(i.blendFuncSeparate(he[De],he[Ze],he[Qe],he[Te]),y=De,w=Ze,S=Qe,T=Te),g=U,A=null}function V(U,Me){U.side===or?W(2884):J(2884);let De=U.side===Pr;Me&&(De=!De),Z(De),U.blending===Ps&&U.transparent===!1?K(Ht):K(U.blending,U.blendEquation,U.blendSrc,U.blendDst,U.blendEquationAlpha,U.blendSrcAlpha,U.blendDstAlpha,U.premultipliedAlpha),l.setFunc(U.depthFunc),l.setTest(U.depthTest),l.setMask(U.depthWrite),a.setMask(U.colorWrite);let Ze=U.stencilWrite;c.setTest(Ze),Ze&&(c.setMask(U.stencilWriteMask),c.setFunc(U.stencilFunc,U.stencilRef,U.stencilFuncMask),c.setOp(U.stencilFail,U.stencilZFail,U.stencilZPass)),pe(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),U.alphaToCoverage===!0?J(32926):W(32926)}function Z(U){x!==U&&(U?i.frontFace(2304):i.frontFace(2305),x=U)}function ce(U){U!==UT?(J(2884),U!==E&&(U===Ex?i.cullFace(1029):U===zT?i.cullFace(1028):i.cullFace(1032))):W(2884),E=U}function se(U){U!==_&&(R&&i.lineWidth(U),_=U)}function pe(U,Me,De){U?(J(32823),(C!==Me||I!==De)&&(i.polygonOffset(Me,De),C=Me,I=De)):W(32823)}function ve(U){U?J(3089):W(3089)}function me(U){U===void 0&&(U=33984+N-1),te!==U&&(i.activeTexture(U),te=U)}function Pe(U,Me){te===null&&me();let De=Q[te];De===void 0&&(De={type:void 0,texture:void 0},Q[te]=De),(De.type!==U||De.texture!==Me)&&(i.bindTexture(U,Me||q[U]),De.type=U,De.texture=Me)}function ke(){let U=Q[te];U!==void 0&&U.type!==void 0&&(i.bindTexture(U.type,null),U.type=void 0,U.texture=void 0)}function L(){try{i.compressedTexImage2D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function D(){try{i.texSubImage2D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function re(){try{i.texSubImage3D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function ye(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Se(){try{i.texStorage2D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Ie(){try{i.texStorage3D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Fe(){try{i.texImage2D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function ue(){try{i.texImage3D.apply(i,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function rt(U){z.equals(U)===!1&&(i.scissor(U.x,U.y,U.z,U.w),z.copy(U))}function st(U){O.equals(U)===!1&&(i.viewport(U.x,U.y,U.z,U.w),O.copy(U))}function Ee(){i.disable(3042),i.disable(2884),i.disable(2929),i.disable(32823),i.disable(3089),i.disable(2960),i.disable(32926),i.blendEquation(32774),i.blendFunc(1,0),i.blendFuncSeparate(1,0,1,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(513),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(519,0,4294967295),i.stencilOp(7680,7680,7680),i.clearStencil(0),i.cullFace(1029),i.frontFace(2305),i.polygonOffset(0,0),i.activeTexture(33984),i.bindFramebuffer(36160,null),r===!0&&(i.bindFramebuffer(36009,null),i.bindFramebuffer(36008,null)),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),h={},te=null,Q={},u={},f=new WeakMap,d=[],p=null,m=!1,g=null,v=null,y=null,w=null,b=null,S=null,T=null,A=!1,x=null,E=null,_=null,C=null,I=null,z.set(0,0,i.canvas.width,i.canvas.height),O.set(0,0,i.canvas.width,i.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:J,disable:W,bindFramebuffer:ge,drawBuffers:oe,useProgram:le,setBlending:K,setMaterial:V,setFlipSided:Z,setCullFace:ce,setLineWidth:se,setPolygonOffset:pe,setScissorTest:ve,activeTexture:me,bindTexture:Pe,unbindTexture:ke,compressedTexImage2D:L,texImage2D:Fe,texImage3D:ue,texStorage2D:Se,texStorage3D:Ie,texSubImage2D:D,texSubImage3D:re,compressedTexSubImage2D:ye,scissor:rt,viewport:st,reset:Ee}}function TL(i,e,t,r,n,s,o){let a=n.isWebGL2,l=n.maxTextures,c=n.maxCubemapSize,h=n.maxTextureSize,u=n.maxSamples,f=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,d=/OculusBrowser/g.test(navigator.userAgent),p=new WeakMap,m,g=new WeakMap,v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(L,D){return v?new OffscreenCanvas(L,D):jc("canvas")}function w(L,D,re,ye){let Se=1;if((L.width>ye||L.height>ye)&&(Se=ye/Math.max(L.width,L.height)),Se<1||D===!0)if(typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&L instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&L instanceof ImageBitmap){let Ie=D?mf:Math.floor,Fe=Ie(Se*L.width),ue=Ie(Se*L.height);m===void 0&&(m=y(Fe,ue));let rt=re?y(Fe,ue):m;return rt.width=Fe,rt.height=ue,rt.getContext("2d").drawImage(L,0,0,Fe,ue),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+L.width+"x"+L.height+") to ("+Fe+"x"+ue+")."),rt}else return"data"in L&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+L.width+"x"+L.height+")."),L;return L}function b(L){return og(L.width)&&og(L.height)}function S(L){return a?!1:L.wrapS!==Dr||L.wrapT!==Dr||L.minFilter!==hr&&L.minFilter!==ct}function T(L,D){return L.generateMipmaps&&D&&L.minFilter!==hr&&L.minFilter!==ct}function A(L){i.generateMipmap(L)}function x(L,D,re,ye,Se=!1){if(a===!1)return D;if(L!==null){if(i[L]!==void 0)return i[L];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+L+"'")}let Ie=D;return D===6403&&(re===5126&&(Ie=33326),re===5131&&(Ie=33325),re===5121&&(Ie=33321)),D===33319&&(re===5126&&(Ie=33328),re===5131&&(Ie=33327),re===5121&&(Ie=33323)),D===6408&&(re===5126&&(Ie=34836),re===5131&&(Ie=34842),re===5121&&(Ie=ye===je&&Se===!1?35907:32856),re===32819&&(Ie=32854),re===32820&&(Ie=32855)),(Ie===33325||Ie===33326||Ie===33327||Ie===33328||Ie===34842||Ie===34836)&&e.get("EXT_color_buffer_float"),Ie}function E(L,D,re){return T(L,re)===!0||L.isFramebufferTexture&&L.minFilter!==hr&&L.minFilter!==ct?Math.log2(Math.max(D.width,D.height))+1:L.mipmaps!==void 0&&L.mipmaps.length>0?L.mipmaps.length:L.isCompressedTexture&&Array.isArray(L.image)?D.mipmaps.length:1}function _(L){return L===hr||L===Ix||L===Rx?9728:9729}function C(L){let D=L.target;D.removeEventListener("dispose",C),N(D),D.isVideoTexture&&p.delete(D)}function I(L){let D=L.target;D.removeEventListener("dispose",I),k(D)}function N(L){let D=r.get(L);if(D.__webglInit===void 0)return;let re=L.source,ye=g.get(re);if(ye){let Se=ye[D.__cacheKey];Se.usedTimes--,Se.usedTimes===0&&R(L),Object.keys(ye).length===0&&g.delete(re)}r.remove(L)}function R(L){let D=r.get(L);i.deleteTexture(D.__webglTexture);let re=L.source,ye=g.get(re);delete ye[D.__cacheKey],o.memory.textures--}function k(L){let D=L.texture,re=r.get(L),ye=r.get(D);if(ye.__webglTexture!==void 0&&(i.deleteTexture(ye.__webglTexture),o.memory.textures--),L.depthTexture&&L.depthTexture.dispose(),L.isWebGLCubeRenderTarget)for(let Se=0;Se<6;Se++)i.deleteFramebuffer(re.__webglFramebuffer[Se]),re.__webglDepthbuffer&&i.deleteRenderbuffer(re.__webglDepthbuffer[Se]);else i.deleteFramebuffer(re.__webglFramebuffer),re.__webglDepthbuffer&&i.deleteRenderbuffer(re.__webglDepthbuffer),re.__webglMultisampledFramebuffer&&i.deleteFramebuffer(re.__webglMultisampledFramebuffer),re.__webglColorRenderbuffer&&i.deleteRenderbuffer(re.__webglColorRenderbuffer),re.__webglDepthRenderbuffer&&i.deleteRenderbuffer(re.__webglDepthRenderbuffer);if(L.isWebGLMultipleRenderTargets)for(let Se=0,Ie=D.length;Se<Ie;Se++){let Fe=r.get(D[Se]);Fe.__webglTexture&&(i.deleteTexture(Fe.__webglTexture),o.memory.textures--),r.remove(D[Se])}r.remove(D),r.remove(L)}let G=0;function te(){G=0}function Q(){let L=G;return L>=l&&console.warn("THREE.WebGLTextures: Trying to use "+L+" texture units while this GPU supports only "+l),G+=1,L}function Y(L){let D=[];return D.push(L.wrapS),D.push(L.wrapT),D.push(L.magFilter),D.push(L.minFilter),D.push(L.anisotropy),D.push(L.internalFormat),D.push(L.format),D.push(L.type),D.push(L.generateMipmaps),D.push(L.premultiplyAlpha),D.push(L.flipY),D.push(L.unpackAlignment),D.push(L.encoding),D.join()}function F(L,D){let re=r.get(L);if(L.isVideoTexture&&Pe(L),L.isRenderTargetTexture===!1&&L.version>0&&re.__version!==L.version){let ye=L.image;if(ye===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ye.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{oe(re,L,D);return}}t.activeTexture(33984+D),t.bindTexture(3553,re.__webglTexture)}function z(L,D){let re=r.get(L);if(L.version>0&&re.__version!==L.version){oe(re,L,D);return}t.activeTexture(33984+D),t.bindTexture(35866,re.__webglTexture)}function O(L,D){let re=r.get(L);if(L.version>0&&re.__version!==L.version){oe(re,L,D);return}t.activeTexture(33984+D),t.bindTexture(32879,re.__webglTexture)}function j(L,D){let re=r.get(L);if(L.version>0&&re.__version!==L.version){le(re,L,D);return}t.activeTexture(33984+D),t.bindTexture(34067,re.__webglTexture)}let q={[Ia]:10497,[Dr]:33071,[ig]:33648},J={[hr]:9728,[Ix]:9984,[Rx]:9986,[ct]:9729,[fE]:9985,[js]:9987};function W(L,D,re){if(re?(i.texParameteri(L,10242,q[D.wrapS]),i.texParameteri(L,10243,q[D.wrapT]),(L===32879||L===35866)&&i.texParameteri(L,32882,q[D.wrapR]),i.texParameteri(L,10240,J[D.magFilter]),i.texParameteri(L,10241,J[D.minFilter])):(i.texParameteri(L,10242,33071),i.texParameteri(L,10243,33071),(L===32879||L===35866)&&i.texParameteri(L,32882,33071),(D.wrapS!==Dr||D.wrapT!==Dr)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),i.texParameteri(L,10240,_(D.magFilter)),i.texParameteri(L,10241,_(D.minFilter)),D.minFilter!==hr&&D.minFilter!==ct&&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){let ye=e.get("EXT_texture_filter_anisotropic");if(D.type===Ds&&e.has("OES_texture_float_linear")===!1||a===!1&&D.type===Vc&&e.has("OES_texture_half_float_linear")===!1)return;(D.anisotropy>1||r.get(D).__currentAnisotropy)&&(i.texParameterf(L,ye.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(D.anisotropy,n.getMaxAnisotropy())),r.get(D).__currentAnisotropy=D.anisotropy)}}function ge(L,D){let re=!1;L.__webglInit===void 0&&(L.__webglInit=!0,D.addEventListener("dispose",C));let ye=D.source,Se=g.get(ye);Se===void 0&&(Se={},g.set(ye,Se));let Ie=Y(D);if(Ie!==L.__cacheKey){Se[Ie]===void 0&&(Se[Ie]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,re=!0),Se[Ie].usedTimes++;let Fe=Se[L.__cacheKey];Fe!==void 0&&(Se[L.__cacheKey].usedTimes--,Fe.usedTimes===0&&R(D)),L.__cacheKey=Ie,L.__webglTexture=Se[Ie].texture}return re}function oe(L,D,re){let ye=3553;D.isDataArrayTexture&&(ye=35866),D.isData3DTexture&&(ye=32879);let Se=ge(L,D),Ie=D.source;if(t.activeTexture(33984+re),t.bindTexture(ye,L.__webglTexture),Ie.version!==Ie.__currentVersion||Se===!0){i.pixelStorei(37440,D.flipY),i.pixelStorei(37441,D.premultiplyAlpha),i.pixelStorei(3317,D.unpackAlignment),i.pixelStorei(37443,0);let Fe=S(D)&&b(D.image)===!1,ue=w(D.image,Fe,!1,h);ue=ke(D,ue);let rt=b(ue)||a,st=s.convert(D.format,D.encoding),Ee=s.convert(D.type),U=x(D.internalFormat,st,Ee,D.encoding,D.isVideoTexture);W(ye,D,rt);let Me,De=D.mipmaps,Ze=a&&D.isVideoTexture!==!0,Oe=L.__version===void 0||Se===!0,Qe=E(D,ue,rt);if(D.isDepthTexture)U=6402,a?D.type===Ds?U=36012:D.type===La?U=33190:D.type===Ls?U=35056:U=33189:D.type===Ds&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),D.format===Eo&&U===6402&&D.type!==kc&&D.type!==La&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),D.type=kc,Ee=s.convert(D.type)),D.format===Ns&&U===6402&&(U=34041,D.type!==Ls&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),D.type=Ls,Ee=s.convert(D.type))),Oe&&(Ze?t.texStorage2D(3553,1,U,ue.width,ue.height):t.texImage2D(3553,0,U,ue.width,ue.height,0,st,Ee,null));else if(D.isDataTexture)if(De.length>0&&rt){Ze&&Oe&&t.texStorage2D(3553,Qe,U,De[0].width,De[0].height);for(let Te=0,$e=De.length;Te<$e;Te++)Me=De[Te],Ze?t.texSubImage2D(3553,Te,0,0,Me.width,Me.height,st,Ee,Me.data):t.texImage2D(3553,Te,U,Me.width,Me.height,0,st,Ee,Me.data);D.generateMipmaps=!1}else Ze?(Oe&&t.texStorage2D(3553,Qe,U,ue.width,ue.height),t.texSubImage2D(3553,0,0,0,ue.width,ue.height,st,Ee,ue.data)):t.texImage2D(3553,0,U,ue.width,ue.height,0,st,Ee,ue.data);else if(D.isCompressedTexture){Ze&&Oe&&t.texStorage2D(3553,Qe,U,De[0].width,De[0].height);for(let Te=0,$e=De.length;Te<$e;Te++)Me=De[Te],D.format!==Fn?st!==null?Ze?t.compressedTexSubImage2D(3553,Te,0,0,Me.width,Me.height,st,Me.data):t.compressedTexImage2D(3553,Te,U,Me.width,Me.height,0,Me.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ze?t.texSubImage2D(3553,Te,0,0,Me.width,Me.height,st,Ee,Me.data):t.texImage2D(3553,Te,U,Me.width,Me.height,0,st,Ee,Me.data)}else if(D.isDataArrayTexture)Ze?(Oe&&t.texStorage3D(35866,Qe,U,ue.width,ue.height,ue.depth),t.texSubImage3D(35866,0,0,0,0,ue.width,ue.height,ue.depth,st,Ee,ue.data)):t.texImage3D(35866,0,U,ue.width,ue.height,ue.depth,0,st,Ee,ue.data);else if(D.isData3DTexture)Ze?(Oe&&t.texStorage3D(32879,Qe,U,ue.width,ue.height,ue.depth),t.texSubImage3D(32879,0,0,0,0,ue.width,ue.height,ue.depth,st,Ee,ue.data)):t.texImage3D(32879,0,U,ue.width,ue.height,ue.depth,0,st,Ee,ue.data);else if(D.isFramebufferTexture){if(Oe)if(Ze)t.texStorage2D(3553,Qe,U,ue.width,ue.height);else{let Te=ue.width,$e=ue.height;for(let lt=0;lt<Qe;lt++)t.texImage2D(3553,lt,U,Te,$e,0,st,Ee,null),Te>>=1,$e>>=1}}else if(De.length>0&&rt){Ze&&Oe&&t.texStorage2D(3553,Qe,U,De[0].width,De[0].height);for(let Te=0,$e=De.length;Te<$e;Te++)Me=De[Te],Ze?t.texSubImage2D(3553,Te,0,0,st,Ee,Me):t.texImage2D(3553,Te,U,st,Ee,Me);D.generateMipmaps=!1}else Ze?(Oe&&t.texStorage2D(3553,Qe,U,ue.width,ue.height),t.texSubImage2D(3553,0,0,0,st,Ee,ue)):t.texImage2D(3553,0,U,st,Ee,ue);T(D,rt)&&A(ye),Ie.__currentVersion=Ie.version,D.onUpdate&&D.onUpdate(D)}L.__version=D.version}function le(L,D,re){if(D.image.length!==6)return;let ye=ge(L,D),Se=D.source;if(t.activeTexture(33984+re),t.bindTexture(34067,L.__webglTexture),Se.version!==Se.__currentVersion||ye===!0){i.pixelStorei(37440,D.flipY),i.pixelStorei(37441,D.premultiplyAlpha),i.pixelStorei(3317,D.unpackAlignment),i.pixelStorei(37443,0);let Ie=D.isCompressedTexture||D.image[0].isCompressedTexture,Fe=D.image[0]&&D.image[0].isDataTexture,ue=[];for(let Te=0;Te<6;Te++)!Ie&&!Fe?ue[Te]=w(D.image[Te],!1,!0,c):ue[Te]=Fe?D.image[Te].image:D.image[Te],ue[Te]=ke(D,ue[Te]);let rt=ue[0],st=b(rt)||a,Ee=s.convert(D.format,D.encoding),U=s.convert(D.type),Me=x(D.internalFormat,Ee,U,D.encoding),De=a&&D.isVideoTexture!==!0,Ze=L.__version===void 0,Oe=E(D,rt,st);W(34067,D,st);let Qe;if(Ie){De&&Ze&&t.texStorage2D(34067,Oe,Me,rt.width,rt.height);for(let Te=0;Te<6;Te++){Qe=ue[Te].mipmaps;for(let $e=0;$e<Qe.length;$e++){let lt=Qe[$e];D.format!==Fn?Ee!==null?De?t.compressedTexSubImage2D(34069+Te,$e,0,0,lt.width,lt.height,Ee,lt.data):t.compressedTexImage2D(34069+Te,$e,Me,lt.width,lt.height,0,lt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):De?t.texSubImage2D(34069+Te,$e,0,0,lt.width,lt.height,Ee,U,lt.data):t.texImage2D(34069+Te,$e,Me,lt.width,lt.height,0,Ee,U,lt.data)}}}else{Qe=D.mipmaps,De&&Ze&&(Qe.length>0&&Oe++,t.texStorage2D(34067,Oe,Me,ue[0].width,ue[0].height));for(let Te=0;Te<6;Te++)if(Fe){De?t.texSubImage2D(34069+Te,0,0,0,ue[Te].width,ue[Te].height,Ee,U,ue[Te].data):t.texImage2D(34069+Te,0,Me,ue[Te].width,ue[Te].height,0,Ee,U,ue[Te].data);for(let $e=0;$e<Qe.length;$e++){let dt=Qe[$e].image[Te].image;De?t.texSubImage2D(34069+Te,$e+1,0,0,dt.width,dt.height,Ee,U,dt.data):t.texImage2D(34069+Te,$e+1,Me,dt.width,dt.height,0,Ee,U,dt.data)}}else{De?t.texSubImage2D(34069+Te,0,0,0,Ee,U,ue[Te]):t.texImage2D(34069+Te,0,Me,Ee,U,ue[Te]);for(let $e=0;$e<Qe.length;$e++){let lt=Qe[$e];De?t.texSubImage2D(34069+Te,$e+1,0,0,Ee,U,lt.image[Te]):t.texImage2D(34069+Te,$e+1,Me,Ee,U,lt.image[Te])}}}T(D,st)&&A(34067),Se.__currentVersion=Se.version,D.onUpdate&&D.onUpdate(D)}L.__version=D.version}function H(L,D,re,ye,Se){let Ie=s.convert(re.format,re.encoding),Fe=s.convert(re.type),ue=x(re.internalFormat,Ie,Fe,re.encoding);r.get(D).__hasExternalTextures||(Se===32879||Se===35866?t.texImage3D(Se,0,ue,D.width,D.height,D.depth,0,Ie,Fe,null):t.texImage2D(Se,0,ue,D.width,D.height,0,Ie,Fe,null)),t.bindFramebuffer(36160,L),me(D)?f.framebufferTexture2DMultisampleEXT(36160,ye,Se,r.get(re).__webglTexture,0,ve(D)):i.framebufferTexture2D(36160,ye,Se,r.get(re).__webglTexture,0),t.bindFramebuffer(36160,null)}function he(L,D,re){if(i.bindRenderbuffer(36161,L),D.depthBuffer&&!D.stencilBuffer){let ye=33189;if(re||me(D)){let Se=D.depthTexture;Se&&Se.isDepthTexture&&(Se.type===Ds?ye=36012:Se.type===La&&(ye=33190));let Ie=ve(D);me(D)?f.renderbufferStorageMultisampleEXT(36161,Ie,ye,D.width,D.height):i.renderbufferStorageMultisample(36161,Ie,ye,D.width,D.height)}else i.renderbufferStorage(36161,ye,D.width,D.height);i.framebufferRenderbuffer(36160,36096,36161,L)}else if(D.depthBuffer&&D.stencilBuffer){let ye=ve(D);re&&me(D)===!1?i.renderbufferStorageMultisample(36161,ye,35056,D.width,D.height):me(D)?f.renderbufferStorageMultisampleEXT(36161,ye,35056,D.width,D.height):i.renderbufferStorage(36161,34041,D.width,D.height),i.framebufferRenderbuffer(36160,33306,36161,L)}else{let ye=D.isWebGLMultipleRenderTargets===!0?D.texture[0]:D.texture,Se=s.convert(ye.format,ye.encoding),Ie=s.convert(ye.type),Fe=x(ye.internalFormat,Se,Ie,ye.encoding),ue=ve(D);re&&me(D)===!1?i.renderbufferStorageMultisample(36161,ue,Fe,D.width,D.height):me(D)?f.renderbufferStorageMultisampleEXT(36161,ue,Fe,D.width,D.height):i.renderbufferStorage(36161,Fe,D.width,D.height)}i.bindRenderbuffer(36161,null)}function K(L,D){if(D&&D.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,L),!(D.depthTexture&&D.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(D.depthTexture).__webglTexture||D.depthTexture.image.width!==D.width||D.depthTexture.image.height!==D.height)&&(D.depthTexture.image.width=D.width,D.depthTexture.image.height=D.height,D.depthTexture.needsUpdate=!0),F(D.depthTexture,0);let ye=r.get(D.depthTexture).__webglTexture,Se=ve(D);if(D.depthTexture.format===Eo)me(D)?f.framebufferTexture2DMultisampleEXT(36160,36096,3553,ye,0,Se):i.framebufferTexture2D(36160,36096,3553,ye,0);else if(D.depthTexture.format===Ns)me(D)?f.framebufferTexture2DMultisampleEXT(36160,33306,3553,ye,0,Se):i.framebufferTexture2D(36160,33306,3553,ye,0);else throw new Error("Unknown depthTexture format")}function V(L){let D=r.get(L),re=L.isWebGLCubeRenderTarget===!0;if(L.depthTexture&&!D.__autoAllocateDepthBuffer){if(re)throw new Error("target.depthTexture not supported in Cube render targets");K(D.__webglFramebuffer,L)}else if(re){D.__webglDepthbuffer=[];for(let ye=0;ye<6;ye++)t.bindFramebuffer(36160,D.__webglFramebuffer[ye]),D.__webglDepthbuffer[ye]=i.createRenderbuffer(),he(D.__webglDepthbuffer[ye],L,!1)}else t.bindFramebuffer(36160,D.__webglFramebuffer),D.__webglDepthbuffer=i.createRenderbuffer(),he(D.__webglDepthbuffer,L,!1);t.bindFramebuffer(36160,null)}function Z(L,D,re){let ye=r.get(L);D!==void 0&&H(ye.__webglFramebuffer,L,L.texture,36064,3553),re!==void 0&&V(L)}function ce(L){let D=L.texture,re=r.get(L),ye=r.get(D);L.addEventListener("dispose",I),L.isWebGLMultipleRenderTargets!==!0&&(ye.__webglTexture===void 0&&(ye.__webglTexture=i.createTexture()),ye.__version=D.version,o.memory.textures++);let Se=L.isWebGLCubeRenderTarget===!0,Ie=L.isWebGLMultipleRenderTargets===!0,Fe=b(L)||a;if(Se){re.__webglFramebuffer=[];for(let ue=0;ue<6;ue++)re.__webglFramebuffer[ue]=i.createFramebuffer()}else if(re.__webglFramebuffer=i.createFramebuffer(),Ie)if(n.drawBuffers){let ue=L.texture;for(let rt=0,st=ue.length;rt<st;rt++){let Ee=r.get(ue[rt]);Ee.__webglTexture===void 0&&(Ee.__webglTexture=i.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(a&&L.samples>0&&me(L)===!1){re.__webglMultisampledFramebuffer=i.createFramebuffer(),re.__webglColorRenderbuffer=i.createRenderbuffer(),i.bindRenderbuffer(36161,re.__webglColorRenderbuffer);let ue=s.convert(D.format,D.encoding),rt=s.convert(D.type),st=x(D.internalFormat,ue,rt,D.encoding),Ee=ve(L);i.renderbufferStorageMultisample(36161,Ee,st,L.width,L.height),t.bindFramebuffer(36160,re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(36160,36064,36161,re.__webglColorRenderbuffer),i.bindRenderbuffer(36161,null),L.depthBuffer&&(re.__webglDepthRenderbuffer=i.createRenderbuffer(),he(re.__webglDepthRenderbuffer,L,!0)),t.bindFramebuffer(36160,null)}if(Se){t.bindTexture(34067,ye.__webglTexture),W(34067,D,Fe);for(let ue=0;ue<6;ue++)H(re.__webglFramebuffer[ue],L,D,36064,34069+ue);T(D,Fe)&&A(34067),t.unbindTexture()}else if(Ie){let ue=L.texture;for(let rt=0,st=ue.length;rt<st;rt++){let Ee=ue[rt],U=r.get(Ee);t.bindTexture(3553,U.__webglTexture),W(3553,Ee,Fe),H(re.__webglFramebuffer,L,Ee,36064+rt,3553),T(Ee,Fe)&&A(3553)}t.unbindTexture()}else{let ue=3553;(L.isWebGL3DRenderTarget||L.isWebGLArrayRenderTarget)&&(a?ue=L.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(ue,ye.__webglTexture),W(ue,D,Fe),H(re.__webglFramebuffer,L,D,36064,ue),T(D,Fe)&&A(ue),t.unbindTexture()}L.depthBuffer&&V(L)}function se(L){let D=b(L)||a,re=L.isWebGLMultipleRenderTargets===!0?L.texture:[L.texture];for(let ye=0,Se=re.length;ye<Se;ye++){let Ie=re[ye];if(T(Ie,D)){let Fe=L.isWebGLCubeRenderTarget?34067:3553,ue=r.get(Ie).__webglTexture;t.bindTexture(Fe,ue),A(Fe),t.unbindTexture()}}}function pe(L){if(a&&L.samples>0&&me(L)===!1){let D=L.width,re=L.height,ye=16384,Se=[36064],Ie=L.stencilBuffer?33306:36096;L.depthBuffer&&Se.push(Ie);let Fe=r.get(L),ue=Fe.__ignoreDepthValues!==void 0?Fe.__ignoreDepthValues:!1;ue===!1&&(L.depthBuffer&&(ye|=256),L.stencilBuffer&&(ye|=1024)),t.bindFramebuffer(36008,Fe.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,Fe.__webglFramebuffer),ue===!0&&(i.invalidateFramebuffer(36008,[Ie]),i.invalidateFramebuffer(36009,[Ie])),i.blitFramebuffer(0,0,D,re,0,0,D,re,ye,9728),d&&i.invalidateFramebuffer(36008,Se),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,Fe.__webglMultisampledFramebuffer)}}function ve(L){return Math.min(u,L.samples)}function me(L){let D=r.get(L);return a&&L.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&D.__useRenderToTexture!==!1}function Pe(L){let D=o.render.frame;p.get(L)!==D&&(p.set(L,D),L.update())}function ke(L,D){let re=L.encoding,ye=L.format,Se=L.type;return L.isCompressedTexture===!0||L.isVideoTexture===!0||L.format===sg||re!==gn&&(re===je?a===!1?e.has("EXT_sRGB")===!0&&ye===Fn?(L.format=sg,L.minFilter=ct,L.generateMipmaps=!1):D=ns.sRGBToLinear(D):(ye!==Fn||Se!==qt)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",re)),D}this.allocateTextureUnit=Q,this.resetTextureUnits=te,this.setTexture2D=F,this.setTexture2DArray=z,this.setTexture3D=O,this.setTextureCube=j,this.rebindTextures=Z,this.setupRenderTarget=ce,this.updateRenderTargetMipmap=se,this.updateMultisampleRenderTarget=pe,this.setupDepthRenderbuffer=V,this.setupFrameBufferTexture=H,this.useMultisampledRTT=me}function EL(i,e,t){let r=t.isWebGL2;function n(s,o=null){let a;if(s===qt)return 5121;if(s===gE)return 32819;if(s===yE)return 32820;if(s===dE)return 5120;if(s===pE)return 5122;if(s===kc)return 5123;if(s===mE)return 5124;if(s===La)return 5125;if(s===Ds)return 5126;if(s===Vc)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===vE)return 6406;if(s===Fn)return 6408;if(s===bE)return 6409;if(s===wE)return 6410;if(s===Eo)return 6402;if(s===Ns)return 34041;if(s===SE)return 6403;if(s===xE)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===sg)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===ME)return 36244;if(s===AE)return 33319;if(s===TE)return 33320;if(s===EE)return 36249;if(s===ym||s===vm||s===xm||s===bm)if(o===je)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===ym)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===vm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===xm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===bm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===ym)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===vm)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===xm)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===bm)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Bx||s===Nx||s===Ox||s===Fx)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===Bx)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Nx)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Ox)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Fx)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===_E)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Ux||s===zx)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===Ux)return o===je?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===zx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Gx||s===kx||s===Vx||s===Hx||s===Wx||s===jx||s===qx||s===Yx||s===Xx||s===Qx||s===Jx||s===Kx||s===Zx||s===$x)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Gx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===kx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Vx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Hx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Wx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===jx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===qx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Yx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Xx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Qx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Jx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Kx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===Zx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===$x)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===e0)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===e0)return o===je?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return s===Ls?r?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):i[s]!==void 0?i[s]:null}return{convert:n}}var bf=class extends sr{constructor(e=[]){super(),this.cameras=e}};bf.prototype.isArrayCamera=!0;var ts=class extends ot{constructor(){super(),this.type="Group"}};ts.prototype.isGroup=!0;var _L={type:"move"},Uc=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ts,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 ts,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new M,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new M),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ts,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new M,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new M),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,r){let n=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(n=t.getPose(e.targetRaySpace,r),n!==null&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(_L))),c&&e.hand){o=!0;for(let m of e.hand.values()){let g=t.getJointPose(m,r);if(c.joints[m.jointName]===void 0){let y=new ts;y.matrixAutoUpdate=!1,y.visible=!1,c.joints[m.jointName]=y,c.add(y)}let v=c.joints[m.jointName];g!==null&&(v.matrix.fromArray(g.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.jointRadius=g.radius),v.visible=g!==null}let h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],f=h.position.distanceTo(u.position),d=.02,p=.005;c.inputState.pinching&&f>d+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),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=n!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}},oi=class extends Dt{constructor(e,t,r,n,s,o,a,l,c,h){if(h=h!==void 0?h:Eo,h!==Eo&&h!==Ns)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&h===Eo&&(r=kc),r===void 0&&h===Ns&&(r=Ls),super(null,n,s,o,a,l,h,r,c),this.image={width:e,height:t},this.magFilter=a!==void 0?a:hr,this.minFilter=l!==void 0?l:hr,this.flipY=!1,this.generateMipmaps=!1}};oi.prototype.isDepthTexture=!0;var pg=class extends Yt{constructor(e,t){super();let r=this,n=null,s=1,o=null,a="local-floor",l=null,c=null,h=null,u=null,f=null,d=null,p=t.getContextAttributes(),m=null,g=null,v=[],y=new Map,w=new sr;w.layers.enable(1),w.viewport=new Je;let b=new sr;b.layers.enable(2),b.viewport=new Je;let S=[w,b],T=new bf;T.layers.enable(1),T.layers.enable(2);let A=null,x=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let F=v[Y];return F===void 0&&(F=new Uc,v[Y]=F),F.getTargetRaySpace()},this.getControllerGrip=function(Y){let F=v[Y];return F===void 0&&(F=new Uc,v[Y]=F),F.getGripSpace()},this.getHand=function(Y){let F=v[Y];return F===void 0&&(F=new Uc,v[Y]=F),F.getHandSpace()};function E(Y){let F=y.get(Y.inputSource);F&&F.dispatchEvent({type:Y.type,data:Y.inputSource})}function _(){y.forEach(function(Y,F){Y.disconnect(F)}),y.clear(),A=null,x=null,e.setRenderTarget(m),f=null,u=null,h=null,n=null,g=null,Q.stop(),r.isPresenting=!1,r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){s=Y,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){a=Y,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(Y){l=Y},this.getBaseLayer=function(){return u!==null?u:f},this.getBinding=function(){return h},this.getFrame=function(){return d},this.getSession=function(){return n},this.setSession=async function(Y){if(n=Y,n!==null){if(m=e.getRenderTarget(),n.addEventListener("select",E),n.addEventListener("selectstart",E),n.addEventListener("selectend",E),n.addEventListener("squeeze",E),n.addEventListener("squeezestart",E),n.addEventListener("squeezeend",E),n.addEventListener("end",_),n.addEventListener("inputsourceschange",C),p.xrCompatible!==!0&&await t.makeXRCompatible(),n.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let F={antialias:n.renderState.layers===void 0?p.antialias:!0,alpha:p.alpha,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(n,t,F),n.updateRenderState({baseLayer:f}),g=new mt(f.framebufferWidth,f.framebufferHeight,{format:Fn,type:qt,encoding:e.outputEncoding})}else{let F=null,z=null,O=null;p.depth&&(O=p.stencil?35056:33190,F=p.stencil?Ns:Eo,z=p.stencil?Ls:kc);let j={colorFormat:e.outputEncoding===je?35907:32856,depthFormat:O,scaleFactor:s};h=new XRWebGLBinding(n,t),u=h.createProjectionLayer(j),n.updateRenderState({layers:[u]}),g=new mt(u.textureWidth,u.textureHeight,{format:Fn,type:qt,depthTexture:new oi(u.textureWidth,u.textureHeight,z,void 0,void 0,void 0,void 0,void 0,void 0,F),stencilBuffer:p.stencil,encoding:e.outputEncoding,samples:p.antialias?4:0});let q=e.properties.get(g);q.__ignoreDepthValues=u.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(1),o=await n.requestReferenceSpace(a),Q.setContext(n),Q.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}};function C(Y){let F=n.inputSources;for(let z=0;z<F.length;z++){let O=F[z].handedness==="right"?1:0;y.set(F[z],v[O])}for(let z=0;z<Y.removed.length;z++){let O=Y.removed[z],j=y.get(O);j&&(j.dispatchEvent({type:"disconnected",data:O}),y.delete(O))}for(let z=0;z<Y.added.length;z++){let O=Y.added[z],j=y.get(O);j&&j.dispatchEvent({type:"connected",data:O})}}let I=new M,N=new M;function R(Y,F,z){I.setFromMatrixPosition(F.matrixWorld),N.setFromMatrixPosition(z.matrixWorld);let O=I.distanceTo(N),j=F.projectionMatrix.elements,q=z.projectionMatrix.elements,J=j[14]/(j[10]-1),W=j[14]/(j[10]+1),ge=(j[9]+1)/j[5],oe=(j[9]-1)/j[5],le=(j[8]-1)/j[0],H=(q[8]+1)/q[0],he=J*le,K=J*H,V=O/(-le+H),Z=V*-le;F.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(Z),Y.translateZ(V),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert();let ce=J+V,se=W+V,pe=he-Z,ve=K+(O-Z),me=ge*W/se*ce,Pe=oe*W/se*ce;Y.projectionMatrix.makePerspective(pe,ve,me,Pe,ce,se)}function k(Y,F){F===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(F.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(n===null)return;T.near=b.near=w.near=Y.near,T.far=b.far=w.far=Y.far,(A!==T.near||x!==T.far)&&(n.updateRenderState({depthNear:T.near,depthFar:T.far}),A=T.near,x=T.far);let F=Y.parent,z=T.cameras;k(T,F);for(let j=0;j<z.length;j++)k(z[j],F);T.matrixWorld.decompose(T.position,T.quaternion,T.scale),Y.position.copy(T.position),Y.quaternion.copy(T.quaternion),Y.scale.copy(T.scale),Y.matrix.copy(T.matrix),Y.matrixWorld.copy(T.matrixWorld);let O=Y.children;for(let j=0,q=O.length;j<q;j++)O[j].updateMatrixWorld(!0);z.length===2?R(T,w,b):T.projectionMatrix.copy(w.projectionMatrix)},this.getCamera=function(){return T},this.getFoveation=function(){if(u!==null)return u.fixedFoveation;if(f!==null)return f.fixedFoveation},this.setFoveation=function(Y){u!==null&&(u.fixedFoveation=Y),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=Y)};let G=null;function te(Y,F){if(c=F.getViewerPose(l||o),d=F,c!==null){let O=c.views;f!==null&&(e.setRenderTargetFramebuffer(g,f.framebuffer),e.setRenderTarget(g));let j=!1;O.length!==T.cameras.length&&(T.cameras.length=0,j=!0);for(let q=0;q<O.length;q++){let J=O[q],W=null;if(f!==null)W=f.getViewport(J);else{let oe=h.getViewSubImage(u,J);W=oe.viewport,q===0&&(e.setRenderTargetTextures(g,oe.colorTexture,u.ignoreDepthValues?void 0:oe.depthStencilTexture),e.setRenderTarget(g))}let ge=S[q];ge.matrix.fromArray(J.transform.matrix),ge.projectionMatrix.fromArray(J.projectionMatrix),ge.viewport.set(W.x,W.y,W.width,W.height),q===0&&T.matrix.copy(ge.matrix),j===!0&&T.cameras.push(ge)}}let z=n.inputSources;for(let O=0;O<v.length;O++){let j=z[O],q=y.get(j);q!==void 0&&q.update(j,F,l||o)}G&&G(Y,F),d=null}let Q=new bb;Q.setAnimationLoop(te),this.setAnimationLoop=function(Y){G=Y},this.dispose=function(){}}};function CL(i,e){function t(m,g){m.fogColor.value.copy(g.color),g.isFog?(m.fogNear.value=g.near,m.fogFar.value=g.far):g.isFogExp2&&(m.fogDensity.value=g.density)}function r(m,g,v,y,w){g.isMeshBasicMaterial||g.isMeshLambertMaterial?n(m,g):g.isMeshToonMaterial?(n(m,g),h(m,g)):g.isMeshPhongMaterial?(n(m,g),c(m,g)):g.isMeshStandardMaterial?(n(m,g),u(m,g),g.isMeshPhysicalMaterial&&f(m,g,w)):g.isMeshMatcapMaterial?(n(m,g),d(m,g)):g.isMeshDepthMaterial?n(m,g):g.isMeshDistanceMaterial?(n(m,g),p(m,g)):g.isMeshNormalMaterial?n(m,g):g.isLineBasicMaterial?(s(m,g),g.isLineDashedMaterial&&o(m,g)):g.isPointsMaterial?a(m,g,v,y):g.isSpriteMaterial?l(m,g):g.isShadowMaterial?(m.color.value.copy(g.color),m.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function n(m,g){m.opacity.value=g.opacity,g.color&&m.diffuse.value.copy(g.color),g.emissive&&m.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.bumpMap&&(m.bumpMap.value=g.bumpMap,m.bumpScale.value=g.bumpScale,g.side===Pr&&(m.bumpScale.value*=-1)),g.displacementMap&&(m.displacementMap.value=g.displacementMap,m.displacementScale.value=g.displacementScale,m.displacementBias.value=g.displacementBias),g.emissiveMap&&(m.emissiveMap.value=g.emissiveMap),g.normalMap&&(m.normalMap.value=g.normalMap,m.normalScale.value.copy(g.normalScale),g.side===Pr&&m.normalScale.value.negate()),g.specularMap&&(m.specularMap.value=g.specularMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let v=e.get(g).envMap;if(v&&(m.envMap.value=v,m.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=g.reflectivity,m.ior.value=g.ior,m.refractionRatio.value=g.refractionRatio),g.lightMap){m.lightMap.value=g.lightMap;let b=i.physicallyCorrectLights!==!0?Math.PI:1;m.lightMapIntensity.value=g.lightMapIntensity*b}g.aoMap&&(m.aoMap.value=g.aoMap,m.aoMapIntensity.value=g.aoMapIntensity);let y;g.map?y=g.map:g.specularMap?y=g.specularMap:g.displacementMap?y=g.displacementMap:g.normalMap?y=g.normalMap:g.bumpMap?y=g.bumpMap:g.roughnessMap?y=g.roughnessMap:g.metalnessMap?y=g.metalnessMap:g.alphaMap?y=g.alphaMap:g.emissiveMap?y=g.emissiveMap:g.clearcoatMap?y=g.clearcoatMap:g.clearcoatNormalMap?y=g.clearcoatNormalMap:g.clearcoatRoughnessMap?y=g.clearcoatRoughnessMap:g.specularIntensityMap?y=g.specularIntensityMap:g.specularColorMap?y=g.specularColorMap:g.transmissionMap?y=g.transmissionMap:g.thicknessMap?y=g.thicknessMap:g.sheenColorMap?y=g.sheenColorMap:g.sheenRoughnessMap&&(y=g.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),m.uvTransform.value.copy(y.matrix));let w;g.aoMap?w=g.aoMap:g.lightMap&&(w=g.lightMap),w!==void 0&&(w.isWebGLRenderTarget&&(w=w.texture),w.matrixAutoUpdate===!0&&w.updateMatrix(),m.uv2Transform.value.copy(w.matrix))}function s(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity}function o(m,g){m.dashSize.value=g.dashSize,m.totalSize.value=g.dashSize+g.gapSize,m.scale.value=g.scale}function a(m,g,v,y){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.size.value=g.size*v,m.scale.value=y*.5,g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let w;g.map?w=g.map:g.alphaMap&&(w=g.alphaMap),w!==void 0&&(w.matrixAutoUpdate===!0&&w.updateMatrix(),m.uvTransform.value.copy(w.matrix))}function l(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.rotation.value=g.rotation,g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let v;g.map?v=g.map:g.alphaMap&&(v=g.alphaMap),v!==void 0&&(v.matrixAutoUpdate===!0&&v.updateMatrix(),m.uvTransform.value.copy(v.matrix))}function c(m,g){m.specular.value.copy(g.specular),m.shininess.value=Math.max(g.shininess,1e-4)}function h(m,g){g.gradientMap&&(m.gradientMap.value=g.gradientMap)}function u(m,g){m.roughness.value=g.roughness,m.metalness.value=g.metalness,g.roughnessMap&&(m.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(m.metalnessMap.value=g.metalnessMap),e.get(g).envMap&&(m.envMapIntensity.value=g.envMapIntensity)}function f(m,g,v){m.ior.value=g.ior,g.sheen>0&&(m.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),m.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(m.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(m.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(m.clearcoat.value=g.clearcoat,m.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(m.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(m.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),m.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===Pr&&m.clearcoatNormalScale.value.negate())),g.transmission>0&&(m.transmission.value=g.transmission,m.transmissionSamplerMap.value=v.texture,m.transmissionSamplerSize.value.set(v.width,v.height),g.transmissionMap&&(m.transmissionMap.value=g.transmissionMap),m.thickness.value=g.thickness,g.thicknessMap&&(m.thicknessMap.value=g.thicknessMap),m.attenuationDistance.value=g.attenuationDistance,m.attenuationColor.value.copy(g.attenuationColor)),m.specularIntensity.value=g.specularIntensity,m.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(m.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(m.specularColorMap.value=g.specularColorMap)}function d(m,g){g.matcap&&(m.matcap.value=g.matcap)}function p(m,g){m.referencePosition.value.copy(g.referencePosition),m.nearDistance.value=g.nearDistance,m.farDistance.value=g.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:r}}function DL(){let i=jc("canvas");return i.style.display="block",i}function Pt(i={}){let e=i.canvas!==void 0?i.canvas:DL(),t=i.context!==void 0?i.context:null,r=i.depth!==void 0?i.depth:!0,n=i.stencil!==void 0?i.stencil:!0,s=i.antialias!==void 0?i.antialias:!1,o=i.premultipliedAlpha!==void 0?i.premultipliedAlpha:!0,a=i.preserveDrawingBuffer!==void 0?i.preserveDrawingBuffer:!1,l=i.powerPreference!==void 0?i.powerPreference:"default",c=i.failIfMajorPerformanceCaveat!==void 0?i.failIfMajorPerformanceCaveat:!1,h;t!==null?h=t.getContextAttributes().alpha:h=i.alpha!==void 0?i.alpha:!1;let u=null,f=null,d=[],p=[];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=gn,this.physicallyCorrectLights=!1,this.toneMapping=rs,this.toneMappingExposure=1;let m=this,g=!1,v=0,y=0,w=null,b=-1,S=null,T=new Je,A=new Je,x=null,E=e.width,_=e.height,C=1,I=null,N=null,R=new Je(0,0,E,_),k=new Je(0,0,E,_),G=!1,te=new Na,Q=!1,Y=!1,F=null,z=new Ae,O=new B,j=new M,q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function J(){return w===null?C:1}let W=t;function ge(P,X){for(let ne=0;ne<P.length;ne++){let ee=P[ne],fe=e.getContext(ee,X);if(fe!==null)return fe}return null}try{let P={alpha:!0,depth:r,stencil:n,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:a,powerPreference:l,failIfMajorPerformanceCaveat:c};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Uo}`),e.addEventListener("webglcontextlost",U,!1),e.addEventListener("webglcontextrestored",Me,!1),W===null){let X=["webgl2","webgl","experimental-webgl"];if(m.isWebGL1Renderer===!0&&X.shift(),W=ge(X,P),W===null)throw ge(X)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}W.getShaderPrecisionFormat===void 0&&(W.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(P){throw console.error("THREE.WebGLRenderer: "+P.message),P}let oe,le,H,he,K,V,Z,ce,se,pe,ve,me,Pe,ke,L,D,re,ye,Se,Ie,Fe,ue,rt;function st(){oe=new QD(W),le=new HD(W,oe,i),oe.init(le),ue=new EL(W,oe,le),H=new AL(W,oe,le),he=new ZD(W),K=new dL,V=new TL(W,oe,H,K,le,ue,he),Z=new jD(m),ce=new XD(m),se=new f_(W,le),rt=new kD(W,oe,se,le),pe=new JD(W,se,he,rt),ve=new rP(W,pe,se,he),Se=new tP(W,le,V),D=new WD(K),me=new fL(m,Z,ce,oe,le,rt,D),Pe=new CL(m,K),ke=new mL,L=new wL(oe,le),ye=new GD(m,Z,H,ve,h,o),re=new _b(m,ve,le),Ie=new VD(W,oe,he,le),Fe=new KD(W,oe,he,le),he.programs=me.programs,m.capabilities=le,m.extensions=oe,m.properties=K,m.renderLists=ke,m.shadowMap=re,m.state=H,m.info=he}st();let Ee=new pg(m,W);this.xr=Ee,this.getContext=function(){return W},this.getContextAttributes=function(){return W.getContextAttributes()},this.forceContextLoss=function(){let P=oe.get("WEBGL_lose_context");P&&P.loseContext()},this.forceContextRestore=function(){let P=oe.get("WEBGL_lose_context");P&&P.restoreContext()},this.getPixelRatio=function(){return C},this.setPixelRatio=function(P){P!==void 0&&(C=P,this.setSize(E,_,!1))},this.getSize=function(P){return P.set(E,_)},this.setSize=function(P,X,ne){if(Ee.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}E=P,_=X,e.width=Math.floor(P*C),e.height=Math.floor(X*C),ne!==!1&&(e.style.width=P+"px",e.style.height=X+"px"),this.setViewport(0,0,P,X)},this.getDrawingBufferSize=function(P){return P.set(E*C,_*C).floor()},this.setDrawingBufferSize=function(P,X,ne){E=P,_=X,C=ne,e.width=Math.floor(P*ne),e.height=Math.floor(X*ne),this.setViewport(0,0,P,X)},this.getCurrentViewport=function(P){return P.copy(T)},this.getViewport=function(P){return P.copy(R)},this.setViewport=function(P,X,ne,ee){P.isVector4?R.set(P.x,P.y,P.z,P.w):R.set(P,X,ne,ee),H.viewport(T.copy(R).multiplyScalar(C).floor())},this.getScissor=function(P){return P.copy(k)},this.setScissor=function(P,X,ne,ee){P.isVector4?k.set(P.x,P.y,P.z,P.w):k.set(P,X,ne,ee),H.scissor(A.copy(k).multiplyScalar(C).floor())},this.getScissorTest=function(){return G},this.setScissorTest=function(P){H.setScissorTest(G=P)},this.setOpaqueSort=function(P){I=P},this.setTransparentSort=function(P){N=P},this.getClearColor=function(P){return P.copy(ye.getClearColor())},this.setClearColor=function(){ye.setClearColor.apply(ye,arguments)},this.getClearAlpha=function(){return ye.getClearAlpha()},this.setClearAlpha=function(){ye.setClearAlpha.apply(ye,arguments)},this.clear=function(P=!0,X=!0,ne=!0){let ee=0;P&&(ee|=16384),X&&(ee|=256),ne&&(ee|=1024),W.clear(ee)},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",U,!1),e.removeEventListener("webglcontextrestored",Me,!1),ke.dispose(),L.dispose(),K.dispose(),Z.dispose(),ce.dispose(),ve.dispose(),rt.dispose(),me.dispose(),Ee.dispose(),Ee.removeEventListener("sessionstart",$e),Ee.removeEventListener("sessionend",lt),F&&(F.dispose(),F=null),dt.stop()};function U(P){P.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function Me(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;let P=he.autoReset,X=re.enabled,ne=re.autoUpdate,ee=re.needsUpdate,fe=re.type;st(),he.autoReset=P,re.enabled=X,re.autoUpdate=ne,re.needsUpdate=ee,re.type=fe}function De(P){let X=P.target;X.removeEventListener("dispose",De),Ze(X)}function Ze(P){Oe(P),K.remove(P)}function Oe(P){let X=K.get(P).programs;X!==void 0&&(X.forEach(function(ne){me.releaseProgram(ne)}),P.isShaderMaterial&&me.releaseShaderCache(P))}this.renderBufferDirect=function(P,X,ne,ee,fe,Ue){X===null&&(X=q);let He=fe.isMesh&&fe.matrixWorld.determinant()<0,nt=pt(P,X,ne,ee,fe);H.setMaterial(ee,He);let it=ne.index,Et=ne.attributes.position;if(it===null){if(Et===void 0||Et.count===0)return}else if(it.count===0)return;let St=1;ee.wireframe===!0&&(it=pe.getWireframeAttribute(ne),St=2),rt.setup(fe,ee,nt,ne,it);let _t,nr=Ie;it!==null&&(_t=se.get(it),nr=Fe,nr.setIndex(_t));let xo=it!==null?it.count:Et.count,sa=ne.drawRange.start*St,oa=ne.drawRange.count*St,wi=Ue!==null?Ue.start*St:0,Rt=Ue!==null?Ue.count*St:1/0,aa=Math.max(sa,wi),yr=Math.min(xo,sa+oa,wi+Rt)-1,Si=Math.max(0,yr-aa+1);if(Si!==0){if(fe.isMesh)ee.wireframe===!0?(H.setLineWidth(ee.wireframeLinewidth*J()),nr.setMode(1)):nr.setMode(4);else if(fe.isLine){let bs=ee.linewidth;bs===void 0&&(bs=1),H.setLineWidth(bs*J()),fe.isLineSegments?nr.setMode(1):fe.isLineLoop?nr.setMode(2):nr.setMode(3)}else fe.isPoints?nr.setMode(0):fe.isSprite&&nr.setMode(4);if(fe.isInstancedMesh)nr.renderInstances(aa,Si,fe.count);else if(ne.isInstancedBufferGeometry){let bs=Math.min(ne.instanceCount,ne._maxInstanceCount);nr.renderInstances(aa,Si,bs)}else nr.render(aa,Si)}},this.compile=function(P,X){f=L.get(P),f.init(),p.push(f),P.traverseVisible(function(ne){ne.isLight&&ne.layers.test(X.layers)&&(f.pushLight(ne),ne.castShadow&&f.pushShadow(ne))}),f.setupLights(m.physicallyCorrectLights),P.traverse(function(ne){let ee=ne.material;if(ee)if(Array.isArray(ee))for(let fe=0;fe<ee.length;fe++){let Ue=ee[fe];ut(Ue,P,ne)}else ut(ee,P,ne)}),p.pop(),f=null};let Qe=null;function Te(P){Qe&&Qe(P)}function $e(){dt.stop()}function lt(){dt.start()}let dt=new bb;dt.setAnimationLoop(Te),typeof self<"u"&&dt.setContext(self),this.setAnimationLoop=function(P){Qe=P,Ee.setAnimationLoop(P),P===null?dt.stop():dt.start()},Ee.addEventListener("sessionstart",$e),Ee.addEventListener("sessionend",lt),this.render=function(P,X){if(X!==void 0&&X.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(g===!0)return;P.autoUpdate===!0&&P.updateMatrixWorld(),X.parent===null&&X.updateMatrixWorld(),Ee.enabled===!0&&Ee.isPresenting===!0&&(Ee.cameraAutoUpdate===!0&&Ee.updateCamera(X),X=Ee.getCamera()),P.isScene===!0&&P.onBeforeRender(m,P,X,w),f=L.get(P,p.length),f.init(),p.push(f),z.multiplyMatrices(X.projectionMatrix,X.matrixWorldInverse),te.setFromProjectionMatrix(z),Y=this.localClippingEnabled,Q=D.init(this.clippingPlanes,Y,X),u=ke.get(P,d.length),u.init(),d.push(u),Ut(P,X,0,m.sortObjects),u.finish(),m.sortObjects===!0&&u.sort(I,N),Q===!0&&D.beginShadows();let ne=f.state.shadowsArray;if(re.render(ne,P,X),Q===!0&&D.endShadows(),this.info.autoReset===!0&&this.info.reset(),ye.render(u,P),f.setupLights(m.physicallyCorrectLights),X.isArrayCamera){let ee=X.cameras;for(let fe=0,Ue=ee.length;fe<Ue;fe++){let He=ee[fe];Ur(u,P,He,He.viewport)}}else Ur(u,P,X);w!==null&&(V.updateMultisampleRenderTarget(w),V.updateRenderTargetMipmap(w)),P.isScene===!0&&P.onAfterRender(m,P,X),rt.resetDefaultState(),b=-1,S=null,p.pop(),p.length>0?f=p[p.length-1]:f=null,d.pop(),d.length>0?u=d[d.length-1]:u=null};function Ut(P,X,ne,ee){if(P.visible===!1)return;if(P.layers.test(X.layers)){if(P.isGroup)ne=P.renderOrder;else if(P.isLOD)P.autoUpdate===!0&&P.update(X);else if(P.isLight)f.pushLight(P),P.castShadow&&f.pushShadow(P);else if(P.isSprite){if(!P.frustumCulled||te.intersectsSprite(P)){ee&&j.setFromMatrixPosition(P.matrixWorld).applyMatrix4(z);let He=ve.update(P),nt=P.material;nt.visible&&u.push(P,He,nt,ne,j.z,null)}}else if((P.isMesh||P.isLine||P.isPoints)&&(P.isSkinnedMesh&&P.skeleton.frame!==he.render.frame&&(P.skeleton.update(),P.skeleton.frame=he.render.frame),!P.frustumCulled||te.intersectsObject(P))){ee&&j.setFromMatrixPosition(P.matrixWorld).applyMatrix4(z);let He=ve.update(P),nt=P.material;if(Array.isArray(nt)){let it=He.groups;for(let Et=0,St=it.length;Et<St;Et++){let _t=it[Et],nr=nt[_t.materialIndex];nr&&nr.visible&&u.push(P,He,nr,ne,j.z,_t)}}else nt.visible&&u.push(P,He,nt,ne,j.z,null)}}let Ue=P.children;for(let He=0,nt=Ue.length;He<nt;He++)Ut(Ue[He],X,ne,ee)}function Ur(P,X,ne,ee){let fe=P.opaque,Ue=P.transmissive,He=P.transparent;f.setupLightsView(ne),Ue.length>0&&ia(fe,X,ne),ee&&H.viewport(T.copy(ee)),fe.length>0&&Nn(fe,X,ne),Ue.length>0&&Nn(Ue,X,ne),He.length>0&&Nn(He,X,ne),H.buffers.depth.setTest(!0),H.buffers.depth.setMask(!0),H.buffers.color.setMask(!0),H.setPolygonOffset(!1)}function ia(P,X,ne){let ee=le.isWebGL2;F===null&&(F=new mt(1,1,{generateMipmaps:!0,type:oe.has("EXT_color_buffer_half_float")?Vc:qt,minFilter:js,samples:ee&&s===!0?4:0})),m.getDrawingBufferSize(O),ee?F.setSize(O.x,O.y):F.setSize(mf(O.x),mf(O.y));let fe=m.getRenderTarget();m.setRenderTarget(F),m.clear();let Ue=m.toneMapping;m.toneMapping=rs,Nn(P,X,ne),m.toneMapping=Ue,V.updateMultisampleRenderTarget(F),V.updateRenderTargetMipmap(F),m.setRenderTarget(fe)}function Nn(P,X,ne){let ee=X.isScene===!0?X.overrideMaterial:null;for(let fe=0,Ue=P.length;fe<Ue;fe++){let He=P[fe],nt=He.object,it=He.geometry,Et=ee===null?He.material:ee,St=He.group;nt.layers.test(ne.layers)&&at(nt,X,ne,it,Et,St)}}function at(P,X,ne,ee,fe,Ue){P.onBeforeRender(m,X,ne,ee,fe,Ue),P.modelViewMatrix.multiplyMatrices(ne.matrixWorldInverse,P.matrixWorld),P.normalMatrix.getNormalMatrix(P.modelViewMatrix),fe.onBeforeRender(m,X,ne,ee,P,Ue),fe.transparent===!0&&fe.side===or?(fe.side=Pr,fe.needsUpdate=!0,m.renderBufferDirect(ne,X,ee,fe,P,Ue),fe.side=ii,fe.needsUpdate=!0,m.renderBufferDirect(ne,X,ee,fe,P,Ue),fe.side=or):m.renderBufferDirect(ne,X,ee,fe,P,Ue),P.onAfterRender(m,X,ne,ee,fe,Ue)}function ut(P,X,ne){X.isScene!==!0&&(X=q);let ee=K.get(P),fe=f.state.lights,Ue=f.state.shadowsArray,He=fe.state.version,nt=me.getParameters(P,fe.state,Ue,X,ne),it=me.getProgramCacheKey(nt),Et=ee.programs;ee.environment=P.isMeshStandardMaterial?X.environment:null,ee.fog=X.fog,ee.envMap=(P.isMeshStandardMaterial?ce:Z).get(P.envMap||ee.environment),Et===void 0&&(P.addEventListener("dispose",De),Et=new Map,ee.programs=Et);let St=Et.get(it);if(St!==void 0){if(ee.currentProgram===St&&ee.lightsStateVersion===He)return ft(P,nt),St}else nt.uniforms=me.getUniforms(P),P.onBuild(ne,nt,m),P.onBeforeCompile(nt,m),St=me.acquireProgram(nt,it),Et.set(it,St),ee.uniforms=nt.uniforms;let _t=ee.uniforms;(!P.isShaderMaterial&&!P.isRawShaderMaterial||P.clipping===!0)&&(_t.clippingPlanes=D.uniform),ft(P,nt),ee.needsLights=It(P),ee.lightsStateVersion=He,ee.needsLights&&(_t.ambientLightColor.value=fe.state.ambient,_t.lightProbe.value=fe.state.probe,_t.directionalLights.value=fe.state.directional,_t.directionalLightShadows.value=fe.state.directionalShadow,_t.spotLights.value=fe.state.spot,_t.spotLightShadows.value=fe.state.spotShadow,_t.rectAreaLights.value=fe.state.rectArea,_t.ltc_1.value=fe.state.rectAreaLTC1,_t.ltc_2.value=fe.state.rectAreaLTC2,_t.pointLights.value=fe.state.point,_t.pointLightShadows.value=fe.state.pointShadow,_t.hemisphereLights.value=fe.state.hemi,_t.directionalShadowMap.value=fe.state.directionalShadowMap,_t.directionalShadowMatrix.value=fe.state.directionalShadowMatrix,_t.spotShadowMap.value=fe.state.spotShadowMap,_t.spotShadowMatrix.value=fe.state.spotShadowMatrix,_t.pointShadowMap.value=fe.state.pointShadowMap,_t.pointShadowMatrix.value=fe.state.pointShadowMatrix);let nr=St.getUniforms(),xo=Is.seqWithValue(nr.seq,_t);return ee.currentProgram=St,ee.uniformsList=xo,St}function ft(P,X){let ne=K.get(P);ne.outputEncoding=X.outputEncoding,ne.instancing=X.instancing,ne.skinning=X.skinning,ne.morphTargets=X.morphTargets,ne.morphNormals=X.morphNormals,ne.morphColors=X.morphColors,ne.morphTargetsCount=X.morphTargetsCount,ne.numClippingPlanes=X.numClippingPlanes,ne.numIntersection=X.numClipIntersection,ne.vertexAlphas=X.vertexAlphas,ne.vertexTangents=X.vertexTangents,ne.toneMapping=X.toneMapping}function pt(P,X,ne,ee,fe){X.isScene!==!0&&(X=q),V.resetTextureUnits();let Ue=X.fog,He=ee.isMeshStandardMaterial?X.environment:null,nt=w===null?m.outputEncoding:w.isXRRenderTarget===!0?w.texture.encoding:gn,it=(ee.isMeshStandardMaterial?ce:Z).get(ee.envMap||He),Et=ee.vertexColors===!0&&!!ne.attributes.color&&ne.attributes.color.itemSize===4,St=!!ee.normalMap&&!!ne.attributes.tangent,_t=!!ne.morphAttributes.position,nr=!!ne.morphAttributes.normal,xo=!!ne.morphAttributes.color,sa=ee.toneMapped?m.toneMapping:rs,oa=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,wi=oa!==void 0?oa.length:0,Rt=K.get(ee),aa=f.state.lights;if(Q===!0&&(Y===!0||P!==S)){let Mi=P===S&&ee.id===b;D.setState(ee,P,Mi)}let yr=!1;ee.version===Rt.__version?(Rt.needsLights&&Rt.lightsStateVersion!==aa.state.version||Rt.outputEncoding!==nt||fe.isInstancedMesh&&Rt.instancing===!1||!fe.isInstancedMesh&&Rt.instancing===!0||fe.isSkinnedMesh&&Rt.skinning===!1||!fe.isSkinnedMesh&&Rt.skinning===!0||Rt.envMap!==it||ee.fog===!0&&Rt.fog!==Ue||Rt.numClippingPlanes!==void 0&&(Rt.numClippingPlanes!==D.numPlanes||Rt.numIntersection!==D.numIntersection)||Rt.vertexAlphas!==Et||Rt.vertexTangents!==St||Rt.morphTargets!==_t||Rt.morphNormals!==nr||Rt.morphColors!==xo||Rt.toneMapping!==sa||le.isWebGL2===!0&&Rt.morphTargetsCount!==wi)&&(yr=!0):(yr=!0,Rt.__version=ee.version);let Si=Rt.currentProgram;yr===!0&&(Si=ut(ee,X,fe));let bs=!1,Ac=!1,pm=!1,en=Si.getUniforms(),Tc=Rt.uniforms;if(H.useProgram(Si.program)&&(bs=!0,Ac=!0,pm=!0),ee.id!==b&&(b=ee.id,Ac=!0),bs||S!==P){if(en.setValue(W,"projectionMatrix",P.projectionMatrix),le.logarithmicDepthBuffer&&en.setValue(W,"logDepthBufFC",2/(Math.log(P.far+1)/Math.LN2)),S!==P&&(S=P,Ac=!0,pm=!0),ee.isShaderMaterial||ee.isMeshPhongMaterial||ee.isMeshToonMaterial||ee.isMeshStandardMaterial||ee.envMap){let Mi=en.map.cameraPosition;Mi!==void 0&&Mi.setValue(W,j.setFromMatrixPosition(P.matrixWorld))}(ee.isMeshPhongMaterial||ee.isMeshToonMaterial||ee.isMeshLambertMaterial||ee.isMeshBasicMaterial||ee.isMeshStandardMaterial||ee.isShaderMaterial)&&en.setValue(W,"isOrthographic",P.isOrthographicCamera===!0),(ee.isMeshPhongMaterial||ee.isMeshToonMaterial||ee.isMeshLambertMaterial||ee.isMeshBasicMaterial||ee.isMeshStandardMaterial||ee.isShaderMaterial||ee.isShadowMaterial||fe.isSkinnedMesh)&&en.setValue(W,"viewMatrix",P.matrixWorldInverse)}if(fe.isSkinnedMesh){en.setOptional(W,fe,"bindMatrix"),en.setOptional(W,fe,"bindMatrixInverse");let Mi=fe.skeleton;Mi&&(le.floatVertexTextures?(Mi.boneTexture===null&&Mi.computeBoneTexture(),en.setValue(W,"boneTexture",Mi.boneTexture,V),en.setValue(W,"boneTextureSize",Mi.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}let mm=ne.morphAttributes;return(mm.position!==void 0||mm.normal!==void 0||mm.color!==void 0&&le.isWebGL2===!0)&&Se.update(fe,ne,ee,Si),(Ac||Rt.receiveShadow!==fe.receiveShadow)&&(Rt.receiveShadow=fe.receiveShadow,en.setValue(W,"receiveShadow",fe.receiveShadow)),Ac&&(en.setValue(W,"toneMappingExposure",m.toneMappingExposure),Rt.needsLights&&xt(Tc,pm),Ue&&ee.fog===!0&&Pe.refreshFogUniforms(Tc,Ue),Pe.refreshMaterialUniforms(Tc,ee,C,_,F),Is.upload(W,Rt.uniformsList,Tc,V)),ee.isShaderMaterial&&ee.uniformsNeedUpdate===!0&&(Is.upload(W,Rt.uniformsList,Tc,V),ee.uniformsNeedUpdate=!1),ee.isSpriteMaterial&&en.setValue(W,"center",fe.center),en.setValue(W,"modelViewMatrix",fe.modelViewMatrix),en.setValue(W,"normalMatrix",fe.normalMatrix),en.setValue(W,"modelMatrix",fe.matrixWorld),Si}function xt(P,X){P.ambientLightColor.needsUpdate=X,P.lightProbe.needsUpdate=X,P.directionalLights.needsUpdate=X,P.directionalLightShadows.needsUpdate=X,P.pointLights.needsUpdate=X,P.pointLightShadows.needsUpdate=X,P.spotLights.needsUpdate=X,P.spotLightShadows.needsUpdate=X,P.rectAreaLights.needsUpdate=X,P.hemisphereLights.needsUpdate=X}function It(P){return P.isMeshLambertMaterial||P.isMeshToonMaterial||P.isMeshPhongMaterial||P.isMeshStandardMaterial||P.isShadowMaterial||P.isShaderMaterial&&P.lights===!0}this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(P,X,ne){K.get(P.texture).__webglTexture=X,K.get(P.depthTexture).__webglTexture=ne;let ee=K.get(P);ee.__hasExternalTextures=!0,ee.__hasExternalTextures&&(ee.__autoAllocateDepthBuffer=ne===void 0,ee.__autoAllocateDepthBuffer||oe.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ee.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(P,X){let ne=K.get(P);ne.__webglFramebuffer=X,ne.__useDefaultFramebuffer=X===void 0},this.setRenderTarget=function(P,X=0,ne=0){w=P,v=X,y=ne;let ee=!0;if(P){let it=K.get(P);it.__useDefaultFramebuffer!==void 0?(H.bindFramebuffer(36160,null),ee=!1):it.__webglFramebuffer===void 0?V.setupRenderTarget(P):it.__hasExternalTextures&&V.rebindTextures(P,K.get(P.texture).__webglTexture,K.get(P.depthTexture).__webglTexture)}let fe=null,Ue=!1,He=!1;if(P){let it=P.texture;(it.isData3DTexture||it.isDataArrayTexture)&&(He=!0);let Et=K.get(P).__webglFramebuffer;P.isWebGLCubeRenderTarget?(fe=Et[X],Ue=!0):le.isWebGL2&&P.samples>0&&V.useMultisampledRTT(P)===!1?fe=K.get(P).__webglMultisampledFramebuffer:fe=Et,T.copy(P.viewport),A.copy(P.scissor),x=P.scissorTest}else T.copy(R).multiplyScalar(C).floor(),A.copy(k).multiplyScalar(C).floor(),x=G;if(H.bindFramebuffer(36160,fe)&&le.drawBuffers&&ee&&H.drawBuffers(P,fe),H.viewport(T),H.scissor(A),H.setScissorTest(x),Ue){let it=K.get(P.texture);W.framebufferTexture2D(36160,36064,34069+X,it.__webglTexture,ne)}else if(He){let it=K.get(P.texture),Et=X||0;W.framebufferTextureLayer(36160,36064,it.__webglTexture,ne||0,Et)}b=-1},this.readRenderTargetPixels=function(P,X,ne,ee,fe,Ue,He){if(!(P&&P.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let nt=K.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&He!==void 0&&(nt=nt[He]),nt){H.bindFramebuffer(36160,nt);try{let it=P.texture,Et=it.format,St=it.type;if(Et!==Fn&&ue.convert(Et)!==W.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let _t=St===Vc&&(oe.has("EXT_color_buffer_half_float")||le.isWebGL2&&oe.has("EXT_color_buffer_float"));if(St!==qt&&ue.convert(St)!==W.getParameter(35738)&&!(St===Ds&&(le.isWebGL2||oe.has("OES_texture_float")||oe.has("WEBGL_color_buffer_float")))&&!_t){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}X>=0&&X<=P.width-ee&&ne>=0&&ne<=P.height-fe&&W.readPixels(X,ne,ee,fe,ue.convert(Et),ue.convert(St),Ue)}finally{let it=w!==null?K.get(w).__webglFramebuffer:null;H.bindFramebuffer(36160,it)}}},this.copyFramebufferToTexture=function(P,X,ne=0){if(X.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}let ee=Math.pow(2,-ne),fe=Math.floor(X.image.width*ee),Ue=Math.floor(X.image.height*ee);V.setTexture2D(X,0),W.copyTexSubImage2D(3553,ne,0,0,P.x,P.y,fe,Ue),H.unbindTexture()},this.copyTextureToTexture=function(P,X,ne,ee=0){let fe=X.image.width,Ue=X.image.height,He=ue.convert(ne.format),nt=ue.convert(ne.type);V.setTexture2D(ne,0),W.pixelStorei(37440,ne.flipY),W.pixelStorei(37441,ne.premultiplyAlpha),W.pixelStorei(3317,ne.unpackAlignment),X.isDataTexture?W.texSubImage2D(3553,ee,P.x,P.y,fe,Ue,He,nt,X.image.data):X.isCompressedTexture?W.compressedTexSubImage2D(3553,ee,P.x,P.y,X.mipmaps[0].width,X.mipmaps[0].height,He,X.mipmaps[0].data):W.texSubImage2D(3553,ee,P.x,P.y,He,nt,X.image),ee===0&&ne.generateMipmaps&&W.generateMipmap(3553),H.unbindTexture()},this.copyTextureToTexture3D=function(P,X,ne,ee,fe=0){if(m.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Ue=P.max.x-P.min.x+1,He=P.max.y-P.min.y+1,nt=P.max.z-P.min.z+1,it=ue.convert(ee.format),Et=ue.convert(ee.type),St;if(ee.isData3DTexture)V.setTexture3D(ee,0),St=32879;else if(ee.isDataArrayTexture)V.setTexture2DArray(ee,0),St=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}W.pixelStorei(37440,ee.flipY),W.pixelStorei(37441,ee.premultiplyAlpha),W.pixelStorei(3317,ee.unpackAlignment);let _t=W.getParameter(3314),nr=W.getParameter(32878),xo=W.getParameter(3316),sa=W.getParameter(3315),oa=W.getParameter(32877),wi=ne.isCompressedTexture?ne.mipmaps[0]:ne.image;W.pixelStorei(3314,wi.width),W.pixelStorei(32878,wi.height),W.pixelStorei(3316,P.min.x),W.pixelStorei(3315,P.min.y),W.pixelStorei(32877,P.min.z),ne.isDataTexture||ne.isData3DTexture?W.texSubImage3D(St,fe,X.x,X.y,X.z,Ue,He,nt,it,Et,wi.data):ne.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),W.compressedTexSubImage3D(St,fe,X.x,X.y,X.z,Ue,He,nt,it,wi.data)):W.texSubImage3D(St,fe,X.x,X.y,X.z,Ue,He,nt,it,Et,wi),W.pixelStorei(3314,_t),W.pixelStorei(32878,nr),W.pixelStorei(3316,xo),W.pixelStorei(3315,sa),W.pixelStorei(32877,oa),fe===0&&ee.generateMipmaps&&W.generateMipmap(St),H.unbindTexture()},this.initTexture=function(P){V.setTexture2D(P,0),H.unbindTexture()},this.resetState=function(){v=0,y=0,w=null,H.reset(),rt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Pt.prototype.isWebGLRenderer=!0;var mg=class extends Pt{};mg.prototype.isWebGL1Renderer=!0;var Kc=class{constructor(e,t=25e-5){this.name="",this.color=new be(e),this.density=t}clone(){return new Kc(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}};Kc.prototype.isFogExp2=!0;var Do=class{constructor(e,t=1,r=1e3){this.name="",this.color=new be(e),this.near=t,this.far=r}clone(){return new Do(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}};Do.prototype.isFog=!0;var on=class extends ot{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}};on.prototype.isScene=!0;var ss=class{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Hc,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Un()}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,r){e*=this.stride,r*=t.stride;for(let n=0,s=this.stride;n<s;n++)this.array[e+n]=t.array[r+n];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=Un()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(t,this.stride);return r.setUsage(this.usage),r}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=Un()),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}}};ss.prototype.isInterleavedBuffer=!0;var tn=new M,_i=class{constructor(e,t,r,n=!1){this.name="",this.data=e,this.itemSize=t,this.offset=r,this.normalized=n===!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,r=this.data.count;t<r;t++)tn.fromBufferAttribute(this,t),tn.applyMatrix4(e),this.setXYZ(t,tn.x,tn.y,tn.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)tn.fromBufferAttribute(this,t),tn.applyNormalMatrix(e),this.setXYZ(t,tn.x,tn.y,tn.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)tn.fromBufferAttribute(this,t),tn.transformDirection(e),this.setXYZ(t,tn.x,tn.y,tn.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,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this}setXYZ(e,t,r,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this}setXYZW(e,t,r,n,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,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.");let t=[];for(let r=0;r<this.count;r++){let n=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+s])}return new Ve(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 _i(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.");let t=[];for(let r=0;r<this.count;r++){let n=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+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}}};_i.prototype.isInterleavedBufferAttribute=!0;var Zc=class extends ur{constructor(e){super(),this.type="SpriteMaterial",this.color=new be(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}};Zc.prototype.isSpriteMaterial=!0;var Sa,Dc=new M,Ma=new M,Aa=new M,Ta=new B,Pc=new B,Cb=new Ae,Xu=new M,Lc=new M,Qu=new M,N0=new B,Xm=new B,O0=new B,gg=class extends ot{constructor(e){if(super(),this.type="Sprite",Sa===void 0){Sa=new Le;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new ss(t,5);Sa.setIndex([0,1,2,0,2,3]),Sa.setAttribute("position",new _i(r,3,0,!1)),Sa.setAttribute("uv",new _i(r,2,3,!1))}this.geometry=Sa,this.material=e!==void 0?e:new Zc,this.center=new B(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ma.setFromMatrixScale(this.matrixWorld),Cb.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Aa.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Ma.multiplyScalar(-Aa.z);let r=this.material.rotation,n,s;r!==0&&(s=Math.cos(r),n=Math.sin(r));let o=this.center;Ju(Xu.set(-.5,-.5,0),Aa,o,Ma,n,s),Ju(Lc.set(.5,-.5,0),Aa,o,Ma,n,s),Ju(Qu.set(.5,.5,0),Aa,o,Ma,n,s),N0.set(0,0),Xm.set(1,0),O0.set(1,1);let a=e.ray.intersectTriangle(Xu,Lc,Qu,!1,Dc);if(a===null&&(Ju(Lc.set(-.5,.5,0),Aa,o,Ma,n,s),Xm.set(0,1),a=e.ray.intersectTriangle(Xu,Qu,Lc,!1,Dc),a===null))return;let l=e.ray.origin.distanceTo(Dc);l<e.near||l>e.far||t.push({distance:l,point:Dc.clone(),uv:Jt.getUV(Dc,Xu,Lc,Qu,N0,Xm,O0,new B),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};gg.prototype.isSprite=!0;function Ju(i,e,t,r,n,s){Ta.subVectors(i,t).addScalar(.5).multiply(r),n!==void 0?(Pc.x=s*Ta.x-n*Ta.y,Pc.y=n*Ta.x+s*Ta.y):Pc.copy(Ta),i.copy(e),i.x+=Pc.x,i.y+=Pc.y,i.applyMatrix4(Cb)}var F0=new M,U0=new Je,z0=new Je,PL=new M,G0=new Ae,wf=class extends Vt{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Ae,this.bindMatrixInverse=new Ae}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(){let e=new Je,t=this.geometry.attributes.skinWeight;for(let r=0,n=t.count;r<n;r++){e.fromBufferAttribute(t,r);let s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(r,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){let r=this.skeleton,n=this.geometry;U0.fromBufferAttribute(n.attributes.skinIndex,e),z0.fromBufferAttribute(n.attributes.skinWeight,e),F0.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){let o=z0.getComponent(s);if(o!==0){let a=U0.getComponent(s);G0.multiplyMatrices(r.bones[a].matrixWorld,r.boneInverses[a]),t.addScaledVector(PL.copy(F0).applyMatrix4(G0),o)}}return t.applyMatrix4(this.bindMatrixInverse)}};wf.prototype.isSkinnedMesh=!0;var yg=class extends ot{constructor(){super(),this.type="Bone"}};yg.prototype.isBone=!0;var Sf=class extends Dt{constructor(e=null,t=1,r=1,n,s,o,a,l,c=hr,h=hr,u,f){super(null,o,a,l,c,h,n,s,u,f),this.image={data:e,width:t,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};Sf.prototype.isDataTexture=!0;var Oa=class extends Ve{constructor(e,t,r,n=1){typeof r=="number"&&(n=r,r=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,r),this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};Oa.prototype.isInstancedBufferAttribute=!0;var k0=new Ae,V0=new Ae,Ku=[],Ic=new Vt,vg=class extends Vt{constructor(e,t,r){super(e,t),this.instanceMatrix=new Oa(new Float32Array(r*16),16),this.instanceColor=null,this.count=r,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){let r=this.matrixWorld,n=this.count;if(Ic.geometry=this.geometry,Ic.material=this.material,Ic.material!==void 0)for(let s=0;s<n;s++){this.getMatrixAt(s,k0),V0.multiplyMatrices(r,k0),Ic.matrixWorld=V0,Ic.raycast(e,Ku);for(let o=0,a=Ku.length;o<a;o++){let l=Ku[o];l.instanceId=s,l.object=this,t.push(l)}Ku.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Oa(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"})}};vg.prototype.isInstancedMesh=!0;var kr=class extends ur{constructor(e){super(),this.type="LineBasicMaterial",this.color=new be(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}};kr.prototype.isLineBasicMaterial=!0;var H0=new M,W0=new M,j0=new Ae,Qm=new si,Zu=new Lr,os=class extends ot{constructor(e=new Le,t=new kr){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(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,r=[0];for(let n=1,s=t.count;n<s;n++)H0.fromBufferAttribute(t,n-1),W0.fromBufferAttribute(t,n),r[n]=r[n-1],r[n]+=H0.distanceTo(W0);e.setAttribute("lineDistance",new Ce(r,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){let r=this.geometry,n=this.matrixWorld,s=e.params.Line.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),Zu.copy(r.boundingSphere),Zu.applyMatrix4(n),Zu.radius+=s,e.ray.intersectsSphere(Zu)===!1)return;j0.copy(n).invert(),Qm.copy(e.ray).applyMatrix4(j0);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new M,h=new M,u=new M,f=new M,d=this.isLineSegments?2:1;if(r.isBufferGeometry){let p=r.index,g=r.attributes.position;if(p!==null){let v=Math.max(0,o.start),y=Math.min(p.count,o.start+o.count);for(let w=v,b=y-1;w<b;w+=d){let S=p.getX(w),T=p.getX(w+1);if(c.fromBufferAttribute(g,S),h.fromBufferAttribute(g,T),Qm.distanceSqToSegment(c,h,f,u)>l)continue;f.applyMatrix4(this.matrixWorld);let x=e.ray.origin.distanceTo(f);x<e.near||x>e.far||t.push({distance:x,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}else{let v=Math.max(0,o.start),y=Math.min(g.count,o.start+o.count);for(let w=v,b=y-1;w<b;w+=d){if(c.fromBufferAttribute(g,w),h.fromBufferAttribute(g,w+1),Qm.distanceSqToSegment(c,h,f,u)>l)continue;f.applyMatrix4(this.matrixWorld);let T=e.ray.origin.distanceTo(f);T<e.near||T>e.far||t.push({distance:T,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}else r.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,r=Object.keys(t);if(r.length>0){let n=t[r[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=n.length;s<o;s++){let a=n[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};os.prototype.isLine=!0;var q0=new M,Y0=new M,ai=class extends os{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,r=[];for(let n=0,s=t.count;n<s;n+=2)q0.fromBufferAttribute(t,n),Y0.fromBufferAttribute(t,n+1),r[n]=n===0?0:r[n-1],r[n+1]=r[n]+q0.distanceTo(Y0);e.setAttribute("lineDistance",new Ce(r,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}};ai.prototype.isLineSegments=!0;var xg=class extends os{constructor(e,t){super(e,t),this.type="LineLoop"}};xg.prototype.isLineLoop=!0;var $c=class extends ur{constructor(e){super(),this.type="PointsMaterial",this.color=new be(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}};$c.prototype.isPointsMaterial=!0;var X0=new Ae,bg=new si,$u=new Lr,ef=new M,wg=class extends ot{constructor(e=new Le,t=new $c){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){let r=this.geometry,n=this.matrixWorld,s=e.params.Points.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),$u.copy(r.boundingSphere),$u.applyMatrix4(n),$u.radius+=s,e.ray.intersectsSphere($u)===!1)return;X0.copy(n).invert(),bg.copy(e.ray).applyMatrix4(X0);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a;if(r.isBufferGeometry){let c=r.index,u=r.attributes.position;if(c!==null){let f=Math.max(0,o.start),d=Math.min(c.count,o.start+o.count);for(let p=f,m=d;p<m;p++){let g=c.getX(p);ef.fromBufferAttribute(u,g),Q0(ef,g,l,n,e,t,this)}}else{let f=Math.max(0,o.start),d=Math.min(u.count,o.start+o.count);for(let p=f,m=d;p<m;p++)ef.fromBufferAttribute(u,p),Q0(ef,p,l,n,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,r=Object.keys(t);if(r.length>0){let n=t[r[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=n.length;s<o;s++){let a=n[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};wg.prototype.isPoints=!0;function Q0(i,e,t,r,n,s,o){let a=bg.distanceSqToPoint(i);if(a<t){let l=new M;bg.closestPointToPoint(i,l),l.applyMatrix4(r);let c=n.ray.origin.distanceTo(l);if(c<n.near||c>n.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}var eh=class extends Dt{constructor(e,t,r,n,s,o,a,l,c){super(e,t,r,n,s,o,a,l,c),this.minFilter=o!==void 0?o:ct,this.magFilter=s!==void 0?s:ct,this.generateMipmaps=!1;let h=this;function u(){h.needsUpdate=!0,e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(u)}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}};eh.prototype.isVideoTexture=!0;var Sg=class extends Dt{constructor(e,t,r){super({width:e,height:t}),this.format=r,this.magFilter=hr,this.minFilter=hr,this.generateMipmaps=!1,this.needsUpdate=!0}};Sg.prototype.isFramebufferTexture=!0;var Mg=class extends Dt{constructor(e,t,r,n,s,o,a,l,c,h,u,f){super(null,o,a,l,c,h,n,s,u,f),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};Mg.prototype.isCompressedTexture=!0;var Ag=class extends Dt{constructor(e,t,r,n,s,o,a,l,c){super(e,t,r,n,s,o,a,l,c),this.needsUpdate=!0}};Ag.prototype.isCanvasTexture=!0;var xn=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){let 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;let t=[],r,n=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(n),t.push(s),n=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let r=this.getLengths(),n=0,s=r.length,o;t?o=t:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),c=r[n]-o,c<0)a=n+1;else if(c>0)l=n-1;else{l=n;break}if(n=l,r[n]===o)return n/(s-1);let h=r[n],f=r[n+1]-h,d=(o-h)/f;return(n+d)/(s-1)}getTangent(e,t){let n=e-1e-4,s=e+1e-4;n<0&&(n=0),s>1&&(s=1);let o=this.getPoint(n),a=this.getPoint(s),l=t||(o.isVector2?new B:new M);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){let r=new M,n=[],s=[],o=[],a=new M,l=new Ae;for(let d=0;d<=e;d++){let p=d/e;n[d]=this.getTangentAt(p,new M)}s[0]=new M,o[0]=new M;let c=Number.MAX_VALUE,h=Math.abs(n[0].x),u=Math.abs(n[0].y),f=Math.abs(n[0].z);h<=c&&(c=h,r.set(1,0,0)),u<=c&&(c=u,r.set(0,1,0)),f<=c&&r.set(0,0,1),a.crossVectors(n[0],r).normalize(),s[0].crossVectors(n[0],a),o[0].crossVectors(n[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(n[d-1],n[d]),a.length()>Number.EPSILON){a.normalize();let p=Math.acos(xr(n[d-1].dot(n[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(a,p))}o[d].crossVectors(n[d],s[d])}if(t===!0){let d=Math.acos(xr(s[0].dot(s[e]),-1,1));d/=e,n[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(n[p],d*p)),o[p].crossVectors(n[p],s[p])}return{tangents:n,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let 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}},Us=class extends xn{constructor(e=0,t=0,r=1,n=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=n,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){let r=t||new B,n=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=n;for(;s>n;)s-=n;s<Number.EPSILON&&(o?s=0:s=n),this.aClockwise===!0&&!o&&(s===n?s=-n:s=s-n);let a=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),f=l-this.aX,d=c-this.aY;l=f*h-d*u+this.aX,c=f*u+d*h+this.aY}return r.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(){let 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}};Us.prototype.isEllipseCurve=!0;var Mf=class extends Us{constructor(e,t,r,n,s,o){super(e,t,r,r,n,s,o),this.type="ArcCurve"}};Mf.prototype.isArcCurve=!0;function ry(){let i=0,e=0,t=0,r=0;function n(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,r=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){n(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,h,u){let f=(o-s)/c-(a-s)/(c+h)+(a-o)/h,d=(a-o)/h-(l-o)/(h+u)+(l-a)/u;f*=h,d*=h,n(o,a,f,d)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+r*a}}}var tf=new M,Jm=new ry,Km=new ry,Zm=new ry,Af=class extends xn{constructor(e=[],t=!1,r="centripetal",n=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=n}getPoint(e,t=new M){let r=t,n=this.points,s=n.length,o=(s-(this.closed?0:1))*e,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,h;this.closed||a>0?c=n[(a-1)%s]:(tf.subVectors(n[0],n[1]).add(n[0]),c=tf);let u=n[a%s],f=n[(a+1)%s];if(this.closed||a+2<s?h=n[(a+2)%s]:(tf.subVectors(n[s-1],n[s-2]).add(n[s-1]),h=tf),this.curveType==="centripetal"||this.curveType==="chordal"){let d=this.curveType==="chordal"?.5:.25,p=Math.pow(c.distanceToSquared(u),d),m=Math.pow(u.distanceToSquared(f),d),g=Math.pow(f.distanceToSquared(h),d);m<1e-4&&(m=1),p<1e-4&&(p=m),g<1e-4&&(g=m),Jm.initNonuniformCatmullRom(c.x,u.x,f.x,h.x,p,m,g),Km.initNonuniformCatmullRom(c.y,u.y,f.y,h.y,p,m,g),Zm.initNonuniformCatmullRom(c.z,u.z,f.z,h.z,p,m,g)}else this.curveType==="catmullrom"&&(Jm.initCatmullRom(c.x,u.x,f.x,h.x,this.tension),Km.initCatmullRom(c.y,u.y,f.y,h.y,this.tension),Zm.initCatmullRom(c.z,u.z,f.z,h.z,this.tension));return r.set(Jm.calc(l),Km.calc(l),Zm.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let n=this.points[t];e.points.push(n.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,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(new M().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};Af.prototype.isCatmullRomCurve3=!0;function J0(i,e,t,r,n){let s=(r-e)*.5,o=(n-t)*.5,a=i*i,l=i*a;return(2*t-2*r+s+o)*l+(-3*t+3*r-2*s-o)*a+s*i+t}function LL(i,e){let t=1-i;return t*t*e}function IL(i,e){return 2*(1-i)*i*e}function RL(i,e){return i*i*e}function zc(i,e,t,r){return LL(i,e)+IL(i,t)+RL(i,r)}function BL(i,e){let t=1-i;return t*t*t*e}function NL(i,e){let t=1-i;return 3*t*t*i*e}function OL(i,e){return 3*(1-i)*i*i*e}function FL(i,e){return i*i*i*e}function Gc(i,e,t,r,n){return BL(i,e)+NL(i,t)+OL(i,r)+FL(i,n)}var an=class extends xn{constructor(e=new B,t=new B,r=new B,n=new B){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new B){let r=t,n=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Gc(e,n.x,s.x,o.x,a.x),Gc(e,n.y,s.y,o.y,a.y)),r}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(){let 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}};an.prototype.isCubicBezierCurve=!0;var Tf=class extends xn{constructor(e=new M,t=new M,r=new M,n=new M){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new M){let r=t,n=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Gc(e,n.x,s.x,o.x,a.x),Gc(e,n.y,s.y,o.y,a.y),Gc(e,n.z,s.z,o.z,a.z)),r}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(){let 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}};Tf.prototype.isCubicBezierCurve3=!0;var ln=class extends xn{constructor(e=new B,t=new B){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new B){let r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){let r=t||new B;return r.copy(this.v2).sub(this.v1).normalize(),r}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}};ln.prototype.isLineCurve=!0;var th=class extends xn{constructor(e=new M,t=new M){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new M){let r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}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(){let 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}},kn=class extends xn{constructor(e=new B,t=new B,r=new B){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new B){let r=t,n=this.v0,s=this.v1,o=this.v2;return r.set(zc(e,n.x,s.x,o.x),zc(e,n.y,s.y,o.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}};kn.prototype.isQuadraticBezierCurve=!0;var Ef=class extends xn{constructor(e=new M,t=new M,r=new M){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new M){let r=t,n=this.v0,s=this.v1,o=this.v2;return r.set(zc(e,n.x,s.x,o.x),zc(e,n.y,s.y,o.y),zc(e,n.z,s.z,o.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}};Ef.prototype.isQuadraticBezierCurve3=!0;var Po=class extends xn{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new B){let r=t,n=this.points,s=(n.length-1)*e,o=Math.floor(s),a=s-o,l=n[o===0?o:o-1],c=n[o],h=n[o>n.length-2?n.length-1:o+1],u=n[o>n.length-3?n.length-1:o+2];return r.set(J0(a,l.x,c.x,h.x,u.x),J0(a,l.y,c.y,h.y,u.y)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(new B().fromArray(n))}return this}};Po.prototype.isSplineCurve=!0;var Db=Object.freeze({__proto__:null,ArcCurve:Mf,CatmullRomCurve3:Af,CubicBezierCurve:an,CubicBezierCurve3:Tf,EllipseCurve:Us,LineCurve:ln,LineCurve3:th,QuadraticBezierCurve:kn,QuadraticBezierCurve3:Ef,SplineCurve:Po}),Tg=class extends xn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new ln(t,e))}getPoint(e,t){let r=e*this.getLength(),n=this.getCurveLengths(),s=0;for(;s<n.length;){if(n[s]>=r){let o=n[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){let 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;let e=[],t=0;for(let r=0,n=this.curves.length;r<n;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],r;for(let n=0,s=this.curves;n<s.length;n++){let o=s[n],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){let h=l[c];r&&r.equals(h)||(t.push(h),r=h)}}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,r=e.curves.length;t<r;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,r=this.curves.length;t<r;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){let n=e.curves[t];this.curves.push(new Db[n.type]().fromJSON(n))}return this}},Fa=class extends Tg{constructor(e){super(),this.type="Path",this.currentPoint=new B,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let r=new ln(this.currentPoint.clone(),new B(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,n){let s=new kn(this.currentPoint.clone(),new B(e,t),new B(r,n));return this.curves.push(s),this.currentPoint.set(r,n),this}bezierCurveTo(e,t,r,n,s,o){let a=new an(this.currentPoint.clone(),new B(e,t),new B(r,n),new B(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),r=new Po(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,n,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,r,n,s,o),this}absarc(e,t,r,n,s,o){return this.absellipse(e,t,r,r,n,s,o),this}ellipse(e,t,r,n,s,o,a,l){let c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+c,t+h,r,n,s,o,a,l),this}absellipse(e,t,r,n,s,o,a,l){let c=new Us(e,t,r,n,s,o,a,l);if(this.curves.length>0){let u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);let h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Ua=class extends Le{constructor(e=[new B(0,.5),new B(.5,0),new B(0,-.5)],t=12,r=0,n=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},t=Math.floor(t),n=xr(n,0,Math.PI*2);let s=[],o=[],a=[],l=[],c=[],h=1/t,u=new M,f=new B,d=new M,p=new M,m=new M,g=0,v=0;for(let y=0;y<=e.length-1;y++)switch(y){case 0:g=e[y+1].x-e[y].x,v=e[y+1].y-e[y].y,d.x=v*1,d.y=-g,d.z=v*0,m.copy(d),d.normalize(),l.push(d.x,d.y,d.z);break;case e.length-1:l.push(m.x,m.y,m.z);break;default:g=e[y+1].x-e[y].x,v=e[y+1].y-e[y].y,d.x=v*1,d.y=-g,d.z=v*0,p.copy(d),d.x+=m.x,d.y+=m.y,d.z+=m.z,d.normalize(),l.push(d.x,d.y,d.z),m.copy(p)}for(let y=0;y<=t;y++){let w=r+y*h*n,b=Math.sin(w),S=Math.cos(w);for(let T=0;T<=e.length-1;T++){u.x=e[T].x*b,u.y=e[T].y,u.z=e[T].x*S,o.push(u.x,u.y,u.z),f.x=y/t,f.y=T/(e.length-1),a.push(f.x,f.y);let A=l[3*T+0]*b,x=l[3*T+1],E=l[3*T+0]*S;c.push(A,x,E)}}for(let y=0;y<t;y++)for(let w=0;w<e.length-1;w++){let b=w+y*e.length,S=b,T=b+e.length,A=b+e.length+1,x=b+1;s.push(S,T,x),s.push(A,x,T)}this.setIndex(s),this.setAttribute("position",new Ce(o,3)),this.setAttribute("uv",new Ce(a,2)),this.setAttribute("normal",new Ce(c,3))}static fromJSON(e){return new Ua(e.points,e.segments,e.phiStart,e.phiLength)}};var Lo=class extends Le{constructor(e=1,t=1,r=1,n=8,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;n=Math.floor(n),s=Math.floor(s);let h=[],u=[],f=[],d=[],p=0,m=[],g=r/2,v=0;y(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(h),this.setAttribute("position",new Ce(u,3)),this.setAttribute("normal",new Ce(f,3)),this.setAttribute("uv",new Ce(d,2));function y(){let b=new M,S=new M,T=0,A=(t-e)/r;for(let x=0;x<=s;x++){let E=[],_=x/s,C=_*(t-e)+e;for(let I=0;I<=n;I++){let N=I/n,R=N*l+a,k=Math.sin(R),G=Math.cos(R);S.x=C*k,S.y=-_*r+g,S.z=C*G,u.push(S.x,S.y,S.z),b.set(k,A,G).normalize(),f.push(b.x,b.y,b.z),d.push(N,1-_),E.push(p++)}m.push(E)}for(let x=0;x<n;x++)for(let E=0;E<s;E++){let _=m[E][x],C=m[E+1][x],I=m[E+1][x+1],N=m[E][x+1];h.push(_,C,N),h.push(C,I,N),T+=6}c.addGroup(v,T,0),v+=T}function w(b){let S=p,T=new B,A=new M,x=0,E=b===!0?e:t,_=b===!0?1:-1;for(let I=1;I<=n;I++)u.push(0,g*_,0),f.push(0,_,0),d.push(.5,.5),p++;let C=p;for(let I=0;I<=n;I++){let R=I/n*l+a,k=Math.cos(R),G=Math.sin(R);A.x=E*G,A.y=g*_,A.z=E*k,u.push(A.x,A.y,A.z),f.push(0,_,0),T.x=k*.5+.5,T.y=G*.5*_+.5,d.push(T.x,T.y),p++}for(let I=0;I<n;I++){let N=S+I,R=C+I;b===!0?h.push(R,R+1,N):h.push(R+1,R,N),x+=3}c.addGroup(v,x,b===!0?1:2),v+=x}}static fromJSON(e){return new Lo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},za=class extends Lo{constructor(e=1,t=1,r=8,n=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,r,n,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:n,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new za(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Ga=class extends Le{constructor(e=[],t=[],r=1,n=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:n};let s=[],o=[];a(n),c(r),h(),this.setAttribute("position",new Ce(s,3)),this.setAttribute("normal",new Ce(s.slice(),3)),this.setAttribute("uv",new Ce(o,2)),n===0?this.computeVertexNormals():this.normalizeNormals();function a(y){let w=new M,b=new M,S=new M;for(let T=0;T<t.length;T+=3)d(t[T+0],w),d(t[T+1],b),d(t[T+2],S),l(w,b,S,y)}function l(y,w,b,S){let T=S+1,A=[];for(let x=0;x<=T;x++){A[x]=[];let E=y.clone().lerp(b,x/T),_=w.clone().lerp(b,x/T),C=T-x;for(let I=0;I<=C;I++)I===0&&x===T?A[x][I]=E:A[x][I]=E.clone().lerp(_,I/C)}for(let x=0;x<T;x++)for(let E=0;E<2*(T-x)-1;E++){let _=Math.floor(E/2);E%2===0?(f(A[x][_+1]),f(A[x+1][_]),f(A[x][_])):(f(A[x][_+1]),f(A[x+1][_+1]),f(A[x+1][_]))}}function c(y){let w=new M;for(let b=0;b<s.length;b+=3)w.x=s[b+0],w.y=s[b+1],w.z=s[b+2],w.normalize().multiplyScalar(y),s[b+0]=w.x,s[b+1]=w.y,s[b+2]=w.z}function h(){let y=new M;for(let w=0;w<s.length;w+=3){y.x=s[w+0],y.y=s[w+1],y.z=s[w+2];let b=g(y)/2/Math.PI+.5,S=v(y)/Math.PI+.5;o.push(b,1-S)}p(),u()}function u(){for(let y=0;y<o.length;y+=6){let w=o[y+0],b=o[y+2],S=o[y+4],T=Math.max(w,b,S),A=Math.min(w,b,S);T>.9&&A<.1&&(w<.2&&(o[y+0]+=1),b<.2&&(o[y+2]+=1),S<.2&&(o[y+4]+=1))}}function f(y){s.push(y.x,y.y,y.z)}function d(y,w){let b=y*3;w.x=e[b+0],w.y=e[b+1],w.z=e[b+2]}function p(){let y=new M,w=new M,b=new M,S=new M,T=new B,A=new B,x=new B;for(let E=0,_=0;E<s.length;E+=9,_+=6){y.set(s[E+0],s[E+1],s[E+2]),w.set(s[E+3],s[E+4],s[E+5]),b.set(s[E+6],s[E+7],s[E+8]),T.set(o[_+0],o[_+1]),A.set(o[_+2],o[_+3]),x.set(o[_+4],o[_+5]),S.copy(y).add(w).add(b).divideScalar(3);let C=g(S);m(T,_+0,y,C),m(A,_+2,w,C),m(x,_+4,b,C)}}function m(y,w,b,S){S<0&&y.x===1&&(o[w]=y.x-1),b.x===0&&b.z===0&&(o[w]=S/2/Math.PI+.5)}function g(y){return Math.atan2(y.z,-y.x)}function v(y){return Math.atan2(-y.y,Math.sqrt(y.x*y.x+y.z*y.z))}}static fromJSON(e){return new Ga(e.vertices,e.indices,e.radius,e.details)}},ka=class extends Ga{constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,n=1/r,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,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],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 ka(e.radius,e.detail)}},dG=new M,pG=new M,mG=new M,gG=new Jt;var rn=class extends Fa{constructor(e){super(e),this.uuid=Un(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let r=0,n=this.holes.length;r<n;r++)t[r]=this.holes[r].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,r=e.holes.length;t<r;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,r=this.holes.length;t<r;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){let n=e.holes[t];this.holes.push(new Fa().fromJSON(n))}return this}},UL={triangulate:function(i,e,t=2){let r=e&&e.length,n=r?e[0]*t:i.length,s=Pb(i,0,n,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c,h,u,f,d;if(r&&(s=HL(i,e,s,t)),i.length>80*t){a=c=i[0],l=h=i[1];for(let p=t;p<n;p+=t)u=i[p],f=i[p+1],u<a&&(a=u),f<l&&(l=f),u>c&&(c=u),f>h&&(h=f);d=Math.max(c-a,h-l),d=d!==0?1/d:0}return rh(s,o,t,a,l,d),o}};function Pb(i,e,t,r,n){let s,o;if(n===e2(i,e,t,r)>0)for(s=e;s<t;s+=r)o=K0(s,i[s],i[s+1],o);else for(s=t-r;s>=e;s-=r)o=K0(s,i[s],i[s+1],o);return o&&td(o,o.next)&&(ih(o),o=o.next),o}function zs(i,e){if(!i)return i;e||(e=i);let t=i,r;do if(r=!1,!t.steiner&&(td(t,t.next)||tr(t.prev,t,t.next)===0)){if(ih(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function rh(i,e,t,r,n,s,o){if(!i)return;!o&&s&&XL(i,r,n,s);let a=i,l,c;for(;i.prev!==i.next;){if(l=i.prev,c=i.next,s?GL(i,r,n,s):zL(i)){e.push(l.i/t),e.push(i.i/t),e.push(c.i/t),ih(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=kL(zs(i),e,t),rh(i,e,t,r,n,s,2)):o===2&&VL(i,e,t,r,n,s):rh(zs(i),e,t,r,n,s,1);break}}}function zL(i){let e=i.prev,t=i,r=i.next;if(tr(e,t,r)>=0)return!1;let n=i.next.next;for(;n!==i.prev;){if(Pa(e.x,e.y,t.x,t.y,r.x,r.y,n.x,n.y)&&tr(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function GL(i,e,t,r){let n=i.prev,s=i,o=i.next;if(tr(n,s,o)>=0)return!1;let a=n.x<s.x?n.x<o.x?n.x:o.x:s.x<o.x?s.x:o.x,l=n.y<s.y?n.y<o.y?n.y:o.y:s.y<o.y?s.y:o.y,c=n.x>s.x?n.x>o.x?n.x:o.x:s.x>o.x?s.x:o.x,h=n.y>s.y?n.y>o.y?n.y:o.y:s.y>o.y?s.y:o.y,u=Eg(a,l,e,t,r),f=Eg(c,h,e,t,r),d=i.prevZ,p=i.nextZ;for(;d&&d.z>=u&&p&&p.z<=f;){if(d!==i.prev&&d!==i.next&&Pa(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tr(d.prev,d,d.next)>=0||(d=d.prevZ,p!==i.prev&&p!==i.next&&Pa(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&tr(p.prev,p,p.next)>=0))return!1;p=p.nextZ}for(;d&&d.z>=u;){if(d!==i.prev&&d!==i.next&&Pa(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tr(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=f;){if(p!==i.prev&&p!==i.next&&Pa(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&tr(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function kL(i,e,t){let r=i;do{let n=r.prev,s=r.next.next;!td(n,s)&&Lb(n,r,r.next,s)&&nh(n,s)&&nh(s,n)&&(e.push(n.i/t),e.push(r.i/t),e.push(s.i/t),ih(r),ih(r.next),r=i=s),r=r.next}while(r!==i);return zs(r)}function VL(i,e,t,r,n,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&KL(o,a)){let l=Ib(o,a);o=zs(o,o.next),l=zs(l,l.next),rh(o,e,t,r,n,s),rh(l,e,t,r,n,s);return}a=a.next}o=o.next}while(o!==i)}function HL(i,e,t,r){let n=[],s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*r,l=s<o-1?e[s+1]*r:i.length,c=Pb(i,a,l,r,!1),c===c.next&&(c.steiner=!0),n.push(JL(c));for(n.sort(WL),s=0;s<n.length;s++)jL(n[s],t),t=zs(t,t.next);return t}function WL(i,e){return i.x-e.x}function jL(i,e){if(e=qL(i,e),e){let t=Ib(e,i);zs(e,e.next),zs(t,t.next)}}function qL(i,e){let t=e,r=i.x,n=i.y,s=-1/0,o;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){let f=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=r&&f>s){if(s=f,f===r){if(n===t.y)return t;if(n===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(r===s)return o;let a=o,l=o.x,c=o.y,h=1/0,u;t=o;do r>=t.x&&t.x>=l&&r!==t.x&&Pa(n<c?r:s,n,l,c,n<c?s:r,n,t.x,t.y)&&(u=Math.abs(n-t.y)/(r-t.x),nh(t,i)&&(u<h||u===h&&(t.x>o.x||t.x===o.x&&YL(o,t)))&&(o=t,h=u)),t=t.next;while(t!==a);return o}function YL(i,e){return tr(i.prev,i,e.prev)<0&&tr(e.next,i,i.next)<0}function XL(i,e,t,r){let n=i;do n.z===null&&(n.z=Eg(n.x,n.y,e,t,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==i);n.prevZ.nextZ=null,n.prevZ=null,QL(n)}function QL(i){let e,t,r,n,s,o,a,l,c=1;do{for(t=i,i=null,s=null,o=0;t;){for(o++,r=t,a=0,e=0;e<c&&(a++,r=r.nextZ,!!r);e++);for(l=c;a>0||l>0&&r;)a!==0&&(l===0||!r||t.z<=r.z)?(n=t,t=t.nextZ,a--):(n=r,r=r.nextZ,l--),s?s.nextZ=n:i=n,n.prevZ=s,s=n;t=r}s.nextZ=null,c*=2}while(o>1);return i}function Eg(i,e,t,r,n){return i=32767*(i-t)*n,e=32767*(e-r)*n,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function JL(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function Pa(i,e,t,r,n,s,o,a){return(n-o)*(e-a)-(i-o)*(s-a)>=0&&(i-o)*(r-a)-(t-o)*(e-a)>=0&&(t-o)*(s-a)-(n-o)*(r-a)>=0}function KL(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!ZL(i,e)&&(nh(i,e)&&nh(e,i)&&$L(i,e)&&(tr(i.prev,i,e.prev)||tr(i,e.prev,e))||td(i,e)&&tr(i.prev,i,i.next)>0&&tr(e.prev,e,e.next)>0)}function tr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function td(i,e){return i.x===e.x&&i.y===e.y}function Lb(i,e,t,r){let n=nf(tr(i,e,t)),s=nf(tr(i,e,r)),o=nf(tr(t,r,i)),a=nf(tr(t,r,e));return!!(n!==s&&o!==a||n===0&&rf(i,t,e)||s===0&&rf(i,r,e)||o===0&&rf(t,i,r)||a===0&&rf(t,e,r))}function rf(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function nf(i){return i>0?1:i<0?-1:0}function ZL(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&Lb(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function nh(i,e){return tr(i.prev,i,i.next)<0?tr(i,e,i.next)>=0&&tr(i,i.prev,e)>=0:tr(i,e,i.prev)<0||tr(i,i.next,e)<0}function $L(i,e){let t=i,r=!1,n=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&n<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==i);return r}function Ib(i,e){let t=new _g(i.i,i.x,i.y),r=new _g(e.i,e.x,e.y),n=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=n,n.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function K0(i,e,t,r){let n=new _g(i,e,t);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function ih(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function _g(i,e,t){this.i=i,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 e2(i,e,t,r){let n=0;for(let s=e,o=t-r;s<t;s+=r)n+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return n}var ni=class{static area(e){let t=e.length,r=0;for(let n=t-1,s=0;s<t;n=s++)r+=e[n].x*e[s].y-e[s].x*e[n].y;return r*.5}static isClockWise(e){return ni.area(e)<0}static triangulateShape(e,t){let r=[],n=[],s=[];Z0(e),$0(r,e);let o=e.length;t.forEach(Z0);for(let l=0;l<t.length;l++)n.push(o),o+=t[l].length,$0(r,t[l]);let a=UL.triangulate(r,n);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function Z0(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function $0(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var Gs=class extends Le{constructor(e=new rn([new B(.5,.5),new B(-.5,.5),new B(-.5,-.5),new B(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let r=this,n=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new Ce(n,3)),this.setAttribute("uv",new Ce(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,u=t.depth!==void 0?t.depth:1,f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,p=t.bevelSize!==void 0?t.bevelSize:d-.1,m=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3,v=t.extrudePath,y=t.UVGenerator!==void 0?t.UVGenerator:t2;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),u=t.amount);let w,b=!1,S,T,A,x;v&&(w=v.getSpacedPoints(h),b=!0,f=!1,S=v.computeFrenetFrames(h,!1),T=new M,A=new M,x=new M),f||(g=0,d=0,p=0,m=0);let E=a.extractPoints(c),_=E.shape,C=E.holes;if(!ni.isClockWise(_)){_=_.reverse();for(let K=0,V=C.length;K<V;K++){let Z=C[K];ni.isClockWise(Z)&&(C[K]=Z.reverse())}}let N=ni.triangulateShape(_,C),R=_;for(let K=0,V=C.length;K<V;K++){let Z=C[K];_=_.concat(Z)}function k(K,V,Z){return V||console.error("THREE.ExtrudeGeometry: vec does not exist"),V.clone().multiplyScalar(Z).add(K)}let G=_.length,te=N.length;function Q(K,V,Z){let ce,se,pe,ve=K.x-V.x,me=K.y-V.y,Pe=Z.x-K.x,ke=Z.y-K.y,L=ve*ve+me*me,D=ve*ke-me*Pe;if(Math.abs(D)>Number.EPSILON){let re=Math.sqrt(L),ye=Math.sqrt(Pe*Pe+ke*ke),Se=V.x-me/re,Ie=V.y+ve/re,Fe=Z.x-ke/ye,ue=Z.y+Pe/ye,rt=((Fe-Se)*ke-(ue-Ie)*Pe)/(ve*ke-me*Pe);ce=Se+ve*rt-K.x,se=Ie+me*rt-K.y;let st=ce*ce+se*se;if(st<=2)return new B(ce,se);pe=Math.sqrt(st/2)}else{let re=!1;ve>Number.EPSILON?Pe>Number.EPSILON&&(re=!0):ve<-Number.EPSILON?Pe<-Number.EPSILON&&(re=!0):Math.sign(me)===Math.sign(ke)&&(re=!0),re?(ce=-me,se=ve,pe=Math.sqrt(L)):(ce=ve,se=me,pe=Math.sqrt(L/2))}return new B(ce/pe,se/pe)}let Y=[];for(let K=0,V=R.length,Z=V-1,ce=K+1;K<V;K++,Z++,ce++)Z===V&&(Z=0),ce===V&&(ce=0),Y[K]=Q(R[K],R[Z],R[ce]);let F=[],z,O=Y.concat();for(let K=0,V=C.length;K<V;K++){let Z=C[K];z=[];for(let ce=0,se=Z.length,pe=se-1,ve=ce+1;ce<se;ce++,pe++,ve++)pe===se&&(pe=0),ve===se&&(ve=0),z[ce]=Q(Z[ce],Z[pe],Z[ve]);F.push(z),O=O.concat(z)}for(let K=0;K<g;K++){let V=K/g,Z=d*Math.cos(V*Math.PI/2),ce=p*Math.sin(V*Math.PI/2)+m;for(let se=0,pe=R.length;se<pe;se++){let ve=k(R[se],Y[se],ce);ge(ve.x,ve.y,-Z)}for(let se=0,pe=C.length;se<pe;se++){let ve=C[se];z=F[se];for(let me=0,Pe=ve.length;me<Pe;me++){let ke=k(ve[me],z[me],ce);ge(ke.x,ke.y,-Z)}}}let j=p+m;for(let K=0;K<G;K++){let V=f?k(_[K],O[K],j):_[K];b?(A.copy(S.normals[0]).multiplyScalar(V.x),T.copy(S.binormals[0]).multiplyScalar(V.y),x.copy(w[0]).add(A).add(T),ge(x.x,x.y,x.z)):ge(V.x,V.y,0)}for(let K=1;K<=h;K++)for(let V=0;V<G;V++){let Z=f?k(_[V],O[V],j):_[V];b?(A.copy(S.normals[K]).multiplyScalar(Z.x),T.copy(S.binormals[K]).multiplyScalar(Z.y),x.copy(w[K]).add(A).add(T),ge(x.x,x.y,x.z)):ge(Z.x,Z.y,u/h*K)}for(let K=g-1;K>=0;K--){let V=K/g,Z=d*Math.cos(V*Math.PI/2),ce=p*Math.sin(V*Math.PI/2)+m;for(let se=0,pe=R.length;se<pe;se++){let ve=k(R[se],Y[se],ce);ge(ve.x,ve.y,u+Z)}for(let se=0,pe=C.length;se<pe;se++){let ve=C[se];z=F[se];for(let me=0,Pe=ve.length;me<Pe;me++){let ke=k(ve[me],z[me],ce);b?ge(ke.x,ke.y+w[h-1].y,w[h-1].x+Z):ge(ke.x,ke.y,u+Z)}}}q(),J();function q(){let K=n.length/3;if(f){let V=0,Z=G*V;for(let ce=0;ce<te;ce++){let se=N[ce];oe(se[2]+Z,se[1]+Z,se[0]+Z)}V=h+g*2,Z=G*V;for(let ce=0;ce<te;ce++){let se=N[ce];oe(se[0]+Z,se[1]+Z,se[2]+Z)}}else{for(let V=0;V<te;V++){let Z=N[V];oe(Z[2],Z[1],Z[0])}for(let V=0;V<te;V++){let Z=N[V];oe(Z[0]+G*h,Z[1]+G*h,Z[2]+G*h)}}r.addGroup(K,n.length/3-K,0)}function J(){let K=n.length/3,V=0;W(R,V),V+=R.length;for(let Z=0,ce=C.length;Z<ce;Z++){let se=C[Z];W(se,V),V+=se.length}r.addGroup(K,n.length/3-K,1)}function W(K,V){let Z=K.length;for(;--Z>=0;){let ce=Z,se=Z-1;se<0&&(se=K.length-1);for(let pe=0,ve=h+g*2;pe<ve;pe++){let me=G*pe,Pe=G*(pe+1),ke=V+ce+me,L=V+se+me,D=V+se+Pe,re=V+ce+Pe;le(ke,L,D,re)}}}function ge(K,V,Z){l.push(K),l.push(V),l.push(Z)}function oe(K,V,Z){H(K),H(V),H(Z);let ce=n.length/3,se=y.generateTopUV(r,n,ce-3,ce-2,ce-1);he(se[0]),he(se[1]),he(se[2])}function le(K,V,Z,ce){H(K),H(V),H(ce),H(V),H(Z),H(ce);let se=n.length/3,pe=y.generateSideWallUV(r,n,se-6,se-3,se-2,se-1);he(pe[0]),he(pe[1]),he(pe[3]),he(pe[1]),he(pe[2]),he(pe[3])}function H(K){n.push(l[K*3+0]),n.push(l[K*3+1]),n.push(l[K*3+2])}function he(K){s.push(K.x),s.push(K.y)}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,r=this.parameters.options;return r2(t,r,e)}static fromJSON(e,t){let r=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];r.push(a)}let n=e.options.extrudePath;return n!==void 0&&(e.options.extrudePath=new Db[n.type]().fromJSON(n)),new Gs(r,e.options)}},t2={generateTopUV:function(i,e,t,r,n){let s=e[t*3],o=e[t*3+1],a=e[r*3],l=e[r*3+1],c=e[n*3],h=e[n*3+1];return[new B(s,o),new B(a,l),new B(c,h)]},generateSideWallUV:function(i,e,t,r,n,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[r*3],h=e[r*3+1],u=e[r*3+2],f=e[n*3],d=e[n*3+1],p=e[n*3+2],m=e[s*3],g=e[s*3+1],v=e[s*3+2];return Math.abs(a-h)<Math.abs(o-c)?[new B(o,1-l),new B(c,1-u),new B(f,1-p),new B(m,1-v)]:[new B(a,1-l),new B(h,1-u),new B(d,1-p),new B(g,1-v)]}};function r2(i,e,t){if(t.shapes=[],Array.isArray(i))for(let r=0,n=i.length;r<n;r++){let s=i[r];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var Va=class extends Ga{constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,n=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,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(n,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Va(e.radius,e.detail)}};var Io=class extends Le{constructor(e=new rn([new B(0,.5),new B(-.5,-.5),new B(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let r=[],n=[],s=[],o=[],a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let h=0;h<e.length;h++)c(e[h]),this.addGroup(a,l,h),a+=l,l=0;this.setIndex(r),this.setAttribute("position",new Ce(n,3)),this.setAttribute("normal",new Ce(s,3)),this.setAttribute("uv",new Ce(o,2));function c(h){let u=n.length/3,f=h.extractPoints(t),d=f.shape,p=f.holes;ni.isClockWise(d)===!1&&(d=d.reverse());for(let g=0,v=p.length;g<v;g++){let y=p[g];ni.isClockWise(y)===!0&&(p[g]=y.reverse())}let m=ni.triangulateShape(d,p);for(let g=0,v=p.length;g<v;g++){let y=p[g];d=d.concat(y)}for(let g=0,v=d.length;g<v;g++){let y=d[g];n.push(y.x,y.y,0),s.push(0,0,1),o.push(y.x,y.y)}for(let g=0,v=m.length;g<v;g++){let y=m[g],w=y[0]+u,b=y[1]+u,S=y[2]+u;r.push(w,b,S),l+=3}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return n2(t,e)}static fromJSON(e,t){let r=[];for(let n=0,s=e.shapes.length;n<s;n++){let o=t[e.shapes[n]];r.push(o)}return new Io(r,e.curveSegments)}};function n2(i,e){if(e.shapes=[],Array.isArray(i))for(let t=0,r=i.length;t<r;t++){let n=i[t];e.shapes.push(n.uuid)}else e.shapes.push(i.uuid);return e}var Ro=class extends Le{constructor(e=1,t=32,r=16,n=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),r=Math.max(2,Math.floor(r));let l=Math.min(o+a,Math.PI),c=0,h=[],u=new M,f=new M,d=[],p=[],m=[],g=[];for(let v=0;v<=r;v++){let y=[],w=v/r,b=0;v==0&&o==0?b=.5/t:v==r&&l==Math.PI&&(b=-.5/t);for(let S=0;S<=t;S++){let T=S/t;u.x=-e*Math.cos(n+T*s)*Math.sin(o+w*a),u.y=e*Math.cos(o+w*a),u.z=e*Math.sin(n+T*s)*Math.sin(o+w*a),p.push(u.x,u.y,u.z),f.copy(u).normalize(),m.push(f.x,f.y,f.z),g.push(T+b,1-w),y.push(c++)}h.push(y)}for(let v=0;v<r;v++)for(let y=0;y<t;y++){let w=h[v][y+1],b=h[v][y],S=h[v+1][y],T=h[v+1][y+1];(v!==0||o>0)&&d.push(w,b,T),(v!==r-1||l<Math.PI)&&d.push(b,S,T)}this.setIndex(d),this.setAttribute("position",new Ce(p,3)),this.setAttribute("normal",new Ce(m,3)),this.setAttribute("uv",new Ce(g,2))}static fromJSON(e){return new Ro(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var Ha=class extends Le{constructor(e=1,t=.4,r=64,n=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:s,q:o},r=Math.floor(r),n=Math.floor(n);let a=[],l=[],c=[],h=[],u=new M,f=new M,d=new M,p=new M,m=new M,g=new M,v=new M;for(let w=0;w<=r;++w){let b=w/r*s*Math.PI*2;y(b,s,o,e,d),y(b+.01,s,o,e,p),g.subVectors(p,d),v.addVectors(p,d),m.crossVectors(g,v),v.crossVectors(m,g),m.normalize(),v.normalize();for(let S=0;S<=n;++S){let T=S/n*Math.PI*2,A=-t*Math.cos(T),x=t*Math.sin(T);u.x=d.x+(A*v.x+x*m.x),u.y=d.y+(A*v.y+x*m.y),u.z=d.z+(A*v.z+x*m.z),l.push(u.x,u.y,u.z),f.subVectors(u,d).normalize(),c.push(f.x,f.y,f.z),h.push(w/r),h.push(S/n)}}for(let w=1;w<=r;w++)for(let b=1;b<=n;b++){let S=(n+1)*(w-1)+(b-1),T=(n+1)*w+(b-1),A=(n+1)*w+b,x=(n+1)*(w-1)+b;a.push(S,T,x),a.push(T,A,x)}this.setIndex(a),this.setAttribute("position",new Ce(l,3)),this.setAttribute("normal",new Ce(c,3)),this.setAttribute("uv",new Ce(h,2));function y(w,b,S,T,A){let x=Math.cos(w),E=Math.sin(w),_=S/b*w,C=Math.cos(_);A.x=T*(2+C)*.5*x,A.y=T*(2+C)*E*.5,A.z=T*Math.sin(_)*.5}}static fromJSON(e){return new Ha(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}};var _f=class extends ur{constructor(e){super(),this.type="ShadowMaterial",this.color=new be(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};_f.prototype.isShadowMaterial=!0;var Cf=class extends Mt{constructor(e){super(e),this.type="RawShaderMaterial"}};Cf.prototype.isRawShaderMaterial=!0;var sh=class extends ur{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new be(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 be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xa,this.normalScale=new B(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.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};sh.prototype.isMeshStandardMaterial=!0;var Df=class extends sh{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new B(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return xr(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new be(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 be(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new be(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}};Df.prototype.isMeshPhysicalMaterial=!0;var Pf=class extends ur{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new be(16777215),this.specular=new be(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xa,this.normalScale=new B(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=$f,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};Pf.prototype.isMeshPhongMaterial=!0;var Lf=class extends ur{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new be(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xa,this.normalScale=new B(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};Lf.prototype.isMeshToonMaterial=!0;var If=class extends ur{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xa,this.normalScale=new B(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}};If.prototype.isMeshNormalMaterial=!0;var Rf=class extends ur{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new be(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=$f,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.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.fog=e.fog,this}};Rf.prototype.isMeshLambertMaterial=!0;var Bf=class extends ur{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new be(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xa,this.normalScale=new B(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}};Bf.prototype.isMeshMatcapMaterial=!0;var Nf=class extends kr{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}};Nf.prototype.isLineDashedMaterial=!0;var i2={ShadowMaterial:_f,SpriteMaterial:Zc,RawShaderMaterial:Cf,ShaderMaterial:Mt,PointsMaterial:$c,MeshPhysicalMaterial:Df,MeshStandardMaterial:sh,MeshPhongMaterial:Pf,MeshToonMaterial:Lf,MeshNormalMaterial:If,MeshLambertMaterial:Rf,MeshDepthMaterial:Qc,MeshDistanceMaterial:Jc,MeshBasicMaterial:zn,MeshMatcapMaterial:Bf,LineDashedMaterial:Nf,LineBasicMaterial:kr,Material:ur};ur.fromType=function(i){return new i2[i]};var Qt={arraySlice:function(i,e,t){return Qt.isTypedArray(i)?new i.constructor(i.subarray(e,t!==void 0?t:i.length)):i.slice(e,t)},convertArray:function(i,e,t){return!i||!t&&i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)},isTypedArray:function(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)},getKeyframeOrder:function(i){function e(n,s){return i[n]-i[s]}let t=i.length,r=new Array(t);for(let n=0;n!==t;++n)r[n]=n;return r.sort(e),r},sortedArray:function(i,e,t){let r=i.length,n=new i.constructor(r);for(let s=0,o=0;o!==r;++s){let a=t[s]*e;for(let l=0;l!==e;++l)n[o++]=i[a+l]}return n},flattenJSON:function(i,e,t,r){let n=1,s=i[0];for(;s!==void 0&&s[r]===void 0;)s=i[n++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=i[n++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=i[n++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),t.push(o)),s=i[n++];while(s!==void 0)},subclip:function(i,e,t,r,n=30){let s=i.clone();s.name=e;let o=[];for(let l=0;l<s.tracks.length;++l){let c=s.tracks[l],h=c.getValueSize(),u=[],f=[];for(let d=0;d<c.times.length;++d){let p=c.times[d]*n;if(!(p<t||p>=r)){u.push(c.times[d]);for(let m=0;m<h;++m)f.push(c.values[d*h+m])}}u.length!==0&&(c.times=Qt.convertArray(u,c.times.constructor),c.values=Qt.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(i,e=0,t=i,r=30){r<=0&&(r=30);let n=t.tracks.length,s=e/r;for(let o=0;o<n;++o){let a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;let c=i.tracks.find(function(v){return v.name===a.name&&v.ValueTypeName===l});if(c===void 0)continue;let h=0,u=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=u/3);let f=0,d=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);let p=a.times.length-1,m;if(s<=a.times[0]){let v=h,y=u-h;m=Qt.arraySlice(a.values,v,y)}else if(s>=a.times[p]){let v=p*u+h,y=v+u-h;m=Qt.arraySlice(a.values,v,y)}else{let v=a.createInterpolant(),y=h,w=u-h;v.evaluate(s),m=Qt.arraySlice(v.resultBuffer,y,w)}l==="quaternion"&&new zt().fromArray(m).normalize().conjugate().toArray(m);let g=c.times.length;for(let v=0;v<g;++v){let y=v*d+f;if(l==="quaternion")zt.multiplyQuaternionsFlat(c.values,y,m,0,c.values,y);else{let w=d-f*2;for(let b=0;b<w;++b)c.values[y+b]-=m[b]}}}return i.blendMode=gb,i}},Ci=class{constructor(e,t,r,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=n!==void 0?n:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,r=this._cachedIndex,n=t[r],s=t[r-1];e:{t:{let o;r:{n:if(!(e<n)){for(let a=r+2;;){if(n===void 0){if(e<s)break n;return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,e,s)}if(r===a)break;if(s=n,n=t[++r],e<n)break t}o=t.length;break r}if(!(e>=s)){let a=t[1];e<a&&(r=2,s=a);for(let l=r-2;;){if(s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(r===l)break;if(n=s,s=t[--r-1],e>=s)break t}o=r,r=0;break r}break e}for(;r<o;){let a=r+o>>>1;e<t[a]?o=a:r=a+1}if(n=t[r],s=t[r-1],s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(n===void 0)return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,s,e)}this._cachedIndex=r,this.intervalChanged_(r,s,n)}return this.interpolate_(r,s,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,s=e*n;for(let o=0;o!==n;++o)t[o]=r[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}};Ci.prototype.beforeStart_=Ci.prototype.copySampleValue_;Ci.prototype.afterEnd_=Ci.prototype.copySampleValue_;var Cg=class extends Ci{constructor(e,t,r,n){super(e,t,r,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:_a,endingEnd:_a}}intervalChanged_(e,t,r){let n=this.parameterPositions,s=e-2,o=e+1,a=n[s],l=n[o];if(a===void 0)switch(this.getSettings_().endingStart){case Ca:s=e,a=2*t-r;break;case df:s=n.length-2,a=t+n[s]-n[s+1];break;default:s=e,a=r}if(l===void 0)switch(this.getSettings_().endingEnd){case Ca:o=e,l=2*r-t;break;case df:o=1,l=r+n[1]-n[0];break;default:o=e-1,l=t}let c=(r-t)*.5,h=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-r),this._offsetPrev=s*h,this._offsetNext=o*h}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,h=this._offsetPrev,u=this._offsetNext,f=this._weightPrev,d=this._weightNext,p=(r-t)/(n-t),m=p*p,g=m*p,v=-f*g+2*f*m-f*p,y=(1+f)*g+(-1.5-2*f)*m+(-.5+f)*p+1,w=(-1-d)*g+(1.5+d)*m+.5*p,b=d*g-d*m;for(let S=0;S!==a;++S)s[S]=v*o[h+S]+y*o[c+S]+w*o[l+S]+b*o[u+S];return s}},Of=class extends Ci{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,h=(r-t)/(n-t),u=1-h;for(let f=0;f!==a;++f)s[f]=o[c+f]*u+o[l+f]*h;return s}},Dg=class extends Ci{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e){return this.copySampleValue_(e-1)}},Vn=class{constructor(e,t,r,n){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=Qt.convertArray(t,this.TimeBufferType),this.values=Qt.convertArray(r,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,r;if(t.toJSON!==this.toJSON)r=t.toJSON(e);else{r={name:e.name,times:Qt.convertArray(e.times,Array),values:Qt.convertArray(e.values,Array)};let n=e.getInterpolation();n!==e.DefaultInterpolation&&(r.interpolation=n)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new Dg(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Of(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Cg(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case uf:t=this.InterpolantFactoryMethodDiscrete;break;case ff:t=this.InterpolantFactoryMethodLinear;break;case wm:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let r="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(r);return console.warn("THREE.KeyframeTrack:",r),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return uf;case this.InterpolantFactoryMethodLinear:return ff;case this.InterpolantFactoryMethodSmooth:return wm}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let r=0,n=t.length;r!==n;++r)t[r]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let r=0,n=t.length;r!==n;++r)t[r]*=e}return this}trim(e,t){let r=this.times,n=r.length,s=0,o=n-1;for(;s!==n&&r[s]<e;)++s;for(;o!==-1&&r[o]>t;)--o;if(++o,s!==0||o!==n){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=Qt.arraySlice(r,s,o),this.values=Qt.arraySlice(this.values,s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let r=this.times,n=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=r[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(n!==void 0&&Qt.isTypedArray(n))for(let a=0,l=n.length;a!==l;++a){let c=n[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=Qt.arraySlice(this.times),t=Qt.arraySlice(this.values),r=this.getValueSize(),n=this.getInterpolation()===wm,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],h=e[a+1];if(c!==h&&(a!==1||c!==e[0]))if(n)l=!0;else{let u=a*r,f=u-r,d=u+r;for(let p=0;p!==r;++p){let m=t[u+p];if(m!==t[f+p]||m!==t[d+p]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let u=a*r,f=o*r;for(let d=0;d!==r;++d)t[f+d]=t[u+d]}++o}}if(s>0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=Qt.arraySlice(e,0,o),this.values=Qt.arraySlice(t,0,o*r)):(this.times=e,this.values=t),this}clone(){let e=Qt.arraySlice(this.times,0),t=Qt.arraySlice(this.values,0),r=this.constructor,n=new r(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}};Vn.prototype.TimeBufferType=Float32Array;Vn.prototype.ValueBufferType=Float32Array;Vn.prototype.DefaultInterpolation=ff;var ks=class extends Vn{};ks.prototype.ValueTypeName="bool";ks.prototype.ValueBufferType=Array;ks.prototype.DefaultInterpolation=uf;ks.prototype.InterpolantFactoryMethodLinear=void 0;ks.prototype.InterpolantFactoryMethodSmooth=void 0;var Ff=class extends Vn{};Ff.prototype.ValueTypeName="color";var Wa=class extends Vn{};Wa.prototype.ValueTypeName="number";var Pg=class extends Ci{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-t)/(n-t),c=e*a;for(let h=c+a;c!==h;c+=4)zt.slerpFlat(s,0,o,c-a,o,c,l);return s}},Bo=class extends Vn{InterpolantFactoryMethodLinear(e){return new Pg(this.times,this.values,this.getValueSize(),e)}};Bo.prototype.ValueTypeName="quaternion";Bo.prototype.DefaultInterpolation=ff;Bo.prototype.InterpolantFactoryMethodSmooth=void 0;var Vs=class extends Vn{};Vs.prototype.ValueTypeName="string";Vs.prototype.ValueBufferType=Array;Vs.prototype.DefaultInterpolation=uf;Vs.prototype.InterpolantFactoryMethodLinear=void 0;Vs.prototype.InterpolantFactoryMethodSmooth=void 0;var ja=class extends Vn{};ja.prototype.ValueTypeName="vector";var Uf=class{constructor(e,t=-1,r,n=$g){this.name=e,this.tracks=r,this.duration=t,this.blendMode=n,this.uuid=Un(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],r=e.tracks,n=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)t.push(o2(r[o]).scale(n));let s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){let t=[],r=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)t.push(Vn.toJSON(r[s]));return n}static CreateFromMorphTargetSequence(e,t,r,n){let 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);let h=Qt.getKeyframeOrder(l);l=Qt.sortedArray(l,1,h),c=Qt.sortedArray(c,1,h),!n&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new Wa(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/r))}return new this(e,-1,o)}static findByName(e,t){let r=e;if(!Array.isArray(e)){let n=e;r=n.geometry&&n.geometry.animations||n.animations}for(let n=0;n<r.length;n++)if(r[n].name===t)return r[n];return null}static CreateClipsFromMorphTargetSequences(e,t,r){let n={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){let c=e[a],h=c.name.match(s);if(h&&h.length>1){let u=h[1],f=n[u];f||(n[u]=f=[]),f.push(c)}}let o=[];for(let a in n)o.push(this.CreateFromMorphTargetSequence(a,n[a],t,r));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let r=function(u,f,d,p,m){if(d.length!==0){let g=[],v=[];Qt.flattenJSON(d,g,v,p),g.length!==0&&m.push(new u(f,g,v))}},n=[],s=e.name||"default",o=e.fps||30,a=e.blendMode,l=e.length||-1,c=e.hierarchy||[];for(let u=0;u<c.length;u++){let f=c[u].keys;if(!(!f||f.length===0))if(f[0].morphTargets){let d={},p;for(p=0;p<f.length;p++)if(f[p].morphTargets)for(let m=0;m<f[p].morphTargets.length;m++)d[f[p].morphTargets[m]]=-1;for(let m in d){let g=[],v=[];for(let y=0;y!==f[p].morphTargets.length;++y){let w=f[p];g.push(w.time),v.push(w.morphTarget===m?1:0)}n.push(new Wa(".morphTargetInfluence["+m+"]",g,v))}l=d.length*o}else{let d=".bones["+t[u].name+"]";r(ja,d+".position",f,"pos",n),r(Bo,d+".quaternion",f,"rot",n),r(ja,d+".scale",f,"scl",n)}}return n.length===0?null:new this(s,l,n,a)}resetDuration(){let e=this.tracks,t=0;for(let r=0,n=e.length;r!==n;++r){let s=this.tracks[r];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(){let 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 s2(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Wa;case"vector":case"vector2":case"vector3":case"vector4":return ja;case"color":return Ff;case"quaternion":return Bo;case"bool":case"boolean":return ks;case"string":return Vs}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function o2(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=s2(i.type);if(i.times===void 0){let t=[],r=[];Qt.flattenJSON(i.keys,t,r,"value"),i.times=t,i.values=r}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}var qa={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}},No=class{constructor(e,t,r){let n=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(h){a++,s===!1&&n.onStart!==void 0&&n.onStart(h,o,a),s=!0},this.itemEnd=function(h){o++,n.onProgress!==void 0&&n.onProgress(h,o,a),o===a&&(s=!1,n.onLoad!==void 0&&n.onLoad())},this.itemError=function(h){n.onError!==void 0&&n.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){let u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,f=c.length;u<f;u+=2){let d=c[u],p=c[u+1];if(d.global&&(d.lastIndex=0),d.test(h))return p}return null}}},a2=new No,cn=class{constructor(e){this.manager=e!==void 0?e:a2,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let r=this;return new Promise(function(n,s){r.load(e,n,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}},$i={},as=class extends cn{constructor(e){super(e)}load(e,t,r,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=qa.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if($i[e]!==void 0){$i[e].push({onLoad:t,onProgress:r,onError:n});return}$i[e]=[],$i[e].push({onLoad:t,onProgress:r,onError:n});let o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;let h=$i[e],u=c.body.getReader(),f=c.headers.get("Content-Length"),d=f?parseInt(f):0,p=d!==0,m=0,g=new ReadableStream({start(v){y();function y(){u.read().then(({done:w,value:b})=>{if(w)v.close();else{m+=b.byteLength;let S=new ProgressEvent("progress",{lengthComputable:p,loaded:m,total:d});for(let T=0,A=h.length;T<A;T++){let x=h[T];x.onProgress&&x.onProgress(S)}v.enqueue(b),y()}})}}});return new Response(g)}else throw Error(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,a));case"json":return c.json();default:if(a===void 0)return c.text();{let u=/charset="?([^;"\s]*)"?/i.exec(a),f=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(f);return c.arrayBuffer().then(p=>d.decode(p))}}}).then(c=>{qa.add(e,c);let h=$i[e];delete $i[e];for(let u=0,f=h.length;u<f;u++){let d=h[u];d.onLoad&&d.onLoad(c)}}).catch(c=>{let h=$i[e];if(h===void 0)throw this.manager.itemError(e),c;delete $i[e];for(let u=0,f=h.length;u<f;u++){let d=h[u];d.onError&&d.onError(c)}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}};var zf=class extends cn{constructor(e){super(e)}load(e,t,r,n){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=qa.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;let a=jc("img");function l(){h(),qa.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(u){h(),n&&n(u),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}},Lg=class extends cn{constructor(e){super(e)}load(e,t,r,n){let s=new Fs,o=new zf(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(h){s.images[c]=h,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,n)}for(let c=0;c<e.length;++c)l(c);return s}};var Ig=class extends cn{constructor(e){super(e)}load(e,t,r,n){let s=new Dt,o=new zf(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)},r,n),s}},bn=class extends ot{constructor(e,t=1){super(),this.type="Light",this.color=new be(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let 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}};bn.prototype.isLight=!0;var Hs=class extends bn{constructor(e,t,r){super(e,r),this.type="HemisphereLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.groundColor=new be(t)}copy(e){return bn.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}};Hs.prototype.isHemisphereLight=!0;var eb=new Ae,tb=new M,rb=new M,oh=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new B(512,512),this.map=null,this.mapPass=null,this.matrix=new Ae,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Na,this._frameExtents=new B(1,1),this._viewportCount=1,this._viewports=[new Je(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,r=this.matrix;tb.setFromMatrixPosition(e.matrixWorld),t.position.copy(tb),rb.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(rb),t.updateMatrixWorld(),eb.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(eb),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(t.projectionMatrix),r.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(){let 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}},Gf=class extends oh{constructor(){super(new sr(50,1,.5,500)),this.focus=1}updateMatrices(e){let t=this.camera,r=Wc*2*e.angle*this.focus,n=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(r!==t.fov||n!==t.aspect||s!==t.far)&&(t.fov=r,t.aspect=n,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}};Gf.prototype.isSpotLightShadow=!0;var ah=class extends bn{constructor(e,t,r=0,n=Math.PI/3,s=0,o=1){super(e,t),this.type="SpotLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.target=new ot,this.distance=r,this.angle=n,this.penumbra=s,this.decay=o,this.shadow=new Gf}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}};ah.prototype.isSpotLight=!0;var nb=new Ae,Rc=new M,$m=new M,kf=class extends oh{constructor(){super(new sr(90,1,.5,500)),this._frameExtents=new B(4,2),this._viewportCount=6,this._viewports=[new Je(2,1,1,1),new Je(0,1,1,1),new Je(3,1,1,1),new Je(1,1,1,1),new Je(3,0,1,1),new Je(1,0,1,1)],this._cubeDirections=[new M(1,0,0),new M(-1,0,0),new M(0,0,1),new M(0,0,-1),new M(0,1,0),new M(0,-1,0)],this._cubeUps=[new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,0,1),new M(0,0,-1)]}updateMatrices(e,t=0){let r=this.camera,n=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),Rc.setFromMatrixPosition(e.matrixWorld),r.position.copy(Rc),$m.copy(r.position),$m.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt($m),r.updateMatrixWorld(),n.makeTranslation(-Rc.x,-Rc.y,-Rc.z),nb.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(nb)}};kf.prototype.isPointLightShadow=!0;var lh=class extends bn{constructor(e,t,r=0,n=1){super(e,t),this.type="PointLight",this.distance=r,this.decay=n,this.shadow=new kf}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}};lh.prototype.isPointLight=!0;var Vf=class extends oh{constructor(){super(new Co(-5,5,5,-5,.5,500))}};Vf.prototype.isDirectionalLightShadow=!0;var ch=class extends bn{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.target=new ot,this.shadow=new Vf}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};ch.prototype.isDirectionalLight=!0;var Rg=class extends bn{constructor(e,t){super(e,t),this.type="AmbientLight"}};Rg.prototype.isAmbientLight=!0;var Bg=class extends bn{constructor(e,t,r=10,n=10){super(e,t),this.type="RectAreaLight",this.width=r,this.height=n}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){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}};Bg.prototype.isRectAreaLight=!0;var Hf=class{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new M)}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){let r=e.x,n=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*n),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*r),t.addScaledVector(o[4],1.092548*(r*n)),t.addScaledVector(o[5],1.092548*(n*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(r*s)),t.addScaledVector(o[8],.546274*(r*r-n*n)),t}getIrradianceAt(e,t){let r=e.x,n=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*n),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*r),t.addScaledVector(o[4],2*.429043*r*n),t.addScaledVector(o[5],2*.429043*n*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*r*s),t.addScaledVector(o[8],.429043*(r*r-n*n)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],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){let r=this.coefficients;for(let n=0;n<9;n++)r[n].fromArray(e,t+n*3);return this}toArray(e=[],t=0){let r=this.coefficients;for(let n=0;n<9;n++)r[n].toArray(e,t+n*3);return e}static getBasisAt(e,t){let r=e.x,n=e.y,s=e.z;t[0]=.282095,t[1]=.488603*n,t[2]=.488603*s,t[3]=.488603*r,t[4]=1.092548*r*n,t[5]=1.092548*n*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*r*s,t[8]=.546274*(r*r-n*n)}};Hf.prototype.isSphericalHarmonics3=!0;var hh=class extends bn{constructor(e=new Hf,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){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};hh.prototype.isLightProbe=!0;var Ng=class{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,n=e.length;r<n;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},Wf=class extends Le{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(){let e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};Wf.prototype.isInstancedBufferGeometry=!0;var Ws=class extends cn{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new as(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){n?n(l):console.error(l),s.manager.itemError(e)}},r,n)}parse(e){let t={},r={};function n(d,p){if(t[p]!==void 0)return t[p];let g=d.interleavedBuffers[p],v=s(d,g.buffer),y=_u(g.type,v),w=new ss(y,g.stride);return w.uuid=g.uuid,t[p]=w,w}function s(d,p){if(r[p]!==void 0)return r[p];let g=d.arrayBuffers[p],v=new Uint32Array(g).buffer;return r[p]=v,v}let o=e.isInstancedBufferGeometry?new Wf:new Le,a=e.data.index;if(a!==void 0){let d=_u(a.type,a.array);o.setIndex(new Ve(d,1))}let l=e.data.attributes;for(let d in l){let p=l[d],m;if(p.isInterleavedBufferAttribute){let g=n(e.data,p.data);m=new _i(g,p.itemSize,p.offset,p.normalized)}else{let g=_u(p.type,p.array),v=p.isInstancedBufferAttribute?Oa:Ve;m=new v(g,p.itemSize,p.normalized)}p.name!==void 0&&(m.name=p.name),p.usage!==void 0&&m.setUsage(p.usage),p.updateRange!==void 0&&(m.updateRange.offset=p.updateRange.offset,m.updateRange.count=p.updateRange.count),o.setAttribute(d,m)}let c=e.data.morphAttributes;if(c)for(let d in c){let p=c[d],m=[];for(let g=0,v=p.length;g<v;g++){let y=p[g],w;if(y.isInterleavedBufferAttribute){let b=n(e.data,y.data);w=new _i(b,y.itemSize,y.offset,y.normalized)}else{let b=_u(y.type,y.array);w=new Ve(b,y.itemSize,y.normalized)}y.name!==void 0&&(w.name=y.name),m.push(w)}o.morphAttributes[d]=m}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);let u=e.data.groups||e.data.drawcalls||e.data.offsets;if(u!==void 0)for(let d=0,p=u.length;d!==p;++d){let m=u[d];o.addGroup(m.start,m.count,m.materialIndex)}let f=e.data.boundingSphere;if(f!==void 0){let d=new M;f.center!==void 0&&d.fromArray(f.center),o.boundingSphere=new Lr(d,f.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}};var Og=class extends cn{constructor(e){super(e),typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=qa.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;let 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){qa.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){n&&n(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}};Og.prototype.isImageBitmapLoader=!0;var sf,l2={getContext:function(){return sf===void 0&&(sf=new(window.AudioContext||window.webkitAudioContext)),sf},setContext:function(i){sf=i}},Fg=class extends cn{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new as(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{let l=a.slice(0);l2.getContext().decodeAudioData(l,function(h){t(h)})}catch(l){n?n(l):console.error(l),s.manager.itemError(e)}},r,n)}},Ug=class extends hh{constructor(e,t,r=1){super(void 0,r);let n=new be().set(e),s=new be().set(t),o=new M(n.r,n.g,n.b),a=new M(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)}};Ug.prototype.isHemisphereLightProbe=!0;var zg=class extends hh{constructor(e,t=1){super(void 0,t);let r=new be().set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}};zg.prototype.isAmbientLightProbe=!0;var jf=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=ib(),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){let t=ib();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function ib(){return(typeof performance>"u"?Date:performance).now()}var Gg=class extends ot{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;let 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}};var kg=class{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,t=this.getFrequencyData();for(let r=0;r<t.length;r++)e+=t[r];return e/t.length}},Vg=class{constructor(e,t,r){this.binding=e,this.valueSize=r;let n,s,o;switch(t){case"quaternion":n=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":n=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:n=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=n,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){let r=this.buffer,n=this.valueSize,s=e*n+n,o=this.cumulativeWeight;if(o===0){for(let a=0;a!==n;++a)r[s+a]=r[a];o=t}else{o+=t;let a=t/o;this._mixBufferRegion(r,s,0,a,n)}this.cumulativeWeight=o}accumulateAdditive(e){let t=this.buffer,r=this.valueSize,n=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,n,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,r=this.buffer,n=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){let l=t*this._origIndex;this._mixBufferRegion(r,n,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(r,n,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(r[l]!==r[l+t]){a.setValue(r,n);break}}saveOriginalState(){let e=this.binding,t=this.buffer,r=this.valueSize,n=r*this._origIndex;e.getValue(t,n);for(let s=r,o=n;s!==o;++s)t[s]=t[n+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r<t;r++)this.buffer[r]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let r=0;r<this.valueSize;r++)this.buffer[t+r]=this.buffer[e+r]}_select(e,t,r,n,s){if(n>=.5)for(let o=0;o!==s;++o)e[t+o]=e[r+o]}_slerp(e,t,r,n){zt.slerpFlat(e,t,e,t,e,r,n)}_slerpAdditive(e,t,r,n,s){let o=this._workIndex*s;zt.multiplyQuaternionsFlat(e,o,e,t,e,r),zt.slerpFlat(e,t,e,t,e,o,n)}_lerp(e,t,r,n,s){let o=1-n;for(let a=0;a!==s;++a){let l=t+a;e[l]=e[l]*o+e[r+a]*n}}_lerpAdditive(e,t,r,n,s){for(let o=0;o!==s;++o){let a=t+o;e[a]=e[a]+e[r+o]*n}}},ny="\\[\\]\\.:\\/",c2=new RegExp("["+ny+"]","g"),iy="[^"+ny+"]",h2="[^"+ny.replace("\\.","")+"]",u2=/((?:WC+[\/:])*)/.source.replace("WC",iy),f2=/(WCOD+)?/.source.replace("WCOD",h2),d2=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",iy),p2=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",iy),m2=new RegExp("^"+u2+f2+d2+p2+"$"),g2=["material","materials","bones"],Hg=class{constructor(e,t,r){let n=r||bt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}getValue(e,t){this.bind();let r=this._targetGroup.nCachedObjects_,n=this._bindings[r];n!==void 0&&n.getValue(e,t)}setValue(e,t){let r=this._bindings;for(let n=this._targetGroup.nCachedObjects_,s=r.length;n!==s;++n)r[n].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},bt=class{constructor(e,t,r){this.path=t,this.parsedPath=r||bt.parseTrackName(t),this.node=bt.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new bt.Composite(e,t,r):new bt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(c2,"")}static parseTrackName(e){let t=m2.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=r.nodeName&&r.nodeName.lastIndexOf(".");if(n!==void 0&&n!==-1){let s=r.nodeName.substring(n+1);g2.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,n),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){let r=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=r(a.children);if(l)return l}return null},n=r(e.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)e[t++]=r[n]}_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){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=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,t=this.parsedPath,r=t.objectName,n=t.propertyName,s=t.propertyIndex;if(e||(e=bt.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(r){let c=t.objectIndex;switch(r){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 h=0;h<e.length;h++)if(e[h].name===c){c=h;break}break;default:if(e[r]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}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]}}let o=e[n];if(o===void 0){let c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+n+" 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(n==="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=n;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}};bt.Composite=Hg;bt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};bt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};bt.prototype.GetterByBindingType=[bt.prototype._getValue_direct,bt.prototype._getValue_array,bt.prototype._getValue_arrayElement,bt.prototype._getValue_toArray];bt.prototype.SetterByBindingTypeAndVersioning=[[bt.prototype._setValue_direct,bt.prototype._setValue_direct_setNeedsUpdate,bt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[bt.prototype._setValue_array,bt.prototype._setValue_array_setNeedsUpdate,bt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[bt.prototype._setValue_arrayElement,bt.prototype._setValue_arrayElement_setNeedsUpdate,bt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[bt.prototype._setValue_fromArray,bt.prototype._setValue_fromArray_setNeedsUpdate,bt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Wg=class{constructor(){this.uuid=Un(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let r=0,n=arguments.length;r!==n;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let 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(){let e=this._objects,t=this._indicesByUUID,r=this._paths,n=this._parsedPaths,s=this._bindings,o=s.length,a,l=e.length,c=this.nCachedObjects_;for(let h=0,u=arguments.length;h!==u;++h){let f=arguments[h],d=f.uuid,p=t[d];if(p===void 0){p=l++,t[d]=p,e.push(f);for(let m=0,g=o;m!==g;++m)s[m].push(new bt(f,r[m],n[m]))}else if(p<c){a=e[p];let m=--c,g=e[m];t[g.uuid]=p,e[p]=g,t[d]=m,e[m]=f;for(let v=0,y=o;v!==y;++v){let w=s[v],b=w[m],S=w[p];w[p]=b,S===void 0&&(S=new bt(f,r[v],n[v])),w[m]=S}}else e[p]!==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(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,n=r.length,s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){let l=arguments[o],c=l.uuid,h=t[c];if(h!==void 0&&h>=s){let u=s++,f=e[u];t[f.uuid]=h,e[h]=f,t[c]=u,e[u]=l;for(let d=0,p=n;d!==p;++d){let m=r[d],g=m[u],v=m[h];m[h]=g,m[u]=v}}}this.nCachedObjects_=s}uncache(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,n=r.length,s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){let c=arguments[a],h=c.uuid,u=t[h];if(u!==void 0)if(delete t[h],u<s){let f=--s,d=e[f],p=--o,m=e[p];t[d.uuid]=u,e[u]=d,t[m.uuid]=f,e[f]=m,e.pop();for(let g=0,v=n;g!==v;++g){let y=r[g],w=y[f],b=y[p];y[u]=w,y[f]=b,y.pop()}}else{let f=--o,d=e[f];f>0&&(t[d.uuid]=u),e[u]=d,e.pop();for(let p=0,m=n;p!==m;++p){let g=r[p];g[u]=g[f],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){let r=this._bindingsIndicesByPath,n=r[e],s=this._bindings;if(n!==void 0)return s[n];let o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,h=this.nCachedObjects_,u=new Array(c);n=s.length,r[e]=n,o.push(e),a.push(t),s.push(u);for(let f=h,d=l.length;f!==d;++f){let p=l[f];u[f]=new bt(p,e,t)}return u}unsubscribe_(e){let t=this._bindingsIndicesByPath,r=t[e];if(r!==void 0){let n=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),n[r]=n[a],n.pop()}}};Wg.prototype.isAnimationObjectGroup=!0;var jg=class{constructor(e,t,r=null,n=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=n;let s=t.tracks,o=s.length,a=new Array(o),l={endingStart:_a,endingEnd:_a};for(let c=0;c!==o;++c){let h=s[c].createInterpolant(null);a[c]=h,h.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=DE,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,r){if(e.fadeOut(t),this.fadeIn(t),r){let n=this._clip.duration,s=e._clip.duration,o=s/n,a=n/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,r){return e.crossFadeFrom(this,t,r)}stopFading(){let 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,r){let n=this._mixer,s=n.time,o=this.timeScale,a=this._timeScaleInterpolant;a===null&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);let l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/o,c[1]=t/o,this}stopWarping(){let 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,r,n){if(!this.enabled){this._updateWeight(e);return}let s=this._startTime;if(s!==null){let l=(e-s)*r;if(l<0||r===0)return;this._startTime=null,t=r*l}t*=this._updateTimeScale(e);let o=this._updateTime(t),a=this._updateWeight(e);if(a>0){let l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case gb:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(o),c[h].accumulateAdditive(a);break;case $g:default:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(o),c[h].accumulate(n,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let r=this._weightInterpolant;if(r!==null){let n=r.evaluate(e)[0];t*=n,e>r.parameterPositions[1]&&(this.stopFading(),n===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let r=this._timeScaleInterpolant;r!==null&&(t*=r.evaluate(e)[0],e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,r=this.loop,n=this.time+e,s=this._loopCount,o=r===PE;if(e===0)return s===-1?n:o&&(s&1)===1?t-n:n;if(r===CE){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n>=t)n=t;else if(n<0)n=0;else{this.time=n;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,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)),n>=t||n<0){let a=Math.floor(n/t);n-=t*a,s+=Math.abs(a);let l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=e>0?t:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){let c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=n;if(o&&(s&1)===1)return t-n}return n}_setEndings(e,t,r){let n=this._interpolantSettings;r?(n.endingStart=Ca,n.endingEnd=Ca):(e?n.endingStart=this.zeroSlopeAtStart?Ca:_a:n.endingStart=df,t?n.endingEnd=this.zeroSlopeAtEnd?Ca:_a:n.endingEnd=df)}_scheduleFading(e,t,r){let n=this._mixer,s=n.time,o=this._weightInterpolant;o===null&&(o=n._lendControlInterpolant(),this._weightInterpolant=o);let a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=r,this}},qg=class extends Yt{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let r=e._localRoot||this._root,n=e._clip.tracks,s=n.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName,h=c[l];h===void 0&&(h={},c[l]=h);for(let u=0;u!==s;++u){let f=n[u],d=f.name,p=h[d];if(p!==void 0)++p.referenceCount,o[u]=p;else{if(p=o[u],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,d));continue}let m=t&&t._propertyBindings[u].binding.parsedPath;p=new Vg(bt.create(r,d,m),f.ValueTypeName,f.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,d),o[u]=p}a[u].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let r=(e._localRoot||this._root).uuid,n=e._clip.uuid,s=this._actionsByClip[n];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,n,r)}let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];--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;let 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){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,r){let n=this._actions,s=this._actionsByClip,o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{let a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=n.length,n.push(e),o.actionByRoot[r]=e}_removeInactiveAction(e){let t=this._actions,r=t[t.length-1],n=e._cacheIndex;r._cacheIndex=n,t[n]=r,t.pop(),e._cacheIndex=null;let s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],h=e._byClipCacheIndex;c._byClipCacheIndex=h,l[h]=c,l.pop(),e._byClipCacheIndex=null;let u=a.actionByRoot,f=(e._localRoot||this._root).uuid;delete u[f],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){let t=this._actions,r=e._cacheIndex,n=this._nActiveActions++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_takeBackAction(e){let t=this._actions,r=e._cacheIndex,n=--this._nActiveActions,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_addInactiveBinding(e,t,r){let n=this._bindingsByRootAndName,s=this._bindings,o=n[t];o===void 0&&(o={},n[t]=o),o[r]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){let t=this._bindings,r=e.binding,n=r.rootNode.uuid,s=r.path,o=this._bindingsByRootAndName,a=o[n],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[n]}_lendBinding(e){let t=this._bindings,r=e._cacheIndex,n=this._nActiveBindings++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_takeBackBinding(e){let t=this._bindings,r=e._cacheIndex,n=--this._nActiveBindings,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return r===void 0&&(r=new Of(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=t,e[t]=r),r}_takeBackControlInterpolant(e){let t=this._controlInterpolants,r=e.__cacheIndex,n=--this._nActiveControlInterpolants,s=t[n];e.__cacheIndex=n,t[n]=e,s.__cacheIndex=r,t[r]=s}clipAction(e,t,r){let n=t||this._root,s=n.uuid,o=typeof e=="string"?Uf.findByName(n,e):e,a=o!==null?o.uuid:e,l=this._actionsByClip[a],c=null;if(r===void 0&&(o!==null?r=o.blendMode:r=$g),l!==void 0){let u=l.actionByRoot[s];if(u!==void 0&&u.blendMode===r)return u;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;let h=new jg(this,o,t,r);return this._bindAction(h,c),this._addInactiveAction(h,a,s),h}existingAction(e,t){let r=t||this._root,n=r.uuid,s=typeof e=="string"?Uf.findByName(r,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[n]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let r=t-1;r>=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;let t=this._actions,r=this._nActiveActions,n=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)t[c]._update(n,e,s,o);let 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){let t=this._actions,r=e.uuid,n=this._actionsByClip,s=n[r];if(s!==void 0){let o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){let c=o[a];this._deactivateAction(c);let h=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=h,t[h]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete n[r]}}uncacheRoot(e){let t=e.uuid,r=this._actionsByClip;for(let o in r){let a=r[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}let n=this._bindingsByRootAndName,s=n[t];if(s!==void 0)for(let o in s){let a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){let r=this.existingAction(e,t);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}};qg.prototype._controlInterpolantsResultBuffer=new Float32Array(1);var _e=class{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new _e(this.value.clone===void 0?this.value:this.value.clone())}},Yg=class extends ss{constructor(e,t,r=1){super(e,t),this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};Yg.prototype.isInstancedInterleavedBuffer=!0;var Xg=class{constructor(e,t,r,n,s){this.buffer=e,this.type=t,this.itemSize=r,this.elementSize=n,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}};Xg.prototype.isGLBufferAttribute=!0;var qf=class{constructor(e,t,r=0,n=1/0){this.ray=new si(e,t),this.near=r,this.far=n,this.camera=null,this.layers=new Yc,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,r=[]){return Qg(e,this,r,t),r.sort(sb),r}intersectObjects(e,t=!0,r=[]){for(let n=0,s=e.length;n<s;n++)Qg(e[n],this,r,t);return r.sort(sb),r}};function sb(i,e){return i.distance-e.distance}function Qg(i,e,t,r){if(i.layers.test(e.layers)&&i.raycast(e,t),r===!0){let n=i.children;for(let s=0,o=n.length;s<o;s++)Qg(n[s],e,t,!0)}}var uh=class{constructor(e=1,t=0,r=0){return this.radius=e,this.phi=t,this.theta=r,this}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,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,r){return this.radius=Math.sqrt(e*e+t*t+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(xr(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var ob=new B,Oo=class{constructor(e=new B(1/0,1/0),t=new B(-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,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=ob.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),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 ob.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)}};Oo.prototype.isBox2=!0;var ab=new M,of=new M,Jr=class{constructor(e=new M,t=new M){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){ab.subVectors(e,this.start),of.subVectors(this.end,this.start);let r=of.dot(of),s=of.dot(ab)/r;return t&&(s=xr(s,0,1)),s}closestPointToPoint(e,t,r){let n=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(n).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)}},lb=new M,Yf=class extends ot{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;let r=new Le,n=[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++){let c=o/l*Math.PI*2,h=a/l*Math.PI*2;n.push(Math.cos(c),Math.sin(c),1,Math.cos(h),Math.sin(h),1)}r.setAttribute("position",new Ce(n,3));let s=new kr({fog:!1,toneMapped:!1});this.cone=new ai(r,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),lb.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(lb),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Cs=new M,af=new Ae,eg=new Ae,Jg=class extends ai{constructor(e){let t=Rb(e),r=new Le,n=[],s=[],o=new be(0,0,1),a=new be(0,1,0);for(let c=0;c<t.length;c++){let h=t[c];h.parent&&h.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}r.setAttribute("position",new Ce(n,3)),r.setAttribute("color",new Ce(s,3));let l=new kr({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,l),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){let t=this.bones,r=this.geometry,n=r.getAttribute("position");eg.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){let a=t[s];a.parent&&a.parent.isBone&&(af.multiplyMatrices(eg,a.matrixWorld),Cs.setFromMatrixPosition(af),n.setXYZ(o,Cs.x,Cs.y,Cs.z),af.multiplyMatrices(eg,a.parent.matrixWorld),Cs.setFromMatrixPosition(af),n.setXYZ(o+1,Cs.x,Cs.y,Cs.z),o+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}};function Rb(i){let e=[];i.isBone===!0&&e.push(i);for(let t=0;t<i.children.length;t++)e.push.apply(e,Rb(i.children[t]));return e}var Xf=class extends Vt{constructor(e,t,r){let n=new Ro(t,4,2),s=new zn({wireframe:!0,fog:!1,toneMapped:!1});super(n,s),this.light=e,this.light.updateMatrixWorld(),this.color=r,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)}};var Kg=class extends ai{constructor(e=10,t=10,r=4473924,n=8947848){r=new be(r),n=new be(n);let s=t/2,o=e/t,a=e/2,l=[],c=[];for(let f=0,d=0,p=-a;f<=t;f++,p+=o){l.push(-a,0,p,a,0,p),l.push(p,0,-a,p,0,a);let m=f===s?r:n;m.toArray(c,d),d+=3,m.toArray(c,d),d+=3,m.toArray(c,d),d+=3,m.toArray(c,d),d+=3}let h=new Le;h.setAttribute("position",new Ce(l,3)),h.setAttribute("color",new Ce(c,3));let u=new kr({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}};var cb=new M,lf=new M,hb=new M,Qf=class extends ot{constructor(e,t,r){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,t===void 0&&(t=1);let n=new Le;n.setAttribute("position",new Ce([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let s=new kr({fog:!1,toneMapped:!1});this.lightPlane=new os(n,s),this.add(this.lightPlane),n=new Le,n.setAttribute("position",new Ce([0,0,0,0,0,1],3)),this.targetLine=new os(n,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(){cb.setFromMatrixPosition(this.light.matrixWorld),lf.setFromMatrixPosition(this.light.target.matrixWorld),hb.subVectors(lf,cb),this.lightPlane.lookAt(lf),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(lf),this.targetLine.scale.z=hb.length()}},cf=new M,ir=new Gn,Hn=class extends ai{constructor(e){let t=new Le,r=new kr({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],o={},a=new be(16755200),l=new be(16711680),c=new be(43775),h=new be(16777215),u=new be(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",h),f("p","c",u),f("cn1","cn2",u),f("cn3","cn4",u),f("cf1","cf2",u),f("cf3","cf4",u);function f(p,m,g){d(p,g),d(m,g)}function d(p,m){n.push(0,0,0),s.push(m.r,m.g,m.b),o[p]===void 0&&(o[p]=[]),o[p].push(n.length/3-1)}t.setAttribute("position",new Ce(n,3)),t.setAttribute("color",new Ce(s,3)),super(t,r),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(){let e=this.geometry,t=this.pointMap,r=1,n=1;ir.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),cr("c",t,e,ir,0,0,-1),cr("t",t,e,ir,0,0,1),cr("n1",t,e,ir,-r,-n,-1),cr("n2",t,e,ir,r,-n,-1),cr("n3",t,e,ir,-r,n,-1),cr("n4",t,e,ir,r,n,-1),cr("f1",t,e,ir,-r,-n,1),cr("f2",t,e,ir,r,-n,1),cr("f3",t,e,ir,-r,n,1),cr("f4",t,e,ir,r,n,1),cr("u1",t,e,ir,r*.7,n*1.1,-1),cr("u2",t,e,ir,-r*.7,n*1.1,-1),cr("u3",t,e,ir,0,n*2,-1),cr("cf1",t,e,ir,-r,0,1),cr("cf2",t,e,ir,r,0,1),cr("cf3",t,e,ir,0,-n,1),cr("cf4",t,e,ir,0,n,1),cr("cn1",t,e,ir,-r,0,-1),cr("cn2",t,e,ir,r,0,-1),cr("cn3",t,e,ir,0,-n,-1),cr("cn4",t,e,ir,0,n,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function cr(i,e,t,r,n,s,o){cf.set(n,s,o).unproject(r);let a=e[i];if(a!==void 0){let l=t.getAttribute("position");for(let c=0,h=a.length;c<h;c++)l.setXYZ(a[c],cf.x,cf.y,cf.z)}}var Fo=class extends ai{constructor(e,t=16776960){let r=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]),n=[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 Le;s.setIndex(new Ve(r,1)),s.setAttribute("position",new Ce(n,3)),super(s,new kr({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){let t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}};var Jf=class extends ai{constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],n=new Le;n.setAttribute("position",new Ce(t,3)),n.setAttribute("color",new Ce(r,3));let s=new kr({vertexColors:!0,toneMapped:!1});super(n,s),this.type="AxesHelper"}setColors(e,t,r){let n=new be,s=this.geometry.attributes.color.array;return n.set(e),n.toArray(s,0),n.toArray(s,3),n.set(t),n.toArray(s,6),n.toArray(s,9),n.set(r),n.toArray(s,12),n.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},Kf=class{constructor(){this.type="ShapePath",this.color=new be,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Fa,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,n){return this.currentPath.quadraticCurveTo(e,t,r,n),this}bezierCurveTo(e,t,r,n,s,o){return this.currentPath.bezierCurveTo(e,t,r,n,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function r(y){let w=[];for(let b=0,S=y.length;b<S;b++){let T=y[b],A=new rn;A.curves=T.curves,w.push(A)}return w}function n(y,w){let b=w.length,S=!1;for(let T=b-1,A=0;A<b;T=A++){let x=w[T],E=w[A],_=E.x-x.x,C=E.y-x.y;if(Math.abs(C)>Number.EPSILON){if(C<0&&(x=w[A],_=-_,E=w[T],C=-C),y.y<x.y||y.y>E.y)continue;if(y.y===x.y){if(y.x===x.x)return!0}else{let I=C*(y.x-x.x)-_*(y.y-x.y);if(I===0)return!0;if(I<0)continue;S=!S}}else{if(y.y!==x.y)continue;if(E.x<=y.x&&y.x<=x.x||x.x<=y.x&&y.x<=E.x)return!0}}return S}let s=ni.isClockWise,o=this.subPaths;if(o.length===0)return[];if(t===!0)return r(o);let a,l,c,h=[];if(o.length===1)return l=o[0],c=new rn,c.curves=l.curves,h.push(c),h;let u=!s(o[0].getPoints());u=e?!u:u;let f=[],d=[],p=[],m=0,g;d[m]=void 0,p[m]=[];for(let y=0,w=o.length;y<w;y++)l=o[y],g=l.getPoints(),a=s(g),a=e?!a:a,a?(!u&&d[m]&&m++,d[m]={s:new rn,p:g},d[m].s.curves=l.curves,u&&m++,p[m]=[]):p[m].push({h:l,p:g[0]});if(!d[0])return r(o);if(d.length>1){let y=!1,w=0;for(let b=0,S=d.length;b<S;b++)f[b]=[];for(let b=0,S=d.length;b<S;b++){let T=p[b];for(let A=0;A<T.length;A++){let x=T[A],E=!0;for(let _=0;_<d.length;_++)n(x.p,d[_].p)&&(b!==_&&w++,E?(E=!1,f[_].push(x)):y=!0);E&&f[b].push(x)}}w>0&&y===!1&&(p=f)}let v;for(let y=0,w=d.length;y<w;y++){c=d[y].s,h.push(c),v=p[y];for(let b=0,S=v.length;b<S;b++)c.holes.push(v[b].h)}return h}};var Bb=new ArrayBuffer(4),yG=new Float32Array(Bb),vG=new Uint32Array(Bb),Ai=new Uint32Array(512),Ti=new Uint32Array(512);for(let i=0;i<256;++i){let e=i-127;e<-27?(Ai[i]=0,Ai[i|256]=32768,Ti[i]=24,Ti[i|256]=24):e<-14?(Ai[i]=1024>>-e-14,Ai[i|256]=1024>>-e-14|32768,Ti[i]=-e-1,Ti[i|256]=-e-1):e<=15?(Ai[i]=e+15<<10,Ai[i|256]=e+15<<10|32768,Ti[i]=13,Ti[i|256]=13):e<128?(Ai[i]=31744,Ai[i|256]=64512,Ti[i]=24,Ti[i|256]=24):(Ai[i]=31744,Ai[i|256]=64512,Ti[i]=13,Ti[i|256]=13)}var Nb=new Uint32Array(2048),fh=new Uint32Array(64),y2=new Uint32Array(64);for(let i=1;i<1024;++i){let e=i<<13,t=0;for(;(e&8388608)===0;)e<<=1,t-=8388608;e&=-8388609,t+=947912704,Nb[i]=e|t}for(let i=1024;i<2048;++i)Nb[i]=939524096+(i-1024<<13);for(let i=1;i<31;++i)fh[i]=i<<23;fh[31]=1199570944;fh[32]=2147483648;for(let i=33;i<63;++i)fh[i]=2147483648+(i-32<<23);fh[63]=3347054592;for(let i=1;i<64;++i)i!==32&&(y2[i]=1024);xn.create=function(i,e){return console.log("THREE.Curve.create() has been deprecated"),i.prototype=Object.create(xn.prototype),i.prototype.constructor=i,i.prototype.getPoint=e,i};Fa.prototype.fromPoints=function(i){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(i)};Kg.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Jg.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};cn.prototype.extractUrlBase=function(i){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Ng.extractUrlBase(i)};cn.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.")}};Oo.prototype.center=function(i){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(i)};Oo.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Oo.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};Oo.prototype.size=function(i){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(i)};Kt.prototype.center=function(i){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Kt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Kt.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};Kt.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};Kt.prototype.size=function(i){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(i)};yn.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")};Lr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Na.prototype.setFromMatrix=function(i){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(i)};Jr.prototype.center=function(i){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Ft.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Ft.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Ft.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Ft.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Ft.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Ft.prototype.getInverse=function(i){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};Ae.prototype.extractPosition=function(i){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(i)};Ae.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Ae.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new M().setFromMatrixColumn(this,3)};Ae.prototype.setRotationFromQuaternion=function(i){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(i)};Ae.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};Ae.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ae.prototype.multiplyVector4=function(i){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ae.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};Ae.prototype.rotateAxis=function(i){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),i.transformDirection(this)};Ae.prototype.crossVector=function(i){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ae.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};Ae.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};Ae.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};Ae.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};Ae.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};Ae.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ae.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};Ae.prototype.makeFrustum=function(i,e,t,r,n,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(i,e,r,t,n,s)};Ae.prototype.getInverse=function(i){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};Gr.prototype.isIntersectionLine=function(i){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(i)};zt.prototype.multiplyVector3=function(i){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),i.applyQuaternion(this)};zt.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};si.prototype.isIntersectionBox=function(i){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};si.prototype.isIntersectionPlane=function(i){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(i)};si.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};Jt.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};Jt.prototype.barycoordFromPoint=function(i,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(i,e)};Jt.prototype.midpoint=function(i){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(i)};Jt.prototypenormal=function(i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(i)};Jt.prototype.plane=function(i){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(i)};Jt.barycoordFromPoint=function(i,e,t,r,n){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Jt.getBarycoord(i,e,t,r,n)};Jt.normal=function(i,e,t,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Jt.getNormal(i,e,t,r)};rn.prototype.extractAllPoints=function(i){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(i)};rn.prototype.extrude=function(i){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Gs(this,i)};rn.prototype.makeGeometry=function(i){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Io(this,i)};B.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};B.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};B.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};M.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};M.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};M.prototype.getPositionFromMatrix=function(i){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(i)};M.prototype.getScaleFromMatrix=function(i){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(i)};M.prototype.getColumnFromMatrix=function(i,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,i)};M.prototype.applyProjection=function(i){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(i)};M.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};M.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};M.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Je.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};Je.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};ot.prototype.getChildByName=function(i){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(i)};ot.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};ot.prototype.translate=function(i,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,i)};ot.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};ot.prototype.applyMatrix=function(i){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(ot.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(i){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=i}},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.")}}});Vt.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(Vt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),yb},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.")}}});wf.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};sr.prototype.setLens=function(i,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(i)};Object.defineProperties(bn.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(i){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=i}},shadowCameraLeft:{set:function(i){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=i}},shadowCameraRight:{set:function(i){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=i}},shadowCameraTop:{set:function(i){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=i}},shadowCameraBottom:{set:function(i){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=i}},shadowCameraNear:{set:function(i){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=i}},shadowCameraFar:{set:function(i){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=i}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(i){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=i}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(i){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=i}},shadowMapHeight:{set:function(i){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=i}}});Object.defineProperties(Ve.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===pf},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(pf)}}});Ve.prototype.setDynamic=function(i){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?pf:Hc),this};Ve.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Ve.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Le.prototype.addIndex=function(i){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(i)};Le.prototype.addAttribute=function(i,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(i,new Ve(arguments[1],arguments[2]))):i==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(i,e)};Le.prototype.addDrawCall=function(i,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(i,e)};Le.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};Le.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};Le.prototype.removeAttribute=function(i){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(i)};Le.prototype.applyMatrix=function(i){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(Le.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}}});ss.prototype.setDynamic=function(i){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?pf:Hc),this};ss.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Gs.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};Gs.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};Gs.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};on.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};_e.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(ur.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 be}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(i){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=i===fb}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(i){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=i}},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(Mt.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(i){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=i}}});Pt.prototype.clearTarget=function(i,e,t,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(i),this.clear(e,t,r)};Pt.prototype.animate=function(i){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(i)};Pt.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};Pt.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};Pt.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};Pt.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};Pt.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};Pt.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};Pt.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};Pt.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};Pt.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};Pt.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};Pt.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};Pt.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};Pt.prototype.enableScissorTest=function(i){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(i)};Pt.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};Pt.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};Pt.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};Pt.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Pt.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};Pt.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};Pt.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};Pt.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};Pt.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};Pt.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(Pt.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(i){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=i}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(i){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=i}},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(i){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=i===!0?je:gn}},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(_b.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.")}}});Object.defineProperties(mt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(i){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=i}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(i){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=i}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(i){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=i}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(i){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=i}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(i){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=i}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(i){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=i}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(i){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=i}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(i){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=i}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(i){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=i}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(i){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=i}}});Gg.prototype.load=function(i){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");let e=this;return new Fg().load(i,function(r){e.setBuffer(r)}),this};kg.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Xc.prototype.updateCubeMap=function(i,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(i,e)};Xc.prototype.clear=function(i,e,t,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(i,e,t,r)};ns.crossOrigin=void 0;ns.loadTexture=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");let n=new Ig;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};ns.loadTextureCube=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");let n=new Lg;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};ns.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};ns.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var Zf=class extends mt{constructor(e,t,r){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,r),this.samples=4}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Uo}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Uo);var Ja=".",dh=Symbol("target"),sy=Symbol("unsubscribe");function ph(i){return i instanceof Date||i instanceof Set||i instanceof Map||i instanceof WeakSet||i instanceof WeakMap||ArrayBuffer.isView(i)}function Ob(i){return(typeof i=="object"?i===null:typeof i!="function")||i instanceof RegExp}var Dn=Array.isArray;function zo(i){return typeof i=="symbol"}var v2={after:(i,e)=>Dn(i)?i.slice(e.length):e===""?i:i.slice(e.length+1),concat:(i,e)=>Dn(i)?(i=[...i],e&&i.push(e),i):e&&e.toString!==void 0?(i!==""&&(i+=Ja),zo(e)?i+e.toString():i+e):i,initial:i=>{if(Dn(i))return i.slice(0,-1);if(i==="")return i;let e=i.lastIndexOf(Ja);return e===-1?"":i.slice(0,e)},last:i=>{if(Dn(i))return i[i.length-1]||"";if(i==="")return i;let e=i.lastIndexOf(Ja);return e===-1?i:i.slice(e+1)},walk:(i,e)=>{if(Dn(i))for(let t of i)e(t);else if(i!==""){let t=0,r=i.indexOf(Ja);if(r===-1)e(i);else for(;t<i.length;)r===-1&&(r=i.length),e(i.slice(t,r)),t=r+1,r=i.indexOf(Ja,t)}},get(i,e){return this.walk(e,t=>{i&&(i=i[t])}),i}},hn=v2;function oy(i){return typeof i=="object"&&typeof i.next=="function"}function ay(i,e,t,r,n){let s=i.next;if(e.name==="entries")i.next=function(){let o=s.call(this);return o.done===!1&&(o.value[0]=n(o.value[0],e,o.value[0],r),o.value[1]=n(o.value[1],e,o.value[0],r)),o};else if(e.name==="values"){let o=t[dh].keys();i.next=function(){let a=s.call(this);return a.done===!1&&(a.value=n(a.value,e,o.next().value,r)),a}}else i.next=function(){let o=s.call(this);return o.done===!1&&(o.value=n(o.value,e,o.value,r)),o};return i}function rd(i,e,t){return i.isUnsubscribed||e.ignoreSymbols&&zo(t)||e.ignoreUnderscores&&t.charAt(0)==="_"||"ignoreKeys"in e&&e.ignoreKeys.includes(t)}var mh=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return this._descriptorCache===void 0&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),r=t.get(e);return r===void 0&&(r={},t.set(e,r)),r}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let r=this._getProperties(e),n=r[t];return n===void 0&&(n=Reflect.getOwnPropertyDescriptor(e,t),r[t]=n),n}getProxy(e,t,r,n){if(this.isUnsubscribed)return e;let s=e[n],o=s||e;this._pathCache.set(o,t);let a=this._proxyCache.get(o);return a===void 0&&(a=s===void 0?new Proxy(e,r):e,this._proxyCache.set(o,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,hn.get(t,this.getPath(e)))}defineProperty(e,t,r){return Reflect.defineProperty(e,t,r)?(this.isUnsubscribed||(this._getProperties(e)[t]=r),!0):!1}setProperty(e,t,r,n,s){if(!this._equals(s,r)||!(t in e)){let o=this._getOwnPropertyDescriptor(e,t);return o!==void 0&&"set"in o?Reflect.set(e,t,r,n):Reflect.set(e,t,r)}return!0}deleteProperty(e,t,r){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let n=this._getDescriptorCache().get(e);n&&(delete n[t],this._pathCache.delete(r))}return!0}return!1}isSameDescriptor(e,t,r){let n=this._getOwnPropertyDescriptor(t,r);return e!==void 0&&n!==void 0&&Object.is(e.value,n.value)&&(e.writable||!1)===(n.writable||!1)&&(e.enumerable||!1)===(n.enumerable||!1)&&(e.configurable||!1)===(n.configurable||!1)&&e.get===n.get&&e.set===n.set}isGetInvariant(e,t){let r=this._getOwnPropertyDescriptor(e,t);return r!==void 0&&r.configurable!==!0&&r.writable!==!0}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function Ka(i){return toString.call(i)==="[object Object]"}function Za(){return!0}function qs(i,e){return i.length!==e.length||i.some((t,r)=>e[r]!==t)}var nd=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]);var x2=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),ly={push:Za,pop:Za,shift:Za,unshift:Za,copyWithin:qs,reverse:qs,sort:qs,splice:qs,flat:qs,fill:qs},Fb=new Set([...nd,...x2,...Object.keys(ly)]);function $a(i,e){if(i.size!==e.size)return!0;for(let t of i)if(!e.has(t))return!0;return!1}var cy=["keys","values","entries"],hy=new Set(["has","toString"]),uy={add:$a,clear:$a,delete:$a,forEach:$a},Ub=new Set([...hy,...Object.keys(uy),...cy]);function el(i,e){if(i.size!==e.size)return!0;let t;for(let[r,n]of i)if(t=e.get(r),t!==n||t===void 0&&!e.has(r))return!0;return!1}var b2=new Set([...hy,"get"]),fy={set:el,clear:el,delete:el,forEach:el},zb=new Set([...b2,...Object.keys(fy),...cy]);var Rr=class{constructor(e,t,r,n){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=n,this._changes=n?[]:null,this.clone=t===void 0?e:this._shallowClone(e)}static isHandledMethod(e){return nd.has(e)}_shallowClone(e){let t=e;if(Ka(e))t=ie({},e);else if(Dn(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(r=>this._shallowClone(r)));else if(e instanceof Map){t=new Map;for(let[r,n]of e.entries())t.set(r,this._shallowClone(n))}return this._clonedCache.add(t),t}preferredThisArg(e,t,r,n){return e?(Dn(n)?this._onIsChanged=ly[t]:n instanceof Set?this._onIsChanged=uy[t]:n instanceof Map&&(this._onIsChanged=fy[t]),n):r}update(e,t,r){let n=hn.after(e,this._path);if(t!=="length"){let s=this.clone;hn.walk(n,o=>{s&&s[o]&&(this._clonedCache.has(s[o])||(s[o]=this._shallowClone(s[o])),s=s[o])}),this._hasOnValidate&&this._changes.push({path:n,property:t,previous:r}),s&&s[t]&&(s[t]=r)}this._isChanged=!0}undo(e){let t;for(let r=this._changes.length-1;r!==-1;r--)t=this._changes[r],hn.get(e,t.path)[t.property]=t.previous}isChanged(e){return this._onIsChanged===void 0?this._isChanged:this._onIsChanged(this.clone,e)}};var tl=class extends Rr{static isHandledMethod(e){return Fb.has(e)}};var gh=class extends Rr{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}};var rl=class extends Rr{static isHandledMethod(e){return Ub.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}};var nl=class extends Rr{static isHandledMethod(e){return zb.has(e)}undo(e){for(let[t,r]of this.clone.entries())e.set(t,r);for(let t of e.keys())this.clone.has(t)||e.delete(t)}};var yh=class extends Rr{constructor(e,t,r,n){super(void 0,t,r,n),this._arg1=r[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}};var vh=class extends Rr{constructor(e,t,r,n){super(void 0,t,r,n),this._weakKey=r[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}};var ci=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return Ka(e)||Dn(e)||ph(e)}static isHandledMethod(e,t){return Ka(e)?Rr.isHandledMethod(t):Dn(e)?tl.isHandledMethod(t):e instanceof Set?rl.isHandledMethod(t):e instanceof Map?nl.isHandledMethod(t):ph(e)}get isCloning(){return this._stack.length>0}start(e,t,r){let n=Rr;Dn(e)?n=tl:e instanceof Date?n=gh:e instanceof Set?n=rl:e instanceof Map?n=nl:e instanceof WeakSet?n=yh:e instanceof WeakMap&&(n=vh),this._stack.push(new n(e,t,r,this._hasOnValidate))}update(e,t,r){this._stack[this._stack.length-1].update(e,t,r)}preferredThisArg(e,t,r){let{name:n}=e,s=ci.isHandledMethod(r,n);return this._stack[this._stack.length-1].preferredThisArg(s,n,t,r)}isChanged(e,t,r){return this._stack[this._stack.length-1].isChanged(e,t,r)}undo(e){this._previousClone!==void 0&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}};var w2={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},dy=(i,e,t={})=>{t=ie(ie({},w2),t);let r=Symbol("ProxyTarget"),{equals:n,isShallow:s,ignoreDetached:o,details:a}=t,l=new mh(n),c=typeof t.onValidate=="function",h=new ci(c),u=(y,w,b,S,T)=>!c||h.isCloning||t.onValidate(hn.concat(l.getPath(y),w),b,S,T)===!0,f=(y,w,b,S)=>{!rd(l,t,w)&&!(o&&l.isDetached(y,i))&&d(l.getPath(y),w,b,S)},d=(y,w,b,S,T)=>{h.isCloning?h.update(y,w,S):e(hn.concat(y,w),b,S,T)},p=y=>y&&(y[r]||y),m=(y,w,b,S)=>Ob(y)||b==="constructor"||s&&!ci.isHandledMethod(w,b)||rd(l,t,b)||l.isGetInvariant(w,b)||o&&l.isDetached(w,i)?y:(S===void 0&&(S=l.getPath(w)),l.getProxy(y,hn.concat(S,b),g,r)),g={get(y,w,b){if(zo(w)){if(w===r||w===dh)return y;if(w===sy&&!l.isUnsubscribed&&l.getPath(y).length===0)return l.unsubscribe(),y}let S=ph(y)?Reflect.get(y,w):Reflect.get(y,w,b);return m(S,y,w)},set(y,w,b,S){b=p(b);let T=y[r]||y,A=T[w];if(n(A,b)&&w in y)return!0;let x=u(y,w,b,A);return x&&l.setProperty(T,w,b,S,A)?(f(y,w,y[w],A),!0):!x},defineProperty(y,w,b){if(!l.isSameDescriptor(b,y,w)){let S=y[w];u(y,w,b.value,S)&&l.defineProperty(y,w,b,S)&&f(y,w,b.value,S)}return!0},deleteProperty(y,w){if(!Reflect.has(y,w))return!0;let b=Reflect.get(y,w),S=u(y,w,void 0,b);return S&&l.deleteProperty(y,w,b)?(f(y,w,void 0,b),!0):!S},apply(y,w,b){let S=w[r]||w;if(l.isUnsubscribed)return Reflect.apply(y,S,b);if((a===!1||a!==!0&&!a.includes(y.name))&&ci.isHandledType(S)){let T=hn.initial(l.getPath(y)),A=ci.isHandledMethod(S,y.name);h.start(S,T,b);let x=Reflect.apply(y,h.preferredThisArg(y,w,S),A?b.map(C=>p(C)):b),E=h.isChanged(S,n),_=h.stop();if(ci.isHandledType(x)&&A&&(w instanceof Map&&y.name==="get"&&(T=hn.concat(T,b[0])),x=l.getProxy(x,T,g)),E){let C={name:y.name,args:b,result:x},I=h.isCloning?hn.initial(T):T,N=h.isCloning?hn.last(T):"";u(hn.get(i,I),N,S,_,C)?d(I,N,S,_,C):h.undo(S)}return(w instanceof Map||w instanceof Set)&&oy(x)?ay(x,y,w,T,m):x}return Reflect.apply(y,w,b)}},v=l.getProxy(i,t.pathAsArray?[]:"",g);return e=e.bind(v),c&&(t.onValidate=t.onValidate.bind(v)),v};dy.target=i=>i&&i[dh]||i;dy.unsubscribe=i=>i[sy]||i;var py=dy;var S2=typeof global=="object"&&global&&global.Object===Object&&global,id=S2;var M2=typeof self=="object"&&self&&self.Object===Object&&self,A2=id||M2||Function("return this")(),ar=A2;var T2=ar.Symbol,un=T2;var Gb=Object.prototype,E2=Gb.hasOwnProperty,_2=Gb.toString,xh=un?un.toStringTag:void 0;function C2(i){var e=E2.call(i,xh),t=i[xh];try{i[xh]=void 0;var r=!0}catch{}var n=_2.call(i);return r&&(e?i[xh]=t:delete i[xh]),n}var kb=C2;var D2=Object.prototype,P2=D2.toString;function L2(i){return P2.call(i)}var Vb=L2;var I2="[object Null]",R2="[object Undefined]",Hb=un?un.toStringTag:void 0;function B2(i){return i==null?i===void 0?R2:I2:Hb&&Hb in Object(i)?kb(i):Vb(i)}var Pn=B2;function N2(i){return i!=null&&typeof i=="object"}var Kr=N2;var O2="[object Symbol]";function F2(i){return typeof i=="symbol"||Kr(i)&&Pn(i)==O2}var Ys=F2;function U2(i,e){for(var t=-1,r=i==null?0:i.length,n=Array(r);++t<r;)n[t]=e(i[t],t,i);return n}var sd=U2;var z2=Array.isArray,Vr=z2;var G2=1/0,Wb=un?un.prototype:void 0,jb=Wb?Wb.toString:void 0;function qb(i){if(typeof i=="string")return i;if(Vr(i))return sd(i,qb)+"";if(Ys(i))return jb?jb.call(i):"";var e=i+"";return e=="0"&&1/i==-G2?"-0":e}var Yb=qb;var k2=/\s/;function V2(i){for(var e=i.length;e--&&k2.test(i.charAt(e)););return e}var Xb=V2;var H2=/^\s+/;function W2(i){return i&&i.slice(0,Xb(i)+1).replace(H2,"")}var Qb=W2;function j2(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var fr=j2;var Jb=0/0,q2=/^[-+]0x[0-9a-f]+$/i,Y2=/^0b[01]+$/i,X2=/^0o[0-7]+$/i,Q2=parseInt;function J2(i){if(typeof i=="number")return i;if(Ys(i))return Jb;if(fr(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=fr(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=Qb(i);var t=Y2.test(i);return t||X2.test(i)?Q2(i.slice(2),t?2:8):q2.test(i)?Jb:+i}var my=J2;function K2(i){return i}var od=K2;var Z2="[object AsyncFunction]",$2="[object Function]",eI="[object GeneratorFunction]",tI="[object Proxy]";function rI(i){if(!fr(i))return!1;var e=Pn(i);return e==$2||e==eI||e==Z2||e==tI}var il=rI;var nI=ar["__core-js_shared__"],ad=nI;var Kb=function(){var i=/[^.]+$/.exec(ad&&ad.keys&&ad.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function iI(i){return!!Kb&&Kb in i}var Zb=iI;var sI=Function.prototype,oI=sI.toString;function aI(i){if(i!=null){try{return oI.call(i)}catch{}try{return i+""}catch{}}return""}var ls=aI;var lI=/[\\^$.*+?()[\]{}|]/g,cI=/^\[object .+?Constructor\]$/,hI=Function.prototype,uI=Object.prototype,fI=hI.toString,dI=uI.hasOwnProperty,pI=RegExp("^"+fI.call(dI).replace(lI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function mI(i){if(!fr(i)||Zb(i))return!1;var e=il(i)?pI:cI;return e.test(ls(i))}var $b=mI;function gI(i,e){return i==null?void 0:i[e]}var ew=gI;function yI(i,e){var t=ew(i,e);return $b(t)?t:void 0}var wn=yI;var vI=wn(ar,"WeakMap"),ld=vI;var tw=Object.create,xI=function(){function i(){}return function(e){if(!fr(e))return{};if(tw)return tw(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}}(),rw=xI;function bI(i,e,t){switch(t.length){case 0:return i.call(e);case 1:return i.call(e,t[0]);case 2:return i.call(e,t[0],t[1]);case 3:return i.call(e,t[0],t[1],t[2])}return i.apply(e,t)}var nw=bI;function wI(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e}var cd=wI;var SI=800,MI=16,AI=Date.now;function TI(i){var e=0,t=0;return function(){var r=AI(),n=MI-(r-t);if(t=r,n>0){if(++e>=SI)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}var iw=TI;function EI(i){return function(){return i}}var sw=EI;var _I=function(){try{var i=wn(Object,"defineProperty");return i({},"",{}),i}catch{}}(),sl=_I;var CI=sl?function(i,e){return sl(i,"toString",{configurable:!0,enumerable:!1,value:sw(e),writable:!0})}:od,ow=CI;var DI=iw(ow),hd=DI;function PI(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i}var aw=PI;var LI=9007199254740991,II=/^(?:0|[1-9]\d*)$/;function RI(i,e){var t=typeof i;return e=e==null?LI:e,!!e&&(t=="number"||t!="symbol"&&II.test(i))&&i>-1&&i%1==0&&i<e}var ud=RI;function BI(i,e,t){e=="__proto__"&&sl?sl(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}var ol=BI;function NI(i,e){return i===e||i!==i&&e!==e}var Xs=NI;var OI=Object.prototype,FI=OI.hasOwnProperty;function UI(i,e,t){var r=i[e];(!(FI.call(i,e)&&Xs(r,t))||t===void 0&&!(e in i))&&ol(i,e,t)}var fd=UI;function zI(i,e,t,r){var n=!t;t||(t={});for(var s=-1,o=e.length;++s<o;){var a=e[s],l=r?r(t[a],i[a],a,t,i):void 0;l===void 0&&(l=i[a]),n?ol(t,a,l):fd(t,a,l)}return t}var Wn=zI;var lw=Math.max;function GI(i,e,t){return e=lw(e===void 0?i.length-1:e,0),function(){for(var r=arguments,n=-1,s=lw(r.length-e,0),o=Array(s);++n<s;)o[n]=r[e+n];n=-1;for(var a=Array(e+1);++n<e;)a[n]=r[n];return a[e]=t(o),nw(i,this,a)}}var dd=GI;function kI(i,e){return hd(dd(i,e,od),i+"")}var cw=kI;var VI=9007199254740991;function HI(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=VI}var pd=HI;function WI(i){return i!=null&&pd(i.length)&&!il(i)}var Qs=WI;function jI(i,e,t){if(!fr(t))return!1;var r=typeof e;return(r=="number"?Qs(t)&&ud(e,t.length):r=="string"&&e in t)?Xs(t[e],i):!1}var hw=jI;function qI(i){return cw(function(e,t){var r=-1,n=t.length,s=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(s=i.length>3&&typeof s=="function"?(n--,s):void 0,o&&hw(t[0],t[1],o)&&(s=n<3?void 0:s,n=1),e=Object(e);++r<n;){var a=t[r];a&&i(e,a,r,s)}return e})}var uw=qI;var YI=Object.prototype;function XI(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||YI;return i===t}var al=XI;function QI(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}var fw=QI;var JI="[object Arguments]";function KI(i){return Kr(i)&&Pn(i)==JI}var gy=KI;var dw=Object.prototype,ZI=dw.hasOwnProperty,$I=dw.propertyIsEnumerable,eR=gy(function(){return arguments}())?gy:function(i){return Kr(i)&&ZI.call(i,"callee")&&!$I.call(i,"callee")},Go=eR;function tR(){return!1}var pw=tR;var yw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,mw=yw&&typeof module=="object"&&module&&!module.nodeType&&module,rR=mw&&mw.exports===yw,gw=rR?ar.Buffer:void 0,nR=gw?gw.isBuffer:void 0,iR=nR||pw,ll=iR;var sR="[object Arguments]",oR="[object Array]",aR="[object Boolean]",lR="[object Date]",cR="[object Error]",hR="[object Function]",uR="[object Map]",fR="[object Number]",dR="[object Object]",pR="[object RegExp]",mR="[object Set]",gR="[object String]",yR="[object WeakMap]",vR="[object ArrayBuffer]",xR="[object DataView]",bR="[object Float32Array]",wR="[object Float64Array]",SR="[object Int8Array]",MR="[object Int16Array]",AR="[object Int32Array]",TR="[object Uint8Array]",ER="[object Uint8ClampedArray]",_R="[object Uint16Array]",CR="[object Uint32Array]",Xt={};Xt[bR]=Xt[wR]=Xt[SR]=Xt[MR]=Xt[AR]=Xt[TR]=Xt[ER]=Xt[_R]=Xt[CR]=!0;Xt[sR]=Xt[oR]=Xt[vR]=Xt[aR]=Xt[xR]=Xt[lR]=Xt[cR]=Xt[hR]=Xt[uR]=Xt[fR]=Xt[dR]=Xt[pR]=Xt[mR]=Xt[gR]=Xt[yR]=!1;function DR(i){return Kr(i)&&pd(i.length)&&!!Xt[Pn(i)]}var vw=DR;function PR(i){return function(e){return i(e)}}var cl=PR;var xw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,bh=xw&&typeof module=="object"&&module&&!module.nodeType&&module,LR=bh&&bh.exports===xw,yy=LR&&id.process,IR=function(){try{var i=bh&&bh.require&&bh.require("util").types;return i||yy&&yy.binding&&yy.binding("util")}catch{}}(),cs=IR;var bw=cs&&cs.isTypedArray,RR=bw?cl(bw):vw,md=RR;var BR=Object.prototype,NR=BR.hasOwnProperty;function OR(i,e){var t=Vr(i),r=!t&&Go(i),n=!t&&!r&&ll(i),s=!t&&!r&&!n&&md(i),o=t||r||n||s,a=o?fw(i.length,String):[],l=a.length;for(var c in i)(e||NR.call(i,c))&&!(o&&(c=="length"||n&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||ud(c,l)))&&a.push(c);return a}var gd=OR;function FR(i,e){return function(t){return i(e(t))}}var yd=FR;var UR=yd(Object.keys,Object),ww=UR;var zR=Object.prototype,GR=zR.hasOwnProperty;function kR(i){if(!al(i))return ww(i);var e=[];for(var t in Object(i))GR.call(i,t)&&t!="constructor"&&e.push(t);return e}var Sw=kR;function VR(i){return Qs(i)?gd(i):Sw(i)}var hl=VR;function HR(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var Mw=HR;var WR=Object.prototype,jR=WR.hasOwnProperty;function qR(i){if(!fr(i))return Mw(i);var e=al(i),t=[];for(var r in i)r=="constructor"&&(e||!jR.call(i,r))||t.push(r);return t}var Aw=qR;function YR(i){return Qs(i)?gd(i,!0):Aw(i)}var Di=YR;var XR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,QR=/^\w*$/;function JR(i,e){if(Vr(i))return!1;var t=typeof i;return t=="number"||t=="symbol"||t=="boolean"||i==null||Ys(i)?!0:QR.test(i)||!XR.test(i)||e!=null&&i in Object(e)}var Tw=JR;var KR=wn(Object,"create"),hs=KR;function ZR(){this.__data__=hs?hs(null):{},this.size=0}var Ew=ZR;function $R(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var _w=$R;var eB="__lodash_hash_undefined__",tB=Object.prototype,rB=tB.hasOwnProperty;function nB(i){var e=this.__data__;if(hs){var t=e[i];return t===eB?void 0:t}return rB.call(e,i)?e[i]:void 0}var Cw=nB;var iB=Object.prototype,sB=iB.hasOwnProperty;function oB(i){var e=this.__data__;return hs?e[i]!==void 0:sB.call(e,i)}var Dw=oB;var aB="__lodash_hash_undefined__";function lB(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=hs&&e===void 0?aB:e,this}var Pw=lB;function ul(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}ul.prototype.clear=Ew;ul.prototype.delete=_w;ul.prototype.get=Cw;ul.prototype.has=Dw;ul.prototype.set=Pw;var vy=ul;function cB(){this.__data__=[],this.size=0}var Lw=cB;function hB(i,e){for(var t=i.length;t--;)if(Xs(i[t][0],e))return t;return-1}var Js=hB;var uB=Array.prototype,fB=uB.splice;function dB(i){var e=this.__data__,t=Js(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():fB.call(e,t,1),--this.size,!0}var Iw=dB;function pB(i){var e=this.__data__,t=Js(e,i);return t<0?void 0:e[t][1]}var Rw=pB;function mB(i){return Js(this.__data__,i)>-1}var Bw=mB;function gB(i,e){var t=this.__data__,r=Js(t,i);return r<0?(++this.size,t.push([i,e])):t[r][1]=e,this}var Nw=gB;function fl(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}fl.prototype.clear=Lw;fl.prototype.delete=Iw;fl.prototype.get=Rw;fl.prototype.has=Bw;fl.prototype.set=Nw;var Ks=fl;var yB=wn(ar,"Map"),Zs=yB;function vB(){this.size=0,this.__data__={hash:new vy,map:new(Zs||Ks),string:new vy}}var Ow=vB;function xB(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}var Fw=xB;function bB(i,e){var t=i.__data__;return Fw(e)?t[typeof e=="string"?"string":"hash"]:t.map}var $s=bB;function wB(i){var e=$s(this,i).delete(i);return this.size-=e?1:0,e}var Uw=wB;function SB(i){return $s(this,i).get(i)}var zw=SB;function MB(i){return $s(this,i).has(i)}var Gw=MB;function AB(i,e){var t=$s(this,i),r=t.size;return t.set(i,e),this.size+=t.size==r?0:1,this}var kw=AB;function dl(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}dl.prototype.clear=Ow;dl.prototype.delete=Uw;dl.prototype.get=zw;dl.prototype.has=Gw;dl.prototype.set=kw;var wh=dl;var TB="Expected a function";function xy(i,e){if(typeof i!="function"||e!=null&&typeof e!="function")throw new TypeError(TB);var t=function(){var r=arguments,n=e?e.apply(this,r):r[0],s=t.cache;if(s.has(n))return s.get(n);var o=i.apply(this,r);return t.cache=s.set(n,o)||s,o};return t.cache=new(xy.Cache||wh),t}xy.Cache=wh;var Vw=xy;var EB=500;function _B(i){var e=Vw(i,function(r){return t.size===EB&&t.clear(),r}),t=e.cache;return e}var Hw=_B;var CB=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,DB=/\\(\\)?/g,PB=Hw(function(i){var e=[];return i.charCodeAt(0)===46&&e.push(""),i.replace(CB,function(t,r,n,s){e.push(n?s.replace(DB,"$1"):r||t)}),e}),Ww=PB;function LB(i){return i==null?"":Yb(i)}var jw=LB;function IB(i,e){return Vr(i)?i:Tw(i,e)?[i]:Ww(jw(i))}var pl=IB;var RB=1/0;function BB(i){if(typeof i=="string"||Ys(i))return i;var e=i+"";return e=="0"&&1/i==-RB?"-0":e}var vd=BB;function NB(i,e){e=pl(e,i);for(var t=0,r=e.length;i!=null&&t<r;)i=i[vd(e[t++])];return t&&t==r?i:void 0}var qw=NB;function OB(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i}var ml=OB;var Yw=un?un.isConcatSpreadable:void 0;function FB(i){return Vr(i)||Go(i)||!!(Yw&&i&&i[Yw])}var Xw=FB;function Qw(i,e,t,r,n){var s=-1,o=i.length;for(t||(t=Xw),n||(n=[]);++s<o;){var a=i[s];e>0&&t(a)?e>1?Qw(a,e-1,t,r,n):ml(n,a):r||(n[n.length]=a)}return n}var Jw=Qw;function UB(i){var e=i==null?0:i.length;return e?Jw(i,1):[]}var Kw=UB;function zB(i){return hd(dd(i,void 0,Kw),i+"")}var Zw=zB;var GB=yd(Object.getPrototypeOf,Object),gl=GB;var kB="[object Object]",VB=Function.prototype,HB=Object.prototype,$w=VB.toString,WB=HB.hasOwnProperty,jB=$w.call(Object);function qB(i){if(!Kr(i)||Pn(i)!=kB)return!1;var e=gl(i);if(e===null)return!0;var t=WB.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&$w.call(t)==jB}var xd=qB;function YB(i,e,t){var r=-1,n=i.length;e<0&&(e=-e>n?0:n+e),t=t>n?n:t,t<0&&(t+=n),n=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(n);++r<n;)s[r]=i[r+e];return s}var eS=YB;function XB(){this.__data__=new Ks,this.size=0}var tS=XB;function QB(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}var rS=QB;function JB(i){return this.__data__.get(i)}var nS=JB;function KB(i){return this.__data__.has(i)}var iS=KB;var ZB=200;function $B(i,e){var t=this.__data__;if(t instanceof Ks){var r=t.__data__;if(!Zs||r.length<ZB-1)return r.push([i,e]),this.size=++t.size,this;t=this.__data__=new wh(r)}return t.set(i,e),this.size=t.size,this}var sS=$B;function yl(i){var e=this.__data__=new Ks(i);this.size=e.size}yl.prototype.clear=tS;yl.prototype.delete=rS;yl.prototype.get=nS;yl.prototype.has=iS;yl.prototype.set=sS;var bd=yl;function eN(i,e){return i&&Wn(e,hl(e),i)}var oS=eN;function tN(i,e){return i&&Wn(e,Di(e),i)}var aS=tN;var uS=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lS=uS&&typeof module=="object"&&module&&!module.nodeType&&module,rN=lS&&lS.exports===uS,cS=rN?ar.Buffer:void 0,hS=cS?cS.allocUnsafe:void 0;function nN(i,e){if(e)return i.slice();var t=i.length,r=hS?hS(t):new i.constructor(t);return i.copy(r),r}var wd=nN;function iN(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var o=i[t];e(o,t,i)&&(s[n++]=o)}return s}var fS=iN;function sN(){return[]}var Sd=sN;var oN=Object.prototype,aN=oN.propertyIsEnumerable,dS=Object.getOwnPropertySymbols,lN=dS?function(i){return i==null?[]:(i=Object(i),fS(dS(i),function(e){return aN.call(i,e)}))}:Sd,vl=lN;function cN(i,e){return Wn(i,vl(i),e)}var pS=cN;var hN=Object.getOwnPropertySymbols,uN=hN?function(i){for(var e=[];i;)ml(e,vl(i)),i=gl(i);return e}:Sd,Md=uN;function fN(i,e){return Wn(i,Md(i),e)}var mS=fN;function dN(i,e,t){var r=e(i);return Vr(i)?r:ml(r,t(i))}var Ad=dN;function pN(i){return Ad(i,hl,vl)}var gS=pN;function mN(i){return Ad(i,Di,Md)}var Td=mN;var gN=wn(ar,"DataView"),Ed=gN;var yN=wn(ar,"Promise"),_d=yN;var vN=wn(ar,"Set"),Cd=vN;var yS="[object Map]",xN="[object Object]",vS="[object Promise]",xS="[object Set]",bS="[object WeakMap]",wS="[object DataView]",bN=ls(Ed),wN=ls(Zs),SN=ls(_d),MN=ls(Cd),AN=ls(ld),ko=Pn;(Ed&&ko(new Ed(new ArrayBuffer(1)))!=wS||Zs&&ko(new Zs)!=yS||_d&&ko(_d.resolve())!=vS||Cd&&ko(new Cd)!=xS||ld&&ko(new ld)!=bS)&&(ko=function(i){var e=Pn(i),t=e==xN?i.constructor:void 0,r=t?ls(t):"";if(r)switch(r){case bN:return wS;case wN:return yS;case SN:return vS;case MN:return xS;case AN:return bS}return e});var xl=ko;var TN=Object.prototype,EN=TN.hasOwnProperty;function _N(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&EN.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var SS=_N;var CN=ar.Uint8Array,by=CN;function DN(i){var e=new i.constructor(i.byteLength);return new by(e).set(new by(i)),e}var bl=DN;function PN(i,e){var t=e?bl(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var MS=PN;var LN=/\w*$/;function IN(i){var e=new i.constructor(i.source,LN.exec(i));return e.lastIndex=i.lastIndex,e}var AS=IN;var TS=un?un.prototype:void 0,ES=TS?TS.valueOf:void 0;function RN(i){return ES?Object(ES.call(i)):{}}var _S=RN;function BN(i,e){var t=e?bl(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var Dd=BN;var NN="[object Boolean]",ON="[object Date]",FN="[object Map]",UN="[object Number]",zN="[object RegExp]",GN="[object Set]",kN="[object String]",VN="[object Symbol]",HN="[object ArrayBuffer]",WN="[object DataView]",jN="[object Float32Array]",qN="[object Float64Array]",YN="[object Int8Array]",XN="[object Int16Array]",QN="[object Int32Array]",JN="[object Uint8Array]",KN="[object Uint8ClampedArray]",ZN="[object Uint16Array]",$N="[object Uint32Array]";function e3(i,e,t){var r=i.constructor;switch(e){case HN:return bl(i);case NN:case ON:return new r(+i);case WN:return MS(i,t);case jN:case qN:case YN:case XN:case QN:case JN:case KN:case ZN:case $N:return Dd(i,t);case FN:return new r;case UN:case kN:return new r(i);case zN:return AS(i);case GN:return new r;case VN:return _S(i)}}var CS=e3;function t3(i){return typeof i.constructor=="function"&&!al(i)?rw(gl(i)):{}}var Pd=t3;var r3="[object Map]";function n3(i){return Kr(i)&&xl(i)==r3}var DS=n3;var PS=cs&&cs.isMap,i3=PS?cl(PS):DS,LS=i3;var s3="[object Set]";function o3(i){return Kr(i)&&xl(i)==s3}var IS=o3;var RS=cs&&cs.isSet,a3=RS?cl(RS):IS,BS=a3;var l3=1,c3=2,h3=4,NS="[object Arguments]",u3="[object Array]",f3="[object Boolean]",d3="[object Date]",p3="[object Error]",OS="[object Function]",m3="[object GeneratorFunction]",g3="[object Map]",y3="[object Number]",FS="[object Object]",v3="[object RegExp]",x3="[object Set]",b3="[object String]",w3="[object Symbol]",S3="[object WeakMap]",M3="[object ArrayBuffer]",A3="[object DataView]",T3="[object Float32Array]",E3="[object Float64Array]",_3="[object Int8Array]",C3="[object Int16Array]",D3="[object Int32Array]",P3="[object Uint8Array]",L3="[object Uint8ClampedArray]",I3="[object Uint16Array]",R3="[object Uint32Array]",Wt={};Wt[NS]=Wt[u3]=Wt[M3]=Wt[A3]=Wt[f3]=Wt[d3]=Wt[T3]=Wt[E3]=Wt[_3]=Wt[C3]=Wt[D3]=Wt[g3]=Wt[y3]=Wt[FS]=Wt[v3]=Wt[x3]=Wt[b3]=Wt[w3]=Wt[P3]=Wt[L3]=Wt[I3]=Wt[R3]=!0;Wt[p3]=Wt[OS]=Wt[S3]=!1;function Ld(i,e,t,r,n,s){var o,a=e&l3,l=e&c3,c=e&h3;if(t&&(o=n?t(i,r,n,s):t(i)),o!==void 0)return o;if(!fr(i))return i;var h=Vr(i);if(h){if(o=SS(i),!a)return cd(i,o)}else{var u=xl(i),f=u==OS||u==m3;if(ll(i))return wd(i,a);if(u==FS||u==NS||f&&!n){if(o=l||f?{}:Pd(i),!a)return l?mS(i,aS(o,i)):pS(i,oS(o,i))}else{if(!Wt[u])return n?i:{};o=CS(i,u,a)}}s||(s=new bd);var d=s.get(i);if(d)return d;s.set(i,o),BS(i)?i.forEach(function(g){o.add(Ld(g,e,t,g,i,s))}):LS(i)&&i.forEach(function(g,v){o.set(v,Ld(g,e,t,v,i,s))});var p=c?l?Td:gS:l?Di:hl,m=h?void 0:p(i);return aw(m||i,function(g,v){m&&(v=g,g=i[v]),fd(o,v,Ld(g,e,t,v,i,s))}),o}var Id=Ld;var B3=1,N3=4;function O3(i){return Id(i,B3|N3)}var Sh=O3;function F3(i){return function(e,t,r){for(var n=-1,s=Object(e),o=r(e),a=o.length;a--;){var l=o[i?a:++n];if(t(s[l],l,s)===!1)break}return e}}var US=F3;var U3=US(),zS=U3;var z3=function(){return ar.Date.now()},Rd=z3;var G3="Expected a function",k3=Math.max,V3=Math.min;function H3(i,e,t){var r,n,s,o,a,l,c=0,h=!1,u=!1,f=!0;if(typeof i!="function")throw new TypeError(G3);e=my(e)||0,fr(t)&&(h=!!t.leading,u="maxWait"in t,s=u?k3(my(t.maxWait)||0,e):s,f="trailing"in t?!!t.trailing:f);function d(T){var A=r,x=n;return r=n=void 0,c=T,o=i.apply(x,A),o}function p(T){return c=T,a=setTimeout(v,e),h?d(T):o}function m(T){var A=T-l,x=T-c,E=e-A;return u?V3(E,s-x):E}function g(T){var A=T-l,x=T-c;return l===void 0||A>=e||A<0||u&&x>=s}function v(){var T=Rd();if(g(T))return y(T);a=setTimeout(v,m(T))}function y(T){return a=void 0,f&&r?d(T):(r=n=void 0,o)}function w(){a!==void 0&&clearTimeout(a),c=0,r=l=n=a=void 0}function b(){return a===void 0?o:y(Rd())}function S(){var T=Rd(),A=g(T);if(r=arguments,n=this,l=T,A){if(a===void 0)return p(l);if(u)return clearTimeout(a),a=setTimeout(v,e),d(l)}return a===void 0&&(a=setTimeout(v,e)),o}return S.cancel=w,S.flush=b,S}var Mh=H3;function W3(i,e,t){(t!==void 0&&!Xs(i[e],t)||t===void 0&&!(e in i))&&ol(i,e,t)}var Ah=W3;function j3(i){return Kr(i)&&Qs(i)}var GS=j3;function q3(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}var Th=q3;function Y3(i){return Wn(i,Di(i))}var kS=Y3;function X3(i,e,t,r,n,s,o){var a=Th(i,t),l=Th(e,t),c=o.get(l);if(c){Ah(i,t,c);return}var h=s?s(a,l,t+"",i,e,o):void 0,u=h===void 0;if(u){var f=Vr(l),d=!f&&ll(l),p=!f&&!d&&md(l);h=l,f||d||p?Vr(a)?h=a:GS(a)?h=cd(a):d?(u=!1,h=wd(l,!0)):p?(u=!1,h=Dd(l,!0)):h=[]:xd(l)||Go(l)?(h=a,Go(a)?h=kS(a):(!fr(a)||il(a))&&(h=Pd(l))):u=!1}u&&(o.set(l,h),n(h,l,r,s,o),o.delete(l)),Ah(i,t,h)}var VS=X3;function HS(i,e,t,r,n){i!==e&&zS(e,function(s,o){if(n||(n=new bd),fr(s))VS(i,e,o,t,HS,r,n);else{var a=r?r(Th(i,o),s,o+"",i,e,n):void 0;a===void 0&&(a=s),Ah(i,o,a)}},Di)}var WS=HS;function Q3(i){var e=i==null?0:i.length;return e?i[e-1]:void 0}var jS=Q3;function J3(i,e){return e.length<2?i:qw(i,eS(e,0,-1))}var qS=J3;var K3=uw(function(i,e,t){WS(i,e,t)}),Vo=K3;function Z3(i,e){return e=pl(e,i),i=qS(i,e),i==null||delete i[vd(jS(e))]}var YS=Z3;function $3(i){return xd(i)?void 0:i}var XS=$3;var eO=1,tO=2,rO=4,nO=Zw(function(i,e){var t={};if(i==null)return t;var r=!1;e=sd(e,function(s){return s=pl(s,i),r||(r=s.length>1),s}),Wn(i,Td(i),t),r&&(t=Id(t,eO|tO|rO,XS));for(var n=e.length;n--;)YS(t,e[n]);return t}),wl=nO;var QS=i=>new Promise(e=>setTimeout(e,i));var iO=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().includes(" electron/"),sO=()=>typeof window>"u"?!1:window.navigator.platform.toUpperCase().includes("MAC"),oO=()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(window.navigator.userAgent)||Eh&&"ontouchend"in document,aO=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,lO=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0,cO=()=>{let i=navigator.userAgent,e=navigator.vendor;return/Safari/i.test(i)&&/Apple Computer/.test(e)},e9=iO(),Eh=sO(),Ho=oO(),JS=aO(),Bd=lO(),KS=cO();function ZS(i){return Array.isArray(i)?i:[i]}function _h(i){return Eh?i.metaKey:i.ctrlKey}var eo;(t=>{t.all=["PerspectiveCamera","OrthographicCamera"];function e(r){return t.all.includes(r)}t.is=e})(eo||(eo={}));var Wo;(n=>{n.DefaultUp=[0,1,0],n.DefaultTargetOffset=1e3,n.defaultData={far:1e5,type:"OrthographicCamera",perspective:{near:5,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:n.DefaultUp,isUpVectorFlipped:!1,targetOffset:n.DefaultTargetOffset};function r(s){return s.type==="PerspectiveCamera"?s.perspective.zoom:s.orthographic.zoom}n.getZoom=r})(Wo||(Wo={}));var us;(t=>{function i(r,n){return r[0]===n[0]&&r[1]===n[1]}t.isEqual=i;function e(r,n,s){return[r[0]+(n[0]-r[0])*s,r[1]+(n[1]-r[1])*s]}t.lerp=e})(us||(us={}));var br;(n=>{function i(s,o){return s[0]===o[0]&&s[1]===o[1]&&s[2]===o[2]}n.isEqual=i;function e(s,o){return[s[0]+o[0],s[1]+o[1],s[2]+o[2]]}n.add=e;function t(s,o){return[s[0]-o[0],s[1]-o[1],s[2]-o[2]]}n.sub=t;function r(s,o,a){return[s[0]+(o[0]-s[0])*a,s[1]+(o[1]-s[1])*a,s[2]+(o[2]-s[2])*a]}n.lerp=r})(br||(br={}));var Ch;(t=>{function i(r,n){return r[0]===n[0]&&r[1]===n[1]&&r[2]===n[2]&&r[3]===n[3]}t.isEqual=i;function e(r,n,s){return[r[0]+(n[0]-r[0])*s,r[1]+(n[1]-r[1])*s,r[2]+(n[2]-r[2])*s,r[3]+(n[3]-r[3])*s]}t.lerp=e})(Ch||(Ch={}));var Pi;(n=>{n.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function e(s,o){for(let a=0;a<16;a++)if(s[a]!==o[a])return!1;return!0}n.isEqual=e;function t(s){return s!=null?s:n.identity}n.simplify=t;function r(s,o){let a=o.slice(0);for(var l=0,c=o.length;l<c;l+=3){let h=s[3]*o[l]+s[7]*o[l+1]+s[11]*o[l+2]+s[15];a[l]=(s[0]*o[l]+s[4]*o[l+1]+s[8]*o[l+2]+s[12])/h,a[l+1]=(s[1]*o[l]+s[5]*o[l+1]+s[9]*o[l+2]+s[13])/h,a[l+2]=(s[2]*o[l]+s[6]*o[l+1]+s[10]*o[l+2]+s[14])/h}return a}n.applyMatrix4=r})(Pi||(Pi={}));var Ar;(l=>{l.white={r:1,g:1,b:1},l.red={r:1,g:0,b:0},l.black={r:0,g:0,b:0};function r(c){return{r:Math.round(c.r*255),g:Math.round(c.g*255),b:Math.round(c.b*255),a:1}}l.toRgb255a1=r;function n(c){return{r:c.r,g:c.g,b:c.b}}l.clone=n;function s(c){return c=Math.floor(c),{r:(c>>16&255)/255,g:(c>>8&255)/255,b:(c&255)/255}}l.fromHex=s;function o(c,h){return c.r===h.r&&c.g===h.g&&c.b===h.b}l.equals=o;function a(c,h,u){return{r:c.r+(h.r-c.r)*u,g:c.g+(h.g-c.g)*u,b:c.b+(h.b-c.b)*u}}l.lerp=a})(Ar||(Ar={}));var Ln;(o=>{o.white=xe(ie({},Ar.white),{a:1});function e(a){return{r:a[0],g:a[1],b:a[2],a:a[3]}}o.from0to1=e;function t(a,l){return xe(ie({},Ar.fromHex(a)),{a:l})}o.fromHexAndA=t;function r(a){return{r:Math.round(a.r*255),g:Math.round(a.g*255),b:Math.round(a.b*255),a:a.a}}o.toRgb255a1=r;function n(a,l){return Ar.equals(a,l)&&a.a===l.a}o.equals=n;function s(a,l,c){return{r:a.r+(l.r-a.r)*c,g:a.g+(l.g-a.g)*c,b:a.b+(l.b-a.b)*c,a:a.a+(l.a-a.a)*c}}o.lerp=s})(Ln||(Ln={}));var Nd;(e=>e.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]})(Nd||(Nd={}));var Od;(e=>e.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(Od||(Od={}));var Fd;(e=>e.defaultData={control1:[.5,.05],control2:[.1,.3]})(Fd||(Fd={}));var Ud;(e=>{function i(t,r=.1){return{type:"radial",hideBase:!1,count:3,radial:{radius:Math.max(t[0],t[1])*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[t[0]+t[0]*r,0,0]},grid:{count:[2,2,2],size:t.map(n=>n*(1+r)),useCenter:!0}}}e.defaultData=i})(Ud||(Ud={}));var jn=class{modifyById(e,t){let r=this;if(r[e]===void 0)throw new Error("not expected");{let s=xe(ie({},r),{[e]:t});return Object.setPrototypeOf(s,jn.prototype),s}}add(e,t){var n;let r=this.runOp({type:1,id:e,data:t});return(n=r==null?void 0:r.data)!=null?n:this}runOp(e){let t=this;if(e.type===1){let r=t[e.id],n;r===void 0?n={type:2,id:e.id}:n={type:1,id:e.id,data:r};let{id:s,data:o}=e,a=xe(ie({},t),{[s]:o});return Object.setPrototypeOf(a,jn.prototype),{data:a,actual:e,reverse:n}}else if(e.type===2){let{id:r}=e,n=t[r];if(n===void 0)return null;{let s=ie({},t);return Object.setPrototypeOf(s,jn.prototype),delete s[r],{data:s,actual:e,reverse:{type:1,id:r,data:n}}}}throw new Error("illegal arg")}};function Dh(i){if(i.deepFreeze!==void 0){i.deepFreeze(i);return}let e=Object.getOwnPropertyNames(i);for(let t of e){let r=i[t];r&&typeof r=="object"&&Dh(r)}return Object.freeze(i)}function $S(i,e){let t=0;for(;t<i.length&&t<e.length;){if(i[t]<e[t])return-1;if(i[t]>e[t])return 1;t+=1}return t!==e.length?-1:t!==i.length?1:0}var zd=class extends Error{};function Li(i,e,t){if(i===void 0?e===void 0?(i=0,e=10):i=e-10:e===void 0&&(e=i+10),i>e){let s=i;i=e,e=s}let r=[],n=1/(t+1);for(let s=0;s<t;s++){let o=i+(e-i)*(s+.75+Math.random()*.5)*n;r.push(o)}return r}function eM(i){return i instanceof Uint8Array||i instanceof Uint16Array||i instanceof Uint32Array||i instanceof Int8Array||i instanceof Int16Array||i instanceof Int32Array||i instanceof Float32Array||i instanceof Float64Array}function tM(){return typeof process<"u"}function rM(i,e){for(let t of i)e(t.id,t.data),rM(t.children,e)}function nM(i,e){e(i.id,i.data);for(let t of i.children)nM(t,e)}var qn=class extends Array{constructor(...t){super(...t);Object.setPrototypeOf(this,qn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)Dh(this[t]),t++}fillCaches0(t,r){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,r);for(let n of t.children)this.fillCaches0(n,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}isDescendantOf(t,r){for(;t;){let n=this.parent(t);if(n===r)return!0;t=n}return!1}data(t){var r;return(r=this.get(t))==null?void 0:r.data}has(t){return this.childrenOf(t)!==void 0}get(t){return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){var r;return t===null?this:(r=this.get(t))==null?void 0:r.children}traverseFrom(t,r){if(t===null)this.traverse(r);else{let n=this.get(t);n&&nM(n,r)}}traverse(t){rM(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,r){if(this.get(t)===void 0)throw new Error("not expected");{let s=this.parent(t),o=this.childrenArray(s),a=o.findIndex(h=>h.id===t);if(a<0)throw new Error("not expected");let l=o[a];return o=[...o],o[a]=xe(ie({},l),{data:r}),this.modifyArrayBy(s,o)}}modifyArrayBy(t,r){let n=t,s=r;for(;n!==null;){let a=s,l=n;if(n=this.parent(n),n===void 0)throw new Error;s=this.childrenArray(n);let c=s.findIndex(h=>h.id===l);if(c<0)throw new Error;s=[...s],s[c]=xe(ie({},s[c]),{children:a})}Object.setPrototypeOf(s,qn.prototype);let o=s;return o.fillCaches(),o}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}}checkDuplicatedIdRec({id:t,children:r}){if(this.get(t)!==void 0)return!0;for(let n of r)if(this.checkDuplicatedIdRec(n))return!0;return!1}addOp(t){let{parent:r,fi:n,id:s,data:o,children:a}=t;if(r!==null&&this.get(r)===void 0)return null;if(this.checkDuplicatedIdRec(t))return null;{let l=r,c=this.childrenArray(l),h={fi:n,id:s,data:o,children:a};return c=[...c,h],c.sort((f,d)=>f.fi-d.fi),t.localIndex=c.indexOf(h),{data:this.modifyArrayBy(l,c),actual:t,reverse:{type:8,id:s}}}}deleteOp(t){let{id:r}=t;if(this.get(r)===null)return null;{let n=this.parent(r);if(n===void 0)return null;let s=this.childrenArray(n),o=s.findIndex(c=>c.id===r);t.localIndex=o,s=[...s];let a=s.splice(o,1)[0];return{data:this.modifyArrayBy(n,s),actual:t,reverse:xe(ie({type:7},a),{parent:n})}}}moveOp(t){let{parent:r,fi:n,id:s}=t;if(r!==null&&this.get(r)===void 0)return this.deleteOp({type:8,id:s});if(r!==null){let d=r;for(;d!==null;){if(d===void 0)throw new Error;if(d===s)throw new zd("cyclic tree");d=this.parent(d)}}let o=this.parent(s);if(o===void 0)return null;let a=o,l=this.childrenArray(o),c=l.findIndex(d=>d.id===s);l=[...l];let h=l.splice(c,1)[0],u=this.modifyArrayBy(o,l);o=r,l=u.childrenArray(o);let f=h.fi;return h=xe(ie({},h),{fi:n}),l=[...l,h],l.sort((d,p)=>d.fi-p.fi),t.localIndex=l.indexOf(h),u=u.modifyArrayBy(o,l),{data:u,actual:t,reverse:{type:9,parent:a,fi:f,id:s}}}previous(t,r){if(r===null){let s=this.childrenArray(t);return s.length===0?null:s[s.length-1].id}let n=null;for(let s of this.childrenArray(t)){if(s.id===r)return n;n=s.id}return null}traverseSortNext(t){let r=this.parent(t);if(r!==void 0){let n=this.childrenArray(r),s=n.findIndex(o=>o.id===t)+1;if(s<n.length)return n[s].id;if(r)return this.traverseSortNext(r)}}sortNext(t){let r=this.childrenArray(t);return r.length>0?r[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let r=this.childrenArray(t);return r.length>0?this.traverseSortPrevious(r[r.length-1].id):t}sortPrevious(t){let r=this.parent(t);if(r!==void 0){let n=this.childrenArray(r),s=n.findIndex(o=>o.id===t)-1;return s>=0?this.traverseSortPrevious(n[s].id):r}}getAllSorted(t){let r=[];for(let n of t){let s=this.getWithSortKey(n.id);s!==void 0&&r.push(ie(ie({},n),s))}r.sort((n,s)=>$S(n.sortKey,s.sortKey));for(let n of r)delete n.sortKey;return r}getWithSortKey(t){var r=t;let n=[],s=this.get(r),o=s;if(s!==void 0){for(;r;)n.splice(0,0,s.fi),r=this.parent(r),r!==null&&(s=this.get(r));return xe(ie({},o),{sortKey:n})}}insertBeforeHelper(t,r,n){return this.insertAfterHelper(t,this.previous(t,r),n)}insertAfterHelper(t,r,n){let s=this.childrenArray(t);if(r===null){if(s.length===0)return Li(0,n,n);{let o=s[0].fi;return Li(o-n,o,n)}}else{let o=this.get(r);if(o===void 0||this.parent(r)!==t)throw new Error("illegal args");let a=s.find(l=>l.fi>o.fi);if(a===void 0){let l=s[s.length-1].fi;return Li(l,l+n,n)}else return Li(o.fi,a.fi,n)}}};var Gd;(e=>{function i(t,r){if(Array.isArray(t)){let n=r.props,s={},o=[...t],a=!1;if(n)for(let l of Object.keys(n)){let c=parseInt(l);if(isNaN(c))throw new Error("wrong index");s[l]=o[c],o[c]=n[l],a=!0}return a?{data:o,actual:r,reverse:{type:0,props:s}}:null}else{let n=r.props,s={},o=ie({},t),a=!1;if(n)for(let l of Object.keys(n)){s[l]=o[l];let c=n[l];c===void 0?delete o[l]:o[l]=c,a=!0}return a?{data:o,actual:r,reverse:{type:0,props:s}}:null}}e.runOp=i})(Gd||(Gd={}));var rr=class extends Array{constructor(...t){super(...t);Object.setPrototypeOf(this,rr.prototype)}deepFreeze(){let t=0;for(;t<this.length;)Dh(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){var r;return(r=this.get(t))==null?void 0:r.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,r){if(this.get(t)===void 0)throw new Error("not expected");{let s=this,o=s.findIndex(c=>c.id===t);if(o<0)throw new Error("not expected");let a=s[o];return s=[...s],s[o]=xe(ie({},a),{data:r}),this.modifyArrayBy(s)}}modifyArrayBy(t){Object.setPrototypeOf(t,rr.prototype);let r=t;return tM()||r.fillCaches(),r}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}}addOp(t){let{fi:r,id:n,data:s}=t,o=this,a={fi:r,id:n,data:s};return o=[...o,a],o.sort((c,h)=>c.fi-h.fi),t.localIndex=o.indexOf(a),{data:this.modifyArrayBy(o),actual:t,reverse:{type:5,id:n}}}deleteOp(t){let{id:r}=t,n=this,s=n.findIndex(l=>l.id===r);if(s===-1)return null;t.localIndex=s,n=[...n];let o=n.splice(s,1)[0];return{data:this.modifyArrayBy(n),actual:t,reverse:ie({type:4},o)}}moveOp(t){let{fi:r,id:n}=t,s=this;s=[...s];let o=s.findIndex(h=>h.id===n);if(o===-1)return null;let a=s[o].fi,l=xe(ie({},s[o]),{fi:r});return s[o]=l,s.sort((h,u)=>h.fi-u.fi),t.localIndex=s.indexOf(l),{data:this.modifyArrayBy(s),actual:t,reverse:{type:6,fi:a,id:n}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let r=null;for(let n of this){if(n.id===t)return r;r=n.id}return null}insertBeforeHelper(t,r){return this.insertAfterHelper(this.previous(t),r)}insertAfterHelper(t,r){let n=this;if(t===null){if(n.length===0)return Li(0,r,r);{let s=n[0].fi;return Li(s-r,s,r)}}else{let s=this.get(t);if(s===void 0)throw new Error("illegal args");let o=n.find(a=>a.fi>s.fi);if(o===void 0){let a=n[n.length-1].fi;return Li(a,a+r,r)}else return Li(s.fi,o.fi,r)}}};var iM=Symbol(),Vd=Symbol(),Sl=class{reportOp(e,t){let r=this;if(t===null)return;r._current=t.data;let n=[];for(;!(r instanceof kd);){let s=r._path,o=r._current;if(s!==""&&n.splice(0,0,s),r=r._parent,r===null)return;r.update(s,o)}r.push(n,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let r=t[Vd];r&&r(),delete this._children[e]}}}},Sy=class extends Sl{constructor(e,t,r){super(),this._parent=e,this._path=t,this._current=r}update(e,t){if(Array.isArray(this._current)){if(typeof e=="string"&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid path");this._current=[...this._current],this._current[e]=t}else this._current=xe(ie({},this._current),{[e]:t})}runOp(e){this.reportOp(e,Gd.runOp(this._current,e))}},My=class extends Sl{constructor(e,t,r){super(),this._parent=e,this._path=t,this._current=r}update(e,t){this._current=xe(ie({},this._current),{[e]:t}),Object.setPrototypeOf(this._current,jn.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},sM={get(i,e){if(e===Vd)return()=>{i._parent=null};if(e===iM)return i._current;let{_current:t,_children:r}=i;if(e==="push"&&Array.isArray(t))throw new Error("not supported to expand array");let n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=t[e],o=Hd(i,e,s);return o!==s?(r===void 0&&(r={},i._children=r),r[e]=o,o):s},has(i,e){return e in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,e){let t=i._current,r=Reflect.getOwnPropertyDescriptor(t,e);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:t[e]}}},hO=xe(ie({},sM),{set(i,e,t){var n;let r={type:0,props:{[e]:(n=Ey(t))!=null?n:t}};return i.deleteChildren(e),i.runOp(r),!0},deleteProperty(i,e){let t={type:0,props:{[e]:void 0}};return i.deleteChildren(e),i.runOp(t),!0}}),uO=xe(ie({},sM),{set(i,e,t){return t===void 0?this.deleteProperty(i,e):(i.deleteChildren(e),i.runOp({type:1,id:e,data:t})),!0},deleteProperty(i,e){return i.runOp({type:2,id:e}),!0}}),Ml=class extends Sl{constructor(e,t,r){super(),this._children={},this._parent=e,this._path=t,this._current=r,this[Vd]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}traverse(e){return this._current.traverse(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse((t,r)=>{e(t,this.data(t))})}data(e){var a;let{_current:t,_children:r}=this,n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=(a=t.get(e))==null?void 0:a.data,o=Hd(this,e,s);return o!==s?(r===void 0&&(r={},this._children=r),r[e]=o,o):s}add(e,t,r,n,s){this.runOp({type:7,parent:e,fi:t,id:r,data:n,children:s})}move(e,t,r){this.runOp({type:9,parent:e,fi:t,id:r})}insertAfter(e,t,r){let n=this._current.insertAfterHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.add(e,n[s],o.id,o.data,o.children)}}insertBefore(e,t,r){let n=this._current.insertBeforeHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.add(e,n[s],o.id,o.data,o.children)}}moveAfter(e,t,r){let n=this._current.insertAfterHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.move(e,n[s],o)}}moveBefore(e,t,r){let n=this._current.insertBeforeHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.move(e,n[s],o)}}delete(e){this.deleteChildren(e),this.runOp({type:8,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},Al=class extends Sl{constructor(e,t,r){super(),this._children={},this._parent=e,this._path=t,this._current=r,this[Vd]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(e){let t=this.length;for(let r=0;r<t;r++){let n=this._current[r].id;e(this.data(this._current[r].id),n)}}update(e,t){this._current=this._current.modifyById(e,t)}randomId(){return this._current.randomId()}get(e){return xe(ie({},this._current.get(e)),{data:this.data(e)})}data(e){var a;let{_current:t,_children:r}=this,n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=(a=t.get(e))==null?void 0:a.data,o=Hd(this,e,s);return o!==s?(r===void 0&&(r={},this._children=r),r[e]=o,o):s}runOp(e){this.reportOp(e,this._current.runOp(e))}add(e,t,r){this.runOp({type:4,fi:e,id:t,data:r})}move(e,t){this.runOp({type:6,fi:e,id:t})}insertAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.add(r[n],s.id,s.data)}}insertBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.add(r[n],s.id,s.data)}}moveAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.move(r[n],s)}}moveBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.move(r[n],s)}}delete(e){this.deleteChildren(e),this.runOp({type:5,id:e})}};function wy(i,e,t){if(i.length>0){let r=i[i.length-1];if(r.type===0&&e.type===0&&Wd.equal(r.path,t)){Object.assign(r.props,e.props);return}}i.push(xe(ie({},e),{path:t}))}var kd=class{constructor(e){this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(e!=="")throw new Error("");this._current=t}push(e,t,r,n){wy(this.ts,t,e),wy(this.actual,r,e),wy(this.reverse,n,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function Hd(i,e,t){return t instanceof qn?new Ml(i,e,t):t instanceof rr?new Al(i,e,t):t instanceof jn?new Proxy(new My(i,e,t),uO):t!==null&&typeof t=="object"?eM(t)?t:new Proxy(new Sy(i,e,t),hO):t}function Ay(i){let e=new kd(i);return[Hd(e,"",i),e]}function Ty(i,e){let[t,r]=Ay(i);return e(t),r.result()}function Ey(i){return i instanceof Ml||i instanceof Al?i._current:i!==null&&typeof i=="object"?i[iM]:i}var Wd;(r=>{function i(n,s){if(s.length===n.length)for(var o=0;o<n.length;){if(n[o]!==s[o])return!1;o+=1}else return!1;return!0}r.equal=i;function e(n,s,o){let a=t(o,n);if(a!==void 0&&typeof a=="object"&&a!==null){let l=ie({},s);return Object.keys(a).forEach(c=>{delete l[c]}),l}else return s}r.removeOverridden=e;function t(n,s,o=0){if(s.length<=o)return n;if((n instanceof qn||n instanceof Ml)&&typeof s[o]=="string")return t(n.data(s[o]),s,o+1);if((n instanceof rr||n instanceof Al)&&typeof s[o]=="string")return t(n.data(s[o]),s,o+1);if(typeof s[o]=="number"&&Array.isArray(n))return t(n[s[o]],s,o+1);if(typeof s[o]=="string"&&typeof n=="object")return t(n[s[o]],s,o+1)}r.zoom=t})(Wd||(Wd={}));var jd=class{},Ph=class extends jd{constructor(t){super();this.id=t}},Lh=class extends jd{constructor(t){super();this.data=t}};var Cy;try{Cy=new TextDecoder}catch{}var Re,ro,$=0;var dM=[],Dy=dM,Py=0,Sn={},Ct,to,Yn=0,Ii=0,In,fs,fn=[],Bt,oM={useRecords:!1,mapsAsObjects:!0},Ih=class{},Iy=new Ih;Iy.name="MessagePack 0xC1";var Tl=!1,Ri=class{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0)),Object.assign(this,e)}unpack(e,t){if(Re)return vM(()=>(Yd(),this?this.unpack(e,t):Ri.prototype.unpack.call(oM,e,t)));ro=t>-1?t:e.length,$=0,Py=0,Ii=0,to=null,Dy=dM,In=null,Re=e;try{Bt=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(r){throw Re=null,e instanceof Uint8Array?r:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof Ri){if(Sn=this,this.structures)return Ct=this.structures,qd();(!Ct||Ct.length>0)&&(Ct=[])}else Sn=oM,(!Ct||Ct.length>0)&&(Ct=[]);return qd()}unpackMultiple(e,t){let r,n=0;try{Tl=!0;let s=e.length,o=this?this.unpack(e,s):Jd.unpack(e,s);if(t){for(t(o);$<s;)if(n=$,t(qd())===!1)return}else{for(r=[o];$<s;)n=$,r.push(qd());return r}}catch(s){throw s.lastPosition=n,s.values=r,s}finally{Tl=!1,Yd()}}_mergeStructures(e,t){e=e||[];for(let r=0,n=e.length;r<n;r++){let s=e[r];s&&(s.isShared=!0,r>=32&&(s.highByte=r-32>>5))}e.sharedLength=e.length;for(let r in t||[])if(r>=0){let n=e[r],s=t[r];s&&(n&&((e.restoreStructures||(e.restoreStructures=[]))[r]=n),e[r]=s)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function qd(){try{if(!Sn.trusted&&!Tl){let e=Ct.sharedLength||0;e<Ct.length&&(Ct.length=e)}let i=lr();if($==ro)Ct.restoreStructures&&aM(),Ct=null,Re=null,fs&&(fs=null);else if($>ro){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}else if(!Tl)throw new Error("Data read, but end of buffer not reached");return i}catch(i){throw Ct.restoreStructures&&aM(),Yd(),(i instanceof RangeError||i.message.startsWith("Unexpected end of buffer"))&&(i.incomplete=!0),i}}function aM(){for(let i in Ct.restoreStructures)Ct[i]=Ct.restoreStructures[i];Ct.restoreStructures=null}function lr(){let i=Re[$++];if(i<160)if(i<128){if(i<64)return i;{let e=Ct[i&63]||Sn.getStructures&&pM()[i&63];return e?(e.read||(e.read=Ry(e,i&63)),e.read()):i}}else if(i<144)if(i-=128,Sn.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[gM()]=lr();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(lr(),lr());return e}else{i-=144;let e=new Array(i);for(let t=0;t<i;t++)e[t]=lr();return e}else if(i<192){let e=i-160;if(Ii>=$)return to.slice($-Yn,($+=e)-Yn);if(Ii==0&&ro<140){let t=e<16?By(e):mM(e);if(t!=null)return t}return Ly(e)}else{let e;switch(i){case 192:return null;case 193:return In?(e=lr(),e>0?In[1].slice(In.position1,In.position1+=e):In[0].slice(In.position0,In.position0-=e)):Iy;case 194:return!1;case 195:return!0;case 196:return _y(Re[$++]);case 197:return e=Bt.getUint16($),$+=2,_y(e);case 198:return e=Bt.getUint32($),$+=4,_y(e);case 199:return jo(Re[$++]);case 200:return e=Bt.getUint16($),$+=2,jo(e);case 201:return e=Bt.getUint32($),$+=4,jo(e);case 202:if(e=Bt.getFloat32($),Sn.useFloat32>2){let t=Qd[(Re[$]&127)<<1|Re[$+1]>>7];return $+=4,(t*e+(e>0?.5:-.5)>>0)/t}return $+=4,e;case 203:return e=Bt.getFloat64($),$+=8,e;case 204:return Re[$++];case 205:return e=Bt.getUint16($),$+=2,e;case 206:return e=Bt.getUint32($),$+=4,e;case 207:return Sn.int64AsNumber?(e=Bt.getUint32($)*4294967296,e+=Bt.getUint32($+4)):e=Bt.getBigUint64($),$+=8,e;case 208:return Bt.getInt8($++);case 209:return e=Bt.getInt16($),$+=2,e;case 210:return e=Bt.getInt32($),$+=4,e;case 211:return Sn.int64AsNumber?(e=Bt.getInt32($)*4294967296,e+=Bt.getUint32($+4)):e=Bt.getBigInt64($),$+=8,e;case 212:if(e=Re[$++],e==114)return fM(Re[$++]&63);{let t=fn[e];if(t)return t.read?($++,t.read(lr())):t.noBuffer?($++,t()):t(Re.subarray($,++$));throw new Error("Unknown extension "+e)}case 213:return e=Re[$],e==114?($++,fM(Re[$++]&63,Re[$++])):jo(2);case 214:return jo(4);case 215:return jo(8);case 216:return jo(16);case 217:return e=Re[$++],Ii>=$?to.slice($-Yn,($+=e)-Yn):dO(e);case 218:return e=Bt.getUint16($),$+=2,Ii>=$?to.slice($-Yn,($+=e)-Yn):pO(e);case 219:return e=Bt.getUint32($),$+=4,Ii>=$?to.slice($-Yn,($+=e)-Yn):mO(e);case 220:return e=Bt.getUint16($),$+=2,cM(e);case 221:return e=Bt.getUint32($),$+=4,cM(e);case 222:return e=Bt.getUint16($),$+=2,hM(e);case 223:return e=Bt.getUint32($),$+=4,hM(e);default:if(i>=224)return i-256;if(i===void 0){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}throw new Error("Unknown MessagePack token "+i)}}}var fO=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Ry(i,e){function t(){if(t.count++>2){let n=i.read=new Function("r","return function(){return {"+i.map(s=>fO.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"}}")(lr);return i.highByte===0&&(i.read=lM(e,i.read)),n()}let r={};for(let n=0,s=i.length;n<s;n++){let o=i[n];r[o]=lr()}return r}return t.count=0,i.highByte===0?lM(e,t):t}var lM=(i,e)=>function(){let t=Re[$++];if(t===0)return e();let r=i<32?-(i+(t<<5)):i+(t<<5),n=Ct[r]||pM()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=Ry(n,i)),n.read()};function pM(){let i=vM(()=>(Re=null,Sn.getStructures()));return Ct=Sn._mergeStructures(i,Ct)}var Ly=Xd,dO=Xd,pO=Xd,mO=Xd;function Xd(i){let e;if(i<16&&(e=By(i)))return e;if(i>64&&Cy)return Cy.decode(Re.subarray($,$+=i));let t=$+i,r=[];for(e="";$<t;){let n=Re[$++];if((n&128)===0)r.push(n);else if((n&224)===192){let s=Re[$++]&63;r.push((n&31)<<6|s)}else if((n&240)===224){let s=Re[$++]&63,o=Re[$++]&63;r.push((n&31)<<12|s<<6|o)}else if((n&248)===240){let s=Re[$++]&63,o=Re[$++]&63,a=Re[$++]&63,l=(n&7)<<18|s<<12|o<<6|a;l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|l&1023),r.push(l)}else r.push(n);r.length>=4096&&(e+=Br.apply(String,r),r.length=0)}return r.length>0&&(e+=Br.apply(String,r)),e}function cM(i){let e=new Array(i);for(let t=0;t<i;t++)e[t]=lr();return e}function hM(i){if(Sn.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[gM()]=lr();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(lr(),lr());return e}}var Br=String.fromCharCode;function mM(i){let e=$,t=new Array(i);for(let r=0;r<i;r++){let n=Re[$++];if((n&128)>0){$=e;return}t[r]=n}return Br.apply(String,t)}function By(i){if(i<4)if(i<2){if(i===0)return"";{let e=Re[$++];if((e&128)>1){$-=1;return}return Br(e)}}else{let e=Re[$++],t=Re[$++];if((e&128)>0||(t&128)>0){$-=2;return}if(i<3)return Br(e,t);let r=Re[$++];if((r&128)>0){$-=3;return}return Br(e,t,r)}else{let e=Re[$++],t=Re[$++],r=Re[$++],n=Re[$++];if((e&128)>0||(t&128)>0||(r&128)>0||(n&128)>0){$-=4;return}if(i<6){if(i===4)return Br(e,t,r,n);{let s=Re[$++];if((s&128)>0){$-=5;return}return Br(e,t,r,n,s)}}else if(i<8){let s=Re[$++],o=Re[$++];if((s&128)>0||(o&128)>0){$-=6;return}if(i<7)return Br(e,t,r,n,s,o);let a=Re[$++];if((a&128)>0){$-=7;return}return Br(e,t,r,n,s,o,a)}else{let s=Re[$++],o=Re[$++],a=Re[$++],l=Re[$++];if((s&128)>0||(o&128)>0||(a&128)>0||(l&128)>0){$-=8;return}if(i<10){if(i===8)return Br(e,t,r,n,s,o,a,l);{let c=Re[$++];if((c&128)>0){$-=9;return}return Br(e,t,r,n,s,o,a,l,c)}}else if(i<12){let c=Re[$++],h=Re[$++];if((c&128)>0||(h&128)>0){$-=10;return}if(i<11)return Br(e,t,r,n,s,o,a,l,c,h);let u=Re[$++];if((u&128)>0){$-=11;return}return Br(e,t,r,n,s,o,a,l,c,h,u)}else{let c=Re[$++],h=Re[$++],u=Re[$++],f=Re[$++];if((c&128)>0||(h&128)>0||(u&128)>0||(f&128)>0){$-=12;return}if(i<14){if(i===12)return Br(e,t,r,n,s,o,a,l,c,h,u,f);{let d=Re[$++];if((d&128)>0){$-=13;return}return Br(e,t,r,n,s,o,a,l,c,h,u,f,d)}}else{let d=Re[$++],p=Re[$++];if((d&128)>0||(p&128)>0){$-=14;return}if(i<15)return Br(e,t,r,n,s,o,a,l,c,h,u,f,d,p);let m=Re[$++];if((m&128)>0){$-=15;return}return Br(e,t,r,n,s,o,a,l,c,h,u,f,d,p,m)}}}}}function _y(i){return Sn.copyBuffers?Uint8Array.prototype.slice.call(Re,$,$+=i):Re.subarray($,$+=i)}function jo(i){let e=Re[$++];if(fn[e])return fn[e](Re.subarray($,$+=i));throw new Error("Unknown extension type "+e)}var uM=new Array(4096);function gM(){let i=Re[$++];if(i>=160&&i<192){if(i=i-160,Ii>=$)return to.slice($-Yn,($+=i)-Yn);if(!(Ii==0&&ro<180))return Ly(i)}else return $--,lr();let e=(i<<5^(i>1?Bt.getUint16($):i>0?Re[$]:0))&4095,t=uM[e],r=$,n=$+i-3,s,o=0;if(t&&t.bytes==i){for(;r<n;){if(s=Bt.getUint32(r),s!=t[o++]){r=1879048192;break}r+=4}for(n+=3;r<n;)if(s=Re[r++],s!=t[o++]){r=1879048192;break}if(r===n)return $=r,t.string;n-=3,r=$}for(t=[],uM[e]=t,t.bytes=i;r<n;)s=Bt.getUint32(r),t.push(s),r+=4;for(n+=3;r<n;)s=Re[r++],t.push(s);let a=i<16?By(i):mM(i);return a!=null?t.string=a:t.string=Ly(i)}var fM=(i,e)=>{var t=lr();let r=i;e!==void 0&&(i=i<32?-((e<<5)+i):(e<<5)+i,t.highByte=e);let n=Ct[i];return n&&n.isShared&&((Ct.restoreStructures||(Ct.restoreStructures=[]))[i]=n),Ct[i]=t,t.read=Ry(t,r),t.read()},yM=typeof self=="object"?self:global;fn[0]=()=>{};fn[0].noBuffer=!0;fn[101]=()=>{let i=lr();return(yM[i[0]]||Error)(i[1])};fn[105]=i=>{let e=Bt.getUint32($-4);fs||(fs=new Map);let t=Re[$],r;t>=144&&t<160||t==220||t==221?r=[]:r={};let n={target:r};fs.set(e,n);let s=lr();return n.used?Object.assign(r,s):(n.target=s,s)};fn[112]=i=>{let e=Bt.getUint32($-4),t=fs.get(e);return t.used=!0,t.target};fn[115]=()=>new Set(lr());var Ny=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array");fn[116]=i=>{let e=i[0],t=Ny[e];if(!t)throw new Error("Could not find typed array for code "+e);return new yM[t](Uint8Array.prototype.slice.call(i,1).buffer)};fn[120]=()=>{let i=lr();return new RegExp(i[0],i[1])};fn[98]=i=>{let e=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],t=$;$+=e-4,In=[lr(),lr()],In.position0=0,In.position1=0;let r=$;$=t;try{return lr()}finally{$=r}};fn[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");function vM(i){let e=ro,t=$,r=Py,n=Yn,s=Ii,o=to,a=Dy,l=fs,c=In,h=new Uint8Array(Re.slice(0,ro)),u=Ct,f=Ct.slice(0,Ct.length),d=Sn,p=Tl,m=i();return ro=e,$=t,Py=r,Yn=n,Ii=s,to=o,Dy=a,fs=l,In=c,Re=h,Tl=p,Ct=u,Ct.splice(0,Ct.length,...f),Sn=d,Bt=new DataView(Re.buffer,Re.byteOffset,Re.byteLength),m}function Yd(){Re=null,fs=null,Ct=null}function xM(i){i.unpack?fn[i.type]=i.unpack:fn[i.type]=i}var Qd=new Array(147);for(let i=0;i<256;i++)Qd[i]=+("1e"+Math.floor(45.15-i*.30103));var Jd=new Ri({useRecords:!1}),gO=Jd.unpack,yO=Jd.unpackMultiple,vO=Jd.unpack,Kd={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},xO=new Float32Array(1),I9=new Uint8Array(xO.buffer,0,4);var Zd;try{Zd=new TextEncoder}catch{}var $d,Fy,ep=typeof Buffer<"u",Oy=ep?Buffer.allocUnsafeSlow:Uint8Array,MM=ep?Buffer:Uint8Array,bM=ep?4294967296:2144337920,de,dr,ae=0,Bi,Ni=null,bO=/[\u0080-\uFFFF]/,Rh=Symbol("record-id"),qo=class extends Ri{constructor(e){super(e),this.offset=0;let t,r,n,s,o,a,l=0,c=MM.prototype.utf8Write?function(x,E,_){return de.utf8Write(x,E,_)}:Zd&&Zd.encodeInto?function(x,E){return Zd.encodeInto(x,de.subarray(E)).written}:!1,h=this;e||(e={});let u=e&&e.sequential,f=e.structures||e.saveStructures,d=e.maxSharedStructures;if(d==null&&(d=f?32:0),d>8160)throw new Error("Maximum maxSharedStructure is 8160");let p=e.maxOwnStructures;p==null&&(p=f?32:64),u&&!e.saveStructures&&(this.structures=[]);let m=d>32||p+d>64,g=d+64,v=d+p+64;if(v>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let y=[],w=0,b=0;this.pack=this.encode=function(x,E){if(de||(de=new Oy(8192),dr=new DataView(de.buffer,0,8192),ae=0),Bi=de.length-10,Bi-ae<2048?(de=new Oy(de.length),dr=new DataView(de.buffer,0,de.length),Bi=de.length-10,ae=0):ae=ae+7&2147483640,r=ae,a=h.structuredClone?new Map:null,h.bundleStrings?(Ni=["",""],de[ae++]=214,de[ae++]=98,Ni.position=ae-r,ae+=4):Ni=null,n=h.structures,n){n.uninitialized&&(n=h._mergeStructures(h.getStructures()));let _=n.sharedLength||0;if(_>d)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+n.sharedLength);if(!n.transitions){n.transitions=Object.create(null);for(let C=0;C<_;C++){let I=n[C];if(!I)continue;let N,R=n.transitions;for(let k=0,G=I.length;k<G;k++){let te=I[k];N=R[te],N||(N=R[te]=Object.create(null)),R=N}R[Rh]=C+64}l=_}u||(n.nextId=_+64)}s&&(s=!1),o=n||[];try{if(S(x),Ni){dr.setUint32(Ni.position+r,ae-Ni.position-r);let _=Ni;Ni=null,S(_[0]),S(_[1])}if(h.offset=ae,a&&a.idsToInsert){ae+=a.idsToInsert.length*6,ae>Bi&&A(ae),h.offset=ae;let _=SO(de.subarray(r,ae),a.idsToInsert);return a=null,_}return E&TM?(de.start=r,de.end=ae,de):de.subarray(r,ae)}finally{if(n){if(b<10&&b++,w>1e4)n.transitions=null,b=0,w=0,y.length>0&&(y=[]);else if(y.length>0&&!u){for(let _=0,C=y.length;_<C;_++)y[_][Rh]=0;y=[]}if(s&&h.saveStructures){let _=n.sharedLength||d;n.length>_&&(n=n.slice(0,_));let C=de.subarray(r,ae);return h.saveStructures(n,l)===!1?(h._mergeStructures(h.getStructures()),h.pack(x)):(l=_,C)}}E&DO&&(ae=r)}};let S=x=>{ae>Bi&&(de=A(ae));var E=typeof x,_;if(E==="string"){let C=x.length;if(Ni&&C>=8&&C<4096){let R=bO.test(x);Ni[R?0:1]+=x,de[ae++]=193,S(R?-C:C);return}let I;C<32?I=1:C<256?I=2:C<65536?I=3:I=5;let N=C*3;if(ae+N>Bi&&(de=A(ae+N)),C<64||!c){let R,k,G,te=ae+I;for(R=0;R<C;R++)k=x.charCodeAt(R),k<128?de[te++]=k:k<2048?(de[te++]=k>>6|192,de[te++]=k&63|128):(k&64512)===55296&&((G=x.charCodeAt(R+1))&64512)===56320?(k=65536+((k&1023)<<10)+(G&1023),R++,de[te++]=k>>18|240,de[te++]=k>>12&63|128,de[te++]=k>>6&63|128,de[te++]=k&63|128):(de[te++]=k>>12|224,de[te++]=k>>6&63|128,de[te++]=k&63|128);_=te-ae-I}else _=c(x,ae+I,N);_<32?de[ae++]=160|_:_<256?(I<2&&de.copyWithin(ae+2,ae+1,ae+1+_),de[ae++]=217,de[ae++]=_):_<65536?(I<3&&de.copyWithin(ae+3,ae+2,ae+2+_),de[ae++]=218,de[ae++]=_>>8,de[ae++]=_&255):(I<5&&de.copyWithin(ae+5,ae+3,ae+3+_),de[ae++]=219,dr.setUint32(ae,_),ae+=4),ae+=_}else if(E==="number")if(x>>>0===x)x<64?de[ae++]=x:x<256?(de[ae++]=204,de[ae++]=x):x<65536?(de[ae++]=205,de[ae++]=x>>8,de[ae++]=x&255):(de[ae++]=206,dr.setUint32(ae,x),ae+=4);else if(x>>0===x)x>=-32?de[ae++]=256+x:x>=-128?(de[ae++]=208,de[ae++]=x+256):x>=-32768?(de[ae++]=209,dr.setInt16(ae,x),ae+=2):(de[ae++]=210,dr.setInt32(ae,x),ae+=4);else{let C;if((C=this.useFloat32)>0&&x<4294967296&&x>=-2147483648){de[ae++]=202,dr.setFloat32(ae,x);let I;if(C<4||(I=x*Qd[(de[ae]&127)<<1|de[ae+1]>>7])>>0===I){ae+=4;return}else ae--}de[ae++]=203,dr.setFloat64(ae,x),ae+=8}else if(E==="object")if(!x)de[ae++]=192;else{if(a){let I=a.get(x);if(I){if(!I.id){let N=a.idsToInsert||(a.idsToInsert=[]);I.id=N.push(I)}de[ae++]=214,de[ae++]=112,dr.setUint32(ae,I.id),ae+=4;return}else a.set(x,{offset:ae-r})}let C=x.constructor;if(C===Object)T(x,!0);else if(C===Array){_=x.length,_<16?de[ae++]=144|_:_<65536?(de[ae++]=220,de[ae++]=_>>8,de[ae++]=_&255):(de[ae++]=221,dr.setUint32(ae,_),ae+=4);for(let I=0;I<_;I++)S(x[I])}else if(C===Map){_=x.size,_<16?de[ae++]=128|_:_<65536?(de[ae++]=222,de[ae++]=_>>8,de[ae++]=_&255):(de[ae++]=223,dr.setUint32(ae,_),ae+=4);for(let[I,N]of x)S(I),S(N)}else{for(let I=0,N=$d.length;I<N;I++){let R=Fy[I];if(x instanceof R){let k=$d[I];if(k.write){k.type&&(de[ae++]=212,de[ae++]=k.type,de[ae++]=0),S(k.write.call(this,x));return}let G=de,te=dr,Q=ae;de=null;let Y;try{Y=k.pack.call(this,x,F=>(de=G,G=null,ae+=F,ae>Bi&&A(ae),{target:de,targetView:dr,position:ae-F}),S)}finally{G&&(de=G,dr=te,ae=Q,Bi=de.length-10)}Y&&(Y.length+ae>Bi&&A(Y.length+ae),ae=wO(Y,de,ae,k.type));return}}T(x,!x.hasOwnProperty)}}else if(E==="boolean")de[ae++]=x?195:194;else if(E==="bigint"){if(x<BigInt(1)<<BigInt(63)&&x>=-(BigInt(1)<<BigInt(63)))de[ae++]=211,dr.setBigInt64(ae,x);else if(x<BigInt(1)<<BigInt(64)&&x>0)de[ae++]=207,dr.setBigUint64(ae,x);else if(this.largeBigIntToFloat)de[ae++]=203,dr.setFloat64(ae,Number(x));else throw new RangeError(x+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");ae+=8}else if(E==="undefined")this.encodeUndefinedAsNil?de[ae++]=192:(de[ae++]=212,de[ae++]=0,de[ae++]=0);else if(E==="function")S(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+E)},T=this.useRecords===!1?this.variableMapSize?x=>{let E=Object.keys(x),_=E.length;_<16?de[ae++]=128|_:_<65536?(de[ae++]=222,de[ae++]=_>>8,de[ae++]=_&255):(de[ae++]=223,dr.setUint32(ae,_),ae+=4);let C;for(let I=0;I<_;I++)S(C=E[I]),S(x[C])}:(x,E)=>{de[ae++]=222;let _=ae-r;ae+=2;let C=0;for(let I in x)(E||x.hasOwnProperty(I))&&(S(I),S(x[I]),C++);de[_+++r]=C>>8,de[_+r]=C&255}:x=>{let E=Object.keys(x),_,C=o.transitions||(o.transitions=Object.create(null)),I=0;for(let R=0,k=E.length;R<k;R++){let G=E[R];_=C[G],_||(_=C[G]=Object.create(null),I++),C=_}let N=C[Rh];if(N)N>=96&&m?(de[ae++]=((N-=96)&31)+96,de[ae++]=N>>5):de[ae++]=N;else{N=o.nextId,N||(N=64),N<g&&this.shouldShareStructure&&!this.shouldShareStructure(E)?(N=o.nextOwnId,N<v||(N=g),o.nextOwnId=N+1):(N>=v&&(N=g),o.nextId=N+1);let R=E.highByte=N>=96&&m?N-96>>5:-1;C[Rh]=N,o[N-64]=E,N<g?(E.isShared=!0,o.sharedLength=N-63,s=!0,R>=0?(de[ae++]=(N&31)+96,de[ae++]=R):de[ae++]=N):(R>=0?(de[ae++]=213,de[ae++]=114,de[ae++]=(N&31)+96,de[ae++]=R):(de[ae++]=212,de[ae++]=114,de[ae++]=N),I&&(w+=b*I),y.length>=p&&(y.shift()[Rh]=0),y.push(C),S(E))}for(let R=0,k=E.length;R<k;R++)S(x[E[R]])},A=x=>{let E;if(x>16777216){if(x-r>bM)throw new Error("Packed buffer would be larger than maximum buffer size");E=Math.min(bM,Math.round(Math.max((x-r)*(x>67108864?1.25:2),4194304)/4096)*4096)}else E=(Math.max(x-r<<2,de.length-1)>>12)+1<<12;let _=new Oy(E);return dr=new DataView(_.buffer,0,E),de.copy?de.copy(_,0,r,x):_.set(de.slice(r,x)),ae-=r,r=0,Bi=_.length-10,de=_}}useBuffer(e){de=e,dr=new DataView(de.buffer,de.byteOffset,de.byteLength),ae=0}};Fy=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Ih];$d=[{pack(i,e,t){let r=i.getTime()/1e3;if((this.useTimestamp32||i.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:n,targetView:s,position:o}=e(6);n[o++]=214,n[o++]=255,s.setUint32(o,r)}else if(r>0&&r<17179869184){let{target:n,targetView:s,position:o}=e(10);n[o++]=215,n[o++]=255,s.setUint32(o,i.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),s.setUint32(o+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return e(0),t(this.onInvalidDate());let{target:n,targetView:s,position:o}=e(3);n[o++]=212,n[o++]=255,n[o++]=255}else{let{target:n,targetView:s,position:o}=e(15);n[o++]=199,n[o++]=12,n[o++]=255,s.setUint32(o,i.getMilliseconds()*1e6),s.setBigInt64(o+4,BigInt(Math.floor(r)))}}},{pack(i,e,t){let r=Array.from(i),{target:n,position:s}=e(this.structuredClone?3:0);this.structuredClone&&(n[s++]=212,n[s++]=115,n[s++]=0),t(r)}},{pack(i,e,t){let{target:r,position:n}=e(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=101,r[n++]=0),t([i.name,i.message])}},{pack(i,e,t){let{target:r,position:n}=e(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=120,r[n++]=0),t([i.source,i.flags])}},{pack(i,e){this.structuredClone?wM(i,16,e):SM(ep?Buffer.from(i):new Uint8Array(i),e)}},{pack(i,e){let t=i.constructor;t!==MM&&this.structuredClone?wM(i,Ny.indexOf(t.name),e):SM(i,e)}},{pack(i,e){let{target:t,position:r}=e(1);t[r]=193}}];function wM(i,e,t,r){let n=i.byteLength;if(n+1<256){var{target:s,position:o}=t(4+n);s[o++]=199,s[o++]=n+1}else if(n+1<65536){var{target:s,position:o}=t(5+n);s[o++]=200,s[o++]=n+1>>8,s[o++]=n+1&255}else{var{target:s,position:o,targetView:a}=t(7+n);s[o++]=201,a.setUint32(o,n+1),o+=4}s[o++]=116,s[o++]=e,s.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),o)}function SM(i,e){let t=i.byteLength;var r,n;if(t<256){var{target:r,position:n}=e(t+2);r[n++]=196,r[n++]=t}else if(t<65536){var{target:r,position:n}=e(t+3);r[n++]=197,r[n++]=t>>8,r[n++]=t&255}else{var{target:r,position:n,targetView:s}=e(t+5);r[n++]=198,s.setUint32(n,t),n+=4}r.set(i,n)}function wO(i,e,t,r){let n=i.length;switch(n){case 1:e[t++]=212;break;case 2:e[t++]=213;break;case 4:e[t++]=214;break;case 8:e[t++]=215;break;case 16:e[t++]=216;break;default:n<256?(e[t++]=199,e[t++]=n):n<65536?(e[t++]=200,e[t++]=n>>8,e[t++]=n&255):(e[t++]=201,e[t++]=n>>24,e[t++]=n>>16&255,e[t++]=n>>8&255,e[t++]=n&255)}return e[t++]=r,e.set(i,t),t+=n,t}function SO(i,e){let t,r=e.length*6,n=i.length-r;for(e.sort((s,o)=>s.offset>o.offset?1:-1);t=e.pop();){let s=t.offset,o=t.id;i.copyWithin(s+r,s,n),r-=6;let a=s+r;i[a++]=214,i[a++]=105,i[a++]=o>>24,i[a++]=o>>16&255,i[a++]=o>>8&255,i[a++]=o&255,n=s}return i}function Yo(i){if(i.Class){if(!i.pack&&!i.write)throw new Error("Extension has no pack or write function");if(i.pack&&!i.type)throw new Error("Extension has no type (numeric code to identify the extension)");Fy.unshift(i.Class),$d.unshift(i)}xM(i)}var AM=new qo({useRecords:!1}),MO=AM.pack,AO=AM.pack;var{NEVER:TO,ALWAYS:EO,DECIMAL_ROUND:_O,DECIMAL_FIT:CO}=Kd,TM=512,DO=1024;var EM=new qo({structuredClone:!0});Yo({Class:jn.prototype.constructor,type:1,write(i){return ie({},i)},read(i){return Object.setPrototypeOf(i,jn.prototype),i}});Yo({Class:rr.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,rr.prototype),i}});Yo({Class:qn.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,qn.prototype),i}});Yo({Class:Ph.prototype.constructor,type:4,write(i){return i.id},read(i){return new Ph(i)}});Yo({Class:Lh.prototype.constructor,type:5,write(i){return i.data},read(i){return new Lh(i)}});function PO(i){var e=0;if(i.length===0)return e;for(let t=0;t<i.length;t++){let r=i[t];e=(e<<5)-e+r,e=e&e}return e}var tp;(r=>{function i(n){return EM.pack(n)}r.serialize=i;function e(n){return EM.unpack(n)}r.deserialize=e;function t(n){return PO(i(n)).toString()}r.checksum=t})(tp||(tp={}));var rp;(t=>{t.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function e(r){return t.all.includes(r)}t.is=e})(rp||(rp={}));var np;(t=>{function i(r){return e(r)}t.defaultData=i;function e(r){if(r==="PointLight")return{type:r,color:Ln.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,depth:2500,helper:!0};if(r==="SpotLight")return{type:r,color:Ln.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:2500,helper:!0};if(r==="DirectionalLight")return{type:r,color:Ln.white,intensity:1,shadows:!0,size:2500,depth:2500,helper:!0};throw new Error("not implemented")}})(np||(np={}));var Uy;(t=>{t.defaultData={castShadow:!0,receiveShadow:!0};function e(r,n){return r.castShadow===n.castShadow&&r.receiveShadow===n.receiveShadow}t.equals=e})(Uy||(Uy={}));var zy;(t=>{t.defaultData={flatShading:!1,wireframe:!1,side:0};function e(r,n){return r.flatShading===n.flatShading&&r.side===n.side&&r.wireframe===n.wireframe}t.equals=e})(zy||(zy={}));var ip;(e=>e.defaultData=xe(ie(ie({},zy.defaultData),Uy.defaultData),{cloner:null,booleanExclude:null}))(ip||(ip={}));var Gy=(n=>(n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.Center=3]="Center",n[n.Justify=4]="Justify",n))(Gy||{}),ky=(r=>(r[r.Top=1]="Top",r[r.Center=2]="Center",r[r.Bottom=3]="Bottom",r))(ky||{}),Vy=(r=>(r[r.None=1]="None",r[r.Upper=2]="Upper",r[r.Lower=3]="Lower",r))(Vy||{}),sp;(e=>e.defaultData={width:100,height:100,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.5,letterSpacing:1,text:"",textTransform:1,color:Ln.fromHexAndA(6974058,1),alpha:1,font:"roboto_regular"})(sp||(sp={}));var _M=["mode","gradientType","noiseType","displacementType","projection","cnormal","crop","axis","side"];var El;(r=>{function i(n,s){return n==="light"&&s?e(s):t(n)}r.defaultData=i;function e(n){switch(n){case"basic":return{type:"light",category:"basic",alpha:1,visible:!0,mode:0};case"phong":return{category:"phong",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"toon":return{category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"lambert":return{category:"lambert",emissive:{r:0,g:0,b:0,a:1},type:"light",alpha:1,visible:!0,mode:0};case"physical":return{category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0}}}function t(n){switch(n){case"texture":return{alpha:1,visible:!0,size:[128,128],mode:0,axis:"x",side:2,type:"texture",projection:0,texture:{image:"image_0",wrapping:1001,repeat:[1,1],offset:[0,0]},crop:!0};case"color":return{type:"color",alpha:1,visible:!0,mode:0,color:Ar.fromHex(4737101)};case"depth":return{type:"depth",alpha:1,visible:!0,mode:0,gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,near:50,far:200};case"normal":return{type:"normal",alpha:1,visible:!0,mode:0,cnormal:[1,1,1]};case"gradient":return{type:"gradient",alpha:1,visible:!0,mode:0,gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{type:"noise",alpha:1,visible:!0,mode:0,size:[100,100,100],noiseType:0,scale:1,move:1,colorA:xe(ie({},Ar.fromHex(6710886)),{a:1}),colorB:xe(ie({},Ar.fromHex(6710886)),{a:1}),colorC:xe(ie({},Ar.fromHex(16777215)),{a:1}),colorD:xe(ie({},Ar.fromHex(16777215)),{a:1}),distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8]};case"fresnel":return{type:"fresnel",alpha:1,visible:!0,mode:0,color:Ln.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{type:"rainbow",alpha:1,visible:!0,mode:0,filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"matcap":return{type:"matcap",alpha:1,visible:!0,mode:0,texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0]}};case"transmission":return{type:"transmission",alpha:1,visible:!0,mode:0,thickness:10,ior:1.5,roughness:1};case"displace":return{type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,visible:!0}}}})(El||(El={}));var hi;(a=>{function i(l){return!l.layers.some(h=>{if(h.data.type==="texture"&&h.data.projection!==0||h.data.type==="depth"&&!h.data.isWorldSpace||h.data.type==="noise"||h.data.type==="displace")return!0})&&!t(l)}a.isMergable=i;function e(l){let c="";return l.layers.forEach(h=>{Object.entries(h.data).forEach(([u,f])=>{c+=`${u}${f}`,Array.isArray(f)?f.forEach(d=>c+=`${d}`):typeof f=="object"?Object.values(f).forEach(d=>{typeof d=="number"?c+=`${d.toFixed(4)}`:c+=`${d}`}):c+=`${f}`})}),c}a.getHash=e;function t(l){let c=0;for(let h of l.layers)"alpha"in h.data&&h.data.type!=="light"&&h.data.type!=="fresnel"&&(c+=(1-c)*h.data.alpha);return c<1}a.isTransparent=t;function r(){return{layers:new rr}}a.defaultEmptyData=r;function n(l="layer1",c="layer2"){return s("phong",l,c)}a.defaultData=n;function s(l,c="layer1",h="layer2"){let u=new rr;return u.push({fi:0,data:El.defaultData("light",l),id:c}),u.push({fi:1,data:El.defaultData("color"),id:h}),{layers:u}}a.defaultTwoLayerData=s;function o(l,c="basic",h="layer1",u="layer2"){let f=El.defaultData("texture");Object.assign(f.texture,{image:l});let d=new rr;return d.push({fi:0,data:f,id:h}),d.push({fi:1,data:El.defaultData("light",c),id:u}),{layers:d}}a.defaultTwoLayerTextureData=o})(hi||(hi={}));var _l;(e=>{function i(){return{points:new rr,roundness:0,shapeHoles:[],isClosed:!1}}e.defaultData=i})(_l||(_l={}));var op;(e=>{function i(t){return t==="PolygonGeometry"||t==="RectangleGeometry"||t==="StarGeometry"||t==="TriangleGeometry"||t==="EllipseGeometry"}e.is2DParametricMesh=i})(op||(op={}));var Bh;(e=>{function i(t){if(t==="RectangleGeometry")return{width:320,height:320,type:t,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(t==="VectorGeometry")return{width:1,height:1,type:t,subdivisions:12,shape:_l.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(t==="BooleanGeometry")return{type:t,operation:2,width:0,height:0,depth:0};throw new Error("not implemented")}e.defaultData=i})(Bh||(Bh={}));var Nh;(n=>{n.identity=xe(ie({},Nd.identity),{hiddenMatrix:Pi.identity});function e(s){return{position:s.position,rotation:s.rotation,scale:s.scale,hiddenMatrix:s.hiddenMatrix}}n.fromObject=e;function t(s,o){return{position:(o==null?void 0:o.position)||s.position,rotation:(o==null?void 0:o.rotation)||s.rotation,scale:(o==null?void 0:o.scale)||s.scale,hiddenMatrix:(o==null?void 0:o.hiddenMatrix)||s.hiddenMatrix}}n.merge=t;function r(s,o){return{position:br.isEqual(s.position,o.position)?null:o.position,rotation:br.isEqual(s.rotation,o.rotation)?null:o.rotation,scale:br.isEqual(s.scale,o.scale)?null:o.scale,hiddenMatrix:Pi.isEqual(s.hiddenMatrix,o.hiddenMatrix)?null:o.hiddenMatrix}}n.diff=r})(Nh||(Nh={}));var ds;(e=>e.defaultData=ie({states:new rr,events:new rr,visible:!0,raycastLock:!1},Nh.identity))(ds||(ds={}));var CM;(e=>e.defaultData=ie({type:"Empty"},ds.defaultData))(CM||(CM={}));var ap;(e=>e.defaultData=ie(ie({type:"Mesh"},ds.defaultData),ip.defaultData))(ap||(ap={}));var DM;(e=>e.defaultData=ie(ie({type:"TextFrame"},ds.defaultData),sp.defaultData))(DM||(DM={}));var lp;(e=>e.defaultData=ie(ie(ie({},ds.defaultData),Nh.identity),Wo.defaultData))(lp||(lp={}));var PM;(e=>{function i(t){return ie(ie({},ds.defaultData),np.defaultData(t))}e.defaultData=i})(PM||(PM={}));var LM;(r=>(r.defaultCamera=ie({position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:Pi.identity,name:"Play Camera",visible:!0,raycastLock:!1,states:new rr,events:new rr},Wo.defaultData),r.defaultMeshObject=xe(ie(ie({name:"Rectangle"},ds.defaultData),ap.defaultData),{geometry:Bh.defaultData("RectangleGeometry"),material:hi.defaultTwoLayerData("basic","layer1","layer2")}),r.defaultBooleanObject=xe(ie(ie({name:"Boolean"},ds.defaultData),ap.defaultData),{geometry:Bh.defaultData("BooleanGeometry"),material:hi.defaultTwoLayerData("phong","layer1","layer2")})))(LM||(LM={}));var Oh;(t=>{function i(r,n){if(n===void 0)return r;let s=ie({},r);return"material"in s&&"material"in n&&n.material&&(s.material=Ty(s.material,o=>{if(typeof o!="string")for(let[a,l]of Object.entries(n.material.layers)){let c=o.layers.data(a);c&&Vo(c,l)}}).data),s.materials&&n.materials&&(s.materials=Ty(s.materials,o=>{var a,l;for(let c=0;c<s.materials.length;c++){let h=n.materials[c];if(typeof h!="string")for(let[u,f]of Object.entries(h.layers)){let d=(l=(a=o[c])==null?void 0:a.layers)==null?void 0:l.data(u);d&&Vo(d,f)}}}).data),s}t.patchMaterialState=i;function e(r,n){var o,a;if(n===void 0)return r;let s=ie({},r);if(Object.assign(s,Nh.merge(s,n)),eo.is(r.type)){s.orthographic=ie({},s.orthographic),s.perspective=ie({},s.perspective);let l=n;((o=l.orthographic)==null?void 0:o.zoom)!==void 0&&(s.orthographic.zoom=l.orthographic.zoom),((a=l.perspective)==null?void 0:a.zoom)!==void 0&&(s.perspective.zoom=l.perspective.zoom)}else if(r.type==="Mesh")s.geometry=ie({},s.geometry),Object.assign(s.geometry,n.geometry),s=i(s,n);else if(rp.is(r.type)){let l=n;s.intensity!==void 0&&(s.intensity=l.intensity),l.color!==void 0&&(typeof l.color=="string"?s.color=l.color:s.color=Ar.clone(l.color))}return s}t.patch=e})(Oh||(Oh={}));function RM(i,e=!1){let t=i[0].index!==null,r=new Set(Object.keys(i[0].attributes)),n=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Le,c=0;for(let h=0;h<i.length;++h){let u=i[h],f=0;if(t!==(u.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let d in u.attributes){if(!r.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. 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(u.attributes[d]),f++}if(f!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let d in u.morphAttributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(u.morphAttributes[d])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(u.userData),e){let d;if(t)d=u.index.count;else if(u.attributes.position!==void 0)d=u.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,d,h),c+=d}}if(t){let h=0,u=[];for(let f=0;f<i.length;++f){let d=i[f].index;for(let p=0;p<d.count;++p)u.push(d.getX(p)+h);h+=i[f].attributes.position.count}l.setIndex(u)}for(let h in s){let u=IM(s[h]);if(!u)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,u)}for(let h in o){let u=o[h][0].length;if(u===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let f=0;f<u;++f){let d=[];for(let m=0;m<o[h].length;++m)d.push(o[h][m][f]);let p=IM(d);if(!p)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(p)}}return l}function IM(i){let e,t,r,n=0;for(let a=0;a<i.length;++a){let l=i[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(r===void 0&&(r=l.normalized),r!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;n+=l.array.length}let s=new e(n),o=0;for(let a=0;a<i.length;++a)s.set(i[a].array,o),o+=i[a].array.length;return new Ve(s,t,r)}var Hy={type:"change"},BM={type:"changeZoom"},LO={type:"changePan"},Cl={type:"start"},Fh={type:"end"},Wy=new zt,IO=new B,RO=2*Math.PI,BO=1e-8,NO=.01,NM=2,jy=.125,OM=2,qy=1,Yy=1,Xy=.1;var cp=class extends Yt{constructor(t,r){super();this.object=t;this.domElement=r;this.enabled=!0;this.useKeyEvents=!0;this.enableDamping=!1;this.enableZoom=!0;this.enableRotate=!0;this.enablePan=!0;this.autoRotate=!1;this.rotationLimitsMode=0;this.panLimitsMode=0;this.rotationSoftLimit=2;this.panSoftLimit=2;this.hoverRotatePanMode=0;this.zoomLimitsEnabled=!1;this.preventScroll=!0;this.mouseButtons=[0,5];this.mouseButtonsPlay=[3,4,5];this.touches=[null,Cn.DOLLY_ROTATE,Cn.PAN];this.offset=new M;this.eye=new M;this.lastPosition=new M;this.lastQuaternion=new zt;this.current=new B;this.overShoot=new B;this.overRatio=new B;this.spherical=new uh;this.sphericalDelta=new uh;this.panOffset=new M;this.panLeftV=new M;this.panUpV=new M;this.panV=new M;this.rotateStart=new B;this.rotateEnd=new B;this.rotateDelta=new B;this.panStart=new B;this.panEnd=new B;this.panDelta=new B;this.dollyStart=new B;this.dollyEnd=new B;this.dollyDelta=new B;this.rotationRangeFactor=new B;this.panRangeFactor=new B;this.state=-1;this.zoomChanged=!1;this.isPointerDown=!1;this.isFirstHover=!0;this.isThetaFlipped=!1;this.prevScale=0;this.scale=1;this.gesture=!1;this.timer=-1;this.timerHover=-1;this.minDistance=0;this.maxDistance=1/0;this.minZoom=0;this.maxZoom=1/0;this.minPhi=0;this.maxPhi=Math.PI;this.minTheta=-1/0;this.maxTheta=1/0;this.minH=0;this.maxH=Math.PI;this.minV=-1/0;this.maxV=1/0;this.autoRotateClockwise=!0;this.isPanOverShoot=!1;this.isRotateOverShoot=!1;this.update=()=>{let t=this.object.position;this.offset.copy(t).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.autoRotate&&this.state===-1&&this.rotateLeft((this.autoRotateClockwise===!0?1:-1)*this.getAutoRotationAngle()),this.rotationLimitsMode!==0&&this.applyLimits(this.sphericalDelta,this.rotationLimitsMode,this.rotationSoftLimit,this.maxTheta,this.minTheta,this.maxPhi,this.minPhi,this.rotationRangeFactor),this.rotationLimitsMode!==2&&(this.spherical.phi+=this.sphericalDelta.phi),(this.rotationLimitsMode!==1||this.autoRotate===!0)&&(this.spherical.theta+=this.sphericalDelta.theta),this.spherical.radius*=this.scale,this.zoomLimitsEnabled&&(this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius))),this.panLimitsMode!==0&&(this.target.applyQuaternion(Wy.copy(this.object.quaternion).invert()),this.panOffset.applyQuaternion(Wy),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(this.object.quaternion),this.panOffset.applyQuaternion(this.object.quaternion)),this.panLimitsMode===2&&(this.panOffset.y=0),this.panLimitsMode===1&&(this.panOffset.x=0),this.state===-1&&!this.gesture?(this.panOffset.multiplyScalar(1-jy),this.target.add(this.panOffset)):(this.target.add(this.panOffset),this.panOffset.set(0,0,0)),this.offset.setFromSpherical(this.spherical),t.copy(this.target).add(this.offset);let r=this.spherical.phi%RO;return this.eye.copy(this.offset).normalize(),this.object.up.copy(ot.DefaultUp).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),r>0&&r>Math.PI||r<0&&r>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),this.state===-1||this.enableDamping===!0?(this.sphericalDelta.theta*=1-jy,this.sphericalDelta.phi*=1-jy):this.sphericalDelta.set(0,0,0),this.scale=1,this.zoomChanged||this.lastPosition.distanceToSquared(this.object.position)>NO||8*(1-this.lastQuaternion.dot(this.object.quaternion))>BO?(this.dispatchEvent(Hy),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),this.zoomChanged=!1,!0):(this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),!1)};this.onPointerDown=t=>{this.enabled!==!1&&(this.isPointerDown=!0,At.length===0&&(this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)),FO(t),t.pointerType==="touch"?this.onPointerDownTouch(t):this.onPointerDownMouse(t))};this.onPointerMove=t=>{this.enabled!==!1&&(t.pointerType==="touch"?this.onPointerMoveTouch(t):this.onPointerMoveMouse(t))};this.onPointerUp=t=>{UM(t),this.isPointerDown=!1,At.length===0&&(this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp)),this.dispatchEvent(Fh),this.state=-1};this.onPointerCancel=t=>{UM(t)};this.onPointerDownMouse=t=>{let r;switch(this.useKeyEvents?r=this.mouseButtons[t.button]:r=this.mouseButtonsPlay[t.button],r){case 0:if(t.altKey===!0&&!t.shiftKey&&!_h(t)){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else if(this.key===" "){if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}break;case 4:if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2;break;case 3:if(_h(t)||t.shiftKey){if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}break;case 5:if(_h(t)||t.shiftKey){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else{if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}break;default:this.state=-1}this.state!==-1&&this.dispatchEvent(Cl)};this.onPointerMoveMouse=t=>{switch(this.state){case 0:if(this.enableRotate===!1)return;this.handleMouseMoveRotate(t);break;case 1:if(this.enableZoom===!1)return;this.handleMouseMoveDolly(t);break;case 2:if(this.enablePan===!1)return;this.handleMouseMovePan(t);break}};this.onPointerDownTouch=t=>{switch(zM(t),this.touches[At.length-1]){case Cn.ROTATE:if(this.enableRotate===!1){this.state=-1;return}this.handleTouchStartRotate(),this.state=3;break;case Cn.PAN:if(this.enablePan===!1){this.state=-1;return}this.handleTouchStartPan(),this.state=4;break;case Cn.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchStartDollyPan(),this.state=5;break;case Cn.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}this.state!==-1&&this.dispatchEvent(Cl)};this.onPointerMoveTouch=t=>{switch(zM(t),this.state){case 3:if(this.enableRotate===!1)return;this.handleTouchMoveRotate(t),this.update();break;case 4:if(this.enablePan===!1)return;this.handleTouchMovePan(t),this.update();break;case 5:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchMoveDollyPan(t),this.update();break;case 6:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchMoveDollyRotate(t),this.update();break;default:this.state=-1}};this.dispatchEndDebounced=Mh(()=>this.dispatchEvent(Fh),33);this.onMouseWheel=t=>{this.enabled===!1||this.enableZoom===!1&&this.enablePan===!1||((this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth||this.preventScroll)&&t.preventDefault(),this.dispatchEvent(Cl),this.handleMouseWheel(t),this.dispatchEndDebounced())};this.onGesture=t=>{if(this.enabled!==!1)if(t.preventDefault(),t.type==="gesturechange"){if(this.enableZoom===!1)return;this.dispatchEvent(Cl),t.scale>this.prevScale?this.dollyIn(this.getZoomScale()):t.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=t.scale,this.update()}else this.dispatchEvent(Fh)};this.onContextMenu=t=>{this.enabled!==!1&&t.preventDefault()};this.onTouchMove=t=>{(t.touches.length>1||this.preventScroll)&&t.preventDefault()};this.onTouchEnd=t=>{t.preventDefault()};this.onKeyDown=t=>{this.enabled!==!1&&(this.key=t.key)};this.onKeyUp=()=>{this.enabled!==!1&&(this.key=void 0,this.state!==-1&&this.onPointerUp(At[0]))};this.onPointerHover=t=>{if(!(Bd||this.enabled===!1||this.state!==-1||this.hoverRotatePanMode===2&&this.isPanOverShoot||this.hoverRotatePanMode===1&&this.isRotateOverShoot)){if(window.clearTimeout(this.timerHover),this.isPointerDown=!0,this.isFirstHover){let r={clientX:window.innerWidth/2,clientY:window.innerHeight/2};this.hoverRotatePanMode===2?this.handleMouseDownPan(r):this.hoverRotatePanMode===1&&this.handleMouseDownRotate(r),this.isFirstHover=!1}this.hoverRotatePanMode===2?this.handleMouseMovePan(t,Xy):this.hoverRotatePanMode===1&&this.handleMouseMoveRotate(t,Xy),this.timerHover=window.setTimeout(()=>{this.isPointerDown=!1},30)}};this.object=t,this.domElement=r,this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.connect(),this.update()}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Hy),this.isFirstHover=!0,this.update(),this.state=-1}resetTo(t,r,n){this.target.copy(t),this.object.position.copy(r),this.object.zoom=n,this.object.updateProjectionMatrix(),this.dispatchEvent(Hy),this.update(),this.state=-1}fromJSON(t){this.setEnableDampingSpeed(t.enableDamping),this.enablePan=t.enablePan,this.enableZoom=t.enableZoom,this.enableRotate=t.enableRotate,this.rotationLimitsMode=t.rotationLimitsMode,this.panLimitsMode=t.panLimitsMode,this.panSoftLimit=t.panSoftLimit,this.rotationSoftLimit=t.rotationSoftLimit,this.hoverRotatePanMode=t.hoverRotatePanMode,this.isFirstHover=!0,this.hoverRotatePanMode!==0&&this.domElement.addEventListener("pointermove",this.onPointerHover),Xy=(t.hoverRotatePanStrength/100)**2,this.zoomLimitsEnabled=t.zoomLimitsEnabled,this.minZoom=t.zoomLimits.min,this.maxZoom=Math.max(t.zoomLimits.min,t.zoomLimits.max),this.minDistance=1e3/t.zoomLimits.max,this.maxDistance=Math.max(this.minDistance,1e3/t.zoomLimits.min),this.autoRotate=t.autoRotate,NM=t.autoRotateSpeed,this.autoRotateClockwise=t.autoRotateClockwise;let n=this.object.getTarget().applyQuaternion(Wy.copy(this.object.quaternion).invert());this.minV=-t.panVerticalOffset.min+n.y,this.maxV=t.panVerticalOffset.max+n.y,this.minH=-t.panHorizontalOffset.min+n.x,this.maxH=t.panHorizontalOffset.max+n.x,this.panRangeFactor.set(this.maxH-this.minH,this.maxV-this.minV).divideScalar(2),this.rotationRangeFactor.setScalar(Math.PI).divideScalar(4),this.minPhi=no(this.spherical.phi-t.rotationVerticalOffset.min),this.maxPhi=no(this.spherical.phi+t.rotationVerticalOffset.max),this.minTheta=no(this.spherical.theta-t.rotationHorizontalOffset.min),this.maxTheta=no(this.spherical.theta+t.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,this.preventScroll=t.preventScroll,t.orbitTouches===1&&(this.touches[0]=Cn.ROTATE),t.panTouches===1&&(this.touches[0]=Cn.PAN),t.orbitTouches===2&&(this.touches[1]=Cn.DOLLY_ROTATE),t.panTouches===2&&(this.touches[1]=Cn.DOLLY_PAN),t.orbitTouches===3&&(this.touches[2]=Cn.ROTATE),t.panTouches===3&&(this.touches[2]=Cn.PAN)}connect(){this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointercancel",this.onPointerCancel),this.domElement.addEventListener("wheel",this.onMouseWheel),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keyup",this.onKeyUp,!1),Ho||(this.domElement.addEventListener("gesturestart",this.onGesture),this.domElement.addEventListener("gesturechange",this.onGesture),this.domElement.addEventListener("gestureend",this.onGesture)),this.domElement.addEventListener("touchmove",this.onTouchMove),this.domElement.addEventListener("touchend",this.onTouchEnd)}dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerCancel),this.domElement.removeEventListener("wheel",this.onMouseWheel),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keyup",this.onKeyUp,!1),this.domElement.removeEventListener("pointermove",this.onPointerHover),Ho||(this.domElement.removeEventListener("gesturestart",this.onGesture),this.domElement.removeEventListener("gesturechange",this.onGesture),this.domElement.removeEventListener("gestureend",this.onGesture)),this.domElement.removeEventListener("touchmove",this.onTouchMove),this.domElement.removeEventListener("touchend",this.onTouchEnd),this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp)}applyLimits(t,r,n,s,o,a,l,c){this.overShoot.set(0,0);let h,u,f;t instanceof M?(h=t.x,u=t.y,this.current.set(this.target.x,this.target.y),f=!0):(h=t.theta,u=t.phi,this.current.set(no(this.spherical.theta),no(this.spherical.phi)),f=!1),n===0&&(this.current.x+=h,this.current.y+=u),(r===3||r===2)&&(!f&&this.isThetaFlipped?this.current.x>s&&this.current.x<0?this.overShoot.x=s-this.current.x:this.current.x<o&&this.current.x>0&&(this.overShoot.x=o-this.current.x):this.current.x>s?this.overShoot.x=s-this.current.x:this.current.x<o&&(this.overShoot.x=o-this.current.x),s===o&&(h=0)),(r===3||r===1)&&(this.current.y>a?this.overShoot.y=a-this.current.y:this.current.y<l&&(this.overShoot.y=l-this.current.y),a===l&&(u=0)),f||(this.overShoot.x=no(this.overShoot.x),this.overShoot.y=no(this.overShoot.y)),n!==0?(this.overRatio.copy(this.overShoot).divide(c),this.overRatio.x=Math.min(Math.abs(this.overRatio.x),1),this.overRatio.y=Math.min(Math.abs(this.overRatio.y),1),n===1&&(this.overRatio.x=FM(Math.abs(this.overRatio.x)),this.overRatio.y=FM(Math.abs(this.overRatio.y))),this.isPointerDown||n===1?n===2&&(this.overRatio.x>.9||this.overRatio.y>.9)?this.isPointerDown=!1:(h*this.overShoot.x<0&&(h*=1-this.overRatio.x),u*this.overShoot.y<0&&(u*=1-this.overRatio.y)):n===2&&(!f&&(this.overRatio.x>.002||this.overRatio.y>.002)||f&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(h=this.overShoot.x*.05,u=this.overShoot.y*.05,f?this.isPanOverShoot=!0:this.isRotateOverShoot=!0):f?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(h+=this.overShoot.x,u+=this.overShoot.y),t instanceof M?(t.x=h,t.y=u):(t.theta=h,t.phi=u)}setEnableDampingSpeed(t){this.enableDamping=t,qy=t===!0?.2:1}stopDamping(){this.sphericalDelta.theta=0,this.sphericalDelta.phi=0}getAutoRotationAngle(){return 2*Math.PI/60/60*NM}getZoomScale(){return Math.pow(.95,OM)}rotateLeft(t){this.sphericalDelta.theta-=t}rotateUp(t){this.sphericalDelta.phi-=t}panLeft(t,r){this.panLeftV.setFromMatrixColumn(r,0),this.panLeftV.multiplyScalar(-t),this.panOffset.add(this.panLeftV)}panUp(t,r){this.panUpV.setFromMatrixColumn(r,1),this.panUpV.multiplyScalar(t),this.panOffset.add(this.panUpV)}pan(t,r){let n=this.domElement;if(n&&this.object.isPerspectiveCamera){let s=this.object.position;this.panV.copy(s).sub(this.target);let o=this.panV.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*t*o/n.clientHeight,this.object.matrix),this.panUp(2*r*o/n.clientHeight,this.object.matrix)}else n&&this.object.isOrthographicCamera&&(this.panLeft(t*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this.panUp(r*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix));this.dispatchEvent(LO)}dollyOut(t){this.object.isPerspectiveCamera?this.scale/=t:this.object.isOrthographicCamera&&(this.object.zoom*=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(BM)}dollyIn(t){this.object.isPerspectiveCamera?this.scale*=t:this.object.isOrthographicCamera&&(this.object.zoom/=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(BM)}zoomOut(t=this.getZoomScale()){this.dispatchEvent(Cl),this.dollyOut(t),this.dispatchEvent(Fh)}zoomIn(t=this.getZoomScale()){this.dispatchEvent(Cl),this.dollyIn(t),this.dispatchEvent(Fh)}handleMouseDownRotate(t){this.rotateStart.set(t.clientX,t.clientY)}handleMouseDownDolly(t){this.dollyStart.set(t.clientX,t.clientY)}handleMouseDownPan(t){this.panStart.set(t.clientX,t.clientY)}handleMouseMoveRotate(t,r=1){this.rotateEnd.set(t.clientX,t.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(qy*r).rotateAround(IO,-this.object.angleOffsetFromUp);let n=this.domElement;this.rotateLeft(2*Math.PI*this.rotateDelta.x/n.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/n.clientHeight),this.rotateStart.copy(this.rotateEnd),this.update()}handleMouseMoveDolly(t){this.dollyEnd.set(t.clientX,t.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyOut(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyIn(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(t,r=1){this.panEnd.set(t.clientX,t.clientY),this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(Yy*r),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd),this.update()}handleMouseWheel(t){if(JS===!1&&_h(t)===!1&&OO(t)===!0){if(this.enablePan===!1)return;this.gesture?(this.panDelta.set(-t.deltaX,-t.deltaY).multiplyScalar(Yy),this.panDelta.x=Math.min(Math.abs(this.panDelta.x),100)*(this.panDelta.x<0?-1:1),this.panDelta.y=Math.min(Math.abs(this.panDelta.y),100)*(this.panDelta.y<0?-1:1),t.altKey?this.pan(0,this.panDelta.y):t.shiftKey?this.pan(this.panDelta.x,0):this.pan(this.panDelta.x,this.panDelta.y),this.update()):(this.gesture=!0,this.isPointerDown=!0),window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.gesture=!1,this.isPointerDown=!1},30)}else{if(this.enableZoom===!1)return;t.deltaY===0?t.deltaX<0?this.dollyIn(this.getZoomScale()):t.deltaX>0&&this.dollyOut(this.getZoomScale()):t.deltaY<0?this.dollyIn(this.getZoomScale()):t.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update(),this.gesture=!1,this.isPointerDown=!1}}handleTouchStartRotate(){if(At.length===2){let t=.5*(At[0].pageX+At[1].pageX),r=.5*(At[0].pageY+At[1].pageY);this.rotateStart.set(t,r)}else this.rotateStart.set(At[0].pageX,At[0].pageY)}handleTouchStartPan(){if(At.length===2){let t=.5*(At[0].pageX+At[1].pageX),r=.5*(At[0].pageY+At[1].pageY);this.panStart.set(t,r)}else this.panStart.set(At[0].pageX,At[0].pageY)}handleTouchStartDolly(){let t=At[0].pageX-At[1].pageX,r=At[0].pageY-At[1].pageY,n=Math.sqrt(t*t+r*r);this.dollyStart.set(0,n)}handleTouchStartDollyPan(){this.enableZoom&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(t){if(At.length===2){let n=Qy(t),s=.5*(t.pageX+n.x),o=.5*(t.pageY+n.y);this.rotateEnd.set(s,o)}else{if(t.pointerId!==At[0].pointerId)return;this.rotateEnd.set(t.pageX,t.pageY)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(qy);let r=this.domElement;r&&(this.rotateLeft(2*Math.PI*this.rotateDelta.x/r.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/r.clientHeight)),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(t){if(At.length===2){let r=Qy(t),n=.5*(t.pageX+r.x),s=.5*(t.pageY+r.y);this.panEnd.set(n,s)}else{if(t.pointerId!==At[0].pointerId)return;this.panEnd.set(t.pageX,t.pageY)}this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(Yy),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(t){let r=Qy(t),n=t.pageX-r.x,s=t.pageY-r.y,o=Math.sqrt(n*n+s*s);this.dollyEnd.set(0,o),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,OM)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t)}handleTouchMoveDollyRotate(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enableRotate&&this.handleTouchMoveRotate(t)}};function no(i){let e=Math.PI*2;for(;i<=-Math.PI;)i+=e;for(;i>Math.PI;)i-=e;return i}function FM(i){return 1-Math.pow(1-i,4)}function OO(i){return i.wheelDeltaY===0||i.deltaY===0?Eh&&i.shiftKey&&Math.abs(i.wheelDeltaX)>=120?!1:i.wheelDeltaX?i.wheelDeltaX===-3*i.deltaX:i.deltaMode===0:i.wheelDeltaY?i.wheelDeltaY===-3*i.deltaY:i.deltaMode===0}var At=[],hp={};function FO(i){At.push(i)}function UM(i){delete hp[i.pointerId];for(let e=0;e<At.length;e++)if(At[e].pointerId===i.pointerId){At.splice(e,1);return}}function zM(i){let e=hp[i.pointerId];e===void 0&&(e=new B,hp[i.pointerId]=e),e.set(i.pageX,i.pageY)}function Qy(i){let e=i.pointerId===At[0].pointerId?At[1]:At[0];return hp[e.pointerId]}var io=class extends qf{constructor(){super(),this.layers.enable(3)}setFromCamera(e,t){t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):t.isPerspectiveCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):console.error("Raycaster: Unsupported camera type.")}intersectVisibleObjects(e,t=!0,r=[]){return e.forEach(n=>{n.visible&&this.intersectObject(n,t,r)}),r}createRaycastLineHelper(){let e=new kr({color:65280,linewidth:10}),t=new M(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),r=new M(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),n=this.camera.far-this.camera.near,s=new M().addVectors(t,r.multiplyScalar(n)),o=new Le;return o.setFromPoints([t,s]),new os(o,e)}};var kM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var o,a,l,c,h;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:0,cornerSegments:8,hollow:0},i.parameters),r=t.width/2,n=(a=t.radiusTop)!=null?a:r,s=(l=t.radiusBottom)!=null?l:r;return n===s?(n=r,s=r):n>s?(n=r,s=s*r/n):(n=n*r/s,s=r),{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((c=t.height)!=null?c:t.width),depth:Math.abs((h=t.depth)!=null?h:t.width),radiusTop:n,radiusBottom:s})}}static build(i){let{width:e,depth:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,radiusTop:c,radiusBottom:h,cornerRadius:u,cornerSegments:f,hollow:d}=i.parameters,p;return u||d?p=new Uh(c,h,r,n,s,o,a,l*Math.PI/180,u,u,f,d):p=new Lo(c,h,r,n,s,o,a,l*Math.PI/180),p.scale(1,1,t/e),Object.assign(p,{userData:xe(ie({},i),{type:"CylinderGeometry"})})}};function so(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function GM(i){return new B(i.y,-i.x)}var Uh=class extends Le{constructor(e,t,r,n,s,o,a,l,c,h,u,f,d=!1){super(),this.type="RoundedCylinderBufferGeometry",e=e!==void 0?e:1,t=t!==void 0?t:1,r=r||1,n=Math.floor(n)||8,s=Math.floor(s)||1,o=o!==void 0?o:!1,a=a!==void 0?a:0,l=l!==void 0?l:Math.PI*2,o&&(c=0,h=0);let p=[],m=[],g=[],v=[],y=0,w=r/2,b=new M,S=new M;d&&e==0&&(e=c),d&&t==0&&(t=h);let T=new B(e,w),A=new B(t,-w),x=null,E=null,_=null,C=null,I=T.clone().sub(A),N=0,R=0,k=0;f>0&&(N=Math.min(e,t)*(1-f),R=e-N,k=t-N);let G=T.clone();G.x-=N;let te=Math.PI-I.angle(),Q=I.angle(),Y=Math.tan(Q/2),F=Math.tan(te/2),z=Y+F,O=f?z:F,j=f?z:Y;if(c=Math.min(c,(e-R)/O,I.length()/z),h=Math.min(h,(t-k)/j,I.length()/z),c>0){let le=c/Y;x=T.clone().sub(new B(le,c)),f&&(_=x.clone(),_.x-=N-z*c),T.sub(I.clone().setLength(le))}if(h>0){let le=h/F;E=A.clone().sub(new B(le,-h)),A.add(I.clone().setLength(le)),f&&(C=E.clone(),C.x-=N-z*h,G.sub(I.clone().setLength(le)))}I=T.clone().sub(A);let q=I.length()<.5,J=[];for(let le=0;le<=n;le++){let H=[],he=le/n,K=he*l+a,V=new B(Math.sin(K),Math.cos(K));C&&E?(W(H,he,V,te,h,C,-1,!0),W(H,he,V,Q,h,E,-1,!1)):E?(ge(H,V,E.x,0,-1),W(H,he,V,Q,h,E,-1,!1)):o||ge(H,V,t,k,-1);let Z=GM(I).normalize();if(so(Z,V,b),!q)for(let ce=0;ce<=s;ce++){let se=ce/s,pe=I.clone().multiplyScalar(se).add(A);so(pe,V,S),m.push(S.x,S.y,S.z),g.push(b.x,b.y,b.z),v.push(he,.5+S.y/r),H.push(y++)}if(_&&x?(W(H,he,V,te,c,x,1,!1),W(H,he,V,Q,c,_,1,!0)):x?(W(H,he,V,te,c,x,1,!1),ge(H,V,x.x,0,1)):o||ge(H,V,e,R,1),f&&!q){let ce=GM(I).multiplyScalar(-1).normalize();so(ce,V,b);for(let se=0;se<=s;se++){let pe=se/s,ve=I.clone().multiplyScalar(-pe).add(G);so(ve,V,S),m.push(S.x,S.y,S.z),g.push(b.x,b.y,b.z),v.push(he,.5+S.y/r),H.push(y++)}}f&&!o&&H.push(H[0]),J.push(H)}for(let le=0;le<J.length-1;le++)for(let H=0;H<J[0].length-1;H++){if(o&&f&&H==s)continue;let he=J[le][H],K=J[le+1][H],V=J[le+1][H+1],Z=J[le][H+1],ce=m[V*3+0],se=m[V*3+2];p.push(he,K,Z),(ce!=0||se!=0)&&p.push(K,V,Z)}l<Math.PI*2&&(oe(-1,J[0],a),oe(1,J[J.length-1],a+l)),this.setIndex(p),this.setAttribute("position",new Ce(m,3)),this.setAttribute("normal",new Ce(g,3)),this.setAttribute("uv",new Ce(v,2));function W(le,H,he,K,V,Z,ce,se){for(let pe=0;pe<u+1;pe++){let ve=pe/u,me=ce<0?ve:1-ve;se&&(me-=1),me*=K;let Pe=new B(Math.sin(me),Math.cos(me)*ce),ke=Pe.clone().multiplyScalar(V).add(Z);so(ke,he,S),m.push(S.x,S.y,S.z),so(Pe,he,b),g.push(b.x,b.y,b.z),v.push(H,.5+S.y/r),le.push(y++)}}function ge(le,H,he,K,V){let Z=new M,ce=new B,se=[he,K];V<0&&se.reverse();for(let pe of se)ce.set(pe,w*V),so(ce,H,Z),m.push(Z.x,Z.y,Z.z),g.push(0,V,0),v.push(.5,.5),le.push(y++)}function oe(le,H,he){let K=new B(Math.sin(he),Math.cos(he)),V=new B(-Math.cos(he),Math.sin(he)),Z=new M,ce=le<0?(ve,me,Pe)=>p.push(ve,me,Pe):(ve,me,Pe)=>p.push(ve,Pe,me),se=new B((e+t+R+k)/4,0);so(se,K,Z),m.push(Z.x,Z.y,Z.z),g.push(V.x,0,V.y),v.push(.5,.5);let pe=y++;for(let ve of H){let me=m.slice(ve*3,ve*3+3);m.push(...me),g.push(V.x,0,V.y);let Pe=v.slice(ve*2,ve*2+2);v.push(...Pe),y++}for(let ve=pe+1;ve<y-1;ve++)ce(pe,ve,ve+1);ce(pe,y-1,pe+1)}}};var VM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:0,cornerRadiusBottom:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,depth:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,cornerRadiusTop:c,cornerRadiusBottom:h,cornerSegments:u}=i.parameters,f;return c>0||h>0||l<360?f=new Uh(0,e/2,r,n,s,o,a,l*Math.PI/180,c,h,u,0,!0):f=new za(e/2,r,n,s,o),f.scale(1,1,t/e),Object.assign(f,{userData:xe(ie({},i),{type:"ConeGeometry"})})}};var HM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,widthSegments:n,heightSegments:s,depthSegments:o,cornerRadius:a,cornerSegments:l}=i.parameters,c;return a==0?c=new vn(e,t,r,n,s,o):c=new Ky(e,t,r,n,s,o,a,l),Object.assign(c,{userData:xe(ie({},i),{type:"CubeGeometry"})})}},Jy=Math.PI/2,Ky=class extends Le{constructor(e=1,t=1,r=1,n=1,s=1,o=1,a=0,l=4){super(),this.type="BoxBufferGeometry";let c=this;n=Math.floor(n),s=Math.floor(s),o=Math.floor(o),l=Math.floor(l),a=Math.min(a,e/2,t/2,r/2);let h=[],u=[],f=[],d=[],p=0,m=0;g("z","y","x",-1,-1,r,t,e,o,s,0),g("z","y","x",1,-1,r,t,-e,o,s,1),g("x","z","y",1,1,e,r,t,n,o,2),g("x","z","y",1,-1,e,r,-t,n,o,3),g("x","y","z",1,-1,e,t,r,n,s,4),g("x","y","z",-1,-1,e,t,-r,n,s,5),a>0&&(v("z","y","x",-1,-1,1,r,t,e,o,0),v("z","y","x",1,-1,-1,r,t,e,o,1),v("z","y","x",-1,1,-1,r,t,e,o,1),v("z","y","x",1,1,1,r,t,e,o,0),v("x","y","z",-1,-1,-1,e,t,r,n,0),v("x","y","z",1,-1,1,e,t,r,n,1),v("x","y","z",-1,1,1,e,t,r,n,0),v("x","y","z",1,1,-1,e,t,r,n,1),v("y","x","z",-1,-1,1,t,e,r,s,0),v("y","x","z",1,-1,-1,t,e,r,s,1),v("y","x","z",1,1,1,t,e,r,s,1),v("y","x","z",-1,1,-1,t,e,r,s,0),y(1,1,1),y(-1,1,1),y(1,-1,1),y(-1,-1,1),y(1,1,-1),y(-1,1,-1),y(1,-1,-1),y(-1,-1,-1)),this.setIndex(h),this.setAttribute("position",new Ce(u,3)),this.setAttribute("normal",new Ce(f,3)),this.setAttribute("uv",new Ce(d,2));function g(w,b,S,T,A,x,E,_,C,I,N){let R=(x-2*a)/C,k=(E-2*a)/I,G=x/2-a,te=E/2-a,Q=_/2,Y=C+1,F=I+1,z=0,O=0,j=new M;for(let q=0;q<F;q++){let J=q*k-te;for(let W=0;W<Y;W++){let ge=W*R-G;j[w]=ge*T,j[b]=J*A,j[S]=Q,u.push(j.x,j.y,j.z),j[w]=0,j[b]=0,j[S]=_>0?1:-1,f.push(j.x,j.y,j.z),d.push(W/C),d.push(1-q/I),z+=1}}for(let q=0;q<I;q++)for(let J=0;J<C;J++){let W=p+J+Y*q,ge=p+J+Y*(q+1),oe=p+(J+1)+Y*(q+1),le=p+(J+1)+Y*q;h.push(W,ge,le),h.push(ge,oe,le),O+=6}c.addGroup(m,O,N),m+=O,p+=z}function v(w,b,S,T,A,x,E,_,C,I,N){let R=(E-2*a)/I,k=E/2-a,G=_/2-a,te=C/2,Q=I+1,Y=0,F=0,z=new M,O=new M;for(let j=0;j<l+1;j++){let q=j/l*Jy,J=Math.sin(q)*a,W=(1-Math.cos(q))*a,ge=Math.sin(q),oe=Math.cos(q);z[b]=(G+J)*A,z[S]=(te-W)*x,O[w]=0,O[b]=ge*Math.sign(z[b]),O[S]=oe*Math.sign(z[S]);for(let le=0;le<Q;le++){let H=le*R-k;z[w]=H*T,u.push(z.x,z.y,z.z),f.push(O.x,O.y,O.z),d.push(le/I),d.push(0),Y+=1}}for(let j=0;j<l;j++)for(let q=0;q<I;q++){let J=p+q+Q*j,W=p+q+Q*(j+1),ge=p+(q+1)+Q*(j+1),oe=p+(q+1)+Q*j;h.push(J,W,oe),h.push(W,ge,oe),F+=6}c.addGroup(m,F,N),m+=F,p+=Y}function y(w,b,S){let T=new M,A=new M(e/2,t/2,r/2);A.subScalar(a);let x=[],E=w*b*S>0?(C,I,N)=>h.push(C,I,N):(C,I,N)=>h.push(C,N,I);for(let C=0;C<=l;C++){let I=[],N=Jy*(1-C/l),R=Math.cos(N),k=Math.sin(N),G=0;for(let te=0;te<=C;te++){let Q=Math.cos(G),Y=Math.sin(G);T.x=R*Q,T.y=k,T.z=R*Y;let F=A.clone().addScaledVector(T,a);u.push(w*F.x,b*F.y,S*F.z),f.push(w*T.x,b*T.y,S*T.z),d.push(0,0),I.push(p++),G+=Jy/C}x.push(I)}let _=x.length-1;for(let C=0;C<_;C++){let I=x[C],N=x[C+1],R=I.length-1;E(I[0],N[1],N[0]);for(let k=1;k<=R;k++)E(I[k-1],I[k],N[k]),E(I[k],N[k+1],N[k])}}}};var oo=class extends Le{constructor(e=[],t=[],r="",n=1,s=.2,o=4){super(),this.type="PolyhedronGeometryRound";let a=[],l=[],c=[];h(),u(),this.setAttribute("position",new Ce(a,3)),this.setAttribute("normal",new Ce(c,3)),this.setAttribute("uv",new Ce(l,2));return;function h(){var Y;s=Math.min(1-1e-5,s),s==0&&(o=0);let d={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[r],p=new M,m=p.clone(),g=new Jt,v=s*n,y=n-v,w=o+1,b=new M,S=(F,z)=>b.subVectors(F,z).normalize(),T=(F,z)=>Array(F).fill(void 0).map(z),A=T(e.length/3,(F,z)=>new M().fromArray(e,z*3).setLength(n)),x=[],E=1e6;for(let F=0;F<A.length;F++){let z=A[F],O=[],j,q,J,W=1e10,ge=-1;for(;(ge=t.indexOf(F,ge+1))!=-1;){let he=ge-ge%3;j=t[he+(ge+1)%3],q=t[he+(ge+2)%3],J=z.distanceToSquared(A[j]),W=Math.min(W,J),O.push([j,q,J])}W+=1e-6;let oe=[],le=0,H=O.length;for(let he=0;he<H;he++){[j,q,J]=O[le];let K=((Y=x[j])==null?void 0:Y.includes(F))==!0;J<=W&&oe.push(j+ +K*E),le=O.findIndex(V=>V[0]==q)}x.push(oe)}let _=[];{let F=0,z=0,O,j,q=d==3;for(let J=0;J<=o;J++){O=J*(J+1)/2,j=(J+1)*(J+2)/2;for(let W=0;W<o-J;W++)[F,z]=[O+W+J+2,j+W+J+3],_.push(O,j,...q?[z,O]:[F,j],z,F),[O,j]=[F,z];_.push(O,j,O+o+2)}}let C=p.clone(),I=p.clone(),N=p.clone(),R=p.clone(),k=p.clone(),G=[],te=T(A.length,()=>T(d,()=>p.clone()));for(let F=0;F<A.length;F++){p.copy(A[F]).normalize(),C.copy(p).multiplyScalar(y);let z=x[F];for(let oe=0;oe<z.length;oe++){let le=z[oe],H=z[(oe+1)%d];g.setFromPointsAndIndices(A,F,le%E,H%E),g.b.sub(g.a).setLength(1e10).add(g.a),g.c.sub(g.a).setLength(1e10).add(g.a),g.closestPointToPoint(C,te[F][oe])}let O=[],j=[],q=[],J=new M;o==0&&[...te[F]].reduce((oe,le)=>oe.add(le),J).multiplyScalar(1/d);for(let oe=0;oe<d;oe++){let le=[],H=(oe-1+d)%d,he=te[F][H],K=te[F][oe];p.copy(he).sub(C),m.copy(K).sub(C);let V=C.angleTo(p),Z=p.angleTo(m),ce=Math.cos(V)*v;o==0?I.copy(J):I.copy(C).setLength(y+ce),j.push(ce);let se=[I,he,K];for(let pe=0;pe<2;pe++){let ve=se[pe],me=se[pe+1];R.subVectors(ve,C),k.subVectors(me,C),N.crossVectors(R,k).normalize();for(let Pe=0;Pe<w;Pe++){let ke=[V,Z][pe]*Pe/w;p.copy(R).applyAxisAngle(N,ke).add(C),O.push(p.clone()),pe&&(S(p,C),le.push([Pe==0?ve:p.clone(),b.clone()]))}pe&&(S(me,C),le.push([me,b.clone()]))}q.push(le)}G.push(q);let W=2*w,ge=2;for(let oe=0;oe<d;oe++){let le=W*oe,H=W*((oe+1)%d),he=[O[le]];for(let V=1;V<w;V++){R=O[le+V],k=O[H+V],he.push(R);for(let Z=1,ce=V-ge+1;Z<=ce;Z++)p.lerpVectors(R,k,Z/(ce+1)),p.sub(C).setLength(j[oe]).add(C),he.push(p.clone());he.push(k)}for(let V=0;V<w;V++)he.push(O[V+w+le]);he.push(O[H+w]);let K=_.map(V=>he[V]);a.push(...K.map(V=>[V.x,V.y,V.z]).flat()),c.push(...K.map(V=>(S(V,C),[b.x,b.y,b.z])).flat())}}let Q=[];for(let F=0;F<x.length;F++)for(let z=0;z<d;z++){let O=x[F][z];if(O<E){let j=x[O].findIndex(W=>W%E==F),q=G[F][z],J=G[O][j];for(let W=0;W<w;W++){let ge=q[W],oe=J[w-W],le=q[W+1],H=J[w-(W+1)];[ge,oe,le,le,oe,H].forEach(he=>{a.push(he[0].x,he[0].y,he[0].z),c.push(he[1].x,he[1].y,he[1].z)})}Q.push(q[0][0],J[w][0],q[w][0],J[0][0])}}for(;Q.length;){let F,z,O,j;[F,z]=Q.splice(0,2);let q=[F];for(;F!=z;)q.push(z),O=Q.indexOf(z),j=O%2,z=Q.splice(O-j,2)[1-j];b.subVectors(q[0],q[1]).cross(p.subVectors(q[0],q[2])).normalize();let J=b.dot(q[0])<0;J&&b.negate();for(let W=1;W<=q.length-2;W++)[q[W+ +J],q[W+1-+J],q[0]].forEach(ge=>{a.push(ge.x,ge.y,ge.z),c.push(b.x,b.y,b.z)})}}function u(){let f=new M;for(let A=0;A<a.length;A+=3){f.x=a[A+0],f.y=a[A+1],f.z=a[A+2];let x=S(f)/2/Math.PI+.5,E=T(f)/Math.PI+.5;l.push(x,1-E)}let d=new M,p=new M,m=new M,g=new M,v=new B,y=new B,w=new B,b=(A,x,E,_)=>{_<0&&A.x===1&&(l[x]=A.x-1),E.x===0&&E.z===0&&(l[x]=_/2/Math.PI+.5)};for(let A=0,x=0;A<a.length;A+=9,x+=6){d.set(a[A+0],a[A+1],a[A+2]),p.set(a[A+3],a[A+4],a[A+5]),m.set(a[A+6],a[A+7],a[A+8]),v.set(l[x+0],l[x+1]),y.set(l[x+2],l[x+3]),w.set(l[x+4],l[x+5]),g.copy(d).add(p).add(m).divideScalar(3);let E=S(g);b(v,x+0,d,E),b(y,x+2,p,E),b(w,x+4,m,E)}for(let A=0;A<l.length;A+=6){let x=l[A+0],E=l[A+2],_=l[A+4],C=Math.max(x,E,_),I=Math.min(x,E,_);C>.9&&I<.1&&(x<.2&&(l[A+0]+=1),E<.2&&(l[A+2]+=1),_<.2&&(l[A+4]+=1))}function S(A){return Math.atan2(A.z,-A.x)}function T(A){return Math.atan2(-A.y,Math.sqrt(A.x*A.x+A.z*A.z))}}}static fromJSON(e){return new oo(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}};var WM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:o}=i.parameters,a=n===0&&s!==0?new zh(e*.5,s,o):new ka(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:xe(ie({},i),{type:"DodecahedronGeometry"})})}},zh=class extends oo{constructor(e=1,t=.2,r=4){let n=(1+Math.sqrt(5))/2,s=1/n,o=[-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,-s,-n,0,-s,n,0,s,-n,0,s,n,-s,-n,0,-s,n,0,s,-n,0,s,n,0,-n,0,-s,n,0,-s,-n,0,s,n,0,s],a=[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],l="DodecahedronGeometry";super(o,a,l,e,t,r),this.type=l}static fromJSON(e){return new zh(e.radius,e.corner,e.cornerSides)}};var Gh=1e-12,Dl=class{constructor(e){this.position=new B;this.startPosition=new B;this.uuid=et.generateUUID();this.position=e.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(e){this.position.copy(this.startPosition).add(e)}copy(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}clone(){return new Dl(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},Pl=class extends Dl{constructor(t){super(t.position);this.parent=t}copy(t){return super.copy(t),this}clone(){return new Pl(this.parent).copy(this)}},ui=class extends Dl{constructor(t,r){super(r);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=t,this.controls.push(new Pl(this),new Pl(this))}static create(t,r){let n=new ui(t,new B(...r.position));return n.controls[0].position.set(...r.controlPrevious.position),n.controls[1].position.set(...r.controlNext.position),n.roundness=r.roundness,n.areControlsDirectionsMirrored=r.areControlsDirectionsMirrored,n}getOppositeControl(t){let r=this.controls.indexOf(t);return r===0?this.controls[1]:r===1?this.controls[0]:null}applyOffsetToControls(t,r=1){for(let n=0,s=this.controls.length;n<s;n++){let o=this.controls[n];this.position.distanceTo(o.position)<=r?o.position.copy(this.position):o.applyOffset(t)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(t){return super.copy(t),this.controls[0].copy(t.controls[0]),this.controls[1].copy(t.controls[1]),this.roundness=t.roundness,this.uuid=t.uuid,this}clone(){return new ui(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}},Zy=i=>i,Vh=new B,$y=new B,UO=new B,zO=new B,GO=new B,kO=new B,jM=new M,qM=new M;function YM(i){let e=new B;e.addVectors(i.v0,Vh.subVectors(i.v1,i.v0).multiplyScalar(2/3));let t=new B;return t.addVectors(i.v2,$y.subVectors(i.v1,i.v2).multiplyScalar(2/3)),new an(i.v0,e,t,i.v2)}function kh(i,e,t=Number.EPSILON){return Math.abs(i-e)<t}function VO(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function HO(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function ev(i,e,t){let r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),s=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2));return Math.acos((n*n+r*r-s*s)/(2*n*r))}function XM(i,e,t,r,n){let s=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),o=(i.y+e.y)/2,a=(i.x+e.x)/2,l=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(i.y-e.y)/s,c=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(e.x-i.x)/s;return r.set(a+l,o+c),n.set(a-l,o-c),[r,n]}function QM(i,e,t){let r=i.distanceTo(t),n=e.distanceTo(t);return r<n?e:i}function JM(i,e,t,r,n,s){let o=e.x-i.x,a=e.y-i.y,l=t.x-i.x,c=t.y-i.y,h=Math.sqrt((o+l)*(o+l)+(a+c)*(a+c)),u;return ev(e,i,t)>Math.PI&&(h*=-1),kh(c,a)?u=(a+c)*(r/h-.5)*8/3/(o-l):u=(o+l)*(r/h-.5)*8/3/(c-a),n.set(e.x-u*a,e.y+u*o),s.set(t.x+u*c,t.y-u*l),[n,s]}function tv(i,e){return i.position.equals(i.controls[1].position)&&e.position.equals(e.controls[0].position)}function KM(i,e,t,r,n=.5){let s=Vh.subVectors(e,i).multiplyScalar(n).add(i),o=$y.subVectors(t,e).multiplyScalar(n).add(e),a=UO.subVectors(r,t).multiplyScalar(n).add(t),l=s,c=zO.subVectors(o,s).multiplyScalar(n).add(s),h=GO.subVectors(a,o).multiplyScalar(n).add(o),u=a,f=kO.subVectors(h,c).multiplyScalar(n).add(c);return[i.x,i.y,l.x,l.y,c.x,c.y,f.x,f.y,h.x,h.y,u.x,u.y,r.x,r.y]}function ZM(i,e,t=12,r=!0){let n=qM.set(0,0,0),s,o=0,a=[];for(let l=0;l<e.length;l++){let c=Zy(e[l]),h=Vh,u=ao(c,t);a.push(u);for(let f=0;f<=u;f++)if(c instanceof an||c instanceof kn||c instanceof ln){if(c.getPoint(f/u,h),n.set(h.x,h.y,0),s!==void 0&&HO(s,n))continue;s===void 0&&(s=jM),s.copy(n),i.setXYZ(o,n.x,n.y,n.z),o++}}return r&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),i}function $M(i,e,t,r=12,n=!0){let s=qM.set(0,0,0),o=0,a=[];for(let l=0;l<e.length;l++){if(t[l]===!1)continue;let c,h=Zy(e[l]),u=Vh,f=ao(h,r);a.push(f);for(let d=0;d<=f;d++)if(h instanceof an||h instanceof kn||h instanceof ln){if(h.getPoint(d/f,u),s.set(u.x,u.y,0),c!=null&&c.equals(s))continue;c===void 0?c=jM:(i.setXYZ(o,c.x,c.y,c.z),o++,i.setXYZ(o,s.x,s.y,s.z),o++),c.copy(s)}}return n&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),a}function rv(i,e=12,t=!1){let r=[];for(let n=0,s=i.length;n<s;n++){let o=i[n],a=0;if(t&&o.roundedCurveCorner!==void 0){let l=ao(o.roundedCurveCorner,e)*.5;n>0&&(r[n-1]+=l),a+=l}o.curveAfter!==void 0&&(a+=ao(o.curveAfter,e)),r.push(a)}return i.length>0&&t&&i[0].roundedCurveCorner!==void 0&&(r[i.length-1]+=ao(i[0].roundedCurveCorner,e)*.5),r}function ao(i,e=12){return i&&i instanceof Us?e*2:i&&(i instanceof ln||i instanceof th)?1:i&&i instanceof Po?e*i.points.length:e}function e1(i,e,t=12,r=!0){let n,s=0;for(let o=0;o<e.length;o++){let a=Zy(e[o]),l=ao(a,t),c=Vh;for(let h=0;h<=l;h++)if(a instanceof an||a instanceof kn||a instanceof ln){if(a.getPoint(h/l,c),n!==void 0&&VO(n,c,Gh))continue;n===void 0&&(n=$y),n.copy(c),i.push(c.x,c.y),s++}}return kh(i[0],i[i.length-2],Gh)&&kh(i[1],i[i.length-1],Gh)&&(i.pop(),i.pop()),r&&s>1&&!(kh(i[s-1],i[1],Gh)&&kh(i[s-2],i[0],Gh))&&(i.push(i[0],i[1]),s++),i}var nv=new B,WO=new B,jO=new B,qO=new B,YO=new B,XO=new B,Tt=class extends rn{constructor(t=100,r=100){super();this.points=[];this.shapeHoles=[];this.eventDispatcher=new Yt;this.plane=new Gr(new M(0,0,-1));this.subdivision=0;this.controlSnapDistance=4;this.pointIDs=0;this.isMesh2D=!1;this._roundness=0;this.isClosed=!1;this.useCubicForRoundedCorners=!0;this.uuid=et.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=t,this._height=r}static createFromState(t,r,n){let s=new Tt;return s.isClosed=t.isClosed,s.points=t.points.map(o=>ui.create(o.id,o.data)),typeof t.roundness=="number"&&(s.roundness=t.roundness),s.shapeHoles=t.shapeHoles.map(o=>Tt.createFromState(o)),r!==void 0&&n!==void 0&&s.applySize(r,n),s.update(),s}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(t){if(this._roundness!==t){this._roundness=t;for(let r=0,n=this.points.length;r<n;r++)this.points[r].roundness=t;this.needsUpdate=!0}}getPointsIndexesByIds(t){return t.map(r=>this.getPointIndexById(r)).filter(r=>r>=0)}getPointIndexById(t){let r=this.points.length,n=this.points.findIndex(s=>s.uuid===t);if(n<0){let s=r;for(let o=0,a=this.shapeHoles.length;o<a;o++){let l=this.shapeHoles[o],c=l.points.length-1,h=l.getPointIndexById(t);if(h<0)s+=c;else return h+s}}return n}getLineIndexById(t){return this.getPointIndexById(t)}getBezierPoint(t){if(t<=this.points.length-1)return this.points[t];if(this.shapeHoles.length>0)for(let r=0,n=this.shapeHoles.length;r<n;r++){let s=this.shapeHoles[r],o=t-this.points.length;if(o<=s.points.length-1)return s.points[o]}throw new Error("This shape does not have a point for this index: "+t)}getBezierPointIndex(t){let r=this.points.indexOf(t);if(r>=0)return r;if(r=this.points.length,this.shapeHoles.length>0)for(let n=0,s=this.shapeHoles.length;n<s;n++){let o=this.shapeHoles[n],a=o.points.indexOf(t);if(a>=0)return r+a;r+=o.points.length}return-1}getAllPoints(){let t=[].concat(...this.shapeHoles.map(r=>r.points));return[...this.points,...t]}applySize(t,r){t===0&&(t=.001),r===0&&(r=.001),this._width=t,this._height=r}applyScale(t,r){let n=nv.set(t,r);for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];a.position.multiply(n),a.controls[0].position.multiply(n),a.controls[1].position.multiply(n)}for(let s=0,o=this.shapeHoles.length;s<o;s++)this.shapeHoles[s].applyScale(t,r);this._update(!1)}createPoint(t,r=0,n=et.generateUUID()){let s;t instanceof B?s=t:s=new B(t,r);let o=new ui(n,s);return o.roundness=this.roundness,o}addPoint(t){this.points.push(t),this.needsUpdate=!0}addPointAt(t,r){this.points.splice(r,0,t),this.needsUpdate=!0}getPointByUuid(t){for(let r=0,n=this.points.length;r<n;r++){let s=this.points[r];if(s.uuid===t)return s}for(let r=0,n=this.shapeHoles.length;r<n;r++){let o=this.shapeHoles[r].getPointByUuid(t);if(o)return o}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(t){let r=this.points.indexOf(t);r>=0&&this.points.splice(r,1),this.needsUpdate=!0}removePointById(t){let r=this.points.find(n=>n.uuid===t);r&&this.removePoint(r)}update(t=!0){for(let r=0,n=this.shapeHoles.length;r<n;r++)this.shapeHoles[r].update(!1);this._update(t)}extractShapePointsToBuffer(t,r=12,n=!1){this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r);let s=n?this.roundedCurveDivisions:this.curveDivisions;return ZM(t,n?this.roundedCurves:this.curves,r,this.autoClose),s.reduce((o,a)=>o+a,0)+1}computeCurveDivisions(t=12){return this.curveDivisions=rv(this.points,t,!1),this.roundedCurveDivisions=rv(this.points,t,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(t,r,n=12){return $M(t,this.curves,r,n,this.autoClose).reduce((o,a)=>o+a,0)*2}extractShapePointsToFlatArray(t,r=12){return this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r),e1(t,this.roundedCurves,r,this.autoClose)}getCurveIndexFromVertexId(t,r=!1){let n=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let s=r?this.roundedCurveDivisions:this.curveDivisions,o=0;r&&this.points[0].roundedCurveCorner!==void 0&&(o=ao(this.points[0].roundedCurveCorner,this.subdivision)*.5);let a=t-o;a<0&&(a+=s.reduce((l,c)=>l+c,0));for(let l=0,c=s.length;l<c;l++){let h=s[l];if(a<n+h)return[l,(a-n+1)/h];n+=h}return[0,1]}getCurveT(t,r,n){let s=this.points[t],o=this.points[t>=this.points.length-1?0:t+1],a=this.curveDivisions,l=a[t];if(tv(s,o)){let u=s.position.distanceTo(o.position);return s.position.distanceTo(nv.set(n.x,n.y))/u}let c=0;for(let u=0;u<t;u++)c+=a[u];return(r-c)/l}dispose(){this.eventDispatcher=null}_applyCurveForPoint(t,r){tv(r,t)?this.lineTo(t.position.x,t.position.y):this.bezierCurveTo(r.controls[1].position.x,r.controls[1].position.y,t.controls[0].position.x,t.controls[0].position.y,t.position.x,t.position.y);let n=this.curves[this.curves.length-1];t.curveBefore=n,r.curveAfter=n;let s=n.clone();t.roundedCurveBefore=s,r.roundedCurveAfter=s,t.roundedCurveCorner=void 0,this.roundedCurves.push(s)}_update(t=!0){var n;if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];if(s===0)this.moveTo(a.position.x,a.position.y);else{let l=this.points[s-1];this._applyCurveForPoint(a,l)}}let r=this.getLastPoint();if(r!=null&&r.curveAfter&&(r.curveAfter=void 0),this.isClosed){let s=this.points[0],o=this.points[this.points.length-1];this._applyCurveForPoint(s,o)}if(this.points.length>2){let s=0;for(let o=0,a=this.points.length;o<a;o++){let l=this.points[o],c=l.roundness;if(!l.controlsMoved()&&c>0){let h=l.curveBefore,u=l.curveAfter;if(h===void 0||u===void 0)continue;let f=l.roundedCurveBefore,d=l.roundedCurveAfter,p=h.getLength(),m=u.getLength(),g=Math.min(c,p*.499),v=Math.min(c,m*.499),y=Math.min(g,v),w=1-y/p,b=y/m,S=h.getPointAt(w,nv),T=u.getPointAt(b,WO);this._subSplitCurve(h,f,w,S,void 0),this._subSplitCurve(u,d,b,void 0,T);let A;if(this.useCubicForRoundedCorners){let x=ev(S,l.position,T)/2,E=Math.tan(x)*S.distanceTo(l.position),[_,C]=XM(S,T,E,jO,qO),I=QM(_,C,l.position),[N,R]=JM(I,S,T,E,YO,XO);A=new an(S.clone(),N.clone(),R.clone(),T.clone())}else A=new kn(S.clone(),l.position.clone(),T.clone());l.roundedCurveCorner=A,this.roundedCurves.splice(o+s,0,A),s++}}}t&&((n=this.eventDispatcher)==null||n.dispatchEvent({type:"update"}))}_subSplitCurve(t,r,n,s,o){if(t instanceof ln)s!==void 0&&r.v2.copy(s),o!==void 0&&r.v1.copy(o);else{let a=t,l=r,c=a.getUtoTmapping(n,0),h=KM(a.v0,a.v1,a.v2,a.v3,c);return s!==void 0&&(l.v0.set(h[0],h[1]),l.v1.set(h[2],h[3]),l.v2.set(h[4],h[5]),l.v3.set(h[6],h[7])),o!==void 0&&(l.v0.set(h[6],h[7]),l.v1.set(h[8],h[9]),l.v2.set(h[10],h[11]),l.v3.set(h[12],h[13])),l}return r}clone(){let t=new Tt(this._width,this._height);return t.points=this.points.map(r=>r.clone()),t.isClosed=this.isClosed,t.roundness=this.roundness,t.isMesh2D=this.isMesh2D,t.shapeHoles=this.shapeHoles.map(r=>r.clone()),t}toJSON(){return{points:this.points.reduce((t,r)=>t.concat(r.toJSON()),[]),shapeHoles:this.shapeHoles.map(t=>t.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(t){var n;this.points=[],this.pointIDs=0;let r=t.points.length/7;for(let s=0;s<r;s++){let o=s*7,a=t.points[o+0],l=t.points[o+1],c=t.points[o+2],h=t.points[o+3],u=t.points[o+4],f=t.points[o+5],d=t.points[o+6],p=new ui(et.generateUUID(),new B(a,l));p.controls[0].position.set(c,h),p.controls[1].position.set(u,f),p.roundness=d,this.points.push(p)}return this.shapeHoles=(n=t.shapeHoles)!=null&&n.length?t.shapeHoles.map(s=>{let o=new Tt;return o.fromJSON(s),o}):[],this.isClosed=t.isClosed,this._roundness=t.roundness,this._update(),this}fromShape(t){let r=(s,o)=>{o instanceof an&&o.v3.equals(s.position)&&s.controls[0].position.copy(o.v2)},n=s=>{let o=[],a,l;for(a=0,l=s.length;a<l;a++)s[a]instanceof kn&&(s[a]=YM(s[a]));for(a=0,l=s.length;a<l;a++){let u=s[a],f=a>0?s[a-1]:null,d;u instanceof an?(d=this.createPoint(u.v0),d.controls[1].position.copy(u.v1)):u instanceof ln&&(d=this.createPoint(u.v1)),d!==void 0&&(f!==null&&r(d,f),o.push(d))}let c=s[s.length-1],h=!1;return c instanceof an?c.v3.equals(o[0].position)&&(o[0].controls[0].position.copy(c.v2),h=!0):c instanceof ln&&c.v2.equals(o[0].position)&&(h=!0),this.isClosed=h,o};return this.points=n(t.curves),t instanceof rn&&(this.shapeHoles=t.holes.map(s=>{let o=new Tt;return o.fromShape(s),o})),this.update(),this}};var sv=Math.PI*2;function iv({x:i,y:e},t,r,n,s){return{x:i*t+n,y:e*r+s}}function QO(i,e){let t=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),r=Math.cos(i),n=Math.sin(i),s=Math.cos(i+e),o=Math.sin(i+e);return[{x:r-n*t,y:n+r*t},{x:s+o*t,y:o-s*t},{x:s,y:o}]}function t1(i,e,t,r){let n=i*r-e*t<0?-1:1,s=Math.min(1,Math.max(-1,i*t+e*r));return n*Math.acos(s)}function JO(i,e,t,r,n,s,o,a,l,c){let h=Math.pow(n,2),u=Math.pow(s,2),f=Math.pow(o,2),d=Math.pow(a,2),p=h*u-h*d-u*f;p<0&&(p=0),p/=h*d+u*f,p=Math.sqrt(p)*(l===c?-1:1);let m=p*n/s*a,g=p*-s/n*o,v=m+(i+t)/2,y=g+(e+r)/2,w=(o-m)/n,b=(a-g)/s,S=(-o-m)/n,T=(-a-g)/s,A=t1(1,0,w,b),x=t1(w,b,S,T);return!c&&x>0&&(x-=sv),c&&x<0&&(x+=sv),{centerx:v,centery:y,ang1:A,ang2:x}}function r1({px:i,py:e,cx:t,cy:r,rx:n,ry:s,largeArcFlag:o,sweepFlag:a}){let l=[];if(n===0||s===0)return[];let c=(i-t)/2,h=(e-r)/2;if(c===0&&h===0)return[];n=Math.abs(n),s=Math.abs(s);let u=Math.pow(c,2)/Math.pow(n,2)+Math.pow(h,2)/Math.pow(s,2);u>1&&(n*=Math.sqrt(u),s*=Math.sqrt(u));let f=JO(i,e,t,r,n,s,c,h,o,a),{ang1:d,ang2:p}=f,{centerx:m,centery:g}=f,v=Math.abs(p)/(sv/4);Math.abs(1-v)<1e-7&&(v=1);let y=Math.max(Math.ceil(v),1);p/=y;for(let w=0;w<y;w++)l.push(QO(d,p)),d+=p;return l.map(w=>{let{x:b,y:S}=iv(w[0],n,s,m,g),{x:T,y:A}=iv(w[1],n,s,m,g),{x,y:E}=iv(w[2],n,s,m,g);return{x1:b,y1:S,x2:T,y2:A,x,y:E}})}var Zt;(function(i){i[i.ODD=0]="ODD",i[i.NONZERO=1]="NONZERO",i[i.POSITIVE=2]="POSITIVE",i[i.NEGATIVE=3]="NEGATIVE",i[i.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(Zt||(Zt={}));var Tr;(function(i){i[i.POLYGONS=0]="POLYGONS",i[i.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",i[i.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(Tr||(Tr={}));function qe(i,e){if(!i)throw e||"Assertion Failed!"}var ze=function(){function i(){}return i.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},i.vertLeq=function(e,t){return e.s<t.s||e.s===t.s&&e.t<=t.t},i.transLeq=function(e,t){return e.t<t.t||e.t===t.t&&e.s<=t.s},i.edgeGoesLeft=function(e){return i.vertLeq(e.Dst,e.Org)},i.edgeGoesRight=function(e){return i.vertLeq(e.Org,e.Dst)},i.vertL1dist=function(e,t){return Math.abs(e.s-t.s)+Math.abs(e.t-t.t)},i.edgeEval=function(e,t,r){qe(i.vertLeq(e,t)&&i.vertLeq(t,r));var n=t.s-e.s,s=r.s-t.s;return n+s>0?n<s?t.t-e.t+(e.t-r.t)*(n/(n+s)):t.t-r.t+(r.t-e.t)*(s/(n+s)):0},i.edgeSign=function(e,t,r){qe(i.vertLeq(e,t)&&i.vertLeq(t,r));var n=t.s-e.s,s=r.s-t.s;return n+s>0?(t.t-r.t)*n+(t.t-e.t)*s:0},i.transEval=function(e,t,r){qe(i.transLeq(e,t)&&i.transLeq(t,r));var n=t.t-e.t,s=r.t-t.t;return n+s>0?n<s?t.s-e.s+(e.s-r.s)*(n/(n+s)):t.s-r.s+(r.s-e.s)*(s/(n+s)):0},i.transSign=function(e,t,r){qe(i.transLeq(e,t)&&i.transLeq(t,r));var n=t.t-e.t,s=r.t-t.t;return n+s>0?(t.s-r.s)*n+(t.s-e.s)*s:0},i.vertCCW=function(e,t,r){return e.s*(t.t-r.t)+t.s*(r.t-e.t)+r.s*(e.t-t.t)>=0},i.interpolate=function(e,t,r,n){return e=e<0?0:e,r=r<0?0:r,e<=r?r===0?(t+n)/2:t+(n-t)*(e/(e+r)):n+(t-n)*(r/(e+r))},i.intersect=function(e,t,r,n,s){var o,a,l;i.vertLeq(e,t)||(l=e,e=t,t=l),i.vertLeq(r,n)||(l=r,r=n,n=l),i.vertLeq(e,r)||(l=e,e=r,r=l,l=t,t=n,n=l),i.vertLeq(r,t)?i.vertLeq(t,n)?(o=i.edgeEval(e,r,t),a=i.edgeEval(r,t,n),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,r.s,a,t.s)):(o=i.edgeSign(e,r,t),a=-i.edgeSign(e,n,t),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,r.s,a,n.s)):s.s=(r.s+t.s)/2,i.transLeq(e,t)||(l=e,e=t,t=l),i.transLeq(r,n)||(l=r,r=n,n=l),i.transLeq(e,r)||(l=e,e=r,r=l,l=t,t=n,n=l),i.transLeq(r,t)?i.transLeq(t,n)?(o=i.transEval(e,r,t),a=i.transEval(r,t,n),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,r.t,a,t.t)):(o=i.transSign(e,r,t),a=-i.transSign(e,n,t),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,r.t,a,n.t)):s.t=(r.t+t.t)/2},i}(),Hh=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}return i}(),up=function(){function i(e){this.side=e,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(i.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),i}(),Ll=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0}return i}(),n1=function(){function i(){var e=new Ll,t=new Hh,r=new up(0),n=new up(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,r.next=r,r.Sym=n,n.next=n,n.Sym=r,this.vHead=e,this.fHead=t,this.eHead=r,this.eHeadSym=n}return i.prototype.makeEdge_=function(e){var t=new up(0),r=new up(1);e.Sym.side<e.side&&(e=e.Sym);var n=e.Sym.next;return r.next=n,n.Sym.next=t,t.next=e,e.Sym.next=r,t.Sym=r,t.Onext=t,t.Lnext=r,t.Org=null,t.Lface=null,t.winding=0,t.activeRegion=null,r.Sym=t,r.Onext=r,r.Lnext=t,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,t},i.prototype.splice_=function(e,t){var r=e.Onext,n=t.Onext;r.Sym.Lnext=t,n.Sym.Lnext=e,e.Onext=n,t.Onext=r},i.prototype.makeVertex_=function(e,t,r){var n=e;qe(n,"Vertex can't be null!");var s=r.prev;n.prev=s,s.next=n,n.next=r,r.prev=n,n.anEdge=t;var o=t;do o.Org=n,o=o.Onext;while(o!==t)},i.prototype.makeFace_=function(e,t,r){var n=e;qe(n,"Face can't be null");var s=r.prev;n.prev=s,s.next=n,n.next=r,r.prev=n,n.anEdge=t,n.trail=null,n.marked=!1,n.inside=r.inside;var o=t;do o.Lface=n,o=o.Lnext;while(o!==t)},i.prototype.killEdge_=function(e){e.Sym.side<e.side&&(e=e.Sym);var t=e.next,r=e.Sym.next;t.Sym.next=r,r.Sym.next=t},i.prototype.killVertex_=function(e,t){var r=e.anEdge,n=r;do n.Org=t,n=n.Onext;while(n!==r);var s=e.prev,o=e.next;o.prev=s,s.next=o},i.prototype.killFace_=function(e,t){var r=e.anEdge,n=r;do n.Lface=t,n=n.Lnext;while(n!==r);var s=e.prev,o=e.next;o.prev=s,s.next=o},i.prototype.makeEdge=function(){var e=new Ll,t=new Ll,r=new Hh,n=this.makeEdge_(this.eHead);return this.makeVertex_(e,n,this.vHead),this.makeVertex_(t,n.Sym,this.vHead),this.makeFace_(r,n,this.fHead),n},i.prototype.splice=function(e,t){var r=!1,n=!1;if(e!==t){if(t.Org!==e.Org&&(n=!0,this.killVertex_(t.Org,e.Org)),t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(t,e),!n){var s=new Ll;this.makeVertex_(s,t,e.Org),e.Org.anEdge=e}if(!r){var o=new Hh;this.makeFace_(o,t,e.Lface),e.Lface.anEdge=e}}},i.prototype.delete=function(e){var t=e.Sym,r=!1;if(e.Lface!==e.Rface&&(r=!0,this.killFace_(e.Lface,e.Rface)),e.Onext===e)this.killVertex_(e.Org,null);else if(e.Rface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev),!r){var n=new Hh;this.makeFace_(n,e,e.Lface)}t.Onext===t?(this.killVertex_(t.Org,null),this.killFace_(t.Lface,null)):(e.Lface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev)),this.killEdge_(e)},i.prototype.addEdgeVertex=function(e){var t=this.makeEdge_(e),r=t.Sym;this.splice_(t,e.Lnext),t.Org=e.Dst;var n=new Ll;return this.makeVertex_(n,r,t.Org),t.Lface=r.Lface=e.Lface,t},i.prototype.splitEdge=function(e){var t=this.addEdgeVertex(e),r=t.Sym;return this.splice_(e.Sym,e.Sym.Oprev),this.splice_(e.Sym,r),e.Dst=r.Org,r.Dst.anEdge=r.Sym,r.Rface=e.Rface,r.winding=e.winding,r.Sym.winding=e.Sym.winding,r.idx=e.idx,r.Sym.idx=e.Sym.idx,r},i.prototype.connect=function(e,t){var r=!1,n=this.makeEdge_(e),s=n.Sym;if(t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(n,e.Lnext),this.splice_(s,t),n.Org=e.Dst,s.Org=t.Org,n.Lface=s.Lface=e.Lface,e.Lface.anEdge=s,!r){var o=new Hh;this.makeFace_(o,n,e.Lface)}return n},i.prototype.zapFace=function(e){var t=e.anEdge,r,n,s,o,a;n=t.Lnext;do r=n,n=r.Lnext,r.Lface=null,r.Rface===null&&(r.Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),s=r.Sym,s.Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(r));while(r!=t);o=e.prev,a=e.next,a.prev=o,o.next=a},i.prototype.countFaceVerts_=function(e){var t=e.anEdge,r=0;do r++,t=t.Lnext;while(t!==e.anEdge);return r},i.prototype.mergeConvexFaces=function(e){var t,r,n,s,o,a,l;for(t=this.fHead.next;t!==this.fHead;t=t.next)if(!!t.inside)for(r=t.anEdge,o=r.Org;n=r.Lnext,s=r.Sym,s&&s.Lface&&s.Lface.inside&&(a=this.countFaceVerts_(t),l=this.countFaceVerts_(s.Lface),a+l-2<=e&&ze.vertCCW(r.Lprev.Org,r.Org,s.Lnext.Lnext.Org)&&ze.vertCCW(s.Lprev.Org,s.Org,r.Lnext.Lnext.Org)&&(n=s.Lnext,this.delete(s),r=null,s=null)),!(r&&r.Lnext.Org===o);)r=n;return!0},i.prototype.check=function(){var e=this.fHead,t=this.vHead,r=this.eHead,n,s,o,a,l,c;for(s=e,s=e;(n=s.next)!==e;s=n){qe(n.prev===s),l=n.anEdge;do qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l),qe(l.Lface===n),l=l.Lnext;while(l!==n.anEdge)}for(qe(n.prev===s&&n.anEdge===null),a=t,a=t;(o=a.next)!==t;a=o){qe(o.prev===a),l=o.anEdge;do qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l),qe(l.Org===o),l=l.Onext;while(l!==o.anEdge)}for(qe(o.prev===a&&o.anEdge===null),c=r,c=r;(l=c.next)!==r;c=l)qe(l.Sym.next===c.Sym),qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Org!==null),qe(l.Dst!==null),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l);qe(l.Sym.next===c.Sym&&l.Sym===this.eHeadSym&&l.Sym.Sym===l&&l.Org===null&&l.Dst===null&&l.Lface===null&&l.Rface===null)},i}(),i1=function(){function i(){this.handle=null}return i}(),s1=function(){function i(){this.key=null,this.node=0}return i}(),KO=function(){function i(e,t){this.leq=t,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=e,this.nodes=[],this.handles=[];for(var r=0;r<e+1;r++)this.nodes[r]=new i1,this.handles[r]=new s1;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return i.prototype.floatDown_=function(e){var t=this.nodes,r=this.handles,n,s,o;for(n=t[e].handle;;){if(o=e<<1,o<this.size&&this.leq(r[t[o+1].handle].key,r[t[o].handle].key)&&++o,qe(o<=this.max),s=t[o].handle,o>this.size||this.leq(r[n].key,r[s].key)){t[e].handle=n,r[n].node=e;break}t[e].handle=s,r[s].node=e,e=o}},i.prototype.floatUp_=function(e){var t=this.nodes,r=this.handles,n,s,o;for(n=t[e].handle;;){if(o=e>>1,s=t[o].handle,o===0||this.leq(r[s].key,r[n].key)){t[e].handle=n,r[n].node=e;break}t[e].handle=s,r[s].node=e,e=o}},i.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},i.prototype.min=function(){return this.handles[this.nodes[1].handle].key},i.prototype.insert=function(e){var t,r;if(t=++this.size,t*2>this.max){this.max*=2;var n,s;for(s=this.nodes.length,this.nodes.length=this.max+1,n=s;n<this.nodes.length;n++)this.nodes[n]=new i1;for(s=this.handles.length,this.handles.length=this.max+1,n=s;n<this.handles.length;n++)this.handles[n]=new s1}return this.freeList===0?r=t:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[t].handle=r,this.handles[r].node=t,this.handles[r].key=e,this.initialized&&this.floatUp_(t),r},i.prototype.extractMin=function(){var e=this.nodes,t=this.handles,r=e[1].handle,n=t[r].key;return this.size>0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[r].key=null,t[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),n},i.prototype.delete=function(e){var t=this.nodes,r=this.handles,n;qe(e>=1&&e<=this.max&&r[e].key!==null),n=r[e].node,t[n].handle=t[this.size].handle,r[t[n].handle].node=n,--this.size,n<=this.size&&(n<=1||this.leq(r[t[n>>1].handle].key,r[t[n].handle].key)?this.floatDown_(n):this.floatUp_(n)),r[e].key=null,r[e].node=this.freeList,this.freeList=e},i}(),ov=function(){function i(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}return i}(),o1=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),ZO=function(){function i(e,t){this.frame=e,this.leq=t,this.head=new o1,this.head.next=this.head,this.head.prev=this.head}return i.prototype.min=function(){return this.head.next},i.prototype.max=function(){return this.head.prev},i.prototype.insert=function(e){return this.insertBefore(this.head,e)},i.prototype.search=function(e){var t=this.head;do t=t.next;while(t.key!==null&&!this.leq(this.frame,e,t.key));return t},i.prototype.insertBefore=function(e,t){do e=e.prev;while(e.key!==null&&!this.leq(this.frame,e.key,t));var r=new o1;return r.key=t,r.next=e.next,e.next.prev=r,r.prev=e,e.next=r,r},i.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},i}(),$O=function(){function i(){}return i.regionBelow=function(e){return e.nodeUp.prev.key},i.regionAbove=function(e){return e.nodeUp.next.key},i.debugEvent=function(e){},i.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.edgeLeq=function(e,t,r){var n=e.event,s=t.eUp,o=r.eUp;if(s.Dst===n)return o.Dst===n?ze.vertLeq(s.Org,o.Org)?ze.edgeSign(o.Dst,s.Org,o.Org)<=0:ze.edgeSign(s.Dst,o.Org,s.Org)>=0:ze.edgeSign(o.Dst,n,o.Org)<=0;if(o.Dst===n)return ze.edgeSign(s.Dst,n,s.Org)>=0;var a=ze.edgeEval(s.Dst,n,s.Org),l=ze.edgeEval(o.Dst,n,o.Org);return a>=l},i.deleteRegion=function(e,t){t.fixUpperEdge&&qe(t.eUp.winding===0),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},i.fixUpperEdge=function(e,t,r){qe(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=r,r.activeRegion=t},i.topLeftRegion=function(e,t){var r=t.eUp.Org,n;do t=i.regionAbove(t);while(t.eUp.Org===r);if(t.fixUpperEdge){if(n=e.mesh.connect(i.regionBelow(t).eUp.Sym,t.eUp.Lnext),n===null)return null;i.fixUpperEdge(e,t,n),t=i.regionAbove(t)}return t},i.topRightRegion=function(e){var t=e.eUp.Dst;do e=i.regionAbove(e);while(e.eUp.Dst===t);return e},i.addRegionBelow=function(e,t,r){var n=new ov;return n.eUp=r,n.nodeUp=e.dict.insertBefore(t.nodeUp,n),n.fixUpperEdge=!1,n.sentinel=!1,n.dirty=!1,r.activeRegion=n,n},i.isWindingInside=function(e,t){switch(e.windingRule){case Zt.ODD:return(t&1)!==0;case Zt.NONZERO:return t!==0;case Zt.POSITIVE:return t>0;case Zt.NEGATIVE:return t<0;case Zt.ABS_GEQ_TWO:return t>=2||t<=-2}throw new Error("Invalid winding rulle")},i.computeWinding=function(e,t){t.windingNumber=i.regionAbove(t).windingNumber+t.eUp.winding,t.inside=i.isWindingInside(e,t.windingNumber)},i.finishRegion=function(e,t){var r=t.eUp,n=r.Lface;n.inside=t.inside,n.anEdge=r,i.deleteRegion(e,t)},i.finishLeftRegions=function(e,t,r){for(var n,s=null,o=t,a=t.eUp;o!==r;){if(o.fixUpperEdge=!1,s=i.regionBelow(o),n=s.eUp,n.Org!=a.Org){if(!s.fixUpperEdge){i.finishRegion(e,o);break}n=e.mesh.connect(a.Lprev,n.Sym),i.fixUpperEdge(e,s,n)}a.Onext!==n&&(e.mesh.splice(n.Oprev,n),e.mesh.splice(a,n)),i.finishRegion(e,o),a=s.eUp,o=s}return a},i.addRightEdges=function(e,t,r,n,s,o){var a,l,c,h,u=!0;c=r;do qe(ze.vertLeq(c.Org,c.Dst)),i.addRegionBelow(e,t,c.Sym),c=c.Onext;while(c!==n);for(s===null&&(s=i.regionBelow(t).eUp.Rprev),l=t,h=s;a=i.regionBelow(l),c=a.eUp.Sym,c.Org===h.Org;)c.Onext!==h&&(e.mesh.splice(c.Oprev,c),e.mesh.splice(h.Oprev,c)),a.windingNumber=l.windingNumber-c.winding,a.inside=i.isWindingInside(e,a.windingNumber),l.dirty=!0,!u&&i.checkForRightSplice(e,l)&&(i.addWinding(c,h),i.deleteRegion(e,l),e.mesh.delete(h)),u=!1,l=a,h=c;l.dirty=!0,qe(l.windingNumber-c.winding===a.windingNumber),o&&i.walkDirtyRegions(e,l)},i.spliceMergeVertices=function(e,t,r){e.mesh.splice(t,r)},i.vertexWeights=function(e,t,r){var n=ze.vertL1dist(t,e),s=ze.vertL1dist(r,e),o=.5*s/(n+s),a=.5*n/(n+s);e.coords[0]+=o*t.coords[0]+a*r.coords[0],e.coords[1]+=o*t.coords[1]+a*r.coords[1],e.coords[2]+=o*t.coords[2]+a*r.coords[2]},i.getIntersectData=function(e,t,r,n,s,o){t.coords[0]=t.coords[1]=t.coords[2]=0,t.idx=-1,i.vertexWeights(t,r,n),i.vertexWeights(t,s,o)},i.checkForRightSplice=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp;if(ze.vertLeq(n.Org,s.Org)){if(ze.edgeSign(s.Dst,n.Org,s.Org)>0)return!1;ze.vertEq(n.Org,s.Org)?n.Org!==s.Org&&(e.pq.delete(n.Org.pqHandle),i.spliceMergeVertices(e,s.Oprev,n)):(e.mesh.splitEdge(s.Sym),e.mesh.splice(n,s.Oprev),t.dirty=r.dirty=!0)}else{if(ze.edgeSign(n.Dst,s.Org,n.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(n.Sym),e.mesh.splice(s.Oprev,n)}return!0},i.checkForLeftSplice=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp,o;if(qe(!ze.vertEq(n.Dst,s.Dst)),ze.vertLeq(n.Dst,s.Dst)){if(ze.edgeSign(n.Dst,s.Dst,n.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,o=e.mesh.splitEdge(n),e.mesh.splice(s.Sym,o),o.Lface.inside=t.inside}else{if(ze.edgeSign(s.Dst,n.Dst,s.Org)>0)return!1;t.dirty=r.dirty=!0,o=e.mesh.splitEdge(s),e.mesh.splice(n.Lnext,s.Sym),o.Rface.inside=t.inside}return!0},i.checkForIntersect=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp,o=n.Org,a=s.Org,l=n.Dst,c=s.Dst,h,u,f=new Ll,d,p;if(qe(!ze.vertEq(c,l)),qe(ze.edgeSign(l,e.event,o)<=0),qe(ze.edgeSign(c,e.event,a)>=0),qe(o!==e.event&&a!==e.event),qe(!t.fixUpperEdge&&!r.fixUpperEdge),o===a||(h=Math.min(o.t,l.t),u=Math.max(a.t,c.t),h>u))return!1;if(ze.vertLeq(o,a)){if(ze.edgeSign(c,o,a)>0)return!1}else if(ze.edgeSign(l,a,o)<0)return!1;return i.debugEvent(e),ze.intersect(l,o,c,a,f),qe(Math.min(o.t,l.t)<=f.t),qe(f.t<=Math.max(a.t,c.t)),qe(Math.min(c.s,l.s)<=f.s),qe(f.s<=Math.max(a.s,o.s)),ze.vertLeq(f,e.event)&&(f.s=e.event.s,f.t=e.event.t),d=ze.vertLeq(o,a)?o:a,ze.vertLeq(d,f)&&(f.s=d.s,f.t=d.t),ze.vertEq(f,o)||ze.vertEq(f,a)?(i.checkForRightSplice(e,t),!1):!ze.vertEq(l,e.event)&&ze.edgeSign(l,e.event,f)>=0||!ze.vertEq(c,e.event)&&ze.edgeSign(c,e.event,f)<=0?c===e.event?(e.mesh.splitEdge(n.Sym),e.mesh.splice(s.Sym,n),t=i.topLeftRegion(e,t),n=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),r),i.addRightEdges(e,t,n.Oprev,n,n,!0),!0):l===e.event?(e.mesh.splitEdge(s.Sym),e.mesh.splice(n.Lnext,s.Oprev),r=t,t=i.topRightRegion(t),p=i.regionBelow(t).eUp.Rprev,r.eUp=s.Oprev,s=i.finishLeftRegions(e,r,null),i.addRightEdges(e,t,s.Onext,n.Rprev,p,!0),!0):(ze.edgeSign(l,e.event,f)>=0&&(i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(n.Sym),n.Org.s=e.event.s,n.Org.t=e.event.t),ze.edgeSign(c,e.event,f)<=0&&(t.dirty=r.dirty=!0,e.mesh.splitEdge(s.Sym),s.Org.s=e.event.s,s.Org.t=e.event.t),!1):(e.mesh.splitEdge(n.Sym),e.mesh.splitEdge(s.Sym),e.mesh.splice(s.Oprev,n),n.Org.s=f.s,n.Org.t=f.t,n.Org.pqHandle=e.pq.insert(n.Org),i.getIntersectData(e,n.Org,o,l,a,c),i.regionAbove(t).dirty=t.dirty=r.dirty=!0,!1)},i.walkDirtyRegions=function(e,t){for(var r=i.regionBelow(t),n,s;;){for(;r.dirty;)t=r,r=i.regionBelow(r);if(!t.dirty&&(r=t,t=i.regionAbove(t),t===null||!t.dirty))return;if(t.dirty=!1,n=t.eUp,s=r.eUp,n.Dst!==s.Dst&&i.checkForLeftSplice(e,t)&&(r.fixUpperEdge?(i.deleteRegion(e,r),e.mesh.delete(s),r=i.regionBelow(t),s=r.eUp):t.fixUpperEdge&&(i.deleteRegion(e,t),e.mesh.delete(n),t=i.regionAbove(r),n=t.eUp)),n.Org!==s.Org)if(n.Dst!==s.Dst&&!t.fixUpperEdge&&!r.fixUpperEdge&&(n.Dst===e.event||s.Dst===e.event)){if(i.checkForIntersect(e,t))return}else i.checkForRightSplice(e,t);n.Org===s.Org&&n.Dst===s.Dst&&(i.addWinding(s,n),i.deleteRegion(e,t),e.mesh.delete(n),t=i.regionAbove(r))}},i.connectRightVertex=function(e,t,r){var n,s=r.Onext,o=i.regionBelow(t),a=t.eUp,l=o.eUp,c=!1;if(a.Dst!==l.Dst&&i.checkForIntersect(e,t),ze.vertEq(a.Org,e.event)&&(e.mesh.splice(s.Oprev,a),t=i.topLeftRegion(e,t),s=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),o),c=!0),ze.vertEq(l.Org,e.event)&&(e.mesh.splice(r,l.Oprev),r=i.finishLeftRegions(e,o,null),c=!0),c){i.addRightEdges(e,t,r.Onext,s,s,!0);return}ze.vertLeq(l.Org,a.Org)?n=l.Oprev:n=a,n=e.mesh.connect(r.Lprev,n),i.addRightEdges(e,t,n,n.Onext,n.Onext,!1),n.Sym.activeRegion.fixUpperEdge=!0,i.walkDirtyRegions(e,t)},i.connectLeftDegenerate=function(e,t,r){var n,s,o,a,l;if(n=t.eUp,ze.vertEq(n.Org,r)){qe(!1),i.spliceMergeVertices(e,n,r.anEdge);return}if(!ze.vertEq(n.Dst,r)){e.mesh.splitEdge(n.Sym),t.fixUpperEdge&&(e.mesh.delete(n.Onext),t.fixUpperEdge=!1),e.mesh.splice(r.anEdge,n),i.sweepEvent(e,r);return}qe(!1),t=i.topRightRegion(t),l=i.regionBelow(t),o=l.eUp.Sym,s=a=o.Onext,l.fixUpperEdge&&(qe(s!==o),i.deleteRegion(e,l),e.mesh.delete(o),o=s.Oprev),e.mesh.splice(r.anEdge,o),ze.edgeGoesLeft(s)||(s=null),i.addRightEdges(e,t,o.Onext,a,s,!0)},i.connectLeftVertex=function(e,t){var r,n,s,o,a,l,c=new ov;if(c.eUp=t.anEdge.Sym,r=e.dict.search(c).key,n=i.regionBelow(r),!!n){if(o=r.eUp,a=n.eUp,ze.edgeSign(o.Dst,t,o.Org)===0){i.connectLeftDegenerate(e,r,t);return}if(s=ze.vertLeq(a.Dst,o.Dst)?r:n,r.inside||s.fixUpperEdge){if(s===r)l=e.mesh.connect(t.anEdge.Sym,o.Lnext);else{var h=e.mesh.connect(a.Dnext,t.anEdge);l=h.Sym}s.fixUpperEdge?i.fixUpperEdge(e,s,l):i.computeWinding(e,i.addRegionBelow(e,r,l)),i.sweepEvent(e,t)}else i.addRightEdges(e,r,t.anEdge,t.anEdge,null,!0)}},i.sweepEvent=function(e,t){e.event=t,i.debugEvent(e);for(var r=t.anEdge;r.activeRegion===null;)if(r=r.Onext,r===t.anEdge){i.connectLeftVertex(e,t);return}var n=i.topLeftRegion(e,r.activeRegion);qe(n!==null);var s=i.regionBelow(n),o=s.eUp,a=i.finishLeftRegions(e,s,null);a.Onext===o?i.connectRightVertex(e,n,a):i.addRightEdges(e,n,a.Onext,o,o,!0)},i.addSentinel=function(e,t,r,n){var s=new ov,o=e.mesh.makeEdge();o.Org.s=r,o.Org.t=n,o.Dst.s=t,o.Dst.t=n,e.event=o.Dst,s.eUp=o,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=e.dict.insert(s)},i.initEdgeDict=function(e){e.dict=new ZO(e,i.edgeLeq);var t=e.bmax[0]-e.bmin[0],r=e.bmax[1]-e.bmin[1],n=e.bmin[0]-t,s=e.bmax[0]+t,o=e.bmin[1]-r,a=e.bmax[1]+r;i.addSentinel(e,n,s,o),i.addSentinel(e,n,s,a)},i.doneEdgeDict=function(e){for(var t,r=0;(t=e.dict.min().key)!==null;)t.sentinel||(qe(t.fixUpperEdge),qe(++r===1)),qe(t.windingNumber===0),i.deleteRegion(e,t)},i.removeDegenerateEdges=function(e){var t,r,n,s=e.mesh.eHead;for(t=s.next;t!==s;t=r)r=t.next,n=t.Lnext,ze.vertEq(t.Org,t.Dst)&&t.Lnext.Lnext!==t&&(i.spliceMergeVertices(e,n,t),e.mesh.delete(t),t=n,n=t.Lnext),n.Lnext===t&&(n!==t&&((n===r||n===r.Sym)&&(r=r.next),e.mesh.delete(n)),(t===r||t===r.Sym)&&(r=r.next),e.mesh.delete(t))},i.initPriorityQ=function(e){var t,r,n,s=0;for(n=e.mesh.vHead,r=n.next;r!==n;r=r.next)s++;for(s+=8,t=e.pq=new KO(s,ze.vertLeq),n=e.mesh.vHead,r=n.next;r!==n;r=r.next)r.pqHandle=t.insert(r);return r!==n?!1:(t.init(),!0)},i.donePriorityQ=function(e){e.pq=null},i.removeDegenerateFaces=function(e,t){var r,n,s;for(r=t.fHead.next;r!==t.fHead;r=n)n=r.next,s=r.anEdge,qe(s.Lnext!==s),s.Lnext.Lnext===s&&(i.addWinding(s.Onext,s),e.mesh.delete(s));return!0},i.computeInterior=function(e,t){t===void 0&&(t=!0);var r,n;if(i.removeDegenerateEdges(e),!i.initPriorityQ(e))return!1;for(i.initEdgeDict(e);(r=e.pq.extractMin())!==null;){for(;n=e.pq.min(),!(n===null||!ze.vertEq(n,r));)n=e.pq.extractMin(),i.spliceMergeVertices(e,r.anEdge,n.anEdge);i.sweepEvent(e,r)}return e.event=e.dict.min().key.eUp.Org,i.debugEvent(e),i.doneEdgeDict(e),i.donePriorityQ(e),i.removeDegenerateFaces(e,e.mesh)?(t&&e.mesh.check(),!0):!1},i}(),eF=function(){function i(){this.mesh=new n1,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=Zt.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return i.prototype.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},i.prototype.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];if(!t)throw"Zero-size vector!";t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},i.prototype.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},i.prototype.computeNormal_=function(e){var t,r,n,s,o,a,l=[0,0,0],c=[0,0,0],h=[0,0,0],u=[0,0,0],f=[0,0,0],d=[null,null,null],p=[null,null,null],m=this.mesh.vHead;t=m.next;for(var g=0;g<3;++g)s=t.coords[g],c[g]=s,p[g]=t,l[g]=s,d[g]=t;for(t=m.next;t!==m;t=t.next)for(var v=0;v<3;++v)s=t.coords[v],s<c[v]&&(c[v]=s,p[v]=t),s>l[v]&&(l[v]=s,d[v]=t);var y=0;if(l[1]-c[1]>l[0]-c[0]&&(y=1),l[2]-c[2]>l[y]-c[y]&&(y=2),c[y]>=l[y]){e[0]=0,e[1]=0,e[2]=1;return}for(a=0,r=p[y],n=d[y],h[0]=r.coords[0]-n.coords[0],h[1]=r.coords[1]-n.coords[1],h[2]=r.coords[2]-n.coords[2],t=m.next;t!==m;t=t.next)u[0]=t.coords[0]-n.coords[0],u[1]=t.coords[1]-n.coords[1],u[2]=t.coords[2]-n.coords[2],f[0]=h[1]*u[2]-h[2]*u[1],f[1]=h[2]*u[0]-h[0]*u[2],f[2]=h[0]*u[1]-h[1]*u[0],o=f[0]*f[0]+f[1]*f[1]+f[2]*f[2],o>a&&(a=o,e[0]=f[0],e[1]=f[1],e[2]=f[2]);a<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(h)]=1)},i.prototype.checkOrientation_=function(){for(var e=this.mesh.fHead,t,r=this.mesh.vHead,n,s=0,o=e.next;o!==e;o=o.next)if(n=o.anEdge,!(n.winding<=0))do s+=(n.Org.s-n.Dst.s)*(n.Org.t+n.Dst.t),n=n.Lnext;while(n!==o.anEdge);if(s<0){for(t=r.next;t!==r;t=t.next)t.t=-t.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},i.prototype.projectPolygon_=function(){var e=this.mesh.vHead,t=[0,0,0],r,n,s=!1;t[0]=this.normal[0],t[1]=this.normal[1],t[2]=this.normal[2],!t[0]&&!t[1]&&!t[2]&&(this.computeNormal_(t),s=!0),r=this.sUnit,n=this.tUnit;var o=this.longAxis_(t);r[o]=0,r[(o+1)%3]=1,r[(o+2)%3]=0,n[o]=0,n[(o+1)%3]=0,n[(o+2)%3]=t[o]>0?1:-1;for(var a=e.next;a!==e;a=a.next)a.s=this.dot_(a.coords,r),a.t=this.dot_(a.coords,n);s&&this.checkOrientation_();for(var l=!0,c=e.next;c!==e;c=c.next)l?(this.bmin[0]=this.bmax[0]=c.s,this.bmin[1]=this.bmax[1]=c.t,l=!1):(c.s<this.bmin[0]&&(this.bmin[0]=c.s),c.s>this.bmax[0]&&(this.bmax[0]=c.s),c.t<this.bmin[1]&&(this.bmin[1]=c.t),c.t>this.bmax[1]&&(this.bmax[1]=c.t))},i.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.prototype.tessellateMonoRegion_=function(e,t){var r,n;if(r=t.anEdge,!(r.Lnext!==r&&r.Lnext.Lnext!==r))throw"Mono region invalid";for(;ze.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;ze.vertLeq(r.Org,r.Dst);r=r.Lnext);n=r.Lprev;for(var s=void 0;r.Lnext!==n;)if(ze.vertLeq(r.Dst,n.Org)){for(;n.Lnext!==r&&(ze.edgeGoesLeft(n.Lnext)||ze.edgeSign(n.Org,n.Dst,n.Lnext.Dst)<=0);)s=e.connect(n.Lnext,n),n=s.Sym;n=n.Lprev}else{for(;n.Lnext!==r&&(ze.edgeGoesRight(r.Lprev)||ze.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)s=e.connect(r,r.Lprev),r=s.Sym;r=r.Lnext}if(n.Lnext===r)throw"Mono region invalid";for(;n.Lnext.Lnext!==r;)s=e.connect(n.Lnext,n),n=s.Sym;return!0},i.prototype.tessellateInterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)if(t=r.next,r.inside&&!this.tessellateMonoRegion_(e,r))return!1;return!0},i.prototype.discardExterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)t=r.next,r.inside||e.zapFace(r)},i.prototype.setWindingNumber_=function(e,t,r){for(var n,s=e.eHead.next;s!==e.eHead;s=n)n=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?t:-t:r?e.delete(s):s.winding=0},i.prototype.getNeighbourFace_=function(e){return!e.Rface||!e.Rface.inside?-1:e.Rface.n},i.prototype.outputPolymesh_=function(e,t,r,n){var s,o=0,a=0,l;r>3&&e.mergeConvexFaces(r);for(var c=e.vHead.next;c!==e.vHead;c=c.next)c.n=-1;for(var h=e.fHead.next;h!==e.fHead;h=h.next)if(h.n=-1,!!h.inside){s=h.anEdge,l=0;do{var c=s.Org;c.n===-1&&(c.n=a,a++),l++,s=s.Lnext}while(s!==h.anEdge);if(l>r)throw"Face vertex greater that support polygon";h.n=o,++o}this.elementCount=o,t===Tr.CONNECTED_POLYGONS&&(o*=2),this.elements=[],this.elements.length=o*r,this.vertexCount=a,this.vertices=[],this.vertices.length=a*n,this.vertexIndices=[],this.vertexIndices.length=a;for(var c=e.vHead.next;c!==e.vHead;c=c.next)if(c.n!==-1){var u=c.n*n;this.vertices[u+0]=c.coords[0],this.vertices[u+1]=c.coords[1],n>2&&(this.vertices[u+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var f=0,h=e.fHead.next;h!==e.fHead;h=h.next)if(!!h.inside){s=h.anEdge,l=0;do{var c=s.Org;this.elements[f++]=c.n,l++,s=s.Lnext}while(s!==h.anEdge);for(var d=l;d<r;++d)this.elements[f++]=-1;if(t===Tr.CONNECTED_POLYGONS){s=h.anEdge;do this.elements[f++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==h.anEdge);for(var p=l;p<r;++p)this.elements[f++]=-1}}},i.prototype.outputContours_=function(e,t){var r,n,s=0,o=0;this.vertexCount=0,this.elementCount=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(!!a.inside){n=r=a.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==n);this.elementCount++}this.elements=[],this.elements.length=this.elementCount*2,this.vertices=[],this.vertices.length=this.vertexCount*t,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var l=0,c=0,h=0;s=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(!!a.inside){o=0,n=r=a.anEdge;do this.vertices[l++]=r.Org.coords[0],this.vertices[l++]=r.Org.coords[1],t>2&&(this.vertices[l++]=r.Org.coords[2]),this.vertexIndices[c++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,o++,r=r.Lnext;while(r!==n);this.elements[h++]=s,this.elements[h++]=o,s+=o}},i.prototype.addContour=function(e,t){this.mesh===null&&(this.mesh=new n1),e<2&&(e=2),e>3&&(e=3);for(var r=null,n=0;n<t.length;n+=e)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=t[n+0],r.Org.coords[1]=t[n+1],e>2?r.Org.coords[2]=t[n+2]:r.Org.coords[2]=0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},i.prototype.tesselate=function(e,t,r,n,s,o){if(e===void 0&&(e=Zt.ODD),t===void 0&&(t=Tr.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,s&&(this.normal[0]=s[0],this.normal[1]=s[1],this.normal[2]=s[2]),this.windingRule=e,n<2&&(n=2),n>3&&(n=3),!this.mesh)return!1;this.projectPolygon_(),$O.computeInterior(this,o);var a=this.mesh;return t===Tr.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),o&&a.check(),t===Tr.BOUNDARY_CONTOURS?this.outputContours_(a,n):this.outputPolymesh_(a,t,r,n),!0},i}();function Xo(i){var e=i.windingRule,t=e===void 0?Zt.ODD:e,r=i.elementType,n=r===void 0?Tr.POLYGONS:r,s=i.polySize,o=s===void 0?3:s,a=i.vertexSize,l=a===void 0?2:a,c=i.normal,h=c===void 0?[0,0,1]:c,u=i.contours,f=u===void 0?[]:u,d=i.strict,p=d===void 0?!0:d,m=i.debug,g=m===void 0?!1:m;if(!f&&p)throw new Error("Contours can't be empty");if(!!f){var v=new eF;i.edgeCreateCallback&&(v.edgeCreateCallback=i.edgeCreateCallback),i.vertexIdCallback&&(v.vertexIdCallback=i.vertexIdCallback);for(var y=0;y<f.length;y++)v.addContour(l||2,f[y]);return v.tesselate(t,n,o,l,h,p),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:g?v.mesh:void 0}}}var B7=Zt.ODD,N7=Zt.NONZERO,O7=Zt.POSITIVE,F7=Zt.NEGATIVE,U7=Zt.ABS_GEQ_TWO,z7=Tr.POLYGONS,G7=Tr.CONNECTED_POLYGONS,k7=Tr.BOUNDARY_CONTOURS;var Il=class extends Le{constructor(t,r=12,n={}){var p,m,g;super();this.type="ShapeGeometry";this.windingRule=Zt.ODD;this.elementType=Tr.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._shape=t,this._curveSegments=r,this._triangulationOptions=Object.assign({windingRule:Zt.ODD,elementType:Tr.POLYGONS,polySize:3,vertexSize:2,strict:!0},n);let s=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(v=>v.extractShapePointsToFlatArray([],this._curveSegments)),a,l=!0,c=!0,h,u;for(let v=0,y=s.length/2;v<y;v++){let w=v*2,b=s[w+0],S=s[w+1];if(h!==void 0&&b!==h&&(l=!1),u!==void 0&&S!==u&&(c=!1),h=b,u=S,!l&&!c)break}!l&&!c&&(a=Xo({contours:[s,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict}));let f=(p=a==null?void 0:a.vertexCount)!=null?p:1,d=(m=a==null?void 0:a.elementCount)!=null?m:1;if(this._positionAttribute=new Ve(new Float32Array(f*3),3),this._normalAttribute=new Ve(new Float32Array(f*3),3),this._uvAttribute=new Ve(new Float32Array(f*2),2),this._indexAttribute=new Ve(new Uint32Array(d*3),1),a){let v=1/0,y=-1/0,w=1/0,b=-1/0;for(let A=0,x=f;A<x;A++){let E=A*2,_=a.vertices[E+0],C=a.vertices[E+1];_<v&&(v=_),_>y&&(y=_),C<w&&(w=C),C>b&&(b=C)}let S=y-v,T=b-w;for(let A=0,x=f;A<x;A++){let E=A*2,_=a.vertices[E+0],C=a.vertices[E+1],I=(_-v)/S,N=(C-w)/T;this._positionAttribute.setXYZ(A,_,C,0),this._normalAttribute.setXYZ(A,0,0,1),this._uvAttribute.setXY(A,I,N)}for(let A=0,x=d;A<x;A++){let E=A*3,_=a.elements[E+0],C=a.elements[E+1],I=a.elements[E+2];this._indexAttribute.setX(E+0,_),this._indexAttribute.setX(E+1,C),this._indexAttribute.setX(E+2,I)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,((g=a==null?void 0:a.elementCount)!=null?g:1)*3)}clone(){let t=new Il(this._shape,this._curveSegments);return t.userData=Sh(this.userData),t}};var fp=class{constructor(e=256,t=!1){this.capacity=e,this.size=0,this.debug=t,this.debug&&console.log(`allocating with cap ${e}`);let r=e*fp.eSize;this.buffer=new ArrayBuffer(r);let n=Float32Array.BYTES_PER_ELEMENT,s=0;this.positions=new Float32Array(this.buffer,s*n,3*e),s+=3*e,this.normals=new Float32Array(this.buffer,s*n,3*e),s+=3*e,this.uvs=new Float32Array(this.buffer,s*n,2*e)}realloc(e,t=!1){if(e<this.size)throw Error("cannot shrink buffer");if(e<=this.capacity&&!t)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${e}`);let r=e*fp.eSize,n=new ArrayBuffer(r),s=Float32Array.BYTES_PER_ELEMENT,o=0,a=new Float32Array(n,o*s,3*e);o+=3*e;let l=new Float32Array(n,o*s,3*e);o+=3*e;let c=new Float32Array(n,o*s,2*e);a.set(this.positions.slice(0,this.size*3)),l.set(this.normals.slice(0,this.size*3)),c.set(this.uvs.slice(0,this.size*2)),this.buffer=n,this.positions=a,this.normals=l,this.uvs=c,this.capacity=e}get(e=1){let t=this.size+e;if(t>this.capacity){let n=this.capacity;for(;t>n;)n*=2;this.realloc(n)}let r=this.size;return this.size=t,r}reserve(e){let t=this.size+e;t>this.capacity&&this.realloc(t)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}},Wh=fp;Wh.eSize=(3+3+2)*Float32Array.BYTES_PER_ELEMENT;var av=(i,e)=>([t,r])=>(r<t&&(r+=e),(i>=t?i:i+e)<=r),Rl=class extends Le{constructor(t,r,n=0,s=12,o=3){super();this.type="ShapeGeometry";this.vertexCache={};this._shape=t,this._depth=r,this._bevel=n,this._curveSegments=s,this._bevelSegmentsInput=o,n<=0?(this._bevelSize=0,this._bevelSegments=0):(this._bevelSize=Math.min(n,r/2-1e-12),this._bevelSegments=Math.floor(o));let a=this._shape.extractShapePointsToFlatArray([],s),l=this._shape.shapeHoles.map(A=>{let x=A.extractShapePointsToFlatArray([],s),E=[];for(let _=x.length-1;_>=1;_-=2){let C=x[_-1],I=x[_-0];E.push(C,I)}return E}),c=Xo({windingRule:Zt.ODD,elementType:Tr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[a]}),h=Xo({windingRule:Zt.ODD,elementType:Tr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...l]});if(!c)throw new Error("error generating geometry");let u=c.elementCount;if(h){c.elementCount+=h.elementCount;for(let A=0;A<h.elements.length;A++){let x=h.elements[A],E=A%2===0?c.vertexCount:0;c.elements.push(x+E)}for(let A=0;A<h.vertexIndices.length;A++){let x=h.vertexIndices[A],E=c.vertexCount;c.vertexIndices.push(x+E)}for(let A=0;A<h.vertices.length;A++){let x=h.vertices[A];c.vertices.push(x)}}let f=1/0,d=-1/0,p=1/0,m=-1/0;for(let A=0,x=c.vertexCount;A<x;A++){let E=A*2,_=c.vertices[E+0],C=c.vertices[E+1];_<f&&(f=_),_>d&&(d=_),C<p&&(p=C),C>m&&(m=C)}this._minX=f,this._minY=p,this._width=d-f,this._height=m-p;let g=c.vertexCount*2*(2+this._bevelSegments);this._buffer=new Wh(g);let v=[],y=[];for(let A=c.elementCount-1;A>=0;A--){let x=A>=u,E=A*2,_=c.elements[E+0],C=c.elements[E+1],I=_+C,N={start:_,count:C,normals:[],continuous:[],concave:[]},R=_,k=I-1,G=_+1,te=this._shape.roundedCurves.length;do{let z=R-_,O=c.vertices[k*2+0],j=c.vertices[k*2+1],q=c.vertices[R*2+0],J=c.vertices[R*2+1],W=c.vertices[G*2+0],ge=c.vertices[G*2+1],oe=q-O,le=J-j,H=Math.sqrt(oe*oe+le*le);oe/=H,le/=H;let he=q-W,K=J-ge,V=Math.sqrt(he*he+K*K);he/=V,K/=V,N.normals[z*2+0]=-K,N.normals[z*2+1]=he,N.concave[z]=oe*K-le*he>0;let Z=c.vertexIndices[R];if(Array.isArray(Z))N.continuous[z]=!1;else{let[ce,se]=this._shape.getCurveIndexFromVertexId(Z-1,!0);if(se>0&&se<1)N.continuous[z]=!0;else{let pe=se===1?ce+1:ce-1;pe=(pe+te)%te;let ve=se===1?0:1,me=this._shape.roundedCurves[ce].getTangent(se),Pe=this._shape.roundedCurves[pe].getTangent(ve);N.continuous[z]=me.dot(Pe)>.95}}x&&(N.normals[z*2+0]*=-1,N.normals[z*2+1]*=-1),[k,R,G]=[R,G,G+1],G>=I&&(G-=C)}while(G!==_+1);let Q=[];Q.push({bevelI:0,angle:0,size:0,boundary:{vertices:c.vertices.slice(_*2,I*2),vertexCount:C,vertexIndices:new Array(C).fill(!0).map((z,O)=>[O,O]),elements:[0,C],elementCount:1,mesh:null},reverseMap:[],insetPoints:c.vertices.slice(_*2,I*2)});for(let z=1;z<=this._bevelSegments;z++){let O=z/this._bevelSegments*Math.PI/2,j=(1-Math.cos(O))*this._bevelSize,q=[],J=[],W=[],ge=[],oe=0;for(let H=0;H<C;H++){let he=H*2,K=(H-1+C)%C*2,V=c.vertices[N.start*2+he+0],Z=c.vertices[N.start*2+he+1],ce=-N.normals[K+0]*j,se=-N.normals[K+1]*j,pe=-N.normals[he+0]*j,ve=-N.normals[he+1]*j;if(N.concave[H]||!N.concave[H]&&x){let me=Math.atan2(se,ce),Pe=Math.atan2(ve,pe);Pe>me&&(Pe-=Math.PI*2);let ke=Pe-me;if(N.continuous[H]||x){let L=me+ke/2,D=Math.cos(L)*j,re=Math.sin(L)*j;q[2*oe+0]=V+D*(x?-1:1),q[2*oe+1]=Z+re*(x?-1:1),ge[oe]=H,oe++}else{let L=Math.max(1,Math.floor(s/4*Math.abs(ke)/Math.PI));for(let D=0;D<=L;D++){let re=me+ke*(D/L),ye=Math.cos(re)*j,Se=Math.sin(re)*j;q[2*oe+0]=V+ye,q[2*oe+1]=Z+Se,ge[oe]=H,oe++}}}else q[2*oe+0]=V+ce,q[2*oe+1]=Z+se,ge[oe]=H,J[H]=oe,oe++,q[2*oe+0]=V,q[2*oe+1]=Z,ge[oe]=H,oe++,q[2*oe+0]=V+pe,q[2*oe+1]=Z+ve,ge[oe]=H,W[H]=oe,oe++}let le=Xo({windingRule:Zt.POSITIVE,elementType:Tr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[q],edgeCreateCallback:H=>{let K=H.Org.idx,V=ge[K],Z=ge[(K+1)%ge.length];H.idx=[V,Z],H.Sym.idx=[Z,V]},vertexIdCallback:H=>{let he=H.Lprev.idx;return[he?he[1]:0,H.idx[0]]}});if(!le)throw console.log("Error"),new Error(`error generating bevel geometry for ${z}'th loop`);if(!le.vertexCount)break;for(let H=0;H<le.vertexIndices.length;H++){let[he,K]=le.vertexIndices[H];if(he===K)continue;let V=K;K<he&&(V+=C);for(let Z=he;Z<V;Z++){let ce=Z%C,se=(Z+1)%C;if(!N.continuous[ce]||!N.continuous[se]){le.vertexIndices[H]=[he,ce],le.vertexIndices.splice(H+1,0,[se,K]),le.vertices.splice((H+1)*2,0,le.vertices[H*2],le.vertices[H*2+1]);break}}}Q.push({bevelI:z,angle:O,size:j,boundary:le,reverseMap:ge,insetPoints:q})}let Y=(z,O,j)=>{let q=0,J=z.boundary.vertexIndices.length;for(;q<J&&j(z.boundary.vertexIndices[O]);)O=(O+1)%J,q++;return q},F=v.length;for(let z=1;z<Q.length;z++){let O=Q[z-1],j=Q[z],q=O.boundary.vertexIndices.length,J=j.boundary.vertexIndices.length;if(!q||!J)break;let W=N.concave.length,ge=0,oe=av(ge,C);for(;!O.boundary.vertexIndices.filter(oe).length||!j.boundary.vertexIndices.filter(oe).length;)ge++,oe=av(ge,C);let le=O.boundary.vertexIndices.findIndex(oe),H=j.boundary.vertexIndices.findIndex(oe);do le=(le+1)%q;while(oe(O.boundary.vertexIndices[le]));do H=(H+1)%J;while(oe(j.boundary.vertexIndices[H]));ge=(ge+1)%C;let he=ge,K=this.buildBevelVert(N,O,(le-1+q)%q),V=this.buildBevelVert(N,j,(H-1+J)%J),Z=K,ce=V,se,pe,ve=!1;do{oe=av(ge,C);let me=Y(O,le,oe),Pe=Y(j,H,oe),ke=ve;if(ve=!1,me&&!Pe){for(let L=0;L<me;L++)se=this.buildBevelVert(N,O,(le+L)%q,L/(me-1)),v.push(Z.topN,se.topP,ce.topN),v.push(se.bottomP,Z.bottomN,ce.bottomN),Z=se;ve=!0}else if(!me&&Pe)for(let L=0;L<Pe;L++)pe=this.buildBevelVert(N,j,(H+L)%J,L/(Pe-1)),v.push(ce.topN,Z.topP,pe.topP),v.push(Z.bottomP,ce.bottomN,pe.bottomP),ce=pe;else if(me&&Pe)if(se=this.buildBevelVert(N,O,le,0),pe=this.buildBevelVert(N,j,H,0),ke?(v.push(Z.topN,pe.topP,ce.topN),v.push(Z.topN,se.topP,pe.topP),v.push(pe.bottomP,Z.bottomN,ce.bottomN),v.push(pe.bottomP,se.bottomP,Z.bottomN)):(v.push(ce.topN,Z.topN,se.topP),v.push(ce.topN,se.topP,pe.topP),v.push(se.bottomP,Z.bottomN,ce.bottomN),v.push(se.bottomP,ce.bottomN,pe.bottomP)),Z=se,ce=pe,me===Pe)for(let L=1;L<me;L++)se=this.buildBevelVert(N,O,(le+L)%q,L/(me-1)),pe=this.buildBevelVert(N,j,(H+L)%J,L/(Pe-1)),v.push(Z.topN,se.topP,ce.topN),v.push(ce.topN,se.topP,pe.topP),v.push(se.bottomP,Z.bottomN,ce.bottomN),v.push(se.bottomP,ce.bottomN,pe.bottomP),Z=se,ce=pe;else if(me>Pe){let L=me/Pe,D=0;for(let re=1;re<me;re++)se=this.buildBevelVert(N,O,(le+re)%q,re/(me-1)),v.push(Z.topN,se.topP,ce.topN),v.push(se.bottomP,Z.bottomN,ce.bottomN),Z=se,re>(D+1)*L&&(D++,pe=this.buildBevelVert(N,j,(H+D)%J,D/(Pe-1)),v.push(ce.topN,se.topP,pe.topP),v.push(se.bottomP,ce.bottomN,pe.bottomP),ce=pe)}else{let L=Pe/me,D=0;for(let re=1;re<Pe;re++)pe=this.buildBevelVert(N,j,(H+re)%J,re/(Pe-1)),v.push(ce.topN,se.topP,pe.topP),v.push(se.bottomP,ce.bottomN,pe.bottomP),ce=pe,re>(D+1)*L&&(D++,se=this.buildBevelVert(N,O,(le+D)%q,D/(me-1)),v.push(Z.topN,se.topP,ce.topN),v.push(se.bottomP,Z.bottomN,ce.bottomN),Z=se)}le=(le+me)%q,H=(H+Pe)%J,ge=(ge+1)%W}while(ge!==he)}{let z=Q[0];for(let O=0,j=z.boundary.vertexCount;O<j;O++){let q=this.buildBevelVert(N,z,O),J=this.buildBevelVert(N,z,(O+1)%j);v.push(J.topP,q.topN,q.bottomN),v.push(J.topP,q.bottomN,J.bottomP)}}if(x){let z=[];for(let O=v.length-1;O>=F+2;O-=3){let j=v[O-2],q=v[O-1],J=v[O-0];z.push(J,q,j)}v.splice(F,v.length-F,...z)}if(x){let z=[];for(let O=Q[Q.length-1].boundary.vertices.length-1;O>=1;O-=2){let j=Q[Q.length-1].boundary.vertices[O-1],q=Q[Q.length-1].boundary.vertices[O-0];z.push(j,q)}y.push(z)}if(!x){let z=Q[Q.length-1],O=Xo({windingRule:Q.length>1?Zt.POSITIVE:Zt.ODD,elementType:Tr.POLYGONS,vertexSize:2,strict:!0,contours:[z.insetPoints,...y]});if(!O)throw new Error("Error generating geometry for surface");Object.assign(this,{capStartIndex:v.length});for(let j=0;j<O.elementCount*3;j+=3){let q=this.buildSurfaceVert(O,O.elements[j+0]),J=this.buildSurfaceVert(O,O.elements[j+1]),W=this.buildSurfaceVert(O,O.elements[j+2]);v.push(q.top,J.top,W.top),v.push(W.bottom,J.bottom,q.bottom)}}this.vertexCache={}}this._buffer.shrink();let w=new Ve(Uint32Array.from(v),1),b=new Ve(this._buffer.positions,3),S=new Ve(this._buffer.normals,3),T=new Ve(this._buffer.uvs,2);b.needsUpdate=!0,S.needsUpdate=!0,T.needsUpdate=!0,w.needsUpdate=!0,this.setAttribute("position",b),this.setAttribute("normal",S),this.setAttribute("uv",T),this.setIndex(w)}buildSurfaceVert(t,r){let n=r.toString();if(n in this.vertexCache)return this.vertexCache[n];let s=t.vertices[r*2+0],o=t.vertices[r*2+1],a=(s-this._minX)/this._width,l=(o-this._minY)/this._height,c=this._buffer.get(2),h=c*3,u=c*2,f={top:c+0,bottom:c+1};return this._buffer.positions[h+0]=s,this._buffer.positions[h+1]=o,this._buffer.positions[h+2]=this._depth,this._buffer.normals[h+0]=0,this._buffer.normals[h+1]=0,this._buffer.normals[h+2]=1,this._buffer.uvs[u+0]=a,this._buffer.uvs[u+1]=l,this._buffer.positions[h+3]=s,this._buffer.positions[h+4]=o,this._buffer.positions[h+5]=0,this._buffer.normals[h+3]=0,this._buffer.normals[h+4]=0,this._buffer.normals[h+5]=-1,this._buffer.uvs[u+2]=a,this._buffer.uvs[u+3]=l,this.vertexCache[n]=f,f}buildBevelVert(t,r,n,s=1){let o=`${r.bevelI}:${n}`;if(o in this.vertexCache)return this.vertexCache[o];let[a,l]=r.boundary.vertexIndices[n],c,h,u,f;a!==l?(h=a,c=l,f=!1,u=t.continuous[h]&&t.continuous[c]):(c=a,h=(c-1+t.count)%t.count,f=t.concave[c]&&r.bevelI>0,u=t.continuous[c]||f);let d=Math.cos(r.angle),p=Math.sin(r.angle),m=n*2,g=c*2,v=h*2,y=r.boundary.vertices[m+0],w=r.boundary.vertices[m+1],b=(1-p)*this._bevelSize,S=(y-this._minX)/this._width,T=(w-this._minY)/this._height,A=t.normals[g+0],x=t.normals[g+1],E=t.normals[v+0],_=t.normals[v+1];if(f){let k=E-A,G=_-x;A=A+k*(1-s),x=x+G*(1-s);let te=Math.sqrt(A*A+x*x);A/=te,x/=te}let C=this._buffer.get(u?2:4),I=C*3,N=C*2,R={i:n,fi:c,topP:C+0,topN:C+0,bottomP:C+1,bottomN:C+1};return this._buffer.positions[I+0]=y,this._buffer.positions[I+1]=w,this._buffer.positions[I+2]=this._depth-b,this._buffer.normals[I+0]=A*d,this._buffer.normals[I+1]=x*d,this._buffer.normals[I+2]=p,this._buffer.uvs[N+0]=S,this._buffer.uvs[N+1]=T,this._buffer.positions[I+3]=y,this._buffer.positions[I+4]=w,this._buffer.positions[I+5]=b,this._buffer.normals[I+3]=A*d,this._buffer.normals[I+4]=x*d,this._buffer.normals[I+5]=-p,this._buffer.uvs[N+2]=T,this._buffer.uvs[N+3]=S,u||(C+=2,I+=6,N+=4,R.topP=C+0,R.bottomP=C+1,this._buffer.positions[I+0]=y,this._buffer.positions[I+1]=w,this._buffer.positions[I+2]=this._depth-b,this._buffer.normals[I+0]=E*d,this._buffer.normals[I+1]=_*d,this._buffer.normals[I+2]=p,this._buffer.uvs[N+0]=S,this._buffer.uvs[N+1]=T,this._buffer.positions[I+3]=y,this._buffer.positions[I+4]=w,this._buffer.positions[I+5]=b,this._buffer.normals[I+3]=E*d,this._buffer.normals[I+4]=_*d,this._buffer.normals[I+5]=-p,this._buffer.uvs[N+2]=T,this._buffer.uvs[N+3]=S),this.vertexCache[o]=R,R}clone(){let t=new Rl(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return t.userData=Sh(this.userData),t}};var Hr=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var c,h,u,f,d,p,m;let t=Object.assign({},(c=e==null?void 0:e.parameters)!=null?c:{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),r=Math.abs(t.width),n=Math.abs((h=t.height)!=null?h:t.width),s=Math.abs((u=t.depth)!=null?u:0),o=(f=i.shape)!=null?f:e==null?void 0:e.shape,a=(d=o==null?void 0:o.roundness)!=null?d:t.roundness;o!==void 0&&(o instanceof Tt?(o.width!==r||o.height!==n)&&o.applySize(r,n):o=new Tt(r,n).fromJSON(o),((p=i.parameters)==null?void 0:p.roundness)!==void 0&&((m=i.parameters)==null?void 0:m.roundness)>0&&o.update(!1));let l=o!=null?o:new Tt(r,n);return{parameters:Object.assign(t,{width:r,height:n,depth:s,roundness:a}),shape:l}}static build(i){let{depth:e,extrudeBevelSize:t,extrudeBevelSegments:r,subdivisions:n,roundness:s}=i.parameters;i.shape.roundness=s;let o;return e<=0?o=new Il(i.shape,n):o=new Rl(i.shape,e,t,n,r),Object.assign(o,{userData:xe(ie({},i),{type:"VectorGeometry"})})}};var l1=Math.PI*2,c1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof Tt?i.shape:new Tt,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs((o=t.depth)!=null?o:0)})}}static build(i){let{width:e,height:t,spikes:r,angle:n,innerRadius:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}=i.parameters,c=i.shape,h=e*.5,u=t*.5,f=tF(c,h,u,n*Math.PI/180,r,s);c.isClosed=!0,c.update();let d=Hr.create({shape:c,parameters:{subdivisions:f,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(d,{userData:xe(ie({},i),{type:"EllipseGeometry"})})}};function tF(i,e,t,r,n,s){if(r>=l1)return n>30||n%4===0?(nF(i,e,t,s),Math.round(n/4)):a1(i,r,n,e,t,s);let o={x:0,y:t},a=r+Math.PI*.5,l={x:Math.cos(a)*e,y:Math.sin(a)*t},c=r1({px:o.x,py:o.y,cx:l.x,cy:l.y,rx:e,ry:t,largeArcFlag:r>Math.PI,sweepFlag:!0});return n>30||n%c.length===0?rF(i,o.x,o.y,c,n,e,t,s):a1(i,r,n,e,t,s)}function rF(i,e,t,r,n,s,o,a){let l=Math.round(n/r.length);i.addPoint(Bl(e,t));for(let c=0,h=r.length;c<h;c++){let u=r[c],f=i.points[c],d=Bl(u.x,u.y);f.controls[1].position.set(u.x1,u.y1),d.controls[0].position.set(u.x2,u.y2),i.addPoint(d)}return a>0?h1(i,s,o,a):i.addPoint(Bl(0,0)),l}function a1(i,e,t,r,n,s){let o=-e/t;for(let a=0;a<=t;a++){let l=o*a,c=Math.sin(l)*r,h=Math.cos(l)*n;i.addPoint(Bl(c,h))}return e<l1?s>0?h1(i,r,n,s):i.addPoint(Bl(0,0)):(i.removePoint(i.points[i.points.length-1]),s>0&&u1(i,r,n,s)),1}function nF(i,e,t,r=0,n=0,s=0){let o=.5522847498,a=e*o,l=t*o;i.addPoint(dp(n-e,s,n-e,s-l,n-e,s+l)),i.addPoint(dp(n,s+t,n-a,s+t,n+a,s+t)),i.addPoint(dp(n+e,s,n+e,s+l,n+e,s-l)),i.addPoint(dp(n,s-t,n+a,s-t,n-a,s-t)),r>0&&u1(i,e,t,r)}function Bl(i,e){return new ui(et.generateUUID(),new B(i,e))}function dp(i,e,t,r,n,s){let o=Bl(i,e);return o.controls[0].position.set(t,r),o.controls[1].position.set(n,s),o}function h1(i,e,t,r){f1(i,e,t,r).forEach(s=>i.addPoint(s))}function u1(i,e,t,r){let n=f1(i,e,t,r),s=new Tt;n.forEach(o=>s.addPoint(o)),s.isClosed=!0,i.shapeHoles.push(s)}function f1(i,e,t,r){let n=r*e/100,s=n*(Math.abs(t)/Math.abs(e)),o=new B(n/e,s/t),a=i.points.map(l=>{let c=l.clone();return c.uuid=et.generateUUID(),c}).reverse();return a.forEach(l=>{l.position.multiply(o);let c=l.controls[0].position.clone().multiply(o),h=l.controls[1].position.clone().multiply(o);l.controls[0].position.copy(h),l.controls[1].position.copy(c)}),a}var d1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var a,l,c;let t=Object.assign({},(a=e==null?void 0:e.parameters)!=null?a:{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},i.parameters),r=Math.abs(t.width),n=Math.abs((l=t.height)!=null?l:r),s=Math.abs((c=t.depth)!=null?c:r),o=Math.abs(Math.min(r,s))/2;return{parameters:Object.assign(t,{width:r,height:n,depth:s,radius:o,segments:Math.round(t.segments),pathSegments:Math.round(t.pathSegments),cornerSegments:Math.round(t.cornerSegments)})}}static build(i){let{width:e,height:t,depth:r,radius:n,revolutions:s,segments:o,pathRadius:a,pathType:l,pathSegments:c,cornerRadius:h,cornerSegments:u}=i.parameters,f=new jh(!1,e,t,r,n,s,o,a,l,c,h,u);return Object.assign(f,{userData:xe(ie({},i),{type:"HelixGeometry"})})}},jh=class extends Le{constructor(e=!0,t=1,r=1,n=1,s=1,o=1,a=1,l=1,c=1,h=1,u=1,f=1){super();let d=e&&o===1;d&&(f=0),u>100&&(u=100);let p=()=>new M,m=new M,g=p(),v=p(),y=p(),w,b,S,T,A,x,E,_,C=p(),I=p(),N=p(),R=p(),k=p(),G=p(),te=p(),Q=p(),Y=r-2*l+.001,F=Y/o,z=Math.ceil(a*o),O=z+1,j=Y/z,q=-Y/2,J=h+1,W=2*Math.PI/h,ge=Math.PI/2/f,oe=.01,le=Math.min((1-u/100)*l,l-oe),H=l-le,he=0,K=2,V=f*K+K,Z=J*V/K,ce=Z+J*O,se=J*(O+V),[pe,ve,me]=[3,3,2].map(Ee=>Array(se*Ee).fill(0)),Pe=[],ke=s-l;function L(Ee,U){let Me=Math.PI/2;x=U*j,_=2*Math.PI*(x%F)/F+Me,x+=q,E=Math.sin(_)*ke,A=Math.cos(_)*ke,e?Ee.set(A,E,x):Ee.set(A,x,E)}L(m,-1e-10),L(g,0),C.copy(m),L(m,1);let D=m.distanceTo(g),re=H+le,ye=D*z+2*re,Se=le,Ie=ye-re;for(let Ee=0;Ee<=z;Ee++){L(v,Ee),Q.subVectors(v,C).normalize(),C.copy(v),G.copy(v).setComponent(+e+1,0).normalize(),te.crossVectors(Q,G).normalize();let U=Ee===0,Me=Ee===z,De=U?3*Math.PI/2:ge,Ze=U?Se:Ie,Oe=U?J:ce,Qe=U?0:se-J,Te=Q.clone().multiplyScalar(U?-H:H).add(v),$e=Q.clone().multiplyScalar(U?-1:1).normalize();for(let lt=0;lt<J;lt++){let dt=lt*W;if(I.addVectors(m.copy(G).multiplyScalar(l*Math.cos(dt)),g.copy(te).multiplyScalar(l*Math.sin(dt))),N.copy(I).normalize(),U||Me){d||(he=Qe+lt,[0,1,2].forEach(Ut=>{pe[he*3+Ut]=Te.getComponent(Ut),ve[he*3+Ut]=$e.getComponent(Ut)}),me[he*2]=+Me,me[he*2+1]=lt/h),g.copy(N).multiplyScalar(le),y.addVectors(v,g);for(let Ut=0;Ut<f;Ut++){let Ur=Ut*ge+De;R.addVectors(m.copy(Q).multiplyScalar(H*Math.sin(Ur)),g.copy(N).multiplyScalar(H*Math.cos(Ur))),k.copy(R).normalize(),g.addVectors(y,R),R.normalize(),he=Oe+Ut*J+lt,[0,1,2].forEach(Nn=>{pe[he*3+Nn]=g.getComponent(Nn),ve[he*3+Nn]=k.getComponent(Nn)});let ia=+U+Math.sin(Ur);me[he*2]=(Ze+H*ia)/ye,me[he*2+1]=lt/h}}g.addVectors(v,I),he=Z+Ee*J+lt,[0,1,2].forEach(Ut=>{pe[he*3+Ut]=g.getComponent(Ut),ve[he*3+Ut]=N.getComponent(Ut)}),me[he*2]=(re+Ee*D)/ye,me[he*2+1]=lt/h}}let Fe=O+2*f+K,ue=1,[rt,st]=d?[ue,ue+O-1]:[0,Fe-1];for(let Ee=rt;Ee<=st-1;Ee++){let U=d&&Ee===st-1;for(let Me=0;Me<J-1;Me++)w=Ee*J+Me,b=w+1,S=(U?Me:w)+J,T=(U?Me+1:b)+J,Ee===0?Pe.push(b,T,S):Ee===Fe-2?Pe.push(w,b,S):Pe.push(w,b,S,b,T,S)}this.setIndex(Pe),this.setAttribute("position",new Ce(pe,3)),this.setAttribute("normal",new Ce(ve,3)),this.setAttribute("uv",new Ce(me,2))}};var p1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:o}=i.parameters,a=n===0&&s!==0?new qh(e*.5,s,o):new Va(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:xe(ie({},i),{type:"IcosahedronGeometry"})})}},qh=class extends oo{constructor(e=1,t=.2,r=4){let n=(1+Math.sqrt(5))/2,s=[-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],o=[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],a="IcosahedronGeometry";super(s,o,a,e,t,r),this.type=a}static fromJSON(e){return new qh(e.radius,e.corner,e.cornerSides)}};var m1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s,o,a;((n=(r=i.parameters)==null?void 0:r.points)!=null?n:[]).forEach(l=>{Array.isArray(l)&&(l.x=l[0],l.y=l[1])});let t=Object.assign({},(s=e==null?void 0:e.parameters)!=null?s:{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs((a=t.depth)!=null?a:t.width)})}}static build(i){let{points:e,segments:t,verticalSegments:r}=i.parameters,n=new rn;n.moveTo(e[0].x,e[0].y),n.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let s=new Ua(n.extractPoints(r).shape,t);return s.rotateZ(Math.PI),Object.assign(s,{userData:xe(ie({},i),{type:"LatheGeometry"})})}};var Oi=new Ae,lv=new ot,pp=new M,lo=class extends Yt{constructor(){super(),this.uuid=et.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}applyMatrix4(e){let t=new Ft().getNormalMatrix(e);for(let r=0,n=this.vertices.length;r<n;r++)this.vertices[r].applyMatrix4(e);for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r];s.normal.applyMatrix3(t).normalize();for(let o=0,a=s.vertexNormals.length;o<a;o++)s.vertexNormals[o].applyMatrix3(t).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this}rotateX(e){return Oi.makeRotationX(e),this.applyMatrix4(Oi),this}rotateY(e){return Oi.makeRotationY(e),this.applyMatrix4(Oi),this}rotateZ(e){return Oi.makeRotationZ(e),this.applyMatrix4(Oi),this}translate(e,t,r){return Oi.makeTranslation(e,t,r),this.applyMatrix4(Oi),this}scale(e,t,r){return Oi.makeScale(e,t,r),this.applyMatrix4(Oi),this}lookAt(e){return lv.lookAt(e),lv.updateMatrix(),this.applyMatrix4(lv.matrix),this}fromBufferGeometry(e){let t=this,r=e.index!==null?e.index:void 0,n=e.attributes;if(n.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;let s=n.position,o=n.normal,a=n.color,l=n.uv,c=n.uv2;c!==void 0&&(this.faceVertexUvs[1]=[]);for(let f=0;f<s.count;f++)t.vertices.push(new M().fromBufferAttribute(s,f)),a!==void 0&&t.colors.push(new be().fromBufferAttribute(a,f));function h(f,d,p,m){let g=a===void 0?[]:[t.colors[f].clone(),t.colors[d].clone(),t.colors[p].clone()],v=o===void 0?[]:[new M().fromBufferAttribute(o,f),new M().fromBufferAttribute(o,d),new M().fromBufferAttribute(o,p)],y=new Nl(f,d,p,v,g,m);t.faces.push(y),l!==void 0&&t.faceVertexUvs[0].push([new B().fromBufferAttribute(l,f),new B().fromBufferAttribute(l,d),new B().fromBufferAttribute(l,p)]),c!==void 0&&t.faceVertexUvs[1].push([new B().fromBufferAttribute(c,f),new B().fromBufferAttribute(c,d),new B().fromBufferAttribute(c,p)])}let u=e.groups;if(u.length>0)for(let f=0;f<u.length;f++){let d=u[f],p=d.start,m=d.count;for(let g=p,v=p+m;g<v;g+=3)r!==void 0?h(r.getX(g),r.getX(g+1),r.getX(g+2),d.materialIndex):h(g,g+1,g+2,d.materialIndex)}else if(r!==void 0)for(let f=0;f<r.count;f+=3)h(r.getX(f),r.getX(f+1),r.getX(f+2));else for(let f=0;f<s.count;f+=3)h(f,f+1,f+2);return this.computeFaceNormals(),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(pp).negate(),this.translate(pp.x,pp.y,pp.z),this}normalize(){this.computeBoundingSphere();let e=this.boundingSphere.center,t=this.boundingSphere.radius,r=t===0?1:1/t,n=new Ae;return n.set(r,0,0,-r*e.x,0,r,0,-r*e.y,0,0,r,-r*e.z,0,0,0,1),this.applyMatrix4(n),this}computeFaceNormals(){let e=new M,t=new M;for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],o=this.vertices[s.a],a=this.vertices[s.b],l=this.vertices[s.c];e.subVectors(l,a),t.subVectors(o,a),e.cross(t),e.normalize(),s.normal.copy(e)}}computeVertexNormals(e=!0){let t=new Array(this.vertices.length);for(let r=0,n=this.vertices.length;r<n;r++)t[r]=new M;if(e){let r=new M,n=new M;for(let s=0,o=this.faces.length;s<o;s++){let a=this.faces[s],l=this.vertices[a.a],c=this.vertices[a.b],h=this.vertices[a.c];r.subVectors(h,c),n.subVectors(l,c),r.cross(n),t[a.a].add(r),t[a.b].add(r),t[a.c].add(r)}}else{this.computeFaceNormals();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r];t[s.a].add(s.normal),t[s.b].add(s.normal),t[s.c].add(s.normal)}}for(let r=0,n=this.vertices.length;r<n;r++)t[r].normalize();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],o=s.vertexNormals;o.length===3?(o[0].copy(t[s.a]),o[1].copy(t[s.b]),o[2].copy(t[s.c])):(o[0]=t[s.a].clone(),o[1]=t[s.b].clone(),o[2]=t[s.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let r=this.faces[e],n=r.vertexNormals;n.length===3?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let t=0,r=this.faces.length;t<r;t++){let n=this.faces[t];n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]);for(let s=0,o=n.vertexNormals.length;s<o;s++)n.__originalVertexNormals[s]?n.__originalVertexNormals[s].copy(n.vertexNormals[s]):n.__originalVertexNormals[s]=n.vertexNormals[s].clone()}let e=new lo;e.faces=this.faces;for(let t=0,r=this.morphTargets.length;t<r;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];let s=this.morphNormals[t].faceNormals,o=this.morphNormals[t].vertexNormals;for(let a=0,l=this.faces.length;a<l;a++){let c=new M,h={a:new M,b:new M,c:new M};s.push(c),o.push(h)}}let n=this.morphNormals[t];e.vertices=this.morphTargets[t].vertices,e.computeFaceNormals(),e.computeVertexNormals();for(let s=0,o=this.faces.length;s<o;s++){let a=this.faces[s],l=n.faceNormals[s],c=n.vertexNormals[s];l.copy(a.normal),c.a.copy(a.vertexNormals[0]),c.b.copy(a.vertexNormals[1]),c.c.copy(a.vertexNormals[2])}}for(let t=0,r=this.faces.length;t<r;t++){let n=this.faces[t];n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals}}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Kt),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Lr),this.boundingSphere.setFromPoints(this.vertices)}merge(e,t,r=0){if(!(e&&e.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);return}let n,s=this.vertices.length,o=this.vertices,a=e.vertices,l=this.faces,c=e.faces,h=this.colors,u=e.colors;t!==void 0&&(n=new Ft().getNormalMatrix(t));for(let f=0,d=a.length;f<d;f++){let m=a[f].clone();t!==void 0&&m.applyMatrix4(t),o.push(m)}for(let f=0,d=u.length;f<d;f++)h.push(u[f].clone());for(let f=0,d=c.length;f<d;f++){let p=c[f],m,g,v=p.vertexNormals,y=p.vertexColors,w=new Nl(p.a+s,p.b+s,p.c+s);w.normal.copy(p.normal),n!==void 0&&w.normal.applyMatrix3(n).normalize();for(let b=0,S=v.length;b<S;b++)m=v[b].clone(),n!==void 0&&m.applyMatrix3(n).normalize(),w.vertexNormals.push(m);w.color.copy(p.color);for(let b=0,S=y.length;b<S;b++)g=y[b],w.vertexColors.push(g.clone());w.materialIndex=p.materialIndex+r,l.push(w)}for(let f=0,d=e.faceVertexUvs.length;f<d;f++){let p=e.faceVertexUvs[f];this.faceVertexUvs[f]===void 0&&(this.faceVertexUvs[f]=[]);for(let m=0,g=p.length;m<g;m++){let v=p[m],y=[];for(let w=0,b=v.length;w<b;w++)y.push(v[w].clone());this.faceVertexUvs[f].push(y)}}}mergeMesh(e){if(!(e&&e.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)}mergeVertices(e=4){let t={},r=[],n=[],s=Math.pow(10,e);for(let l=0,c=this.vertices.length;l<c;l++){let h=this.vertices[l],u=Math.round(h.x*s)+"_"+Math.round(h.y*s)+"_"+Math.round(h.z*s);t[u]===void 0?(t[u]=l,r.push(this.vertices[l]),n[l]=r.length-1):n[l]=n[t[u]]}let o=[];for(let l=0,c=this.faces.length;l<c;l++){let h=this.faces[l];h.a=n[h.a],h.b=n[h.b],h.c=n[h.c];let u=[h.a,h.b,h.c];for(let f=0;f<3;f++)if(u[f]===u[(f+1)%3]){o.push(l);break}}for(let l=o.length-1;l>=0;l--){let c=o[l];this.faces.splice(c,1);for(let h=0,u=this.faceVertexUvs.length;h<u;h++)this.faceVertexUvs[h].splice(c,1)}let a=this.vertices.length-r.length;return this.vertices=r,a}setFromPoints(e){this.vertices=[];for(let t=0,r=e.length;t<r;t++){let n=e[t];this.vertices.push(new M(n.x,n.y,n.z||0))}return this}sortFacesByMaterialIndex(){let e=this.faces,t=e.length;for(let l=0;l<t;l++)e[l]._id=l;function r(l,c){return l.materialIndex-c.materialIndex}e.sort(r);let n=this.faceVertexUvs[0],s=this.faceVertexUvs[1],o,a;n&&n.length===t&&(o=[]),s&&s.length===t&&(a=[]);for(let l=0;l<t;l++){let c=e[l]._id;o&&o.push(n[c]),a&&a.push(s[c])}o&&(this.faceVertexUvs[0]=o),a&&(this.faceVertexUvs[1]=a)}toJSON(){let e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),this.parameters!==void 0){let p=this.parameters;for(let m in p)p[m]!==void 0&&(e[m]=p[m]);return e}let t=[];for(let p=0;p<this.vertices.length;p++){let m=this.vertices[p];t.push(m.x,m.y,m.z)}let r=[],n=[],s={},o=[],a={},l=[],c={};for(let p=0;p<this.faces.length;p++){let m=this.faces[p],g=!0,v=!1,y=this.faceVertexUvs[0][p]!==void 0,w=m.normal.length()>0,b=m.vertexNormals.length>0,S=m.color.r!==1||m.color.g!==1||m.color.b!==1,T=m.vertexColors.length>0,A=0;if(A=h(A,0,0),A=h(A,1,g),A=h(A,2,v),A=h(A,3,y),A=h(A,4,w),A=h(A,5,b),A=h(A,6,S),A=h(A,7,T),r.push(A),r.push(m.a,m.b,m.c),r.push(m.materialIndex),y){let x=this.faceVertexUvs[0][p];r.push(d(x[0]),d(x[1]),d(x[2]))}if(w&&r.push(u(m.normal)),b){let x=m.vertexNormals;r.push(u(x[0]),u(x[1]),u(x[2]))}if(S&&r.push(f(m.color)),T){let x=m.vertexColors;r.push(f(x[0]),f(x[1]),f(x[2]))}}function h(p,m,g){return g?p|1<<m:p&~(1<<m)}function u(p){let m=p.x.toString()+p.y.toString()+p.z.toString();return s[m]!==void 0||(s[m]=n.length/3,n.push(p.x,p.y,p.z)),s[m]}function f(p){let m=p.r.toString()+p.g.toString()+p.b.toString();return a[m]!==void 0||(a[m]=o.length,o.push(p.getHex())),a[m]}function d(p){let m=p.x.toString()+p.y.toString();return c[m]!==void 0||(c[m]=l.length/2,l.push(p.x,p.y)),c[m]}return e.data={},e.data.vertices=t,e.data.normals=n,o.length>0&&(e.data.colors=o),l.length>0&&(e.data.uvs=[l]),e.data.faces=r,e}clone(){return new lo().copy(this)}copy(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;let t=e.vertices;for(let f=0,d=t.length;f<d;f++)this.vertices.push(t[f].clone());let r=e.colors;for(let f=0,d=r.length;f<d;f++)this.colors.push(r[f].clone());let n=e.faces;for(let f=0,d=n.length;f<d;f++)this.faces.push(n[f].clone());for(let f=0,d=e.faceVertexUvs.length;f<d;f++){let p=e.faceVertexUvs[f];this.faceVertexUvs[f]===void 0&&(this.faceVertexUvs[f]=[]);for(let m=0,g=p.length;m<g;m++){let v=p[m],y=[];for(let w=0,b=v.length;w<b;w++){let S=v[w];y.push(S.clone())}this.faceVertexUvs[f].push(y)}}let s=e.morphTargets;for(let f=0,d=s.length;f<d;f++){let p={};if(p.name=s[f].name,s[f].vertices!==void 0){p.vertices=[];for(let m=0,g=s[f].vertices.length;m<g;m++)p.vertices.push(s[f].vertices[m].clone())}if(s[f].normals!==void 0){p.normals=[];for(let m=0,g=s[f].normals.length;m<g;m++)p.normals.push(s[f].normals[m].clone())}this.morphTargets.push(p)}let o=e.morphNormals;for(let f=0,d=o.length;f<d;f++){let p={};if(o[f].vertexNormals!==void 0){p.vertexNormals=[];for(let m=0,g=o[f].vertexNormals.length;m<g;m++){let v=o[f].vertexNormals[m],y={};y.a=v.a.clone(),y.b=v.b.clone(),y.c=v.c.clone(),p.vertexNormals.push(y)}}if(o[f].faceNormals!==void 0){p.faceNormals=[];for(let m=0,g=o[f].faceNormals.length;m<g;m++)p.faceNormals.push(o[f].faceNormals[m].clone())}this.morphNormals.push(p)}let a=e.skinWeights;for(let f=0,d=a.length;f<d;f++)this.skinWeights.push(a[f].clone());let l=e.skinIndices;for(let f=0,d=l.length;f<d;f++)this.skinIndices.push(l[f].clone());let c=e.lineDistances;for(let f=0,d=c.length;f<d;f++)this.lineDistances.push(c[f]);let h=e.boundingBox;h!==null&&(this.boundingBox=h.clone());let u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this}toBufferGeometry(){let e=new cv().fromGeometry(this),t=new Le,r=new Float32Array(e.vertices.length*3);if(t.setAttribute("position",new Ve(r,3).copyVector3sArray(e.vertices)),e.normals.length>0){let n=new Float32Array(e.normals.length*3);t.setAttribute("normal",new Ve(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){let n=new Float32Array(e.colors.length*3);t.setAttribute("color",new Ve(n,3).copyColorsArray(e.colors))}if(e.uvs.length>0){let n=new Float32Array(e.uvs.length*2);t.setAttribute("uv",new Ve(n,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){let n=new Float32Array(e.uvs2.length*2);t.setAttribute("uv2",new Ve(n,2).copyVector2sArray(e.uvs2))}t.groups=e.groups;for(let n in e.morphTargets){let s=[],o=e.morphTargets[n];for(let a=0,l=o.length;a<l;a++){let c=o[a],h=new Ce(c.data.length*3,3);h.name=c.name,s.push(h.copyVector3sArray(c.data))}t.morphAttributes[n]=s}if(e.skinIndices.length>0){let n=new Ce(e.skinIndices.length*4,4);t.setAttribute("skinIndex",n.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){let n=new Ce(e.skinWeights.length*4,4);t.setAttribute("skinWeight",n.copyVector4sArray(e.skinWeights))}return e.boundingSphere!==null&&(t.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(t.boundingBox=e.boundingBox.clone()),t}computeTangents(){console.error("THREE.Geometry: .computeTangents() has been removed.")}computeLineDistances(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}applyMatrix(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}dispose(){this.dispatchEvent({type:"dispose"})}static createBufferGeometryFromObject(e){let t=new Le,r=e.geometry;if(e.isPoints||e.isLine){let n=new Ce(r.vertices.length*3,3),s=new Ce(r.colors.length*3,3);if(t.setAttribute("position",n.copyVector3sArray(r.vertices)),t.setAttribute("color",s.copyColorsArray(r.colors)),r.lineDistances&&r.lineDistances.length===r.vertices.length){let o=new Ce(r.lineDistances.length,1);t.setAttribute("lineDistance",o.copyArray(r.lineDistances))}r.boundingSphere!==null&&(t.boundingSphere=r.boundingSphere.clone()),r.boundingBox!==null&&(t.boundingBox=r.boundingBox.clone())}else e.isMesh&&(t=r.toBufferGeometry());return t}};lo.prototype.isGeometry=!0;var cv=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){let t=[],r,n,s,o=e.faces;for(n=0;n<o.length;n++){let a=o[n];a.materialIndex!==s&&(s=a.materialIndex,r!==void 0&&(r.count=n*3-r.start,t.push(r)),r={start:n*3,materialIndex:s})}r!==void 0&&(r.count=n*3-r.start,t.push(r)),this.groups=t}fromGeometry(e){let t=e.faces,r=e.vertices,n=e.faceVertexUvs,s=n[0]&&n[0].length>0,o=n[1]&&n[1].length>0,a=e.morphTargets,l=a.length,c;if(l>0){c=[];for(let v=0;v<l;v++)c[v]={name:a[v].name,data:[]};this.morphTargets.position=c}let h=e.morphNormals,u=h.length,f;if(u>0){f=[];for(let v=0;v<u;v++)f[v]={name:h[v].name,data:[]};this.morphTargets.normal=f}let d=e.skinIndices,p=e.skinWeights,m=d.length===r.length,g=p.length===r.length;r.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let v=0;v<t.length;v++){let y=t[v];this.vertices.push(r[y.a],r[y.b],r[y.c]);let w=y.vertexNormals;if(w.length===3)this.normals.push(w[0],w[1],w[2]);else{let S=y.normal;this.normals.push(S,S,S)}let b=y.vertexColors;if(b.length===3)this.colors.push(b[0],b[1],b[2]);else{let S=y.color;this.colors.push(S,S,S)}if(s===!0){let S=n[0][v];S!==void 0?this.uvs.push(S[0],S[1],S[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",v),this.uvs.push(new B,new B,new B))}if(o===!0){let S=n[1][v];S!==void 0?this.uvs2.push(S[0],S[1],S[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",v),this.uvs2.push(new B,new B,new B))}for(let S=0;S<l;S++){let T=a[S].vertices;c[S].data.push(T[y.a],T[y.b],T[y.c])}for(let S=0;S<u;S++){let T=h[S].vertexNormals[v];f[S].data.push(T.a,T.b,T.c)}m&&this.skinIndices.push(d[y.a],d[y.b],d[y.c]),g&&this.skinWeights.push(p[y.a],p[y.b],p[y.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}},Nl=class{constructor(e,t,r,n,s,o=0){this.a=e,this.b=t,this.c=r,this.normal=n&&n.isVector3?n:new M,this.vertexNormals=Array.isArray(n)?n:[],this.color=s&&s.isColor?s:new be,this.vertexColors=Array.isArray(s)?s:[],this.materialIndex=o}clone(){return new this.constructor().copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,r=e.vertexNormals.length;t<r;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,r=e.vertexColors.length;t<r;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}};var iF=["a","b","c"];function sF(i,e){switch(e){case"c":return i.c;case"b":return i.b;case"a":default:return i.a}}function hv(i,e,t){let r=Math.min(i,e),n=Math.max(i,e),s=r+"_"+n;return t.get(s)}function uv(i,e,t,r,n,s){let o=Math.min(i,e),a=Math.max(i,e),l=o+"_"+a,c;if(r.has(l))c=r.get(l);else{let h=t[o],u=t[a];c={a:h,b:u,newEdge:null,faces:[]},r.set(l,c)}c.faces.push(n),s[i].edges.push(c),s[e].edges.push(c)}function oF(i,e,t,r){let n,s,o;for(n=0,s=i.length;n<s;n++)t[n]={edges:[]};for(n=0,s=e.length;n<s;n++)o=e[n],uv(o.a,o.b,i,r,o,t),uv(o.b,o.c,i,r,o,t),uv(o.c,o.a,i,r,o,t)}function mp(i,e,t,r,n){i.push(new Nl(e,t,r,void 0,void 0,n))}function Ol(i,e){return Math.abs(e-i)/2+Math.min(i,e)}function gp(i,e,t,r){i.push([e.clone(),t.clone(),r.clone()])}var yp=class{constructor(e=1){this.subdivisions=e}modify(e){e instanceof Le?e=new lo().fromBufferGeometry(e):e=e.clone(),e.mergeVertices();let t=this.subdivisions;for(;t-- >0;)this._smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e}_smooth(e){let t=new M,r,n,s,o,a,l=e.vertices,c=e.faces,h=e.faceVertexUvs[0],u=h!==void 0&&h.length>0,f=[],d=new Map;oF(l,c,f,d);let p=[],m,g,v,y,w,b,S;for(let oe of Array.from(d.keys())){for(g=d.get(oe),v=new M,w=3/8,b=1/8,S=g.faces.length,S!=2&&(w=.5,b=0,S!=1),v.addVectors(g.a,g.b).multiplyScalar(w),t.set(0,0,0),o=0;o<S;o++){for(y=g.faces[o],a=0;a<3&&(m=l[sF(y,iF[a])],!(m!==g.a&&m!==g.b));a++);m&&t.add(m)}t.multiplyScalar(b),v.add(t),g.newEdge=p.length,p.push(v)}let T,A,x,E,_,C,I,N=[];for(n=0,s=l.length;n<s;n++){for(C=l[n],_=f[n].edges,r=_.length,r==3?T=3/16:r>3&&(T=3/(8*r)),A=1-r*Number(T),x=T,r<=2&&(r==2?(A=3/4,x=1/8):r==1||r==0),I=C.clone().multiplyScalar(A),t.set(0,0,0),o=0;o<r;o++)E=_[o],m=E.a!==C?E.a:E.b,t.add(m);t.multiplyScalar(Number(x)),I.add(t),N.push(I)}let R=N.concat(p),k=N.length,G,te,Q,Y=[],F=[],z,O,j,q,J=new B,W=new B,ge=new B;for(n=0,s=c.length;n<s;n++)y=c[n],G=Number(hv(y.a,y.b,d).newEdge)+k,te=Number(hv(y.b,y.c,d).newEdge)+k,Q=Number(hv(y.c,y.a,d).newEdge)+k,mp(Y,G,te,Q,y.materialIndex),mp(Y,y.a,G,Q,y.materialIndex),mp(Y,y.b,te,G,y.materialIndex),mp(Y,y.c,Q,te,y.materialIndex),u&&(z=h[n],O=z[0],j=z[1],q=z[2],J.set(Ol(O.x,j.x),Ol(O.y,j.y)),W.set(Ol(j.x,q.x),Ol(j.y,q.y)),ge.set(Ol(O.x,q.x),Ol(O.y,q.y)),gp(F,J,W,ge),gp(F,O,J,ge),gp(F,j,W,J),gp(F,q,ge,W));e.vertices=R,e.faces=Y,u&&(e.faceVertexUvs[0]=F)}};var Er=new M,g1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var s,o;let t=(o=(s=i.geometry)!=null?s:e==null?void 0:e.geometry)!=null?o:new Le().copy(new vn(100,100,100)),r;e===void 0?(t.computeBoundingBox(),t.boundingBox.getSize(Er),r={width:Er.x,height:Er.y,depth:Er.z,subdivisions:0}):r=e.parameters;let n=ie(ie({},r),i.parameters);return{parameters:{width:Math.abs(n.width),height:Math.abs(n.height),depth:Math.abs(n.depth),subdivisions:Math.abs(n.subdivisions)},geometry:t}}static build(i){var l;let{width:e,height:t,depth:r,subdivisions:n}=i.parameters,s=(l=i.geometry)!=null?l:new Le().copy(new vn(100,100,100)),o=s.userData.parameters;o===void 0?(s.computeBoundingBox(),s.boundingBox.getSize(Er)):Er.set(o.width,o.height,o.depth),(e!==Er.x||t!==Er.y||r!==Er.z)&&s.scale(Er.x===0?1:e/Er.x,Er.y===0?1:t/Er.y,Er.z===0?1:r/Er.z);let a=s.originalGeometry;return n>0?(a===void 0||(o==null?void 0:o.subdivisions)!==n)&&(a===void 0&&(a=s),s=new yp(n).modify(a).toBufferGeometry()):(a!==void 0&&(s=a),a=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()),a!==void 0&&Object.assign(s,{originalGeometry:a}),delete i.geometry,Object.assign(s,{userData:xe(ie({},i),{type:"NonParametricGeometry"})})}static loadFromUrl(i,e,t){new Ws(t).load(i,n=>{let s=this.normalizeInputs({geometry:n});n.boundingBox.getSize(Er);let o=100/Er.x;Object.assign(s.parameters,{width:100,height:Er.y*o,depth:Er.z*o}),e(this.build(s))})}};var y1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters);return{shape:i.shape&&i.shape instanceof Tt?i.shape:new Tt,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs((o=t.depth)!=null?o:0)})}}static build(i){let{width:e,height:t,spikes:r,cornerRadius:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}=i.parameters,l=i.shape,c=e*.5,h=t*.5,u=0,f=0,d=2*Math.PI/r;for(let m=0;m<r;m++){let g=d*m,v=u+Math.sin(g)*c,y=f+Math.cos(g)*h;l.addPoint(l.createPoint(v,y))}l.isClosed=!0;for(let m=0,g=l.points.length;m<g;m++)l.points[m].roundness=n;l.roundness=n,l.update();let p=Hr.create({shape:l,parameters:{roundness:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}});return Object.assign(p,{userData:xe(ie({},i),{type:"PolygonGeometry"})})}};var v1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,radialSegments:n,heightSegments:s,openEnded:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=new dv(e*.5,t,n,s,o,a,l);return c.scale(1,1,r/e),Object.assign(c,{userData:xe(ie({},i),{type:"PyramidGeometry"})})}};function Yh(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function fv(i,e,t,r,n,s){let o=e.clone().sub(i),a=t.clone().sub(i),l=o.angleTo(a);if(o.normalize(),a.normalize(),r===n){let c=o.add(a).normalize();s.copy(i).addScaledVector(c,r/Math.sin(l/2))}else{let c=o.angleTo(a);s.copy(i),s.addScaledVector(o,n/Math.sin(c)),s.addScaledVector(a,r/Math.sin(c))}}function aF(i,e,t){let r=i.clone().sub(e),n=t.clone().sub(e);return r.projectOnVector(n),r.add(e)}var dv=class extends Le{constructor(e=.5,t=1,r=4,n=1,s=!1,o=0,a=4){super(),r=Math.floor(Math.max(3,r)),n=Math.floor(n),a=Math.floor(a);let l=[],c=[],h=[],u=[],f=0,d=t/2,p=Math.PI/r,m=e*Math.cos(Math.PI/r),g=2*Math.PI/r,v=(r-2)*Math.PI/r,y=Math.PI-v,w=new M(0,-d,0),b=new M(0,d,0),S=new B(e,-d),T=new B(m,-d),A=new B(0,b.y).sub(T),x=new B(0,b.y).sub(S),E=new B(A.y,-A.x).normalize(),_=new B(x.y,-x.x).normalize(),I=e*Math.cos(Math.PI/r)*Math.tan((Math.PI-A.angle())/2)-1e-8;o=Math.min(o,I);let N;{let F=new M(E.x,E.y,0),z=new M(Math.cos(g)*F.x,F.y,Math.sin(g)*F.x);N=F.angleTo(z)}let R=o/Math.tan((Math.PI-A.angle())/2),k=o/Math.tan((Math.PI-N)/2),G=new M;if(!s){c.push(w.x,w.y,w.z),h.push(0,-1,0),u.push(0,0);let F=f++,z=[],O=S.clone(),j=R/Math.cos(Math.PI/r);O.x-=j;for(let q=0;q<r;q++){let J=q/r*Math.PI*2+p,W=new B(Math.sin(J),Math.cos(J));Yh(O,W,G),c.push(G.x,G.y,G.z),h.push(0,-1,0),u.push(0,0),z.push(f++)}for(let q=0;q<z.length;q++)l.push(z[q],F,z[(q+1)%z.length])}let te=[];{let F=new M,z=new M,O=new M,j=new M,q=new M,J=new M;for(let W=0;W<r;W++){let ge=W/r*Math.PI*2+p,oe=(W+.5)/r*Math.PI*2+p,le=(W+1)/r*Math.PI*2+p,H=new B(Math.sin(ge),Math.cos(ge)),he=new B(Math.sin(oe),Math.cos(oe)),K=new B(Math.sin(le),Math.cos(le));Yh(S,H,z),Yh(S,K,O),Yh(E,he,F),fv(b,z,O,k,k,j),c.push(j.x,j.y,j.z),fv(z,b,O,k,R,q),c.push(q.x,q.y,q.z),fv(O,z,b,R,k,J),c.push(J.x,J.y,J.z),h.push(F.x,F.y,F.z),h.push(F.x,F.y,F.z),h.push(F.x,F.y,F.z),u.push(0,0),u.push(0,0),u.push(0,0);let V=f++,Z=f++,ce=f++;if(l.push(V,Z,ce),o>0){{let ve=z.clone().add(O).multiplyScalar(.5),me=b.clone().sub(ve).normalize(),ke=w.clone().sub(ve).normalize().add(me).normalize().multiplyScalar(-1),L=J.clone().sub(q);Q(ve,L,ke,A.angle())}let se,pe;{let ve=new M;Yh(_,K,ve);let me=J.clone().add(j).multiplyScalar(.5);me=aF(me,O,b);let Pe=J.clone().sub(j);[se,pe]=Q(me,Pe,ve,N,j.y)}{let ve=se,me=ve.clone().setY(0).normalize(),Pe=new M(0,-1,0),ke=me.clone().cross(Pe);Y(ve,me,Pe,ke)}te.concat(pe);{let ve=A.angle(),me=Math.PI-ve,Pe=b.clone();Pe.y-=o/Math.sin(ve-Math.PI/2);let ke=new M,L=[];for(let re=0;re<a;re++){let ye=[],Se=Math.PI/2-me*re/a,Ie=Math.cos(Se),Fe=Math.sin(Se),ue=oe;for(let rt=0;rt<=re;rt++){let st=Math.cos(ue),Ee=Math.sin(ue);F.x=Ie*Ee,F.y=Fe,F.z=Ie*st,ke.copy(Pe).addScaledVector(F,o),c.push(ke.x,ke.y,ke.z),h.push(F.x,F.y,F.z),u.push(0,0),ye.push(f++),ue+=Math.PI*2/re/r}L.push(ye)}pe.reverse(),L.push(pe);let D=L.length-1;for(let re=0;re<D;re++){let ye=L[re],Se=L[re+1],Ie=ye.length-1;l.push(Se[1],ye[0],Se[0]);for(let Fe=1;Fe<=Ie;Fe++)l.push(ye[Fe],ye[Fe-1],Se[Fe]),l.push(Se[Fe+1],ye[Fe],Se[Fe])}}}}}this.setIndex(l),this.setAttribute("position",new Ce(c,3)),this.setAttribute("normal",new Ce(h,3)),this.setAttribute("uv",new Ce(u,2));function Q(F,z,O,j,q){let J=-j/2,W=(Math.PI-j)/2,ge=z.clone().normalize().cross(O);F.addScaledVector(O,-o/Math.sin(W));let oe=new M,le=new M,H=1,he=f,K=[];for(let V=0;V<=a;V++){let Z=J+V/a*j;le.set(0,0,0),le.addScaledVector(ge,Math.sin(Z)),le.addScaledVector(O,Math.cos(Z));for(let ce=0;ce<=H;ce++){let se=ce/H-.5;if(oe.copy(F),oe.addScaledVector(z,se),oe.addScaledVector(le,o),q!=null){let pe=Math.max(0,oe.y-q);oe.addScaledVector(z,-pe/z.y)}c.push(oe.x,oe.y,oe.z),h.push(le.x,le.y,le.z),u.push(0,0),ce===0&&K.push(f),f++}}for(let V=0;V<a;V++)for(let Z=0;Z<H;Z++){let ce=he+Z+(H+1)*V,se=ce+(H+1),pe=se+1,ve=ce+1;l.push(ce,se,ve),l.push(se,pe,ve)}return[F.clone().addScaledVector(z,.5),K]}function Y(F,z,O,j){let q=Math.PI/2,J=x.angle()-q,W=[],ge=new M,oe=new M;for(let H=0;H<=a;H++){let he=[],K=H/a;for(let V=0;V<=H;V++){let ce=((H?V/H:0)-.5)*y,se=Math.cos(ce),pe=Math.sin(ce),ve=Math.atan(Math.tan(J)*se),me=(q+ve)*K,Pe=Math.cos(me),ke=Math.sin(me);ge.set(0,0,0),ge.addScaledVector(z,ke*se),ge.addScaledVector(O,Pe),ge.addScaledVector(j,ke*pe),oe.copy(F).addScaledVector(ge,o),c.push(oe.x,oe.y,oe.z),h.push(ge.x,ge.y,ge.z),u.push(0,0),he.push(f++)}W.push(he)}let le=W.length-1;for(let H=0;H<le;H++){let he=W[H],K=W[H+1],V=he.length-1;l.push(he[0],K[1],K[0]);for(let Z=1;Z<=V;Z++)l.push(he[Z-1],he[Z],K[Z]),l.push(he[Z],K[Z+1],K[Z])}}}};var vp=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var s,o,a,l;let t=Object.assign({},(s=e==null?void 0:e.parameters)!=null?s:{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters),r=Object.assign((o=e==null?void 0:e.ui)!=null?o:{enabledIndieCorners:!1},i.ui);return{shape:i.shape&&i.shape instanceof Tt?i.shape:new Tt,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((a=t.height)!=null?a:t.width),depth:Math.abs((l=t.depth)!=null?l:0)}),ui:r}}static build(i){let e=i.shape,{width:t,height:r,cornerRadius:n,cornerType:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}=i.parameters,c={x:t*.5,y:r*.5},h={x:-c.x,y:-c.y},u={x:c.x,y:c.y};function f(b,S,T){return S>t&&T>r?Math.min(b*t/S,b*r/T):S>t?b*t/S:T>r?b*r/T:b}let d=[];d[0]=n[0]===0?0:f(n[0],n[0]+n[3],n[0]+n[1]),d[1]=n[1]===0?0:f(n[1],n[1]+n[2],n[1]+n[0]),d[2]=n[2]===0?0:f(n[2],n[2]+n[1],n[2]+n[3]),d[3]=n[3]===0?0:f(n[3],n[3]+n[0],n[3]+n[2]);let p=h.x,m=u.x,g=u.y,v=h.y;e.addPoint(e.createPoint(p,g)),e.addPoint(e.createPoint(m,g)),e.addPoint(e.createPoint(m,v)),e.addPoint(e.createPoint(p,v)),e.isClosed=!0;let y=!0;for(let b=0,S=e.points.length;b<S;b++)e.points[b].roundness=d[b],b>0&&d[b]!==d[b-1]&&(y=!1);y&&(e.roundness=d[0]),e.useCubicForRoundedCorners=s!==1,e.update();let w=Hr.create({shape:e,parameters:{depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(w,{userData:xe(ie({},i),{type:"RectangleGeometry"})})}};var x1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:Math.PI},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e=100,height:t=e,depth:r=e,widthSegments:n=64,heightSegments:s=64,phiStart:o,phiLength:a,thetaStart:l,thetaLength:c}=i.parameters,h=new Ro(.5*e,n,s,o,a,l,c);return h.scale(1,t/e,r/e),Object.assign(h,{userData:xe(ie({},i),{type:"SphereGeometry"})})}};var b1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0,widthSegments:8,heightSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:0})}}static build(i){let{width:e=100,height:t=e,widthSegments:r=8,heightSegments:n=8}=i.parameters,s=new is(e,t,r,n);return s.scale(1,1,1),Object.assign(s,{userData:xe(ie({},i),{type:"PlaneGeometry"})})}};var w1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof Tt?i.shape:new Tt,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs((o=t.depth)!=null?o:0)})}}static build(i){let{width:e,height:t,innerRadiusPercent:r,spikes:n,cornerRadius:s,angle:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}=i.parameters,h=i.shape,u=e*.5,f=t*.5,d=0,p=0,m=o*Math.PI/360/n,g=Math.PI/2*3*-1,v=u*r/100,y=f*r/100;if(n===3&&r===50){m=2*Math.PI/n;for(let b=0;b<n;b++){let S=m*b,T=d+Math.sin(S)*u,A=p+Math.cos(S)*f;h.addPoint(h.createPoint(T,A))}}else for(let b=0;b<n;b++){let S=d+Math.cos(g)*u,T=p+Math.sin(g)*f;h.addPoint(h.createPoint(S,T)),g+=m,S=d+Math.cos(g)*v,T=p+Math.sin(g)*y,b<=n,h.addPoint(h.createPoint(S,T)),g+=m}h.isClosed=!0;for(let b=0,S=h.points.length;b<S;b++)h.points[b].roundness=s;h.roundness=s,h.update();let w=Hr.create({shape:h,parameters:{roundness:s,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}});return Object.assign(w,{userData:xe(ie({},i),{type:"StarGeometry"})})}};var xp=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:0)})}}static build(i){let{width:e,height:t}=i.parameters,r=new is(e,t);return Object.assign(r,{userData:xe(ie({},i),{type:"TextFrameGeometry"})})}};var S1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var o,a,l;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,radialSegments:32,tubularSegments:64,arc:Math.PI*2,cornerRadius:30,cornerSegments:8},i.parameters),r=Math.abs(t.width),n=Math.abs((a=t.height)!=null?a:t.width),s=Math.abs((l=t.depth)!=null?l:t.width*.25);return{parameters:Object.assign(t,{width:r,height:n,depth:s})}}static build(i){let{width:e,height:t,depth:r,radialSegments:n,tubularSegments:s,arc:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=lF(e,t,r,e*.5,o,s,0,0,n,a,l);return c.scale(1,t/e,1),Object.assign(c,{userData:xe(ie({},i),{type:"TorusGeometry"})})}};function lF(i,e,t,r,n,s,o,a,l,c,h){return[e,t]=[t,e],o=e/2,n/=2*Math.PI,n==1&&(c=0),new jh(!0,i,e,t,r,n,s,o,a,l,c,h)}var M1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s,o;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width),tube:(o=t.tube)!=null?o:t.width*.125})}}static build(i){let{width:e,tube:t,tubularSegments:r,radialSegments:n,p:s,q:o}=i.parameters,a=e*.5;a!==t&&(a-=t);let l=new Ha(a,t,r,n,s,o);return Object.assign(l,{userData:xe(ie({},i),{type:"TorusKnotGeometry"})})}};var A1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},i.parameters);return{shape:i.shape&&i.shape instanceof Tt?i.shape:new Tt,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width*(t.isRect?1:Math.sqrt(3)/2)),depth:Math.abs((o=t.depth)!=null?o:0)})}}static build(i){let{width:e=100,height:t,cornerRadius:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o,isRect:a}=i.parameters,l=i.shape,c=e*.5,h=t*.5;a?(l.addPoint(l.createPoint(-c,h)),l.addPoint(l.createPoint(c,-h)),l.addPoint(l.createPoint(-c,-h))):(l.addPoint(l.createPoint(0,h)),l.addPoint(l.createPoint(c,-h)),l.addPoint(l.createPoint(-c,-h))),l.isClosed=!0;for(let f=0,d=l.points.length;f<d;f++)l.points[f].roundness=r;l.roundness=r,l.update();let u=Hr.create({shape:l,parameters:{roundness:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o}});return Object.assign(u,{userData:xe(ie({},i),{type:"TriangleGeometry"})})}};var Xh={};Tx(Xh,{addBarycentricAttribute:()=>uF,fixUvs:()=>dF,loadFromUrl:()=>fF,resizeGeometry:()=>hF,roundShapePolygon:()=>cF});var T1=function(i,e){let t=e.x-i.x,r=e.y-i.y,n=Math.sqrt(t*t+r*r),s=t/n,o=r/n,a=Math.atan2(o,s);return{x:t,y:r,len:n,nx:s,ny:o,ang:a}},cF=(i,e,t)=>{let r,n,s,o,a,l,c,h,u,f,d,p,m,g,v=e.length;for(o=e[v-2],i.curves=[],r=1;r<v-1;r++){a=e[r%v],l=e[(r+1)%v];let y=T1(a,o),w=T1(a,l);c=y.nx*w.ny-y.ny*w.nx,h=y.nx*w.nx-y.ny*-w.ny,d=Math.asin(c),u=1,f=!1,h<0?d<0?d=Math.PI+d:(d=Math.PI-d,u=-1,f=!0):d>0&&(u=-1,f=!0),p=d/2,g=Math.abs(Math.cos(p)*t/Math.sin(p)),g>Math.min(y.len/2,w.len/2)?(g=Math.min(y.len/2,w.len/2),m=Math.abs(g*Math.sin(p)/Math.cos(p))):m=t,n=a.x+w.nx*g,s=a.y+w.ny*g,n+=-w.ny*m*u,s+=w.nx*m*u,i.absarc(n,s,m,y.ang+Math.PI/2*u,w.ang-Math.PI/2*u,f),o=a,a=l}i.closePath()},hF=(i,{width:e,height:t,depth:r})=>{e=Math.abs(e),t=Math.abs(t),r=Math.abs(r);let n=i.userData.parameters,s,o,a;e===0?(e=n.width,s=1):s=e/n.width,t===0?(t=n.height,o=1):o=t/n.height,r===0?(r=n.depth,a=1):a=r/n.depth,i.scale(s,o,a),n.width=e,n.height=t,n.depth=r},uF=(i,e)=>{let t=[new M(1,0,0),new M(0,1,0),new M(0,0,1)],r=i.attributes.position,n=new Float32Array(r.count*3);for(let s=0,o=r.count;s<o;s++)t[s%3].toArray(n,s*3);i.setAttribute(e,new Ce(n,3))},fF=i=>new Promise(e=>{new Ws().load(i,r=>e(r))}),dF=(i,e,t)=>{let r=i.getAttribute("uv");if(r)for(let n=0;n<r.count;n++){let s=r.getX(n),o=r.getY(n);r.setXY(n,(s+e/2)/e,1-(o-t/2)/t*-1)}};var pF,bp=new Promise(i=>{pF=i});var Qh=class{constructor(e){e=e!=null?e:{},this.name=e.name,this.type=e.type,this.node=e.node,this.size=e.size,this.needsUpdate=e.needsUpdate}get value(){return this.node.value}set value(e){this.node.value=e}};var We=class{constructor(e){this.hashProperties=void 0;this.isNode=!0;this.shortcuts={};this.uuid=et.generateUUID(),this.type=e,this.name="",this.userData={}}analyze(e,t){t=t!=null?t:{},e.analyzing=!0,this.build(e.addFlow(t.slot,t.cache,t.context),"v4"),e.clearVertexNodeCode(),e.clearFragmentNodeCode(),e.removeFlow(),e.analyzing=!1}analyzeAndFlow(e,t,r){return r=r!=null?r:{},this.analyze(e,r),this.flow(e,t,r)}flow(e,t,r){r=r!=null?r:{},e.addFlow(r.slot,r.cache,r.context);let n={result:this.build(e,t),code:e.clearNodeCode(),extra:e.context.extra};return e.removeFlow(),n}build(e,t,r){t=t!=null?t:this.getType(e,t);let n=e.getNodeData(r!=null?r:this);return e.analyzing&&this.appendDepsNode(e,n,t),e.nodes.indexOf(this)===-1&&e.nodes.push(this),this.updateFrame!==void 0&&e.updaters.indexOf(this)===-1&&e.updaters.push(this),this.generate(e,t,r)}updateFrame(e){}generateReadonly(e,t,r,n,s,o){return""}generate(e,t,r,n,s){return""}parse(e,t,r,n){}appendDepsNode(e,t,r){t.deps=(t.deps||0)+1;let n=e.getTypeLength(r);(n>(t.outputMax||0)||this.getType(e,r))&&(t.outputMax=n,t.output=r)}setName(e){this.name=e}getName(){return this.name}getType(e,t){return t==="sampler2D"||t==="samplerCube"?t:this.type}getJSONNode(e){if((e==null?void 0:e.materials)&&(e==null?void 0:e.materials[this.uuid])!==void 0)return e.materials[this.uuid]}getHash(){let e="{",t,r;for(t in this)r=this[t],r instanceof We&&(e+='"'+t+'":'+r.getHash()+",");if(this.hashProperties)for(let n=0;n<this.hashProperties.length;n++)t=this.hashProperties[n],r=this[t],e+='"'+t+'":"'+String(r)+'",';return e+='"id":"'+this.uuid+'"}',e}copy(e){return this.name=e.name,e.type&&(this.type=e.type),e.frameId&&(this.frameId=e.frameId),e.hashProperties&&(this.hashProperties=e.hashProperties.map(t=>t)),this.userData=JSON.parse(JSON.stringify(e.userData)),this.shortcuts=JSON.parse(JSON.stringify(e.shortcuts)),this}clone(){return new this.constructor().copy(this)}createJSONNode(e){let t=e===void 0||typeof e=="string";if(typeof this.type!="string")throw new Error("Node does not allow serialization.");let r={};return r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),!t&&e&&(e.nodes[this.uuid]=r),r}toJSON(e){var t;return(t=this.getJSONNode(e))!=null?t:this.createJSONNode(e)}fromJSON(e,t){return this.uuid=e.uuid,this.type=e.type,e.name&&(this.name=e.name),e.userData&&(this.userData=e.userData),this}};var pv=class{constructor(){this.nodes={};this.keywords={}}add(e){this.nodes[e.name]=e}addKeyword(e,t,r){r=r!==void 0?r:!0,this.keywords[e]={callback:t,cache:r}}remove(e){delete this.nodes[e.name]}removeKeyword(e){delete this.keywords[e]}get(e){return this.nodes[e]}getKeyword(e,t){return this.keywords[e].callback(t)}getKeywordData(e){return this.keywords[e]}contains(e){return this.nodes[e]!==void 0}containsKeyword(e){return this.keywords[e]!==void 0}},_r=new pv;var Ye=class extends We{constructor(t,r){super(t);this.scope="";r=r!=null?r:{},this.shared=r.shared!==void 0?r.shared:!0,this.unique=r.unique!==void 0?r.unique:!1}build(t,r,n,s){if(r=r!=null?r:this.getType(t),this.getShared(t,r)){let o=this.getUnique(t,r);o&&this.uuid===void 0&&(this.uuid=et.generateUUID()),n=t.getUUID(n!=null?n:this.getUUID(),!o);let a=t.getNodeData(n),l=a.output||this.getType(t);if(t.analyzing)return(a.deps||0)>0||this.getLabel()?(this.appendDepsNode(t,a,r),this.generate(t,r,n)):super.build(t,r,n);if(o)return a.name=a.name||super.build(t,r,n),a.name;if(!this.getLabel()&&(!this.getShared(t,l)||t.context.ignoreCache||a.deps===1))return super.build(t,r,n);n=this.getUUID(!1);let c=this.getTemp(t,n);if(c)return t.format(c,l,r);{c=super.generate(t,r,n,a.output,s);let h=this.generate(t,l,n);return t.addNodeCode(c+" = "+h+";"),t.format(c,l,r)}}return super.build(t,r,n)}getShared(t,r){return r!=="sampler2D"&&r!=="samplerCube"&&this.shared}getUnique(t,r){return this.unique}setLabel(t){return this.label=t,this}getLabel(){return this.label}getUUID(t){let r=this.uuid;return typeof this.scope=="string"&&(r=this.scope+"-"+r),r}getTemp(t,r){r=r||this.uuid;let n=t.getVars()[r];return n?n.name:void 0}generate(t,r,n,s,o){return this.getShared(t,r)||console.error("TempNode is not shared"),n=n!=null?n:this.uuid,t.getTempVar(n,s!=null?s:this.getType(t),o,this.getLabel()).name}};var jt=class extends Ye{constructor(t,r){r=r!=null?r:{},r.shared=r.shared!==void 0?r.shared:!1;super(t,r);this.readonly=!1}setReadonly(t){return this.readonly=t,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}createJSONNode(t){let r=super.createJSONNode(t);return this.readonly===!0&&(r.readonly=this.readonly),r}fromJSON(t,r){return super.fromJSON(t,r),t.readonly!==void 0&&this.setReadonly(t.readonly),this}generate(t,r,n,s,o,a){n=t.getUUID(n!=null?n:this.getUUID()),s=s!=null?s:this.getType(t);let l=t.getNodeData(n);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(t,r,n,s,o,a):t.isShader("vertex")?(l.vertex||(l.vertex=t.createVertexUniform(s,this,o,a,this.getLabel())),t.format(l.vertex.name,s,r)):(l.fragment||(l.fragment=t.createFragmentUniform(s,this,o,a,this.getLabel())),t.format(l.fragment.name,s,r))}copy(t){return super.copy(t),this.readonly=t.readonly,this}};var Nr=class extends jt{constructor(t=0,r){super("v2");this.nodeType="Vector2";this.value=t instanceof B?t:new B(t,r)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}generateReadonly(t,r,n,s,o,a){return t.format("vec2("+this.value.x+", "+this.value.y+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var Or=class extends jt{constructor(t=0,r,n){super("v3");this.nodeType="Vector3";this.value=t instanceof M?t:new M(t,r,n)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}get z(){return this.value.z}set z(t){this.value.z=t}generateReadonly(t,r,n,s,o,a){return t.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var Wr=class extends be{constructor(t,r,n,s){super(t,r,n);this.isColorA=!0;this.a=s}setRGBA(t,r,n,s){super.setRGB(t,r,n),this.a=s}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}};var fi=class extends jt{constructor(t){super("v4");this.nodeType="Vector4";this.value=t instanceof Wr?t:new Wr(t.r,t.g,t.b,t.a)}generateReadonly(t,r,n,s,o,a){return t.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var mF=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,E1=/[a-z_0-9]+/gi,Ne=class extends Ye{constructor(t,r,n,s,o){super(o);this.src="";this.nodeType="Function";this.useKeywords=!0;this.includes=[];this.extensions={};this.keywords={};this.isMethod=o===void 0,this.isInterface=!1,this.parse(t,r,n,s)}getShared(t,r){return!this.isMethod}getType(t){return t.getTypeByFormat(this.type)}getInputByName(t){if(this.inputs){let r=this.inputs.length;for(;r--;)if(this.inputs[r].name===t)return this.inputs[r]}}getIncludeByName(t){if(this.includes){let r=this.includes.length;for(;r--;)if(this.includes[r].name===t)return this.includes[r]}}generate(t,r,n,s,o){let a,l=0,c=this.src;if(this.includes)for(let u=0;u<this.includes.length;u++)t.include(this.includes[u],this);for(let u in this.extensions)t.extensions[u]=!0;let h=[];for(;a=E1.exec(this.src);)h.push(a);for(let u=0;u<h.length;u++){let f=h[u],d=f[0],p=this.isMethod?!this.getInputByName(d):!0,m=d;if(this.keywords[d]||this.useKeywords&&p&&_r.containsKeyword(d)){let g=this.keywords[d];if(!g){let v=_r.getKeywordData(d);v.cache&&(g=t.keywords[d]),g=g||_r.getKeyword(d,t),v.cache&&(t.keywords[d]=g)}m=g.build(t)}d!==m&&(c=c.substring(0,f.index+l)+m+c.substring(f.index+d.length+l),l+=m.length-d.length),this.getIncludeByName(m)===void 0&&_r.contains(m)&&t.include(_r.get(m))}return r==="source"?c:this.isMethod?(this.isInterface||t.include(this,void 0,c),this.name):t.format("( "+c+" )",this.getType(t),r)}parse(t,r,n,s){if(this.src=t||"",this.includes=r!=null?r:[],this.extensions=n!=null?n:{},this.keywords=s!=null?s:{},this.isMethod){let o=mF.exec(this.src);if(this.inputs=[],o&&o.length==4){this.type=o[1],this.name=o[2];let a=o[3].match(E1);if(a){let l=0;for(;l<a.length;){let c=a[l++],h;c==="in"||c==="out"||c==="inout"?h=a[l++]:(h=c,c="");let u=a[l++];this.inputs.push({name:u,type:h,qualifier:c})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}copy(t){return super.copy(t),this.isMethod=t.isMethod,this.useKeywords=t.useKeywords,t.type!==void 0&&(this.type=t.type),this.parse(t.src,t.includes,t.extensions,t.keywords),this}toJSON(t){var n;let r=this.getJSONNode(t);if(!r){r=this.createJSONNode(t),r.src=this.src,r.isMethod=this.isMethod,r.useKeywords=this.useKeywords,this.isMethod||(r.type=this.type),r.extensions=JSON.parse(JSON.stringify(this.extensions));let s={};for(let o in this.keywords)s[o]=this.keywords[o].toJSON(t).uuid;if(r.keywords=s,(n=this.includes)!=null&&n.length){let o=[];for(let a=0;a<this.includes.length;a++)o.push(this.includes[a].toJSON(t).uuid);r.includes=o}r.isMethod=this.isMethod,r.inputs=this.inputs}return r.nodeType=this.nodeType,r}fromJSON(t,r){if(super.fromJSON(t,r),t.inputs!==void 0&&(this.inputs=t.inputs),t.isMethod!==void 0&&(this.isMethod=t.isMethod),t.src&&(this.src=t.src),t.isMethod&&(this.isMethod=t.isMethod),t.useKeywords&&(this.useKeywords=t.useKeywords),t.type&&(this.type=t.type),t.extensions&&(this.extensions=t.extensions),t.keywords&&r){this.keywords={};for(let n in t.keywords)this.keywords[n]=r.getNode(t.keywords[n])}return t.includes&&r&&(this.includes=t.includes.map(n=>r.getNode(n))),this}};var gF=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,mv=class extends Ye{constructor(t="",r){super();this.src="";this.useDefine=!1;this.nodeType="Const";this.parse(t||mv.PI,void 0,void 0,void 0,r)}getType(t){return t.getTypeByFormat(this.type)}parse(t,r,n,s,o){this.src=t||"";let a,l,c="",h=gF.exec(t);this.useDefine=o!=null?o:this.src.charAt(0)==="#",h&&h.length>1?(l=h[1],a=h[2],c=h[3]):(a=this.src,l="f"),this.name=a,this.type=l,this.value=c}build(t,r){if(r==="source"){if(this.value)return this.useDefine?"#define "+this.name+" "+this.value:"const "+this.type+" "+this.name+" = "+this.value+";";if(this.useDefine)return this.src}return t.include(this),t.format(this.name,this.getType(t),r)}generate(t,r,n,s,o){return t.format(this.name,this.getType(t),r)}copy(t){return super.copy(t),this.parse(t.src,void 0,void 0,void 0,t.useDefine),this}},wt=mv;wt.PI="PI",wt.PI2="PI2",wt.RECIPROCAL_PI="RECIPROCAL_PI",wt.RECIPROCAL_PI2="RECIPROCAL_PI2",wt.LOG2="LOG2",wt.EPSILON="EPSILON";var yF=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
|
|
2987
2987
|
)*?)}`,"gim"),vF=new RegExp("s*(w*?)s*(w*?)(=|;)","gim"),Fl=class extends Ye{constructor(t=""){super();this.inputs=[];this.src="";this.nodeType="Struct";this.parse(t)}getType(t){return t.getTypeByFormat(this.name)}getInputByName(t){let r=this.inputs.length;for(;r--;)if(this.inputs[r].name===t)return this.inputs[r]}generate(t,r,n,s,o){return r==="source"?this.src+";":t.format("( "+this.src+" )",this.getType(t),r)}parse(t=""){this.src=t,this.inputs=[];let r=yF.exec(t);if(r){let n=r[2],s;for(;s=vF.exec(n);)this.inputs.push({type:s[1],name:s[2]});this.name=r[1]}else this.name="";this.type=this.name}};var Ul=class extends Ye{constructor(t){super("v2",{shared:!1});this.nodeType="UV";this.index=t!=null?t:0}generate(t,r){t.requires.uv[this.index]=!0;let n=this.index>0?this.index+1:"",s=t.isShader("vertex")?"uv"+n:"vUv"+n;return t.format(s,this.getType(t),r)}copy(t){return super.copy(t),this.index=t.index,this}toJSON(t){let r=this.getJSONNode(t);return r||(r=this.createJSONNode(t),r.index=this.index),r.nodeType=this.nodeType,r}fromJSON(t,r){return super.fromJSON(t,r),t.index&&(this.index=t.index),this}};_r.addKeyword("uv",function(){return new Ul});_r.addKeyword("uv2",function(){return new Ul(1)});var Qo=class extends Ye{constructor(t=new We,r){super("v4");this.nodeType="ColorSpace";this.factor=new We;this.input=t,this.method=r!=null?r:Qo.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(t){switch(t){case gn:return["Linear"];case je:return["sRGB"];default:return[]}}generate(t,r){var l;let n=this.input.build(t,"v4"),s=this.getType(t),o=Qo.Nodes[this.method],a=t.include(o);if(a===Qo.LINEAR_TO_LINEAR)return t.format(n,s,r);if(((l=o.inputs)==null?void 0:l.length)===2){let c=this.factor.build(t,"f");return t.format(a+"( "+n+", "+c+" )",s,r)}else return t.format(a+"( "+n+" )",s,r)}fromEncoding(t){let r=Qo.getEncodingComponents(t);this.method="LinearTo"+r[0],this.factor=r[1]}fromDecoding(t){let r=Qo.getEncodingComponents(t);this.method=r[0]+"ToLinear",this.factor=r[1]}copy(t){return super.copy(t),this.input.copy(t.input),this.method=t.method,this.factor.copy(t.factor),this}},dn=Qo;dn.Nodes={LinearToLinear:new Ne(["vec4 LinearToLinear( in vec4 value ) {"," return value;","}"].join(`
|
|
2988
2988
|
`)),sRGBToLinear:new Ne(["vec4 sRGBToLinear( in vec4 value ) {"," return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );","}"].join(`
|
|
2989
2989
|
`)),LinearTosRGB:new Ne(["vec4 LinearTosRGB( in vec4 value ) {"," return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );","}"].join(`
|
|
@@ -3923,7 +3923,7 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
3923
3923
|
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${l.result}, ${c.result} );
|
|
3924
3924
|
}
|
|
3925
3925
|
`),h&&d.push(h.code,`outgoingLight = spe_blend(outgoingLight, ${h.result}, 1.0, SPE_BLENDING_NORMAL);`),u?d.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${u.result} );`):d.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),d.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),r=d.join(`
|
|
3926
|
-
`)}return r}copy(t){return super.copy(t),t.color&&(this.color=t.color.clone()),this.roughness=t.roughness.clone(),this.metalness=t.metalness.clone(),t.position&&(this.position=t.position.clone()),t.afterColor&&(this.afterColor=t.afterColor.clone()),t.alpha&&(this.alpha=t.alpha.clone()),t.reflectivity&&(this.reflectivity=t.reflectivity.clone()),t.shadingAlpha&&(this.shadingAlpha=t.shadingAlpha.clone()),t.shadingBlend&&(this.shadingBlend=t.shadingBlend.clone()),this}};var Rp=class extends Rn{constructor(t=new Ip,r){super(t,t,r);this.type="StandardNodeMaterial",this.fragment=t}get color(){return this.fragment.color}set color(t){this.fragment.color=t}get afterColor(){return this.fragment.afterColor}set afterColor(t){this.fragment.afterColor=t}get alpha(){return this.fragment.alpha}set alpha(t){this.fragment.alpha=t}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(t){this.fragment.shadingAlpha=t}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(t){this.fragment.shadingBlend=t}get position(){return this.fragment.position}set position(t){this.fragment.position=t}get roughness(){return this.fragment.roughness}set roughness(t){this.fragment.roughness=t}get metalness(){return this.fragment.metalness}set metalness(t){this.fragment.metalness=t}get reflectivity(){return this.fragment.reflectivity}set reflectivity(t){this.fragment.reflectivity=t}};var Yl=class extends Rp{constructor(e,t,r){super(t,e),this.userData.type="PhysicalMaterial",this.userData.category="Physical",this.userData.layers=r!=null?r:this._getLayerStack(e==null?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(e.userData.layers!==void 0&&e.userData.layers instanceof Zr){let t=e.userData.layers,r=e.fragment;super.copy(e);let n=r.clone();this.fragment=n,this.vertex=n;let s=t.clone(this);this.userData.layers=s,n.shadingAlpha.value=r.shadingAlpha.value,n.shadingBlend.value=r.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,r){let n=r.getNode(t.vertex),s=new Yl(void 0,n);return s.fromJSON(t,r),s}dispose(){super.dispose()}};function pr(i,e){let t;if(typeof i=="string"){let r=e==null?void 0:e.getColor(i);r?t=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new Wr(0,0,0,0))}else return"a"in i?new Wr(i.r,i.g,i.b,i.a):new Wr(i.r,i.g,i.b,1);return t}function Bp(i,e){switch(i.data.type){case"light":return mi(i);case"fresnel":return AF(i,e);case"gradient":return TF(i);case"depth":return EF(i);case"normal":return _F(i);case"noise":return CF(i,e);case"texture":return DF(i,e);case"rainbow":return PF(i);case"transmission":return LF(i,e);case"matcap":return IF(i,e);case"displace":return RF(i);case"color":default:return MF(i,e)}}function L1(i){return{type:i.data.type}}function mi(i){let{alpha:e,mode:t}=i.data;return xe(ie({},L1(i)),{alpha:e,mode:t})}function MF(i,e){return xe(ie({},mi(i)),{color:pr(i.data.color,e)})}function AF(i,e){let{bias:t,scale:r,intensity:n,factor:s,color:o}=i.data;return xe(ie({},mi(i)),{color:pr(o,e),bias:t,scale:r,intensity:n,factor:s})}function TF(i){let{gradientType:e,smooth:t,colors:r,steps:n,angle:s,offset:o,morph:a}=i.data;return xe(ie({},mi(i)),{gradientType:e,smooth:t,colors:r.map(l=>new Je(l[0],l[1],l[2],l[3])),num:r.length,steps:n,offset:new B(...o),morph:new B(...a),angle:s})}function EF(i){let{gradientType:e,near:t,far:r,isVector:n,isWorldSpace:s,origin:o,direction:a,colors:l,steps:c,smooth:h,num:u}=i.data;return xe(ie({},mi(i)),{gradientType:e,near:t,far:r,isVector:n,isWorldSpace:s,origin:new M(...o),direction:a?new M(...a):new M(1,0,0),num:u,colors:l.map(f=>new Je(f[0],f[1],f[2],f[3])),steps:c,smooth:h})}function _F(i){let{cnormal:e}=i.data;return xe(ie({},mi(i)),{cnormal:new M(e[0],e[1],e[2])})}function CF(i,e){let{data:t}=i;return xe(ie({},mi(i)),{scale:t.scale,move:t.move,fA:new B(...t.fA),fB:new B(...t.fB),size:new M(...t.size),distortion:new B(...t.distortion),colorA:pr(t.colorA,e),colorB:pr(t.colorB,e),colorC:pr(t.colorC,e),colorD:pr(t.colorD,e),noiseType:t.noiseType})}function DF(i,e){let{projection:t,axis:r,side:n,crop:s,size:o}=i.data,{image:a,wrapping:l,repeat:c,offset:h}=i.data.texture,u=new Dt,f;if(typeof a=="string")f=e==null?void 0:e.getImage(a);else{let d=new Image;d.src=co(a.data),d.onload=()=>{e!=null&&e.onImageLoad&&(e==null||e.onImageLoad())},f=d}return u.image=f,u.repeat.set(c[0],c[1]),u.offset.set(h[0],h[1]),u.wrapS=u.wrapT=l,xe(ie({},mi(i)),{texture:u,mat:new Ft().setUvTransform(h[0],h[1],c[0],c[1],0,0,0),crop:s,projection:t,axis:["x","y","z"].indexOf(r),side:[2,0,1].indexOf(n),size:o})}function PF(i){let{data:e}=i;return xe(ie({},mi(i)),{filmThickness:e.filmThickness,movement:e.movement,wavelengths:new M(...e.wavelengths),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:new M(...e.offset)})}function LF(i,e){let{data:t}=i;return xe(ie({},mi(i)),{thickness:t.thickness,ior:t.ior,roughness:t.roughness,transmissionSamplerMap:e.transmissionSamplerMap,transmissionDepthMap:e.transmissionDepthMap})}function IF(i,e){let t=new Dt,{image:r}=i.data.texture,n;if(typeof r=="string")n=e==null?void 0:e.getImage(r);else{let o=new Image;o.src=co(r.data),o.onload=()=>{e!=null&&e.onImageLoad&&(e==null||e.onImageLoad())},n=o}t.image=n;let s=16777215;return xe(ie({},mi(i)),{color:s,texture:t})}function RF(i){let{data:e}=i,t=xe(ie({},L1(i)),{intensity:e.intensity});if(e.displacementType==="noise")return xe(ie({},t),{offset:new M(...e.offset),scale:e.scale,movement:e.movement,noiseType:e.noiseType});{let r=new Dt,n=new Ft().setUvTransform(0,0,1,1,0,0,0);return xe(ie({},t),{texture:r,mat:n,crop:e.crop})}}function Np(i,e,t){if(t.type==="displace"&&(i==="intensity"||i==="visible")){let r=e.uniforms[`f${e.id}_intensity`];return r?(r.value=t.intensity*(t.visible?1:0),r):void 0}if(t.type!=="displace"&&(i==="alpha"||i==="visible")){let r=e.uniforms[`f${e.id}_alpha`];return r?(r.value=t.alpha*(t.visible?1:0),r):void 0}}var Xl;(e=>{function i(t){return new be(t.x,t.y,t.z).getHex()}e.getHex=i})(Xl||(Xl={}));var I1;(e=>{function i(t){return new Je(t.r,t.g,t.b,t.a)}e.getThreeVector4=i})(I1||(I1={}));var R1;(t=>{function i(r,n){r.setRGB(n.r,n.g,n.b)}t.setThreeColor=i;function e(r){return new be(r.r,r.g,r.b).getHex()}t.getHex=e})(R1||(R1={}));function uu(i,e){return typeof i=="string"?e.getMaterialOrDeletedPlaceholder(i):Tv(i,e)}function B1(i,e){return i.map(t=>uu(t,e))}function Tv(i,e){var o,a;let t=(o=i.layers)!=null?o:hi.defaultTwoLayerData("phong").layers,r=BF(t),n;switch(r.category){case"basic":n=new Yr;break;case"lambert":{n=new jl;break}case"toon":{n=new ql;break}case"physical":n=new Yl;break;case"phong":default:{n=new pn;break}}n.name=(a=i.name)!=null?a:"Untitled Material";let s=n.userData.layers;NF(s);for(let l=t.length-1;l>=0;l--)OF(s,t[l],e);switch(r.category){case"basic":break;case"lambert":{let h=n,f=pr(r.emissive,e);f instanceof be?h.emissive.value=f:h.emissive.value.setHex(Xl.getHex(f));break}case"toon":{let h=n,u=r;h.shininess.value=u.shininess;let f=pr(u.specular,e);f instanceof be?h.specular.value=f:h.specular.value.setHex(Xl.getHex(f));break}case"physical":let l=n,c=r;l.metalness.value=c.metalness,l.roughness.value=c.roughness,l.reflectivity.value=c.reflectivity;break;case"phong":default:{let h=n,u=r;h.shininess.value=u.shininess;let f=pr(u.specular,e);f instanceof be?h.specular.value=f:h.specular.value.setHex(Xl.getHex(f));break}}return s.blendColors(),s.blendAfterColors(),s.blendPositions(),n}function BF(i){for(let e of i)if(e.data.type==="light")return e.data;return{type:"light",category:"basic",visible:!0,alpha:1,mode:0}}function NF(i){for(let e of i.getLayers())i.removeLayer(e.id)}function OF(i,e,t){let r=Bp(e,t);r.type==="transmission"&&(r.transmissionSamplerMap=t==null?void 0:t.transmissionSamplerMap,r.transmissionDepthMap=t==null?void 0:t.transmissionDepthMap);let n=i.addLayer(r);n.uuid=e.id;for(let s in e.data)Np(s,n,e.data)}var Zo=i=>"isEntity"in i,er=i=>"isAbstractMesh"in i,Lt=i=>i!==null&&i.isBooleanMesh,N1=i=>i.objectType==="CombinedCamera",O1=i=>Zo(i)&&(i.objectType==="LightDirectional"||i.objectType==="LightSpot"||i.objectType==="LightPoint");var ms=i=>"objectHelper"in i;function Ev(i,e){var r;let t=!1;e.position&&(i.position.fromArray(e.position),t=!0),e.rotation&&(i.rotation.fromArray(e.rotation),t=!0),e.scale&&(t=!0,i.scale.fromArray(e.scale)),e.hiddenMatrix!==void 0&&"hiddenMatrix"in i&&(t=!0,i.hiddenMatrix.fromArray((r=e.hiddenMatrix)!=null?r:Pi.identity)),t&&(i.updateMatrix(),Lt(i.parent)&&er(i)&&i.invalidateDownstreamBooleanData(!0).recomputeBoolean()),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&i.updateWorldMatrix(!1,!0),i.objectType==="CombinedCamera"&&(e.isUpVectorFlipped!==void 0&&(i.isUpVectorFlipped=e.isUpVectorFlipped),i.updateUp())}function FF(i,e){Ev(i,e),e.name!==void 0&&(i.name=e.name),e.visible!==void 0&&(i.isEntity?i.visibility=e.visible:i.visible=e.visible)}function F1(i,e,t){FF(i,e),e.color!==void 0&&(i.color=pr(e.color,t)),e.intensity!==void 0&&(i.intensity=e.intensity),e.shadows!==void 0&&!(i instanceof Hs)&&(i.castShadow=e.shadows),i.shadow&&!(i instanceof Hs)&&e.depth!==void 0&&(i.shadow.camera.far=e.depth,i.shadow.needsUpdate=!0),e.helper!==void 0&&ms(i)&&(i.enableHelper=e.helper,i.gizmos.shadowmap.visible=e.helper)}function U1(i,e){i.shadow.camera.right=e/2,i.shadow.camera.left=-e/2,i.shadow.camera.top=e/2,i.shadow.camera.bottom=-e/2,i.shadow.needsUpdate=!0}var Ql=new Kt,Xr=new M,Ge=new M,wr=new Ae;function UF(i,e,t=0,r=e.count){let n=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,c=-1/0;for(let h=t;h<r;h++){let u=e.getX(h),f=e.getY(h),d=e.getZ(h);u<n&&(n=u),f<s&&(s=f),d<o&&(o=d),u>a&&(a=u),f>l&&(l=f),d>c&&(c=d)}return i.min.set(n,s,o),i.max.set(a,l,c),i}var z1=(i,e,t,r)=>{var n;if(er(i)){let s=i.geometry.userData.parameters,o=i.geometry.getAttribute("position");i.geometry.userData.type==="SubdivGeometry"?Xr.copy(i.originalGeometry.boundingSphere.center):o!==void 0&&(UF(Ql,o,i.geometry.drawRange.start,i.geometry.drawRange.count<1/0?i.geometry.drawRange.count:o.count),Ql.getCenter(Xr)),i.forceComputeSize?Ql.getSize(Ge).multiplyScalar(.5):Ge.set(s.width,s.height,(n=s.depth)!=null?n:0).multiplyScalar(.5)}else if(ms(i)&&r===!0){let s=i.geometryHelper.getAttribute("position");Ql.setFromArray(s.array),Ql.getCenter(Xr),Ql.getSize(Ge).multiplyScalar(.5)}else Xr.setScalar(0),Ge.setScalar(0);wr.copy(e).multiply(i.matrixWorld),Ge.x===0&&Ge.y===0&&Ge.z===0?t.push(new M(Xr.x,Xr.y,Xr.z).applyMatrix4(wr)):t.push(new M(-Ge.x,Ge.y,Ge.z).add(Xr).applyMatrix4(wr),new M(-Ge.x,-Ge.y,Ge.z).add(Xr).applyMatrix4(wr),new M(Ge.x,-Ge.y,Ge.z).add(Xr).applyMatrix4(wr),new M(Ge.x,Ge.y,Ge.z).add(Xr).applyMatrix4(wr),new M(-Ge.x,Ge.y,-Ge.z).add(Xr).applyMatrix4(wr),new M(-Ge.x,-Ge.y,-Ge.z).add(Xr).applyMatrix4(wr),new M(Ge.x,-Ge.y,-Ge.z).add(Xr).applyMatrix4(wr),new M(Ge.x,Ge.y,-Ge.z).add(Xr).applyMatrix4(wr))},fu=class extends Kt{constructor(){super(...arguments);this.matrix=new Ae;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(r=>r.clone()),this.faces=t.faces.map(r=>r.clone()),this.edges=t.edges.map(r=>r.clone()),this.centerEdges=t.centerEdges.map(r=>r.clone()),this}setFromObjectSize(t,r=!1){t.updateWorldMatrix(!1,r),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let n=new Ae().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,n,r)}expandByObjectSize(t,r,n=!1){let s=[];return n===!0?t.traverseEntity(o=>{o.visible&&z1(o,r,s,t.enableHelper===!0)}):z1(t,r,s,t.enableHelper===!0),this.setFromPoints(s)}getCenter(t){return t=super.getCenter(t),t.applyMatrix4(this.matrix),t}getPositionToCenter(t){return t=super.getCenter(t),t.applyMatrix4(wr.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Ge).multiplyScalar(.5),this.getCenter(Xr),wr.copy(this.matrix).setPosition(Xr),this.vertices=[new M(-Ge.x,Ge.y,Ge.z).applyMatrix4(wr),new M(-Ge.x,-Ge.y,Ge.z).applyMatrix4(wr),new M(Ge.x,-Ge.y,Ge.z).applyMatrix4(wr),new M(Ge.x,Ge.y,Ge.z).applyMatrix4(wr),new M(-Ge.x,Ge.y,-Ge.z).applyMatrix4(wr),new M(-Ge.x,-Ge.y,-Ge.z).applyMatrix4(wr),new M(Ge.x,-Ge.y,-Ge.z).applyMatrix4(wr),new M(Ge.x,Ge.y,-Ge.z).applyMatrix4(wr)]}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=[new Jr(this.vertices[0],this.vertices[3]),new Jr(this.vertices[1],this.vertices[2]),new Jr(this.vertices[5],this.vertices[6]),new Jr(this.vertices[4],this.vertices[7]),new Jr(this.vertices[0],this.vertices[1]),new Jr(this.vertices[3],this.vertices[2]),new Jr(this.vertices[7],this.vertices[6]),new Jr(this.vertices[4],this.vertices[5]),new Jr(this.vertices[0],this.vertices[4]),new Jr(this.vertices[1],this.vertices[5]),new Jr(this.vertices[2],this.vertices[6]),new Jr(this.vertices[3],this.vertices[7])],this.centerEdges=this.edges.map(t=>t.getCenter(new M))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=[new M().copy(this.vertices[0]).sub(this.vertices[2]).multiplyScalar(.5).add(this.vertices[2]),new M().copy(this.vertices[7]).sub(this.vertices[5]).multiplyScalar(.5).add(this.vertices[5]),new M().copy(this.vertices[4]).sub(this.vertices[1]).multiplyScalar(.5).add(this.vertices[1]),new M().copy(this.vertices[3]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6]),new M().copy(this.vertices[4]).sub(this.vertices[3]).multiplyScalar(.5).add(this.vertices[3]),new M().copy(this.vertices[1]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6])]}};function du(i){let e=[];for(let t in i){let r=i[t];delete r.metadata,e.push(r)}return e}function zF(i){let e=[];for(let t in i)e.push(i[t]);return e}var Op=i=>class extends i{hasEntityChild(){return this.children.some(t=>Zo(t))}isDescendantOf(t){t instanceof ot&&(t=t.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===t)return!0;r=r.parent}return!1}attach(t,r){this.updateWorldMatrix(!0,!1);let n=new Ae().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),n.multiply(t.parent.matrixWorld)),Zo(t)?t.hiddenMatrix.premultiply(n):t.applyMatrix4(n),t.updateWorldMatrix(!1,!1),this.add(t),r!==void 0&&(this.children.pop(),this.children.splice(r,0,t)),this}copy(t,r=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),r===!0)for(let n=0;n<t.children.length;n++){let s=t.children[n];this.add(s.clone())}return this}toJSON(t){let r=t===void 0,n={object:{uuid:"",objectType:""}};t===void 0&&(t={geometries:{},materials:{},textures:{},images:{},interactionStates:{},nodes:{}},n.metadata={version:1.5,type:"Object",generator:"Object3D.toJSON"});let s={uuid:this.uuid,objectType:this.type};if(this.name!==""&&(s.name=this.name),s.matrix=this.matrix.toArray(),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),s.layers=this.layers.mask,JSON.stringify(this.userData)!=="{}"&&(s.userData=this.userData),this.children.length>0){s.children=[];for(let o of this.children)(Zo(o)||o instanceof bn)&&s.children.push(o.toJSON(t).object)}if(r){let o=du(t.geometries),a=du(t.materials),l=du(t.textures),c=du(t.images),h=du(t.interactionStates),u=zF(t.nodes);o.length>0&&(n.geometries=o),a.length>0&&(n.materials=a),l.length>0&&(n.textures=l),c.length>0&&(n.images=c),h.length>0&&(n.interactionStates=h),u.length>0&&(n.nodes=u)}return n.object=s,n}fromJSON(t){return this.uuid=t.uuid,t.name!==void 0&&(this.name=t.name),t.matrix!==void 0?(this.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(this.matrixAutoUpdate=t.matrixAutoUpdate),this.matrixAutoUpdate&&this.matrix.decompose(this.position,this.quaternion,this.scale)):(t.position!==void 0&&this.position.fromArray(t.position),t.rotation!==void 0&&this.rotation.fromArray(t.rotation),t.quaternion!==void 0&&this.quaternion.fromArray(t.quaternion),t.scale!==void 0&&this.scale.fromArray(t.scale)),this.castShadow=t.castShadow!==void 0,this.receiveShadow=t.receiveShadow!==void 0,t.visible!==void 0&&(this.visible=t.visible),t.frustumCulled!==void 0&&(this.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(this.renderOrder=t.renderOrder),t.layers!==void 0&&(this.layers.mask=t.layers),t.userData!==void 0&&(this.userData=t.userData),this}};var Xn=i=>"isEntity"in i,G1=i=>"isAbstractMesh"in i,Qn=i=>class extends Op(i){constructor(){super(...arguments);this.objectType="";this.isEntity=!0;this.raycastLock=!1;this.scaleLock=!1;this.hiddenMatrix=new Ae;this._singleBBox=new fu;this._recursiveBBox=new fu;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.forceComputeSize=!1}set visibility(r){this.visible=r;for(let n of this.children)Xn(n)&&n.traverseEntity(s=>{ms(s)&&s.visible&&(s.objectHelper.visible=r)})}get visibility(){return this.visible}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}resetBBoxNeedsUpdate(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.traverseAncestors(r=>{Xn(r)&&(r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0)}),this.traverseEntity(r=>{r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0})}traverseEntity(r){r(this);for(let n of this.children)Xn(n)&&n.traverseEntity(r)}updateMatrixWorld(r){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||r)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,r=!0);for(let n of this.children)n.updateMatrixWorld(r)}updateWorldMatrix(r,n){let s=this.parent;if(r&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),n)for(let o of this.children)o.updateWorldMatrix(!1,!0)}shallowClone(r){return new this.constructor().shallowCopy(this,r)}shallowCopy(r,n=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),n===!0)for(let s of r.children)Xn(s)&&this.add(s.shallowClone());return this}clone(r){return new this.constructor().copy(this,r)}copy(r,n=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),n===!0)for(let s of r.children)Xn(s)&&this.add(s.clone());return this}keepChildrenMatrixWorld(){let r=new Ae,n=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),r.copy(this.matrixWorld).invert(),r.multiply(n);for(let s of this.children)Xn(s)&&s.hiddenMatrix.premultiply(r)}toJSON(r){let n=super.toJSON(r),s=n.object;return this.raycastLock===!0&&(s.raycastLock=!0),this.scaleLock===!0&&(s.scaleLock=!0),s.hiddenMatrix=this.hiddenMatrix.toArray(),n}fromJSON(r){return super.fromJSON(r),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.scaleLock!==void 0&&(this.scaleLock=r.scaleLock),this.hiddenMatrix.fromArray(r.hiddenMatrix),this}fromObject3D(r){let n=r.children;return r.children=[],Object.assign(r,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new Ae}),this.copy(r),r.children=n,this}toObjectTransformState(r=[]){this.updateWorldMatrix(!0,!1);let n={position:this.position.toArray(),rotation:[this.rotation.x,this.rotation.y,this.rotation.z],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return wl(n,r)}fromObjectTransformState(r){return r.position&&this.position.fromArray(r.position),r.rotation&&this.rotation.fromArray(r.rotation),r.scale&&this.scale.fromArray(r.scale),r.hiddenMatrix&&this.hiddenMatrix.fromArray(r.hiddenMatrix),this.updateMatrix(),this}toState(r=[]){let n=ie({name:this.name,visible:this.visible,raycastLock:this.raycastLock},this.toObjectTransformState(r));return wl(n,r)}fromState(r,n){return r.name&&(this.name=r.name),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.type!=="OrthographicCamera"&&r.type!=="PerspectiveCamera"&&(this.matrixAutoUpdate=!1),r.visible!==void 0&&(this.visibility=r.visible),this.fromObjectTransformState(r),this}};var pu=class extends ot{constructor(t,r={}){super();this.object=t;let n=t.recursiveBBox.getSize(new M),s=.1;this.parameters=Ud.defaultData(n.toArray(),s),Vo(this.parameters,r),this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(let t of this.children)t.material=this.object.material}setHideBase(t){if("material"in this.object){if(Array.isArray(this.object.material)){if(this.children.length>0){for(let r of this.object.material)r.visible=!0;if(t){let r=this.object.material.map(n=>n.clone());for(let n of this.children)n.material=r}else for(let r of this.children)r.material=this.object.material}for(let r of this.object.material)r.visible=!t}else{if(this.children.length>0)if(this.object.material.visible=!0,t){let r=this.object.material.clone();for(let n of this.children)n.material=r}else for(let r of this.children)r.material=this.object.material;this.object.material.visible=!t}this.parameters.hideBase=t}}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters)}this.children.forEach(t=>t.updateMatrix())}_updateCount(){let t=this.parameters.type==="grid"?this.parameters.grid.count[0]*this.parameters.grid.count[1]*this.parameters.grid.count[2]:this.parameters.count;if(this.children.length!==t)if(this.children.length<t)for(let r=0,n=t-this.children.length;r<n;++r){let s=this.object.shallowClone(!1);s.visible=!0,this.add(s),this.parameters.hideBase&&this.setHideBase(!0)}else for(let r=0,n=this.children.length-t;r<n;++r)this.remove(this.children[0])}_updateRadial(t){let r=t.radial,n=r.start*et.DEG2RAD,s=r.end*et.DEG2RAD,o=n-s,a=new yn(r.rotation[0]*et.DEG2RAD,r.rotation[1]*et.DEG2RAD,r.rotation[2]*et.DEG2RAD),l;switch(r.axis){case"z":l=new M(0,0,1);break;case"y":l=new M(0,1,0);break;default:case"x":l=new M(1,0,0);break}for(let[c,h]of this.children.entries()){h.hiddenMatrix.identity(),h.scale.x=r.scale[0],h.scale.y=r.scale[1],h.scale.z=r.scale[2],h.position.setScalar(0);let u=o/t.count*c-n;switch(r.axis){case"x":h.rotation.set(0,u,0);break;case"y":h.rotation.set(0,0,u);break;case"z":h.rotation.set(u,0,0);break}h.translateOnAxis(l,r.radius),h.position.x+=r.position[0],h.position.y+=r.position[1],h.position.z+=r.position[2],r.alignment===!0?(h.rotation.x+=a.x,h.rotation.y+=a.y,h.rotation.z+=a.z):h.rotation.copy(a)}}_updateLinear(t){if(t.type!=="linear")throw new Error;let r=t.linear,n=new yn(r.rotation[0]*et.DEG2RAD,r.rotation[1]*et.DEG2RAD,r.rotation[2]*et.DEG2RAD);for(let[s,o]of this.children.entries())o.hiddenMatrix.identity(),o.scale.x=1+(r.scale[0]-1)*s,o.scale.y=1+(r.scale[1]-1)*s,o.scale.z=1+(r.scale[2]-1)*s,o.rotation.x=n.x*s,o.rotation.y=n.y*s,o.rotation.z=n.z*s,o.position.x=r.position[0]*s,o.position.y=r.position[1]*s,o.position.z=r.position[2]*s}_updateGrid(t){let r=0,n=t.grid;if(n.useCenter===!0){let s={x:n.count[0]%2===0?2:1,y:n.count[1]%2===0?2:1,z:n.count[2]%2===0?2:1},o=new M(n.size[0]*(n.count[0]-s.x)*.5,n.size[1]*(n.count[1]-s.y)*.5,n.size[2]*(n.count[2]-s.z)*.5);for(let a=0;a<n.count[0];a++)for(let l=0;l<n.count[1];l++)for(let c=0;c<n.count[2];c++){let h=this.children[r++];h.hiddenMatrix.identity(),h.scale.setScalar(1),h.rotation.set(0,0,0),h.position.x=n.size[0]*a-o.x,h.position.y=n.size[1]*l-o.y,h.position.z=n.size[2]*c-o.z}}else for(let s=0;s<n.count[0];s++)for(let o=0;o<n.count[1];o++)for(let a=0;a<n.count[2];a++){let l=this.children[r++];l.hiddenMatrix.identity(),l.scale.setScalar(1),l.rotation.set(0,0,0),l.position.x=n.size[0]*s,l.position.y=-n.size[1]*o,l.position.z=-n.size[2]*a}}fromJSON(t){return this}toJSON(){return{}}fromClonerState(t){return t.hideBase!==void 0&&this.setHideBase(t.hideBase),Vo(this.parameters,t),this.update(),this}};var kt=class extends Qn(Vt){constructor(t,r){super(t,r);this.isAbstractMesh=!0;this.isBooleanMesh=!1;this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new Ae;this.booleanExclude=null;Array.isArray(r)&&(this.selectedMaterial=0,t.groups.length===0&&t.addGroup(0,t.getAttribute("position").count,0))}get cloner(){return this._cloner}set cloner(t){this._cloner&&this.remove(this._cloner),t&&this.add(t),this._cloner=t}getSelectedMaterial(t){return Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=t!=null?t:0),this.material[t!=null?t:this.selectedMaterial]):this.material}setSelectedMaterial(t,r){Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=r!=null?r:0),r=r!=null?r:this.selectedMaterial,this.material[r].dispose(),this.material[r]=t):(this.material.dispose(),this.material=t)}updateGeometry(t){let r=this.geometry,n=_v[r.userData.type],s=this.objectType==="NonParametric"?Object.assign({},r.userData,{geometry:r}):r.userData,o=n.build(n.normalizeInputs(t,s)),a=r.uuid;if(this.geometry.dispose(),this.geometry=o,this.geometry.uuid=a,this.geometry.computeBoundingSphere(),this.cloner)for(let l of this.cloner.children)l.geometry=this.geometry}resizeGeometry(t,r,n){Xh.resizeGeometry(this.geometry,{width:t,height:r,depth:n})}shallowClone(t){return new this.constructor(this.geometry,this.material).shallowCopy(this,t)}clone(t){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,n=mu(r),s=Array.isArray(this.material)?this.material.map(o=>o.clone()):this.material.clone();return new this.constructor(n,s).copy(this,t)}copy(t,r=!0){return super.copy(t,r),t.cloner&&(this.cloner=new pu(t,t.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(t){t===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new pu(this)),this.cloner.fromClonerState(t))}fromState(t,r){var n,s,o;return super.fromState(t),t.type==="Mesh"&&(this.setFromClonerState(t.cloner),this.castShadow=(n=t.castShadow)!=null?n:!0,this.receiveShadow=(s=t.receiveShadow)!=null?s:!0,this.booleanExclude=(o=t.booleanExclude)!=null?o:null),this}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Jn.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Lt(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)er(t)&&(t.freeBooleanPointer(),Lt(t)&&t.invalidateUpstreamBooleanData())}};var GF=new M(0,0,1),k1=new M,V1=new M,H1=new Ft,ho=class extends kt{constructor(t=Hr.create({}),r=new Yr({side:or})){var n;super(t,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new Yt;this._onShapeUpdate=()=>{this.updateGeometry({}),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=t.userData.shape,(n=this.shape.eventDispatcher)==null||n.addEventListener("update",this._onShapeUpdate)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="VectorObject",r}fromState(t){return super.fromState(t),this.shape.update(),this}setHelperVisibility(){}updateGeometry(t){if(super.updateGeometry(t),"userData"in this.geometry){let r=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:r})}}setShape(t){var r,n;this.shape&&((r=this.shape.eventDispatcher)==null||r.removeEventListener("update",this._onShapeUpdate)),this.shape=t,(n=this.shape.eventDispatcher)==null||n.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),H1.getNormalMatrix(this.matrixWorld),k1.copy(GF).applyMatrix3(H1).normalize(),V1.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(k1,V1)}clone(t){let r=this.shape.clone(),n=this.material.clone(),s=this.geometry.userData,o=Hr.create(Object.assign({},s,{shape:r})),a=new ho(o,n).copy(this,t);return a.shape=r,r.update(),a}raycast(t,r){kt.prototype.raycast.call(this,t,r)}};function Fp(i,e){return kF(i)}function kF(i){let e={parameters:i,type:i.type};if(i.type==="VectorGeometry"){let r=Tt.createFromState(i.shape,i.width,i.height);e.shape=r}else i.type==="NonParametricGeometry"&&(i.data.groups&&i.data.groups.forEach(r=>{var n;return r.materialIndex=Math.max((n=r.materialIndex)!=null?n:0,0)}),e.geometry=new Ws().parse(i));let t;try{t=mu(e)}catch(r){console.error(r)}if(!t){let r=Tt.createFromState(_l.defaultData(),100,100);e.shape=r,t=mu(e)}return t}var Ke;bp.then(i=>{Ke=i});var W1=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),j1=new Uint32Array([0,1,2,3]),q1=new Uint8Array([4]),gi=class{static build(i,e,t,r){let n,s,o;if((i==null?void 0:i.positionWASM)!==void 0){e&&e!==0&&(Ke.free_bvh(e),Ke.free_subdivision_surface(e));try{n=gi.allocate(i,r)}catch(a){console.error(a,i),n=gi.allocate({positionWASM:W1,indexWASM:j1,verticesPerFaceWASM:q1},r)}Ke.set_destination_refinement_level(n,0),s=gi.buildLevel(n,!0,t)}else n=e;if(i!==void 0&&i.subdivisions!==void 0){let a=VF(i.subdivisions,i.positionWASM.length);Ke.set_destination_refinement_level(n,a),a>0?o=gi.buildLevel(n,!1,t):o=null}return{subdivPointer:n,originalGeometry:s,subdividedGeometry:o}}static primitiveToQuads(i,e){i.widthSegments>16&&(i.widthSegments=16),i.heightSegments>16&&(i.heightSegments=16),i.depthSegments>16&&(i.depthSegments=16),i.radialSegments>16&&(i.radialSegments=16),i.type==="DodecahedronGeometry"&&(i.detail=0);let t=i.shape!==void 0?e.geometry:Fp(i),r,n,s,o;return{positions:r,triIndices:o}=Lv(t.getAttribute("position"),t.getIndex()),{indices:n,verticesPerFace:s}=Iv(r,o,t),{positions:r,indices:n,verticesPerFace:s}}static allocate(i,e){var b;let t,r,n,s=[],o=[];i.positionWASM&&i.positionWASM.length>0?(t=i.positionWASM,r=i.indexWASM,n=i.verticesPerFaceWASM):(t=W1,r=j1,n=q1);let a=t.length,l=r.length,c=n.length,h=t.length+s.length+o.length,u=r.length+n.length,f=h*Float32Array.BYTES_PER_ELEMENT+u*Uint32Array.BYTES_PER_ELEMENT,d=h*Float32Array.BYTES_PER_ELEMENT,p=u*Uint32Array.BYTES_PER_ELEMENT,m=Ke._malloc(f),g=new Float32Array(Ke.HEAPF32.buffer,m,h),v=new Uint32Array(Ke.HEAPU32.buffer,m+d,u);g.set(t,0),g.set(s,t.length),g.set(o,t.length+s.length),v.set(r,0),v.set(n,r.length);let y;(b=i==null?void 0:i.scaleBaked)!=null&&b.some(S=>S!==1)&&(y=new Ae().makeScale(...i.scaleBaked)),e&&(y?y.premultiply(e):y=e);let w=y?Ke.alloc_subdivision_surface2(m,a,m+d,l,m+d+r.length*Uint32Array.BYTES_PER_ELEMENT,c,y.elements):Ke.alloc_subdivision_surface(m,a,m+d,l,m+d+r.length*Uint32Array.BYTES_PER_ELEMENT,c);return Ke._free(m),w}static buildLevel(i,e,t,r,n){let s=n?Ke.get_mesh_data2(i,e?Ke.Level.CONTROL:Ke.Level.REFINED,t!=null?t:!e,n.elements):Ke.get_mesh_data(i,e?Ke.Level.CONTROL:Ke.Level.REFINED,t!=null?t:!e),o=8,a=Ke.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(4,4+4),c=0,h=Ke.HEAPU32[a[c]>>2],u=Ke.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let f=Ke.HEAPU32[a[c]>>2],d=Ke.HEAPF32.subarray(f>>2,(f>>2)+l[c]);c++;let p=Ke.HEAPU32[a[c]>>2],m=Ke.HEAPU32.subarray(p>>2,(p>>2)+l[c]);c++;let g=Ke.HEAPU32[a[c]>>2],v=Ke.HEAPU32.subarray(g>>2,(g>>2)+l[c]);if(c++,r===void 0){let y=new Le;if(y.setIndex(new Os(v,1)),y.setAttribute("position",new Ce(u,3)),y.setAttribute("normal",new Ce(d,3)),e){y.setAttribute("faceMap",new Os(m,1));let w=new Float32Array(d.length/3*4).fill(0);y.setAttribute("color",new Ve(w,4))}return Ke.free_mesh_data(s),y.userData.type="SubdivGeometry",y}r.getAttribute("position").copyArray(u),r.getAttribute("normal").copyArray(d),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,Ke.free_mesh_data(s)}static buildControlCageWireframe(i,e,t){let r=Ke.get_wireframe_data_for_base_level(i),n=4,s=Ke.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(2,2+2),a=0,l=Ke.HEAPU32[s[a]>>2],c=Ke.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let h=Ke.HEAPU32[s[a]>>2],u=Ke.HEAPU32.subarray(h>>2,(h>>2)+o[a]);if(e===void 0){let f=new Le;f.setAttribute("position",new Ce(c,3));let d=new Float32Array(c.length);for(let p=0,m=c.length;p<m;)d[p++]=t.r,d[p++]=t.g,d[p++]=t.b;return f.setAttribute("color",new Ve(d,3)),f.setIndex(new Os(u,1)),Ke.free_wireframe_data_for_base_level(r),f}e.getAttribute("position").copyArray(c),e.attributes.position.needsUpdate=!0,Ke.free_wireframe_data_for_base_level(r)}static updateCollabMesh(i,e,t){e||Ke.set_destination_refinement_level(i,1);let r=t?Ke.get_topological_data2(i,e?Ke.Level.CONTROL:Ke.Level.REFINED,t.elements):Ke.get_topological_data(i,e?Ke.Level.CONTROL:Ke.Level.REFINED),n=6,s=Ke.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(3,3+3),a=0,l=Ke.HEAPU32[s[a]>>2],c=new Float32Array(Ke.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let h=Ke.HEAPU32[s[a]>>2],u=new Uint32Array(Ke.HEAPU32.subarray(h>>2,(h>>2)+o[a]));a++;let f=Ke.HEAPU32[s[a]>>2],d=new Uint8Array(Ke.HEAPU32.subarray(f>>2,(f>>2)+o[a]));return Ke.free_topological_data(r),{positions:c,indices:u,verticesPerFace:d}}};function VF(i,e){let t=i;return t=Math.min(t,3-Math.ceil(Math.log(e/172e3)/Math.log(4))),Math.max(t,0)}var Y1=["getX","getY","getZ"];function Lv(i,e){let t={},r=e?e.count:i.count,n=0,s=[],o=[],a=1e4;for(let c=0;c<r;c++){let h=e?e.getX(c):c,u="";for(let f=0;f<3;f++)u+=`${~~(i[Y1[f]](h)*a)},`;if(u in t)s.push(t[u]);else{for(let f=0;f<3;f++)o.push(i[Y1[f]](h));t[u]=n,s.push(n),n++}}let l=[];for(let c=0;c<s.length;c+=3)s[c]===s[c+1]||s[c]===s[c+2]||s[c+1]===s[c+2]||l.push(s[c],s[c+1],s[c+2]);return{positions:o,triIndices:l}}var Up=new M,Cv=new M,Dv=new M,Pv=new M;function Iv(i,e,t){var s;let r=[],n=[];if(t.userData.shape!==void 0&&t.userData.parameters.depth===0){let o=t.userData.shape.extractShapePointsToFlatArray([]),a=0;for(let c=0;c<o.length;c+=2)a+=(o[c]-o[(c===0?o.length:c)-2])*(o[c+1]+o[(c===0?o.length:c)-1]);i.length=0;let l=0;if(a<0)for(let c=0;c<o.length;c+=2)i.push(o[c],o[c+1],0),r.push(l++);else for(let c=o.length-2;c>=0;c-=2)i.push(o[c],o[c+1],0),r.push(l++);return n.push(l),{indices:r,verticesPerFace:n}}for(let o=0,a=(s=t.capStartIndex)!=null?s:e.length;o<a;)if(e[o+1]===e[o+3]&&e[o+2]===e[o+5]||e[o+0]===e[o+3]&&e[o+2]===e[o+4]){Up.set(i[e[o]*3],i[e[o]*3+1],i[e[o]*3+2]),Cv.set(i[e[o+1]*3],i[e[o+1]*3+1],i[e[o+1]*3+2]),Dv.set(i[e[o+4]*3],i[e[o+4]*3+1],i[e[o+4]*3+2]),Pv.set(i[e[o+5]*3],i[e[o+5]*3+1],i[e[o+5]*3+2]),Cv.sub(Up).normalize(),Dv.sub(Up).normalize(),Pv.sub(Up).normalize();let l=Cv.cross(Dv).dot(Pv);Math.abs(l)>.005?(r.push(e[o],e[o+1],e[o+2]),n.push(3),o+=3):(r.push(e[o],e[o+1],e[o+4],e[o+5]),n.push(4),o+=6)}else r.push(e[o],e[o+1],e[o+2]),n.push(3),o+=3;if(t.capStartIndex!==void 0){let o=[],a=[],l=0;for(let c=0,h=0;c<i.length;c+=3,h++)i[c+2]===0&&(o.push(h),l++),i[c+2]===t.userData.parameters.depth&&a.push(h);if(t.userData.parameters.extrudeBevelSize===0){let c=a[0];a[0]=a[1],a[1]=c}o.reverse(),r.push(...o,...a),n.push(l,l)}return{indices:r,verticesPerFace:n}}var Jn={};Tx(Jn,{calcBoolean:()=>jF,calcBooleanTopological:()=>WF,freeMeshSet:()=>XF,getMeshSet:()=>qF,transformMeshSet:()=>YF});var Q1,J1=new Promise(i=>{Q1=i}),X1=!1;async function K1(){if(X1)return;let e=!1?".":"https://unpkg.com/@splinetool/boolean-wasm@0.9.52/build",[t,r]=await Promise.all([import("./boolean.js"),fetch(`${e}/boolean.wasm`).then(o=>o.arrayBuffer())]),s=await t.default({wasmBinary:r});Q1(s),X1=!0}var gt,Jl;J1.then(i=>gt=i);function HF(i,e){let t,{positions:r,triIndices:n}=Lv(i.getAttribute("position"),i.getIndex()),s;if(e){let{indices:o,verticesPerFace:a}=Iv(r,n,i);s=a.length,t=[];for(let l=0,c=0;l<s;l++){t.push(a[l]);for(let h=0;h<a[l];h++)t.push(o[c++])}}else{let o=n.length;t=Array(o+o/3),s=0;for(let a=0,l=0;l<t.length;)t[l++]=3,s++,t[l++]=n[a++],t[l++]=n[a++],t[l++]=n[a++]}return{positions:r,faceIndices:t,nFaces:s}}function Z1(i){let e=i.length,t=e*Uint32Array.BYTES_PER_ELEMENT,r=e*Float32Array.BYTES_PER_ELEMENT,n=Number.isInteger(i[0])?t:r,s=gt._malloc(n);return(Number.isInteger(i[0])?new Uint32Array(gt.HEAPU32.buffer,s,e):new Float32Array(gt.HEAPF32.buffer,s,e)).set(i,0),s}function $1(i){switch(i){case 0:return gt.OP.UNION;case 1:return gt.OP.INTERSECTION;case 2:return gt.OP.A_MINUS_B;case 3:return gt.OP.B_MINUS_A;case 4:return gt.OP.SYMMETRIC_DIFFERENCE;case 5:return gt.OP.ALL;default:throw new Error("Unknown boolean operation "+i)}}function WF(i,e){Jl===void 0&&(Jl=gt.init_csg());let t=Z1(i),r=gt.csg_calc_topological(Jl,t,i.length,$1(e));gt._free(t);let n=6,s=gt.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(3,3+3),a=0,l=gt.HEAPU32[s[a]>>2],c=new Float32Array(gt.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let h=gt.HEAPU32[s[a]>>2],u=new Uint32Array(gt.HEAPU32.subarray(h>>2,(h>>2)+o[a]));a++;let f=gt.HEAPU32[s[a]>>2],d=new Uint8Array(gt.HEAPU32.subarray(f>>2,(f>>2)+o[a]));return gt.free_mesh_data(r),{positions:c,indices:u,verticesPerFace:d}}function jF(i,e,t){Jl===void 0&&(Jl=gt.init_csg());let r=Z1(i),n=gt.csg_calc(Jl,r,i.length,$1(e));gt._free(r);let s=5,o=gt.HEAPU32.subarray(n>>2,(n>>2)+s),a=o.subarray(2,2+3),l=0,c=gt.HEAPU32[o[l]>>2],h=gt.HEAPF32.subarray(c>>2,(c>>2)+a[l]);l++;let u=gt.HEAPU32[o[l]>>2],f=gt.HEAPF32.subarray(u>>2,(u>>2)+a[l]);l++;let d=a[l];t.setAttribute("position",new Ce(h,3)),t.setAttribute("normal",new Ce(f,3));let p=gt.HEAPF32.subarray((n>>2)+5,(n>>2)+5+6);return t.boundingSphere===null&&(t.boundingSphere=new Lr),t.boundingSphere.center.set(p[0],p[1],p[2]),t.boundingSphere.radius=(p[3]**2+p[4]**2+p[5]**2)**.5,t.userData.parameters={width:p[3]*2,height:p[4]*2,depth:p[5]*2},gt.free_mesh_data(n),d}function qF(i,e){if(gt===void 0)return-1;let t,r,n;if(e&&i.userData.positions!==void 0){let m=i.userData;n=m.verticesPerFace.length,t=m.positions,r=Array(m.verticesPerFace.reduce((g,v)=>g+v,0)+n);for(let g=0,v=0,y=0;g<m.verticesPerFace.length;g++){r[y++]=m.verticesPerFace[g];for(let w=0;w<m.verticesPerFace[g];w++)r[y++]=m.indices[v++]}}else({positions:t,faceIndices:r,nFaces:n}=HF(i,e));let s=t.length,o=r.length,a=t.length,l=r.length,c=a*Float32Array.BYTES_PER_ELEMENT+l*Uint32Array.BYTES_PER_ELEMENT,h=a*Float32Array.BYTES_PER_ELEMENT,u=l*Uint32Array.BYTES_PER_ELEMENT,f=gt._malloc(c),d=new Float32Array(gt.HEAPF32.buffer,f,a),p=new Uint32Array(gt.HEAPU32.buffer,f+h,l);return d.set(t,0),p.set(r,0),gt.get_csg_mesh(f,s,f+h,o,n)}function YF(i,e){gt.transform_csg_mesh(i,e.elements)}function XF(i){gt.free_csg_mesh(i)}var _v={ConeGeometry:VM,CubeGeometry:HM,CylinderGeometry:kM,DodecahedronGeometry:WM,EllipseGeometry:c1,HelixGeometry:d1,IcosahedronGeometry:p1,LatheGeometry:m1,NonParametricGeometry:g1,PolygonGeometry:y1,PyramidGeometry:v1,RectangleGeometry:vp,SphereGeometry:x1,PlaneGeometry:b1,StarGeometry:w1,TextFrameGeometry:xp,TorusGeometry:S1,TorusKnotGeometry:M1,TriangleGeometry:A1,VectorGeometry:Hr},mu=i=>_v[i.type].create(i);var eA=new Ae;function Rv(i){let e=!1;return i.scene.objects.traverse((t,r)=>{var n;((n=r.geometry)==null?void 0:n.type)==="BooleanGeometry"&&(e=!0)}),e}var zp=class extends kt{constructor(t=new Le,r=new pn){super(t,r);this.booleanOp=2;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.isBooleanMesh=!0,this.castShadow=!0,this.receiveShadow=!0,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}reInit(){this.isBooleanMesh=!0,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}recomputeBoolean(t){if(this.booleanMeshSetAddress!==-1)return;for(let n=0;n<this.children.length;n++){let s=this.children[n];Lt(s)&&s.recomputeBoolean(t===!0)}this.meshSetAddresses=[];for(let n=0;n<this.children.length;n++){let s=this.children[n];if(G1(s)&&s.booleanExclude===!1&&s.geometry.drawRange.count>0){if(s.booleanMeshSetAddress===-1){if(s.booleanMeshSetAddress=Jn.getMeshSet(s.geometry,t===!0),s.booleanMeshSetAddress===-1)return;Jn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1}else Lt(s)&&s.needsTransformForDownstream===!0?(Jn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.needsTransformForDownstream=!1):s.booleanWasTransformed===!0&&(eA.multiplyMatrices(s.matrix,s.booleanMatrixInvOld),Jn.transformMeshSet(s.booleanMeshSetAddress,eA),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1);this.meshSetAddresses.push(s.booleanMeshSetAddress)}}if(this.meshSetAddresses.length===0){this.geometry.setDrawRange(0,0);return}if(t===!0)return Jn.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new Le,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere,this.booleanMeshSetAddress=Jn.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry),this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh3D",r}updateGeometry(t){this.booleanOp=t.parameters.operation,this.invalidateDownstreamBooleanData().recomputeBoolean()}};var Gi=i=>{var e;return e=class extends i{constructor(){super(...arguments);this.isObjectHelper=!0}},e.geometryHelper=new vn(30,30,30),e};var Gp=new si,Bv=new Lr,tA=new Ae,ki=(i,e,t,r,n=!1)=>{let s=e,o=i.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),Bv.copy(s.boundingSphere),Bv.applyMatrix4(o),t.ray.intersectsSphere(Bv)===!1||(tA.copy(o).invert(),Gp.copy(t.ray).applyMatrix4(tA),s.boundingBox!==null&&Gp.intersectsBox(s.boundingBox)===!1))return;let a,l,c,h,u=s.index,f=s.attributes.position,d=s.drawRange,p,m;if(n===!1){let v=Math.max(0,d.start),y=Math.min(u.count,d.start+d.count);for(p=v,m=y;p<m;p+=3)if(l=u.getX(p),c=u.getX(p+1),h=u.getX(p+2),a=g(i,t,Gp,f,l,c,h),a){a.faceIndex=Math.floor(p/3),r.push(a);return}}else{let y=s.attributes.position,w=new M,b=new M,S=new M,T=new M,A=2,E=1/((i.scale.x+i.scale.y+i.scale.z)/3),_=E*E,C=Math.max(0,d.start),I=Math.min(y.count,d.start+d.count);for(let N=C,R=I-1;N<R;N+=A){if(w.fromBufferAttribute(y,N),b.fromBufferAttribute(y,N+1),Gp.distanceSqToSegment(w,b,T,S)>_)continue;T.applyMatrix4(i.matrixWorld);let G=t.ray.origin.distanceTo(T);G<t.near||G>t.far||r.push({distance:G,point:S.clone().applyMatrix4(i.matrixWorld),object:i})}}function g(v,y,w,b,S,T,A){let x=new M,E=new M,_=new M,C=new M,I=new M;if(x.fromBufferAttribute(b,S),E.fromBufferAttribute(b,T),_.fromBufferAttribute(b,A),w.intersectTriangle(x,E,_,!1,C)===null)return null;I.copy(C),I.applyMatrix4(v.matrixWorld);let R=y.ray.origin.distanceTo(I);return R<y.near||R>y.far?null:{faceIndex:1,distance:R,point:I.clone(),object:v}}};var kp=new M,Kn=new Gn,Nv=class extends ai{constructor(t){let r=new Le,n=new kr({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],o=[],a={},l=new be(15711266),c=new be(15711266),h=new be(2857471);u("n1","n2",l),u("n2","n4",l),u("n4","n3",l),u("n3","n1",l),u("f1","f2",l),u("f2","f4",l),u("f4","f3",l),u("f3","f1",l),u("n1","f1",l),u("n2","f2",l),u("n3","f3",l),u("n4","f4",l),u("p","n1",c),u("p","n2",c),u("p","n3",c),u("p","n4",c),u("u1","u2",h),u("u2","u3",h),u("u3","u1",h);function u(d,p,m){f(d,m),f(p,m)}function f(d,p){s.push(0,0,0),o.push(p.r,p.g,p.b),a[d]===void 0&&(a[d]=[]),a[d].push(s.length/3-1)}r.setAttribute("position",new Ce(s,3)),r.setAttribute("color",new Ce(o,3));super(r,n);this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let t=this.geometry,r=this.pointMap,n=!0;Kn.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,o=1,a=n?.8:1e-4;yi("n1",r,t,Kn,-s,-o,a),yi("n2",r,t,Kn,s,-o,a),yi("n3",r,t,Kn,-s,o,a),yi("n4",r,t,Kn,s,o,a);let l=a;yi("f1",r,t,Kn,-s,-o,l),yi("f2",r,t,Kn,s,-o,l),yi("f3",r,t,Kn,-s,o,l),yi("f4",r,t,Kn,s,o,l);let c=l,h=.5;yi("u1",r,t,Kn,s*.7*h,o*1.1,c),yi("u2",r,t,Kn,-s*.7*h,o*1.1,c),yi("u3",r,t,Kn,0,o*(1.1+.9*h),c),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function yi(i,e,t,r,n,s,o){kp.set(n,s,o).unproject(r);let a=e[i];if(a!==void 0){let l=t.getAttribute("position");for(let c=0,h=a.length;c<h;c++)l.setXYZ(a[c],kp.x,kp.y,kp.z)}}var Vp=class extends Gi(Nv){constructor(t){super(t);this.object=t;this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,r){ki(this.object,this.geometry,t,r,!0)}};var Kl=class extends Gi(Qf){constructor(t,r=15,n=10066329){super(t,r,n);this.object=t;this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,r){ki(this.object,Kl.geometryHelper,t,r)}};var Zl=class extends Gi(Jf){constructor(t,r=15){super(r);this.object=t;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}raycast(t,r){ki(this.object,Zl.geometryHelper,t,r)}update(){}};var $l=class extends Gi(Xf){constructor(t,r=15,n=6710886){super(t,r,n);this.object=t;this.name=`PointLightHelper: ${t.uuid}`}raycast(t,r){ki(this.object,$l.geometryHelper,t,r)}};var Hp=class extends Gi(Yf){constructor(t,r=6710886){super(t,r);this.object=t;this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,r){ki(this.object,Hp.geometryHelper,t,r)}update(){if(this.object!==void 0){let t=Hp._vector,r=this.object.distance?this.object.distance:1e3,n=r*Math.tan(this.object.angle);this.cone.scale.set(n,n,r),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let o=0,a=this.cone.material.length;o<a;o++)this.cone.material[o].color.set(s);else this.cone.material.color.set(s)}}},gu=Hp;gu._vector=new M;var Vi=(i,e)=>class extends i{constructor(){super(...arguments);this.objectHelper=new e(this);this.enableHelper=!1}set visibility(n){this.visible=n,this.setHelperVisibility(n),this.setHelperChildrenVisibility(n)}get visibility(){return this.visible}get geometryHelper(){return e.geometryHelper}setHelperVisibility(n){this.objectHelper.visible=n}setHelperChildrenVisibility(n){for(let s of this.children)Xn(s)&&s.traverseEntity(o=>{ms(o)&&o.visible&&(o.objectHelper.visible=n)})}raycast(n,s){this.objectHelper.raycast(n,s)}copy(n,s=!0){return super.copy(n,s),n.enableHelper!==void 0&&(this.enableHelper=n.enableHelper),n.objectHelper!==void 0&&(this.objectHelper.visible=n.objectHelper.visible),this}toJSON(n){let s=super.toJSON(n),o=s.object;return o.enableHelper=this.enableHelper,s}fromJSON(n){return super.fromJSON(n),n.enableHelper!==void 0&&(this.enableHelper=!0),this}fromLightState(n,s){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let o=this;n.color!==void 0&&(o.color=pr(n.color,s)),n.intensity!==void 0&&(o.intensity=n.intensity),n.depth!==void 0&&(o.shadow.camera.far=n.depth,o.shadow.needsUpdate=!0),n.shadows!==void 0&&(this.castShadow=n.shadows),n.helper!==void 0&&(this.enableHelper=n.helper,o.gizmos.shadowmap.visible=n.helper)}return this}};var ec=new M,Ov=new M,Bn=class extends Vi(Qn(Gn),Vp){constructor(t=window.innerWidth,r=window.innerHeight,n=45,s,o=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=Wo.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=t,this.height=r,this.orthoCamera=new Co(t*-.5,t*.5,r*.5,r*-.5,s!=null?s:-5e4,o),this.perspCamera=new sr(n,t/r,s!=null?s:50,o),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic(!0)}static createFromState(t,r){let n=new Bn().fromState(r);return n.enableHelper=!0,n.objectHelper.update(),n.uuid=t,n}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(t,r){t==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(t,r){r>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t){super.lookAt(t),this.getWorldPosition(ec),this.targetOffset=ec.distanceTo(t)}getTarget(t=new M){return this.getWorldDirection(Ov),this.getWorldPosition(ec),Ov.multiplyScalar(this.targetOffset),t.copy(ec).add(Ov),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(ec),ec.distanceTo(t)}updateUp(){let t=this.getWorldQuaternion(new zt),r=new M(0,0,1).applyQuaternion(t),n=new M().copy(ot.DefaultUp);this.isUpVectorFlipped&&n.negate(),n.applyQuaternion(t);let s=new M().copy(ot.DefaultUp).projectOnPlane(r),o=new M().crossVectors(s,n).dot(r)>=0?1:-1;this.angleOffsetFromUp=s.angleTo(n)*o}getViewFrontToObject(t){let r=t.getWorldPosition(new M),s=t.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:r.clone().add(s),target:r}}getViewToObject(t){let r=t.getWorldPosition(new M),s=this.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:r.clone().sub(s),target:r}}setViewplaneSize(t,r){this.left=-t*.5,this.right=t*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=t/r,this.updateProjectionMatrix()}toOrthographic(t){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",(this.enableHelper===!0||t===!0)&&this.objectHelper.update()}toPerspective(t){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",(this.enableHelper===!0||t===!0)&&this.objectHelper.update()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,r,n,s,o,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,r,n,s,o,a):this.orthoCamera.setViewOffset(t,r,n,s,o,a)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(t){this._cameraType==="PerspectiveCamera"?this.toPerspective(t):this._cameraType==="OrthographicCamera"&&this.toOrthographic(t)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,r){return super.copy(t,r),this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=t.targetOffset,this.updateProjectionMatrix(),this}fromCameraRender(t){let r={near:this.orthoCamera.near,far:this.orthoCamera.far},n={near:this.perspCamera.near,far:this.perspCamera.far};return this.copy(t),this.name="",this.enableHelper=!0,this.objectHelper.visible=!0,this.orthoCamera.near=r.near,this.orthoCamera.far=r.far,this.perspCamera.near=n.near,this.perspCamera.far=n.far,this.updateProjectionMatrix(),this}toJSON(t){let r=super.toJSON(t),n=r.object;return n.objectType="CombinedCamera",n.cameraType=this.cameraType,n.targetOffset=this.targetOffset,n.isUpVectorFlipped=this.isUpVectorFlipped,n.angleOffsetFromUp=this.angleOffsetFromUp,n.left=this.left,n.right=this.right,n.top=this.top,n.bottom=this.bottom,this.view!==null&&(n.view=Object.assign({},this.view)),n.zoomOrtho=this.orthoCamera.zoom,n.nearOrtho=this.orthoCamera.near,n.far=this.far,n.aspect=this.aspect,n.fov=this.fov,n.focus=this.focus,n.filmGauge=this.filmGauge,n.filmOffset=this.filmOffset,n.zoomPersp=this.perspCamera.zoom,n.nearPersp=this.perspCamera.near,r}fromJSON(t){var r;if(super.fromJSON(t),this.cameraType=t.cameraType,t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.orbitControlsTarget!==void 0){let n=this.getWorldPosition(new M),s=new M().fromArray(t.orbitControlsTarget);this.targetOffset=s.distanceTo(n)}else t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset);return this.isUpVectorFlipped=!1,this.angleOffsetFromUp=(r=t.angleOffsetFromUp)!=null?r:0,t.left!==void 0&&(this.left=t.left),t.right!==void 0&&(this.right=t.right),t.top!==void 0&&(this.top=t.top),t.bottom!==void 0&&(this.bottom=t.bottom),t.view!==void 0&&(this.view=Object.assign({},t.view)),t.zoomOrtho!==void 0&&(this.orthoCamera.zoom=t.zoomOrtho),t.nearOrtho!==void 0&&(this.orthoCamera.near=t.nearOrtho),t.far!==void 0&&(this.far=t.far),t.aspect!==void 0&&(this.aspect=t.aspect),t.fov!==void 0&&(this.fov=t.fov),t.focus!==void 0&&(this.focus=t.focus),t.filmGauge!==void 0&&(this.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(this.filmOffset=t.filmOffset),t.zoomPersp!==void 0&&(this.perspCamera.zoom=t.zoomPersp),t.nearPersp!==void 0&&(this.perspCamera.near=t.nearPersp),this.updateProjectionMatrix(),this}toCameraState(t=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return wl(r,t)}fromCameraState(t){let{orthographic:r,perspective:n}=t;return t.type!==void 0&&(this.cameraType=t.type),t.far!==void 0&&(this.far=t.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),n!==void 0&&(n.near!==void 0&&(this.perspCamera.near=n.near),n.fov!==void 0&&(this.perspCamera.fov=n.fov),n.zoom!==void 0&&(this.perspCamera.zoom=n.zoom)),t.up!==void 0&&this.up.fromArray(t.up),t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(t){return xe(ie(ie({},super.toState(t)),this.toCameraState(t)),{type:this.cameraType})}fromState(t){return super.fromState(t),this.fromCameraState(t),this}};var gs=class extends Vi(Qn(ts),Zl){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(t,r){let n=new gs().fromState(r);return n.uuid=t,n.enableHelper=!0,n.objectHelper.update(),n}toJSON(t){let r=super.toJSON(t);return r.object.objectType="EmptyObject",r}};var tc=class extends Vi(Qn(ch),Kl){constructor(...t){super(...t);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let n=this.shadow.camera;n.top=1250,n.bottom=-1250,n.right=1250,n.left=-1250,n.near=1,n.far=2500;let s=new Hn(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,n){let s=new tc().fromState(r,n);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Hn&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Hn&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Hn&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),n=r.object;return n.objectType="LightDirectional",n.color=this.color.getHex(),n.intensity=this.intensity,n.shadow=this.shadow.toJSON(),r}fromJSON(t){var s;super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.shadow.normalBias=(s=t.shadow.normalBias)!=null?s:0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray(t.shadow.mapSize);let r=this.shadow.camera,n=t.shadow.camera;return r.near=n.near,r.far=n.far,r.zoom=n.zoom,r.left=n.left,r.right=n.right,r.top=n.top,r.bottom=n.bottom,n.view!==void 0&&(r.view=Object.assign({},n.view)),this}fromDirectionalLightState(t,r){let n=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;return super.fromLightState(t,r),t.size!==void 0&&U1(this,t.size),n&&this.update(),this}fromState(t,r){return super.fromState(t),this.fromDirectionalLightState(t,r),this}};var rc=class extends Vi(Qn(lh),$l){constructor(...t){super(...t);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let n=this.shadow.camera;n.fov=90,n.aspect=1,n.near=100,n.far=2500;let s=new M(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),o=new M(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z),a=new Kt(s,o),l=new Fo(a,new be(16755200));l.visible=!1,this._gizmos.shadowmap=l,this.update()}static createFromState(t,r,n){let s=new rc().fromState(r,n);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Fo&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Fo&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let t in this._gizmos){let r=this._gizmos[t];if(r instanceof Fo){let n=this.shadow.camera,s=new M(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),o=new M(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z);r.box.set(s,o),r.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),n=r.object;return n.objectType="LightPoint",n.color=this.color.getHex(),n.intensity=this.intensity,n.distance=this.distance,n.decay=this.decay,n.shadow=this.shadow.toJSON(),r}fromJSON(t){var s,o;super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.distance=t.distance,this.decay=t.decay,this.shadow.normalBias=(s=t.shadow.normalBias)!=null?s:0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray((o=t.shadow.mapSize)!=null?o:[512,512]),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null);let r=this.shadow.camera,n=t.shadow.camera;return r.near=n.near,r.far=n.far,r.zoom=n.zoom,r.fov=n.fov,r.focus=n.focus,r.aspect=n.aspect,r.filmGauge=n.filmGauge,r.filmOffset=n.filmOffset,n.view!==void 0&&(r.view=Object.assign({},n.view)),this}fromPointLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromPointLightState(t,r),this}};var rA=new M,nA=new M,iA=new zt,nc=class extends Vi(Qn(ah),gu){constructor(...t){super(...t);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let n=this.shadow.camera;n.fov=et.RAD2DEG*2*this.angle,n.aspect=1,n.near=100,n.far=2500;let s=new Hn(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,n){let s=new nc().fromState(r,n);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Hn&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Hn&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Hn&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),nA.setFromMatrixPosition(this.matrixWorld),iA.setFromRotationMatrix(this.matrixWorld),rA.copy(this.up).applyQuaternion(iA).negate().multiplyScalar(this.distance),this.target.position.copy(nA).add(rA),this.target.updateMatrixWorld(),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),n=r.object;return n.objectType="LightSpot",n.color=this.color.getHex(),n.intensity=this.intensity,n.distance=this.distance,n.angle=this.angle,n.decay=this.decay,n.penumbra=this.penumbra,n.shadow=this.shadow.toJSON(),r}fromJSON(t){var s;super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.distance=t.distance,this.angle=t.angle,this.decay=t.decay,this.penumbra=t.penumbra,this.shadow.normalBias=(s=t.shadow.normalBias)!=null?s:0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray(t.shadow.mapSize);let r=this.shadow.camera,n=t.shadow.camera;return r.near=n.near,r.far=n.far,r.zoom=n.zoom,r.fov=n.fov,r.focus=n.focus,r.aspect=n.aspect,r.filmGauge=n.filmGauge,r.filmOffset=n.filmOffset,n.view!==void 0&&(r.view=Object.assign({},n.view)),this}fromSpotLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),this}fromState(t,r){return super.fromState(t),this.fromSpotLightState(t,r),this}};var sA=i=>i.tagName==="VIDEO",$o=class{static resize(e,t,r){let n=e/t,s;if(!r.image)return;let o=r.image;sA(o)?s=o.videoWidth/o.videoHeight:s=o.width/o.height,n>s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*s/n):r.repeat.set(1,1*s/n)),n<s&&(r.imageType=="WEBCAM"?r.repeat.set(1*n/s*-1,1):r.repeat.set(1*n/s,1)),n==s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(e,t,r){let n=e/t,s=r.image!==void 0?r.image.width/r.image.height:1,o;n>s?o={x:1,y:s/n}:n<s?o={x:n/s,y:1}:o={x:1,y:1},r.repeat.set(o.x,o.y),r.updateMatrix()}static resizeTextureLayers(e,t,r){let n=r.userData.layers,s=n.getLayers();for(let o=0;o<s.length;o++){let a=s[o];D1(a)&&($o.resizeTextureLayer(e,t,a.uniforms[`f${a.id}_texture`].value),n.updateLayerUniform())}}static resizeComplex(e,t,r,n){let s=e/t,o,a=r.image;sA(a)?o=a.videoWidth/a.videoHeight:o=a.width/a.height,n.geometry.type.includes("Shape")?(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t*o/s):r.repeat.set(1/e,1/t*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*s/o*-1,1/t):r.repeat.set(1/e*s/o,1/t)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t):r.repeat.set(1/e,1/t))):(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*o/s):r.repeat.set(1,1*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1*s/o*-1,1):r.repeat.set(1*s/o,1)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1)))}};var ic=class extends kt{constructor(t,r=new Yr){super(t,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(t){super.updateGeometry(t),this.material.userData.layers&&$o.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}resizeGeometry(t,r){super.resizeGeometry(t,r,0),this.material.userData.layers&&$o.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh2D",r}clone(){let t=super.clone();return t.updateGeometry({}),t}static fromTexture(t){let r,n;if(t instanceof eh){let a=t.image;r=a.videoWidth*.5,n=a.videoHeight*.5}else{let a=t.image;r=a.width*.5,n=a.height*.5}let s=vp.create({parameters:{width:r,height:n}}),o=new Yr;return o.layersList.changeLayer(0,{type:"texture",texture:t}),o.layersList.moveLayer(0,1),o.dispose(),new ic(s,o)}};var sc=class extends kt{constructor(t,r=new pn){super(t,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh3D",r}};var oc=class extends sc{constructor(t,r=new pn){super(t,r);this.objectType="NonParametric"}toJSON(t){let r=super.toJSON(t);return r.object.objectType="NonParametric",r}};var Wp=class extends cn{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new as(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){let l;try{l=JSON.parse(a)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),l=JSON.parse(a.substring(65,a.length-2))}let c=s.parse(l);t&&t(c)},r,n)}parse(e){return new jp(e)}},jp=class{constructor(e){this.type="Font",this.data=e}generateShapes(e,t=100){let r=[],n=JF(e,t,this.data);for(let s=0,o=n.length;s<o;s++)Array.prototype.push.apply(r,n[s].toShapes());return r}};function JF(i,e,t){let r=Array.from(i),n=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*n,o=[],a=0,l=0;for(let c=0;c<r.length;c++){let h=r[c];if(h===`
|
|
3926
|
+
`)}return r}copy(t){return super.copy(t),t.color&&(this.color=t.color.clone()),this.roughness=t.roughness.clone(),this.metalness=t.metalness.clone(),t.position&&(this.position=t.position.clone()),t.afterColor&&(this.afterColor=t.afterColor.clone()),t.alpha&&(this.alpha=t.alpha.clone()),t.reflectivity&&(this.reflectivity=t.reflectivity.clone()),t.shadingAlpha&&(this.shadingAlpha=t.shadingAlpha.clone()),t.shadingBlend&&(this.shadingBlend=t.shadingBlend.clone()),this}};var Rp=class extends Rn{constructor(t=new Ip,r){super(t,t,r);this.type="StandardNodeMaterial",this.fragment=t}get color(){return this.fragment.color}set color(t){this.fragment.color=t}get afterColor(){return this.fragment.afterColor}set afterColor(t){this.fragment.afterColor=t}get alpha(){return this.fragment.alpha}set alpha(t){this.fragment.alpha=t}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(t){this.fragment.shadingAlpha=t}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(t){this.fragment.shadingBlend=t}get position(){return this.fragment.position}set position(t){this.fragment.position=t}get roughness(){return this.fragment.roughness}set roughness(t){this.fragment.roughness=t}get metalness(){return this.fragment.metalness}set metalness(t){this.fragment.metalness=t}get reflectivity(){return this.fragment.reflectivity}set reflectivity(t){this.fragment.reflectivity=t}};var Yl=class extends Rp{constructor(e,t,r){super(t,e),this.userData.type="PhysicalMaterial",this.userData.category="Physical",this.userData.layers=r!=null?r:this._getLayerStack(e==null?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(e.userData.layers!==void 0&&e.userData.layers instanceof Zr){let t=e.userData.layers,r=e.fragment;super.copy(e);let n=r.clone();this.fragment=n,this.vertex=n;let s=t.clone(this);this.userData.layers=s,n.shadingAlpha.value=r.shadingAlpha.value,n.shadingBlend.value=r.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,r){let n=r.getNode(t.vertex),s=new Yl(void 0,n);return s.fromJSON(t,r),s}dispose(){super.dispose()}};function pr(i,e){let t;if(typeof i=="string"){let r=e==null?void 0:e.getColor(i);r?t=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new Wr(0,0,0,0))}else return"a"in i?new Wr(i.r,i.g,i.b,i.a):new Wr(i.r,i.g,i.b,1);return t}function Bp(i,e){switch(i.data.type){case"light":return mi(i);case"fresnel":return AF(i,e);case"gradient":return TF(i);case"depth":return EF(i);case"normal":return _F(i);case"noise":return CF(i,e);case"texture":return DF(i,e);case"rainbow":return PF(i);case"transmission":return LF(i,e);case"matcap":return IF(i,e);case"displace":return RF(i);case"color":default:return MF(i,e)}}function L1(i){return{type:i.data.type}}function mi(i){let{alpha:e,mode:t}=i.data;return xe(ie({},L1(i)),{alpha:e,mode:t})}function MF(i,e){return xe(ie({},mi(i)),{color:pr(i.data.color,e)})}function AF(i,e){let{bias:t,scale:r,intensity:n,factor:s,color:o}=i.data;return xe(ie({},mi(i)),{color:pr(o,e),bias:t,scale:r,intensity:n,factor:s})}function TF(i){let{gradientType:e,smooth:t,colors:r,steps:n,angle:s,offset:o,morph:a}=i.data;return xe(ie({},mi(i)),{gradientType:e,smooth:t,colors:r.map(l=>new Je(l[0],l[1],l[2],l[3])),num:r.length,steps:n,offset:new B(...o),morph:new B(...a),angle:s})}function EF(i){let{gradientType:e,near:t,far:r,isVector:n,isWorldSpace:s,origin:o,direction:a,colors:l,steps:c,smooth:h,num:u}=i.data;return xe(ie({},mi(i)),{gradientType:e,near:t,far:r,isVector:n,isWorldSpace:s,origin:new M(...o),direction:a?new M(...a):new M(1,0,0),num:u,colors:l.map(f=>new Je(f[0],f[1],f[2],f[3])),steps:c,smooth:h})}function _F(i){let{cnormal:e}=i.data;return xe(ie({},mi(i)),{cnormal:new M(e[0],e[1],e[2])})}function CF(i,e){let{data:t}=i;return xe(ie({},mi(i)),{scale:t.scale,move:t.move,fA:new B(...t.fA),fB:new B(...t.fB),size:new M(...t.size),distortion:new B(...t.distortion),colorA:pr(t.colorA,e),colorB:pr(t.colorB,e),colorC:pr(t.colorC,e),colorD:pr(t.colorD,e),noiseType:t.noiseType})}function DF(i,e){let{projection:t,axis:r,side:n,crop:s,size:o}=i.data,{image:a,wrapping:l,repeat:c,offset:h}=i.data.texture,u=new Dt,f;if(typeof a=="string")f=e==null?void 0:e.getImage(a);else{let d=new Image;d.src=co(a.data),d.onload=()=>{e!=null&&e.onImageLoad&&(e==null||e.onImageLoad())},f=d}return u.image=f,u.repeat.set(c[0],c[1]),u.offset.set(h[0],h[1]),u.wrapS=u.wrapT=l,xe(ie({},mi(i)),{texture:u,mat:new Ft().setUvTransform(h[0],h[1],c[0],c[1],0,0,0),crop:s,projection:t,axis:["x","y","z"].indexOf(r),side:[2,0,1].indexOf(n),size:o})}function PF(i){let{data:e}=i;return xe(ie({},mi(i)),{filmThickness:e.filmThickness,movement:e.movement,wavelengths:new M(...e.wavelengths),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:new M(...e.offset)})}function LF(i,e){let{data:t}=i;return xe(ie({},mi(i)),{thickness:t.thickness,ior:t.ior,roughness:t.roughness,transmissionSamplerMap:e.transmissionSamplerMap,transmissionDepthMap:e.transmissionDepthMap})}function IF(i,e){let t=new Dt,{image:r}=i.data.texture,n;if(typeof r=="string")n=e==null?void 0:e.getImage(r);else{let o=new Image;o.src=co(r.data),o.onload=()=>{e!=null&&e.onImageLoad&&(e==null||e.onImageLoad())},n=o}t.image=n;let s=16777215;return xe(ie({},mi(i)),{color:s,texture:t})}function RF(i){let{data:e}=i,t=xe(ie({},L1(i)),{intensity:e.intensity});if(e.displacementType==="noise")return xe(ie({},t),{offset:new M(...e.offset),scale:e.scale,movement:e.movement,noiseType:e.noiseType});{let r=new Dt,n=new Ft().setUvTransform(0,0,1,1,0,0,0);return xe(ie({},t),{texture:r,mat:n,crop:e.crop})}}function Np(i,e,t){if(t.type==="displace"&&(i==="intensity"||i==="visible")){let r=e.uniforms[`f${e.id}_intensity`];return r?(r.value=t.intensity*(t.visible?1:0),r):void 0}if(t.type!=="displace"&&(i==="alpha"||i==="visible")){let r=e.uniforms[`f${e.id}_alpha`];return r?(r.value=t.alpha*(t.visible?1:0),r):void 0}}var Xl;(e=>{function i(t){return new be(t.x,t.y,t.z).getHex()}e.getHex=i})(Xl||(Xl={}));var I1;(e=>{function i(t){return new Je(t.r,t.g,t.b,t.a)}e.getThreeVector4=i})(I1||(I1={}));var R1;(t=>{function i(r,n){r.setRGB(n.r,n.g,n.b)}t.setThreeColor=i;function e(r){return new be(r.r,r.g,r.b).getHex()}t.getHex=e})(R1||(R1={}));function uu(i,e){return typeof i=="string"?e.getMaterialOrDeletedPlaceholder(i):Tv(i,e)}function B1(i,e){return i.map(t=>uu(t,e))}function Tv(i,e){var o,a;let t=(o=i.layers)!=null?o:hi.defaultTwoLayerData("phong").layers,r=BF(t),n;switch(r.category){case"basic":n=new Yr;break;case"lambert":{n=new jl;break}case"toon":{n=new ql;break}case"physical":n=new Yl;break;case"phong":default:{n=new pn;break}}n.name=(a=i.name)!=null?a:"Untitled Material";let s=n.userData.layers;NF(s);for(let l=t.length-1;l>=0;l--)OF(s,t[l],e);switch(r.category){case"basic":break;case"lambert":{let h=n,f=pr(r.emissive,e);f instanceof be?h.emissive.value=f:h.emissive.value.setHex(Xl.getHex(f));break}case"toon":{let h=n,u=r;h.shininess.value=u.shininess;let f=pr(u.specular,e);f instanceof be?h.specular.value=f:h.specular.value.setHex(Xl.getHex(f));break}case"physical":let l=n,c=r;l.metalness.value=c.metalness,l.roughness.value=c.roughness,l.reflectivity.value=c.reflectivity;break;case"phong":default:{let h=n,u=r;h.shininess.value=u.shininess;let f=pr(u.specular,e);f instanceof be?h.specular.value=f:h.specular.value.setHex(Xl.getHex(f));break}}return s.blendColors(),s.blendAfterColors(),s.blendPositions(),n}function BF(i){for(let e of i)if(e.data.type==="light")return e.data;return{type:"light",category:"basic",visible:!0,alpha:1,mode:0}}function NF(i){for(let e of i.getLayers())i.removeLayer(e.id)}function OF(i,e,t){let r=Bp(e,t);r.type==="transmission"&&(r.transmissionSamplerMap=t==null?void 0:t.transmissionSamplerMap,r.transmissionDepthMap=t==null?void 0:t.transmissionDepthMap);let n=i.addLayer(r);n.uuid=e.id;for(let s in e.data)Np(s,n,e.data)}var Zo=i=>"isEntity"in i,er=i=>"isAbstractMesh"in i,Lt=i=>i!==null&&i.isBooleanMesh,N1=i=>i.objectType==="CombinedCamera",O1=i=>Zo(i)&&(i.objectType==="LightDirectional"||i.objectType==="LightSpot"||i.objectType==="LightPoint");var ms=i=>"objectHelper"in i;function Ev(i,e){var r;let t=!1;e.position&&(i.position.fromArray(e.position),t=!0),e.rotation&&(i.rotation.fromArray(e.rotation),t=!0),e.scale&&(t=!0,i.scale.fromArray(e.scale)),e.hiddenMatrix!==void 0&&"hiddenMatrix"in i&&(t=!0,i.hiddenMatrix.fromArray((r=e.hiddenMatrix)!=null?r:Pi.identity)),t&&(i.updateMatrix(),Lt(i.parent)&&er(i)&&i.invalidateDownstreamBooleanData(!0).recomputeBoolean()),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&i.updateWorldMatrix(!1,!0),i.objectType==="CombinedCamera"&&(e.isUpVectorFlipped!==void 0&&(i.isUpVectorFlipped=e.isUpVectorFlipped),i.updateUp())}function FF(i,e){Ev(i,e),e.name!==void 0&&(i.name=e.name),e.visible!==void 0&&(i.isEntity?i.visibility=e.visible:i.visible=e.visible)}function F1(i,e,t){FF(i,e),e.color!==void 0&&(i.color=pr(e.color,t)),e.intensity!==void 0&&(i.intensity=e.intensity),e.shadows!==void 0&&!(i instanceof Hs)&&(i.castShadow=e.shadows),i.shadow&&!(i instanceof Hs)&&e.depth!==void 0&&(i.shadow.camera.far=e.depth,i.shadow.needsUpdate=!0),e.helper!==void 0&&ms(i)&&(i.enableHelper=e.helper,i.gizmos.shadowmap.visible=e.helper)}function U1(i,e){i.shadow.camera.right=e/2,i.shadow.camera.left=-e/2,i.shadow.camera.top=e/2,i.shadow.camera.bottom=-e/2,i.shadow.needsUpdate=!0}var Ql=new Kt,Xr=new M,Ge=new M,wr=new Ae;function UF(i,e,t=0,r=e.count){let n=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,c=-1/0;for(let h=t;h<r;h++){let u=e.getX(h),f=e.getY(h),d=e.getZ(h);u<n&&(n=u),f<s&&(s=f),d<o&&(o=d),u>a&&(a=u),f>l&&(l=f),d>c&&(c=d)}return i.min.set(n,s,o),i.max.set(a,l,c),i}var z1=(i,e,t,r)=>{var n;if(er(i)){let s=i.geometry.userData.parameters,o=i.geometry.getAttribute("position");i.geometry.userData.type==="SubdivGeometry"?Xr.copy(i.originalGeometry.boundingSphere.center):o!==void 0&&(UF(Ql,o,i.geometry.drawRange.start,i.geometry.drawRange.count<1/0?i.geometry.drawRange.count:o.count),Ql.getCenter(Xr)),i.forceComputeSize?Ql.getSize(Ge).multiplyScalar(.5):Ge.set(s.width,s.height,(n=s.depth)!=null?n:0).multiplyScalar(.5)}else if(ms(i)&&r===!0){let s=i.geometryHelper.getAttribute("position");Ql.setFromArray(s.array),Ql.getCenter(Xr),Ql.getSize(Ge).multiplyScalar(.5)}else Xr.setScalar(0),Ge.setScalar(0);wr.copy(e).multiply(i.matrixWorld),Ge.x===0&&Ge.y===0&&Ge.z===0?t.push(new M(Xr.x,Xr.y,Xr.z).applyMatrix4(wr)):t.push(new M(-Ge.x,Ge.y,Ge.z).add(Xr).applyMatrix4(wr),new M(-Ge.x,-Ge.y,Ge.z).add(Xr).applyMatrix4(wr),new M(Ge.x,-Ge.y,Ge.z).add(Xr).applyMatrix4(wr),new M(Ge.x,Ge.y,Ge.z).add(Xr).applyMatrix4(wr),new M(-Ge.x,Ge.y,-Ge.z).add(Xr).applyMatrix4(wr),new M(-Ge.x,-Ge.y,-Ge.z).add(Xr).applyMatrix4(wr),new M(Ge.x,-Ge.y,-Ge.z).add(Xr).applyMatrix4(wr),new M(Ge.x,Ge.y,-Ge.z).add(Xr).applyMatrix4(wr))},fu=class extends Kt{constructor(){super(...arguments);this.matrix=new Ae;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(r=>r.clone()),this.faces=t.faces.map(r=>r.clone()),this.edges=t.edges.map(r=>r.clone()),this.centerEdges=t.centerEdges.map(r=>r.clone()),this}setFromObjectSize(t,r=!1){t.updateWorldMatrix(!1,r),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let n=new Ae().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,n,r)}expandByObjectSize(t,r,n=!1){let s=[];return n===!0?t.traverseEntity(o=>{o.visible&&z1(o,r,s,t.enableHelper===!0)}):z1(t,r,s,t.enableHelper===!0),this.setFromPoints(s)}getCenter(t){return t=super.getCenter(t),t.applyMatrix4(this.matrix),t}getPositionToCenter(t){return t=super.getCenter(t),t.applyMatrix4(wr.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Ge).multiplyScalar(.5),this.getCenter(Xr),wr.copy(this.matrix).setPosition(Xr),this.vertices=[new M(-Ge.x,Ge.y,Ge.z).applyMatrix4(wr),new M(-Ge.x,-Ge.y,Ge.z).applyMatrix4(wr),new M(Ge.x,-Ge.y,Ge.z).applyMatrix4(wr),new M(Ge.x,Ge.y,Ge.z).applyMatrix4(wr),new M(-Ge.x,Ge.y,-Ge.z).applyMatrix4(wr),new M(-Ge.x,-Ge.y,-Ge.z).applyMatrix4(wr),new M(Ge.x,-Ge.y,-Ge.z).applyMatrix4(wr),new M(Ge.x,Ge.y,-Ge.z).applyMatrix4(wr)]}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=[new Jr(this.vertices[0],this.vertices[3]),new Jr(this.vertices[1],this.vertices[2]),new Jr(this.vertices[5],this.vertices[6]),new Jr(this.vertices[4],this.vertices[7]),new Jr(this.vertices[0],this.vertices[1]),new Jr(this.vertices[3],this.vertices[2]),new Jr(this.vertices[7],this.vertices[6]),new Jr(this.vertices[4],this.vertices[5]),new Jr(this.vertices[0],this.vertices[4]),new Jr(this.vertices[1],this.vertices[5]),new Jr(this.vertices[2],this.vertices[6]),new Jr(this.vertices[3],this.vertices[7])],this.centerEdges=this.edges.map(t=>t.getCenter(new M))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=[new M().copy(this.vertices[0]).sub(this.vertices[2]).multiplyScalar(.5).add(this.vertices[2]),new M().copy(this.vertices[7]).sub(this.vertices[5]).multiplyScalar(.5).add(this.vertices[5]),new M().copy(this.vertices[4]).sub(this.vertices[1]).multiplyScalar(.5).add(this.vertices[1]),new M().copy(this.vertices[3]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6]),new M().copy(this.vertices[4]).sub(this.vertices[3]).multiplyScalar(.5).add(this.vertices[3]),new M().copy(this.vertices[1]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6])]}};function du(i){let e=[];for(let t in i){let r=i[t];delete r.metadata,e.push(r)}return e}function zF(i){let e=[];for(let t in i)e.push(i[t]);return e}var Op=i=>class extends i{hasEntityChild(){return this.children.some(t=>Zo(t))}isDescendantOf(t){t instanceof ot&&(t=t.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===t)return!0;r=r.parent}return!1}attach(t,r){this.updateWorldMatrix(!0,!1);let n=new Ae().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),n.multiply(t.parent.matrixWorld)),Zo(t)?t.hiddenMatrix.premultiply(n):t.applyMatrix4(n),t.updateWorldMatrix(!1,!1),this.add(t),r!==void 0&&(this.children.pop(),this.children.splice(r,0,t)),this}copy(t,r=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),r===!0)for(let n=0;n<t.children.length;n++){let s=t.children[n];this.add(s.clone())}return this}toJSON(t){let r=t===void 0,n={object:{uuid:"",objectType:""}};t===void 0&&(t={geometries:{},materials:{},textures:{},images:{},interactionStates:{},nodes:{}},n.metadata={version:1.5,type:"Object",generator:"Object3D.toJSON"});let s={uuid:this.uuid,objectType:this.type};if(this.name!==""&&(s.name=this.name),s.matrix=this.matrix.toArray(),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),s.layers=this.layers.mask,JSON.stringify(this.userData)!=="{}"&&(s.userData=this.userData),this.children.length>0){s.children=[];for(let o of this.children)(Zo(o)||o instanceof bn)&&s.children.push(o.toJSON(t).object)}if(r){let o=du(t.geometries),a=du(t.materials),l=du(t.textures),c=du(t.images),h=du(t.interactionStates),u=zF(t.nodes);o.length>0&&(n.geometries=o),a.length>0&&(n.materials=a),l.length>0&&(n.textures=l),c.length>0&&(n.images=c),h.length>0&&(n.interactionStates=h),u.length>0&&(n.nodes=u)}return n.object=s,n}fromJSON(t){return this.uuid=t.uuid,t.name!==void 0&&(this.name=t.name),t.matrix!==void 0?(this.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(this.matrixAutoUpdate=t.matrixAutoUpdate),this.matrixAutoUpdate&&this.matrix.decompose(this.position,this.quaternion,this.scale)):(t.position!==void 0&&this.position.fromArray(t.position),t.rotation!==void 0&&this.rotation.fromArray(t.rotation),t.quaternion!==void 0&&this.quaternion.fromArray(t.quaternion),t.scale!==void 0&&this.scale.fromArray(t.scale)),this.castShadow=t.castShadow!==void 0,this.receiveShadow=t.receiveShadow!==void 0,t.visible!==void 0&&(this.visible=t.visible),t.frustumCulled!==void 0&&(this.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(this.renderOrder=t.renderOrder),t.layers!==void 0&&(this.layers.mask=t.layers),t.userData!==void 0&&(this.userData=t.userData),this}};var Xn=i=>"isEntity"in i,G1=i=>"isAbstractMesh"in i,Qn=i=>class extends Op(i){constructor(){super(...arguments);this.objectType="";this.isEntity=!0;this.raycastLock=!1;this.scaleLock=!1;this.hiddenMatrix=new Ae;this._singleBBox=new fu;this._recursiveBBox=new fu;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.forceComputeSize=!1}set visibility(r){this.visible=r;for(let n of this.children)Xn(n)&&n.traverseEntity(s=>{ms(s)&&s.visible&&(s.objectHelper.visible=r)})}get visibility(){return this.visible}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}resetBBoxNeedsUpdate(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.traverseAncestors(r=>{Xn(r)&&(r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0)}),this.traverseEntity(r=>{r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0})}traverseEntity(r){r(this);for(let n of this.children)Xn(n)&&n.traverseEntity(r)}updateMatrixWorld(r){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||r)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,r=!0);for(let n of this.children)n.updateMatrixWorld(r)}updateWorldMatrix(r,n){let s=this.parent;if(r&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),n)for(let o of this.children)o.updateWorldMatrix(!1,!0)}shallowClone(r){return new this.constructor().shallowCopy(this,r)}shallowCopy(r,n=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),n===!0)for(let s of r.children)Xn(s)&&this.add(s.shallowClone());return this}clone(r){return new this.constructor().copy(this,r)}copy(r,n=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),n===!0)for(let s of r.children)Xn(s)&&this.add(s.clone());return this}keepChildrenMatrixWorld(){let r=new Ae,n=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),r.copy(this.matrixWorld).invert(),r.multiply(n);for(let s of this.children)Xn(s)&&s.hiddenMatrix.premultiply(r)}toJSON(r){let n=super.toJSON(r),s=n.object;return this.raycastLock===!0&&(s.raycastLock=!0),this.scaleLock===!0&&(s.scaleLock=!0),s.hiddenMatrix=this.hiddenMatrix.toArray(),n}fromJSON(r){return super.fromJSON(r),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.scaleLock!==void 0&&(this.scaleLock=r.scaleLock),this.hiddenMatrix.fromArray(r.hiddenMatrix),this}fromObject3D(r){let n=r.children;return r.children=[],Object.assign(r,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new Ae}),this.copy(r),r.children=n,this}toObjectTransformState(r=[]){this.updateWorldMatrix(!0,!1);let n={position:this.position.toArray(),rotation:[this.rotation.x,this.rotation.y,this.rotation.z],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return wl(n,r)}fromObjectTransformState(r){return r.position&&this.position.fromArray(r.position),r.rotation&&this.rotation.fromArray(r.rotation),r.scale&&this.scale.fromArray(r.scale),r.hiddenMatrix&&this.hiddenMatrix.fromArray(r.hiddenMatrix),this.updateMatrix(),this}toState(r=[]){let n=ie({name:this.name,visible:this.visible,raycastLock:this.raycastLock},this.toObjectTransformState(r));return wl(n,r)}fromState(r,n){return r.name&&(this.name=r.name),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.type!=="OrthographicCamera"&&r.type!=="PerspectiveCamera"&&(this.matrixAutoUpdate=!1),r.visible!==void 0&&(this.visibility=r.visible),this.fromObjectTransformState(r),this}};var pu=class extends ot{constructor(t,r={}){super();this.object=t;let n=t.recursiveBBox.getSize(new M),s=.1;this.parameters=Ud.defaultData(n.toArray(),s),Vo(this.parameters,r),this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(let t of this.children)t.material=this.object.material}setHideBase(t){if("material"in this.object){if(Array.isArray(this.object.material)){if(this.children.length>0){for(let r of this.object.material)r.visible=!0;if(t){let r=this.object.material.map(n=>n.clone());for(let n of this.children)n.material=r}else for(let r of this.children)r.material=this.object.material}for(let r of this.object.material)r.visible=!t}else{if(this.children.length>0)if(this.object.material.visible=!0,t){let r=this.object.material.clone();for(let n of this.children)n.material=r}else for(let r of this.children)r.material=this.object.material;this.object.material.visible=!t}this.parameters.hideBase=t}}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters)}this.children.forEach(t=>t.updateMatrix())}_updateCount(){let t=this.parameters.type==="grid"?this.parameters.grid.count[0]*this.parameters.grid.count[1]*this.parameters.grid.count[2]:this.parameters.count;if(this.children.length!==t)if(this.children.length<t)for(let r=0,n=t-this.children.length;r<n;++r){let s=this.object.shallowClone(!1);s.visible=!0,this.add(s),this.parameters.hideBase&&this.setHideBase(!0)}else for(let r=0,n=this.children.length-t;r<n;++r)this.remove(this.children[0])}_updateRadial(t){let r=t.radial,n=r.start*et.DEG2RAD,s=r.end*et.DEG2RAD,o=n-s,a=new yn(r.rotation[0]*et.DEG2RAD,r.rotation[1]*et.DEG2RAD,r.rotation[2]*et.DEG2RAD),l;switch(r.axis){case"z":l=new M(0,0,1);break;case"y":l=new M(0,1,0);break;default:case"x":l=new M(1,0,0);break}for(let[c,h]of this.children.entries()){h.hiddenMatrix.identity(),h.scale.x=r.scale[0],h.scale.y=r.scale[1],h.scale.z=r.scale[2],h.position.setScalar(0);let u=o/t.count*c-n;switch(r.axis){case"x":h.rotation.set(0,u,0);break;case"y":h.rotation.set(0,0,u);break;case"z":h.rotation.set(u,0,0);break}h.translateOnAxis(l,r.radius),h.position.x+=r.position[0],h.position.y+=r.position[1],h.position.z+=r.position[2],r.alignment===!0?(h.rotation.x+=a.x,h.rotation.y+=a.y,h.rotation.z+=a.z):h.rotation.copy(a)}}_updateLinear(t){if(t.type!=="linear")throw new Error;let r=t.linear,n=new yn(r.rotation[0]*et.DEG2RAD,r.rotation[1]*et.DEG2RAD,r.rotation[2]*et.DEG2RAD);for(let[s,o]of this.children.entries())o.hiddenMatrix.identity(),o.scale.x=1+(r.scale[0]-1)*s,o.scale.y=1+(r.scale[1]-1)*s,o.scale.z=1+(r.scale[2]-1)*s,o.rotation.x=n.x*s,o.rotation.y=n.y*s,o.rotation.z=n.z*s,o.position.x=r.position[0]*s,o.position.y=r.position[1]*s,o.position.z=r.position[2]*s}_updateGrid(t){let r=0,n=t.grid;if(n.useCenter===!0){let s={x:n.count[0]%2===0?2:1,y:n.count[1]%2===0?2:1,z:n.count[2]%2===0?2:1},o=new M(n.size[0]*(n.count[0]-s.x)*.5,n.size[1]*(n.count[1]-s.y)*.5,n.size[2]*(n.count[2]-s.z)*.5);for(let a=0;a<n.count[0];a++)for(let l=0;l<n.count[1];l++)for(let c=0;c<n.count[2];c++){let h=this.children[r++];h.hiddenMatrix.identity(),h.scale.setScalar(1),h.rotation.set(0,0,0),h.position.x=n.size[0]*a-o.x,h.position.y=n.size[1]*l-o.y,h.position.z=n.size[2]*c-o.z}}else for(let s=0;s<n.count[0];s++)for(let o=0;o<n.count[1];o++)for(let a=0;a<n.count[2];a++){let l=this.children[r++];l.hiddenMatrix.identity(),l.scale.setScalar(1),l.rotation.set(0,0,0),l.position.x=n.size[0]*s,l.position.y=-n.size[1]*o,l.position.z=-n.size[2]*a}}fromJSON(t){return this}toJSON(){return{}}fromClonerState(t){return t.hideBase!==void 0&&this.setHideBase(t.hideBase),Vo(this.parameters,t),this.update(),this}};var kt=class extends Qn(Vt){constructor(t,r){super(t,r);this.isAbstractMesh=!0;this.isBooleanMesh=!1;this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new Ae;this.booleanExclude=null;Array.isArray(r)&&(this.selectedMaterial=0,t.groups.length===0&&t.addGroup(0,t.getAttribute("position").count,0))}get cloner(){return this._cloner}set cloner(t){this._cloner&&this.remove(this._cloner),t&&this.add(t),this._cloner=t}getSelectedMaterial(t){return Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=t!=null?t:0),this.material[t!=null?t:this.selectedMaterial]):this.material}setSelectedMaterial(t,r){Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=r!=null?r:0),r=r!=null?r:this.selectedMaterial,this.material[r].dispose(),this.material[r]=t):(this.material.dispose(),this.material=t)}updateGeometry(t){let r=this.geometry,n=_v[r.userData.type],s=this.objectType==="NonParametric"?Object.assign({},r.userData,{geometry:r}):r.userData,o=n.build(n.normalizeInputs(t,s)),a=r.uuid;if(this.geometry.dispose(),this.geometry=o,this.geometry.uuid=a,this.geometry.computeBoundingSphere(),this.cloner)for(let l of this.cloner.children)l.geometry=this.geometry}resizeGeometry(t,r,n){Xh.resizeGeometry(this.geometry,{width:t,height:r,depth:n})}shallowClone(t){return new this.constructor(this.geometry,this.material).shallowCopy(this,t)}clone(t){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,n=mu(r),s=Array.isArray(this.material)?this.material.map(o=>o.clone()):this.material.clone();return new this.constructor(n,s).copy(this,t)}copy(t,r=!0){return super.copy(t,r),t.cloner&&(this.cloner=new pu(t,t.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(t){t===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new pu(this)),this.cloner.fromClonerState(t))}fromState(t,r){var n,s,o;return super.fromState(t),t.type==="Mesh"&&(this.setFromClonerState(t.cloner),this.castShadow=(n=t.castShadow)!=null?n:!0,this.receiveShadow=(s=t.receiveShadow)!=null?s:!0,this.booleanExclude=(o=t.booleanExclude)!=null?o:null),this}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Jn.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Lt(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)er(t)&&(t.freeBooleanPointer(),Lt(t)&&t.invalidateUpstreamBooleanData())}};var GF=new M(0,0,1),k1=new M,V1=new M,H1=new Ft,ho=class extends kt{constructor(t=Hr.create({}),r=new Yr({side:or})){var n;super(t,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new Yt;this._onShapeUpdate=()=>{this.updateGeometry({}),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=t.userData.shape,(n=this.shape.eventDispatcher)==null||n.addEventListener("update",this._onShapeUpdate)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="VectorObject",r}fromState(t){return super.fromState(t),this.shape.update(),this}setHelperVisibility(){}updateGeometry(t){if(super.updateGeometry(t),"userData"in this.geometry){let r=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:r})}}setShape(t){var r,n;this.shape&&((r=this.shape.eventDispatcher)==null||r.removeEventListener("update",this._onShapeUpdate)),this.shape=t,(n=this.shape.eventDispatcher)==null||n.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),H1.getNormalMatrix(this.matrixWorld),k1.copy(GF).applyMatrix3(H1).normalize(),V1.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(k1,V1)}clone(t){let r=this.shape.clone(),n=this.material.clone(),s=this.geometry.userData,o=Hr.create(Object.assign({},s,{shape:r})),a=new ho(o,n).copy(this,t);return a.shape=r,r.update(),a}raycast(t,r){kt.prototype.raycast.call(this,t,r)}};function Fp(i,e){return kF(i)}function kF(i){let e={parameters:i,type:i.type};if(i.type==="VectorGeometry"){let r=Tt.createFromState(i.shape,i.width,i.height);e.shape=r}else i.type==="NonParametricGeometry"&&(i.data.groups&&i.data.groups.forEach(r=>{var n;return r.materialIndex=Math.max((n=r.materialIndex)!=null?n:0,0)}),e.geometry=new Ws().parse(i));let t;try{t=mu(e)}catch(r){console.error(r)}if(!t){let r=Tt.createFromState(_l.defaultData(),100,100);e.shape=r,t=mu(e)}return t}var Ke;bp.then(i=>{Ke=i});var W1=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),j1=new Uint32Array([0,1,2,3]),q1=new Uint8Array([4]),gi=class{static build(i,e,t,r){let n,s,o;if((i==null?void 0:i.positionWASM)!==void 0){e&&e!==0&&(Ke.free_bvh(e),Ke.free_subdivision_surface(e));try{n=gi.allocate(i,r)}catch(a){console.error(a,i),n=gi.allocate({positionWASM:W1,indexWASM:j1,verticesPerFaceWASM:q1},r)}Ke.set_destination_refinement_level(n,0),s=gi.buildLevel(n,!0,t)}else n=e;if(i!==void 0&&i.subdivisions!==void 0){let a=VF(i.subdivisions,i.positionWASM.length);Ke.set_destination_refinement_level(n,a),a>0?o=gi.buildLevel(n,!1,t):o=null}return{subdivPointer:n,originalGeometry:s,subdividedGeometry:o}}static primitiveToQuads(i,e){i.widthSegments>16&&(i.widthSegments=16),i.heightSegments>16&&(i.heightSegments=16),i.depthSegments>16&&(i.depthSegments=16),i.radialSegments>16&&(i.radialSegments=16),i.type==="DodecahedronGeometry"&&(i.detail=0);let t=i.shape!==void 0?e.geometry:Fp(i),r,n,s,o;return{positions:r,triIndices:o}=Lv(t.getAttribute("position"),t.getIndex()),{indices:n,verticesPerFace:s}=Iv(r,o,t),{positions:r,indices:n,verticesPerFace:s}}static allocate(i,e){var b;let t,r,n,s=[],o=[];i.positionWASM&&i.positionWASM.length>0?(t=i.positionWASM,r=i.indexWASM,n=i.verticesPerFaceWASM):(t=W1,r=j1,n=q1);let a=t.length,l=r.length,c=n.length,h=t.length+s.length+o.length,u=r.length+n.length,f=h*Float32Array.BYTES_PER_ELEMENT+u*Uint32Array.BYTES_PER_ELEMENT,d=h*Float32Array.BYTES_PER_ELEMENT,p=u*Uint32Array.BYTES_PER_ELEMENT,m=Ke._malloc(f),g=new Float32Array(Ke.HEAPF32.buffer,m,h),v=new Uint32Array(Ke.HEAPU32.buffer,m+d,u);g.set(t,0),g.set(s,t.length),g.set(o,t.length+s.length),v.set(r,0),v.set(n,r.length);let y;(b=i==null?void 0:i.scaleBaked)!=null&&b.some(S=>S!==1)&&(y=new Ae().makeScale(...i.scaleBaked)),e&&(y?y.premultiply(e):y=e);let w=y?Ke.alloc_subdivision_surface2(m,a,m+d,l,m+d+r.length*Uint32Array.BYTES_PER_ELEMENT,c,y.elements):Ke.alloc_subdivision_surface(m,a,m+d,l,m+d+r.length*Uint32Array.BYTES_PER_ELEMENT,c);return Ke._free(m),w}static buildLevel(i,e,t,r,n){let s=n?Ke.get_mesh_data2(i,e?Ke.Level.CONTROL:Ke.Level.REFINED,t!=null?t:!e,n.elements):Ke.get_mesh_data(i,e?Ke.Level.CONTROL:Ke.Level.REFINED,t!=null?t:!e),o=8,a=Ke.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(4,4+4),c=0,h=Ke.HEAPU32[a[c]>>2],u=Ke.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let f=Ke.HEAPU32[a[c]>>2],d=Ke.HEAPF32.subarray(f>>2,(f>>2)+l[c]);c++;let p=Ke.HEAPU32[a[c]>>2],m=Ke.HEAPU32.subarray(p>>2,(p>>2)+l[c]);c++;let g=Ke.HEAPU32[a[c]>>2],v=Ke.HEAPU32.subarray(g>>2,(g>>2)+l[c]);if(c++,r===void 0){let y=new Le;if(y.setIndex(new Os(v,1)),y.setAttribute("position",new Ce(u,3)),y.setAttribute("normal",new Ce(d,3)),e){y.setAttribute("faceMap",new Os(m,1));let w=new Float32Array(d.length/3*4).fill(0);y.setAttribute("color",new Ve(w,4))}return Ke.free_mesh_data(s),y.userData.type="SubdivGeometry",y}r.getAttribute("position").copyArray(u),r.getAttribute("normal").copyArray(d),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,Ke.free_mesh_data(s)}static buildControlCageWireframe(i,e,t){let r=Ke.get_wireframe_data_for_base_level(i),n=4,s=Ke.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(2,2+2),a=0,l=Ke.HEAPU32[s[a]>>2],c=Ke.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let h=Ke.HEAPU32[s[a]>>2],u=Ke.HEAPU32.subarray(h>>2,(h>>2)+o[a]);if(e===void 0){let f=new Le;f.setAttribute("position",new Ce(c,3));let d=new Float32Array(c.length);for(let p=0,m=c.length;p<m;)d[p++]=t.r,d[p++]=t.g,d[p++]=t.b;return f.setAttribute("color",new Ve(d,3)),f.setIndex(new Os(u,1)),Ke.free_wireframe_data_for_base_level(r),f}e.getAttribute("position").copyArray(c),e.attributes.position.needsUpdate=!0,Ke.free_wireframe_data_for_base_level(r)}static updateCollabMesh(i,e,t){e||Ke.set_destination_refinement_level(i,1);let r=t?Ke.get_topological_data2(i,e?Ke.Level.CONTROL:Ke.Level.REFINED,t.elements):Ke.get_topological_data(i,e?Ke.Level.CONTROL:Ke.Level.REFINED),n=6,s=Ke.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(3,3+3),a=0,l=Ke.HEAPU32[s[a]>>2],c=new Float32Array(Ke.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let h=Ke.HEAPU32[s[a]>>2],u=new Uint32Array(Ke.HEAPU32.subarray(h>>2,(h>>2)+o[a]));a++;let f=Ke.HEAPU32[s[a]>>2],d=new Uint8Array(Ke.HEAPU32.subarray(f>>2,(f>>2)+o[a]));return Ke.free_topological_data(r),{positions:c,indices:u,verticesPerFace:d}}};function VF(i,e){let t=i;return t=Math.min(t,3-Math.ceil(Math.log(e/172e3)/Math.log(4))),Math.max(t,0)}var Y1=["getX","getY","getZ"];function Lv(i,e){let t={},r=e?e.count:i.count,n=0,s=[],o=[],a=1e4;for(let c=0;c<r;c++){let h=e?e.getX(c):c,u="";for(let f=0;f<3;f++)u+=`${~~(i[Y1[f]](h)*a)},`;if(u in t)s.push(t[u]);else{for(let f=0;f<3;f++)o.push(i[Y1[f]](h));t[u]=n,s.push(n),n++}}let l=[];for(let c=0;c<s.length;c+=3)s[c]===s[c+1]||s[c]===s[c+2]||s[c+1]===s[c+2]||l.push(s[c],s[c+1],s[c+2]);return{positions:o,triIndices:l}}var Up=new M,Cv=new M,Dv=new M,Pv=new M;function Iv(i,e,t){var s;let r=[],n=[];if(t.userData.shape!==void 0&&t.userData.parameters.depth===0){let o=t.userData.shape.extractShapePointsToFlatArray([]),a=0;for(let c=0;c<o.length;c+=2)a+=(o[c]-o[(c===0?o.length:c)-2])*(o[c+1]+o[(c===0?o.length:c)-1]);i.length=0;let l=0;if(a<0)for(let c=0;c<o.length;c+=2)i.push(o[c],o[c+1],0),r.push(l++);else for(let c=o.length-2;c>=0;c-=2)i.push(o[c],o[c+1],0),r.push(l++);return n.push(l),{indices:r,verticesPerFace:n}}for(let o=0,a=(s=t.capStartIndex)!=null?s:e.length;o<a;)if(e[o+1]===e[o+3]&&e[o+2]===e[o+5]||e[o+0]===e[o+3]&&e[o+2]===e[o+4]){Up.set(i[e[o]*3],i[e[o]*3+1],i[e[o]*3+2]),Cv.set(i[e[o+1]*3],i[e[o+1]*3+1],i[e[o+1]*3+2]),Dv.set(i[e[o+4]*3],i[e[o+4]*3+1],i[e[o+4]*3+2]),Pv.set(i[e[o+5]*3],i[e[o+5]*3+1],i[e[o+5]*3+2]),Cv.sub(Up).normalize(),Dv.sub(Up).normalize(),Pv.sub(Up).normalize();let l=Cv.cross(Dv).dot(Pv);Math.abs(l)>.005?(r.push(e[o],e[o+1],e[o+2]),n.push(3),o+=3):(r.push(e[o],e[o+1],e[o+4],e[o+5]),n.push(4),o+=6)}else r.push(e[o],e[o+1],e[o+2]),n.push(3),o+=3;if(t.capStartIndex!==void 0){let o=[],a=[],l=0;for(let c=0,h=0;c<i.length;c+=3,h++)i[c+2]===0&&(o.push(h),l++),i[c+2]===t.userData.parameters.depth&&a.push(h);if(t.userData.parameters.extrudeBevelSize===0){let c=a[0];a[0]=a[1],a[1]=c}o.reverse(),r.push(...o,...a),n.push(l,l)}return{indices:r,verticesPerFace:n}}var Jn={};Tx(Jn,{calcBoolean:()=>jF,calcBooleanTopological:()=>WF,freeMeshSet:()=>XF,getMeshSet:()=>qF,transformMeshSet:()=>YF});var Q1,J1=new Promise(i=>{Q1=i}),X1=!1;async function K1(){if(X1)return;let e=!1?".":"https://unpkg.com/@splinetool/boolean-wasm@0.9.53/build",[t,r]=await Promise.all([import("./boolean.js"),fetch(`${e}/boolean.wasm`).then(o=>o.arrayBuffer())]),s=await t.default({wasmBinary:r});Q1(s),X1=!0}var gt,Jl;J1.then(i=>gt=i);function HF(i,e){let t,{positions:r,triIndices:n}=Lv(i.getAttribute("position"),i.getIndex()),s;if(e){let{indices:o,verticesPerFace:a}=Iv(r,n,i);s=a.length,t=[];for(let l=0,c=0;l<s;l++){t.push(a[l]);for(let h=0;h<a[l];h++)t.push(o[c++])}}else{let o=n.length;t=Array(o+o/3),s=0;for(let a=0,l=0;l<t.length;)t[l++]=3,s++,t[l++]=n[a++],t[l++]=n[a++],t[l++]=n[a++]}return{positions:r,faceIndices:t,nFaces:s}}function Z1(i){let e=i.length,t=e*Uint32Array.BYTES_PER_ELEMENT,r=e*Float32Array.BYTES_PER_ELEMENT,n=Number.isInteger(i[0])?t:r,s=gt._malloc(n);return(Number.isInteger(i[0])?new Uint32Array(gt.HEAPU32.buffer,s,e):new Float32Array(gt.HEAPF32.buffer,s,e)).set(i,0),s}function $1(i){switch(i){case 0:return gt.OP.UNION;case 1:return gt.OP.INTERSECTION;case 2:return gt.OP.A_MINUS_B;case 3:return gt.OP.B_MINUS_A;case 4:return gt.OP.SYMMETRIC_DIFFERENCE;case 5:return gt.OP.ALL;default:throw new Error("Unknown boolean operation "+i)}}function WF(i,e){Jl===void 0&&(Jl=gt.init_csg());let t=Z1(i),r=gt.csg_calc_topological(Jl,t,i.length,$1(e));gt._free(t);let n=6,s=gt.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(3,3+3),a=0,l=gt.HEAPU32[s[a]>>2],c=new Float32Array(gt.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let h=gt.HEAPU32[s[a]>>2],u=new Uint32Array(gt.HEAPU32.subarray(h>>2,(h>>2)+o[a]));a++;let f=gt.HEAPU32[s[a]>>2],d=new Uint8Array(gt.HEAPU32.subarray(f>>2,(f>>2)+o[a]));return gt.free_mesh_data(r),{positions:c,indices:u,verticesPerFace:d}}function jF(i,e,t){Jl===void 0&&(Jl=gt.init_csg());let r=Z1(i),n=gt.csg_calc(Jl,r,i.length,$1(e));gt._free(r);let s=5,o=gt.HEAPU32.subarray(n>>2,(n>>2)+s),a=o.subarray(2,2+3),l=0,c=gt.HEAPU32[o[l]>>2],h=gt.HEAPF32.subarray(c>>2,(c>>2)+a[l]);l++;let u=gt.HEAPU32[o[l]>>2],f=gt.HEAPF32.subarray(u>>2,(u>>2)+a[l]);l++;let d=a[l];t.setAttribute("position",new Ce(h,3)),t.setAttribute("normal",new Ce(f,3));let p=gt.HEAPF32.subarray((n>>2)+5,(n>>2)+5+6);return t.boundingSphere===null&&(t.boundingSphere=new Lr),t.boundingSphere.center.set(p[0],p[1],p[2]),t.boundingSphere.radius=(p[3]**2+p[4]**2+p[5]**2)**.5,t.userData.parameters={width:p[3]*2,height:p[4]*2,depth:p[5]*2},gt.free_mesh_data(n),d}function qF(i,e){if(gt===void 0)return-1;let t,r,n;if(e&&i.userData.positions!==void 0){let m=i.userData;n=m.verticesPerFace.length,t=m.positions,r=Array(m.verticesPerFace.reduce((g,v)=>g+v,0)+n);for(let g=0,v=0,y=0;g<m.verticesPerFace.length;g++){r[y++]=m.verticesPerFace[g];for(let w=0;w<m.verticesPerFace[g];w++)r[y++]=m.indices[v++]}}else({positions:t,faceIndices:r,nFaces:n}=HF(i,e));let s=t.length,o=r.length,a=t.length,l=r.length,c=a*Float32Array.BYTES_PER_ELEMENT+l*Uint32Array.BYTES_PER_ELEMENT,h=a*Float32Array.BYTES_PER_ELEMENT,u=l*Uint32Array.BYTES_PER_ELEMENT,f=gt._malloc(c),d=new Float32Array(gt.HEAPF32.buffer,f,a),p=new Uint32Array(gt.HEAPU32.buffer,f+h,l);return d.set(t,0),p.set(r,0),gt.get_csg_mesh(f,s,f+h,o,n)}function YF(i,e){gt.transform_csg_mesh(i,e.elements)}function XF(i){gt.free_csg_mesh(i)}var _v={ConeGeometry:VM,CubeGeometry:HM,CylinderGeometry:kM,DodecahedronGeometry:WM,EllipseGeometry:c1,HelixGeometry:d1,IcosahedronGeometry:p1,LatheGeometry:m1,NonParametricGeometry:g1,PolygonGeometry:y1,PyramidGeometry:v1,RectangleGeometry:vp,SphereGeometry:x1,PlaneGeometry:b1,StarGeometry:w1,TextFrameGeometry:xp,TorusGeometry:S1,TorusKnotGeometry:M1,TriangleGeometry:A1,VectorGeometry:Hr},mu=i=>_v[i.type].create(i);var eA=new Ae;function Rv(i){let e=!1;return i.scene.objects.traverse((t,r)=>{var n;((n=r.geometry)==null?void 0:n.type)==="BooleanGeometry"&&(e=!0)}),e}var zp=class extends kt{constructor(t=new Le,r=new pn){super(t,r);this.booleanOp=2;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.isBooleanMesh=!0,this.castShadow=!0,this.receiveShadow=!0,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}reInit(){this.isBooleanMesh=!0,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}recomputeBoolean(t){if(this.booleanMeshSetAddress!==-1)return;for(let n=0;n<this.children.length;n++){let s=this.children[n];Lt(s)&&s.recomputeBoolean(t===!0)}this.meshSetAddresses=[];for(let n=0;n<this.children.length;n++){let s=this.children[n];if(G1(s)&&s.booleanExclude===!1&&s.geometry.drawRange.count>0){if(s.booleanMeshSetAddress===-1){if(s.booleanMeshSetAddress=Jn.getMeshSet(s.geometry,t===!0),s.booleanMeshSetAddress===-1)return;Jn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1}else Lt(s)&&s.needsTransformForDownstream===!0?(Jn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.needsTransformForDownstream=!1):s.booleanWasTransformed===!0&&(eA.multiplyMatrices(s.matrix,s.booleanMatrixInvOld),Jn.transformMeshSet(s.booleanMeshSetAddress,eA),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1);this.meshSetAddresses.push(s.booleanMeshSetAddress)}}if(this.meshSetAddresses.length===0){this.geometry.setDrawRange(0,0);return}if(t===!0)return Jn.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new Le,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere,this.booleanMeshSetAddress=Jn.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry),this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh3D",r}updateGeometry(t){this.booleanOp=t.parameters.operation,this.invalidateDownstreamBooleanData().recomputeBoolean()}};var Gi=i=>{var e;return e=class extends i{constructor(){super(...arguments);this.isObjectHelper=!0}},e.geometryHelper=new vn(30,30,30),e};var Gp=new si,Bv=new Lr,tA=new Ae,ki=(i,e,t,r,n=!1)=>{let s=e,o=i.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),Bv.copy(s.boundingSphere),Bv.applyMatrix4(o),t.ray.intersectsSphere(Bv)===!1||(tA.copy(o).invert(),Gp.copy(t.ray).applyMatrix4(tA),s.boundingBox!==null&&Gp.intersectsBox(s.boundingBox)===!1))return;let a,l,c,h,u=s.index,f=s.attributes.position,d=s.drawRange,p,m;if(n===!1){let v=Math.max(0,d.start),y=Math.min(u.count,d.start+d.count);for(p=v,m=y;p<m;p+=3)if(l=u.getX(p),c=u.getX(p+1),h=u.getX(p+2),a=g(i,t,Gp,f,l,c,h),a){a.faceIndex=Math.floor(p/3),r.push(a);return}}else{let y=s.attributes.position,w=new M,b=new M,S=new M,T=new M,A=2,E=1/((i.scale.x+i.scale.y+i.scale.z)/3),_=E*E,C=Math.max(0,d.start),I=Math.min(y.count,d.start+d.count);for(let N=C,R=I-1;N<R;N+=A){if(w.fromBufferAttribute(y,N),b.fromBufferAttribute(y,N+1),Gp.distanceSqToSegment(w,b,T,S)>_)continue;T.applyMatrix4(i.matrixWorld);let G=t.ray.origin.distanceTo(T);G<t.near||G>t.far||r.push({distance:G,point:S.clone().applyMatrix4(i.matrixWorld),object:i})}}function g(v,y,w,b,S,T,A){let x=new M,E=new M,_=new M,C=new M,I=new M;if(x.fromBufferAttribute(b,S),E.fromBufferAttribute(b,T),_.fromBufferAttribute(b,A),w.intersectTriangle(x,E,_,!1,C)===null)return null;I.copy(C),I.applyMatrix4(v.matrixWorld);let R=y.ray.origin.distanceTo(I);return R<y.near||R>y.far?null:{faceIndex:1,distance:R,point:I.clone(),object:v}}};var kp=new M,Kn=new Gn,Nv=class extends ai{constructor(t){let r=new Le,n=new kr({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],o=[],a={},l=new be(15711266),c=new be(15711266),h=new be(2857471);u("n1","n2",l),u("n2","n4",l),u("n4","n3",l),u("n3","n1",l),u("f1","f2",l),u("f2","f4",l),u("f4","f3",l),u("f3","f1",l),u("n1","f1",l),u("n2","f2",l),u("n3","f3",l),u("n4","f4",l),u("p","n1",c),u("p","n2",c),u("p","n3",c),u("p","n4",c),u("u1","u2",h),u("u2","u3",h),u("u3","u1",h);function u(d,p,m){f(d,m),f(p,m)}function f(d,p){s.push(0,0,0),o.push(p.r,p.g,p.b),a[d]===void 0&&(a[d]=[]),a[d].push(s.length/3-1)}r.setAttribute("position",new Ce(s,3)),r.setAttribute("color",new Ce(o,3));super(r,n);this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let t=this.geometry,r=this.pointMap,n=!0;Kn.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,o=1,a=n?.8:1e-4;yi("n1",r,t,Kn,-s,-o,a),yi("n2",r,t,Kn,s,-o,a),yi("n3",r,t,Kn,-s,o,a),yi("n4",r,t,Kn,s,o,a);let l=a;yi("f1",r,t,Kn,-s,-o,l),yi("f2",r,t,Kn,s,-o,l),yi("f3",r,t,Kn,-s,o,l),yi("f4",r,t,Kn,s,o,l);let c=l,h=.5;yi("u1",r,t,Kn,s*.7*h,o*1.1,c),yi("u2",r,t,Kn,-s*.7*h,o*1.1,c),yi("u3",r,t,Kn,0,o*(1.1+.9*h),c),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function yi(i,e,t,r,n,s,o){kp.set(n,s,o).unproject(r);let a=e[i];if(a!==void 0){let l=t.getAttribute("position");for(let c=0,h=a.length;c<h;c++)l.setXYZ(a[c],kp.x,kp.y,kp.z)}}var Vp=class extends Gi(Nv){constructor(t){super(t);this.object=t;this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,r){ki(this.object,this.geometry,t,r,!0)}};var Kl=class extends Gi(Qf){constructor(t,r=15,n=10066329){super(t,r,n);this.object=t;this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,r){ki(this.object,Kl.geometryHelper,t,r)}};var Zl=class extends Gi(Jf){constructor(t,r=15){super(r);this.object=t;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}raycast(t,r){ki(this.object,Zl.geometryHelper,t,r)}update(){}};var $l=class extends Gi(Xf){constructor(t,r=15,n=6710886){super(t,r,n);this.object=t;this.name=`PointLightHelper: ${t.uuid}`}raycast(t,r){ki(this.object,$l.geometryHelper,t,r)}};var Hp=class extends Gi(Yf){constructor(t,r=6710886){super(t,r);this.object=t;this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,r){ki(this.object,Hp.geometryHelper,t,r)}update(){if(this.object!==void 0){let t=Hp._vector,r=this.object.distance?this.object.distance:1e3,n=r*Math.tan(this.object.angle);this.cone.scale.set(n,n,r),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let o=0,a=this.cone.material.length;o<a;o++)this.cone.material[o].color.set(s);else this.cone.material.color.set(s)}}},gu=Hp;gu._vector=new M;var Vi=(i,e)=>class extends i{constructor(){super(...arguments);this.objectHelper=new e(this);this.enableHelper=!1}set visibility(n){this.visible=n,this.setHelperVisibility(n),this.setHelperChildrenVisibility(n)}get visibility(){return this.visible}get geometryHelper(){return e.geometryHelper}setHelperVisibility(n){this.objectHelper.visible=n}setHelperChildrenVisibility(n){for(let s of this.children)Xn(s)&&s.traverseEntity(o=>{ms(o)&&o.visible&&(o.objectHelper.visible=n)})}raycast(n,s){this.objectHelper.raycast(n,s)}copy(n,s=!0){return super.copy(n,s),n.enableHelper!==void 0&&(this.enableHelper=n.enableHelper),n.objectHelper!==void 0&&(this.objectHelper.visible=n.objectHelper.visible),this}toJSON(n){let s=super.toJSON(n),o=s.object;return o.enableHelper=this.enableHelper,s}fromJSON(n){return super.fromJSON(n),n.enableHelper!==void 0&&(this.enableHelper=!0),this}fromLightState(n,s){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let o=this;n.color!==void 0&&(o.color=pr(n.color,s)),n.intensity!==void 0&&(o.intensity=n.intensity),n.depth!==void 0&&(o.shadow.camera.far=n.depth,o.shadow.needsUpdate=!0),n.shadows!==void 0&&(this.castShadow=n.shadows),n.helper!==void 0&&(this.enableHelper=n.helper,o.gizmos.shadowmap.visible=n.helper)}return this}};var ec=new M,Ov=new M,Bn=class extends Vi(Qn(Gn),Vp){constructor(t=window.innerWidth,r=window.innerHeight,n=45,s,o=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=Wo.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=t,this.height=r,this.orthoCamera=new Co(t*-.5,t*.5,r*.5,r*-.5,s!=null?s:-5e4,o),this.perspCamera=new sr(n,t/r,s!=null?s:50,o),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic(!0)}static createFromState(t,r){let n=new Bn().fromState(r);return n.enableHelper=!0,n.objectHelper.update(),n.uuid=t,n}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(t,r){t==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(t,r){r>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t){super.lookAt(t),this.getWorldPosition(ec),this.targetOffset=ec.distanceTo(t)}getTarget(t=new M){return this.getWorldDirection(Ov),this.getWorldPosition(ec),Ov.multiplyScalar(this.targetOffset),t.copy(ec).add(Ov),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(ec),ec.distanceTo(t)}updateUp(){let t=this.getWorldQuaternion(new zt),r=new M(0,0,1).applyQuaternion(t),n=new M().copy(ot.DefaultUp);this.isUpVectorFlipped&&n.negate(),n.applyQuaternion(t);let s=new M().copy(ot.DefaultUp).projectOnPlane(r),o=new M().crossVectors(s,n).dot(r)>=0?1:-1;this.angleOffsetFromUp=s.angleTo(n)*o}getViewFrontToObject(t){let r=t.getWorldPosition(new M),s=t.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:r.clone().add(s),target:r}}getViewToObject(t){let r=t.getWorldPosition(new M),s=this.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:r.clone().sub(s),target:r}}setViewplaneSize(t,r){this.left=-t*.5,this.right=t*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=t/r,this.updateProjectionMatrix()}toOrthographic(t){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",(this.enableHelper===!0||t===!0)&&this.objectHelper.update()}toPerspective(t){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",(this.enableHelper===!0||t===!0)&&this.objectHelper.update()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,r,n,s,o,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,r,n,s,o,a):this.orthoCamera.setViewOffset(t,r,n,s,o,a)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(t){this._cameraType==="PerspectiveCamera"?this.toPerspective(t):this._cameraType==="OrthographicCamera"&&this.toOrthographic(t)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,r){return super.copy(t,r),this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=t.targetOffset,this.updateProjectionMatrix(),this}fromCameraRender(t){let r={near:this.orthoCamera.near,far:this.orthoCamera.far},n={near:this.perspCamera.near,far:this.perspCamera.far};return this.copy(t),this.name="",this.enableHelper=!0,this.objectHelper.visible=!0,this.orthoCamera.near=r.near,this.orthoCamera.far=r.far,this.perspCamera.near=n.near,this.perspCamera.far=n.far,this.updateProjectionMatrix(),this}toJSON(t){let r=super.toJSON(t),n=r.object;return n.objectType="CombinedCamera",n.cameraType=this.cameraType,n.targetOffset=this.targetOffset,n.isUpVectorFlipped=this.isUpVectorFlipped,n.angleOffsetFromUp=this.angleOffsetFromUp,n.left=this.left,n.right=this.right,n.top=this.top,n.bottom=this.bottom,this.view!==null&&(n.view=Object.assign({},this.view)),n.zoomOrtho=this.orthoCamera.zoom,n.nearOrtho=this.orthoCamera.near,n.far=this.far,n.aspect=this.aspect,n.fov=this.fov,n.focus=this.focus,n.filmGauge=this.filmGauge,n.filmOffset=this.filmOffset,n.zoomPersp=this.perspCamera.zoom,n.nearPersp=this.perspCamera.near,r}fromJSON(t){var r;if(super.fromJSON(t),this.cameraType=t.cameraType,t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.orbitControlsTarget!==void 0){let n=this.getWorldPosition(new M),s=new M().fromArray(t.orbitControlsTarget);this.targetOffset=s.distanceTo(n)}else t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset);return this.isUpVectorFlipped=!1,this.angleOffsetFromUp=(r=t.angleOffsetFromUp)!=null?r:0,t.left!==void 0&&(this.left=t.left),t.right!==void 0&&(this.right=t.right),t.top!==void 0&&(this.top=t.top),t.bottom!==void 0&&(this.bottom=t.bottom),t.view!==void 0&&(this.view=Object.assign({},t.view)),t.zoomOrtho!==void 0&&(this.orthoCamera.zoom=t.zoomOrtho),t.nearOrtho!==void 0&&(this.orthoCamera.near=t.nearOrtho),t.far!==void 0&&(this.far=t.far),t.aspect!==void 0&&(this.aspect=t.aspect),t.fov!==void 0&&(this.fov=t.fov),t.focus!==void 0&&(this.focus=t.focus),t.filmGauge!==void 0&&(this.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(this.filmOffset=t.filmOffset),t.zoomPersp!==void 0&&(this.perspCamera.zoom=t.zoomPersp),t.nearPersp!==void 0&&(this.perspCamera.near=t.nearPersp),this.updateProjectionMatrix(),this}toCameraState(t=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return wl(r,t)}fromCameraState(t){let{orthographic:r,perspective:n}=t;return t.type!==void 0&&(this.cameraType=t.type),t.far!==void 0&&(this.far=t.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),n!==void 0&&(n.near!==void 0&&(this.perspCamera.near=n.near),n.fov!==void 0&&(this.perspCamera.fov=n.fov),n.zoom!==void 0&&(this.perspCamera.zoom=n.zoom)),t.up!==void 0&&this.up.fromArray(t.up),t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(t){return xe(ie(ie({},super.toState(t)),this.toCameraState(t)),{type:this.cameraType})}fromState(t){return super.fromState(t),this.fromCameraState(t),this}};var gs=class extends Vi(Qn(ts),Zl){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(t,r){let n=new gs().fromState(r);return n.uuid=t,n.enableHelper=!0,n.objectHelper.update(),n}toJSON(t){let r=super.toJSON(t);return r.object.objectType="EmptyObject",r}};var tc=class extends Vi(Qn(ch),Kl){constructor(...t){super(...t);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let n=this.shadow.camera;n.top=1250,n.bottom=-1250,n.right=1250,n.left=-1250,n.near=1,n.far=2500;let s=new Hn(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,n){let s=new tc().fromState(r,n);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Hn&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Hn&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Hn&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),n=r.object;return n.objectType="LightDirectional",n.color=this.color.getHex(),n.intensity=this.intensity,n.shadow=this.shadow.toJSON(),r}fromJSON(t){var s;super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.shadow.normalBias=(s=t.shadow.normalBias)!=null?s:0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray(t.shadow.mapSize);let r=this.shadow.camera,n=t.shadow.camera;return r.near=n.near,r.far=n.far,r.zoom=n.zoom,r.left=n.left,r.right=n.right,r.top=n.top,r.bottom=n.bottom,n.view!==void 0&&(r.view=Object.assign({},n.view)),this}fromDirectionalLightState(t,r){let n=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;return super.fromLightState(t,r),t.size!==void 0&&U1(this,t.size),n&&this.update(),this}fromState(t,r){return super.fromState(t),this.fromDirectionalLightState(t,r),this}};var rc=class extends Vi(Qn(lh),$l){constructor(...t){super(...t);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let n=this.shadow.camera;n.fov=90,n.aspect=1,n.near=100,n.far=2500;let s=new M(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),o=new M(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z),a=new Kt(s,o),l=new Fo(a,new be(16755200));l.visible=!1,this._gizmos.shadowmap=l,this.update()}static createFromState(t,r,n){let s=new rc().fromState(r,n);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Fo&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Fo&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let t in this._gizmos){let r=this._gizmos[t];if(r instanceof Fo){let n=this.shadow.camera,s=new M(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),o=new M(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z);r.box.set(s,o),r.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),n=r.object;return n.objectType="LightPoint",n.color=this.color.getHex(),n.intensity=this.intensity,n.distance=this.distance,n.decay=this.decay,n.shadow=this.shadow.toJSON(),r}fromJSON(t){var s,o;super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.distance=t.distance,this.decay=t.decay,this.shadow.normalBias=(s=t.shadow.normalBias)!=null?s:0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray((o=t.shadow.mapSize)!=null?o:[512,512]),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null);let r=this.shadow.camera,n=t.shadow.camera;return r.near=n.near,r.far=n.far,r.zoom=n.zoom,r.fov=n.fov,r.focus=n.focus,r.aspect=n.aspect,r.filmGauge=n.filmGauge,r.filmOffset=n.filmOffset,n.view!==void 0&&(r.view=Object.assign({},n.view)),this}fromPointLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromPointLightState(t,r),this}};var rA=new M,nA=new M,iA=new zt,nc=class extends Vi(Qn(ah),gu){constructor(...t){super(...t);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let n=this.shadow.camera;n.fov=et.RAD2DEG*2*this.angle,n.aspect=1,n.near=100,n.far=2500;let s=new Hn(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,n){let s=new nc().fromState(r,n);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Hn&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Hn&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Hn&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),nA.setFromMatrixPosition(this.matrixWorld),iA.setFromRotationMatrix(this.matrixWorld),rA.copy(this.up).applyQuaternion(iA).negate().multiplyScalar(this.distance),this.target.position.copy(nA).add(rA),this.target.updateMatrixWorld(),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),n=r.object;return n.objectType="LightSpot",n.color=this.color.getHex(),n.intensity=this.intensity,n.distance=this.distance,n.angle=this.angle,n.decay=this.decay,n.penumbra=this.penumbra,n.shadow=this.shadow.toJSON(),r}fromJSON(t){var s;super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.distance=t.distance,this.angle=t.angle,this.decay=t.decay,this.penumbra=t.penumbra,this.shadow.normalBias=(s=t.shadow.normalBias)!=null?s:0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray(t.shadow.mapSize);let r=this.shadow.camera,n=t.shadow.camera;return r.near=n.near,r.far=n.far,r.zoom=n.zoom,r.fov=n.fov,r.focus=n.focus,r.aspect=n.aspect,r.filmGauge=n.filmGauge,r.filmOffset=n.filmOffset,n.view!==void 0&&(r.view=Object.assign({},n.view)),this}fromSpotLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),this}fromState(t,r){return super.fromState(t),this.fromSpotLightState(t,r),this}};var sA=i=>i.tagName==="VIDEO",$o=class{static resize(e,t,r){let n=e/t,s;if(!r.image)return;let o=r.image;sA(o)?s=o.videoWidth/o.videoHeight:s=o.width/o.height,n>s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*s/n):r.repeat.set(1,1*s/n)),n<s&&(r.imageType=="WEBCAM"?r.repeat.set(1*n/s*-1,1):r.repeat.set(1*n/s,1)),n==s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(e,t,r){let n=e/t,s=r.image!==void 0?r.image.width/r.image.height:1,o;n>s?o={x:1,y:s/n}:n<s?o={x:n/s,y:1}:o={x:1,y:1},r.repeat.set(o.x,o.y),r.updateMatrix()}static resizeTextureLayers(e,t,r){let n=r.userData.layers,s=n.getLayers();for(let o=0;o<s.length;o++){let a=s[o];D1(a)&&($o.resizeTextureLayer(e,t,a.uniforms[`f${a.id}_texture`].value),n.updateLayerUniform())}}static resizeComplex(e,t,r,n){let s=e/t,o,a=r.image;sA(a)?o=a.videoWidth/a.videoHeight:o=a.width/a.height,n.geometry.type.includes("Shape")?(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t*o/s):r.repeat.set(1/e,1/t*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*s/o*-1,1/t):r.repeat.set(1/e*s/o,1/t)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t):r.repeat.set(1/e,1/t))):(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*o/s):r.repeat.set(1,1*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1*s/o*-1,1):r.repeat.set(1*s/o,1)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1)))}};var ic=class extends kt{constructor(t,r=new Yr){super(t,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(t){super.updateGeometry(t),this.material.userData.layers&&$o.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}resizeGeometry(t,r){super.resizeGeometry(t,r,0),this.material.userData.layers&&$o.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh2D",r}clone(){let t=super.clone();return t.updateGeometry({}),t}static fromTexture(t){let r,n;if(t instanceof eh){let a=t.image;r=a.videoWidth*.5,n=a.videoHeight*.5}else{let a=t.image;r=a.width*.5,n=a.height*.5}let s=vp.create({parameters:{width:r,height:n}}),o=new Yr;return o.layersList.changeLayer(0,{type:"texture",texture:t}),o.layersList.moveLayer(0,1),o.dispose(),new ic(s,o)}};var sc=class extends kt{constructor(t,r=new pn){super(t,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh3D",r}};var oc=class extends sc{constructor(t,r=new pn){super(t,r);this.objectType="NonParametric"}toJSON(t){let r=super.toJSON(t);return r.object.objectType="NonParametric",r}};var Wp=class extends cn{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new as(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){let l;try{l=JSON.parse(a)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),l=JSON.parse(a.substring(65,a.length-2))}let c=s.parse(l);t&&t(c)},r,n)}parse(e){return new jp(e)}},jp=class{constructor(e){this.type="Font",this.data=e}generateShapes(e,t=100){let r=[],n=JF(e,t,this.data);for(let s=0,o=n.length;s<o;s++)Array.prototype.push.apply(r,n[s].toShapes());return r}};function JF(i,e,t){let r=Array.from(i),n=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*n,o=[],a=0,l=0;for(let c=0;c<r.length;c++){let h=r[c];if(h===`
|
|
3927
3927
|
`)a=0,l-=s;else{let u=KF(h,n,a,l,t);a+=u.offsetX,o.push(u.path)}}return o}function KF(i,e,t,r,n){let s=n.glyphs[i]||n.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+n.familyName+".");return}let o=new Kf,a,l,c,h,u,f,d,p;if(s.o){let m=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let g=0,v=m.length;g<v;)switch(m[g++]){case"m":a=m[g++]*e+t,l=m[g++]*e+r,o.moveTo(a,l);break;case"l":a=m[g++]*e+t,l=m[g++]*e+r,o.lineTo(a,l);break;case"q":c=m[g++]*e+t,h=m[g++]*e+r,u=m[g++]*e+t,f=m[g++]*e+r,o.quadraticCurveTo(u,f,c,h);break;case"b":c=m[g++]*e+t,h=m[g++]*e+r,u=m[g++]*e+t,f=m[g++]*e+r,d=m[g++]*e+t,p=m[g++]*e+r,o.bezierCurveTo(u,f,d,p,c,h);break}}return{offsetX:s.ha*e,path:o}}jp.prototype.isFont=!0;var mr=class extends Vt{constructor({char:t,originalChar:r,fontFamily:n,letterSpacing:s,fontSize:o,LOD:a=16},l=new zn({color:0,opacity:1,visible:!0,transparent:!0,side:or})){let c=mr.loadChar(t,n,a);super(c.geometry,l);this.char=t,this.originalChar=r!=null?r:t,this.fontFamily=n,this.letterSpacing=s,this.fontSize=o,this.LOD=a,this.resolution=c.resolution,this.glyphsHa=c.glyphsHa,this.localPosition=new B,this.charSize=0,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}static get FONTS_PATH(){return mr._fontPath}static set FONTS_PATH(t){mr._fontPath=t}updatePosition(t,r){this.localPosition.copy(t);let n=new M(this.localPosition.x,-this.localPosition.y,0);this.position.copy(n).add(r)}updateFontSize(t){let r=t/this.resolution;this.fontSize=t,this.scale.set(this.fontSize,this.fontSize,1),this.charSize=this.glyphsHa*r*this.letterSpacing}updateFontFamily(t){if(this.fontFamily===t)return;this.fontFamily=t;let r=mr.loadChar(this.char,t,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateChar(t){if(this.char===t)return;this.char=t;let r=mr.loadChar(t,this.fontFamily,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateLetterSpacing(t){this.letterSpacing!==t&&(this.letterSpacing=t,this.updateFontSize(this.fontSize))}updateLOD(t){if(this.LOD===t)return;this.LOD=t;let r=mr.loadChar(this.char,this.fontFamily,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}clone(){let t={char:this.char,originalChar:this.originalChar,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,LOD:this.LOD};return new mr(t).copy(this)}static loadFont(t){return new Promise(function(r,n){mr.fontCache[t]?r(mr.fontCache[t]):new Wp().load(mr.FONTS_PATH+t+".json",o=>{mr.fontCache[t]=o,r(o)},void 0,n)})}static loadChar(t,r,n){if(mr.charCache[t]){if(mr.charCache[t][n]&&mr.charCache[t][n].fontFamily===r)return mr.charCache[t][n]}else mr.charCache[t]={};let s=mr.fontCache[r],o=s.generateShapes(t,1);return mr.charCache[t][n]={geometry:new Io(o,n),fontFamily:r,resolution:s.data.resolution,glyphsHa:s.data.glyphs[t].ha},mr.charCache[t][n]}},mn=mr;mn.charCache={},mn.fontCache={},mn._fontPath="/_assets/_fonts/";var qp=new B,uo=class{constructor(e,t,r){this.message=[];this.endLine=!0;this.yLinePos=e,this.lineHeight=t,this.maxCharSize=r,this.nextChar3DPos=new B(0,this.yLinePos+this.maxCharSize*this.lineHeight),this.align=1}addChar3D(e,t,r=this.message.length){this.message.splice(r,0,e),e.fontSize>this.maxCharSize?(this.maxCharSize=e.fontSize,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight,this.fullUpdate(t)):(e.updatePosition(this.nextChar3DPos,t),this.nextChar3DPos.x+=e.charSize)}deleteChar3D(e=this.message.length-1){let t=this.message[e];if(t)return this.message.splice(e,1),this.nextChar3DPos.x-=t.charSize,t}isEndLine(e){this.endLine=e}fullUpdate(e,t=0){this.nextChar3DPos.x=0;for(let r=t,n=this.message.length;r<n;r+=1)this.message[r].updatePosition(this.nextChar3DPos,e),this.nextChar3DPos.x+=this.message[r].charSize}checkOverFlow(e){let t,r=this.message.length-1;if(r<=0)return!1;for(;r>=0;){if(this.message[r].char!==" "){t=this.message[r];break}r-=1}return!!(r>=0&&t&&t.localPosition.x+t.charSize>e)}containSpaceOverFlow(e=this.message.length-1){for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}containSpace(e=this.message.length-1){if(this.endLine)return!0;for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}popWord(e=this.message.length-1){let t=[],r=!0,n;for(n=e;n>=0;n-=1)if(this.message[n].char===" "){r=!1,t.length===0&&(n-=1,t.splice(0,0,this.message[n]));break}else t.splice(0,0,this.message[n]);return r?t=[]:this.message.splice(n+1,t.length),t}getWord(e=0,t=1){let r=[],n=e;for(n=e;;n+=t){if(!this.message[n]||this.message[n].char===" "){r.length===0&&this.message[n]&&(r.push(this.message[n]),this.message.splice(n,1));break}t>0?(r.push(this.message[n]),this.message.splice(n,1),n-=t):(r.splice(0,0,this.message[n]),this.message.splice(n,1))}return r}getWordAtIndex(e){let t=[];for(let r=e;r<this.message.length&&this.message[r].char!==" ";r++)t.push(this.message[r]);for(let r=e-1;r>=0&&this.message[r].char!==" ";r--)t.splice(0,0,this.message[r]);return t}wordSize(e=0,t=-1){let r=0,n=e;for(;n>=0&&n<this.message.length;){if(this.message[n].char===" "){r===0&&(r=this.message[n].charSize);break}r+=this.message[n].charSize,n+=t}return(n<0||n>=this.message.length)&&!this.endLine?this.message[e]?this.message[e].charSize:999999999:r===0?999999999:r}spaceLeft(e){return e-this.nextChar3DPos.x}popChar(e=this.message.length-1){return this.nextChar3DPos.x-=this.message[e].charSize,this.message.splice(e,1)}isEmpty(){return!this.message.length}updateNextCharPosY(){this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}updateYLinePos(e){this.yLinePos=e,this.updateNextCharPosY()}updatelineHeight(e){this.lineHeight=e,this.updateNextCharPosY()}updateFontSize(e,t=0,r=this.message.length-1){for(let n=t;n<=r;n+=1)this.message[n].updateFontSize(e);this.maxCharSize=e,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}countSpaces(){let e=0;for(let t=0;t<this.message.length;t++)this.message[t].char===" "&&(e+=1);return e}alignText(e,t,r,n,s){switch(r){case 1:this.leftAlign(e,s);break;case 3:this.centerAlign(this.spaceLeft(t),e,s);break;case 2:this.rightAlign(this.spaceLeft(t),e,s);break;case 4:this.justifyAlign(this.spaceLeft(t),e,s);break}}offsetCharacters(e,t,r){qp.set(t,r);let n=this.message.length;for(let s=0;s<n;s++)this.message[s].updatePosition(this.message[s].localPosition.add(qp),e)}leftAlign(e,t){this.align=1,this.offsetCharacters(e,0,t)}centerAlign(e,t,r){this.align=3,this.offsetCharacters(t,e/2,r)}rightAlign(e,t,r){this.align=2,this.offsetCharacters(t,e,r)}justifyAlign(e,t,r){if(this.align=4,this.endLine){this.offsetCharacters(t,0,r);return}let n=this.countSpaces();if(n===0){this.offsetCharacters(t,0,r);return}let s=e/n,o=0;for(let a=0;a<this.message.length;a++)this.message[a].char===" "&&(o+=s),qp.set(o,r),this.message[a].updatePosition(this.message[a].localPosition.add(qp),t)}clone(){let e=new uo(this.yLinePos,this.lineHeight,this.maxCharSize);e.nextChar3DPos=this.nextChar3DPos.clone(),e.align=this.align,e.endLine=this.endLine;for(let t=0;t<this.message.length;t++)e.message.push(this.message[t].clone());return e}};var Fv=class extends kt{constructor(t,r=new Yr({transparent:!0,opacity:1,visible:!1,side:or})){super(t,r);this.objectType="TextFrame";this.charContainer=new ot,this.add(this.charContainer),this.material.visible=!1,this._geometryUserData=t.userData,this.userData.textFrame={hexColor:null,opacity:1,visible:!0,text:"",fontSize:16,lineHeight:1.5,letterSpacing:1,fontFamily:"roboto_regular",textTransform:1,horizontalAlignment:1,verticalAlignment:1,LOD:16,maxLineSize:this._geometryUserData.parameters.width,textOrigin:new M(this._geometryUserData.parameters.width*-.5,this._geometryUserData.parameters.height*.5,0),textLines:[]},this.createTextLine()}static createFromState(t,r,n){let s=xp.create({parameters:{width:r.width,height:r.height}}),o=new Fv(s).fromState(r,n);return o.uuid=t,o}async updateText(t){this.clearText();let r=this.userData.textFrame,n=r.fontFamily;await mn.loadFont(n),r.text=t;let s=r.textOrigin,o=new zn({visible:r.visible,transparent:!0,side:or}),a=t.split(`
|
|
3928
3928
|
`),l=0;this.userData.textFrame.textLines=a.map((c,h)=>{let u=new uo(l,r.lineHeight,r.fontSize);return u.message=c.split("").map(f=>{let d={char:f,fontFamily:n,letterSpacing:r.letterSpacing,fontSize:r.fontSize,LOD:16},p=o.clone();p.color=r.hexColor,p.opacity=r.opacity;let m=new mn(d,p);return u.addChar3D(m,s),this.charContainer.add(m),m}),l+=u.maxCharSize*u.lineHeight,u}),this.textFullUpdate(),this.checkOverFlow()}clearText(){let t=this.userData.textFrame.textLines;for(;this.charContainer.children.length;){let r=this.charContainer.children[0];this.charContainer.remove(r)}for(;t.length;)t.pop()}raycast(t,r){let n=[];if(super.raycast(t,n),n.length>0){r.push(n[0]);return}let s=[];for(let o=0,a=this.charContainer.children.length;o<a;++o)if(this.charContainer.children[o]instanceof mn&&(t.intersectObject(this.charContainer.children[o],!1,s),s.length>0)){s[0].object=this,r.push(s[0]);return}}updateGeometry(t){var h,u,f,d;let r=this.userData,n=this.geometry.userData,s=n.parameters.width,o=n.parameters.height,a=(u=(h=t.parameters)==null?void 0:h.width)!=null?u:s,l=(d=(f=t.parameters)==null?void 0:f.height)!=null?d:o,c=r.textFrame;super.updateGeometry(t),c.maxLineSize=a,c.textOrigin.set(-.5*a,.5*l,0),l!==o?(this.checkOverFlow(),this.checkCapacity()):a!==s&&(s<a?this.checkCapacity():s>a&&this.checkOverFlow())}checkOverFlow(t=0){let r=this.userData,n=r.textFrame.textOrigin,s=r.textFrame.textLines;for(let o=t;o<s.length;o++){s[o].updateYLinePos(this.getNewLinePosition(o)),s[o].fullUpdate(n);let a=[];for(;s[o].checkOverFlow(r.textFrame.maxLineSize);)s[o].containSpaceOverFlow()?a.unshift(s[o].getWord(s[o].message.length-1,-1)):a.unshift(s[o].popChar());if(a.length>0){s[o+1]===void 0?(s[o].isEndLine(!1),this.createTextLine()):s[o].endLine&&(this.createTextLine(o+1),s[o].isEndLine(!1),s[o+1].isEndLine(!0));let l=0;for(let c=0;c<a.length;c+=1)for(let h=0;h<a[c].length;h+=1)s[o+1].addChar3D(a[c][h],n,l),l+=1;s[o+1].fullUpdate(n)}s[o].fullUpdate(n)}this.textFullUpdate(t)}checkCapacity(t=0){let r=this.userData,n=r.textFrame.textOrigin,s=r.textFrame.maxLineSize,o=r.textFrame.textLines;for(let a=t;a<o.length;a+=1)if(o[a].updateYLinePos(this.getNewLinePosition(a)),o[a].fullUpdate(n),!!o[a-1])for(;!o[a-1].endLine;){let l,c=o[a-1].spaceLeft(s);if(o[a].wordSize(0,1)<=c){o[a].containSpace()?l=o[a].getWord(0,1):l=o[a].popChar(0);for(let h=0;h<l.length;h+=1)l[h]&&o[a-1].addChar3D(l[h],n)}else{o[a].isEmpty()?(o[a].endLine&&o[a-1].isEndLine(!0),o.splice(a,1),a-=1):(o[a].updateYLinePos(this.getNewLinePosition(a)),o[a].fullUpdate(n));break}}this.textFullUpdate(t)}createTextLine(t=this.userData.textFrame.textLines.length){let n=this.userData.textFrame;n.textLines.splice(t,0,new uo(this.getNewLinePosition(t),n.lineHeight,n.fontSize))}textFullUpdate(t=0){let n=this.userData.textFrame,s=n.textLines,o=this.getVerticalAlignmentOffSet();for(let a=t;a<s.length;a++)s[a].updateYLinePos(this.getNewLinePosition(a)),s[a].fullUpdate(n.textOrigin),s[a].alignText(n.textOrigin,n.maxLineSize,n.horizontalAlignment,n.verticalAlignment,o)}getVerticalAlignmentOffSet(){switch(this.userData.textFrame.verticalAlignment){case 1:return 0;case 2:return this.getRemainingVerticalSpace()/2;case 3:return this.getRemainingVerticalSpace();default:return 0}}getRemainingVerticalSpace(){let r=this.userData.textFrame.textLines;return this.geometry.userData.parameters.height-this.getNewLinePosition(r.length)}getNewLinePosition(t){let n=this.userData.textFrame.textLines,s=0;for(let o=0;o<t;o+=1)s+=n[o].maxCharSize*n[o].lineHeight;return s}updateColor(t){var s;let r=this.userData;r.textFrame.hexColor=t;let n=r.textFrame.textLines;for(let o=0;o<n.length;o++){let a=n[o].message;for(let l=0;l<a.length;l++){let c=a[l].material;(s=c.color)!=null&&s.isColor&&(c.color=t)}}}updateOpacity(t){let r=this.userData;r.textFrame.opacity=t;let n=r.textFrame.textLines;for(let s=0;s<n.length;s++){let o=n[s].message;for(let a=0;a<o.length;a++){let l=o[a].material;l.opacity=t}}}updateVisible(t){let r=this.userData;r.textFrame.visible=t;let n=r.textFrame.textLines;for(let s=0;s<n.length;s++){let o=n[s].message;for(let a=0;a<o.length;a++){let l=o[a].material;l.visible=t}}}async updateFontFamily(t){await mn.loadFont(t);let n=this.userData.textFrame,s=n.textLines;n.fontFamily=t;for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)a[l].updateFontFamily(t)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateFontSize(t){let n=this.userData.textFrame,s=n.textLines,o=n.fontSize;n.fontSize=t;for(let a=0;a<s.length;a++)s[a].updateFontSize(t);this.textFullUpdate(),t>o?this.checkOverFlow():t<o&&this.checkCapacity()}async updateTextTransform(t){let n=this.userData.textFrame;await mn.loadFont(n.fontFamily);let s=n.textLines;switch(n.textTransform=t,t){case 2:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].char.toUpperCase())}break;case 3:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].char.toLowerCase())}break;default:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].originalChar)}}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLetterSpacing(t){let r=this.userData,n=r.textFrame.textLines;r.textFrame.letterSpacing=t;for(let s=0;s<n.length;s++){let o=n[s].message;for(let a=0;a<o.length;a++)o[a].updateLetterSpacing(t)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLOD(t){let r=this.userData;r.textFrame.LOD=t;let n=r.textFrame.textLines;for(let s=0;s<n.length;s++);this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLineHeight(t){let r=this.userData,n=r.textFrame.textLines;r.textFrame.lineHeight=t;for(let s=0;s<n.length;s++)n[s].updatelineHeight(t);this.textFullUpdate()}updateVerticalAlignment(t){let r=this.userData;r.textFrame.verticalAlignment=t,this.textFullUpdate()}updateHorizontalAlignment(t){let r=this.userData;r.textFrame.horizontalAlignment=t,this.textFullUpdate()}toJSON(t){let r=super.toJSON(t),n=r.object;n.objectType="TextFrame";let o=this.userData.textFrame.textLines.map(a=>{let l=a.message.map(c=>({char:c.char,originalChar:c.originalChar,fontFamily:c.fontFamily,letterSpacing:c.letterSpacing,fontSize:c.fontSize,LOD:c.LOD}));return{align:a.align,endLine:a.endLine,lineHeight:a.lineHeight,maxCharSize:a.maxCharSize,yLinePos:a.yLinePos,message:l}});return n.userData.textFrame.textLinesData=o,r}async fromJSONasync(t){if(super.fromJSON(t),t.userData!==void 0){let r=t.userData.textFrame;await mn.loadFont(r.fontFamily),r.textOrigin=new M(r.textOrigin.x,r.textOrigin.y,r.textOrigin.z);let n=new zn({color:r.hexColor,opacity:r.opacity,visible:r.visible,transparent:!0,side:or});r.textLinesData&&(r.textLines=r.textLinesData.map((s,o)=>{let a=new uo(Number(s.yLinePos),Number(s.lineHeight),Number(s.maxCharSize)),l=s.message.map((c,h)=>{if(c.char===void 0){let d=r.textLines[o].message[h];if("geometries"in d){let p=d.geometries[0].userData.parameters;Object.assign(c,{LOD:p.lod,char:p.char,fontFamily:p.fontFamily,fontSize:p.fontSize,letterSpacing:p.letterSpacing,originalChar:p.char})}}let u={char:c.char,fontFamily:c.fontFamily,letterSpacing:Number(c.letterSpacing),fontSize:Number(c.fontSize),LOD:c.LOD},f=new mn(u,n.clone());return a.addChar3D(f,r.textOrigin),this.charContainer.add(f),f});return a.message=l,a}),this.userData.textFrame=r),this.textFullUpdate()}return this}fromTextFrameData(t,r){if(t.color!==void 0){let n=pr(t.color,r);this.updateColor(n),this.updateOpacity(n.a)}t.alpha!==void 0&&this.updateOpacity(t.alpha),t.font!==void 0&&this.updateFontFamily(t.font),t.horizontalAlign!==void 0&&this.updateHorizontalAlignment(t.horizontalAlign),t.verticalAlign!==void 0&&this.updateVerticalAlignment(t.verticalAlign),t.textTransform!==void 0&&this.updateTextTransform(t.textTransform),t.fontSize!==void 0&&this.updateFontSize(t.fontSize),t.lineHeight!==void 0&&this.updateLineHeight(t.lineHeight),t.letterSpacing!==void 0&&this.updateLetterSpacing(t.letterSpacing),t.text!==void 0&&t.text!==""&&this.updateText(t.text),(t.width!==void 0||t.height!==void 0)&&this.updateGeometry({parameters:{width:t.width,height:t.height}})}fromState(t,r){return super.fromState(t),this.fromTextFrameData(t,r),this}convertToVector(){let{fontFamily:t,hexColor:r}=this.userData.textFrame,n=new gs;n.name="Text Shape";let s=mn.fontCache[t];for(let o of this.charContainer.children)o instanceof mn&&s.generateShapes(o.char,1).forEach(a=>{let l=new Tt().fromShape(a);l.applyScale(o.scale.x,o.scale.y);let c=Hr.create({shape:l}),h=new Yr({side:or});h.color=r;let u=new ho(c,h);u.name=o.char,u.position.copy(o.position),u.rotation.copy(o.rotation),n.attach(u)});return n}},ea=Fv;ea.VerticalAlign=ky,ea.HorizontalAlign=Gy,ea.TextTransform=Vy;var cA=FT(aA());var Uv;bp.then(i=>{Uv=i});var hA=new Ae,ZF=new Ae,$F=new Ae,vi=new Kt,fo=new M,eU=new Ae,tU=new Ae,po=class extends kt{constructor(t,r,n,s=new pn){super(n!=null?n:r,s);this.subdivPointer=t;this.originalGeometry=r;this.subdividedGeometry=n;this.objectType="SubdivObject";this.hiddenMatrixOld=new Ae;this.smoothShading=!0;this.matrixWorldRigid=new Ae;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(t,r,n){let{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}=gi.build(r.geometry,void 0,!r.flatShading),l=uu(r.material,n),c=new po(s,o,a||void 0,l);return c.calcBoundingBox(),c.freeSubdivPointer(),c.uuid=t,c.fromState(r),c}shallowClone(t){return new oc(this.geometry,this.material).shallowCopy(this,t)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="SubdivObject",r}buildFromStore(t){var o,a,l;let{originalGeometry:r,subdividedGeometry:n,subdivPointer:s}=gi.build(t,this.subdivPointer,this.smoothShading,this.shearScale);if(this.subdivPointer=s,r!==void 0&&((o=this.originalGeometry)==null||o.dispose(),this.originalGeometry=r),n!==void 0&&((a=this.subdividedGeometry)==null||a.dispose(),this.subdividedGeometry=n!=null?n:void 0),this.geometry=(l=this.subdividedGeometry)!=null?l:this.originalGeometry,this.cloner)for(let c of this.cloner.children)c.geometry=this.geometry;t.width&&(this.geometry.userData.parameters={width:t.width,height:t.height,depth:t.depth})}updateMesh(t=!1){gi.buildLevel(this.subdivPointer,!0,this.smoothShading,this.originalGeometry,t?this.shearScaleInv:void 0),this.subdividedGeometry&&gi.buildLevel(this.subdivPointer,!1,this.smoothShading,this.subdividedGeometry,t?this.shearScaleInv:void 0)}updateTopology(){var t;this.originalGeometry.dispose(),this.originalGeometry=gi.buildLevel(this.subdivPointer,!0,this.smoothShading),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=gi.buildLevel(this.subdivPointer,!1,this.smoothShading)),this.geometry=(t=this.subdividedGeometry)!=null?t:this.originalGeometry}raycast(t,r){var n;this.geometry=this.originalGeometry,kt.prototype.raycast.call(this,t,r),this.geometry=(n=this.subdividedGeometry)!=null?n:this.originalGeometry}updateMatrixWorldSVD(){let t=this.matrixWorld.elements,r=[[t[0],t[4],t[8]],[t[1],t[5],t[9]],[t[2],t[6],t[10]]],{u:n,v:s,q:o}=(0,cA.SVD)(r),a=hA.set(n[0][0],n[0][1],n[0][2],0,n[1][0],n[1][1],n[1][2],0,n[2][0],n[2][1],n[2][2],0,0,0,0,1),l=ZF.set(s[0][0],s[0][1],s[0][2],0,s[1][0],s[1][1],s[1][2],0,s[2][0],s[2][1],s[2][2],0,0,0,0,1),c=$F.copy(l).transpose();this.shearScale=eU.makeScale(o[0],o[1],o[2]).multiply(c).premultiply(l),this.shearScaleInv=tU.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(a,c),o.every(h=>Math.abs(o[0]-h)<.01)&&(this.shearScale=void 0,this.shearScaleInv=void 0)}activateSVDCompensation(){this.shearScale!==void 0&&(this.matrixAutoUpdate=!1,this.matrix.copy(this.matrixWorldRigid).copyPosition(this.matrixWorld),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateSVDCompensation(){this.shearScale!==void 0&&(this.shearScale=void 0,this.shearScaleInv=void 0,this.matrixAutoUpdate=!0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new Lr);let r=t.attributes.position,n=t.boundingSphere.center;vi.setFromBufferAttribute(r),vi.getCenter(n),t.boundingSphere.radius=n.distanceTo(vi.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),vi.getSize(fo);let s={width:fo.x,height:fo.y,depth:fo.z};return this.geometry.userData.parameters=s,s}updateBoundingBox(t){let r=this.originalGeometry;vi.min.set(t[0],t[2],t[4]),vi.max.set(t[1],t[3],t[5]),this.shearScaleInv&&(vi.min.applyMatrix4(this.shearScaleInv),vi.max.applyMatrix4(this.shearScaleInv)),r.boundingSphere===null&&(r.boundingSphere=new Lr);let n=r.boundingSphere.center;vi.getCenter(n),r.boundingSphere.radius=n.distanceTo(vi.max),isNaN(r.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),vi.getSize(fo);let s={width:fo.x,height:fo.y,depth:fo.z};return this.geometry.userData.parameters=s,s}freeSubdivPointer(){this.subdivPointer&&(Uv.free_bvh(this.subdivPointer),Uv.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(t){this.geometry.userData.scale||(this.geometry.userData.scale=Array(3)),this.geometry.userData.scale[0]=this.geometry.userData.parameters.width===0?1:t.parameters.width/this.geometry.userData.parameters.width,this.geometry.userData.scale[1]=this.geometry.userData.parameters.height===0?1:t.parameters.height/this.geometry.userData.parameters.height,this.geometry.userData.scale[2]=this.geometry.userData.parameters.depth===0?1:t.parameters.depth/this.geometry.userData.parameters.depth,lA(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(lA(this.subdividedGeometry.attributes,...this.subdividedGeometry.userData.scale),this.subdividedGeometry.attributes.position.needsUpdate=!0,this.subdividedGeometry.attributes.normal.needsUpdate=!0),this.geometry.userData.parameters=ie({},t.parameters)}};function lA(i,e,t,r){let n=i.position.array,s=i.normal.array,o=hA.makeScale(e,t,r).invert().elements,a,l,c;for(var h=0,u=n.length;h<u;h+=3)n[h]*=e,n[h+1]*=t,n[h+2]*=r,a=s[h],l=s[h+1],c=s[h+2],s[h]=o[0]*a+o[4]*l+o[8]*c,s[h+1]=o[1]*a+o[5]*l+o[9]*c,s[h+2]=o[2]*a+o[6]*l+o[10]*c}function uA(i,e){e.flatShading!==void 0&&(i.flatShading=e.flatShading,i.needsUpdate=!0),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.side!==void 0&&(e.side===0?i.side=ii:e.side===1?i.side=Pr:i.side=or)}function rU(i,e){if(Array.isArray(i.material))for(let t of i.material)uA(t,e);else{let t=i.material;uA(t,e)}i.objectType==="SubdivObject"&&e.flatShading!==void 0&&(i.material.flatShading=!1,i.smoothShading=!e.flatShading,i.updateMesh())}function fA(i,e,t){let r;if(e.geometry.type==="SubdivGeometry")r=po.createFromState(i,e,t);else{let n=e.geometry.type==="BooleanGeometry"?new Le:Fp(e.geometry,t),s="materials"in e?B1(e.materials,t):uu(e.material,t);op.is2DParametricMesh(n.userData.type)?r=new ic(n,s):(n==null?void 0:n.userData.type)==="VectorGeometry"?r=new ho(n,s):e.geometry.type==="NonParametricGeometry"?r=new oc(n,s):e.geometry.type==="BooleanGeometry"?(r=new zp(void 0,s),r.booleanOp=e.geometry.operation):r=new sc(n,s),r.uuid=i,r.fromState(e)}return rU(r,e),r}function dA(i,e,t){return e.type==="Mesh"?fA(i,e,t):e.type==="TextFrame"?ea.createFromState(i,e,t):e.type==="Empty"?gs.createFromState(i,e):e.type==="PointLight"?rc.createFromState(i,e,t):e.type==="SpotLight"?nc.createFromState(i,e,t):e.type==="DirectionalLight"?tc.createFromState(i,e,t):eo.is(e.type)?Bn.createFromState(i,e):(console.error(e),new gs)}function nU(i,e){e.uniforms[`f${e.id}_transmissionSamplerMap`].value=i.texture,e.uniforms[`f${e.id}_transmissionDepthMap`].value=i.depthTexture}function pA(i,e,t){if(!t.userData.layers)return!1;let r=!1,n=t.userData.layers.getLayersOfType("transmission");return n.length>0?(e.layers.set(3),r=!0,i!==void 0&&n.forEach(s=>nU(i,s))):e.layers.set(0),r}function mA(i,e){let t=!1;return e.traverseEntity(r=>{if(r instanceof kt)if(Array.isArray(r.material))for(let n=0;n<r.material.length;n++)pA(i,r,r.material[n])&&(t=!0);else pA(i,r,r.material)&&(t=!0)}),t}function gA(i,e){"material"in i&&iU(i.material,e),"geometry"in i&&i.geometry.dispose()}function iU(i,e){ZS(i).forEach(t=>{e.isSharedMaterial(t)||t.dispose()})}var yA=new M,zv=class extends Op(on){constructor(t,r){super();this.objectType="Scene";this.alpha=1;this.backupFog=new Do(16777215,.1,2e3);this.fogUseBGColor=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this._needsTransmission=!1;this._color=new be(1,0,0);this.bgColor=new be(1,1,1);this.entityByUuid={};this.ambientLight=new Hs(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.personalCamera=this.createPersonalCamera(),this.activeCamera=this.personalCamera,this.sharedAssetManager=r,this.init(t,r)}needsTransmission(t){return this.needsTransmissionDirty&&(this._needsTransmission=mA(t,this),t!==void 0&&(this.needsTransmissionDirty=!1)),this._needsTransmission}find(t){if(t===""||t===void 0)return;let r=this.entityByUuid[t];return r===void 0?this.getObjectByProperty("uuid",t):r}get color(){return this._color}set color(t){this.fogUseBGColor===!0&&this.backupFog.color.copy(t),this._color.copy(t)}get enableFog(){return this.fog!==null}set enableFog(t){this.fog=t===!0?this.backupFog:null}init(t,r){if(this.createChildrenObjects(t.objects,this,r),this.personalCamera.removeFromParent(),this.add(this.personalCamera),this.ambientLight.removeFromParent(),this.add(this.ambientLight),this.setBackgroundColor(pr(t.backgroundColor,r)),this.updateFog(t.fog,r),this.updateAmbientLight(t.environment.ambientLight,r),this.activeCamera=this.personalCamera,t.publish.playCamera!==null){let n=this.find(t.publish.playCamera);n instanceof Bn&&this.switchActiveCamera(n)}this.traverse(n=>{Lt(n)&&n.recomputeBoolean()})}clearScene(t){this.traverseEntity(r=>{gA(r,t)});for(let r of this.children)Xn(r)&&r.removeFromParent()}resetAfterClear(t,r){this.init(t,r)}createPersonalCamera(){let t=Bn.createFromState(zv.PERSONAL_CAMERA_ID,xe(ie({},lp.defaultData),{name:"Personal Camera"}));return t.enableHelper=!1,t.objectHelper.visible=!1,delete t.isEntity,this.registerObjectCreatedInLegacy(t),t}raycast(t){let r=[],n=s=>{for(let o of s.children)Xn(o)&&!o.raycastLock&&o.visible&&((er(o)||ms(o)&&o.enableHelper&&o.objectHelper.parent)&&t.intersectObject(o,!1,r),n(o))};return n(this),r}traverseEntity(t){for(let r of this.children)Xn(r)&&r.traverseEntity(t)}updateFog(t,r){this.enableFog=t.enabled,this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=pr(t.color,r),this.backupFog.near=t.near,this.backupFog.far=t.far}toJSON(t){return{}}fromJSON(t){return this}dispose(){this.clearScene(this.sharedAssetManager),this.sharedAssetManager.dispose()}updateAmbientLight(t,r){F1(this.ambientLight,t,r),t.groundColor!==void 0&&(this.ambientLight.groundColor=pr(t.groundColor,r)),t.enabled!==void 0&&(this.ambientLight.visible=t.enabled)}switchActiveCamera(t){this.activeCamera!==this.personalCamera&&(this.activeCamera.enableHelper=!0),this.activeCamera=t,t.enableHelper=!1}setBackgroundColor(t){this.bgColor=t,this.alpha=t.a}createChildrenObjects(t,r,n){for(let s of t)this.createChildObject(s.id,s.data,s.children,r,n)}registerObjectCreatedInLegacy(t){this.entityByUuid[t.uuid]=t}unregisterObject(t){delete this.entityByUuid[t.uuid];for(let r of t.children)this.unregisterObject(r)}createChildObject(t,r,n,s,o){let a=dA(t,r,o);return a&&(this.entityByUuid[t]=a,s.add(a),Lt(s)&&er(a)&&(a.prevBooleanObjectParent=s),this.createChildrenObjects(n,a,o)),a}getCenter(t){let r=[];for(let s=0,o=t.length;s<o;++s){let{id:a,recursive:l}=t[s],c=this.find(a),h=l?c.recursiveBBox:c.singleBBox;r.push(...h.vertices)}let n=new Kt;return n.setFromPoints(r),n.getCenter(yA),yA}copyMatrixWorld(t,r){if(t===null){r.identity();return}let n=this.find(t);n?r.copy(n.matrixWorld):r.identity()}copyParentMatrixWorld(t,r){var s;if(t===null){r.identity();return}let n=(s=this.find(t))==null?void 0:s.parent;n?r.copy(n.matrixWorld):r.identity()}traverseMaterial(t){this.traverseEntity(r=>{if(r instanceof kt)if(Array.isArray(r.material))for(let n=0;n<r.material.length;n++)t(r.material[n]);else t(r.material)})}updateCanvasSize(t,r){this.activeCamera.setViewplaneSize(t,r);let n,s;t>=r?(n=r/t,s=1):(n=1,s=t/r),this.traverseMaterial(o=>{o.layersList.getLayersOfType("transmission").forEach(l=>{l.uniforms[`f${l.id}_aspectRatio`].value.x=n,l.uniforms[`f${l.id}_aspectRatio`].value.y=s})})}},yu=zv;yu.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";var AA={RED:0,GREEN:1,BLUE:2,ALPHA:3};var vu="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}";var sU=`#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
3929
3929
|
uniform mediump sampler2D inputBuffer;
|
|
@@ -4202,4 +4202,4 @@ float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offse
|
|
|
4202
4202
|
vec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord));
|
|
4203
4203
|
#endif
|
|
4204
4204
|
outputColor=vec4(color,inputColor.a);}`,Qp={DEFAULT:0,ESKIL:1},FA=class extends Wi{constructor({blendFunction:i=vt.NORMAL,technique:e=Qp.DEFAULT,eskil:t=!1,offset:r=.5,darkness:n=.5}={}){super("VignetteEffect",hz,{blendFunction:i,defines:new Map([["VIGNETTE_TECHNIQUE",e.toFixed(0)]]),uniforms:new Map([["offset",new _e(r)],["darkness",new _e(n)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(i){this.technique!==i&&(this.defines.set("VIGNETTE_TECHNIQUE",i.toFixed(0)),this.setChanged())}get eskil(){return this.technique===Qp.ESKIL}set eskil(i){this.technique=i?Qp.ESKIL:Qp.DEFAULT}getTechnique(){return this.technique}setTechnique(i){this.technique=i}get offset(){return this.uniforms.get("offset").value}set offset(i){this.uniforms.get("offset").value=i}getOffset(){return this.offset}setOffset(i){this.offset=i}get darkness(){return this.uniforms.get("darkness").value}set darkness(i){this.uniforms.get("darkness").value=i}getDarkness(){return this.darkness}setDarkness(i){this.darkness=i}},Sae=[new Float32Array(3),new Float32Array(3)],Mae=[new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3)],Aae=[[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1])]];var Tae=[new Float32Array(2),new Float32Array(2)];var Eae=new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),_ae=[new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125])],Cae=[new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4])],Dae=[new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3])];var Pae=new Map([[$r(0,0,0,0),new Float32Array([0,0,0,0])],[$r(0,0,0,1),new Float32Array([0,0,0,1])],[$r(0,0,1,0),new Float32Array([0,0,1,0])],[$r(0,0,1,1),new Float32Array([0,0,1,1])],[$r(0,1,0,0),new Float32Array([0,1,0,0])],[$r(0,1,0,1),new Float32Array([0,1,0,1])],[$r(0,1,1,0),new Float32Array([0,1,1,0])],[$r(0,1,1,1),new Float32Array([0,1,1,1])],[$r(1,0,0,0),new Float32Array([1,0,0,0])],[$r(1,0,0,1),new Float32Array([1,0,0,1])],[$r(1,0,1,0),new Float32Array([1,0,1,0])],[$r(1,0,1,1),new Float32Array([1,0,1,1])],[$r(1,1,0,0),new Float32Array([1,1,0,0])],[$r(1,1,0,1),new Float32Array([1,1,0,1])],[$r(1,1,1,0),new Float32Array([1,1,1,0])],[$r(1,1,1,1),new Float32Array([1,1,1,1])]]);function Hv(i,e,t){return i+(e-i)*t}function $r(i,e,t,r){let n=Hv(i,e,.75),s=Hv(t,r,1-.25);return Hv(n,s,1-.125)}var gr=class{constructor(e,t){this.enabled=!1;this.effect=new e(t),Object.defineProperty(this,"opacity",{enumerable:!0,set(r){this.effect.blendMode.opacity.value=r},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(r){this.effect.blendMode.setBlendFunction(Number(r))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=vt.NORMAL}toJSON(){let e=["constructor","effect","subscriptions"],t=ie({},this),r=Object.getPrototypeOf(this),n=Object.getOwnPropertyNames(r);for(let s of n){let o=Object.getOwnPropertyDescriptor(r,s);o&&typeof o.get=="function"&&(t[s]=this[s])}return e.forEach(s=>delete t[s]),t}};var ac=class extends gr{constructor(){super(CA),this.blendFunction=vt.SCREEN}set intensity(e){this.effect.intensity=e}get intensity(){return this.effect.intensity}set luminanceThreshold(e){this.effect.luminanceMaterial.threshold=e}get luminanceThreshold(){return this.effect.luminanceMaterial.threshold}set luminanceSmoothing(e){this.effect.luminanceMaterial.smoothing=e}get luminanceSmoothing(){return this.effect.luminanceMaterial.smoothing}set blurScale(e){this.effect.blurPass.scale=e}get blurScale(){return this.effect.blurPass.scale}set kernelSize(e){this.effect.blurPass.kernelSize=e}get kernelSize(){return this.effect.blurPass.kernelSize}};var lc=class extends gr{constructor(){super(DA)}set contrast(e){this.effect.uniforms.get("contrast").value=e}get contrast(){return this.effect.uniforms.get("contrast").value}set brightness(e){this.effect.uniforms.get("brightness").value=e}get brightness(){return this.effect.uniforms.get("brightness").value}};var cc=class extends gr{constructor(){super(LA),this.effect.offset=new B(.01,.01)}set offset(e){this.effect.offset.set(e[0]/1e3,e[1]/1e3)}get offset(){return[this.effect.offset.x*1e3,this.effect.offset.y*1e3]}};var hc=class extends gr{constructor(){super(PA)}};var uc=class extends gr{constructor(){super(RA);this._hue=0}set hue(t){this._hue=t,this.effect.setHue(t)}get hue(){return this._hue}set saturation(t){this.effect.uniforms.get("saturation").value=t}get saturation(){return this.effect.uniforms.get("saturation").value}};var fc=class extends gr{constructor(){super(BA),this.blendFunction=vt.OVERLAY}};var dc=class extends gr{constructor(){super(FA)}get eskil(){return this.effect.eskil}set eskil(e){this.effect.eskil=e}get darkness(){return this.effect.uniforms.get("darkness").value}set darkness(e){this.effect.uniforms.get("darkness").value=e}get offset(){return this.effect.uniforms.get("offset").value}set offset(e){this.effect.uniforms.get("offset").value=e}};var pc=class extends gr{constructor(e){super(IA,e)}set focalLength(e){this.effect.circleOfConfusionMaterial.uniforms.focalLength.value=e}get focalLength(){return this.effect.circleOfConfusionMaterial.uniforms.focalLength.value}set focusDistance(e){this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value=e}get focusDistance(){return this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value}get bokehScale(){return this.effect.bokehScale}set bokehScale(e){this.effect.bokehScale=e}};var mc=class extends gr{constructor(){super(NA)}get granularity(){return this.effect.getGranularity()}set granularity(e){this.effect.setGranularity(e)}};function UA(i,e){return e&&e.enabled&&i.push(e.effect),i}var xu=class extends Yt{constructor(){super();this._scene=new on;this._camera=new Bn;this.effects=new Map;this.loadingManager=new No;this.renderPass=new Qv;this._renderToScreen=!0;this._hasSmaa=!1;this.clock=new jf,this.enabled=!1,this.debug=!1,this.effects.set("bloom",new ac),this.effects.set("chromaticAberration",new cc),this.effects.set("vignette",new dc),this.effects.set("noise",new fc),this.effects.set("colorAverage",new hc),this.effects.set("hueSaturation",new uc),this.effects.set("brightnessContrast",new lc),this.effects.set("depthOfField",new pc),this.effects.set("pixelation",new mc)}get scene(){return this._scene}set scene(t){this._scene=t}get camera(){return this._camera}set camera(t){this._camera=t}_initSmaa(){if(!this.effectComposer)return;let t=this.effectComposer.passes.length,r=new OA({preset:ta.ULTRA,edgeDetectionMode:Jp.COLOR}),n=()=>{r.removeEventListener("load",n),this.dispatchEvent({type:"smaaloaded"})};r.addEventListener("load",n),r.edgeDetectionMaterial.setPredicationMode(qv.DEPTH),r.edgeDetectionMaterial.setEdgeDetectionThreshold(.05),r.edgeDetectionMaterial.setPredicationThreshold(.002),r.edgeDetectionMaterial.setPredicationScale(1),this.effectComposer.addPass(new Kp(this.camera,r),t),this._hasSmaa=!0}_initPasses(){if(!this.effectComposer||!this.renderer)return;let t;if(this.effectComposer.removeAllPasses(),this._hasSmaa=!1,this.renderPass=new Qv(this.scene,this.camera),this.enabled){this.effectComposer.addPass(this.renderPass),this._initSmaa();let r=[this.effects.get("chromaticAberration"),this.effects.get("bloom"),this.effects.get("colorAverage"),this.effects.get("hueSaturation"),this.effects.get("brightnessContrast"),this.effects.get("vignette"),this.effects.get("noise")].reduce(UA,[]),n=[this.effects.get("pixelation")].reduce(UA,[]);n.length>0&&this.effectComposer.addPass(new Kp(this.camera,...n)),this.effectComposer.addPass(new Kp(this.camera,...r))}else this.effectComposer.addPass(this.renderPass),(KS||Ho)&&this._initSmaa();if(t)return t}reinit(){if(!this.renderer)return Promise.all([]);this.effectComposer=new _A(this.renderer),this._initPasses()}init({renderer:t,camera:r,scene:n}){this.renderer=t,this.scene=n,this.camera=r,this._initCopyPass(),this.reinit()}_initCopyPass(){if(this._savePass)return;let t=new B;this.renderer.getDrawingBufferSize(t),this._rt=new mt(t.x,t.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:Ia,wrapT:Ia}),this._rt.samples=this.renderer.capabilities.isWebGL2?4:0,this._savePass=new Yv(this._rt,!1),this._savePass.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(t){var n,s;let r=this.effectComposer;!r||(t===!0?((n=this.renderer)!=null&&n.capabilities.isWebGL2&&(r.multisampling=0),r.removePass(this._savePass),r.passes[r.passes.length-1].renderToScreen=!0,r.autoRenderToScreen=!0):(((s=this.renderer)==null?void 0:s.capabilities.isWebGL2)&&!this._hasSmaa&&(r.multisampling=4),r.autoRenderToScreen=!1,r.passes[r.passes.length-1].renderToScreen=!1,this._savePass.renderToScreen=!1,this.enabled||(this._savePass.needsDepthTexture=!0),r.addPass(this._savePass)),this._renderToScreen=t)}get texture(){return this._rt&&this._rt.texture}get renderTarget(){return this._rt}fromJSON(t){t&&(Object.keys(t).forEach(r=>{let n=t[r],s=this.effects.get(r);Object.keys(n).forEach(o=>{s[o]=n[o]})}),this.enabled=t.enabled)}toJSON(){let t={};return this.effects.forEach((r,n)=>{t[n]=r.toJSON()},t),ie({enabled:this.enabled},t)}render(){var t;(t=this.effectComposer)==null||t.render(this.clock.getDelta())}setScissor(t,r,n,s){if(!this.effectComposer||!this.renderer)return;t instanceof Je?(this.effectComposer.inputBuffer.scissor.set(t.x,t.y,t.z,t.w),this.effectComposer.outputBuffer.scissor.set(t.x,t.y,t.z,t.w)):(this.effectComposer.inputBuffer.scissor.set(t,r,n,s),this.effectComposer.outputBuffer.scissor.set(t,r,n,s));let o=this.renderer.getPixelRatio();this.effectComposer.inputBuffer.scissor.multiplyScalar(o),this.effectComposer.outputBuffer.scissor.multiplyScalar(o),this.renderer.setScissor(t,r,n,s)}setScissorTest(t){!this.effectComposer||!this.renderer||(this.effectComposer.inputBuffer.scissorTest=t,this.effectComposer.outputBuffer.scissorTest=t,this.renderer.setScissorTest(t))}setViewport(t,r,n,s){!this.effectComposer||(t instanceof Je?(this.effectComposer.inputBuffer.viewport.copy(t),this.effectComposer.outputBuffer.viewport.copy(t)):(this.effectComposer.inputBuffer.viewport.set(t,r,n,s),this.effectComposer.outputBuffer.viewport.set(t,r,n,s)))}resize(t,r,n){var s,o;if((s=this.effectComposer)==null||s.setSize(t,r,n),this._rt){let a=((o=this.renderer)==null?void 0:o.getPixelRatio())||window.devicePixelRatio;this._rt.setSize(t*a,r*a)}}dispose(){var t;this._listeners=void 0,(t=this.effectComposer)==null||t.dispose()}};var Zp=class extends yu{constructor(t,r){super(t,r);this.postprocessing=new xu;this.initPostprocessing(t.postprocessing)}resetAfterClear(t,r){super.resetAfterClear(t,r),this.initPostprocessing(t.postprocessing)}initPostprocessing(t){let s=t,{enabled:r}=s,n=Eu(s,["enabled"]);for(let o of Object.entries(n)){let a=o[1],l=this.postprocessing.effects.get(o[0]);if(l){l.enabled=a.enabled;for(let[c,h]of Object.entries(a))l[c]=h}}this.postprocessing.enabled=r,this.postprocessing.reinit()}dispose(){super.dispose(),this.postprocessing.dispose()}switchActiveCamera(t){super.switchActiveCamera(t),this.postprocessing&&(this.postprocessing.camera=t)}};var Kv=new WeakMap,$p=class extends cn{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,n){let s=new as(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{let a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,a).then(t).catch(n)},r,n)}decodeDracoFile(e,t,r,n){let s={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){for(let l in t.attributeTypes){let c=t.attributeTypes[l];c.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=c.name)}let r=JSON.stringify(t);if(Kv.has(e)){let l=Kv.get(e);if(l.key===r)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n,s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(n=l,new Promise((c,h)=>{n._callbacks[s]={resolve:c,reject:h},n.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{n&&s&&this._releaseTask(n,s)}),Kv.set(e,{key:r,promise:a}),a}_createGeometry(e){let t=new Le;e.index&&t.setIndex(new Ve(e.index.array,1));for(let r=0;r<e.attributes.length;r++){let n=e.attributes[r],s=n.name,o=n.array,a=n.itemSize;t.setAttribute(s,new Ve(o,a))}return t}_loadLibrary(e,t){let r=new as(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((n,s)=>{r.load(e,n,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(r=>{let n=r[0];e||(this.decoderConfig.wasmBinary=r[1]);let s=fz.toString(),o=["/* draco decoder */",n,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
|
|
4205
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(s){let o=s.data;switch(o.type){case"decode":n._callbacks[o.id].resolve(o);break;case"error":n._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,s){return n._taskLoad>s._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}};function fz(){let i,e;onmessage=function(o){let a=o.data;switch(a.type){case"init":i=a.decoderConfig,e=new Promise(function(h){i.onModuleLoaded=function(u){h({draco:u})},DracoDecoderModule(i)});break;case"decode":let l=a.buffer,c=a.taskConfig;e.then(h=>{let u=h.draco,f=new u.Decoder,d=new u.DecoderBuffer;d.Init(new Int8Array(l),l.byteLength);try{let p=t(u,f,d,c),m=p.attributes.map(g=>g.array.buffer);p.index&&m.push(p.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:p},m)}catch(p){console.error(p),self.postMessage({type:"error",id:a.id,error:p.message})}finally{u.destroy(d),u.destroy(f)}});break}};function t(o,a,l,c){let h=c.attributeIDs,u=c.attributeTypes,f,d,p=a.GetEncodedGeometryType(l);if(p===o.TRIANGULAR_MESH)f=new o.Mesh,d=a.DecodeBufferToMesh(l,f);else if(p===o.POINT_CLOUD)f=new o.PointCloud,d=a.DecodeBufferToPointCloud(l,f);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||f.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());let m={index:null,attributes:[]};for(let g in h){let v=self[u[g]],y,w;if(c.useUniqueIDs)w=h[g],y=a.GetAttributeByUniqueId(f,w);else{if(w=a.GetAttributeId(f,o[h[g]]),w===-1)continue;y=a.GetAttribute(f,w)}m.attributes.push(n(o,a,f,g,v,y))}return p===o.TRIANGULAR_MESH&&(m.index=r(o,a,f)),o.destroy(f),m}function r(o,a,l){let h=l.num_faces()*3,u=h*4,f=o._malloc(u);a.GetTrianglesUInt32Array(l,u,f);let d=new Uint32Array(o.HEAPF32.buffer,f,h).slice();return o._free(f),{array:d,itemSize:1}}function n(o,a,l,c,h,u){let f=u.num_components(),p=l.num_points()*f,m=p*h.BYTES_PER_ELEMENT,g=s(o,h),v=o._malloc(m);a.GetAttributeDataArrayForAllPoints(l,u,g,m,v);let y=new h(o.HEAPF32.buffer,v,p).slice();return o._free(v),{name:c,array:y,itemSize:f}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}var vo;function dz(){return vo||(vo=new $p,vo.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),vo.decoderPending}async function pz(i){if(vo){let e={attributeIDs:vo.defaultAttributeIDs,attributeTypes:vo.defaultAttributeTypes,useUniqueIDs:!1},t;try{t=await vo.decodeGeometry(new Int8Array(i).buffer,e)}catch(r){console.error(r)}if(t)return{index:t.index?{array:t.index.array}:void 0,attributes:Object.entries(t.attributes).map(([r,n])=>({name:r,itemSize:n.itemSize,array:n.array}))}}return null}async function zA(i){let[e,t]=Ay(tp.deserialize(new Uint8Array(i))),r=[];e.scene.objects.traverse((n,s)=>{s.type==="Mesh"&&s.geometry.type==="NonParametricGeometry"&&s.geometry.data.draco!==void 0&&r.push(s)}),r.length&&await dz();for(let n of r){let s=await pz(Ey(n.geometry.data.draco));if(s){s.index&&(n.geometry.data.index={array:s.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let o={};s.attributes.forEach(({name:a,array:l,itemSize:c})=>{o[a]={array:l,itemSize:c,type:"Float32Array",normalized:!1}}),n.geometry.data.attributes=o,n.geometry.data.draco=void 0}}return t.result().data}var jA={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0,rewind:!0},tx={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},mz=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],tm={CSS:{},springs:{}};function ji(i,e,t){return Math.min(Math.max(i,e),t)}function bu(i,e){return i.indexOf(e)>-1}function Zv(i,e){return i.apply(null,e)}var Xe={arr:function(i){return Array.isArray(i)},obj:function(i){return bu(Object.prototype.toString.call(i),"Object")},pth:function(i){return Xe.obj(i)&&i.hasOwnProperty("totalLength")},svg:function(i){return i instanceof SVGElement},inp:function(i){return i instanceof HTMLInputElement},dom:function(i){return!("isNode"in i)&&(i.nodeType||Xe.svg(i))},str:function(i){return typeof i=="string"},fnc:function(i){return typeof i=="function"},und:function(i){return typeof i>"u"},hex:function(i){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(i)},rgb:function(i){return/^rgb/.test(i)},hsl:function(i){return/^hsl/.test(i)},col:function(i){return Xe.hex(i)||Xe.rgb(i)||Xe.hsl(i)},key:function(i){return!jA.hasOwnProperty(i)&&!tx.hasOwnProperty(i)&&i!=="targets"&&i!=="keyframes"}};function qA(i){var e=/\(([^)]+)\)/.exec(i);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function YA(i,e){var t=qA(i),r=ji(Xe.und(t[0])?1:t[0],.1,100),n=ji(Xe.und(t[1])?100:t[1],.1,100),s=ji(Xe.und(t[2])?10:t[2],.1,100),o=ji(Xe.und(t[3])?0:t[3],.1,100),a=Math.sqrt(n/r),l=s/(2*Math.sqrt(n*r)),c=l<1?a*Math.sqrt(1-l*l):0,h=1,u=l<1?(l*a+-o)/c:-o+a;function f(p){var m=e?e*p/1e3:p;return l<1?m=Math.exp(-m*l*a)*(h*Math.cos(c*m)+u*Math.sin(c*m)):m=(h+u*m)*Math.exp(-m*a),p===0||p===1?p:1-m}function d(){var p=tm.springs[i];if(p)return p;for(var m=1/6,g=0,v=0;;)if(g+=m,f(g)===1){if(v++,v>=16)break}else v=0;var y=g*m*1e3;return tm.springs[i]=y,y}return e?f:d}function gz(i){return i===void 0&&(i=10),function(e){return Math.ceil(ji(e,1e-6,1)*i)*(1/i)}}var yz=function(){var i=11,e=1/(i-1);function t(h,u){return 1-3*u+3*h}function r(h,u){return 3*u-6*h}function n(h){return 3*h}function s(h,u,f){return((t(u,f)*h+r(u,f))*h+n(u))*h}function o(h,u,f){return 3*t(u,f)*h*h+2*r(u,f)*h+n(u)}function a(h,u,f,d,p){var m,g,v=0;do g=u+(f-u)/2,m=s(g,d,p)-h,m>0?f=g:u=g;while(Math.abs(m)>1e-7&&++v<10);return g}function l(h,u,f,d){for(var p=0;p<4;++p){var m=o(u,f,d);if(m===0)return u;var g=s(u,f,d)-h;u-=g/m}return u}function c(h,u,f,d){if(!(0<=h&&h<=1&&0<=f&&f<=1))return;var p=new Float32Array(i);if(h!==u||f!==d)for(var m=0;m<i;++m)p[m]=s(m*e,h,f);function g(v){for(var y=0,w=1,b=i-1;w!==b&&p[w]<=v;++w)y+=e;--w;var S=(v-p[w])/(p[w+1]-p[w]),T=y+S*e,A=o(T,h,f);return A>=.001?l(v,T,h,f):A===0?T:a(v,y,y+e,h,f)}return function(v){return h===u&&f===d||v===0||v===1?v:s(g(v),u,d)}}return c}(),XA=function(){var i={linear:function(){return function(r){return r}}},e={Sine:function(){return function(r){return 1-Math.cos(r*Math.PI/2)}},Circ:function(){return function(r){return 1-Math.sqrt(1-r*r)}},Back:function(){return function(r){return r*r*(3*r-2)}},Bounce:function(){return function(r){for(var n,s=4;r<((n=Math.pow(2,--s))-1)/11;);return 1/Math.pow(4,3-s)-7.5625*Math.pow((n*3-2)/22-r,2)}},Elastic:function(r,n){r===void 0&&(r=1),n===void 0&&(n=.5);var s=ji(r,1,10),o=ji(n,.1,2);return function(a){return a===0||a===1?a:-s*Math.pow(2,10*(a-1))*Math.sin((a-1-o/(Math.PI*2)*Math.asin(1/s))*(Math.PI*2)/o)}}},t=["Quad","Cubic","Quart","Quint","Expo"];return t.forEach(function(r,n){e[r]=function(){return function(s){return Math.pow(s,n+2)}}}),Object.keys(e).forEach(function(r){var n=e[r];i["easeIn"+r]=n,i["easeOut"+r]=function(s,o){return function(a){return 1-n(s,o)(1-a)}},i["easeInOut"+r]=function(s,o){return function(a){return a<.5?n(s,o)(a*2)/2:1-n(s,o)(a*-2+2)/2}}}),i}();function rx(i,e){if(Xe.fnc(i))return i;var t=i.split("(")[0],r=XA[t],n=qA(i);switch(t){case"spring":return YA(i,e);case"cubicBezier":return Zv(yz,n);case"steps":return Zv(gz,n);default:return Zv(r,n)}}function QA(i){try{var e=document.querySelectorAll(i);return e}catch{return}}function rm(i,e){for(var t=i.length,r=arguments.length>=2?arguments[1]:void 0,n=[],s=0;s<t;s++)if(s in i){var o=i[s];e.call(r,o,s,i)&&n.push(o)}return n}function nm(i){return i.reduce(function(e,t){return e.concat(Xe.arr(t)?nm(t):t)},[])}function GA(i){return Xe.arr(i)?i:(Xe.str(i)&&(i=QA(i)||i),i instanceof NodeList||i instanceof HTMLCollection?[].slice.call(i):[i])}function nx(i,e){return i.some(function(t){return t===e})}function ix(i){var e={};for(var t in i)e[t]=i[t];return e}function $v(i,e){var t=ix(i);for(var r in i)t[r]=e.hasOwnProperty(r)?e[r]:i[r];return t}function im(i,e){var t=ix(i);for(var r in e)t[r]=Xe.und(i[r])?e[r]:i[r];return t}function vz(i){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(i);return e?"rgba("+e[1]+",1)":i}function xz(i){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,t=i.replace(e,function(a,l,c,h){return l+l+c+c+h+h}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),n=parseInt(r[1],16),s=parseInt(r[2],16),o=parseInt(r[3],16);return"rgba("+n+","+s+","+o+",1)"}function bz(i){var e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(i)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(i),t=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,n=parseInt(e[3],10)/100,s=e[4]||1;function o(f,d,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?f+(d-f)*6*p:p<1/2?d:p<2/3?f+(d-f)*(2/3-p)*6:f}var a,l,c;if(r==0)a=l=c=n;else{var h=n<.5?n*(1+r):n+r-n*r,u=2*n-h;a=o(u,h,t+1/3),l=o(u,h,t),c=o(u,h,t-1/3)}return"rgba("+a*255+","+l*255+","+c*255+","+s+")"}function wz(i){if(Xe.rgb(i))return vz(i);if(Xe.hex(i))return xz(i);if(Xe.hsl(i))return bz(i)}function vs(i){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(i);if(e)return e[1]}function Sz(i){if(bu(i,"translate")||i==="perspective")return"px";if(bu(i,"rotate")||bu(i,"skew"))return"deg"}function ex(i,e){return Xe.fnc(i)?i(e.target,e.id,e.total):i}function qi(i,e){return i.getAttribute(e)}function sx(i,e,t){var r=vs(e);if(nx([t,"deg","rad","turn"],r))return e;var n=tm.CSS[e+t];if(!Xe.und(n))return n;var s=100,o=document.createElement(i.tagName),a=i.parentNode&&i.parentNode!==document?i.parentNode:document.body;a.appendChild(o),o.style.position="absolute",o.style.width=s+t;var l=s/o.offsetWidth;a.removeChild(o);var c=l*parseFloat(e);return tm.CSS[e+t]=c,c}function JA(i,e,t){if(e in i.style){var r=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),n=i.style[e]||getComputedStyle(i).getPropertyValue(r)||"0";return t?sx(i,n,t):n}}function ox(i,e){if(Xe.dom(i)&&!Xe.inp(i)&&(qi(i,e)||Xe.svg(i)&&i[e]))return"attribute";if(Xe.dom(i)&&nx(mz,e))return"transform";if(Xe.dom(i)&&e!=="transform"&&JA(i,e))return"css";if(i[e]!=null)return"object"}function KA(i){if(!!Xe.dom(i)){for(var e=i.style.transform||"",t=/(\w+)\(([^)]*)\)/g,r=new Map,n;n=t.exec(e);)r.set(n[1],n[2]);return r}}function Mz(i,e,t,r){var n=bu(e,"scale")?1:0+Sz(e),s=KA(i).get(e)||n;return t&&(t.transforms.list.set(e,s),t.transforms.last=e),r?sx(i,s,r):s}function ax(i,e,t,r){switch(ox(i,e)){case"transform":return Mz(i,e,r,t);case"css":return JA(i,e,t);case"attribute":return qi(i,e);default:return i[e]||0}}function lx(i,e){var t=/^(\*=|\+=|-=)/.exec(i);if(!t)return i;var r=vs(i)||0,n=parseFloat(e),s=parseFloat(i.replace(t[0],""));switch(t[0][0]){case"+":return n+s+r;case"-":return n-s+r;case"*":return n*s+r}}function ZA(i,e){if(Xe.col(i))return wz(i);if(/\s/g.test(i))return i;var t=vs(i),r=t?i.substr(0,i.length-t.length):i;return e?r+e:r}function cx(i,e){return Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2))}function Az(i){return Math.PI*2*qi(i,"r")}function Tz(i){return qi(i,"width")*2+qi(i,"height")*2}function Ez(i){return cx({x:qi(i,"x1"),y:qi(i,"y1")},{x:qi(i,"x2"),y:qi(i,"y2")})}function $A(i){for(var e=i.points,t=0,r,n=0;n<e.numberOfItems;n++){var s=e.getItem(n);n>0&&(t+=cx(r,s)),r=s}return t}function _z(i){var e=i.points;return $A(i)+cx(e.getItem(e.numberOfItems-1),e.getItem(0))}function eT(i){if(i.getTotalLength)return i.getTotalLength();switch(i.tagName.toLowerCase()){case"circle":return Az(i);case"rect":return Tz(i);case"line":return Ez(i);case"polyline":return $A(i);case"polygon":return _z(i)}}function Cz(i){var e=eT(i);return i.setAttribute("stroke-dasharray",e),e}function Dz(i){for(var e=i.parentNode;Xe.svg(e)&&Xe.svg(e.parentNode);)e=e.parentNode;return e}function tT(i,e){var t=e||{},r=t.el||Dz(i),n=r.getBoundingClientRect(),s=qi(r,"viewBox"),o=n.width,a=n.height,l=t.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function Pz(i,e){var t=Xe.str(i)?QA(i)[0]:i,r=e||100;return function(n){return{property:n,el:t,svg:tT(t),totalLength:eT(t)*(r/100)}}}function Lz(i,e){function t(a){a===void 0&&(a=0);var l=e+a>=1?e+a:0;return i.el.getPointAtLength(l)}var r=tT(i.el,i.svg),n=t(),s=t(-1),o=t(1);switch(i.property){case"x":return(n.x-r.x)*r.w;case"y":return(n.y-r.y)*r.h;case"angle":return Math.atan2(o.y-s.y,o.x-s.x)*180/Math.PI}}function kA(i,e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=ZA(Xe.pth(i)?i.totalLength:i,e)+"";return{original:r,numbers:r.match(t)?r.match(t).map(Number):[0],strings:Xe.str(i)||e?r.split(t):[]}}function rT(i){var e=i?nm(Xe.arr(i)?i.map(GA):GA(i)):[];return rm(e,function(t,r,n){return n.indexOf(t)===r})}function nT(i){var e=rT(i);return e.map(function(t,r){return{target:t,id:r,total:e.length,transforms:{list:KA(t)}}})}function Iz(i,e){var t=ix(e);if(/^spring/.test(t.easing)&&(t.duration=YA(t.easing)),Xe.arr(i)){var r=i.length,n=r===2&&!Xe.obj(i[0]);n?i={value:i}:Xe.fnc(e.duration)||(t.duration=e.duration/r)}var s=Xe.arr(i)?i:[i];return s.map(function(o,a){var l=Xe.obj(o)&&!Xe.pth(o)?o:{value:o};return Xe.und(l.delay)&&(l.delay=a?0:e.delay),Xe.und(l.endDelay)&&(l.endDelay=a===s.length-1?e.endDelay:0),l}).map(function(o){return im(o,t)})}function Rz(i){for(var e=rm(nm(i.map(function(s){return Object.keys(s)})),function(s){return Xe.key(s)}).reduce(function(s,o){return s.indexOf(o)<0&&s.push(o),s},[]),t={},r=function(s){var o=e[s];t[o]=i.map(function(a){var l={};for(var c in a)Xe.key(c)?c==o&&(l.value=a[c]):l[c]=a[c];return l})},n=0;n<e.length;n++)r(n);return t}function Bz(i,e){var t=[],r=e.keyframes;r&&(e=im(Rz(r),e));for(var n in e)Xe.key(n)&&t.push({name:n,tweens:Iz(e[n],i)});return t}function Nz(i,e){var t={};for(var r in i){var n=ex(i[r],e);Xe.arr(n)&&(n=n.map(function(s){return ex(s,e)}),n.length===1&&(n=n[0])),t[r]=n}return t.duration=parseFloat(t.duration),t.delay=parseFloat(t.delay),t}function Oz(i,e){var t;return i.tweens.map(function(r){var n=Nz(r,e),s=n.value,o=Xe.arr(s)?s[1]:s,a=vs(o),l=ax(e.target,i.name,a,e),c=t?t.to.original:l,h=Xe.arr(s)?s[0]:c,u=vs(h)||vs(l),f=a||u;return Xe.und(o)&&(o=c),n.from=kA(h,f),n.to=kA(lx(o,h),f),n.start=t?t.end:0,n.end=n.start+n.delay+n.duration+n.endDelay,n.easing=rx(n.easing,n.duration),n.isPath=Xe.pth(s),n.isColor=Xe.col(n.from.original),n.isColor&&(n.round=1),t=n,n})}var iT={css:function(i,e,t){return i.style[e]=t},attribute:function(i,e,t){return i.setAttribute(e,t)},object:function(i,e,t){return i[e]=t},transform:function(i,e,t,r,n){if(r.list.set(e,t),e===r.last||n){var s="";r.list.forEach(function(o,a){s+=a+"("+o+") "}),i.style.transform=s}}};function sT(i,e){var t=nT(i);t.forEach(function(r){for(var n in e){var s=ex(e[n],r),o=r.target,a=vs(s),l=ax(o,n,a,r),c=a||vs(l),h=lx(ZA(s,c),l),u=ox(o,n);iT[u](o,n,h,r.transforms,!0)}})}function Fz(i,e){var t=ox(i.target,e.name);if(t){var r=Oz(e,i),n=r[r.length-1];return{type:t,property:e.name,animatable:i,tweens:r,duration:n.end,delay:r[0].delay,endDelay:n.endDelay}}}function Uz(i,e){return rm(nm(i.map(function(t){return e.map(function(r){return Fz(t,r)})})),function(t){return!Xe.und(t)})}function oT(i,e){var t=i.length,r=function(s){return s.timelineOffset?s.timelineOffset:0},n={};return n.duration=t?Math.max.apply(Math,i.map(function(s){return r(s)+s.duration})):e.duration,n.delay=t?Math.min.apply(Math,i.map(function(s){return r(s)+s.delay})):e.delay,n.endDelay=t?n.duration-Math.max.apply(Math,i.map(function(s){return r(s)+s.duration-s.endDelay})):e.endDelay,n}var VA=0;function zz(i){var e=$v(jA,i),t=$v(tx,i),r=Bz(t,i),n=nT(i.targets),s=Uz(n,r),o=oT(s,t),a=VA;return VA++,im(e,{id:a,children:[],animatables:n,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}var Tn=[],HA=[],em,Gz=function(){function i(){em=requestAnimationFrame(e)}function e(t){var r=Tn.length;if(r){for(var n=0;n<r;){var s=Tn[n];if(!s.paused)s.tick(t);else{var o=Tn.indexOf(s);o>-1&&(Tn.splice(o,1),r=Tn.length)}n++}i()}else em=cancelAnimationFrame(em)}return i}();function kz(){document.hidden?(Tn.forEach(function(i){return i.pause()}),HA=Tn.slice(0),Sr.running=Tn=[]):HA.forEach(function(i){return i.play()})}typeof document<"u"&&document.addEventListener("visibilitychange",kz);function Sr(i){i===void 0&&(i={});var e=0,t=0,r=0,n,s=0,o=null;function a(w){var b=window.Promise&&new Promise(function(S){return o=S});return w.finished=b,b}var l=zz(i),c=a(l);function h(){var w=l.direction;w!=="alternate"&&(l.direction=w!=="normal"?"normal":"reverse"),l.reversed=!l.reversed,n.forEach(function(b){return b.reversed=l.reversed})}function u(w){return l.reversed?l.duration-w:w}function f(){e=0,t=u(l.currentTime)*(1/Sr.speed)}function d(w,b){b&&b.seek(w-b.timelineOffset)}function p(w){if(l.reversePlayback)for(var S=s;S--;)d(w,n[S]);else for(var b=0;b<s;b++)d(w,n[b])}function m(w){var b=0,S=l.animations,T=S.length;for(l.reversePlayback===!0&&l.rewind===!1&&(w=l.duration-w);b<T;){var A=S[b],x=A.animatable,E=A.tweens,_=E.length-1,C=E[_];_&&(C=rm(E,function(oe){return w<oe.end})[0]||C);for(var I=ji(w-C.start-C.delay,0,C.duration)/C.duration,N=isNaN(I)?1:C.easing(I),R=C.to.strings,k=C.round,G=[],te=C.to.numbers.length,Q=void 0,Y=0;Y<te;Y++){var F=void 0;if(l.reversePlayback===!0&&l.rewind===!1)var z=C.to.numbers[Y],O=C.from.numbers[Y]||0;else var O=C.to.numbers[Y],z=C.from.numbers[Y]||0;C.isPath?F=Lz(C.value,N*O):F=z+N*(O-z),k&&(C.isColor&&Y>2||(F=Math.round(F*k)/k)),G.push(F)}var j=R.length;if(!j)Q=G[0];else{Q=R[0];for(var q=0;q<j;q++){var J=R[q],W=R[q+1],ge=G[q];isNaN(ge)||(W?Q+=ge+W:Q+=ge+" ")}}iT[A.type](x.target,A.property,Q,x.transforms),A.currentValue=Q,b++}}function g(w){l[w]&&!l.passThrough&&l[w](l)}function v(){l.remaining&&l.remaining!==!0&&l.remaining--}function y(w){var b=l.duration,S=l.delay,T=b-l.endDelay,A=u(w);l.progress=ji(A/b*100,0,100),l.reversePlayback=A<l.currentTime,n&&p(A),!l.began&&l.currentTime>=0&&(l.began=!0,g("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,g("loopBegin")),A<=S&&l.currentTime!==0&&m(0),(A>=T&&l.currentTime!==b||!b)&&m(b),A>S&&A<T?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,g("changeBegin")),g("change"),m(A)):l.changeBegan?(l.changeCompleted=!0,l.changeBegan=!1,g("change"),g("changeComplete")):l.began&&A>T&&(g("change"),g("changeComplete")),l.currentTime=ji(A,0,b),l.began&&g("update"),w>=b&&(t=0,v(),l.remaining?(e=r,g("loopComplete"),l.loopBegan=!1,l.direction==="alternate"&&h()):(l.paused=!0,l.completed||(l.completed=!0,g("loopComplete"),g("complete"),!l.passThrough&&"Promise"in window&&(o(),c=a(l)))))}return l.reset=function(){var w=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed=w==="reverse",l.remaining=l.loop,n=l.children,s=n.length;for(var b=s;b--;)l.children[b].reset();(l.reversed&&l.loop!==!0||w==="alternate"&&l.loop===1)&&l.remaining++,m(l.reversed?l.duration:0)},l.set=function(w,b){return sT(w,b),l},l.tick=function(w){r=w,e||(e=r),y((r+(t-e))*Sr.speed)},l.seek=function(w){y(u(w))},l.pause=function(){l.paused=!0,f()},l.play=function(){!l.paused||(l.completed&&l.reset(),l.paused=!1,Tn.push(l),f(),em||Gz())},l.reverse=function(){h(),l.completed=!l.reversed,f()},l.restart=function(){l.reset(),l.play()},l.reset(),l.autoplay&&l.play(),l}function WA(i,e){for(var t=e.length;t--;)nx(i,e[t].animatable.target)&&e.splice(t,1)}function Vz(i){for(var e=rT(i),t=Tn.length;t--;){var r=Tn[t],n=r.animations,s=r.children;WA(e,n);for(var o=s.length;o--;){var a=s[o],l=a.animations;WA(e,l),!l.length&&!a.children.length&&s.splice(o,1)}!n.length&&!s.length&&r.pause()}}function Hz(i,e){e===void 0&&(e={});var t=e.direction||"normal",r=e.easing?rx(e.easing):null,n=e.grid,s=e.axis,o=e.from||0,a=o==="first",l=o==="center",c=o==="last",h=Xe.arr(i),u=parseFloat(h?i[0]:i),f=h?parseFloat(i[1]):0,d=vs(h?i[1]:i)||0,p=e.start||0+(h?u:0),m=[],g=0;return function(v,y,w){if(a&&(o=0),l&&(o=(w-1)/2),c&&(o=w-1),!m.length){for(var b=0;b<w;b++){if(!n)m.push(Math.abs(o-b));else{var S=l?(n[0]-1)/2:o%n[0],T=l?(n[1]-1)/2:Math.floor(o/n[0]),A=b%n[0],x=Math.floor(b/n[0]),E=S-A,_=T-x,C=Math.sqrt(E*E+_*_);s==="x"&&(C=-E),s==="y"&&(C=-_),m.push(C)}g=Math.max.apply(Math,m)}r&&(m=m.map(function(N){return r(N/g)*g})),t==="reverse"&&(m=m.map(function(N){return s?N<0?N*-1:-N:Math.abs(g-N)}))}var I=h?(f-u)/g:u;return p+I*(Math.round(m[y]*100)/100)+d}}function Wz(i){i===void 0&&(i={});var e=Sr(i);return e.duration=0,e.add=function(t,r){var n=Tn.indexOf(e),s=e.children;n>-1&&Tn.splice(n,1);function o(f){f.passThrough=!0}for(var a=0;a<s.length;a++)o(s[a]);var l=im(t,$v(tx,i));l.targets=l.targets||i.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=Xe.und(r)?c:lx(r,c),o(e),l.rewind=e.rewind,e.seek(l.timelineOffset);var h=Sr(l);o(h),s.push(h);var u=oT(s,i);return e.delay=u.delay,e.endDelay=u.endDelay,e.duration=u.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}Sr.version="3.2.0";Sr.speed=1;Sr.running=Tn;Sr.remove=Vz;Sr.get=ax;Sr.set=sT;Sr.convertPx=sx;Sr.path=Pz;Sr.setDashoffset=Cz;Sr.stagger=Hz;Sr.timeline=Wz;Sr.easing=rx;Sr.penner=XA;Sr.random=function(i,e){return Math.floor(Math.random()*(e-i+1))+i};var aT=Sr;function lT(i,e,t){var n,s;let r=i.cameraType==="OrthographicCamera"?(n=e.orthographic)==null?void 0:n.zoom:(s=e.perspective)==null?void 0:s.zoom;if(r!==void 0){let o=i.zoom;o!==r&&t.push({change:a=>{i.zoom=et.lerp(o,r,a),i.updateProjectionMatrix()}})}if(e.targetOffset!==void 0){let o=i.targetOffset,a=e.targetOffset;o!==a&&t.push({change:l=>{i.targetOffset=et.lerp(o,a,l)}})}}function cT(i,e,t){if(e.width!==void 0&&e.height!==void 0&&e.depth!==void 0){let{width:r,height:n,depth:s}=i.geometry.userData.parameters,o=[r,n,s],a=[e.width,e.height,e.depth];!br.isEqual(o,a)&&!Lt(i)&&t.push({change:l=>{let[c,h,u]=br.lerp(o,a,l);i.updateGeometry({parameters:{width:c,height:h,depth:u}}),i.invalidateDownstreamBooleanData()}})}}function hT(i,e,t,r){if(e.intensity!==void 0){let n=i.intensity,s=e.intensity;n!==s&&t.push({change:o=>{i.intensity=et.lerp(n,s,o)}})}if(e.color!==void 0){let n=i.color.clone(),s=typeof e.color=="string"?r.getColor(e.color):e.color;if(!Ar.equals(n,s)){let o=n.clone();i.color=o,t.push({change:a=>{let{r:l,g:c,b:h}=Ar.lerp(n,s,a);o.setRGB(l,c,h)}})}}}function uT(i,e,t,r){var s,o;let n=i.layersList.head;for(;n;){let a=e.layers.data(n.uuid);if(a&&((s=n.visible)!=null?s:!0)&&((o=a.visible)!=null?o:!0)){let l=n.getNames().filter(c=>!_M.some(h=>c.includes(h)));for(let c of l)try{let h=n.getValue(c);if(c==="steps")Jz(n,a,c,t);else if(c==="colors")Kz(n,a,c,t);else if(typeof h=="number")jz(n,a,c,t);else{if(typeof h=="boolean")continue;"isVector2"in h?qz(n,a,c,t):"isVector3"in h?Yz(n,a,c,t):"isColorA"in h?Qz(n,a,c,t,r):"isColor"in h?Xz(n,a,c,t,r):"isTexture"in h&&Zz(n,a,c,t)}}catch(h){console.error(`animateMaterial: unexpected material layer for ${c}`,h)}}n=n.next}}function jz(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=e[t];n!==s&&r.push({change:o=>{i.setValue(t,et.lerp(n,s,o))}})}function qz(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=n.toArray(),o=e[t];us.isEqual(s,o)||r.push({change:a=>{n.fromArray(us.lerp(s,o,a))}})}function Yz(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=n.toArray(),o=e[t];br.isEqual(s,o)||r.push({change:a=>{n.fromArray(br.lerp(s,o,a))}})}function Xz(i,e,t,r,n){if(!i.hasValue(t)||!(t in e))return;let s=i.getValue(t).clone(),o=e[t],a=typeof o=="string"?n.getColor(o):o;if(Ar.equals(s,a))return;let l=s.clone();i.setValue(t,l),r.push({change:c=>{let{r:h,g:u,b:f}=Ar.lerp(s,a,c);l.setRGB(h,u,f)}})}function Qz(i,e,t,r,n){if(!i.hasValue(t)||!(t in e))return;let s=i.getValue(t).clone(),o=e[t],a=typeof o=="string"?n.getColor(o):o;if(Ln.equals(s,a))return;let l=s.clone();i.setValue(t,l),r.push({change:c=>{let{r:h,g:u,b:f,a:d}=Ln.lerp(s,a,c);l.setRGBA(h,u,f,d)}})}function Jz(i,e,t="steps",r){if(!i.hasValue(t)||!(t in e))return;let n=[...i.getValue(t)],s=e[t];for(let o=0;o<n.length;++o){let a=n[o],l=s[o];a!==l&&r.push({change:c=>{n[o]=et.lerp(a,l,c),i.setValue("steps",n)}})}}function Kz(i,e,t="colors",r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=e[t];for(let o=0;o<n.length;++o){let a=n[o].toArray(),l=s[o];Ch.isEqual(a,l)||r.push({change:c=>{n[o].fromArray(Ch.lerp(a,l,c))}})}}function Zz(i,e,t="texture",r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue("texture"),s=e[t],o=n.repeat.toArray(),a=n.offset.toArray(),l=s.repeat,c=s.offset;(!us.isEqual(o,l)||!us.isEqual(a,c))&&r.push({change:h=>{n.repeat.fromArray(us.lerp(o,l,h)),n.offset.fromArray(us.lerp(a,c,h)),n.updateMatrix(),n.needsUpdate=!0}})}function fT(i,e,t,r){if(r===0)return t.copy(i);if(r===1)return t.copy(e);let n=i.w*e.w+i.x*e.x+i.y*e.y+i.z*e.z;if(n>=1)return t.copy(i);let s=1-n*n;if(s<=Number.EPSILON){let h=1-r;return t.w=h*i.w+r*e.w,t.x=h*i.x+r*e.x,t.y=h*i.y+r*e.y,t.z=h*i.z+r*e.z,t.normalize(),t}let o=Math.sqrt(s),a=Math.atan2(o,n),l=Math.sin((1-r)*a)/o,c=Math.sin(r*a)/o;return t.w=i.w*l+e.w*c,t.x=i.x*l+e.x*c,t.y=i.y*l+e.y*c,t.z=i.z*l+e.z*c,t}function dT(i,e,t=0){let r=Array.isArray(i.material)?i.material[t]:i.material,n;return"materials"in e?n=e.materials[t]:"material"in e&&(n=e.material),[r,n]}var hx=new M,ux=new M,pT=new zt,$z=new yn,eG=new Ae;function mT(i,e,t,r){if(t.position!==void 0){let n=i.position.toArray(),s=t.position;br.isEqual(n,s)||r.push({change:o=>{i.position.fromArray(br.lerp(n,s,o)),i.updateMatrix(),er(i)&&Lt(i.parent)&&i.invalidateDownstreamBooleanData(!0)}})}if(t.scale!==void 0){let n=i.scale.toArray(),s=t.scale;br.isEqual(n,s)||r.push({change:o=>{i.scale.fromArray(br.lerp(n,s,o)),i.updateMatrix(),er(i)&&Lt(i.parent)&&i.invalidateDownstreamBooleanData(!0)}})}tG(i,e,t,r),rG(i,t,r)}function tG(i,e,t,r){if(t.rotation===void 0)return;let n=hx.setFromEuler(i.rotation).toArray(),s=t.rotation;if(br.isEqual(n,s))return;if(br.sub(t.rotation,e?e.rotation:i.rotation).every(a=>Math.abs(a)<2*Math.PI)){let a=i.quaternion.clone(),l=new zt().setFromEuler($z.set(t.rotation[0],t.rotation[1],t.rotation[2]));r.push({change:c=>{fT(a,l,i.quaternion,c),i.updateMatrix(),er(i)&&Lt(i.parent)&&i.invalidateDownstreamBooleanData(!0)}})}else r.push({change:a=>{i.rotation.setFromVector3(ux.fromArray(br.lerp(n,s,a))),i.updateMatrix(),er(i)&&Lt(i.parent)&&i.invalidateDownstreamBooleanData(!0)}})}function rG(i,e,t){if(e.hiddenMatrix!==void 0&&!Pi.isEqual(i.hiddenMatrix.toArray(),e.hiddenMatrix)){let r=new M,n=new zt,s=new M;i.hiddenMatrix.decompose(r,n,s);let o=new M,a=new zt,l=new M;eG.fromArray(e.hiddenMatrix).decompose(o,a,l),t.push({change:c=>{pT.slerpQuaternions(n,a,c),hx.lerpVectors(r,o,c),ux.lerpVectors(s,l,c),i.hiddenMatrix.compose(hx,pT,ux),er(i)&&Lt(i.parent)&&i.invalidateDownstreamBooleanData(!0)}})}}function gT(i,e,t,r){let n=[];if((i.visible||Lt(i.parent))&&mT(i,e==null?void 0:e.objectState,t.objectState,n),er(i)){if((i.visible||Lt(i.parent))&&"geometry"in t.objectState&&cT(i,t.objectState.geometry,n),i.visible&&("material"in t.objectState||"materials"in t.objectState)){let[s,o]=dT(i,t.objectState,i.selectedMaterial);s&&o&&typeof o!="string"&&uT(s,o,n,r)}}else i.visible&&O1(i)?hT(i,t.objectState,n,r):N1(i)&&lT(i,t.objectState,n);return n.length?{change:s=>{n.forEach(o=>{o.change&&o.change(s)})}}:void 0}function nG(i,e,t){switch(i){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 5:let{control1:r,control2:n}=e!=null?e:ie({},Fd.defaultData);return`cubicBezier( ${r[0]}, ${r[1]}, ${n[0]}, ${n[1]} )`;case 6:let{mass:s,stiffness:o,damping:a,velocity:l}=t!=null?t:ie({},Od.defaultData);return`spring( ${s}, ${o}, ${a}, ${l} )`}}var sm=class{constructor(e,t){this.object=e;this.sharedAssets=t;this.uuid=et.generateUUID();this.states=[];this.events={};this.animatingState=0;this._scrollCounter=null}get fromState(){return this._fromState}get animation(){return this._animation}start(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._scrollCounter=null),this.states.length>1&&(this.states[0].execute(this.object,this.sharedAssets),this._toState=this.states[0],this._fromState=void 0)}end(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0),this.states.length>1&&this.states[0].execute(this.object,this.sharedAssets),this._toState=void 0,this._fromState=void 0}seek(e,t,r,n,s){var o;this._scrollCounter===null&&(this.animate(e,n,s),this._scrollCounter=0),this._scrollCounter+=t,this._scrollCounter=Math.min(Math.max(this._scrollCounter,0),r),(o=this._animation)==null||o.seek(this._scrollCounter/r*(n.duration?n.duration:1))}animate(e,s,n){var o=s,{autoplay:t=!0}=o,r=Eu(o,["autoplay"]);var a,l,c,h,u,f;if(this._fromState===e&&((a=this._animation)==null?void 0:a.reversed)){let d=(c=(l=this._animation)==null?void 0:l.currentTime)!=null?c:0;(h=this._animation)==null||h.reset(),(u=this._animation)==null||u.seek(d),(f=this._animation)==null||f.play()}else if(this._toState!==e){this._animation!==void 0&&this._animation.pause(),this.animatingState=0,this._fromState=this._toState,this._toState=e;let d=gT(this.object,this._fromState,e,this.sharedAssets);if(!d)return;let p={t:0};this._animation=aT({autoplay:t,loop:r.repeat?!0:r.cycle?1:!1,direction:r.cycle?"alternate":"normal",rewind:r.rewind,delay:r.delay,endDelay:r.delay,duration:r.duration,easing:nG(r.easing,r.cubicControls,r.springParameters),targets:p,t:1,change:()=>{d.change&&d.change(p.t),n!=null&&n.change&&n.change(p.t)},loopBegin:m=>{if(this.animatingState===0){this.animatingState=1;return}m.reversed?(this._toState=this._fromState,this._fromState=e):(this._fromState=this._toState,this._toState=e)}}),t&&this._animation.finished.then(()=>{this._animation=void 0,this.animatingState=0})}}emitEvent(e){var t;if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let r=this.events[e];if(r){for(let n of r)if("targets"in n)for(let{object:s,state:o,params:a}of n.targets)(t=s.interaction)==null||t.animate(o,a)}}}emitEventReverse(e){if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let t=this.events[e];if(t){for(let r of t)if("targets"in r)for(let{object:n,params:s}of r.targets){let o=n.interaction;(o==null?void 0:o._fromState)!==void 0&&o.animate(o._fromState,s)}}}}};var gc=class{static create(e,t){if(e.object){let r=t.find(e.object);if(r!=null&&r.interaction){let n=e.state?r.interaction.states.find(s=>s.uuid===e.state):r.interaction.states[0];if(n){let s={cycle:e.cycle,rewind:e.rewind,repeat:e.repeat,duration:e.duration,delay:e.delay,easing:e.easing};if(e.easing===5){let o=e;s.cubicControls={control1:[...o.control1],control2:[...o.control2]}}if(e.easing===6){let o=e;s.springParameters={mass:o.mass,stiffness:o.stiffness,damping:o.damping,velocity:o.velocity}}return new gc(r,n,s)}}}}constructor(e,t,r){this.object=e,this.state=t,this.params=r}};var fx=new Map,wu={url:"head",time:0,data:null,next:null,prev:null},yc={url:"tail",time:1/0,data:null,next:null,prev:null};wu.next=yc;yc.prev=wu;var yT=0;function co(i){if(typeof i=="string")return i;let e=Date.now(),t=fx.get(i);return t===void 0?(t={url:URL.createObjectURL(new Blob([i])),data:i,time:e,next:null,prev:null},fx.set(i,t)):(t.time=e,t.prev.next=t.next,t.next.prev=t.prev),t.prev=yc.prev,t.next=yc,yc.prev.next=t,yc.prev=t,e-yT>1e3*10&&(yT=e+1e3,setTimeout(()=>{let r=Date.now(),n=wu.next;for(;n.time<r-1e3*10;)URL.revokeObjectURL(n.url),fx.delete(n.data),n=n.next,n.prev=wu,wu.next=n},900)),t.url}var vT=new Yr,ra=class extends Wr{},om=class{constructor(e){this.materials={};this.images={};this.colors={};this.transmissionRenderTarget=new mt(2048,2048,{generateMipmaps:!0,minFilter:js,magFilter:ct,wrapS:Dr,wrapT:Dr}),this.transmissionRenderTarget.depthTexture=new oi(2048,2048),this.reset(e)}reset(e){for(let[t,r]of Object.entries(e.images))this.addImage(t,r.data);for(let[t,r]of Object.entries(e.colors))this.addColor(t,r);for(let[t,r]of Object.entries(e.materials))this.addMaterial(t,Tv(r,this))}get transmissionSamplerMap(){return this.transmissionRenderTarget.texture}get transmissionDepthMap(){return this.transmissionRenderTarget.depthTexture}addMaterial(e,t){t.uuid=e,this.materials[e]=t}deleteMaterial(e){this.materials[e]&&(this.materials[e].dispose(),delete this.materials[e])}isSharedMaterial(e){return e.uuid in this.materials||e===vT}getMaterial(e){let t=this.materials[e];return t}getMaterialOrDeletedPlaceholder(e){var t;return(t=this.materials[e])!=null?t:vT}getMaterials(){return this.materials}addImage(e,t){if(this.images[e])return this.images[e].onload=()=>{this.onImageLoad&&this.onImageLoad()},this.images[e].src=co(t),!0;{let r=new Image;return r.src=co(t),r.onload=()=>{this.onImageLoad&&this.onImageLoad()},this.images[e]=r,!1}}deleteImage(e){this.images[e]&&delete this.images[e]}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]}getImages(){return this.images}addColor(e,t){return this.colors[e]?("a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new ra(t.r,t.g,t.b,t.a):this.colors[e]=new ra(t.r,t.g,t.b,1),!1)}updateColor(e,t){var r,n,s,o;if(this.colors[e]){let a=this.colors[e];return this.colors[e].r=(r=t.r)!=null?r:a.r,this.colors[e].g=(n=t.g)!=null?n:a.g,this.colors[e].b=(s=t.b)!=null?s:a.b,this.colors[e].a=(o=t.a)!=null?o:a.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this.transmissionRenderTarget.depthTexture.dispose(),this.transmissionRenderTarget.dispose(),this.onImageLoad=void 0}};function iG(i,e){switch(i.type){case"noise":return e==="noiseType";case"texture":return e==="projection"||e==="axis"||e==="side";case"displace":return e==="noiseType";case"depth":return e==="num"||e==="smooth"||e==="isWorldSpace"||e==="gradientType";default:return!1}}function dx(i,e,t,r,n){var o;let s=!1;for(let[a,l]of Object.entries(i)){if(!a||l===void 0||Np(a,t,n))continue;t.visible=n.visible;let c=t.uniforms[`f${t.id}_${a}`];if(!!c)switch(c.constructor){case Ot:if(typeof l=="string"){let h=e.getColor(l);h&&(c.value=h);break}else{let h=l;c.value instanceof ra?c.value=new Wr(h.r,h.g,h.b,h.a):c.setRGBA(h);break}case fi:if(typeof l=="string"){let h=e.getColor(l);h&&(c.value=h);break}else{let h=l;c.value instanceof ra?c.value=new Wr(h.r,h.g,h.b,h.a):c.value.setRGBA(h.r,h.g,h.b,h.a);break}case Nr:{let h=l;c.value.setX(h[0]),c.value.setY(h[1]);break}case Or:{let h=l;c.value.setX(h[0]),c.value.setY(h[1]),c.value.setZ(h[2]);break}case jr:{let h=l;if("image"in h){let u=h.iamge;if(typeof u=="string"){let f=e.getImage(u);f&&(c.value.image=f)}else{let f=new Image;f.src=co(u.data),c.value.image=f}}"wrapping"in h&&(c.value.wrapS=c.value.wrapT=h.wrapping),"repeat"in h&&c.value.repeat.fromArray(h.repeat),"offset"in h&&c.value.offset.fromArray(h.offset),c.value.needsUpdate=!0;break}case ps:{l.forEach((h,u)=>{c.value[u].setX(h[0]),c.value[u].setY(h[1]),c.value[u].setZ(h[2]),c.value[u].setW(h[3])});break}default:{s=s||iG(t,a),c.value=l;break}}}if(s&&n){let a=Bp({id:"0",fi:0,data:n},e);(o=r.userData.layers)==null||o.changeLayer(t.id,ie({},a)),r.dispose(),r.needsUpdate=!0}}var px=new M,xT=new Gr,bT=new Ae,Su={type:"follow",normal:new M,raycaster:new io},vc;(t=>{function i(r){if(r.type===10)return{type:"follow"}}t.create=i;function e({target:r,normal:n,raycaster:s,begin:o,change:a}){!r||!n||!s||(o&&o("follow",r.uuid),xT.setFromNormalAndCoplanarPoint(n,r.getWorldPosition(px)),s.ray.intersectPlane(xT,px),r.position.copy(px),r.parent!==null&&r.position.applyMatrix4(bT.copy(r.parent.matrixWorld).invert()),r.position.applyMatrix4(bT.copy(r.hiddenMatrix).invert()),r.updateMatrix(),er(r)&&Lt(r.parent)&&r.invalidateDownstreamBooleanData(!0),a&&a())}t.listener=e})(vc||(vc={}));var mx=new M,wT=new Gr,Mu={type:"lookAt",normal:new M,raycaster:new io},xc;(t=>{function i(r){if(r.type===9&&r.distance)return{type:"lookAt",distance:r.distance}}t.create=i;function e({target:r,normal:n,raycaster:s,begin:o,change:a}){var c,h,u;if(!((h=(c=r==null?void 0:r.interaction)==null?void 0:c.events.lookAt)!=null&&h.length)||!n||!s)return;o&&o("lookAt",r.uuid);let l=r.interaction.events.lookAt[0].distance;wT.set(n,-l),s.ray.intersectPlane(wT,mx),r.lookAt(mx),r.updateMatrix(),(u=r.interaction.animation)==null||u.finished.then(()=>{r.lookAt(mx),r.updateMatrix(),er(r)&&Lt(r.parent)&&r.invalidateDownstreamBooleanData(!0)}),er(r)&&Lt(r.parent)&&r.invalidateDownstreamBooleanData(!0),a&&a()}t.listener=e})(xc||(xc={}));var gx={type:"start"},bc;(t=>{function i(r){if(r.type===7)return{type:"start",targets:[]}}t.create=i;function e({target:r,begin:n,change:s}){var a,l;if(!((l=(a=r==null?void 0:r.interaction)==null?void 0:a.events.start)!=null&&l.length))return;n&&n("start",r.uuid);let o={change:s};r.interaction.events.start.forEach(c=>{c.targets.forEach(({object:h,state:u,params:f})=>{var d;return(d=h.interaction)==null?void 0:d.animate(u,f,o)})})}t.listener=e})(bc||(bc={}));var am={type:"scroll"},wc;(t=>{function i(r){if(!(r.type!==11||r.steps===void 0))return{type:"scroll",targets:[],steps:r.steps}}t.create=i;function e({target:r,deltaY:n,begin:s,change:o}){var c,h;if(!((h=(c=r==null?void 0:r.interaction)==null?void 0:c.events.scroll)!=null&&h.length)||!n)return;s&&s("scroll",r.uuid);let a={change:o},l=n>0?1:-1;r.interaction.events.scroll.forEach(u=>{u.targets.forEach(({object:f,state:d,params:p})=>{var g;let m=xe(ie({},p),{autoplay:!1,cycle:!1,rewind:!1,repeat:!1});(g=f.interaction)==null||g.seek(d,l,u.steps,m,a)})})}t.listener=e})(wc||(wc={}));var Mc={type:"mouseHover"},Sc;(t=>{function i(r){if(r.type===2)return{type:"mouseHover",targets:[]}}t.create=i;function e({target:r,begin:n,change:s,enter:o}){var l,c;if(!((c=(l=r==null?void 0:r.interaction)==null?void 0:l.events.mouseHover)!=null&&c.length)||o===void 0)return;n&&n("mouseHover",r.uuid);let a={change:s};o?r.interaction.events.mouseHover.forEach(h=>{h.targets.forEach(({object:u,state:f,params:d})=>{var p;(p=u.interaction)==null||p.animate(f,d,a)})}):r.interaction.events.mouseHover.forEach(h=>{h.targets.forEach(({object:u,params:f})=>{let d=u.interaction;(d==null?void 0:d.fromState)!==void 0&&d.animate(d.fromState,f,a)})})}t.listener=e})(Sc||(Sc={}));var yx={type:"mouseDown"},vx={type:"mouseUp"},lm={type:"keyDown"},cm={type:"keyUp"},xs;(t=>{function i(r){var o,a;let n,s;if(r.type===0)n={type:"mousedown"},s="mouseDown";else if(r.type===1)n={type:"mouseup"},s="mouseUp";else if(r.type===5){if(!r.key)return;n={type:"keydown",key:r.key},s="keyDown"}else if(r.type===6){if(!r.key)return;n={type:"keyup",key:r.key},s="keyUp"}else return;return{type:s,domEvent:n,targets:[],url:(o=r.url)!=null?o:void 0,toggle:(a=r.toggle)!=null?a:!1,enable:!1}}t.create=i;function e({target:r,interactionEvents:n,type:s,begin:o,change:a}){var c;if(!r)return;n||(n=(c=r.interaction)==null?void 0:c.events[s]),o&&o(s,r.uuid);let l={change:a};n.forEach(h=>{if(h.toggle){h.enable=!h.enable;for(let{object:u,state:f,params:d}of h.targets){let p=u.interaction;if(p!==void 0){let m=xe(ie({},d),{cycle:!1,rewind:!1,repeat:!1});h.enable?p.animate(f,m,l):p.fromState!==void 0&&p.animate(p.fromState,m,l)}}}else h.targets.forEach(({object:u,state:f,params:d})=>{var p;return(p=u.interaction)==null?void 0:p.animate(f,d,l)});h.url&&(Ho?window.location.assign(h.url):window.open(h.url,"_blank"))})}t.listener=e})(xs||(xs={}));function sG(i){let e,{type:t}=i;return t===10?e=vc.create(i):t===0||t===1||t===5||t===6?e=xs.create(i):t===9?e=xc.create(i):t===2?e=Sc.create(i):t===11?e=wc.create(i):t===7&&(e=bc.create(i)),e}function ST(i,e,t){let r=[];i.objects.traverse((n,s)=>{let o=e.find(n);if(delete o.interaction,!s.visible&&!Lt(o.parent)||s.states===void 0)return;let a=new sm(o,t),l=a.states;l.push(na.create(n,s));for(let h of s.states){let u=Oh.patch(s,h.data);l.push(na.create(h.id,u))}let c=a.events;if(s.events)for(let{data:h}of s.events){let u=sG(h);if(!u)continue;let f=u.type;c[f]?c[f].push(u):c[f]=[u],"targets"in h&&r.push([h,u])}(l.length>0||Object.keys(c).length>0)&&(o.interaction=a,xx(o,s,null,t))});for(let[n,s]of r)if("targets"in n&&"targets"in s)for(let{data:o}of n.targets){let a=gc.create(o,e);a&&s.targets.push(a)}}function xx(i,e,t,r,n=!1){if(!n&&e.states.length===0)return;let s=t===null?e:Oh.patch(e,e.states.data(t));if(Ev(i,s),i instanceof kt&&s.type==="Mesh"){if(i instanceof po?i.buildFromStore(s.geometry):i.updateGeometry({parameters:s.geometry}),i.freeBooleanPointer(),Lt(i.parent)&&i.parent.invalidateDownstreamBooleanData().recomputeBoolean(),"material"in s){if(i.material instanceof Array)return;if(typeof s.material!="string"){let a=s.material.layers;for(let l of a){let c=i.material.userData.layers.getLayerByUuid(l.id);dx(l.data,r,c,i.material,l.data)}}}else if("materials"in s){if(!(i.material instanceof Array))return;var o=0;for(let a of s.materials){if(typeof a!="string"){let l=a.layers;for(let c of l){let h=i.material[o].userData.layers.getLayerByUuid(c.id);dx(c.data,r,h,i.material[o],c.data)}}o++}}}else if(s.type==="DirectionalLight")i.fromDirectionalLightState(s,r);else if(s.type==="PointLight")i.fromPointLightState(s,r);else if(s.type==="SpotLight")i.fromSpotLightState(s,r);else if(i instanceof Bn&&eo.is(s.type)){let a=s;i.setZoom("PerspectiveCamera",a.perspective.zoom),i.setZoom("OrthographicCamera",a.orthographic.zoom)}}var na=class{constructor(e){this.objectState=e;this.uuid=et.generateUUID()}static create(e,t){let r=new na(t);return r.uuid=e,r}execute(e,t){xx(e,this.objectState,null,t,!0)}};var Yi=new io,Zn=new M,bx={follow:vc.listener,keyDown:xs.listener,keyUp:xs.listener,lookAt:xc.listener,mouseDown:xs.listener,mouseUp:xs.listener,mouseHover:Sc.listener,scroll:wc.listener,start:bc.listener},MT={follow:Su,keyDown:lm,keyUp:cm,lookAt:Mu,mouseDown:yx,mouseUp:vx,mouseHover:Mc,scroll:am,start:gx};function oG(i){if(i.style.transform!==""){let e=getComputedStyle(i).getPropertyValue("transform");if(e!=="none"){let t=e.replace("matrix(","").split(",");return{x:parseFloat(t[0]),y:parseFloat(t[3])}}}return{x:1,y:1}}function AT(i){let e=i.getViewport(new Je),t=oG(i.domElement);return{left:e.x*t.x,top:e.y*t.y,width:e.z*t.x,height:e.w*t.y}}function wx(i,e){if(er(e)){if(!e.raycastLock&&e.visible){let t=i.intersectObject(e,!1);return t.length?t[0]:void 0}}else if(e.objectType==="EmptyObject")return TT(i,e)}function TT(i,e){if(er(e)&&!e.raycastLock&&e.visible){let t=i.intersectObject(e,!1);if(t.length)return t[0]}for(let t of e.children)if(Zo(t)){let r=TT(i,t);if(r)return r}}var hm=class{constructor(e,t,r,n){this.isEnable=!1;this.splineEvents={};this._map={};this._prevObjects=[];this._onMouseDown=e=>{Yi.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Zn),Zn.negate(),this._handleMouseDownEvent(e)};this._onMouseUp=e=>{Yi.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Zn),Zn.negate(),this._handleMouseUpEvent(e)};this._onMouseMove=e=>{Yi.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Zn),Zn.negate(),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e)};this._onTouchStart=e=>{e.touches.length===1&&(Yi.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(Zn),Zn.negate(),this._handleMouseDownEvent(e),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e))};this._onTouchEnd=e=>{this._handleMouseUpEvent(e),this._handleMouseHoverEvent(e,!0)};this._onTouchMove=e=>{e.touches.length===1&&(Yi.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(Zn),Zn.negate(),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e))};this._onWheel=e=>{this._handleWheelEvent(e)};this._onKeyDown=e=>{this._handleKeyDownEvent(e)};this._onKeyUp=e=>{this._handleKeyUpEvent(e)};this._renderer=e,this._domElement=e.domElement,this._camera=r,this._scene=t,this._app=n,this._domRect=this._domElement.getBoundingClientRect(),this._viewRect=AT(e)}activate(){var e,t,r,n,s,o,a,l,c,h,u,f,d,p,m,g,v,y;this.isEnable=!0,this._map={},this._scene.traverseEntity(w=>{w.interaction!==void 0&&(w.interaction.start(),Object.keys(w.interaction.events).forEach(b=>{let S=b;this._addDOMCustomEvent(S,w),(w.visible||S!=="mouseDown"&&S!=="mouseUp"&&S!=="mouseHover")&&this._addSPEEvent(S,w)}))}),Bd?((((e=this._map.mouseDown)==null?void 0:e.length)||((t=this._map.mouseHover)==null?void 0:t.length)||((r=this._map.lookAt)==null?void 0:r.length)||((n=this._map.follow)==null?void 0:n.length))&&this._domElement.addEventListener("touchstart",this._onTouchStart),(((s=this._map.mouseUp)==null?void 0:s.length)||((o=this._map.mouseHover)==null?void 0:o.length))&&this._domElement.addEventListener("touchend",this._onTouchEnd),(((a=this._map.mouseHover)==null?void 0:a.length)||((l=this._map.lookAt)==null?void 0:l.length)||((c=this._map.follow)==null?void 0:c.length))&&this._domElement.addEventListener("touchmove",this._onTouchMove)):((h=this._map.mouseDown)!=null&&h.length&&this._domElement.addEventListener("pointerdown",this._onMouseDown),(u=this._map.mouseUp)!=null&&u.length&&this._domElement.addEventListener("pointerup",this._onMouseUp),(((f=this._map.mouseHover)==null?void 0:f.length)||((d=this._map.lookAt)==null?void 0:d.length)||((p=this._map.follow)==null?void 0:p.length))&&this._domElement.addEventListener("pointermove",this._onMouseMove)),(m=this._map.scroll)!=null&&m.length&&this._domElement.addEventListener("wheel",this._onWheel),(g=this._map.keyDown)!=null&&g.length&&document.addEventListener("keydown",this._onKeyDown),(v=this._map.keyUp)!=null&&v.length&&document.addEventListener("keyup",this._onKeyUp),(y=this._map.start)!=null&&y.length&&this._handleStartEvent(),this.resize()}deactivate(){this._scene.traverseEntity(e=>{if(!e.interaction)return;e.interaction.end();let t=e;Object.keys(bx).forEach(r=>{let n=r;t.removeEventListener(n,bx[n])})}),this._domElement.removeEventListener("pointerdown",this._onMouseDown),this._domElement.removeEventListener("pointerup",this._onMouseUp),this._domElement.removeEventListener("pointermove",this._onMouseMove),this._domElement.removeEventListener("touchstart",this._onTouchStart),this._domElement.removeEventListener("touchend",this._onTouchEnd),this._domElement.removeEventListener("touchmove",this._onTouchMove),this._domElement.removeEventListener("wheel",this._onWheel),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keyup",this._onKeyUp),this._map={},this.isEnable=!1}reset(){this._scene.traverseEntity(e=>{var t;(t=e.interaction)==null||t.start()}),this._handleStartEvent()}resize(){this._domRect=this._domElement.getBoundingClientRect(),this._viewRect=AT(this._renderer)}_getPointer(e,t){let r=this._domRect,n=this._viewRect,s=r.height-n.height,o=(e-n.left-r.left)*(r.width/n.width),a=(t-s+n.top-r.top)*(r.height/n.height);return{x:o/r.width*2-1,y:-(a/r.height)*2+1}}_handleStartEvent(){var e;(e=this._map.start)==null||e.forEach(t=>{t.dispatchEvent(gx)})}_handleWheelEvent(e){var t;(t=this._map.scroll)!=null&&t.length&&(am.deltaY=e.deltaY,this._map.scroll.forEach(r=>{r.dispatchEvent(am)}))}_handleMouseDownEvent(e){var t;(t=this._map.mouseDown)==null||t.forEach(r=>{wx(Yi,r)&&r.dispatchEvent(yx)})}_handleMouseUpEvent(e){var t;(t=this._map.mouseUp)==null||t.forEach(r=>{wx(Yi,r)&&r.dispatchEvent(vx)})}_handleMouseHoverEvent(e,t=!1){var n;let r=[];t||(n=this._map.mouseHover)==null||n.forEach(s=>{wx(Yi,s)&&r.push(s)}),this._prevObjects.length&&(Mc.enter=!1,this._prevObjects.forEach(s=>{r.includes(s)||s.dispatchEvent(Mc)})),r.length&&(Mc.enter=!0,r.forEach(s=>{s.dispatchEvent(Mc)})),this._prevObjects=r}_handleLookAtEvent(e){var t;(t=this._map.lookAt)!=null&&t.length&&(Mu.normal=Zn,Mu.raycaster=Yi,this._map.lookAt.forEach(r=>{r.dispatchEvent(Mu)}))}_handleFollowEvent(e){this._map.follow&&(Su.normal=Zn,Su.raycaster=Yi,this._map.follow.forEach(t=>t.dispatchEvent(Su)))}_handleKeyDownEvent(e){var t;(t=this._map.keyDown)==null||t.forEach(r=>{var n,s,o;lm.interactionEvents=(o=(s=(n=r.interaction)==null?void 0:n.events)==null?void 0:s.keyDown)==null?void 0:o.filter(a=>a.domEvent.type==="keydown"&&a.domEvent.key===e.key),r.dispatchEvent(lm)})}_handleKeyUpEvent(e){var t;(t=this._map.keyUp)==null||t.forEach(r=>{var n,s,o;cm.interactionEvents=(o=(s=(n=r.interaction)==null?void 0:n.events)==null?void 0:s.keyUp)==null?void 0:o.filter(a=>a.domEvent.type==="keyup"&&a.domEvent.key===e.key),r.dispatchEvent(cm)})}_addSPEEvent(e,t){var r;!t.interaction||(MT[e].begin=this._dispatchDOMCustomEvent.bind(this),MT[e].change=this._app.requestRender.bind(this),(r=t.interaction.events[e])!=null&&r.length&&(t.addEventListener(e,bx[e]),this._map[e]===void 0?this._map[e]=[t]:this._map[e].push(t)))}_addDOMCustomEvent(e,t){if(e){let r=new CustomEvent(e,{bubbles:!0});Object.defineProperty(r,"target",{writable:!1,value:{id:t.uuid,name:t.name}}),this.splineEvents[e]?this.splineEvents[e][t.uuid]=r:this.splineEvents[e]={[t.uuid]:r}}}_dispatchDOMCustomEvent(e,t){var n;let r=(n=this.splineEvents[e])==null?void 0:n[t];r&&this._domElement.dispatchEvent(r)}};var um=class{constructor(e,t,r,n,s){this._aspect=1;this._renderer=e,this._camera=t,this._frameSize=new B().copy(r),this._editorSize=new B().copy(n),this._aspect=t.aspect,this._fov=s!=null?s:t.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){!this._renderer||this._renderer.setSize(this._frameSize.x,this._frameSize.y,!1)}updateViewportForImageExport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,n=this._editorSize.y;this._aspect=e/t,this._camera.zoom*=Math.min(r/e,n/t),this._renderer.setViewport(0,0,e,t)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,n=this._editorSize.y,s=0,o=0,a=e,l=t;e<r&&(s=(r-e)*.5,s=-s,a=r),t<n&&(o=(n-t)*.5,o=-o,l=n),this._aspect=a/l,this._renderer.setViewport(s,o,a,l)}updateCamera(){if(!!this._camera)if(this._camera.cameraType==="PerspectiveCamera"){let e=this._frameSize.y,t=this._editorSize.y,r=this._fov;if(e>t){let n=aG(e,1080,2160,1,15)/100;r*=e/t,r*=1-n}this._camera.aspect=this._aspect,this._camera.fov=r,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y)}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t,!1)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t),this._camera.updateProjectionMatrix())}};function aG(i,e,t,r,n){return(i-e)/(t-e)*(n-r)+r}var fm=class{constructor(e){this.sharedAssets=new om(e.shared),this.scene=new Zp(e.scene,this.sharedAssets),this.scene.switchActiveCamera(this.scene.activeCamera)}reset(e,t){this.scene.clearScene(this.sharedAssets),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}dispose(){this.scene.dispose()}};var dm=class{constructor({x:e=10,y:t=10}){this._startTime=0;let r=document.getElementById("spe-perfs");r?this.element=r:(this.element=document.createElement("div"),document.body.appendChild(this.element),this.element.style.position="absolute",this.element.style.zIndex="10000",this.element.style.fontFamily="monospace",this.element.style.background="black",this.element.style.color="white",this.element.style.padding="10px",this.element.style.opacity="0.5",this.element.style.fontSize="11px",this.element.setAttribute("id","spe-perfs")),this.element.style.left=`${e}px`,this.element.style.top=`${t}px`}dispose(){var e;(e=this.element.parentElement)==null||e.removeChild(this.element)}start(){this._startTime=performance.now()}end(){let t=performance.now()-this._startTime;this.element.innerHTML=t.toFixed(3)+" ms"}};function lG(i){let e;if(!!i.index)for(let t=0;t<i.index.array.length;t+=3)e=i.index.array[t],i.index.array[t]=i.index.array[t+2],i.index.array[t+2]=e}function Sx(i){return i==="SubdivObject"||i==="NonParametric"?i:"Mesh"}function cG(i,e){let t={};return i.traverseEntity(r=>{var c;if(r.type!=="Mesh"||!("material"in r)||!r.visible||!(r instanceof kt)||Array.isArray(r.material)||r&&r.interaction&&r.interaction.states.length>0)return;let n=r.parent;for(;n;){if(n instanceof kt&&n.interaction&&n.interaction.states.length>1)return;n=n.parent}let s=r.material.uuid,o=e.shared.materials[s];if(o){if(!hi.isMergable(o))return}else{let h=(c=e.scene.objects.get(r.uuid))==null?void 0:c.data;if(h&&"material"in h&&typeof h.material!="string"){if(!hi.isMergable(h.material))return;s=hi.getHash(h.material)}}t[s]||(t[s]={});let l=t[s][Sx(r.objectType)];if(l){if(l.push(r),r.cloner)for(let h of r.cloner.children)l.push(h)}else if(t[s][Sx(r.objectType)]=[r],r.cloner)for(let h of r.cloner.children)t[s][Sx(r.objectType)].push(h)}),t}function hG(i){let e=0;return Object.values(i).forEach(t=>{Object.values(t).forEach(r=>{let n=r.length;n>e&&(e=n)})}),e}function ET(i,e){let t=cG(e,i),r=hG(t),n=new Array(r),s=0,o=new Array(r),a=0,l=new Array(r),c=0,h=new Array(r),u=0;for(let f of Object.values(t))for(let d of Object.values(f)){if(a=0,c=0,d.forEach(m=>{m instanceof kt&&(o[a++]=m.geometry.clone(),l[c++]=m)}),c<2)continue;for(let m=0;m<c;m++)l[m].updateWorldMatrix(!0,!1),o[m].applyMatrix4(l[m].matrixWorld),l[m].matrixWorld.determinant()<0&&lG(o[m]);let p=RM(o.slice(0,a),!1);if(p){let m;switch(d[0].objectType){case"SubdivObject":{console.warn("Turning subdiv object into mesh"),m=new Vt(p,l[0].material);break}default:{m=new Vt(p,l[0].material);break}}m.castShadow=l[0].castShadow,m.receiveShadow=l[0].receiveShadow,e.add(m);let g=v=>{u=0;for(let y of v)y.children&&g(y.children),y instanceof kt&&(Array.isArray(y.material)||t[y.material.uuid]&&t[y.material.uuid][y.objectType]&&t[y.material.uuid][y.objectType].length>1||(h[u++]=y));for(let y=0;y<u;y++)e.attach(h[y])};for(let v=0;v<c;v++){let y=l[v];g(y.children),n[s++]=y}}}for(let f=0;f<s;f++)n[f].removeFromParent()}var uG=new B,_T="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.",CT=class{constructor(e,{autoRender:t=!1}={}){this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._skipRender=!0;this.autoRender=!1;this.disposed=!1;this.requestRender=()=>{this._skipRender=!1};this.render=()=>{var e,t,r;!this._renderer||(this._rafId=requestAnimationFrame(this.render),(e=this._perfs)==null||e.start(),!(!this.autoRender&&this._skipRender)&&(this._controls&&(this._controls.enableDamping||this._controls.autoRotate)?this._skipRender=!this._controls.update():this._skipRender=!0,this._playmode&&!this._playmode.isEnable&&this._playmode.activate(),this._scene&&this._camera&&(this._renderer.autoClear=!1,this._transmissionRenderTarget&&(this._renderer.setRenderTarget(this._transmissionRenderTarget),this._renderer.clear(),this._camera.layers.enable(0),this._camera.layers.disable(3),this._renderer.render(this._scene,this._camera),this._renderer.setRenderTarget(null),this._camera.layers.enable(3)),(t=this._scene.postprocessing)!=null&&t.enabled?(this._renderer.autoClear=!1,this._scene.postprocessing.render()):(this._renderer.autoClear=!0,this._renderer.render(this._scene,this._camera))),(r=this._perfs)==null||r.end()))};this.resize=Mh(()=>{var e,t,r,n,s;!this._renderer||(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=uG.set(this._viewportWidth,this._viewportHeight)),(e=this._frameView)==null||e.updateRenderer(),(t=this._scene)!=null&&t.postprocessing&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight,!1),this._viewportMode!==1&&((r=this._frameView)==null||r.updateViewport()),this._camera&&((n=this._frameView)==null||n.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&this._viewportMode===1&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),(s=this._playmode)==null||s.resize(),this.requestRender())},10);this.canvas=e,this.autoRender=t,window.location.search.includes("perfs")&&(this._perfs=new dm({x:10,y:10}))}async load(e){e.endsWith(".spline")?console.warn(_T+" The .spline files are only meant to be used by the Editor."):e.endsWith(".splinecode")||console.warn(_T);let r=await(await fetch(e)).arrayBuffer();await this.start(r)}async start(e){var l;if(this.disposed)return;let t=await zA(e);this._publishData=t.scene.publish,Rv(t)&&await K1();let r=new fm(t);if(window.location.search.includes("merge-geometries")){let c=performance.now();ET(t,r.scene);let h=performance.now();console.log("Merged geometries in ",h-c," ms")}this._scene=r.scene,Rv(t)&&this._scene.traverse(c=>{Lt(c)&&c.recomputeBoolean()}),this._sharedAssetsManager=r.sharedAssets,this._sharedAssetsManager.onImageLoad=()=>{this.requestRender()},ST(t.scene,this._scene,this._sharedAssetsManager),this._camera=this._scene.activeCamera;let n=Object.values(t.frames)[0],s,o;if(n)if(n.preset==="fullscreen"){this._viewportMode=1;let{width:c,height:h}=window.getComputedStyle(this.canvas);this.canvas.parentElement&&(c==="300px"||c==="auto")?(this._viewportWidth=this.canvas.parentElement.clientWidth,this.canvas.style.width="100%",s=this.canvas.style.width):this._viewportWidth=this.canvas.clientWidth,this.canvas.parentElement&&(h==="150px"||h==="auto")?(this._viewportHeight=this.canvas.parentElement.clientHeight,this.canvas.style.height="100%",o=this.canvas.style.height):this._viewportHeight=this.canvas.clientHeight}else this._viewportMode=2,this._viewportWidth=n.size[0],this._viewportHeight=n.size[1],s=this._viewportWidth+"px",o=this._viewportHeight+"px";(l=this._scene.postprocessing)!=null&&l.enabled?(this._renderer=new Pt({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"}),this._scene.postprocessing.init({renderer:this._renderer,camera:this._camera,scene:this._scene}),this._scene.postprocessing.addEventListener("smaaloaded",this.requestRender)):this._renderer=new Pt({canvas:this.canvas,antialias:!0,alpha:!0,stencil:!0,depth:!0,powerPreference:"high-performance"}),s&&(this.canvas.style.width=s),o&&(this.canvas.style.height=o),this._scene.needsTransmission(void 0)&&(this._transmissionRenderTarget=new mt(2048,2048,{generateMipmaps:!0,minFilter:js,magFilter:ct,wrapS:Dr,wrapT:Dr}),this._transmissionRenderTarget.depthTexture=new oi(2048,2048),this._scene.needsTransmission(this._transmissionRenderTarget)),this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._scene.postprocessing&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight,!1),this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=Zg,this._renderer.setClearColor(this._scene.bgColor,this._scene.alpha),this._frameView=new um(this._renderer,this._camera,new B(this._viewportWidth,this._viewportHeight),new B(window.innerWidth,window.innerHeight)),!0&&(this._controls=new cp(this._camera,this._renderer.domElement),this._publishData&&(this._controls.fromJSON(this._publishData.orbitControls),this._controls.useKeyEvents=!1),this._controls.addEventListener("change",this.requestRender),this._controls.addEventListener("start",this.requestRender)),this._playmode=new hm(this._renderer,this._scene,this._camera,this),this.resize(),this.render(),this.canvas.parentElement&&(await QS(0),this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this.resize()}),this._resizeObserver.observe(this.canvas.parentElement))}findObjectById(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByName(e);return this._createProxyObject(t)}getSplineEvents(){var e;return(e=this._playmode)==null?void 0:e.splineEvents}emitEvent(e,t){let r=this.findObjectById(t);r==null||r.emitEvent(e)}emitEventReverse(e,t){let r=this.findObjectById(t);r==null||r.emitEventReverse(e)}addEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.addEventListener(e,t)}removeEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.removeEventListener(e,t)}setZoom(e){var t;(t=this._controls)==null||t.zoomOut(e)}setSize(e,t){this._viewportWidth=e,this._viewportHeight=t,this._viewportMode=2,this.resize()}dispose(){var e,t,r,n,s,o,a;this.disposed=!0,(e=this._playmode)==null||e.deactivate(),(t=this._scene)==null||t.dispose(),this._rafId&&cancelAnimationFrame(this._rafId),this._proxyObjectCache.forEach(l=>{py.unsubscribe(l)}),(r=this._renderer)==null||r.dispose(),(n=this._transmissionRenderTarget)==null||n.dispose(),(o=(s=this._transmissionRenderTarget)==null?void 0:s.depthTexture)==null||o.dispose(),(a=this._sharedAssetsManager)==null||a.dispose(),this._resizeObserver&&this._resizeObserver.disconnect()}_createProxyObject(e){if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);let t={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,emitEvent(n){var s;(s=e.interaction)==null||s.emitEvent(n)},emitEventReverse(n){var s;(s=e.interaction)==null||s.emitEventReverse(n)}},r=py(t,(n,s)=>{var a;typeof e[n]!="object"&&((a=Object.getOwnPropertyDescriptor(e,n))==null?void 0:a.writable)&&(e[n]=s),this.requestRender(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,r),r}};export{CT as Application};
|
|
4205
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(s){let o=s.data;switch(o.type){case"decode":n._callbacks[o.id].resolve(o);break;case"error":n._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,s){return n._taskLoad>s._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}};function fz(){let i,e;onmessage=function(o){let a=o.data;switch(a.type){case"init":i=a.decoderConfig,e=new Promise(function(h){i.onModuleLoaded=function(u){h({draco:u})},DracoDecoderModule(i)});break;case"decode":let l=a.buffer,c=a.taskConfig;e.then(h=>{let u=h.draco,f=new u.Decoder,d=new u.DecoderBuffer;d.Init(new Int8Array(l),l.byteLength);try{let p=t(u,f,d,c),m=p.attributes.map(g=>g.array.buffer);p.index&&m.push(p.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:p},m)}catch(p){console.error(p),self.postMessage({type:"error",id:a.id,error:p.message})}finally{u.destroy(d),u.destroy(f)}});break}};function t(o,a,l,c){let h=c.attributeIDs,u=c.attributeTypes,f,d,p=a.GetEncodedGeometryType(l);if(p===o.TRIANGULAR_MESH)f=new o.Mesh,d=a.DecodeBufferToMesh(l,f);else if(p===o.POINT_CLOUD)f=new o.PointCloud,d=a.DecodeBufferToPointCloud(l,f);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||f.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());let m={index:null,attributes:[]};for(let g in h){let v=self[u[g]],y,w;if(c.useUniqueIDs)w=h[g],y=a.GetAttributeByUniqueId(f,w);else{if(w=a.GetAttributeId(f,o[h[g]]),w===-1)continue;y=a.GetAttribute(f,w)}m.attributes.push(n(o,a,f,g,v,y))}return p===o.TRIANGULAR_MESH&&(m.index=r(o,a,f)),o.destroy(f),m}function r(o,a,l){let h=l.num_faces()*3,u=h*4,f=o._malloc(u);a.GetTrianglesUInt32Array(l,u,f);let d=new Uint32Array(o.HEAPF32.buffer,f,h).slice();return o._free(f),{array:d,itemSize:1}}function n(o,a,l,c,h,u){let f=u.num_components(),p=l.num_points()*f,m=p*h.BYTES_PER_ELEMENT,g=s(o,h),v=o._malloc(m);a.GetAttributeDataArrayForAllPoints(l,u,g,m,v);let y=new h(o.HEAPF32.buffer,v,p).slice();return o._free(v),{name:c,array:y,itemSize:f}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}var vo;function dz(){return vo||(vo=new $p,vo.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),vo.decoderPending}async function pz(i){if(vo){let e={attributeIDs:vo.defaultAttributeIDs,attributeTypes:vo.defaultAttributeTypes,useUniqueIDs:!1},t;try{t=await vo.decodeGeometry(new Int8Array(i).buffer,e)}catch(r){console.error(r)}if(t)return{index:t.index?{array:t.index.array}:void 0,attributes:Object.entries(t.attributes).map(([r,n])=>({name:r,itemSize:n.itemSize,array:n.array}))}}return null}async function zA(i){let[e,t]=Ay(tp.deserialize(new Uint8Array(i))),r=[];e.scene.objects.traverse((n,s)=>{s.type==="Mesh"&&s.geometry.type==="NonParametricGeometry"&&s.geometry.data.draco!==void 0&&r.push(s)}),r.length&&await dz();for(let n of r){let s=await pz(Ey(n.geometry.data.draco));if(s){s.index&&(n.geometry.data.index={array:s.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let o={};s.attributes.forEach(({name:a,array:l,itemSize:c})=>{o[a]={array:l,itemSize:c,type:"Float32Array",normalized:!1}}),n.geometry.data.attributes=o,n.geometry.data.draco=void 0}}return t.result().data}var jA={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0,rewind:!0},tx={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},mz=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],tm={CSS:{},springs:{}};function ji(i,e,t){return Math.min(Math.max(i,e),t)}function bu(i,e){return i.indexOf(e)>-1}function Zv(i,e){return i.apply(null,e)}var Xe={arr:function(i){return Array.isArray(i)},obj:function(i){return bu(Object.prototype.toString.call(i),"Object")},pth:function(i){return Xe.obj(i)&&i.hasOwnProperty("totalLength")},svg:function(i){return i instanceof SVGElement},inp:function(i){return i instanceof HTMLInputElement},dom:function(i){return!("isNode"in i)&&(i.nodeType||Xe.svg(i))},str:function(i){return typeof i=="string"},fnc:function(i){return typeof i=="function"},und:function(i){return typeof i>"u"},hex:function(i){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(i)},rgb:function(i){return/^rgb/.test(i)},hsl:function(i){return/^hsl/.test(i)},col:function(i){return Xe.hex(i)||Xe.rgb(i)||Xe.hsl(i)},key:function(i){return!jA.hasOwnProperty(i)&&!tx.hasOwnProperty(i)&&i!=="targets"&&i!=="keyframes"}};function qA(i){var e=/\(([^)]+)\)/.exec(i);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function YA(i,e){var t=qA(i),r=ji(Xe.und(t[0])?1:t[0],.1,100),n=ji(Xe.und(t[1])?100:t[1],.1,100),s=ji(Xe.und(t[2])?10:t[2],.1,100),o=ji(Xe.und(t[3])?0:t[3],.1,100),a=Math.sqrt(n/r),l=s/(2*Math.sqrt(n*r)),c=l<1?a*Math.sqrt(1-l*l):0,h=1,u=l<1?(l*a+-o)/c:-o+a;function f(p){var m=e?e*p/1e3:p;return l<1?m=Math.exp(-m*l*a)*(h*Math.cos(c*m)+u*Math.sin(c*m)):m=(h+u*m)*Math.exp(-m*a),p===0||p===1?p:1-m}function d(){var p=tm.springs[i];if(p)return p;for(var m=1/6,g=0,v=0;;)if(g+=m,f(g)===1){if(v++,v>=16)break}else v=0;var y=g*m*1e3;return tm.springs[i]=y,y}return e?f:d}function gz(i){return i===void 0&&(i=10),function(e){return Math.ceil(ji(e,1e-6,1)*i)*(1/i)}}var yz=function(){var i=11,e=1/(i-1);function t(h,u){return 1-3*u+3*h}function r(h,u){return 3*u-6*h}function n(h){return 3*h}function s(h,u,f){return((t(u,f)*h+r(u,f))*h+n(u))*h}function o(h,u,f){return 3*t(u,f)*h*h+2*r(u,f)*h+n(u)}function a(h,u,f,d,p){var m,g,v=0;do g=u+(f-u)/2,m=s(g,d,p)-h,m>0?f=g:u=g;while(Math.abs(m)>1e-7&&++v<10);return g}function l(h,u,f,d){for(var p=0;p<4;++p){var m=o(u,f,d);if(m===0)return u;var g=s(u,f,d)-h;u-=g/m}return u}function c(h,u,f,d){if(!(0<=h&&h<=1&&0<=f&&f<=1))return;var p=new Float32Array(i);if(h!==u||f!==d)for(var m=0;m<i;++m)p[m]=s(m*e,h,f);function g(v){for(var y=0,w=1,b=i-1;w!==b&&p[w]<=v;++w)y+=e;--w;var S=(v-p[w])/(p[w+1]-p[w]),T=y+S*e,A=o(T,h,f);return A>=.001?l(v,T,h,f):A===0?T:a(v,y,y+e,h,f)}return function(v){return h===u&&f===d||v===0||v===1?v:s(g(v),u,d)}}return c}(),XA=function(){var i={linear:function(){return function(r){return r}}},e={Sine:function(){return function(r){return 1-Math.cos(r*Math.PI/2)}},Circ:function(){return function(r){return 1-Math.sqrt(1-r*r)}},Back:function(){return function(r){return r*r*(3*r-2)}},Bounce:function(){return function(r){for(var n,s=4;r<((n=Math.pow(2,--s))-1)/11;);return 1/Math.pow(4,3-s)-7.5625*Math.pow((n*3-2)/22-r,2)}},Elastic:function(r,n){r===void 0&&(r=1),n===void 0&&(n=.5);var s=ji(r,1,10),o=ji(n,.1,2);return function(a){return a===0||a===1?a:-s*Math.pow(2,10*(a-1))*Math.sin((a-1-o/(Math.PI*2)*Math.asin(1/s))*(Math.PI*2)/o)}}},t=["Quad","Cubic","Quart","Quint","Expo"];return t.forEach(function(r,n){e[r]=function(){return function(s){return Math.pow(s,n+2)}}}),Object.keys(e).forEach(function(r){var n=e[r];i["easeIn"+r]=n,i["easeOut"+r]=function(s,o){return function(a){return 1-n(s,o)(1-a)}},i["easeInOut"+r]=function(s,o){return function(a){return a<.5?n(s,o)(a*2)/2:1-n(s,o)(a*-2+2)/2}}}),i}();function rx(i,e){if(Xe.fnc(i))return i;var t=i.split("(")[0],r=XA[t],n=qA(i);switch(t){case"spring":return YA(i,e);case"cubicBezier":return Zv(yz,n);case"steps":return Zv(gz,n);default:return Zv(r,n)}}function QA(i){try{var e=document.querySelectorAll(i);return e}catch{return}}function rm(i,e){for(var t=i.length,r=arguments.length>=2?arguments[1]:void 0,n=[],s=0;s<t;s++)if(s in i){var o=i[s];e.call(r,o,s,i)&&n.push(o)}return n}function nm(i){return i.reduce(function(e,t){return e.concat(Xe.arr(t)?nm(t):t)},[])}function GA(i){return Xe.arr(i)?i:(Xe.str(i)&&(i=QA(i)||i),i instanceof NodeList||i instanceof HTMLCollection?[].slice.call(i):[i])}function nx(i,e){return i.some(function(t){return t===e})}function ix(i){var e={};for(var t in i)e[t]=i[t];return e}function $v(i,e){var t=ix(i);for(var r in i)t[r]=e.hasOwnProperty(r)?e[r]:i[r];return t}function im(i,e){var t=ix(i);for(var r in e)t[r]=Xe.und(i[r])?e[r]:i[r];return t}function vz(i){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(i);return e?"rgba("+e[1]+",1)":i}function xz(i){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,t=i.replace(e,function(a,l,c,h){return l+l+c+c+h+h}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),n=parseInt(r[1],16),s=parseInt(r[2],16),o=parseInt(r[3],16);return"rgba("+n+","+s+","+o+",1)"}function bz(i){var e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(i)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(i),t=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,n=parseInt(e[3],10)/100,s=e[4]||1;function o(f,d,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?f+(d-f)*6*p:p<1/2?d:p<2/3?f+(d-f)*(2/3-p)*6:f}var a,l,c;if(r==0)a=l=c=n;else{var h=n<.5?n*(1+r):n+r-n*r,u=2*n-h;a=o(u,h,t+1/3),l=o(u,h,t),c=o(u,h,t-1/3)}return"rgba("+a*255+","+l*255+","+c*255+","+s+")"}function wz(i){if(Xe.rgb(i))return vz(i);if(Xe.hex(i))return xz(i);if(Xe.hsl(i))return bz(i)}function vs(i){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(i);if(e)return e[1]}function Sz(i){if(bu(i,"translate")||i==="perspective")return"px";if(bu(i,"rotate")||bu(i,"skew"))return"deg"}function ex(i,e){return Xe.fnc(i)?i(e.target,e.id,e.total):i}function qi(i,e){return i.getAttribute(e)}function sx(i,e,t){var r=vs(e);if(nx([t,"deg","rad","turn"],r))return e;var n=tm.CSS[e+t];if(!Xe.und(n))return n;var s=100,o=document.createElement(i.tagName),a=i.parentNode&&i.parentNode!==document?i.parentNode:document.body;a.appendChild(o),o.style.position="absolute",o.style.width=s+t;var l=s/o.offsetWidth;a.removeChild(o);var c=l*parseFloat(e);return tm.CSS[e+t]=c,c}function JA(i,e,t){if(e in i.style){var r=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),n=i.style[e]||getComputedStyle(i).getPropertyValue(r)||"0";return t?sx(i,n,t):n}}function ox(i,e){if(Xe.dom(i)&&!Xe.inp(i)&&(qi(i,e)||Xe.svg(i)&&i[e]))return"attribute";if(Xe.dom(i)&&nx(mz,e))return"transform";if(Xe.dom(i)&&e!=="transform"&&JA(i,e))return"css";if(i[e]!=null)return"object"}function KA(i){if(!!Xe.dom(i)){for(var e=i.style.transform||"",t=/(\w+)\(([^)]*)\)/g,r=new Map,n;n=t.exec(e);)r.set(n[1],n[2]);return r}}function Mz(i,e,t,r){var n=bu(e,"scale")?1:0+Sz(e),s=KA(i).get(e)||n;return t&&(t.transforms.list.set(e,s),t.transforms.last=e),r?sx(i,s,r):s}function ax(i,e,t,r){switch(ox(i,e)){case"transform":return Mz(i,e,r,t);case"css":return JA(i,e,t);case"attribute":return qi(i,e);default:return i[e]||0}}function lx(i,e){var t=/^(\*=|\+=|-=)/.exec(i);if(!t)return i;var r=vs(i)||0,n=parseFloat(e),s=parseFloat(i.replace(t[0],""));switch(t[0][0]){case"+":return n+s+r;case"-":return n-s+r;case"*":return n*s+r}}function ZA(i,e){if(Xe.col(i))return wz(i);if(/\s/g.test(i))return i;var t=vs(i),r=t?i.substr(0,i.length-t.length):i;return e?r+e:r}function cx(i,e){return Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2))}function Az(i){return Math.PI*2*qi(i,"r")}function Tz(i){return qi(i,"width")*2+qi(i,"height")*2}function Ez(i){return cx({x:qi(i,"x1"),y:qi(i,"y1")},{x:qi(i,"x2"),y:qi(i,"y2")})}function $A(i){for(var e=i.points,t=0,r,n=0;n<e.numberOfItems;n++){var s=e.getItem(n);n>0&&(t+=cx(r,s)),r=s}return t}function _z(i){var e=i.points;return $A(i)+cx(e.getItem(e.numberOfItems-1),e.getItem(0))}function eT(i){if(i.getTotalLength)return i.getTotalLength();switch(i.tagName.toLowerCase()){case"circle":return Az(i);case"rect":return Tz(i);case"line":return Ez(i);case"polyline":return $A(i);case"polygon":return _z(i)}}function Cz(i){var e=eT(i);return i.setAttribute("stroke-dasharray",e),e}function Dz(i){for(var e=i.parentNode;Xe.svg(e)&&Xe.svg(e.parentNode);)e=e.parentNode;return e}function tT(i,e){var t=e||{},r=t.el||Dz(i),n=r.getBoundingClientRect(),s=qi(r,"viewBox"),o=n.width,a=n.height,l=t.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function Pz(i,e){var t=Xe.str(i)?QA(i)[0]:i,r=e||100;return function(n){return{property:n,el:t,svg:tT(t),totalLength:eT(t)*(r/100)}}}function Lz(i,e){function t(a){a===void 0&&(a=0);var l=e+a>=1?e+a:0;return i.el.getPointAtLength(l)}var r=tT(i.el,i.svg),n=t(),s=t(-1),o=t(1);switch(i.property){case"x":return(n.x-r.x)*r.w;case"y":return(n.y-r.y)*r.h;case"angle":return Math.atan2(o.y-s.y,o.x-s.x)*180/Math.PI}}function kA(i,e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=ZA(Xe.pth(i)?i.totalLength:i,e)+"";return{original:r,numbers:r.match(t)?r.match(t).map(Number):[0],strings:Xe.str(i)||e?r.split(t):[]}}function rT(i){var e=i?nm(Xe.arr(i)?i.map(GA):GA(i)):[];return rm(e,function(t,r,n){return n.indexOf(t)===r})}function nT(i){var e=rT(i);return e.map(function(t,r){return{target:t,id:r,total:e.length,transforms:{list:KA(t)}}})}function Iz(i,e){var t=ix(e);if(/^spring/.test(t.easing)&&(t.duration=YA(t.easing)),Xe.arr(i)){var r=i.length,n=r===2&&!Xe.obj(i[0]);n?i={value:i}:Xe.fnc(e.duration)||(t.duration=e.duration/r)}var s=Xe.arr(i)?i:[i];return s.map(function(o,a){var l=Xe.obj(o)&&!Xe.pth(o)?o:{value:o};return Xe.und(l.delay)&&(l.delay=a?0:e.delay),Xe.und(l.endDelay)&&(l.endDelay=a===s.length-1?e.endDelay:0),l}).map(function(o){return im(o,t)})}function Rz(i){for(var e=rm(nm(i.map(function(s){return Object.keys(s)})),function(s){return Xe.key(s)}).reduce(function(s,o){return s.indexOf(o)<0&&s.push(o),s},[]),t={},r=function(s){var o=e[s];t[o]=i.map(function(a){var l={};for(var c in a)Xe.key(c)?c==o&&(l.value=a[c]):l[c]=a[c];return l})},n=0;n<e.length;n++)r(n);return t}function Bz(i,e){var t=[],r=e.keyframes;r&&(e=im(Rz(r),e));for(var n in e)Xe.key(n)&&t.push({name:n,tweens:Iz(e[n],i)});return t}function Nz(i,e){var t={};for(var r in i){var n=ex(i[r],e);Xe.arr(n)&&(n=n.map(function(s){return ex(s,e)}),n.length===1&&(n=n[0])),t[r]=n}return t.duration=parseFloat(t.duration),t.delay=parseFloat(t.delay),t}function Oz(i,e){var t;return i.tweens.map(function(r){var n=Nz(r,e),s=n.value,o=Xe.arr(s)?s[1]:s,a=vs(o),l=ax(e.target,i.name,a,e),c=t?t.to.original:l,h=Xe.arr(s)?s[0]:c,u=vs(h)||vs(l),f=a||u;return Xe.und(o)&&(o=c),n.from=kA(h,f),n.to=kA(lx(o,h),f),n.start=t?t.end:0,n.end=n.start+n.delay+n.duration+n.endDelay,n.easing=rx(n.easing,n.duration),n.isPath=Xe.pth(s),n.isColor=Xe.col(n.from.original),n.isColor&&(n.round=1),t=n,n})}var iT={css:function(i,e,t){return i.style[e]=t},attribute:function(i,e,t){return i.setAttribute(e,t)},object:function(i,e,t){return i[e]=t},transform:function(i,e,t,r,n){if(r.list.set(e,t),e===r.last||n){var s="";r.list.forEach(function(o,a){s+=a+"("+o+") "}),i.style.transform=s}}};function sT(i,e){var t=nT(i);t.forEach(function(r){for(var n in e){var s=ex(e[n],r),o=r.target,a=vs(s),l=ax(o,n,a,r),c=a||vs(l),h=lx(ZA(s,c),l),u=ox(o,n);iT[u](o,n,h,r.transforms,!0)}})}function Fz(i,e){var t=ox(i.target,e.name);if(t){var r=Oz(e,i),n=r[r.length-1];return{type:t,property:e.name,animatable:i,tweens:r,duration:n.end,delay:r[0].delay,endDelay:n.endDelay}}}function Uz(i,e){return rm(nm(i.map(function(t){return e.map(function(r){return Fz(t,r)})})),function(t){return!Xe.und(t)})}function oT(i,e){var t=i.length,r=function(s){return s.timelineOffset?s.timelineOffset:0},n={};return n.duration=t?Math.max.apply(Math,i.map(function(s){return r(s)+s.duration})):e.duration,n.delay=t?Math.min.apply(Math,i.map(function(s){return r(s)+s.delay})):e.delay,n.endDelay=t?n.duration-Math.max.apply(Math,i.map(function(s){return r(s)+s.duration-s.endDelay})):e.endDelay,n}var VA=0;function zz(i){var e=$v(jA,i),t=$v(tx,i),r=Bz(t,i),n=nT(i.targets),s=Uz(n,r),o=oT(s,t),a=VA;return VA++,im(e,{id:a,children:[],animatables:n,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}var Tn=[],HA=[],em,Gz=function(){function i(){em=requestAnimationFrame(e)}function e(t){var r=Tn.length;if(r){for(var n=0;n<r;){var s=Tn[n];if(!s.paused)s.tick(t);else{var o=Tn.indexOf(s);o>-1&&(Tn.splice(o,1),r=Tn.length)}n++}i()}else em=cancelAnimationFrame(em)}return i}();function kz(){document.hidden?(Tn.forEach(function(i){return i.pause()}),HA=Tn.slice(0),Sr.running=Tn=[]):HA.forEach(function(i){return i.play()})}typeof document<"u"&&document.addEventListener("visibilitychange",kz);function Sr(i){i===void 0&&(i={});var e=0,t=0,r=0,n,s=0,o=null;function a(w){var b=window.Promise&&new Promise(function(S){return o=S});return w.finished=b,b}var l=zz(i),c=a(l);function h(){var w=l.direction;w!=="alternate"&&(l.direction=w!=="normal"?"normal":"reverse"),l.reversed=!l.reversed,n.forEach(function(b){return b.reversed=l.reversed})}function u(w){return l.reversed?l.duration-w:w}function f(){e=0,t=u(l.currentTime)*(1/Sr.speed)}function d(w,b){b&&b.seek(w-b.timelineOffset)}function p(w){if(l.reversePlayback)for(var S=s;S--;)d(w,n[S]);else for(var b=0;b<s;b++)d(w,n[b])}function m(w){var b=0,S=l.animations,T=S.length;for(l.reversePlayback===!0&&l.rewind===!1&&(w=l.duration-w);b<T;){var A=S[b],x=A.animatable,E=A.tweens,_=E.length-1,C=E[_];_&&(C=rm(E,function(oe){return w<oe.end})[0]||C);for(var I=ji(w-C.start-C.delay,0,C.duration)/C.duration,N=isNaN(I)?1:C.easing(I),R=C.to.strings,k=C.round,G=[],te=C.to.numbers.length,Q=void 0,Y=0;Y<te;Y++){var F=void 0;if(l.reversePlayback===!0&&l.rewind===!1)var z=C.to.numbers[Y],O=C.from.numbers[Y]||0;else var O=C.to.numbers[Y],z=C.from.numbers[Y]||0;C.isPath?F=Lz(C.value,N*O):F=z+N*(O-z),k&&(C.isColor&&Y>2||(F=Math.round(F*k)/k)),G.push(F)}var j=R.length;if(!j)Q=G[0];else{Q=R[0];for(var q=0;q<j;q++){var J=R[q],W=R[q+1],ge=G[q];isNaN(ge)||(W?Q+=ge+W:Q+=ge+" ")}}iT[A.type](x.target,A.property,Q,x.transforms),A.currentValue=Q,b++}}function g(w){l[w]&&!l.passThrough&&l[w](l)}function v(){l.remaining&&l.remaining!==!0&&l.remaining--}function y(w){var b=l.duration,S=l.delay,T=b-l.endDelay,A=u(w);l.progress=ji(A/b*100,0,100),l.reversePlayback=A<l.currentTime,n&&p(A),!l.began&&l.currentTime>=0&&(l.began=!0,g("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,g("loopBegin")),A<=S&&l.currentTime!==0&&m(0),(A>=T&&l.currentTime!==b||!b)&&m(b),A>S&&A<T?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,g("changeBegin")),g("change"),m(A)):l.changeBegan?(l.changeCompleted=!0,l.changeBegan=!1,g("change"),g("changeComplete")):l.began&&A>T&&(g("change"),g("changeComplete")),l.currentTime=ji(A,0,b),l.began&&g("update"),w>=b&&(t=0,v(),l.remaining?(e=r,g("loopComplete"),l.loopBegan=!1,l.direction==="alternate"&&h()):(l.paused=!0,l.completed||(l.completed=!0,g("loopComplete"),g("complete"),!l.passThrough&&"Promise"in window&&(o(),c=a(l)))))}return l.reset=function(){var w=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed=w==="reverse",l.remaining=l.loop,n=l.children,s=n.length;for(var b=s;b--;)l.children[b].reset();(l.reversed&&l.loop!==!0||w==="alternate"&&l.loop===1)&&l.remaining++,m(l.reversed?l.duration:0)},l.set=function(w,b){return sT(w,b),l},l.tick=function(w){r=w,e||(e=r),y((r+(t-e))*Sr.speed)},l.seek=function(w){y(u(w))},l.pause=function(){l.paused=!0,f()},l.play=function(){!l.paused||(l.completed&&l.reset(),l.paused=!1,Tn.push(l),f(),em||Gz())},l.reverse=function(){h(),l.completed=!l.reversed,f()},l.restart=function(){l.reset(),l.play()},l.reset(),l.autoplay&&l.play(),l}function WA(i,e){for(var t=e.length;t--;)nx(i,e[t].animatable.target)&&e.splice(t,1)}function Vz(i){for(var e=rT(i),t=Tn.length;t--;){var r=Tn[t],n=r.animations,s=r.children;WA(e,n);for(var o=s.length;o--;){var a=s[o],l=a.animations;WA(e,l),!l.length&&!a.children.length&&s.splice(o,1)}!n.length&&!s.length&&r.pause()}}function Hz(i,e){e===void 0&&(e={});var t=e.direction||"normal",r=e.easing?rx(e.easing):null,n=e.grid,s=e.axis,o=e.from||0,a=o==="first",l=o==="center",c=o==="last",h=Xe.arr(i),u=parseFloat(h?i[0]:i),f=h?parseFloat(i[1]):0,d=vs(h?i[1]:i)||0,p=e.start||0+(h?u:0),m=[],g=0;return function(v,y,w){if(a&&(o=0),l&&(o=(w-1)/2),c&&(o=w-1),!m.length){for(var b=0;b<w;b++){if(!n)m.push(Math.abs(o-b));else{var S=l?(n[0]-1)/2:o%n[0],T=l?(n[1]-1)/2:Math.floor(o/n[0]),A=b%n[0],x=Math.floor(b/n[0]),E=S-A,_=T-x,C=Math.sqrt(E*E+_*_);s==="x"&&(C=-E),s==="y"&&(C=-_),m.push(C)}g=Math.max.apply(Math,m)}r&&(m=m.map(function(N){return r(N/g)*g})),t==="reverse"&&(m=m.map(function(N){return s?N<0?N*-1:-N:Math.abs(g-N)}))}var I=h?(f-u)/g:u;return p+I*(Math.round(m[y]*100)/100)+d}}function Wz(i){i===void 0&&(i={});var e=Sr(i);return e.duration=0,e.add=function(t,r){var n=Tn.indexOf(e),s=e.children;n>-1&&Tn.splice(n,1);function o(f){f.passThrough=!0}for(var a=0;a<s.length;a++)o(s[a]);var l=im(t,$v(tx,i));l.targets=l.targets||i.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=Xe.und(r)?c:lx(r,c),o(e),l.rewind=e.rewind,e.seek(l.timelineOffset);var h=Sr(l);o(h),s.push(h);var u=oT(s,i);return e.delay=u.delay,e.endDelay=u.endDelay,e.duration=u.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}Sr.version="3.2.0";Sr.speed=1;Sr.running=Tn;Sr.remove=Vz;Sr.get=ax;Sr.set=sT;Sr.convertPx=sx;Sr.path=Pz;Sr.setDashoffset=Cz;Sr.stagger=Hz;Sr.timeline=Wz;Sr.easing=rx;Sr.penner=XA;Sr.random=function(i,e){return Math.floor(Math.random()*(e-i+1))+i};var aT=Sr;function lT(i,e,t){var n,s;let r=i.cameraType==="OrthographicCamera"?(n=e.orthographic)==null?void 0:n.zoom:(s=e.perspective)==null?void 0:s.zoom;if(r!==void 0){let o=i.zoom;o!==r&&t.push({change:a=>{i.zoom=et.lerp(o,r,a),i.updateProjectionMatrix()}})}if(e.targetOffset!==void 0){let o=i.targetOffset,a=e.targetOffset;o!==a&&t.push({change:l=>{i.targetOffset=et.lerp(o,a,l)}})}}function cT(i,e,t){if(e.width!==void 0&&e.height!==void 0&&e.depth!==void 0){let{width:r,height:n,depth:s}=i.geometry.userData.parameters,o=[r,n,s],a=[e.width,e.height,e.depth];!br.isEqual(o,a)&&!Lt(i)&&t.push({change:l=>{let[c,h,u]=br.lerp(o,a,l);i.updateGeometry({parameters:{width:c,height:h,depth:u}}),i.invalidateDownstreamBooleanData()}})}}function hT(i,e,t,r){if(e.intensity!==void 0){let n=i.intensity,s=e.intensity;n!==s&&t.push({change:o=>{i.intensity=et.lerp(n,s,o)}})}if(e.color!==void 0){let n=i.color.clone(),s=typeof e.color=="string"?r.getColor(e.color):e.color;if(!Ar.equals(n,s)){let o=n.clone();i.color=o,t.push({change:a=>{let{r:l,g:c,b:h}=Ar.lerp(n,s,a);o.setRGB(l,c,h)}})}}}function uT(i,e,t,r){var s,o;let n=i.layersList.head;for(;n;){let a=e.layers.data(n.uuid);if(a&&((s=n.visible)!=null?s:!0)&&((o=a.visible)!=null?o:!0)){let l=n.getNames().filter(c=>!_M.some(h=>c.includes(h)));for(let c of l)try{let h=n.getValue(c);if(c==="steps")Jz(n,a,c,t);else if(c==="colors")Kz(n,a,c,t);else if(typeof h=="number")jz(n,a,c,t);else{if(typeof h=="boolean")continue;"isVector2"in h?qz(n,a,c,t):"isVector3"in h?Yz(n,a,c,t):"isColorA"in h?Qz(n,a,c,t,r):"isColor"in h?Xz(n,a,c,t,r):"isTexture"in h&&Zz(n,a,c,t)}}catch(h){console.error(`animateMaterial: unexpected material layer for ${c}`,h)}}n=n.next}}function jz(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=e[t];n!==s&&r.push({change:o=>{i.setValue(t,et.lerp(n,s,o))}})}function qz(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=n.toArray(),o=e[t];us.isEqual(s,o)||r.push({change:a=>{n.fromArray(us.lerp(s,o,a))}})}function Yz(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=n.toArray(),o=e[t];br.isEqual(s,o)||r.push({change:a=>{n.fromArray(br.lerp(s,o,a))}})}function Xz(i,e,t,r,n){if(!i.hasValue(t)||!(t in e))return;let s=i.getValue(t).clone(),o=e[t],a=typeof o=="string"?n.getColor(o):o;if(Ar.equals(s,a))return;let l=s.clone();i.setValue(t,l),r.push({change:c=>{let{r:h,g:u,b:f}=Ar.lerp(s,a,c);l.setRGB(h,u,f)}})}function Qz(i,e,t,r,n){if(!i.hasValue(t)||!(t in e))return;let s=i.getValue(t).clone(),o=e[t],a=typeof o=="string"?n.getColor(o):o;if(Ln.equals(s,a))return;let l=s.clone();i.setValue(t,l),r.push({change:c=>{let{r:h,g:u,b:f,a:d}=Ln.lerp(s,a,c);l.setRGBA(h,u,f,d)}})}function Jz(i,e,t="steps",r){if(!i.hasValue(t)||!(t in e))return;let n=[...i.getValue(t)],s=e[t];for(let o=0;o<n.length;++o){let a=n[o],l=s[o];a!==l&&r.push({change:c=>{n[o]=et.lerp(a,l,c),i.setValue("steps",n)}})}}function Kz(i,e,t="colors",r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=e[t];for(let o=0;o<n.length;++o){let a=n[o].toArray(),l=s[o];Ch.isEqual(a,l)||r.push({change:c=>{n[o].fromArray(Ch.lerp(a,l,c))}})}}function Zz(i,e,t="texture",r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue("texture"),s=e[t],o=n.repeat.toArray(),a=n.offset.toArray(),l=s.repeat,c=s.offset;(!us.isEqual(o,l)||!us.isEqual(a,c))&&r.push({change:h=>{n.repeat.fromArray(us.lerp(o,l,h)),n.offset.fromArray(us.lerp(a,c,h)),n.updateMatrix(),n.needsUpdate=!0}})}function fT(i,e,t,r){if(r===0)return t.copy(i);if(r===1)return t.copy(e);let n=i.w*e.w+i.x*e.x+i.y*e.y+i.z*e.z;if(n>=1)return t.copy(i);let s=1-n*n;if(s<=Number.EPSILON){let h=1-r;return t.w=h*i.w+r*e.w,t.x=h*i.x+r*e.x,t.y=h*i.y+r*e.y,t.z=h*i.z+r*e.z,t.normalize(),t}let o=Math.sqrt(s),a=Math.atan2(o,n),l=Math.sin((1-r)*a)/o,c=Math.sin(r*a)/o;return t.w=i.w*l+e.w*c,t.x=i.x*l+e.x*c,t.y=i.y*l+e.y*c,t.z=i.z*l+e.z*c,t}function dT(i,e,t=0){let r=Array.isArray(i.material)?i.material[t]:i.material,n;return"materials"in e?n=e.materials[t]:"material"in e&&(n=e.material),[r,n]}var hx=new M,ux=new M,pT=new zt,$z=new yn,eG=new Ae;function mT(i,e,t,r){if(t.position!==void 0){let n=i.position.toArray(),s=t.position;br.isEqual(n,s)||r.push({change:o=>{i.position.fromArray(br.lerp(n,s,o)),i.updateMatrix(),er(i)&&Lt(i.parent)&&i.invalidateDownstreamBooleanData(!0)}})}if(t.scale!==void 0){let n=i.scale.toArray(),s=t.scale;br.isEqual(n,s)||r.push({change:o=>{i.scale.fromArray(br.lerp(n,s,o)),i.updateMatrix(),er(i)&&Lt(i.parent)&&i.invalidateDownstreamBooleanData(!0)}})}tG(i,e,t,r),rG(i,t,r)}function tG(i,e,t,r){if(t.rotation===void 0)return;let n=hx.setFromEuler(i.rotation).toArray(),s=t.rotation;if(br.isEqual(n,s))return;if(br.sub(t.rotation,e?e.rotation:i.rotation).every(a=>Math.abs(a)<2*Math.PI)){let a=i.quaternion.clone(),l=new zt().setFromEuler($z.set(t.rotation[0],t.rotation[1],t.rotation[2]));r.push({change:c=>{fT(a,l,i.quaternion,c),i.updateMatrix(),er(i)&&Lt(i.parent)&&i.invalidateDownstreamBooleanData(!0)}})}else r.push({change:a=>{i.rotation.setFromVector3(ux.fromArray(br.lerp(n,s,a))),i.updateMatrix(),er(i)&&Lt(i.parent)&&i.invalidateDownstreamBooleanData(!0)}})}function rG(i,e,t){if(e.hiddenMatrix!==void 0&&!Pi.isEqual(i.hiddenMatrix.toArray(),e.hiddenMatrix)){let r=new M,n=new zt,s=new M;i.hiddenMatrix.decompose(r,n,s);let o=new M,a=new zt,l=new M;eG.fromArray(e.hiddenMatrix).decompose(o,a,l),t.push({change:c=>{pT.slerpQuaternions(n,a,c),hx.lerpVectors(r,o,c),ux.lerpVectors(s,l,c),i.hiddenMatrix.compose(hx,pT,ux),er(i)&&Lt(i.parent)&&i.invalidateDownstreamBooleanData(!0)}})}}function gT(i,e,t,r){let n=[];if((i.visible||Lt(i.parent))&&mT(i,e==null?void 0:e.objectState,t.objectState,n),er(i)){if((i.visible||Lt(i.parent))&&"geometry"in t.objectState&&cT(i,t.objectState.geometry,n),i.visible&&("material"in t.objectState||"materials"in t.objectState)){let[s,o]=dT(i,t.objectState,i.selectedMaterial);s&&o&&typeof o!="string"&&uT(s,o,n,r)}}else i.visible&&O1(i)?hT(i,t.objectState,n,r):N1(i)&&lT(i,t.objectState,n);return n.length?{change:s=>{n.forEach(o=>{o.change&&o.change(s)})}}:void 0}function nG(i,e,t){switch(i){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 5:let{control1:r,control2:n}=e!=null?e:ie({},Fd.defaultData);return`cubicBezier( ${r[0]}, ${r[1]}, ${n[0]}, ${n[1]} )`;case 6:let{mass:s,stiffness:o,damping:a,velocity:l}=t!=null?t:ie({},Od.defaultData);return`spring( ${s}, ${o}, ${a}, ${l} )`}}var sm=class{constructor(e,t){this.object=e;this.sharedAssets=t;this.uuid=et.generateUUID();this.states=[];this.events={};this.animatingState=0;this._scrollCounter=null}get fromState(){return this._fromState}get animation(){return this._animation}start(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._scrollCounter=null),this.states.length>1&&(this.states[0].execute(this.object,this.sharedAssets),this._toState=this.states[0],this._fromState=void 0)}end(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0),this.states.length>1&&this.states[0].execute(this.object,this.sharedAssets),this._toState=void 0,this._fromState=void 0}seek(e,t,r,n,s){var o;this._scrollCounter===null&&(this.animate(e,n,s),this._scrollCounter=0),this._scrollCounter+=t,this._scrollCounter=Math.min(Math.max(this._scrollCounter,0),r),(o=this._animation)==null||o.seek(this._scrollCounter/r*(n.duration?n.duration:1))}animate(e,s,n){var o=s,{autoplay:t=!0}=o,r=Eu(o,["autoplay"]);var a,l,c,h,u,f;if(this._fromState===e&&((a=this._animation)==null?void 0:a.reversed)){let d=(c=(l=this._animation)==null?void 0:l.currentTime)!=null?c:0;(h=this._animation)==null||h.reset(),(u=this._animation)==null||u.seek(d),(f=this._animation)==null||f.play()}else if(this._toState!==e){this._animation!==void 0&&this._animation.pause(),this.animatingState=0,this._fromState=this._toState,this._toState=e;let d=gT(this.object,this._fromState,e,this.sharedAssets);if(!d)return;let p={t:0};this._animation=aT({autoplay:t,loop:r.repeat?!0:r.cycle?1:!1,direction:r.cycle?"alternate":"normal",rewind:r.rewind,delay:r.delay,endDelay:r.delay,duration:r.duration,easing:nG(r.easing,r.cubicControls,r.springParameters),targets:p,t:1,change:()=>{d.change&&d.change(p.t),n!=null&&n.change&&n.change(p.t)},loopBegin:m=>{if(this.animatingState===0){this.animatingState=1;return}m.reversed?(this._toState=this._fromState,this._fromState=e):(this._fromState=this._toState,this._toState=e)}}),t&&this._animation.finished.then(()=>{this._animation=void 0,this.animatingState=0})}}emitEvent(e){var t;if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let r=this.events[e];if(r){for(let n of r)if("targets"in n)for(let{object:s,state:o,params:a}of n.targets)(t=s.interaction)==null||t.animate(o,a)}}}emitEventReverse(e){if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let t=this.events[e];if(t){for(let r of t)if("targets"in r)for(let{object:n,params:s}of r.targets){let o=n.interaction;(o==null?void 0:o._fromState)!==void 0&&o.animate(o._fromState,s)}}}}};var gc=class{static create(e,t){if(e.object){let r=t.find(e.object);if(r!=null&&r.interaction){let n=e.state?r.interaction.states.find(s=>s.uuid===e.state):r.interaction.states[0];if(n){let s={cycle:e.cycle,rewind:e.rewind,repeat:e.repeat,duration:e.duration,delay:e.delay,easing:e.easing};if(e.easing===5){let o=e;s.cubicControls={control1:[...o.control1],control2:[...o.control2]}}if(e.easing===6){let o=e;s.springParameters={mass:o.mass,stiffness:o.stiffness,damping:o.damping,velocity:o.velocity}}return new gc(r,n,s)}}}}constructor(e,t,r){this.object=e,this.state=t,this.params=r}};var fx=new Map,wu={url:"head",time:0,data:null,next:null,prev:null},yc={url:"tail",time:1/0,data:null,next:null,prev:null};wu.next=yc;yc.prev=wu;var yT=0;function co(i){if(typeof i=="string")return i;let e=Date.now(),t=fx.get(i);return t===void 0?(t={url:URL.createObjectURL(new Blob([i])),data:i,time:e,next:null,prev:null},fx.set(i,t)):(t.time=e,t.prev.next=t.next,t.next.prev=t.prev),t.prev=yc.prev,t.next=yc,yc.prev.next=t,yc.prev=t,e-yT>1e3*10&&(yT=e+1e3,setTimeout(()=>{let r=Date.now(),n=wu.next;for(;n.time<r-1e3*10;)URL.revokeObjectURL(n.url),fx.delete(n.data),n=n.next,n.prev=wu,wu.next=n},900)),t.url}var vT=new Yr,ra=class extends Wr{},om=class{constructor(e){this.materials={};this.images={};this.colors={};this.transmissionRenderTarget=new mt(2048,2048,{generateMipmaps:!0,minFilter:js,magFilter:ct,wrapS:Dr,wrapT:Dr}),this.transmissionRenderTarget.depthTexture=new oi(2048,2048),this.reset(e)}reset(e){for(let[t,r]of Object.entries(e.images))this.addImage(t,r.data);for(let[t,r]of Object.entries(e.colors))this.addColor(t,r);for(let[t,r]of Object.entries(e.materials))this.addMaterial(t,Tv(r,this))}get transmissionSamplerMap(){return this.transmissionRenderTarget.texture}get transmissionDepthMap(){return this.transmissionRenderTarget.depthTexture}addMaterial(e,t){t.uuid=e,this.materials[e]=t}deleteMaterial(e){this.materials[e]&&(this.materials[e].dispose(),delete this.materials[e])}isSharedMaterial(e){return e.uuid in this.materials||e===vT}getMaterial(e){let t=this.materials[e];return t}getMaterialOrDeletedPlaceholder(e){var t;return(t=this.materials[e])!=null?t:vT}getMaterials(){return this.materials}addImage(e,t){if(this.images[e])return this.images[e].onload=()=>{this.onImageLoad&&this.onImageLoad()},this.images[e].src=co(t),!0;{let r=new Image;return r.src=co(t),r.onload=()=>{this.onImageLoad&&this.onImageLoad()},this.images[e]=r,!1}}deleteImage(e){this.images[e]&&delete this.images[e]}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]}getImages(){return this.images}addColor(e,t){return this.colors[e]?("a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new ra(t.r,t.g,t.b,t.a):this.colors[e]=new ra(t.r,t.g,t.b,1),!1)}updateColor(e,t){var r,n,s,o;if(this.colors[e]){let a=this.colors[e];return this.colors[e].r=(r=t.r)!=null?r:a.r,this.colors[e].g=(n=t.g)!=null?n:a.g,this.colors[e].b=(s=t.b)!=null?s:a.b,this.colors[e].a=(o=t.a)!=null?o:a.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this.transmissionRenderTarget.depthTexture.dispose(),this.transmissionRenderTarget.dispose(),this.onImageLoad=void 0}};function iG(i,e){switch(i.type){case"noise":return e==="noiseType";case"texture":return e==="projection"||e==="axis"||e==="side";case"displace":return e==="noiseType";case"depth":return e==="num"||e==="smooth"||e==="isWorldSpace"||e==="gradientType";default:return!1}}function dx(i,e,t,r,n){var o;let s=!1;for(let[a,l]of Object.entries(i)){if(!a||l===void 0||Np(a,t,n))continue;t.visible=n.visible;let c=t.uniforms[`f${t.id}_${a}`];if(!!c)switch(c.constructor){case Ot:if(typeof l=="string"){let h=e.getColor(l);h&&(c.value=h);break}else{let h=l;c.value instanceof ra?c.value=new Wr(h.r,h.g,h.b,h.a):c.setRGBA(h);break}case fi:if(typeof l=="string"){let h=e.getColor(l);h&&(c.value=h);break}else{let h=l;c.value instanceof ra?c.value=new Wr(h.r,h.g,h.b,h.a):c.value.setRGBA(h.r,h.g,h.b,h.a);break}case Nr:{let h=l;c.value.setX(h[0]),c.value.setY(h[1]);break}case Or:{let h=l;c.value.setX(h[0]),c.value.setY(h[1]),c.value.setZ(h[2]);break}case jr:{let h=l;if("image"in h){let u=h.image;if(typeof u=="string"){let f=e.getImage(u);f&&(c.value.image=f)}else{let f=new Image;f.src=co(u.data),c.value.image=f}}"wrapping"in h&&(c.value.wrapS=c.value.wrapT=h.wrapping),"repeat"in h&&c.value.repeat.fromArray(h.repeat),"offset"in h&&c.value.offset.fromArray(h.offset),c.value.needsUpdate=!0;break}case ps:{l.forEach((h,u)=>{c.value[u].setX(h[0]),c.value[u].setY(h[1]),c.value[u].setZ(h[2]),c.value[u].setW(h[3])});break}default:{s=s||iG(t,a),c.value=l;break}}}if(s&&n){let a=Bp({id:"0",fi:0,data:n},e);(o=r.userData.layers)==null||o.changeLayer(t.id,ie({},a)),r.dispose(),r.needsUpdate=!0}}var px=new M,xT=new Gr,bT=new Ae,Su={type:"follow",normal:new M,raycaster:new io},vc;(t=>{function i(r){if(r.type===10)return{type:"follow"}}t.create=i;function e({target:r,normal:n,raycaster:s,begin:o,change:a}){!r||!n||!s||(o&&o("follow",r.uuid),xT.setFromNormalAndCoplanarPoint(n,r.getWorldPosition(px)),s.ray.intersectPlane(xT,px),r.position.copy(px),r.parent!==null&&r.position.applyMatrix4(bT.copy(r.parent.matrixWorld).invert()),r.position.applyMatrix4(bT.copy(r.hiddenMatrix).invert()),r.updateMatrix(),er(r)&&Lt(r.parent)&&r.invalidateDownstreamBooleanData(!0),a&&a())}t.listener=e})(vc||(vc={}));var mx=new M,wT=new Gr,Mu={type:"lookAt",normal:new M,raycaster:new io},xc;(t=>{function i(r){if(r.type===9&&r.distance)return{type:"lookAt",distance:r.distance}}t.create=i;function e({target:r,normal:n,raycaster:s,begin:o,change:a}){var c,h,u;if(!((h=(c=r==null?void 0:r.interaction)==null?void 0:c.events.lookAt)!=null&&h.length)||!n||!s)return;o&&o("lookAt",r.uuid);let l=r.interaction.events.lookAt[0].distance;wT.set(n,-l),s.ray.intersectPlane(wT,mx),r.lookAt(mx),r.updateMatrix(),(u=r.interaction.animation)==null||u.finished.then(()=>{r.lookAt(mx),r.updateMatrix(),er(r)&&Lt(r.parent)&&r.invalidateDownstreamBooleanData(!0)}),er(r)&&Lt(r.parent)&&r.invalidateDownstreamBooleanData(!0),a&&a()}t.listener=e})(xc||(xc={}));var gx={type:"start"},bc;(t=>{function i(r){if(r.type===7)return{type:"start",targets:[]}}t.create=i;function e({target:r,begin:n,change:s}){var a,l;if(!((l=(a=r==null?void 0:r.interaction)==null?void 0:a.events.start)!=null&&l.length))return;n&&n("start",r.uuid);let o={change:s};r.interaction.events.start.forEach(c=>{c.targets.forEach(({object:h,state:u,params:f})=>{var d;return(d=h.interaction)==null?void 0:d.animate(u,f,o)})})}t.listener=e})(bc||(bc={}));var am={type:"scroll"},wc;(t=>{function i(r){if(!(r.type!==11||r.steps===void 0))return{type:"scroll",targets:[],steps:r.steps}}t.create=i;function e({target:r,deltaY:n,begin:s,change:o}){var c,h;if(!((h=(c=r==null?void 0:r.interaction)==null?void 0:c.events.scroll)!=null&&h.length)||!n)return;s&&s("scroll",r.uuid);let a={change:o},l=n>0?1:-1;r.interaction.events.scroll.forEach(u=>{u.targets.forEach(({object:f,state:d,params:p})=>{var g;let m=xe(ie({},p),{autoplay:!1,cycle:!1,rewind:!1,repeat:!1});(g=f.interaction)==null||g.seek(d,l,u.steps,m,a)})})}t.listener=e})(wc||(wc={}));var Mc={type:"mouseHover"},Sc;(t=>{function i(r){if(r.type===2)return{type:"mouseHover",targets:[]}}t.create=i;function e({target:r,begin:n,change:s,enter:o}){var l,c;if(!((c=(l=r==null?void 0:r.interaction)==null?void 0:l.events.mouseHover)!=null&&c.length)||o===void 0)return;n&&n("mouseHover",r.uuid);let a={change:s};o?r.interaction.events.mouseHover.forEach(h=>{h.targets.forEach(({object:u,state:f,params:d})=>{var p;(p=u.interaction)==null||p.animate(f,d,a)})}):r.interaction.events.mouseHover.forEach(h=>{h.targets.forEach(({object:u,params:f})=>{let d=u.interaction;(d==null?void 0:d.fromState)!==void 0&&d.animate(d.fromState,f,a)})})}t.listener=e})(Sc||(Sc={}));var yx={type:"mouseDown"},vx={type:"mouseUp"},lm={type:"keyDown"},cm={type:"keyUp"},xs;(t=>{function i(r){var o,a;let n,s;if(r.type===0)n={type:"mousedown"},s="mouseDown";else if(r.type===1)n={type:"mouseup"},s="mouseUp";else if(r.type===5){if(!r.key)return;n={type:"keydown",key:r.key},s="keyDown"}else if(r.type===6){if(!r.key)return;n={type:"keyup",key:r.key},s="keyUp"}else return;return{type:s,domEvent:n,targets:[],url:(o=r.url)!=null?o:void 0,toggle:(a=r.toggle)!=null?a:!1,enable:!1}}t.create=i;function e({target:r,interactionEvents:n,type:s,begin:o,change:a}){var c;if(!r)return;n||(n=(c=r.interaction)==null?void 0:c.events[s]),o&&o(s,r.uuid);let l={change:a};n.forEach(h=>{if(h.toggle){h.enable=!h.enable;for(let{object:u,state:f,params:d}of h.targets){let p=u.interaction;if(p!==void 0){let m=xe(ie({},d),{cycle:!1,rewind:!1,repeat:!1});h.enable?p.animate(f,m,l):p.fromState!==void 0&&p.animate(p.fromState,m,l)}}}else h.targets.forEach(({object:u,state:f,params:d})=>{var p;return(p=u.interaction)==null?void 0:p.animate(f,d,l)});h.url&&(Ho?window.location.assign(h.url):window.open(h.url,"_blank"))})}t.listener=e})(xs||(xs={}));function sG(i){let e,{type:t}=i;return t===10?e=vc.create(i):t===0||t===1||t===5||t===6?e=xs.create(i):t===9?e=xc.create(i):t===2?e=Sc.create(i):t===11?e=wc.create(i):t===7&&(e=bc.create(i)),e}function ST(i,e,t){let r=[];i.objects.traverse((n,s)=>{let o=e.find(n);if(delete o.interaction,!s.visible&&!Lt(o.parent)||s.states===void 0)return;let a=new sm(o,t),l=a.states;l.push(na.create(n,s));for(let h of s.states){let u=Oh.patch(s,h.data);l.push(na.create(h.id,u))}let c=a.events;if(s.events)for(let{data:h}of s.events){let u=sG(h);if(!u)continue;let f=u.type;c[f]?c[f].push(u):c[f]=[u],"targets"in h&&r.push([h,u])}(l.length>0||Object.keys(c).length>0)&&(o.interaction=a,xx(o,s,null,t))});for(let[n,s]of r)if("targets"in n&&"targets"in s)for(let{data:o}of n.targets){let a=gc.create(o,e);a&&s.targets.push(a)}}function xx(i,e,t,r,n=!1){if(!n&&e.states.length===0)return;let s=t===null?e:Oh.patch(e,e.states.data(t));if(Ev(i,s),i instanceof kt&&s.type==="Mesh"){if(i instanceof po?i.buildFromStore(s.geometry):i.updateGeometry({parameters:s.geometry}),i.freeBooleanPointer(),Lt(i.parent)&&i.parent.invalidateDownstreamBooleanData().recomputeBoolean(),"material"in s){if(i.material instanceof Array)return;if(typeof s.material!="string"){let a=s.material.layers;for(let l of a){let c=i.material.userData.layers.getLayerByUuid(l.id);dx(l.data,r,c,i.material,l.data)}}}else if("materials"in s){if(!(i.material instanceof Array))return;var o=0;for(let a of s.materials){if(typeof a!="string"){let l=a.layers;for(let c of l){let h=i.material[o].userData.layers.getLayerByUuid(c.id);dx(c.data,r,h,i.material[o],c.data)}}o++}}}else if(s.type==="DirectionalLight")i.fromDirectionalLightState(s,r);else if(s.type==="PointLight")i.fromPointLightState(s,r);else if(s.type==="SpotLight")i.fromSpotLightState(s,r);else if(i instanceof Bn&&eo.is(s.type)){let a=s;i.setZoom("PerspectiveCamera",a.perspective.zoom),i.setZoom("OrthographicCamera",a.orthographic.zoom)}}var na=class{constructor(e){this.objectState=e;this.uuid=et.generateUUID()}static create(e,t){let r=new na(t);return r.uuid=e,r}execute(e,t){xx(e,this.objectState,null,t,!0)}};var Yi=new io,Zn=new M,bx={follow:vc.listener,keyDown:xs.listener,keyUp:xs.listener,lookAt:xc.listener,mouseDown:xs.listener,mouseUp:xs.listener,mouseHover:Sc.listener,scroll:wc.listener,start:bc.listener},MT={follow:Su,keyDown:lm,keyUp:cm,lookAt:Mu,mouseDown:yx,mouseUp:vx,mouseHover:Mc,scroll:am,start:gx};function oG(i){if(i.style.transform!==""){let e=getComputedStyle(i).getPropertyValue("transform");if(e!=="none"){let t=e.replace("matrix(","").split(",");return{x:parseFloat(t[0]),y:parseFloat(t[3])}}}return{x:1,y:1}}function AT(i){let e=i.getViewport(new Je),t=oG(i.domElement);return{left:e.x*t.x,top:e.y*t.y,width:e.z*t.x,height:e.w*t.y}}function wx(i,e){if(er(e)){if(!e.raycastLock&&e.visible){let t=i.intersectObject(e,!1);return t.length?t[0]:void 0}}else if(e.objectType==="EmptyObject")return TT(i,e)}function TT(i,e){if(er(e)&&!e.raycastLock&&e.visible){let t=i.intersectObject(e,!1);if(t.length)return t[0]}for(let t of e.children)if(Zo(t)){let r=TT(i,t);if(r)return r}}var hm=class{constructor(e,t,r,n){this.isEnable=!1;this.splineEvents={};this._map={};this._prevObjects=[];this._onMouseDown=e=>{Yi.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Zn),Zn.negate(),this._handleMouseDownEvent(e)};this._onMouseUp=e=>{Yi.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Zn),Zn.negate(),this._handleMouseUpEvent(e)};this._onMouseMove=e=>{Yi.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Zn),Zn.negate(),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e)};this._onTouchStart=e=>{e.touches.length===1&&(Yi.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(Zn),Zn.negate(),this._handleMouseDownEvent(e),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e))};this._onTouchEnd=e=>{this._handleMouseUpEvent(e),this._handleMouseHoverEvent(e,!0)};this._onTouchMove=e=>{e.touches.length===1&&(Yi.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(Zn),Zn.negate(),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e))};this._onWheel=e=>{this._handleWheelEvent(e)};this._onKeyDown=e=>{this._handleKeyDownEvent(e)};this._onKeyUp=e=>{this._handleKeyUpEvent(e)};this._renderer=e,this._domElement=e.domElement,this._camera=r,this._scene=t,this._app=n,this._domRect=this._domElement.getBoundingClientRect(),this._viewRect=AT(e)}activate(){var e,t,r,n,s,o,a,l,c,h,u,f,d,p,m,g,v,y;this.isEnable=!0,this._map={},this._scene.traverseEntity(w=>{w.interaction!==void 0&&(w.interaction.start(),Object.keys(w.interaction.events).forEach(b=>{let S=b;this._addDOMCustomEvent(S,w),(w.visible||S!=="mouseDown"&&S!=="mouseUp"&&S!=="mouseHover")&&this._addSPEEvent(S,w)}))}),Bd?((((e=this._map.mouseDown)==null?void 0:e.length)||((t=this._map.mouseHover)==null?void 0:t.length)||((r=this._map.lookAt)==null?void 0:r.length)||((n=this._map.follow)==null?void 0:n.length))&&this._domElement.addEventListener("touchstart",this._onTouchStart),(((s=this._map.mouseUp)==null?void 0:s.length)||((o=this._map.mouseHover)==null?void 0:o.length))&&this._domElement.addEventListener("touchend",this._onTouchEnd),(((a=this._map.mouseHover)==null?void 0:a.length)||((l=this._map.lookAt)==null?void 0:l.length)||((c=this._map.follow)==null?void 0:c.length))&&this._domElement.addEventListener("touchmove",this._onTouchMove)):((h=this._map.mouseDown)!=null&&h.length&&this._domElement.addEventListener("pointerdown",this._onMouseDown),(u=this._map.mouseUp)!=null&&u.length&&this._domElement.addEventListener("pointerup",this._onMouseUp),(((f=this._map.mouseHover)==null?void 0:f.length)||((d=this._map.lookAt)==null?void 0:d.length)||((p=this._map.follow)==null?void 0:p.length))&&this._domElement.addEventListener("pointermove",this._onMouseMove)),(m=this._map.scroll)!=null&&m.length&&this._domElement.addEventListener("wheel",this._onWheel),(g=this._map.keyDown)!=null&&g.length&&document.addEventListener("keydown",this._onKeyDown),(v=this._map.keyUp)!=null&&v.length&&document.addEventListener("keyup",this._onKeyUp),(y=this._map.start)!=null&&y.length&&this._handleStartEvent(),this.resize()}deactivate(){this._scene.traverseEntity(e=>{if(!e.interaction)return;e.interaction.end();let t=e;Object.keys(bx).forEach(r=>{let n=r;t.removeEventListener(n,bx[n])})}),this._domElement.removeEventListener("pointerdown",this._onMouseDown),this._domElement.removeEventListener("pointerup",this._onMouseUp),this._domElement.removeEventListener("pointermove",this._onMouseMove),this._domElement.removeEventListener("touchstart",this._onTouchStart),this._domElement.removeEventListener("touchend",this._onTouchEnd),this._domElement.removeEventListener("touchmove",this._onTouchMove),this._domElement.removeEventListener("wheel",this._onWheel),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keyup",this._onKeyUp),this._map={},this.isEnable=!1}reset(){this._scene.traverseEntity(e=>{var t;(t=e.interaction)==null||t.start()}),this._handleStartEvent()}resize(){this._domRect=this._domElement.getBoundingClientRect(),this._viewRect=AT(this._renderer)}_getPointer(e,t){let r=this._domRect,n=this._viewRect,s=r.height-n.height,o=(e-n.left-r.left)*(r.width/n.width),a=(t-s+n.top-r.top)*(r.height/n.height);return{x:o/r.width*2-1,y:-(a/r.height)*2+1}}_handleStartEvent(){var e;(e=this._map.start)==null||e.forEach(t=>{t.dispatchEvent(gx)})}_handleWheelEvent(e){var t;(t=this._map.scroll)!=null&&t.length&&(am.deltaY=e.deltaY,this._map.scroll.forEach(r=>{r.dispatchEvent(am)}))}_handleMouseDownEvent(e){var t;(t=this._map.mouseDown)==null||t.forEach(r=>{wx(Yi,r)&&r.dispatchEvent(yx)})}_handleMouseUpEvent(e){var t;(t=this._map.mouseUp)==null||t.forEach(r=>{wx(Yi,r)&&r.dispatchEvent(vx)})}_handleMouseHoverEvent(e,t=!1){var n;let r=[];t||(n=this._map.mouseHover)==null||n.forEach(s=>{wx(Yi,s)&&r.push(s)}),this._prevObjects.length&&(Mc.enter=!1,this._prevObjects.forEach(s=>{r.includes(s)||s.dispatchEvent(Mc)})),r.length&&(Mc.enter=!0,r.forEach(s=>{s.dispatchEvent(Mc)})),this._prevObjects=r}_handleLookAtEvent(e){var t;(t=this._map.lookAt)!=null&&t.length&&(Mu.normal=Zn,Mu.raycaster=Yi,this._map.lookAt.forEach(r=>{r.dispatchEvent(Mu)}))}_handleFollowEvent(e){this._map.follow&&(Su.normal=Zn,Su.raycaster=Yi,this._map.follow.forEach(t=>t.dispatchEvent(Su)))}_handleKeyDownEvent(e){var t;(t=this._map.keyDown)==null||t.forEach(r=>{var n,s,o;lm.interactionEvents=(o=(s=(n=r.interaction)==null?void 0:n.events)==null?void 0:s.keyDown)==null?void 0:o.filter(a=>a.domEvent.type==="keydown"&&a.domEvent.key===e.key),r.dispatchEvent(lm)})}_handleKeyUpEvent(e){var t;(t=this._map.keyUp)==null||t.forEach(r=>{var n,s,o;cm.interactionEvents=(o=(s=(n=r.interaction)==null?void 0:n.events)==null?void 0:s.keyUp)==null?void 0:o.filter(a=>a.domEvent.type==="keyup"&&a.domEvent.key===e.key),r.dispatchEvent(cm)})}_addSPEEvent(e,t){var r;!t.interaction||(MT[e].begin=this._dispatchDOMCustomEvent.bind(this),MT[e].change=this._app.requestRender.bind(this),(r=t.interaction.events[e])!=null&&r.length&&(t.addEventListener(e,bx[e]),this._map[e]===void 0?this._map[e]=[t]:this._map[e].push(t)))}_addDOMCustomEvent(e,t){if(e){let r=new CustomEvent(e,{bubbles:!0});Object.defineProperty(r,"target",{writable:!1,value:{id:t.uuid,name:t.name}}),this.splineEvents[e]?this.splineEvents[e][t.uuid]=r:this.splineEvents[e]={[t.uuid]:r}}}_dispatchDOMCustomEvent(e,t){var n;let r=(n=this.splineEvents[e])==null?void 0:n[t];r&&this._domElement.dispatchEvent(r)}};var um=class{constructor(e,t,r,n,s){this._aspect=1;this._renderer=e,this._camera=t,this._frameSize=new B().copy(r),this._editorSize=new B().copy(n),this._aspect=t.aspect,this._fov=s!=null?s:t.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){!this._renderer||this._renderer.setSize(this._frameSize.x,this._frameSize.y,!1)}updateViewportForImageExport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,n=this._editorSize.y;this._aspect=e/t,this._camera.zoom*=Math.min(r/e,n/t),this._renderer.setViewport(0,0,e,t)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,n=this._editorSize.y,s=0,o=0,a=e,l=t;e<r&&(s=(r-e)*.5,s=-s,a=r),t<n&&(o=(n-t)*.5,o=-o,l=n),this._aspect=a/l,this._renderer.setViewport(s,o,a,l)}updateCamera(){if(!!this._camera)if(this._camera.cameraType==="PerspectiveCamera"){let e=this._frameSize.y,t=this._editorSize.y,r=this._fov;if(e>t){let n=aG(e,1080,2160,1,15)/100;r*=e/t,r*=1-n}this._camera.aspect=this._aspect,this._camera.fov=r,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y)}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t,!1)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t),this._camera.updateProjectionMatrix())}};function aG(i,e,t,r,n){return(i-e)/(t-e)*(n-r)+r}var fm=class{constructor(e){this.sharedAssets=new om(e.shared),this.scene=new Zp(e.scene,this.sharedAssets),this.scene.switchActiveCamera(this.scene.activeCamera)}reset(e,t){this.scene.clearScene(this.sharedAssets),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}dispose(){this.scene.dispose()}};var dm=class{constructor({x:e=10,y:t=10}){this._startTime=0;let r=document.getElementById("spe-perfs");r?this.element=r:(this.element=document.createElement("div"),document.body.appendChild(this.element),this.element.style.position="absolute",this.element.style.zIndex="10000",this.element.style.fontFamily="monospace",this.element.style.background="black",this.element.style.color="white",this.element.style.padding="10px",this.element.style.opacity="0.5",this.element.style.fontSize="11px",this.element.setAttribute("id","spe-perfs")),this.element.style.left=`${e}px`,this.element.style.top=`${t}px`}dispose(){var e;(e=this.element.parentElement)==null||e.removeChild(this.element)}start(){this._startTime=performance.now()}end(){let t=performance.now()-this._startTime;this.element.innerHTML=t.toFixed(3)+" ms"}};function lG(i){let e;if(!!i.index)for(let t=0;t<i.index.array.length;t+=3)e=i.index.array[t],i.index.array[t]=i.index.array[t+2],i.index.array[t+2]=e}function Sx(i){return i==="SubdivObject"||i==="NonParametric"?i:"Mesh"}function cG(i,e){let t={};return i.traverseEntity(r=>{var c;if(r.type!=="Mesh"||!("material"in r)||!r.visible||!(r instanceof kt)||Array.isArray(r.material)||r&&r.interaction&&r.interaction.states.length>0)return;let n=r.parent;for(;n;){if(n instanceof kt&&n.interaction&&n.interaction.states.length>1)return;n=n.parent}let s=r.material.uuid,o=e.shared.materials[s];if(o){if(!hi.isMergable(o))return}else{let h=(c=e.scene.objects.get(r.uuid))==null?void 0:c.data;if(h&&"material"in h&&typeof h.material!="string"){if(!hi.isMergable(h.material))return;s=hi.getHash(h.material)}}t[s]||(t[s]={});let l=t[s][Sx(r.objectType)];if(l){if(l.push(r),r.cloner)for(let h of r.cloner.children)l.push(h)}else if(t[s][Sx(r.objectType)]=[r],r.cloner)for(let h of r.cloner.children)t[s][Sx(r.objectType)].push(h)}),t}function hG(i){let e=0;return Object.values(i).forEach(t=>{Object.values(t).forEach(r=>{let n=r.length;n>e&&(e=n)})}),e}function ET(i,e){let t=cG(e,i),r=hG(t),n=new Array(r),s=0,o=new Array(r),a=0,l=new Array(r),c=0,h=new Array(r),u=0;for(let f of Object.values(t))for(let d of Object.values(f)){if(a=0,c=0,d.forEach(m=>{m instanceof kt&&(o[a++]=m.geometry.clone(),l[c++]=m)}),c<2)continue;for(let m=0;m<c;m++)l[m].updateWorldMatrix(!0,!1),o[m].applyMatrix4(l[m].matrixWorld),l[m].matrixWorld.determinant()<0&&lG(o[m]);let p=RM(o.slice(0,a),!1);if(p){let m;switch(d[0].objectType){case"SubdivObject":{console.warn("Turning subdiv object into mesh"),m=new Vt(p,l[0].material);break}default:{m=new Vt(p,l[0].material);break}}m.castShadow=l[0].castShadow,m.receiveShadow=l[0].receiveShadow,e.add(m);let g=v=>{u=0;for(let y of v)y.children&&g(y.children),y instanceof kt&&(Array.isArray(y.material)||t[y.material.uuid]&&t[y.material.uuid][y.objectType]&&t[y.material.uuid][y.objectType].length>1||(h[u++]=y));for(let y=0;y<u;y++)e.attach(h[y])};for(let v=0;v<c;v++){let y=l[v];g(y.children),n[s++]=y}}}for(let f=0;f<s;f++)n[f].removeFromParent()}var uG=new B,_T="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.",CT=class{constructor(e,{autoRender:t=!1}={}){this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._skipRender=!0;this.autoRender=!1;this.disposed=!1;this.requestRender=()=>{this._skipRender=!1};this.render=()=>{var e,t,r;!this._renderer||(this._rafId=requestAnimationFrame(this.render),(e=this._perfs)==null||e.start(),!(!this.autoRender&&this._skipRender)&&(this._controls&&(this._controls.enableDamping||this._controls.autoRotate)?this._skipRender=!this._controls.update():this._skipRender=!0,this._playmode&&!this._playmode.isEnable&&this._playmode.activate(),this._scene&&this._camera&&(this._renderer.autoClear=!1,this._transmissionRenderTarget&&(this._renderer.setRenderTarget(this._transmissionRenderTarget),this._renderer.clear(),this._camera.layers.enable(0),this._camera.layers.disable(3),this._renderer.render(this._scene,this._camera),this._renderer.setRenderTarget(null),this._camera.layers.enable(3)),(t=this._scene.postprocessing)!=null&&t.enabled?(this._renderer.autoClear=!1,this._scene.postprocessing.render()):(this._renderer.autoClear=!0,this._renderer.render(this._scene,this._camera))),(r=this._perfs)==null||r.end()))};this.resize=Mh(()=>{var e,t,r,n,s;!this._renderer||(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=uG.set(this._viewportWidth,this._viewportHeight)),(e=this._frameView)==null||e.updateRenderer(),(t=this._scene)!=null&&t.postprocessing&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight,!1),this._viewportMode!==1&&((r=this._frameView)==null||r.updateViewport()),this._camera&&((n=this._frameView)==null||n.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&this._viewportMode===1&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),(s=this._playmode)==null||s.resize(),this.requestRender())},10);this.canvas=e,this.autoRender=t,window.location.search.includes("perfs")&&(this._perfs=new dm({x:10,y:10}))}async load(e){e.endsWith(".spline")?console.warn(_T+" The .spline files are only meant to be used by the Editor."):e.endsWith(".splinecode")||console.warn(_T);let r=await(await fetch(e)).arrayBuffer();await this.start(r)}async start(e){var l;if(this.disposed)return;let t=await zA(e);this._publishData=t.scene.publish,Rv(t)&&await K1();let r=new fm(t);if(window.location.search.includes("merge-geometries")){let c=performance.now();ET(t,r.scene);let h=performance.now();console.log("Merged geometries in ",h-c," ms")}this._scene=r.scene,Rv(t)&&this._scene.traverse(c=>{Lt(c)&&c.recomputeBoolean()}),this._sharedAssetsManager=r.sharedAssets,this._sharedAssetsManager.onImageLoad=()=>{this.requestRender()},ST(t.scene,this._scene,this._sharedAssetsManager),this._camera=this._scene.activeCamera;let n=Object.values(t.frames)[0],s,o;if(n)if(n.preset==="fullscreen"){this._viewportMode=1;let{width:c,height:h}=window.getComputedStyle(this.canvas);this.canvas.parentElement&&(c==="300px"||c==="auto")?(this._viewportWidth=this.canvas.parentElement.clientWidth,this.canvas.style.width="100%",s=this.canvas.style.width):this._viewportWidth=this.canvas.clientWidth,this.canvas.parentElement&&(h==="150px"||h==="auto")?(this._viewportHeight=this.canvas.parentElement.clientHeight,this.canvas.style.height="100%",o=this.canvas.style.height):this._viewportHeight=this.canvas.clientHeight}else this._viewportMode=2,this._viewportWidth=n.size[0],this._viewportHeight=n.size[1],s=this._viewportWidth+"px",o=this._viewportHeight+"px";(l=this._scene.postprocessing)!=null&&l.enabled?(this._renderer=new Pt({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"}),this._scene.postprocessing.init({renderer:this._renderer,camera:this._camera,scene:this._scene}),this._scene.postprocessing.addEventListener("smaaloaded",this.requestRender)):this._renderer=new Pt({canvas:this.canvas,antialias:!0,alpha:!0,stencil:!0,depth:!0,powerPreference:"high-performance"}),s&&(this.canvas.style.width=s),o&&(this.canvas.style.height=o),this._scene.needsTransmission(void 0)&&(this._transmissionRenderTarget=new mt(2048,2048,{generateMipmaps:!0,minFilter:js,magFilter:ct,wrapS:Dr,wrapT:Dr}),this._transmissionRenderTarget.depthTexture=new oi(2048,2048),this._scene.needsTransmission(this._transmissionRenderTarget)),this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._scene.postprocessing&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight,!1),this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=Zg,this._renderer.setClearColor(this._scene.bgColor,this._scene.alpha),this._frameView=new um(this._renderer,this._camera,new B(this._viewportWidth,this._viewportHeight),new B(window.innerWidth,window.innerHeight)),!0&&(this._controls=new cp(this._camera,this._renderer.domElement),this._publishData&&(this._controls.fromJSON(this._publishData.orbitControls),this._controls.useKeyEvents=!1),this._controls.addEventListener("change",this.requestRender),this._controls.addEventListener("start",this.requestRender)),this._playmode=new hm(this._renderer,this._scene,this._camera,this),this.resize(),this.render(),this.canvas.parentElement&&(await QS(0),this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this.resize()}),this._resizeObserver.observe(this.canvas.parentElement))}findObjectById(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByName(e);return this._createProxyObject(t)}getSplineEvents(){var e;return(e=this._playmode)==null?void 0:e.splineEvents}emitEvent(e,t){let r=this.findObjectById(t);r==null||r.emitEvent(e)}emitEventReverse(e,t){let r=this.findObjectById(t);r==null||r.emitEventReverse(e)}addEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.addEventListener(e,t)}removeEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.removeEventListener(e,t)}setZoom(e){var t;(t=this._controls)==null||t.zoomOut(e)}setSize(e,t){this._viewportWidth=e,this._viewportHeight=t,this._viewportMode=2,this.resize()}dispose(){var e,t,r,n,s,o,a;this.disposed=!0,(e=this._playmode)==null||e.deactivate(),(t=this._scene)==null||t.dispose(),this._rafId&&cancelAnimationFrame(this._rafId),this._proxyObjectCache.forEach(l=>{py.unsubscribe(l)}),(r=this._renderer)==null||r.dispose(),(n=this._transmissionRenderTarget)==null||n.dispose(),(o=(s=this._transmissionRenderTarget)==null?void 0:s.depthTexture)==null||o.dispose(),(a=this._sharedAssetsManager)==null||a.dispose(),this._resizeObserver&&this._resizeObserver.disconnect()}_createProxyObject(e){if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);let t={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,emitEvent(n){var s;(s=e.interaction)==null||s.emitEvent(n)},emitEventReverse(n){var s;(s=e.interaction)==null||s.emitEventReverse(n)}},r=py(t,(n,s)=>{var a;typeof e[n]!="object"&&((a=Object.getOwnPropertyDescriptor(e,n))==null?void 0:a.writable)&&(e[n]=s),this.requestRender(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,r),r}};export{CT as Application};
|