@aibee/crc-bmap 0.12.21 → 0.12.22
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/lib/index.cjs +1 -1
- package/lib/index.esm.min.js +1 -1
- package/lib/index.online.esm.min.js +1 -1
- package/lib/index.online.min.js +1 -1
- package/package.json +1 -1
package/lib/index.online.min.js
CHANGED
|
@@ -8167,7 +8167,7 @@ void main() {
|
|
|
8167
8167
|
}
|
|
8168
8168
|
|
|
8169
8169
|
}\`,uh=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){let r=new $t,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}render(e,t){if(this.texture!==null){if(this.mesh===null){let i=t.cameras[0].viewport,r=new xn({extensions:{fragDepth:!0},vertexShader:tN,fragmentShader:nN,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new on(new bo(20,20),r)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}},hh=class extends ai{constructor(e,t){super();let i=this,r=null,s=1,o=null,a="local-floor",c=1,l=null,u=null,h=null,f=null,m=null,g=null,_=new uh,d=t.getContextAttributes(),p=null,b=null,v=[],E=[],I=new ie,R=null,w=new Gt;w.layers.enable(1),w.viewport=new yt;let B=new Gt;B.layers.enable(2),B.viewport=new yt;let j=[w,B],x=new lh;x.layers.enable(1),x.layers.enable(2);let A=null,re=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(k){let Q=v[k];return Q===void 0&&(Q=new hs,v[k]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(k){let Q=v[k];return Q===void 0&&(Q=new hs,v[k]=Q),Q.getGripSpace()},this.getHand=function(k){let Q=v[k];return Q===void 0&&(Q=new hs,v[k]=Q),Q.getHandSpace()};function K(k){let Q=E.indexOf(k.inputSource);if(Q===-1)return;let me=v[Q];me!==void 0&&(me.update(k.inputSource,k.frame,l||o),me.dispatchEvent({type:k.type,data:k.inputSource}))}function C(){r.removeEventListener("select",K),r.removeEventListener("selectstart",K),r.removeEventListener("selectend",K),r.removeEventListener("squeeze",K),r.removeEventListener("squeezestart",K),r.removeEventListener("squeezeend",K),r.removeEventListener("end",C),r.removeEventListener("inputsourceschange",W);for(let k=0;k<v.length;k++){let Q=E[k];Q!==null&&(E[k]=null,v[k].disconnect(Q))}A=null,re=null,_.reset(),e.setRenderTarget(p),m=null,f=null,h=null,r=null,b=null,Ie.stop(),i.isPresenting=!1,e.setPixelRatio(R),e.setSize(I.width,I.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(k){s=k,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(k){a=k,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(k){l=k},this.getBaseLayer=function(){return f!==null?f:m},this.getBinding=function(){return h},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=function(k){return Cs(this,null,function*(){if(r=k,r!==null){if(p=e.getRenderTarget(),r.addEventListener("select",K),r.addEventListener("selectstart",K),r.addEventListener("selectend",K),r.addEventListener("squeeze",K),r.addEventListener("squeezestart",K),r.addEventListener("squeezeend",K),r.addEventListener("end",C),r.addEventListener("inputsourceschange",W),d.xrCompatible!==!0&&(yield t.makeXRCompatible()),R=e.getPixelRatio(),e.getSize(I),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let Q={antialias:r.renderState.layers===void 0?d.antialias:!0,alpha:!0,depth:d.depth,stencil:d.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(r,t,Q),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),b=new Fn(m.framebufferWidth,m.framebufferHeight,{format:an,type:ii,colorSpace:e.outputColorSpace,stencilBuffer:d.stencil})}else{let Q=null,me=null,Ae=null;d.depth&&(Ae=d.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Q=d.stencil?Tr:Ii,me=d.stencil?Pi:ei);let Me={colorFormat:t.RGBA8,depthFormat:Ae,scaleFactor:s};h=new XRWebGLBinding(r,t),f=h.createProjectionLayer(Me),r.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),b=new Fn(f.textureWidth,f.textureHeight,{format:an,type:ii,depthTexture:new Ao(f.textureWidth,f.textureHeight,me,void 0,void 0,void 0,void 0,void 0,void 0,Q),stencilBuffer:d.stencil,colorSpace:e.outputColorSpace,samples:d.antialias?4:0});let ye=e.properties.get(b);ye.__ignoreDepthValues=f.ignoreDepthValues}b.isXRRenderTarget=!0,this.setFoveation(c),l=null,o=yield r.requestReferenceSpace(a),Ie.setContext(r),Ie.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function W(k){for(let Q=0;Q<k.removed.length;Q++){let me=k.removed[Q],Ae=E.indexOf(me);Ae>=0&&(E[Ae]=null,v[Ae].disconnect(me))}for(let Q=0;Q<k.added.length;Q++){let me=k.added[Q],Ae=E.indexOf(me);if(Ae===-1){for(let ye=0;ye<v.length;ye++)if(ye>=E.length){E.push(me),Ae=ye;break}else if(E[ye]===null){E[ye]=me,Ae=ye;break}if(Ae===-1)break}let Me=v[Ae];Me&&Me.connect(me)}}let G=new U,$=new U;function q(k,Q,me){G.setFromMatrixPosition(Q.matrixWorld),$.setFromMatrixPosition(me.matrixWorld);let Ae=G.distanceTo($),Me=Q.projectionMatrix.elements,ye=me.projectionMatrix.elements,ke=Me[14]/(Me[10]-1),Te=Me[14]/(Me[10]+1),T=(Me[9]+1)/Me[5],oe=(Me[9]-1)/Me[5],Y=(Me[8]-1)/Me[0],se=(ye[8]+1)/ye[0],Z=ke*Y,_e=ke*se,pe=Ae/(-Y+se),xe=pe*-Y;Q.matrixWorld.decompose(k.position,k.quaternion,k.scale),k.translateX(xe),k.translateZ(pe),k.matrixWorld.compose(k.position,k.quaternion,k.scale),k.matrixWorldInverse.copy(k.matrixWorld).invert();let Ge=ke+pe,S=Te+pe,y=Z-xe,V=_e+(Ae-xe),H=T*Te/S*Ge,ee=oe*Te/S*Ge;k.projectionMatrix.makePerspective(y,V,H,ee,Ge,S),k.projectionMatrixInverse.copy(k.projectionMatrix).invert()}function X(k,Q){Q===null?k.matrixWorld.copy(k.matrix):k.matrixWorld.multiplyMatrices(Q.matrixWorld,k.matrix),k.matrixWorldInverse.copy(k.matrixWorld).invert()}this.updateCamera=function(k){if(r===null)return;_.texture!==null&&(k.near=_.depthNear,k.far=_.depthFar),x.near=B.near=w.near=k.near,x.far=B.far=w.far=k.far,(A!==x.near||re!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),A=x.near,re=x.far,w.near=A,w.far=re,B.near=A,B.far=re,w.updateProjectionMatrix(),B.updateProjectionMatrix(),k.updateProjectionMatrix());let Q=k.parent,me=x.cameras;X(x,Q);for(let Ae=0;Ae<me.length;Ae++)X(me[Ae],Q);me.length===2?q(x,w,B):x.projectionMatrix.copy(w.projectionMatrix),ne(k,x,Q)};function ne(k,Q,me){me===null?k.matrix.copy(Q.matrixWorld):(k.matrix.copy(me.matrixWorld),k.matrix.invert(),k.matrix.multiply(Q.matrixWorld)),k.matrix.decompose(k.position,k.quaternion,k.scale),k.updateMatrixWorld(!0),k.projectionMatrix.copy(Q.projectionMatrix),k.projectionMatrixInverse.copy(Q.projectionMatrixInverse),k.isPerspectiveCamera&&(k.fov=Yu*2*Math.atan(1/k.projectionMatrix.elements[5]),k.zoom=1)}this.getCamera=function(){return x},this.getFoveation=function(){if(!(f===null&&m===null))return c},this.setFoveation=function(k){c=k,f!==null&&(f.fixedFoveation=k),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=k)},this.hasDepthSensing=function(){return _.texture!==null};let te=null;function ve(k,Q){if(u=Q.getViewerPose(l||o),g=Q,u!==null){let me=u.views;m!==null&&(e.setRenderTargetFramebuffer(b,m.framebuffer),e.setRenderTarget(b));let Ae=!1;me.length!==x.cameras.length&&(x.cameras.length=0,Ae=!0);for(let ye=0;ye<me.length;ye++){let ke=me[ye],Te=null;if(m!==null)Te=m.getViewport(ke);else{let oe=h.getViewSubImage(f,ke);Te=oe.viewport,ye===0&&(e.setRenderTargetTextures(b,oe.colorTexture,f.ignoreDepthValues?void 0:oe.depthStencilTexture),e.setRenderTarget(b))}let T=j[ye];T===void 0&&(T=new Gt,T.layers.enable(ye),T.viewport=new yt,j[ye]=T),T.matrix.fromArray(ke.transform.matrix),T.matrix.decompose(T.position,T.quaternion,T.scale),T.projectionMatrix.fromArray(ke.projectionMatrix),T.projectionMatrixInverse.copy(T.projectionMatrix).invert(),T.viewport.set(Te.x,Te.y,Te.width,Te.height),ye===0&&(x.matrix.copy(T.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale)),Ae===!0&&x.cameras.push(T)}let Me=r.enabledFeatures;if(Me&&Me.includes("depth-sensing")){let ye=h.getDepthInformation(me[0]);ye&&ye.isValid&&ye.texture&&_.init(e,ye,r.renderState)}}for(let me=0;me<v.length;me++){let Ae=E[me],Me=v[me];Ae!==null&&Me!==void 0&&Me.update(Ae,Q,l||o)}_.render(e,x),te&&te(k,Q),Q.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:Q}),g=null}let Ie=new hy;Ie.setAnimationLoop(ve),this.setAnimationLoop=function(k){te=k},this.dispose=function(){}}},bi=new Ui,iN=new ft;function rN(n,e){function t(d,p){d.matrixAutoUpdate===!0&&d.updateMatrix(),p.value.copy(d.matrix)}function i(d,p){p.color.getRGB(d.fogColor.value,uy(n)),p.isFog?(d.fogNear.value=p.near,d.fogFar.value=p.far):p.isFogExp2&&(d.fogDensity.value=p.density)}function r(d,p,b,v,E){p.isMeshBasicMaterial||p.isMeshLambertMaterial?s(d,p):p.isMeshToonMaterial?(s(d,p),h(d,p)):p.isMeshPhongMaterial?(s(d,p),u(d,p)):p.isMeshStandardMaterial?(s(d,p),f(d,p),p.isMeshPhysicalMaterial&&m(d,p,E)):p.isMeshMatcapMaterial?(s(d,p),g(d,p)):p.isMeshDepthMaterial?s(d,p):p.isMeshDistanceMaterial?(s(d,p),_(d,p)):p.isMeshNormalMaterial?s(d,p):p.isLineBasicMaterial?(o(d,p),p.isLineDashedMaterial&&a(d,p)):p.isPointsMaterial?c(d,p,b,v):p.isSpriteMaterial?l(d,p):p.isShadowMaterial?(d.color.value.copy(p.color),d.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(d,p){d.opacity.value=p.opacity,p.color&&d.diffuse.value.copy(p.color),p.emissive&&d.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(d.map.value=p.map,t(p.map,d.mapTransform)),p.alphaMap&&(d.alphaMap.value=p.alphaMap,t(p.alphaMap,d.alphaMapTransform)),p.bumpMap&&(d.bumpMap.value=p.bumpMap,t(p.bumpMap,d.bumpMapTransform),d.bumpScale.value=p.bumpScale,p.side===Dt&&(d.bumpScale.value*=-1)),p.normalMap&&(d.normalMap.value=p.normalMap,t(p.normalMap,d.normalMapTransform),d.normalScale.value.copy(p.normalScale),p.side===Dt&&d.normalScale.value.negate()),p.displacementMap&&(d.displacementMap.value=p.displacementMap,t(p.displacementMap,d.displacementMapTransform),d.displacementScale.value=p.displacementScale,d.displacementBias.value=p.displacementBias),p.emissiveMap&&(d.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,d.emissiveMapTransform)),p.specularMap&&(d.specularMap.value=p.specularMap,t(p.specularMap,d.specularMapTransform)),p.alphaTest>0&&(d.alphaTest.value=p.alphaTest);let b=e.get(p),v=b.envMap,E=b.envMapRotation;if(v&&(d.envMap.value=v,bi.copy(E),bi.x*=-1,bi.y*=-1,bi.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(bi.y*=-1,bi.z*=-1),d.envMapRotation.value.setFromMatrix4(iN.makeRotationFromEuler(bi)),d.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,d.reflectivity.value=p.reflectivity,d.ior.value=p.ior,d.refractionRatio.value=p.refractionRatio),p.lightMap){d.lightMap.value=p.lightMap;let I=n._useLegacyLights===!0?Math.PI:1;d.lightMapIntensity.value=p.lightMapIntensity*I,t(p.lightMap,d.lightMapTransform)}p.aoMap&&(d.aoMap.value=p.aoMap,d.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,d.aoMapTransform))}function o(d,p){d.diffuse.value.copy(p.color),d.opacity.value=p.opacity,p.map&&(d.map.value=p.map,t(p.map,d.mapTransform))}function a(d,p){d.dashSize.value=p.dashSize,d.totalSize.value=p.dashSize+p.gapSize,d.scale.value=p.scale}function c(d,p,b,v){d.diffuse.value.copy(p.color),d.opacity.value=p.opacity,d.size.value=p.size*b,d.scale.value=v*.5,p.map&&(d.map.value=p.map,t(p.map,d.uvTransform)),p.alphaMap&&(d.alphaMap.value=p.alphaMap,t(p.alphaMap,d.alphaMapTransform)),p.alphaTest>0&&(d.alphaTest.value=p.alphaTest)}function l(d,p){d.diffuse.value.copy(p.color),d.opacity.value=p.opacity,d.rotation.value=p.rotation,p.map&&(d.map.value=p.map,t(p.map,d.mapTransform)),p.alphaMap&&(d.alphaMap.value=p.alphaMap,t(p.alphaMap,d.alphaMapTransform)),p.alphaTest>0&&(d.alphaTest.value=p.alphaTest)}function u(d,p){d.specular.value.copy(p.specular),d.shininess.value=Math.max(p.shininess,1e-4)}function h(d,p){p.gradientMap&&(d.gradientMap.value=p.gradientMap)}function f(d,p){d.metalness.value=p.metalness,p.metalnessMap&&(d.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,d.metalnessMapTransform)),d.roughness.value=p.roughness,p.roughnessMap&&(d.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,d.roughnessMapTransform)),e.get(p).envMap&&(d.envMapIntensity.value=p.envMapIntensity)}function m(d,p,b){d.ior.value=p.ior,p.sheen>0&&(d.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),d.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(d.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,d.sheenColorMapTransform)),p.sheenRoughnessMap&&(d.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,d.sheenRoughnessMapTransform))),p.clearcoat>0&&(d.clearcoat.value=p.clearcoat,d.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(d.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,d.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(d.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,d.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(d.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,d.clearcoatNormalMapTransform),d.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Dt&&d.clearcoatNormalScale.value.negate())),p.iridescence>0&&(d.iridescence.value=p.iridescence,d.iridescenceIOR.value=p.iridescenceIOR,d.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],d.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(d.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,d.iridescenceMapTransform)),p.iridescenceThicknessMap&&(d.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,d.iridescenceThicknessMapTransform))),p.transmission>0&&(d.transmission.value=p.transmission,d.transmissionSamplerMap.value=b.texture,d.transmissionSamplerSize.value.set(b.width,b.height),p.transmissionMap&&(d.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,d.transmissionMapTransform)),d.thickness.value=p.thickness,p.thicknessMap&&(d.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,d.thicknessMapTransform)),d.attenuationDistance.value=p.attenuationDistance,d.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(d.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(d.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,d.anisotropyMapTransform))),d.specularIntensity.value=p.specularIntensity,d.specularColor.value.copy(p.specularColor),p.specularColorMap&&(d.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,d.specularColorMapTransform)),p.specularIntensityMap&&(d.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,d.specularIntensityMapTransform))}function g(d,p){p.matcap&&(d.matcap.value=p.matcap)}function _(d,p){let b=e.get(p).light;d.referencePosition.value.setFromMatrixPosition(b.matrixWorld),d.nearDistance.value=b.shadow.camera.near,d.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function sN(n,e,t,i){let r={},s={},o=[],a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(b,v){let E=v.program;i.uniformBlockBinding(b,E)}function l(b,v){let E=r[b.id];E===void 0&&(g(b),E=u(b),r[b.id]=E,b.addEventListener("dispose",d));let I=v.program;i.updateUBOMapping(b,I);let R=e.render.frame;s[b.id]!==R&&(f(b),s[b.id]=R)}function u(b){let v=h();b.__bindingPointIndex=v;let E=n.createBuffer(),I=b.__size,R=b.usage;return n.bindBuffer(n.UNIFORM_BUFFER,E),n.bufferData(n.UNIFORM_BUFFER,I,R),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,v,E),E}function h(){for(let b=0;b<a;b++)if(o.indexOf(b)===-1)return o.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(b){let v=r[b.id],E=b.uniforms,I=b.__cache;n.bindBuffer(n.UNIFORM_BUFFER,v);for(let R=0,w=E.length;R<w;R++){let B=Array.isArray(E[R])?E[R]:[E[R]];for(let j=0,x=B.length;j<x;j++){let A=B[j];if(m(A,R,j,I)===!0){let re=A.__offset,K=Array.isArray(A.value)?A.value:[A.value],C=0;for(let W=0;W<K.length;W++){let G=K[W],$=_(G);typeof G=="number"||typeof G=="boolean"?(A.__data[0]=G,n.bufferSubData(n.UNIFORM_BUFFER,re+C,A.__data)):G.isMatrix3?(A.__data[0]=G.elements[0],A.__data[1]=G.elements[1],A.__data[2]=G.elements[2],A.__data[3]=0,A.__data[4]=G.elements[3],A.__data[5]=G.elements[4],A.__data[6]=G.elements[5],A.__data[7]=0,A.__data[8]=G.elements[6],A.__data[9]=G.elements[7],A.__data[10]=G.elements[8],A.__data[11]=0):(G.toArray(A.__data,C),C+=$.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,re,A.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function m(b,v,E,I){let R=b.value,w=v+"_"+E;if(I[w]===void 0)return typeof R=="number"||typeof R=="boolean"?I[w]=R:I[w]=R.clone(),!0;{let B=I[w];if(typeof R=="number"||typeof R=="boolean"){if(B!==R)return I[w]=R,!0}else if(B.equals(R)===!1)return B.copy(R),!0}return!1}function g(b){let v=b.uniforms,E=0,I=16;for(let w=0,B=v.length;w<B;w++){let j=Array.isArray(v[w])?v[w]:[v[w]];for(let x=0,A=j.length;x<A;x++){let re=j[x],K=Array.isArray(re.value)?re.value:[re.value];for(let C=0,W=K.length;C<W;C++){let G=K[C],$=_(G),q=E%I;q!==0&&I-q<$.boundary&&(E+=I-q),re.__data=new Float32Array($.storage/Float32Array.BYTES_PER_ELEMENT),re.__offset=E,E+=$.storage}}}let R=E%I;return R>0&&(E+=I-R),b.__size=E,b.__cache={},this}function _(b){let v={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(v.boundary=4,v.storage=4):b.isVector2?(v.boundary=8,v.storage=8):b.isVector3||b.isColor?(v.boundary=16,v.storage=12):b.isVector4?(v.boundary=16,v.storage=16):b.isMatrix3?(v.boundary=48,v.storage=48):b.isMatrix4?(v.boundary=64,v.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),v}function d(b){let v=b.target;v.removeEventListener("dispose",d);let E=o.indexOf(v.__bindingPointIndex);o.splice(E,1),n.deleteBuffer(r[v.id]),delete r[v.id],delete s[v.id]}function p(){for(let b in r)n.deleteBuffer(r[b]);o=[],r={},s={}}return{bind:c,update:l,dispose:p}}var fh=class{constructor(e={}){let{canvas:t=lP(),context:i=null,depth:r=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let f;i!==null?f=i.getContextAttributes().alpha:f=o;let m=new Uint32Array(4),g=new Int32Array(4),_=null,d=null,p=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=vn,this._useLegacyLights=!1,this.toneMapping=ni,this.toneMappingExposure=1;let v=this,E=!1,I=0,R=0,w=null,B=-1,j=null,x=new yt,A=new yt,re=null,K=new Xe(0),C=0,W=t.width,G=t.height,$=1,q=null,X=null,ne=new yt(0,0,W,G),te=new yt(0,0,W,G),ve=!1,Ie=new So,k=!1,Q=!1,me=null,Ae=new ft,Me=new ie,ye=new U,ke={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Te(){return w===null?$:1}let T=i;function oe(M,N){for(let F=0;F<M.length;F++){let z=M[F],D=t.getContext(z,N);if(D!==null)return D}return null}try{let M={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",\`three.js r\${Dh}\`),t.addEventListener("webglcontextlost",tt,!1),t.addEventListener("webglcontextrestored",P,!1),t.addEventListener("webglcontextcreationerror",fe,!1),T===null){let N=["webgl2","webgl","experimental-webgl"];if(v.isWebGL1Renderer===!0&&N.shift(),T=oe(N,M),T===null)throw oe(N)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&T instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),T.getShaderPrecisionFormat===void 0&&(T.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(M){throw console.error("THREE.WebGLRenderer: "+M.message),M}let Y,se,Z,_e,pe,xe,Ge,S,y,V,H,ee,J,Le,Re,le,he,Ue,ae,lt,He,we,Se,be;function Ye(){Y=new ML(T),se=new mL(T,Y,e),Y.init(se),we=new QU(T,Y,se),Z=new KU(T,Y,se),_e=new EL(T),pe=new zU,xe=new jU(T,Y,Z,pe,se,we,_e),Ge=new vL(v),S=new xL(v),y=new PP(T,se),Se=new dL(T,Y,y,se),V=new SL(T,y,_e,Se),H=new RL(T,V,y,_e),ae=new wL(T,se,xe),le=new gL(pe),ee=new BU(v,Ge,S,Y,se,Se,le),J=new rN(v,pe),Le=new VU,Re=new YU(Y,se),Ue=new fL(v,Ge,S,Z,H,f,c),he=new JU(v,H,se),be=new sN(T,_e,se,Z),lt=new pL(T,Y,_e,se),He=new bL(T,Y,_e,se),_e.programs=ee.programs,v.capabilities=se,v.extensions=Y,v.properties=pe,v.renderLists=Le,v.shadowMap=he,v.state=Z,v.info=_e}Ye();let De=new hh(v,T);this.xr=De,this.getContext=function(){return T},this.getContextAttributes=function(){return T.getContextAttributes()},this.forceContextLoss=function(){let M=Y.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){let M=Y.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return $},this.setPixelRatio=function(M){M!==void 0&&($=M,this.setSize(W,G,!1))},this.getSize=function(M){return M.set(W,G)},this.setSize=function(M,N,F=!0){if(De.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}W=M,G=N,t.width=Math.floor(M*$),t.height=Math.floor(N*$),F===!0&&(t.style.width=M+"px",t.style.height=N+"px"),this.setViewport(0,0,M,N)},this.getDrawingBufferSize=function(M){return M.set(W*$,G*$).floor()},this.setDrawingBufferSize=function(M,N,F){W=M,G=N,$=F,t.width=Math.floor(M*F),t.height=Math.floor(N*F),this.setViewport(0,0,M,N)},this.getCurrentViewport=function(M){return M.copy(x)},this.getViewport=function(M){return M.copy(ne)},this.setViewport=function(M,N,F,z){M.isVector4?ne.set(M.x,M.y,M.z,M.w):ne.set(M,N,F,z),Z.viewport(x.copy(ne).multiplyScalar($).round())},this.getScissor=function(M){return M.copy(te)},this.setScissor=function(M,N,F,z){M.isVector4?te.set(M.x,M.y,M.z,M.w):te.set(M,N,F,z),Z.scissor(A.copy(te).multiplyScalar($).round())},this.getScissorTest=function(){return ve},this.setScissorTest=function(M){Z.setScissorTest(ve=M)},this.setOpaqueSort=function(M){q=M},this.setTransparentSort=function(M){X=M},this.getClearColor=function(M){return M.copy(Ue.getClearColor())},this.setClearColor=function(){Ue.setClearColor.apply(Ue,arguments)},this.getClearAlpha=function(){return Ue.getClearAlpha()},this.setClearAlpha=function(){Ue.setClearAlpha.apply(Ue,arguments)},this.clear=function(M=!0,N=!0,F=!0){let z=0;if(M){let D=!1;if(w!==null){let ge=w.texture.format;D=ge===ry||ge===iy||ge===ny}if(D){let ge=w.texture.type,Ee=ge===ii||ge===ei||ge===Oh||ge===Pi||ge===ey||ge===ty,Ce=Ue.getClearColor(),Pe=Ue.getClearAlpha(),Ve=Ce.r,Ne=Ce.g,Oe=Ce.b;Ee?(m[0]=Ve,m[1]=Ne,m[2]=Oe,m[3]=Pe,T.clearBufferuiv(T.COLOR,0,m)):(g[0]=Ve,g[1]=Ne,g[2]=Oe,g[3]=Pe,T.clearBufferiv(T.COLOR,0,g))}else z|=T.COLOR_BUFFER_BIT}N&&(z|=T.DEPTH_BUFFER_BIT),F&&(z|=T.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),T.clear(z)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",tt,!1),t.removeEventListener("webglcontextrestored",P,!1),t.removeEventListener("webglcontextcreationerror",fe,!1),Le.dispose(),Re.dispose(),pe.dispose(),Ge.dispose(),S.dispose(),H.dispose(),Se.dispose(),be.dispose(),ee.dispose(),he.dispose(),De.dispose(),De.removeEventListener("sessionstart",Ht),De.removeEventListener("sessionend",je),me&&(me.dispose(),me=null),Tt.stop()};function tt(M){M.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),E=!0}function P(){console.log("THREE.WebGLRenderer: Context Restored."),E=!1;let M=_e.autoReset,N=he.enabled,F=he.autoUpdate,z=he.needsUpdate,D=he.type;Ye(),_e.autoReset=M,he.enabled=N,he.autoUpdate=F,he.needsUpdate=z,he.type=D}function fe(M){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function O(M){let N=M.target;N.removeEventListener("dispose",O),ce(N)}function ce(M){de(M),pe.remove(M)}function de(M){let N=pe.get(M).programs;N!==void 0&&(N.forEach(function(F){ee.releaseProgram(F)}),M.isShaderMaterial&&ee.releaseShaderCache(M))}this.renderBufferDirect=function(M,N,F,z,D,ge){N===null&&(N=ke);let Ee=D.isMesh&&D.matrixWorld.determinant()<0,Ce=Yx(M,N,F,z,D);Z.setMaterial(z,Ee);let Pe=F.index,Ve=1;if(z.wireframe===!0){if(Pe=V.getWireframeAttribute(F),Pe===void 0)return;Ve=2}let Ne=F.drawRange,Oe=F.attributes.position,ct=Ne.start*Ve,Ft=(Ne.start+Ne.count)*Ve;ge!==null&&(ct=Math.max(ct,ge.start*Ve),Ft=Math.min(Ft,(ge.start+ge.count)*Ve)),Pe!==null?(ct=Math.max(ct,0),Ft=Math.min(Ft,Pe.count)):Oe!=null&&(ct=Math.max(ct,0),Ft=Math.min(Ft,Oe.count));let mt=Ft-ct;if(mt<0||mt===1/0)return;Se.setup(D,z,Ce,F,Pe);let Mn,st=lt;if(Pe!==null&&(Mn=y.get(Pe),st=He,st.setIndex(Mn)),D.isMesh)z.wireframe===!0?(Z.setLineWidth(z.wireframeLinewidth*Te()),st.setMode(T.LINES)):st.setMode(T.TRIANGLES);else if(D.isLine){let Fe=z.linewidth;Fe===void 0&&(Fe=1),Z.setLineWidth(Fe*Te()),D.isLineSegments?st.setMode(T.LINES):D.isLineLoop?st.setMode(T.LINE_LOOP):st.setMode(T.LINE_STRIP)}else D.isPoints?st.setMode(T.POINTS):D.isSprite&&st.setMode(T.TRIANGLES);if(D.isBatchedMesh)st.renderMultiDraw(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount);else if(D.isInstancedMesh)st.renderInstances(ct,mt,D.count);else if(F.isInstancedBufferGeometry){let Fe=F._maxInstanceCount!==void 0?F._maxInstanceCount:1/0,Wo=Math.min(F.instanceCount,Fe);st.renderInstances(ct,mt,Wo)}else st.render(ct,mt)};function qe(M,N,F){M.transparent===!0&&M.side===Un&&M.forceSinglePass===!1?(M.side=Dt,M.needsUpdate=!0,Rs(M,N,F),M.side=si,M.needsUpdate=!0,Rs(M,N,F),M.side=Un):Rs(M,N,F)}this.compile=function(M,N,F=null){F===null&&(F=M),d=Re.get(F),d.init(),b.push(d),F.traverseVisible(function(D){D.isLight&&D.layers.test(N.layers)&&(d.pushLight(D),D.castShadow&&d.pushShadow(D))}),M!==F&&M.traverseVisible(function(D){D.isLight&&D.layers.test(N.layers)&&(d.pushLight(D),D.castShadow&&d.pushShadow(D))}),d.setupLights(v._useLegacyLights);let z=new Set;return M.traverse(function(D){let ge=D.material;if(ge)if(Array.isArray(ge))for(let Ee=0;Ee<ge.length;Ee++){let Ce=ge[Ee];qe(Ce,F,D),z.add(Ce)}else qe(ge,F,D),z.add(ge)}),b.pop(),d=null,z},this.compileAsync=function(M,N,F=null){let z=this.compile(M,N,F);return new Promise(D=>{function ge(){if(z.forEach(function(Ee){pe.get(Ee).currentProgram.isReady()&&z.delete(Ee)}),z.size===0){D(M);return}setTimeout(ge,10)}Y.get("KHR_parallel_shader_compile")!==null?ge():setTimeout(ge,10)})};let Ke=null;function vt(M){Ke&&Ke(M)}function Ht(){Tt.stop()}function je(){Tt.start()}let Tt=new hy;Tt.setAnimationLoop(vt),typeof self!="undefined"&&Tt.setContext(self),this.setAnimationLoop=function(M){Ke=M,De.setAnimationLoop(M),M===null?Tt.stop():Tt.start()},De.addEventListener("sessionstart",Ht),De.addEventListener("sessionend",je),this.render=function(M,N){if(N!==void 0&&N.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(E===!0)return;M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),N.parent===null&&N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),De.enabled===!0&&De.isPresenting===!0&&(De.cameraAutoUpdate===!0&&De.updateCamera(N),N=De.getCamera()),M.isScene===!0&&M.onBeforeRender(v,M,N,w),d=Re.get(M,b.length),d.init(),b.push(d),Ae.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse),Ie.setFromProjectionMatrix(Ae),Q=this.localClippingEnabled,k=le.init(this.clippingPlanes,Q),_=Le.get(M,p.length),_.init(),p.push(_),un(M,N,0,v.sortObjects),_.finish(),v.sortObjects===!0&&_.sort(q,X),this.info.render.frame++,k===!0&&le.beginShadows();let F=d.state.shadowsArray;if(he.render(F,M,N),k===!0&&le.endShadows(),this.info.autoReset===!0&&this.info.reset(),(De.enabled===!1||De.isPresenting===!1||De.hasDepthSensing()===!1)&&Ue.render(_,M),d.setupLights(v._useLegacyLights),N.isArrayCamera){let z=N.cameras;for(let D=0,ge=z.length;D<ge;D++){let Ee=z[D];mf(_,M,Ee,Ee.viewport)}}else mf(_,M,N);w!==null&&(xe.updateMultisampleRenderTarget(w),xe.updateRenderTargetMipmap(w)),M.isScene===!0&&M.onAfterRender(v,M,N),Se.resetDefaultState(),B=-1,j=null,b.pop(),b.length>0?d=b[b.length-1]:d=null,p.pop(),p.length>0?_=p[p.length-1]:_=null};function un(M,N,F,z){if(M.visible===!1)return;if(M.layers.test(N.layers)){if(M.isGroup)F=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(N);else if(M.isLight)d.pushLight(M),M.castShadow&&d.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||Ie.intersectsSprite(M)){z&&ye.setFromMatrixPosition(M.matrixWorld).applyMatrix4(Ae);let Ee=H.update(M),Ce=M.material;Ce.visible&&_.push(M,Ee,Ce,F,ye.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||Ie.intersectsObject(M))){let Ee=H.update(M),Ce=M.material;if(z&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),ye.copy(M.boundingSphere.center)):(Ee.boundingSphere===null&&Ee.computeBoundingSphere(),ye.copy(Ee.boundingSphere.center)),ye.applyMatrix4(M.matrixWorld).applyMatrix4(Ae)),Array.isArray(Ce)){let Pe=Ee.groups;for(let Ve=0,Ne=Pe.length;Ve<Ne;Ve++){let Oe=Pe[Ve],ct=Ce[Oe.materialIndex];ct&&ct.visible&&_.push(M,Ee,ct,F,ye.z,Oe)}}else Ce.visible&&_.push(M,Ee,Ce,F,ye.z,null)}}let ge=M.children;for(let Ee=0,Ce=ge.length;Ee<Ce;Ee++)un(ge[Ee],N,F,z)}function mf(M,N,F,z){let D=M.opaque,ge=M.transmissive,Ee=M.transparent;d.setupLightsView(F),k===!0&&le.setGlobalState(v.clippingPlanes,F),ge.length>0&&Xx(D,ge,N,F),z&&Z.viewport(x.copy(z)),D.length>0&&ws(D,N,F),ge.length>0&&ws(ge,N,F),Ee.length>0&&ws(Ee,N,F),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Xx(M,N,F,z){if((F.isScene===!0?F.overrideMaterial:null)!==null)return;let ge=se.isWebGL2;me===null&&(me=new Fn(1,1,{generateMipmaps:!0,type:Y.has("EXT_color_buffer_half_float")?ps:ii,minFilter:wi,samples:ge?4:0})),v.getDrawingBufferSize(Me),ge?me.setSize(Me.x,Me.y):me.setSize($u(Me.x),$u(Me.y));let Ee=v.getRenderTarget();v.setRenderTarget(me),v.getClearColor(K),C=v.getClearAlpha(),C<1&&v.setClearColor(16777215,.5),v.clear();let Ce=v.toneMapping;v.toneMapping=ni,ws(M,F,z),xe.updateMultisampleRenderTarget(me),xe.updateRenderTargetMipmap(me);let Pe=!1;for(let Ve=0,Ne=N.length;Ve<Ne;Ve++){let Oe=N[Ve],ct=Oe.object,Ft=Oe.geometry,mt=Oe.material,Mn=Oe.group;if(mt.side===Un&&ct.layers.test(z.layers)){let st=mt.side;mt.side=Dt,mt.needsUpdate=!0,gf(ct,F,z,Ft,mt,Mn),mt.side=st,mt.needsUpdate=!0,Pe=!0}}Pe===!0&&(xe.updateMultisampleRenderTarget(me),xe.updateRenderTargetMipmap(me)),v.setRenderTarget(Ee),v.setClearColor(K,C),v.toneMapping=Ce}function ws(M,N,F){let z=N.isScene===!0?N.overrideMaterial:null;for(let D=0,ge=M.length;D<ge;D++){let Ee=M[D],Ce=Ee.object,Pe=Ee.geometry,Ve=z===null?Ee.material:z,Ne=Ee.group;Ce.layers.test(F.layers)&&gf(Ce,N,F,Pe,Ve,Ne)}}function gf(M,N,F,z,D,ge){M.onBeforeRender(v,N,F,z,D,ge),M.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),D.onBeforeRender(v,N,F,z,M,ge),D.transparent===!0&&D.side===Un&&D.forceSinglePass===!1?(D.side=Dt,D.needsUpdate=!0,v.renderBufferDirect(F,N,z,D,M,ge),D.side=si,D.needsUpdate=!0,v.renderBufferDirect(F,N,z,D,M,ge),D.side=Un):v.renderBufferDirect(F,N,z,D,M,ge),M.onAfterRender(v,N,F,z,D,ge)}function Rs(M,N,F){N.isScene!==!0&&(N=ke);let z=pe.get(M),D=d.state.lights,ge=d.state.shadowsArray,Ee=D.state.version,Ce=ee.getParameters(M,D.state,ge,N,F),Pe=ee.getProgramCacheKey(Ce),Ve=z.programs;z.environment=M.isMeshStandardMaterial?N.environment:null,z.fog=N.fog,z.envMap=(M.isMeshStandardMaterial?S:Ge).get(M.envMap||z.environment),z.envMapRotation=z.environment!==null&&M.envMap===null?N.environmentRotation:M.envMapRotation,Ve===void 0&&(M.addEventListener("dispose",O),Ve=new Map,z.programs=Ve);let Ne=Ve.get(Pe);if(Ne!==void 0){if(z.currentProgram===Ne&&z.lightsStateVersion===Ee)return _f(M,Ce),Ne}else Ce.uniforms=ee.getUniforms(M),M.onBuild(F,Ce,v),M.onBeforeCompile(Ce,v),Ne=ee.acquireProgram(Ce,Pe),Ve.set(Pe,Ne),z.uniforms=Ce.uniforms;let Oe=z.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Oe.clippingPlanes=le.uniform),_f(M,Ce),z.needsLights=Zx(M),z.lightsStateVersion=Ee,z.needsLights&&(Oe.ambientLightColor.value=D.state.ambient,Oe.lightProbe.value=D.state.probe,Oe.directionalLights.value=D.state.directional,Oe.directionalLightShadows.value=D.state.directionalShadow,Oe.spotLights.value=D.state.spot,Oe.spotLightShadows.value=D.state.spotShadow,Oe.rectAreaLights.value=D.state.rectArea,Oe.ltc_1.value=D.state.rectAreaLTC1,Oe.ltc_2.value=D.state.rectAreaLTC2,Oe.pointLights.value=D.state.point,Oe.pointLightShadows.value=D.state.pointShadow,Oe.hemisphereLights.value=D.state.hemi,Oe.directionalShadowMap.value=D.state.directionalShadowMap,Oe.directionalShadowMatrix.value=D.state.directionalShadowMatrix,Oe.spotShadowMap.value=D.state.spotShadowMap,Oe.spotLightMatrix.value=D.state.spotLightMatrix,Oe.spotLightMap.value=D.state.spotLightMap,Oe.pointShadowMap.value=D.state.pointShadowMap,Oe.pointShadowMatrix.value=D.state.pointShadowMatrix),z.currentProgram=Ne,z.uniformsList=null,Ne}function vf(M){if(M.uniformsList===null){let N=M.currentProgram.getUniforms();M.uniformsList=br.seqWithValue(N.seq,M.uniforms)}return M.uniformsList}function _f(M,N){let F=pe.get(M);F.outputColorSpace=N.outputColorSpace,F.batching=N.batching,F.instancing=N.instancing,F.instancingColor=N.instancingColor,F.instancingMorph=N.instancingMorph,F.skinning=N.skinning,F.morphTargets=N.morphTargets,F.morphNormals=N.morphNormals,F.morphColors=N.morphColors,F.morphTargetsCount=N.morphTargetsCount,F.numClippingPlanes=N.numClippingPlanes,F.numIntersection=N.numClipIntersection,F.vertexAlphas=N.vertexAlphas,F.vertexTangents=N.vertexTangents,F.toneMapping=N.toneMapping}function Yx(M,N,F,z,D){N.isScene!==!0&&(N=ke),xe.resetTextureUnits();let ge=N.fog,Ee=z.isMeshStandardMaterial?N.environment:null,Ce=w===null?v.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:ci,Pe=(z.isMeshStandardMaterial?S:Ge).get(z.envMap||Ee),Ve=z.vertexColors===!0&&!!F.attributes.color&&F.attributes.color.itemSize===4,Ne=!!F.attributes.tangent&&(!!z.normalMap||z.anisotropy>0),Oe=!!F.morphAttributes.position,ct=!!F.morphAttributes.normal,Ft=!!F.morphAttributes.color,mt=ni;z.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&(mt=v.toneMapping);let Mn=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,st=Mn!==void 0?Mn.length:0,Fe=pe.get(z),Wo=d.state.lights;if(k===!0&&(Q===!0||M!==j)){let Wt=M===j&&z.id===B;le.setState(z,M,Wt)}let nt=!1;z.version===Fe.__version?(Fe.needsLights&&Fe.lightsStateVersion!==Wo.state.version||Fe.outputColorSpace!==Ce||D.isBatchedMesh&&Fe.batching===!1||!D.isBatchedMesh&&Fe.batching===!0||D.isInstancedMesh&&Fe.instancing===!1||!D.isInstancedMesh&&Fe.instancing===!0||D.isSkinnedMesh&&Fe.skinning===!1||!D.isSkinnedMesh&&Fe.skinning===!0||D.isInstancedMesh&&Fe.instancingColor===!0&&D.instanceColor===null||D.isInstancedMesh&&Fe.instancingColor===!1&&D.instanceColor!==null||D.isInstancedMesh&&Fe.instancingMorph===!0&&D.morphTexture===null||D.isInstancedMesh&&Fe.instancingMorph===!1&&D.morphTexture!==null||Fe.envMap!==Pe||z.fog===!0&&Fe.fog!==ge||Fe.numClippingPlanes!==void 0&&(Fe.numClippingPlanes!==le.numPlanes||Fe.numIntersection!==le.numIntersection)||Fe.vertexAlphas!==Ve||Fe.vertexTangents!==Ne||Fe.morphTargets!==Oe||Fe.morphNormals!==ct||Fe.morphColors!==Ft||Fe.toneMapping!==mt||se.isWebGL2===!0&&Fe.morphTargetsCount!==st)&&(nt=!0):(nt=!0,Fe.__version=z.version);let li=Fe.currentProgram;nt===!0&&(li=Rs(z,N,D));let yf=!1,Fr=!1,qo=!1,Mt=li.getUniforms(),ui=Fe.uniforms;if(Z.useProgram(li.program)&&(yf=!0,Fr=!0,qo=!0),z.id!==B&&(B=z.id,Fr=!0),yf||j!==M){Mt.setValue(T,"projectionMatrix",M.projectionMatrix),Mt.setValue(T,"viewMatrix",M.matrixWorldInverse);let Wt=Mt.map.cameraPosition;Wt!==void 0&&Wt.setValue(T,ye.setFromMatrixPosition(M.matrixWorld)),se.logarithmicDepthBuffer&&Mt.setValue(T,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&Mt.setValue(T,"isOrthographic",M.isOrthographicCamera===!0),j!==M&&(j=M,Fr=!0,qo=!0)}if(D.isSkinnedMesh){Mt.setOptional(T,D,"bindMatrix"),Mt.setOptional(T,D,"bindMatrixInverse");let Wt=D.skeleton;Wt&&(se.floatVertexTextures?(Wt.boneTexture===null&&Wt.computeBoneTexture(),Mt.setValue(T,"boneTexture",Wt.boneTexture,xe)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}D.isBatchedMesh&&(Mt.setOptional(T,D,"batchingTexture"),Mt.setValue(T,"batchingTexture",D._matricesTexture,xe));let Xo=F.morphAttributes;if((Xo.position!==void 0||Xo.normal!==void 0||Xo.color!==void 0&&se.isWebGL2===!0)&&ae.update(D,F,li),(Fr||Fe.receiveShadow!==D.receiveShadow)&&(Fe.receiveShadow=D.receiveShadow,Mt.setValue(T,"receiveShadow",D.receiveShadow)),z.isMeshGouraudMaterial&&z.envMap!==null&&(ui.envMap.value=Pe,ui.flipEnvMap.value=Pe.isCubeTexture&&Pe.isRenderTargetTexture===!1?-1:1),Fr&&(Mt.setValue(T,"toneMappingExposure",v.toneMappingExposure),Fe.needsLights&&$x(ui,qo),ge&&z.fog===!0&&J.refreshFogUniforms(ui,ge),J.refreshMaterialUniforms(ui,z,$,G,me),br.upload(T,vf(Fe),ui,xe)),z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(br.upload(T,vf(Fe),ui,xe),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&Mt.setValue(T,"center",D.center),Mt.setValue(T,"modelViewMatrix",D.modelViewMatrix),Mt.setValue(T,"normalMatrix",D.normalMatrix),Mt.setValue(T,"modelMatrix",D.matrixWorld),z.isShaderMaterial||z.isRawShaderMaterial){let Wt=z.uniformsGroups;for(let Yo=0,Jx=Wt.length;Yo<Jx;Yo++)if(se.isWebGL2){let xf=Wt[Yo];be.update(xf,li),be.bind(xf,li)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return li}function $x(M,N){M.ambientLightColor.needsUpdate=N,M.lightProbe.needsUpdate=N,M.directionalLights.needsUpdate=N,M.directionalLightShadows.needsUpdate=N,M.pointLights.needsUpdate=N,M.pointLightShadows.needsUpdate=N,M.spotLights.needsUpdate=N,M.spotLightShadows.needsUpdate=N,M.rectAreaLights.needsUpdate=N,M.hemisphereLights.needsUpdate=N}function Zx(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return I},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(M,N,F){pe.get(M.texture).__webglTexture=N,pe.get(M.depthTexture).__webglTexture=F;let z=pe.get(M);z.__hasExternalTextures=!0,z.__autoAllocateDepthBuffer=F===void 0,z.__autoAllocateDepthBuffer||Y.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),z.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(M,N){let F=pe.get(M);F.__webglFramebuffer=N,F.__useDefaultFramebuffer=N===void 0},this.setRenderTarget=function(M,N=0,F=0){w=M,I=N,R=F;let z=!0,D=null,ge=!1,Ee=!1;if(M){let Pe=pe.get(M);Pe.__useDefaultFramebuffer!==void 0?(Z.bindFramebuffer(T.FRAMEBUFFER,null),z=!1):Pe.__webglFramebuffer===void 0?xe.setupRenderTarget(M):Pe.__hasExternalTextures&&xe.rebindTextures(M,pe.get(M.texture).__webglTexture,pe.get(M.depthTexture).__webglTexture);let Ve=M.texture;(Ve.isData3DTexture||Ve.isDataArrayTexture||Ve.isCompressedArrayTexture)&&(Ee=!0);let Ne=pe.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(Ne[N])?D=Ne[N][F]:D=Ne[N],ge=!0):se.isWebGL2&&M.samples>0&&xe.useMultisampledRTT(M)===!1?D=pe.get(M).__webglMultisampledFramebuffer:Array.isArray(Ne)?D=Ne[F]:D=Ne,x.copy(M.viewport),A.copy(M.scissor),re=M.scissorTest}else x.copy(ne).multiplyScalar($).floor(),A.copy(te).multiplyScalar($).floor(),re=ve;if(Z.bindFramebuffer(T.FRAMEBUFFER,D)&&se.drawBuffers&&z&&Z.drawBuffers(M,D),Z.viewport(x),Z.scissor(A),Z.setScissorTest(re),ge){let Pe=pe.get(M.texture);T.framebufferTexture2D(T.FRAMEBUFFER,T.COLOR_ATTACHMENT0,T.TEXTURE_CUBE_MAP_POSITIVE_X+N,Pe.__webglTexture,F)}else if(Ee){let Pe=pe.get(M.texture),Ve=N||0;T.framebufferTextureLayer(T.FRAMEBUFFER,T.COLOR_ATTACHMENT0,Pe.__webglTexture,F||0,Ve)}B=-1},this.readRenderTargetPixels=function(M,N,F,z,D,ge,Ee){if(!(M&&M.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ce=pe.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&Ee!==void 0&&(Ce=Ce[Ee]),Ce){Z.bindFramebuffer(T.FRAMEBUFFER,Ce);try{let Pe=M.texture,Ve=Pe.format,Ne=Pe.type;if(Ve!==an&&we.convert(Ve)!==T.getParameter(T.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Oe=Ne===ps&&(Y.has("EXT_color_buffer_half_float")||se.isWebGL2&&Y.has("EXT_color_buffer_float"));if(Ne!==ii&&we.convert(Ne)!==T.getParameter(T.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ne===Nn&&(se.isWebGL2||Y.has("OES_texture_float")||Y.has("WEBGL_color_buffer_float")))&&!Oe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}N>=0&&N<=M.width-z&&F>=0&&F<=M.height-D&&T.readPixels(N,F,z,D,we.convert(Ve),we.convert(Ne),ge)}finally{let Pe=w!==null?pe.get(w).__webglFramebuffer:null;Z.bindFramebuffer(T.FRAMEBUFFER,Pe)}}},this.copyFramebufferToTexture=function(M,N,F=0){let z=Math.pow(2,-F),D=Math.floor(N.image.width*z),ge=Math.floor(N.image.height*z);xe.setTexture2D(N,0),T.copyTexSubImage2D(T.TEXTURE_2D,F,0,0,M.x,M.y,D,ge),Z.unbindTexture()},this.copyTextureToTexture=function(M,N,F,z=0){let D=N.image.width,ge=N.image.height,Ee=we.convert(F.format),Ce=we.convert(F.type);xe.setTexture2D(F,0),T.pixelStorei(T.UNPACK_FLIP_Y_WEBGL,F.flipY),T.pixelStorei(T.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),T.pixelStorei(T.UNPACK_ALIGNMENT,F.unpackAlignment),N.isDataTexture?T.texSubImage2D(T.TEXTURE_2D,z,M.x,M.y,D,ge,Ee,Ce,N.image.data):N.isCompressedTexture?T.compressedTexSubImage2D(T.TEXTURE_2D,z,M.x,M.y,N.mipmaps[0].width,N.mipmaps[0].height,Ee,N.mipmaps[0].data):T.texSubImage2D(T.TEXTURE_2D,z,M.x,M.y,Ee,Ce,N.image),z===0&&F.generateMipmaps&&T.generateMipmap(T.TEXTURE_2D),Z.unbindTexture()},this.copyTextureToTexture3D=function(M,N,F,z,D=0){if(v.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let ge=Math.round(M.max.x-M.min.x),Ee=Math.round(M.max.y-M.min.y),Ce=M.max.z-M.min.z+1,Pe=we.convert(z.format),Ve=we.convert(z.type),Ne;if(z.isData3DTexture)xe.setTexture3D(z,0),Ne=T.TEXTURE_3D;else if(z.isDataArrayTexture||z.isCompressedArrayTexture)xe.setTexture2DArray(z,0),Ne=T.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}T.pixelStorei(T.UNPACK_FLIP_Y_WEBGL,z.flipY),T.pixelStorei(T.UNPACK_PREMULTIPLY_ALPHA_WEBGL,z.premultiplyAlpha),T.pixelStorei(T.UNPACK_ALIGNMENT,z.unpackAlignment);let Oe=T.getParameter(T.UNPACK_ROW_LENGTH),ct=T.getParameter(T.UNPACK_IMAGE_HEIGHT),Ft=T.getParameter(T.UNPACK_SKIP_PIXELS),mt=T.getParameter(T.UNPACK_SKIP_ROWS),Mn=T.getParameter(T.UNPACK_SKIP_IMAGES),st=F.isCompressedTexture?F.mipmaps[D]:F.image;T.pixelStorei(T.UNPACK_ROW_LENGTH,st.width),T.pixelStorei(T.UNPACK_IMAGE_HEIGHT,st.height),T.pixelStorei(T.UNPACK_SKIP_PIXELS,M.min.x),T.pixelStorei(T.UNPACK_SKIP_ROWS,M.min.y),T.pixelStorei(T.UNPACK_SKIP_IMAGES,M.min.z),F.isDataTexture||F.isData3DTexture?T.texSubImage3D(Ne,D,N.x,N.y,N.z,ge,Ee,Ce,Pe,Ve,st.data):z.isCompressedArrayTexture?T.compressedTexSubImage3D(Ne,D,N.x,N.y,N.z,ge,Ee,Ce,Pe,st.data):T.texSubImage3D(Ne,D,N.x,N.y,N.z,ge,Ee,Ce,Pe,Ve,st),T.pixelStorei(T.UNPACK_ROW_LENGTH,Oe),T.pixelStorei(T.UNPACK_IMAGE_HEIGHT,ct),T.pixelStorei(T.UNPACK_SKIP_PIXELS,Ft),T.pixelStorei(T.UNPACK_SKIP_ROWS,mt),T.pixelStorei(T.UNPACK_SKIP_IMAGES,Mn),D===0&&z.generateMipmaps&&T.generateMipmap(Ne),Z.unbindTexture()},this.initTexture=function(M){M.isCubeTexture?xe.setTextureCube(M,0):M.isData3DTexture?xe.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?xe.setTexture2DArray(M,0):xe.setTexture2D(M,0),Z.unbindTexture()},this.resetState=function(){I=0,R=0,w=null,Z.reset(),Se.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Dn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===Fh?"display-p3":"srgb",t.unpackColorSpace=Je.workingColorSpace===Lo?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}},dh=class extends fh{};dh.prototype.isWebGL1Renderer=!0;var To=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=qu,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=On()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return cy("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];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=On()),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]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}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=On()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},Pt=new U,vs=class n{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}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,i=this.data.count;t<i;t++)Pt.fromBufferAttribute(this,t),Pt.applyMatrix4(e),this.setXYZ(t,Pt.x,Pt.y,Pt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Pt.fromBufferAttribute(this,t),Pt.applyNormalMatrix(e),this.setXYZ(t,Pt.x,Pt.y,Pt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Pt.fromBufferAttribute(this,t),Pt.transformDirection(e),this.setXYZ(t,Pt.x,Pt.y,Pt.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=yn(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Ze(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=Ze(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ze(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ze(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ze(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=yn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=yn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=yn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=yn(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ze(t,this.array),i=Ze(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ze(t,this.array),i=Ze(i,this.array),r=Ze(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ze(t,this.array),i=Ze(i,this.array),r=Ze(r,this.array),s=Ze(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let i=0;i<this.count;i++){let r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new rt(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 n(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let i=0;i<this.count;i++){let r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+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}}},ph=class extends Ni{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(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}},jn,cs=new U,mr=new U,gr=new U,vr=new ie,ls=new ie,vy=new ft,Ka=new U,us=new U,ja=new U,W0=new ie,Du=new ie,q0=new ie,mh=class extends cn{constructor(e=new ph){if(super(),this.isSprite=!0,this.type="Sprite",jn===void 0){jn=new Ot;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new To(t,5);jn.setIndex([0,1,2,0,2,3]),jn.setAttribute("position",new vs(i,3,0,!1)),jn.setAttribute("uv",new vs(i,2,3,!1))}this.geometry=jn,this.material=e,this.center=new ie(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),mr.setFromMatrixScale(this.matrixWorld),vy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),gr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&mr.multiplyScalar(-gr.z);let i=this.material.rotation,r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));let o=this.center;Qa(Ka.set(-.5,-.5,0),gr,o,mr,r,s),Qa(us.set(.5,-.5,0),gr,o,mr,r,s),Qa(ja.set(.5,.5,0),gr,o,mr,r,s),W0.set(0,0),Du.set(1,0),q0.set(1,1);let a=e.ray.intersectTriangle(Ka,us,ja,!1,cs);if(a===null&&(Qa(us.set(-.5,.5,0),gr,o,mr,r,s),Du.set(0,1),a=e.ray.intersectTriangle(Ka,ja,us,!1,cs),a===null))return;let c=e.ray.origin.distanceTo(cs);c<e.near||c>e.far||t.push({distance:c,point:cs.clone(),uv:Ri.getInterpolation(cs,Ka,us,ja,W0,Du,q0,new ie),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};mh.Dispose=function(){jn.dispose(),jn=void 0};function Qa(n,e,t,i,r,s){vr.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(ls.x=s*vr.x-r*vr.y,ls.y=r*vr.x+s*vr.y):ls.copy(vr),n.copy(e),n.x+=ls.x,n.y+=ls.y,n.applyMatrix4(vy)}var Zt=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/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=[],i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i=this.getLengths(),r=0,s=i.length,o;t?o=t:o=e*i[s-1];let a=0,c=s-1,l;for(;a<=c;)if(r=Math.floor(a+(c-a)/2),l=i[r]-o,l<0)a=r+1;else if(l>0)c=r-1;else{c=r;break}if(r=c,i[r]===o)return r/(s-1);let u=i[r],f=i[r+1]-u,m=(o-u)/f;return(r+m)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);let o=this.getPoint(r),a=this.getPoint(s),c=t||(o.isVector2?new ie:new U);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new U,r=[],s=[],o=[],a=new U,c=new ft;for(let m=0;m<=e;m++){let g=m/e;r[m]=this.getTangentAt(g,new U)}s[0]=new U,o[0]=new U;let l=Number.MAX_VALUE,u=Math.abs(r[0].x),h=Math.abs(r[0].y),f=Math.abs(r[0].z);u<=l&&(l=u,i.set(1,0,0)),h<=l&&(l=h,i.set(0,1,0)),f<=l&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),o[m]=o[m-1].clone(),a.crossVectors(r[m-1],r[m]),a.length()>Number.EPSILON){a.normalize();let g=Math.acos(At(r[m-1].dot(r[m]),-1,1));s[m].applyMatrix4(c.makeRotationAxis(a,g))}o[m].crossVectors(r[m],s[m])}if(t===!0){let m=Math.acos(At(s[0].dot(s[e]),-1,1));m/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(m=-m);for(let g=1;g<=e;g++)s[g].applyMatrix4(c.makeRotationAxis(r[g],m*g)),o[g].crossVectors(r[g],s[g])}return{tangents:r,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.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},_s=class extends Zt{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t=new ie){let i=t,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);let a=this.aStartAngle+e*s,c=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),f=c-this.aX,m=l-this.aY;c=f*u-m*h+this.aX,l=f*h+m*u+this.aY}return i.set(c,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){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}},gh=class extends _s{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function zh(){let n=0,e=0,t=0,i=0;function r(s,o,a,c){n=s,e=a,t=-3*s+3*o-2*a-c,i=2*s-2*o+a+c}return{initCatmullRom:function(s,o,a,c,l){r(o,a,l*(a-s),l*(c-o))},initNonuniformCatmullRom:function(s,o,a,c,l,u,h){let f=(o-s)/l-(a-s)/(l+u)+(a-o)/u,m=(a-o)/u-(c-o)/(u+h)+(c-a)/h;f*=u,m*=u,r(o,a,f,m)},calc:function(s){let o=s*s,a=o*s;return n+e*s+t*o+i*a}}}var eo=new U,Ou=new zh,Fu=new zh,Bu=new zh,vh=class extends Zt{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new U){let i=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),c=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:c===0&&a===s-1&&(a=s-2,c=1);let l,u;this.closed||a>0?l=r[(a-1)%s]:(eo.subVectors(r[0],r[1]).add(r[0]),l=eo);let h=r[a%s],f=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(eo.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=eo),this.curveType==="centripetal"||this.curveType==="chordal"){let m=this.curveType==="chordal"?.5:.25,g=Math.pow(l.distanceToSquared(h),m),_=Math.pow(h.distanceToSquared(f),m),d=Math.pow(f.distanceToSquared(u),m);_<1e-4&&(_=1),g<1e-4&&(g=_),d<1e-4&&(d=_),Ou.initNonuniformCatmullRom(l.x,h.x,f.x,u.x,g,_,d),Fu.initNonuniformCatmullRom(l.y,h.y,f.y,u.y,g,_,d),Bu.initNonuniformCatmullRom(l.z,h.z,f.z,u.z,g,_,d)}else this.curveType==="catmullrom"&&(Ou.initCatmullRom(l.x,h.x,f.x,u.x,this.tension),Fu.initCatmullRom(l.y,h.y,f.y,u.y,this.tension),Bu.initCatmullRom(l.z,h.z,f.z,u.z,this.tension));return i.set(Ou.calc(c),Fu.calc(c),Bu.calc(c)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(r.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,i=this.points.length;t<i;t++){let r=this.points[t];e.points.push(r.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,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(new U().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function X0(n,e,t,i,r){let s=(i-e)*.5,o=(r-t)*.5,a=n*n,c=n*a;return(2*t-2*i+s+o)*c+(-3*t+3*i-2*s-o)*a+s*n+t}function aN(n,e){let t=1-n;return t*t*e}function oN(n,e){return 2*(1-n)*n*e}function cN(n,e){return n*n*e}function fs(n,e,t,i){return aN(n,e)+oN(n,t)+cN(n,i)}function lN(n,e){let t=1-n;return t*t*t*e}function uN(n,e){let t=1-n;return 3*t*t*n*e}function hN(n,e){return 3*(1-n)*n*n*e}function fN(n,e){return n*n*n*e}function ds(n,e,t,i,r){return lN(n,e)+uN(n,t)+hN(n,i)+fN(n,r)}var wo=class extends Zt{constructor(e=new ie,t=new ie,i=new ie,r=new ie){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new ie){let i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(ds(e,r.x,s.x,o.x,a.x),ds(e,r.y,s.y,o.y,a.y)),i}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}},_h=class extends Zt{constructor(e=new U,t=new U,i=new U,r=new U){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new U){let i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(ds(e,r.x,s.x,o.x,a.x),ds(e,r.y,s.y,o.y,a.y),ds(e,r.z,s.z,o.z,a.z)),i}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}},Ro=class extends Zt{constructor(e=new ie,t=new ie){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ie){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ie){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){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}},yh=class extends Zt{constructor(e=new U,t=new U){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new U){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new U){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){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}},Co=class extends Zt{constructor(e=new ie,t=new ie,i=new ie){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new ie){let i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(fs(e,r.x,s.x,o.x),fs(e,r.y,s.y,o.y)),i}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}},xh=class extends Zt{constructor(e=new U,t=new U,i=new U){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new U){let i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(fs(e,r.x,s.x,o.x),fs(e,r.y,s.y,o.y),fs(e,r.z,s.z,o.z)),i}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}},Po=class extends Zt{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ie){let i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,c=r[o===0?o:o-1],l=r[o],u=r[o>r.length-2?r.length-1:o+1],h=r[o>r.length-3?r.length-1:o+2];return i.set(X0(a,c.x,l.x,u.x,h.x),X0(a,c.y,l.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(new ie().fromArray(r))}return this}},Mh=Object.freeze({__proto__:null,ArcCurve:gh,CatmullRomCurve3:vh,CubicBezierCurve:wo,CubicBezierCurve3:_h,EllipseCurve:_s,LineCurve:Ro,LineCurve3:yh,QuadraticBezierCurve:Co,QuadraticBezierCurve3:xh,SplineCurve:Po}),Sh=class extends Zt{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);if(!e.equals(t)){let i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Mh[i](t,e))}return this}getPoint(e,t){let i=e*this.getLength(),r=this.getCurveLengths(),s=0;for(;s<r.length;){if(r[s]>=i){let o=r[s]-i,a=this.curves[s],c=a.getLength(),l=c===0?0:1-o/c;return a.getPointAt(l,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 i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],i;for(let r=0,s=this.curves;r<s.length;r++){let o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,c=o.getPoints(a);for(let l=0;l<c.length;l++){let u=c[l];i&&i.equals(u)||(t.push(u),i=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let r=e.curves[t];this.curves.push(new Mh[r.type]().fromJSON(r))}return this}},Rr=class extends Sh{constructor(e){super(),this.type="Path",this.currentPoint=new ie,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;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 i=new Ro(this.currentPoint.clone(),new ie(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){let s=new Co(this.currentPoint.clone(),new ie(e,t),new ie(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){let a=new wo(this.currentPoint.clone(),new ie(e,t),new ie(i,r),new ie(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),i=new Po(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){let a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,a,c){let l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,i,r,s,o,a,c),this}absellipse(e,t,i,r,s,o,a,c){let l=new _s(e,t,i,r,s,o,a,c);if(this.curves.length>0){let h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);let u=l.getPoint(1);return this.currentPoint.copy(u),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}};var Cr=class extends Rr{constructor(e){super(e),this.uuid=On(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].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,i=e.holes.length;t<i;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let r=e.holes[t];this.holes.push(new Rr().fromJSON(r))}return this}},dN={triangulate:function(n,e,t=2){let i=e&&e.length,r=i?e[0]*t:n.length,s=_y(n,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,c,l,u,h,f,m;if(i&&(s=_N(n,e,s,t)),n.length>80*t){a=l=n[0],c=u=n[1];for(let g=t;g<r;g+=t)h=n[g],f=n[g+1],h<a&&(a=h),f<c&&(c=f),h>l&&(l=h),f>u&&(u=f);m=Math.max(l-a,u-c),m=m!==0?32767/m:0}return ys(s,o,t,a,c,m,0),o}};function _y(n,e,t,i,r){let s,o;if(r===CN(n,e,t,i)>0)for(s=e;s<t;s+=i)o=Y0(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=Y0(s,n[s],n[s+1],o);return o&&No(o,o.next)&&(Ms(o),o=o.next),o}function Di(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(No(t,t.next)||ot(t.prev,t,t.next)===0)){if(Ms(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function ys(n,e,t,i,r,s,o){if(!n)return;!o&&s&&bN(n,i,r,s);let a=n,c,l;for(;n.prev!==n.next;){if(c=n.prev,l=n.next,s?mN(n,i,r,s):pN(n)){e.push(c.i/t|0),e.push(n.i/t|0),e.push(l.i/t|0),Ms(n),n=l.next,a=l.next;continue}if(n=l,n===a){o?o===1?(n=gN(Di(n),e,t),ys(n,e,t,i,r,s,2)):o===2&&vN(n,e,t,i,r,s):ys(Di(n),e,t,i,r,s,1);break}}}function pN(n){let e=n.prev,t=n,i=n.next;if(ot(e,t,i)>=0)return!1;let r=e.x,s=t.x,o=i.x,a=e.y,c=t.y,l=i.y,u=r<s?r<o?r:o:s<o?s:o,h=a<c?a<l?a:l:c<l?c:l,f=r>s?r>o?r:o:s>o?s:o,m=a>c?a>l?a:l:c>l?c:l,g=i.next;for(;g!==e;){if(g.x>=u&&g.x<=f&&g.y>=h&&g.y<=m&&xr(r,a,s,c,o,l,g.x,g.y)&&ot(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function mN(n,e,t,i){let r=n.prev,s=n,o=n.next;if(ot(r,s,o)>=0)return!1;let a=r.x,c=s.x,l=o.x,u=r.y,h=s.y,f=o.y,m=a<c?a<l?a:l:c<l?c:l,g=u<h?u<f?u:f:h<f?h:f,_=a>c?a>l?a:l:c>l?c:l,d=u>h?u>f?u:f:h>f?h:f,p=bh(m,g,e,t,i),b=bh(_,d,e,t,i),v=n.prevZ,E=n.nextZ;for(;v&&v.z>=p&&E&&E.z<=b;){if(v.x>=m&&v.x<=_&&v.y>=g&&v.y<=d&&v!==r&&v!==o&&xr(a,u,c,h,l,f,v.x,v.y)&&ot(v.prev,v,v.next)>=0||(v=v.prevZ,E.x>=m&&E.x<=_&&E.y>=g&&E.y<=d&&E!==r&&E!==o&&xr(a,u,c,h,l,f,E.x,E.y)&&ot(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;v&&v.z>=p;){if(v.x>=m&&v.x<=_&&v.y>=g&&v.y<=d&&v!==r&&v!==o&&xr(a,u,c,h,l,f,v.x,v.y)&&ot(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;E&&E.z<=b;){if(E.x>=m&&E.x<=_&&E.y>=g&&E.y<=d&&E!==r&&E!==o&&xr(a,u,c,h,l,f,E.x,E.y)&&ot(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function gN(n,e,t){let i=n;do{let r=i.prev,s=i.next.next;!No(r,s)&&yy(r,i,i.next,s)&&xs(r,s)&&xs(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Ms(i),Ms(i.next),i=n=s),i=i.next}while(i!==n);return Di(i)}function vN(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&TN(o,a)){let c=xy(o,a);o=Di(o,o.next),c=Di(c,c.next),ys(o,e,t,i,r,s,0),ys(c,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function _N(n,e,t,i){let r=[],s,o,a,c,l;for(s=0,o=e.length;s<o;s++)a=e[s]*i,c=s<o-1?e[s+1]*i:n.length,l=_y(n,a,c,i,!1),l===l.next&&(l.steiner=!0),r.push(AN(l));for(r.sort(yN),s=0;s<r.length;s++)t=xN(r[s],t);return t}function yN(n,e){return n.x-e.x}function xN(n,e){let t=MN(n,e);if(!t)return e;let i=xy(t,n);return Di(i,i.next),Di(t,t.next)}function MN(n,e){let t=e,i=-1/0,r,s=n.x,o=n.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){let f=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>i&&(i=f,r=t.x<t.next.x?t:t.next,f===s))return r}t=t.next}while(t!==e);if(!r)return null;let a=r,c=r.x,l=r.y,u=1/0,h;t=r;do s>=t.x&&t.x>=c&&s!==t.x&&xr(o<l?s:i,o,c,l,o<l?i:s,o,t.x,t.y)&&(h=Math.abs(o-t.y)/(s-t.x),xs(t,n)&&(h<u||h===u&&(t.x>r.x||t.x===r.x&&SN(r,t)))&&(r=t,u=h)),t=t.next;while(t!==a);return r}function SN(n,e){return ot(n.prev,n,e.prev)<0&&ot(e.next,n,n.next)<0}function bN(n,e,t,i){let r=n;do r.z===0&&(r.z=bh(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,EN(r)}function EN(n){let e,t,i,r,s,o,a,c,l=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<l&&(a++,i=i.nextZ,!!i);e++);for(c=l;a>0||c>0&&i;)a!==0&&(c===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,c--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,l*=2}while(o>1);return n}function bh(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function AN(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function xr(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function TN(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!wN(n,e)&&(xs(n,e)&&xs(e,n)&&RN(n,e)&&(ot(n.prev,n,e.prev)||ot(n,e.prev,e))||No(n,e)&&ot(n.prev,n,n.next)>0&&ot(e.prev,e,e.next)>0)}function ot(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function No(n,e){return n.x===e.x&&n.y===e.y}function yy(n,e,t,i){let r=no(ot(n,e,t)),s=no(ot(n,e,i)),o=no(ot(t,i,n)),a=no(ot(t,i,e));return!!(r!==s&&o!==a||r===0&&to(n,t,e)||s===0&&to(n,i,e)||o===0&&to(t,n,i)||a===0&&to(t,e,i))}function to(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function no(n){return n>0?1:n<0?-1:0}function wN(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&yy(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function xs(n,e){return ot(n.prev,n,n.next)<0?ot(n,e,n.next)>=0&&ot(n,n.prev,e)>=0:ot(n,e,n.prev)<0||ot(n,n.next,e)<0}function RN(n,e){let t=n,i=!1,r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function xy(n,e){let t=new Eh(n.i,n.x,n.y),i=new Eh(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function Y0(n,e,t,i){let r=new Eh(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Ms(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Eh(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function CN(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}var ri=class n{static area(e){let t=e.length,i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return n.area(e)<0}static triangulateShape(e,t){let i=[],r=[],s=[];$0(e),Z0(i,e);let o=e.length;t.forEach($0);for(let c=0;c<t.length;c++)r.push(o),o+=t[c].length,Z0(i,t[c]);let a=dN.triangulate(i,r);for(let c=0;c<a.length;c+=3)s.push(a.slice(c,c+3));return s}};function $0(n){let e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function Z0(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}var Pr=class n extends Ot{constructor(e=new Cr([new ie(.5,.5),new ie(-.5,.5),new ie(-.5,-.5),new ie(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let i=this,r=[],s=[];for(let a=0,c=e.length;a<c;a++){let l=e[a];o(l)}this.setAttribute("position",new xt(r,3)),this.setAttribute("uv",new xt(s,2)),this.computeVertexNormals();function o(a){let c=[],l=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1,f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,m=t.bevelThickness!==void 0?t.bevelThickness:.2,g=t.bevelSize!==void 0?t.bevelSize:m-.1,_=t.bevelOffset!==void 0?t.bevelOffset:0,d=t.bevelSegments!==void 0?t.bevelSegments:3,p=t.extrudePath,b=t.UVGenerator!==void 0?t.UVGenerator:PN,v,E=!1,I,R,w,B;p&&(v=p.getSpacedPoints(u),E=!0,f=!1,I=p.computeFrenetFrames(u,!1),R=new U,w=new U,B=new U),f||(d=0,m=0,g=0,_=0);let j=a.extractPoints(l),x=j.shape,A=j.holes;if(!ri.isClockWise(x)){x=x.reverse();for(let T=0,oe=A.length;T<oe;T++){let Y=A[T];ri.isClockWise(Y)&&(A[T]=Y.reverse())}}let K=ri.triangulateShape(x,A),C=x;for(let T=0,oe=A.length;T<oe;T++){let Y=A[T];x=x.concat(Y)}function W(T,oe,Y){return oe||console.error("THREE.ExtrudeGeometry: vec does not exist"),T.clone().addScaledVector(oe,Y)}let G=x.length,$=K.length;function q(T,oe,Y){let se,Z,_e,pe=T.x-oe.x,xe=T.y-oe.y,Ge=Y.x-T.x,S=Y.y-T.y,y=pe*pe+xe*xe,V=pe*S-xe*Ge;if(Math.abs(V)>Number.EPSILON){let H=Math.sqrt(y),ee=Math.sqrt(Ge*Ge+S*S),J=oe.x-xe/H,Le=oe.y+pe/H,Re=Y.x-S/ee,le=Y.y+Ge/ee,he=((Re-J)*S-(le-Le)*Ge)/(pe*S-xe*Ge);se=J+pe*he-T.x,Z=Le+xe*he-T.y;let Ue=se*se+Z*Z;if(Ue<=2)return new ie(se,Z);_e=Math.sqrt(Ue/2)}else{let H=!1;pe>Number.EPSILON?Ge>Number.EPSILON&&(H=!0):pe<-Number.EPSILON?Ge<-Number.EPSILON&&(H=!0):Math.sign(xe)===Math.sign(S)&&(H=!0),H?(se=-xe,Z=pe,_e=Math.sqrt(y)):(se=pe,Z=xe,_e=Math.sqrt(y/2))}return new ie(se/_e,Z/_e)}let X=[];for(let T=0,oe=C.length,Y=oe-1,se=T+1;T<oe;T++,Y++,se++)Y===oe&&(Y=0),se===oe&&(se=0),X[T]=q(C[T],C[Y],C[se]);let ne=[],te,ve=X.concat();for(let T=0,oe=A.length;T<oe;T++){let Y=A[T];te=[];for(let se=0,Z=Y.length,_e=Z-1,pe=se+1;se<Z;se++,_e++,pe++)_e===Z&&(_e=0),pe===Z&&(pe=0),te[se]=q(Y[se],Y[_e],Y[pe]);ne.push(te),ve=ve.concat(te)}for(let T=0;T<d;T++){let oe=T/d,Y=m*Math.cos(oe*Math.PI/2),se=g*Math.sin(oe*Math.PI/2)+_;for(let Z=0,_e=C.length;Z<_e;Z++){let pe=W(C[Z],X[Z],se);Ae(pe.x,pe.y,-Y)}for(let Z=0,_e=A.length;Z<_e;Z++){let pe=A[Z];te=ne[Z];for(let xe=0,Ge=pe.length;xe<Ge;xe++){let S=W(pe[xe],te[xe],se);Ae(S.x,S.y,-Y)}}}let Ie=g+_;for(let T=0;T<G;T++){let oe=f?W(x[T],ve[T],Ie):x[T];E?(w.copy(I.normals[0]).multiplyScalar(oe.x),R.copy(I.binormals[0]).multiplyScalar(oe.y),B.copy(v[0]).add(w).add(R),Ae(B.x,B.y,B.z)):Ae(oe.x,oe.y,0)}for(let T=1;T<=u;T++)for(let oe=0;oe<G;oe++){let Y=f?W(x[oe],ve[oe],Ie):x[oe];E?(w.copy(I.normals[T]).multiplyScalar(Y.x),R.copy(I.binormals[T]).multiplyScalar(Y.y),B.copy(v[T]).add(w).add(R),Ae(B.x,B.y,B.z)):Ae(Y.x,Y.y,h/u*T)}for(let T=d-1;T>=0;T--){let oe=T/d,Y=m*Math.cos(oe*Math.PI/2),se=g*Math.sin(oe*Math.PI/2)+_;for(let Z=0,_e=C.length;Z<_e;Z++){let pe=W(C[Z],X[Z],se);Ae(pe.x,pe.y,h+Y)}for(let Z=0,_e=A.length;Z<_e;Z++){let pe=A[Z];te=ne[Z];for(let xe=0,Ge=pe.length;xe<Ge;xe++){let S=W(pe[xe],te[xe],se);E?Ae(S.x,S.y+v[u-1].y,v[u-1].x+Y):Ae(S.x,S.y,h+Y)}}}k(),Q();function k(){let T=r.length/3;if(f){let oe=0,Y=G*oe;for(let se=0;se<$;se++){let Z=K[se];Me(Z[2]+Y,Z[1]+Y,Z[0]+Y)}oe=u+d*2,Y=G*oe;for(let se=0;se<$;se++){let Z=K[se];Me(Z[0]+Y,Z[1]+Y,Z[2]+Y)}}else{for(let oe=0;oe<$;oe++){let Y=K[oe];Me(Y[2],Y[1],Y[0])}for(let oe=0;oe<$;oe++){let Y=K[oe];Me(Y[0]+G*u,Y[1]+G*u,Y[2]+G*u)}}i.addGroup(T,r.length/3-T,0)}function Q(){let T=r.length/3,oe=0;me(C,oe),oe+=C.length;for(let Y=0,se=A.length;Y<se;Y++){let Z=A[Y];me(Z,oe),oe+=Z.length}i.addGroup(T,r.length/3-T,1)}function me(T,oe){let Y=T.length;for(;--Y>=0;){let se=Y,Z=Y-1;Z<0&&(Z=T.length-1);for(let _e=0,pe=u+d*2;_e<pe;_e++){let xe=G*_e,Ge=G*(_e+1),S=oe+se+xe,y=oe+Z+xe,V=oe+Z+Ge,H=oe+se+Ge;ye(S,y,V,H)}}}function Ae(T,oe,Y){c.push(T),c.push(oe),c.push(Y)}function Me(T,oe,Y){ke(T),ke(oe),ke(Y);let se=r.length/3,Z=b.generateTopUV(i,r,se-3,se-2,se-1);Te(Z[0]),Te(Z[1]),Te(Z[2])}function ye(T,oe,Y,se){ke(T),ke(oe),ke(se),ke(oe),ke(Y),ke(se);let Z=r.length/3,_e=b.generateSideWallUV(i,r,Z-6,Z-3,Z-2,Z-1);Te(_e[0]),Te(_e[1]),Te(_e[3]),Te(_e[1]),Te(_e[2]),Te(_e[3])}function ke(T){r.push(c[T*3+0]),r.push(c[T*3+1]),r.push(c[T*3+2])}function Te(T){s.push(T.x),s.push(T.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return IN(t,i,e)}static fromJSON(e,t){let i=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];i.push(a)}let r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new Mh[r.type]().fromJSON(r)),new n(i,e.options)}},PN={generateTopUV:function(n,e,t,i,r){let s=e[t*3],o=e[t*3+1],a=e[i*3],c=e[i*3+1],l=e[r*3],u=e[r*3+1];return[new ie(s,o),new ie(a,c),new ie(l,u)]},generateSideWallUV:function(n,e,t,i,r,s){let o=e[t*3],a=e[t*3+1],c=e[t*3+2],l=e[i*3],u=e[i*3+1],h=e[i*3+2],f=e[r*3],m=e[r*3+1],g=e[r*3+2],_=e[s*3],d=e[s*3+1],p=e[s*3+2];return Math.abs(a-u)<Math.abs(o-l)?[new ie(o,1-c),new ie(l,1-h),new ie(f,1-g),new ie(_,1-p)]:[new ie(a,1-c),new ie(u,1-h),new ie(m,1-g),new ie(d,1-p)]}};function IN(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){let s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var Ss=class n extends Ot{constructor(e=new Cr([new ie(0,.5),new ie(-.5,-.5),new ie(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let i=[],r=[],s=[],o=[],a=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let u=0;u<e.length;u++)l(e[u]),this.addGroup(a,c,u),a+=c,c=0;this.setIndex(i),this.setAttribute("position",new xt(r,3)),this.setAttribute("normal",new xt(s,3)),this.setAttribute("uv",new xt(o,2));function l(u){let h=r.length/3,f=u.extractPoints(t),m=f.shape,g=f.holes;ri.isClockWise(m)===!1&&(m=m.reverse());for(let d=0,p=g.length;d<p;d++){let b=g[d];ri.isClockWise(b)===!0&&(g[d]=b.reverse())}let _=ri.triangulateShape(m,g);for(let d=0,p=g.length;d<p;d++){let b=g[d];m=m.concat(b)}for(let d=0,p=m.length;d<p;d++){let b=m[d];r.push(b.x,b.y,0),s.push(0,0,1),o.push(b.x,b.y)}for(let d=0,p=_.length;d<p;d++){let b=_[d],v=b[0]+h,E=b[1]+h,I=b[2]+h;i.push(v,E,I),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return LN(t,e)}static fromJSON(e,t){let i=[];for(let r=0,s=e.shapes.length;r<s;r++){let o=t[e.shapes[r]];i.push(o)}return new n(i,e.curveSegments)}};function LN(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){let r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}function io(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function UN(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var Ir=class{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,r=t[i],s=t[i-1];n:{e:{let o;t:{i:if(!(e<r)){for(let a=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(s=r,r=t[++i],e<r)break e}o=t.length;break t}if(!(e>=s)){let a=t[1];e<a&&(i=2,s=a);for(let c=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===c)break;if(r=s,s=t[--i-1],e>=s)break e}o=i,i=0;break t}break n}for(;i<o;){let a=i+o>>>1;e<t[a]?o=a:i=a+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=i[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Ah=class extends Ir{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Q_,endingEnd:Q_}}intervalChanged_(e,t,i){let r=this.parameterPositions,s=e-2,o=e+1,a=r[s],c=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case e0:s=e,a=2*t-i;break;case t0:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=i}if(c===void 0)switch(this.getSettings_().endingEnd){case e0:o=e,c=2*i-t;break;case t0:o=1,c=i+r[1]-r[0];break;default:o=e-1,c=t}let l=(i-t)*.5,u=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(c-i),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,i,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,m=this._weightNext,g=(i-t)/(r-t),_=g*g,d=_*g,p=-f*d+2*f*_-f*g,b=(1+f)*d+(-1.5-2*f)*_+(-.5+f)*g+1,v=(-1-m)*d+(1.5+m)*_+.5*g,E=m*d-m*_;for(let I=0;I!==a;++I)s[I]=p*o[u+I]+b*o[l+I]+v*o[c+I]+E*o[h+I];return s}},Th=class extends Ir{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=(i-t)/(r-t),h=1-u;for(let f=0;f!==a;++f)s[f]=o[l+f]*h+o[c+f]*u;return s}},wh=class extends Ir{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}},ln=class{constructor(e,t,i,r){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=io(t,this.TimeBufferType),this.values=io(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:io(e.times,Array),values:io(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new wh(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Th(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Ah(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case so:t=this.InterpolantFactoryMethodDiscrete;break;case ao:t=this.InterpolantFactoryMethodLinear;break;case cu:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let i="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(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return so;case this.InterpolantFactoryMethodLinear:return ao;case this.InterpolantFactoryMethodSmooth:return cu}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){let i=this.times,r=i.length,s=0,o=r-1;for(;s!==r&&i[s]<e;)++s;for(;o!==-1&&i[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(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 i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let c=i[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(r!==void 0&&UN(r))for(let a=0,c=r.length;a!==c;++a){let l=r[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===cu,s=e.length-1,o=1;for(let a=1;a<s;++a){let c=!1,l=e[a],u=e[a+1];if(l!==u&&(a!==1||l!==e[0]))if(r)c=!0;else{let h=a*i,f=h-i,m=h+i;for(let g=0;g!==i;++g){let _=t[h+g];if(_!==t[f+g]||_!==t[m+g]){c=!0;break}}}if(c){if(a!==o){e[o]=e[a];let h=a*i,f=o*i;for(let m=0;m!==i;++m)t[f+m]=t[h+m]}++o}}if(s>0){e[o]=e[s];for(let a=s*i,c=o*i,l=0;l!==i;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};ln.prototype.TimeBufferType=Float32Array;ln.prototype.ValueBufferType=Float32Array;ln.prototype.DefaultInterpolation=ao;var Oi=class extends ln{};Oi.prototype.ValueTypeName="bool";Oi.prototype.ValueBufferType=Array;Oi.prototype.DefaultInterpolation=so;Oi.prototype.InterpolantFactoryMethodLinear=void 0;Oi.prototype.InterpolantFactoryMethodSmooth=void 0;var Rh=class extends ln{};Rh.prototype.ValueTypeName="color";var Ch=class extends ln{};Ch.prototype.ValueTypeName="number";var Ph=class extends Ir{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(i-t)/(r-t),l=e*a;for(let u=l+a;l!==u;l+=4)oi.slerpFlat(s,0,o,l-a,o,l,c);return s}},bs=class extends ln{InterpolantFactoryMethodLinear(e){return new Ph(this.times,this.values,this.getValueSize(),e)}};bs.prototype.ValueTypeName="quaternion";bs.prototype.DefaultInterpolation=ao;bs.prototype.InterpolantFactoryMethodSmooth=void 0;var Fi=class extends ln{};Fi.prototype.ValueTypeName="string";Fi.prototype.ValueBufferType=Array;Fi.prototype.DefaultInterpolation=so;Fi.prototype.InterpolantFactoryMethodLinear=void 0;Fi.prototype.InterpolantFactoryMethodSmooth=void 0;var Ih=class extends ln{};Ih.prototype.ValueTypeName="vector";var Lh=class{constructor(e,t,i){let r=this,s=!1,o=0,a=0,c,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return c?c(u):u},this.setURLModifier=function(u){return c=u,this},this.addHandler=function(u,h){return l.push(u,h),this},this.removeHandler=function(u){let h=l.indexOf(u);return h!==-1&&l.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=l.length;h<f;h+=2){let m=l[h],g=l[h+1];if(m.global&&(m.lastIndex=0),m.test(u))return g}return null}}},NN=new Lh,Uh=class{constructor(e){this.manager=e!==void 0?e:NN,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let i=this;return new Promise(function(r,s){i.load(e,r,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}};Uh.DEFAULT_MATERIAL_NAME="__DEFAULT";var kh="\\\\[\\\\]\\\\.:\\\\/",DN=new RegExp("["+kh+"]","g"),Vh="[^"+kh+"]",ON="[^"+kh.replace("\\\\.","")+"]",FN=/((?:WC+[\\/:])*)/.source.replace("WC",Vh),BN=/(WCOD+)?/.source.replace("WCOD",ON),zN=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Vh),kN=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Vh),VN=new RegExp("^"+FN+BN+zN+kN+"$"),GN=["material","materials","bones","map"],Nh=class{constructor(e,t,i){let r=i||it.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},it=class n{constructor(e,t,i){this.path=t,this.parsedPath=i||n.parseTrackName(t),this.node=n.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new n.Composite(e,t,i):new n(e,t,i)}static sanitizeNodeName(e){return e.replace(/\\s/g,"_").replace(DN,"")}static parseTrackName(e){let t=VN.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=i.nodeName.substring(r+1);GN.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){let i=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let c=i(a.children);if(c)return c}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_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 i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=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,i=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=n.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let l=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===l){l=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}let o=e[r];if(o===void 0){let l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};it.Composite=Nh;it.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};it.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};it.prototype.GetterByBindingType=[it.prototype._getValue_direct,it.prototype._getValue_array,it.prototype._getValue_arrayElement,it.prototype._getValue_toArray];it.prototype.SetterByBindingTypeAndVersioning=[[it.prototype._setValue_direct,it.prototype._setValue_direct_setNeedsUpdate,it.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[it.prototype._setValue_array,it.prototype._setValue_array_setNeedsUpdate,it.prototype._setValue_array_setMatrixWorldNeedsUpdate],[it.prototype._setValue_arrayElement,it.prototype._setValue_arrayElement_setNeedsUpdate,it.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[it.prototype._setValue_fromArray,it.prototype._setValue_fromArray_setNeedsUpdate,it.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var ZB=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Dh}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Dh);var uz=We(nx(),1),hz=We(ta(),1);function Ur(n,e){e===void 0&&(e=[]);let t=new Cr(n.map(i=>new ie(...i)));return e.length&&e.forEach(i=>{var r=new Rr(i.map(s=>new ie(...s)));t.holes.push(r)}),t}var Pz=We(Vx(),1),Iz=We(of(),1);function Gx(n){return n.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function Hx(n){let e={};for(let i in n)i.startsWith("on")&&(e[Gx(i.slice(2))]=n[i]);let t=i=>Cs(this,null,function*(){let{data:r}=i;if(e[r.type])try{let s=yield e[r.type](r.data);if(s!=null&&s.$transfer&&Array.isArray(s.$transfer)){let o=s.$transfer;delete s.$transfer,self.postMessage({type:""+r.type+"_result",key:r.key,data:s},o)}else self.postMessage({type:""+r.type+"_result",key:r.key,data:s})}catch(s){self.postMessage({type:""+r.type+"_result",key:r.key,error:s})}else self.postMessage({type:""+r.type+"_result",key:r.key,error:"no_event"})});return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var Gz=We(dl(),1),Hz=We(pl(),1),Wz=We(ml(),1),qz=We(vl(),1),Xz=We(_l(),1),Yz=We(Sl(),1),$z=We(Al(),1),Zz=We(wl(),1),Jz=We(Rl(),1),Kz=We(Pl(),1),jz=We(Ll(),1),Qz=We(Ol(),1),ek=We(zl(),1),tk=We(eu(),1),nk=We(tu(),1),ik=We(ta(),1);function Or(n,e=!1){let t=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),r=new Set(Object.keys(n[0].morphAttributes)),s={},o={},a=n[0].morphTargetsRelative,c=new Ot,l=0;for(let u=0;u<n.length;++u){let h=n[u],f=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let m in h.attributes){if(!i.has(m))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;s[m]===void 0&&(s[m]=[]),s[m].push(h.attributes[m]),f++}if(f!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let m in h.morphAttributes){if(!r.has(m))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[m]===void 0&&(o[m]=[]),o[m].push(h.morphAttributes[m])}if(e){let m;if(t)m=h.index.count;else if(h.attributes.position!==void 0)m=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;c.addGroup(l,m,u),l+=m}}if(t){let u=0,h=[];for(let f=0;f<n.length;++f){let m=n[f].index;for(let g=0;g<m.count;++g)h.push(m.getX(g)+u);u+=n[f].attributes.position.count}c.setIndex(h)}for(let u in s){let h=Wx(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;c.setAttribute(u,h)}for(let u in o){let h=o[u][0].length;if(h===0)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[u]=[];for(let f=0;f<h;++f){let m=[];for(let _=0;_<o[u].length;++_)m.push(o[u][_][f]);let g=Wx(m);if(!g)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;c.morphAttributes[u].push(g)}}return c}function Wx(n){let e,t,i,r=-1,s=0;for(let l=0;l<n.length;++l){let u=n[l];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=u.normalized),i!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}let o=new e(s),a=new rt(o,t,i),c=0;for(let l=0;l<n.length;++l){let u=n[l];if(u.isInterleavedBufferAttribute){let h=c/t;for(let f=0,m=u.count;f<m;f++)for(let g=0;g<t;g++){let _=u.getComponent(f,g);a.setComponent(f+h,g,_)}}else o.set(u.array,c);c+=u.count*t}return r!==void 0&&(a.gpuType=r),a}function qx(n,e,t){e===void 0&&(e=!0),t===void 0&&(t=!1);let i=n.filter(a=>a.geometry.type==="polygon");if(!i.length)return null;let r=i.map(a=>{var c;let l=a.geometry.coords,u=Ur(l[0],l.slice(1)),h=new Pr(u,{steps:1,bevelEnabled:!1,depth:a.height,curveSegments:4});(c=a).deltaHeight||(c.deltaHeight=0),h.translate(0,0,a.airHeight+a.deltaHeight);let f=h.attributes.position.count,m=new Float32Array(f).fill(a.height+a.airHeight+a.deltaHeight);if(h.setAttribute("maxZ",new rt(m,1)),h.setAttribute("opacity",new rt(new Float32Array(f).fill(a.fillOpacity),1)),t){let d=new Float32Array(f).fill(a.airHeight+a.deltaHeight);h.setAttribute("minZ",new rt(d,1))}let g=new Xe(a.fillColor).convertLinearToSRGB(),_=new Float32Array(f*3);for(let d=0;d<f;d++)_[d*3]=g.r,_[d*3+1]=g.g,_[d*3+2]=g.b;return h.setAttribute("color",new rt(_,3)),h}),s=Or(r);r.forEach(a=>a.dispose());let o={geometry:s};return s.dispose(),e&&(o.lineGeometry=BO(i)||void 0),o}function BO(n){let{points:e,colors:t,opacities:i}=zO(n);if(!e.length)return null;let r=new Ot().setFromPoints(e);return r.setAttribute("color",new rt(new Float32Array(t),3)),r.setAttribute("opacity",new rt(new Float32Array(i),1)),r}function zO(n){let e=[],t=[],i=[];return n.filter(r=>r.strokeOpacity>0).map(r=>{let s=r.height+(r.deltaHeight||0)+r.airHeight,{coords:o}=r.geometry,{strokeColor:a,strokeOpacity:c}=r,l=new Xe(a).convertLinearToSRGB();for(let u=0;u<o.length;u++){let h=o[u];for(let f=0;f<h.length;f++){let m=h[f],g=f+1===h.length?h[0]:h[f+1];e.push(new U(m[0],m[1],s)),e.push(new U(g[0],g[1],s)),t.push(l.r,l.g,l.b),t.push(l.r,l.g,l.b),i.push(c),i.push(c)}}}),{points:e,colors:t,opacities:i}}Hx({onGetMergedGeometryAttributes(n){let{data:e}=n,t=e.map(s=>{let o=s.geometry.coords,a=Ur(o[0],o.slice(1));return new Pr(a,{steps:1,bevelEnabled:!1,depth:s.height,curveSegments:4})}),i=Or(t);t.forEach(s=>s.dispose());let r={attributes:i.attributes,index:i.index,morphAttributes:i.morphAttributes,morphTargetsRelative:i.morphTargetsRelative,groups:i.groups,boundingSphere:i.boundingSphere};return i.dispose(),r},onGetMergedShapeGeometryAttributes(n){let{data:e}=n,t=e.map(s=>{let o=Ur(s.geometry.coords[0].slice(0,-1),s.geometry.coords.slice(1)),a=new Ss(o,4),c=a.getAttribute("position"),l=[],u=new Xe(s.fillColor);for(let f=0;f<c.count;f++){c.setZ(f,s.airHeight+(s.deltaHeight||0));var h;l.push(u.r,u.g,u.b,(h=s.fillOpacity)!=null?h:1)}return a.setAttribute("color",new rt(new Float32Array(l),4)),a}),i=Or(t);t.forEach(s=>s.dispose());let r={attributes:i.attributes,index:i.index,morphAttributes:i.morphAttributes,morphTargetsRelative:i.morphTargetsRelative,groups:i.groups,boundingSphere:i.boundingSphere};return i.dispose(),r},onGetMergedTexture2dShapeGeometryAttributes(n){let{data:e}=n,t=e.map(s=>{let o=Ur(s.geometry.coords[0].slice(0,-1),s.geometry.coords.slice(1)),a=new Ss(o,4),c=a.getAttribute("position"),l=[1,1,1,0,0,0,0,1];a.setAttribute("uv",new xt(l,2));let u=s.height+(s.deltaHeight||0)+s.airHeight;for(let h=0;h<c.count;h++)c.setZ(h,u);return a}),i=Or(t);t.forEach(s=>s.dispose());let r={attributes:i.attributes,index:i.index,morphAttributes:i.morphAttributes,morphTargetsRelative:i.morphTargetsRelative,groups:i.groups,boundingSphere:i.boundingSphere};return i.dispose(),r},onGetMergedGeometriesJson(n){let{data:e}=n,t=qx(e);if(t){var i;return{mergedGeometry:t.geometry.toJSON(),lineGeometry:(i=t.lineGeometry)==null?void 0:i.toJSON()}}else return null}});
|
|
8170
|
-
`],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var v0=class{static GetMergeGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedShapeGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_shape_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedTexture2dGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetBufferGeometryByData(t){let e=new qe;return Object.keys(t.attributes).forEach(n=>{e.setAttribute(n,new He(t.attributes[n].array,t.attributes[n].itemSize))}),t.index&&e.setIndex(new He(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),n?ee({},t[0],n):null})}static dispose(){this.WorkerPool.dispose()}};v0.WorkerPool=new Pv(10,AR);var CY=H(qs(),1),Dh={id:"",height:.1,airHeight:0,area:0,group:"",fillColor:"#EFF4FB",strokeColor:"#ffffff",fillOpacity:1,strokeOpacity:1,strokeWidth:1,doors:[],visible:!0,geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},layerType:"",zIndex:0,stroke:!0,deltaHeight:0,userData:{},gradualColor:[],renderType:"single",colorFactor:.9,center_x:0,center_y:0,center_coord_x:0,center_coord_y:0,dashed:!1},wo=class extends Se{getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new G,e=new Be;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new G(0,0,0);let t=new Be,e=new G;return t.setFromObject(this),t.getSize(e),e}getPosition(){let{center_coord_x:t,center_coord_y:e}=this.options,n=this.getCenter();return n.setZ(n.z+this.options.height/2),new G(t,e,n.z+this.options.height/2)}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&this.options.strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initDoor(){var t;if((t=this.options.doors)!=null&&t.length&&this.options.geometry.type==="polygon"){let e=this.options.geometry.coords[0];this.options.doors.forEach(n=>{let i=n.type==="single"?.5:1,o=.5,a=K0(e,n.coord),l=new ft(...n.coord),c=new ft(...e[a]).sub(new ft(...n.coord)).normalize(),f=new ft().addVectors(l,c.clone().multiplyScalar(i)),g=new ft().addVectors(l,c.clone().multiplyScalar(-i)),m=new ft(-c.y,c.x),v=new ft().addVectors(f,m.clone().multiplyScalar(o));gT([v.x,v.y],e)||(m.multiplyScalar(-1),v=new ft().addVectors(f,m.clone().multiplyScalar(o)));let x=new ft().addVectors(g,m.clone().multiplyScalar(o)),S=[[f.x,f.y],[v.x,v.y],[x.x,x.y],[g.x,g.y]];e=this.options.geometry.coords[0]=[...e.slice(0,a+1),...S,...e.slice(a+1)]})}}initGeometry(){let t=Wm(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new bf(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=hn.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.secondUrl&&Mo.getTextureByUrl(this.options.secondUrl).then(n=>{n.wrapS=zs,n.wrapT=zs,n.needsUpdate=!0,t.map=n,t.side=qi}),this.options.height<=.1)return this.material=t,t;let e=hn.createMeshBasicMaterial({color:J0(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let n=new Be().setFromObject(this),i=t.clone().add(e.clone().multiplyScalar(1e3)),o=new da(i,e.clone().multiplyScalar(-1)),a=new G;o.intersectBox(n,a);let l=t.clone().add(e.clone().multiplyScalar(-1e3)),c=new da(l,e.clone()),f=new G;return c.intersectBox(n,f),{max:f,min:a}}initGradualMaterial(){let{max:t,min:e}=new Be().setFromObject(this),n=t.clone().sub(e),i=Math.max(n.x,n.y,n.z)/2,o=this.getPosition(),a=new G(-1,.2,0).normalize(),{max:l,min:c}=this.getMaxAndMin(o,a),f=hn.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:i,opacity:this.options.fillOpacity,direction:new G(-1,.2,0),max:l,min:c});if(this.options.height<=.1)return this.material=f,f;let g=this.getCenter(),m=new G(-1,.2,1).normalize(),{max:v,min:x}=this.getMaxAndMin(g,m),S=hn.createShaderMaterial({gradualColor:[J0(this.options.gradualColor[0],this.options.colorFactor),J0(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:i,opacity:this.options.fillOpacity,direction:new G(-1,.2,1),max:v,min:x});return this.material=[f,S],[f,S]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){if(this.options.dashed){let t=hn.createLineDashedMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}else{let t=hn.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new en(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options.height+this.options.deltaHeight,{coords:n}=this.options.geometry;for(let i=0;i<n.length;i++){let o=n[i];for(let a=0;a<o.length;a++){let l=o[a],c=a+1===o.length?o[0]:o[a+1];t.push(new G(l[0],l[1],e)),t.push(new G(c[0],c[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new qe().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new Yi(this.lineGeometry,this.lineMaterial);return t.position.z=this.options.airHeight+.01,this.options.dashed&&t.computeLineDistances(),this.line=t,this.add(t),t}raycast(t){if(!this.visible||this.options.geometry.type==="point")return!1;this.mesh.updateMatrixWorld(!0);let e=t.intersectObject(this.mesh);if(e[0]){let{point:n,distance:i}=e[0];return{position:n,distance:i}}return!1}dispose(){var t,e;(t=this.geometry)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e){if(super(),this.context=t,this.line=null,this.options=Wf((0,CY.cloneDeep)(ee({},Dh,e)),this),this.options.geometry.type==="point"){let[n,i]=this.options.geometry.coords;return this.position.set(n,i,this.options.height+this.options.airHeight),this}this.initDoor(),this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",n=>{let{value:i}=n;this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",n=>{let{value:i}=n;this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",n=>{let{value:i}=n;this.dispose(),this.init()}),this.addEventListener("change-strokeColor",n=>{let{value:i}=n;!this.options.stroke||!this.options.strokeOpacity||(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",n=>{let{value:i}=n;if(this.options.stroke)if(i)this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder();else{var o;this.line&&(this.remove(this.line),this.line=null),(o=this.lineGeometry)==null||o.dispose(),this.lineGeometry=void 0}}),this.addEventListener("change-airHeight",n=>{let{value:i}=n;this.position.z=i}),this.addEventListener("change-visible",n=>{let{value:i}=n;this.visible=i}),this.addEventListener("change-stroke",n=>{let{value:i}=n;if(i){if(this.line)return;this.initLineGeometry(),this.initLineMaterial(),this.createBorder()}else if(this.line){var o;this.remove(this.line),(o=this.lineGeometry)==null||o.dispose()}}),this.addEventListener("change-dashed",()=>{!this.options.stroke||!this.options.strokeOpacity||(this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-renderType",()=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-gradualColor",()=>{this.initMaterial(),this.initMesh()})}};var t_=class extends Se{initLight(){let t=hM(16777215,.5);return t.position.set(0,0,100),this.add(t),t}changeLightCamera(t){let e=t.x,n=t.y;this.directionalLight.shadow.camera.left=-e,this.directionalLight.shadow.camera.right=e,this.directionalLight.shadow.camera.top=n,this.directionalLight.shadow.camera.bottom=-n,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(e,n)}changeLightColor(t){this.directionalLight.color=new ne(t)}setPosition(t){this.position.copy(t),this.directionalLight.position.set(-t.x/2,-t.y/2,100)}initPlane(t,e){t===void 0&&(t=1e3),e===void 0&&(e=1e3);let n=new Ju(t,e),i=new Dm({transparent:!0,opacity:0,side:qi}),o=new en(n,i);return o.receiveShadow=!0,o.position.z=-10,this.add(o),this.plane=o,o}setTarget(t){this.directionalLight.target=t}transformOpacity(t){return t*this.basicOpacity}setOpacity(t){this.plane.material.opacity=this.transformOpacity(t)}dispose(){Lr(this,!0)}constructor(){super(),this.basicOpacity=.07,this.directionalLight=this.initLight(),this.initPlane()}};var zJt=H(Ge(),1);var RY=H(qs(),1);var ubt={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},ap=class extends bo{initObserver(){let t=new MutationObserver((0,RY.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){var t,e;if(this.element instanceof wo&&this.element.options.geometry.type==="polygon"){let{max:a,min:l}=new Be().setFromObject(this.element),c=(a.x+l.x)/2,f=(a.y+l.y)/2;return{left:new G(l.x,f,a.z),leftTop:new G(l.x,a.y,a.z),top:new G(c,a.y,a.z),rightTop:new G(a.x,a.y,a.z),right:new G(a.x,f,a.z),rightBottom:new G(a.x,l.y,a.z),bottom:new G(c,l.y,a.z),leftBottom:new G(l.x,l.y,a.z),center:new G(c,f,a.z)}}let{x:n,y:i,z:o}=((e=this.element)==null||(t=e.getPosition)==null?void 0:t.call(e))||this.position;return{left:new G(n,i,o),leftTop:new G(n,i,o),top:new G(n,i,o),rightTop:new G(n,i,o),right:new G(n,i,o),rightBottom:new G(n,i,o),bottom:new G(n,i,o),leftBottom:new G(n,i,o),center:new G(n,i,o)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,n=this.getPlacementPosition();return Object.keys(n).reduce((i,o)=>{let{x:a,y:l}=sn(n[o],this.context.camera,t,e);return i[o]={x:a,y:l},i},{})}checkOverflow(t,e){let{width:n,height:i}=this.context.clientSize;return e.x>0&&t.x<n&&e.y<i&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,n=this.getPlacementScreenPosition(),i=t/2,o=e/2,a=[{type:"center",getBox(l,c){return{max:{x:i+l,y:c-e},min:{x:l-i,y:c}}}},{type:"left",getBox(l,c){return{max:{x:l,y:c-o},min:{x:l-t,y:c+o}}}},{type:"leftTop",getBox(l,c){return{max:{x:l,y:c-e},min:{x:l-t,y:c}}}},{type:"top",getBox(l,c){return{max:{x:l+i,y:c-e},min:{x:l-i,y:c}}}},{type:"rightTop",getBox(l,c){return{max:{x:l+t,y:c-e},min:{x:l,y:c}}}},{type:"right",getBox(l,c){return{max:{x:l+t,y:c-o},min:{x:l,y:c+o}}}},{type:"rightBottom",getBox(l,c){return{max:{x:l+t,y:c},min:{x:l,y:c+e}}}},{type:"bottom",getBox(l,c){return{max:{x:l+i,y:c},min:{x:l-i,y:c+e}}}},{type:"leftBottom",getBox(l,c){return{max:{x:l,y:c},min:{x:l-t,y:c+o}}}}];for(let l=0;l<a.length;l++){let c=a[l],f=n[c.type],{max:g,min:m}=c.getBox(f.x,f.y);if(this.checkOverflow(g,m))return{type:c.type,position:f}}return{type:"center",position:n.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className="overlay_"+t.type,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,e){e===void 0&&(e="block"),t!==this.visible&&(this.div.style.display=t?e:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=""+t}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new Be().setFromObject(this.element).getCenter(new G):this.position}get withinDisplayRange(){let{x:t,y:e}=this.clientPos,{width:n,height:i}=this.context.clientSize;return t>=0&&t<=n&&e>=0&&e<=i}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:n,height:i,x:o,y:a}=this.context.clientSize;if(this.div){if(this.options.appendToBody){this.div.style.left=""+o+"px",this.div.style.top=""+(a+i)+"px";return}this.options.autoUpdate?(this.div.style.left=""+t+"px",this.div.style.bottom=""+(i-e)+"px"):this.dispatchEvent({type:"update-position",x:t,y:e,width:n,height:i})}}updatePosition(t){t===void 0&&(t=!1);let e=this.getPosition(),{width:n,height:i}=this.context.clientSize,{x:o,y:a}=sn(e,this.context.camera,n,i);this.clientPos.x===o&&this.clientPos.y===a&&!t||this._updatePosition(o,a)}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){var t,e;super.dispose(),this.unRegistryEvent(),this.unBindElement(),(t=this.observer)==null||t.disconnect(),(e=this.div)==null||e.remove(),this.div=null}constructor(t,e={}){super(),this.context=t,this.position=new G,this.clientPos={x:0,y:0},this.visible=!0,this.placement="top",this.observer=null,this.onUpdate=()=>{this.options.autoChangePlacement?this.usePlacement():this.updatePosition()},this.options=ee({},ubt,e),this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}};var lbt={texts:[{text:""}],level:1,icon_position:"bottom",collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},icon_opacity:1,icon_border:{color:"#586EE0",width:0},background:"",collision_hide_icon:!0,built_in:!1,box_only_icon:!1},Uh=class extends dn{get withinDisplayRange(){return this.overlay.withinDisplayRange}resetSize(){return At(this,null,function*(){if(yield xT(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:e}=this.img.getBoundingClientRect();this.size={width:t+2,height:e+2}}else{let{width:t,height:e}=this.div.getBoundingClientRect();this.size={width:t+2,height:e+2}}})}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(e=>{let n=document.createElement("div");if(n.style.whiteSpace="nowrap",e.styles)for(let[i,o]of Object.entries(e.styles))n.style[i]=o;n.textContent=e.text,t.appendChild(n)}),t}initIcon(){var t,e;let n=document.createElement("img");return n.setAttribute("src",this.options.icon),n.style.width=""+(((t=this.options.icon_size)==null?void 0:t[0])||32)+"px",n.style.height=""+(((e=this.options.icon_size)==null?void 0:e[1])||32)+"px",n.style.opacity=""+this.options.icon_opacity+"px",n.style.borderRadius="50%",this.options.icon_border.width&&(n.style.border=this.options.icon_border.width+"px solid "+this.options.icon_border.color),n.onload=()=>{this.resetSize()},this.img=n,n}registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t){t===void 0&&(t=this.context.config.poi.boxScale);let{width:e,height:n}=this.size,i=e*t,o=n*t,{x:a,y:l}=this.overlay.clientPos;return{left:a-i/2,right:a+i/2,top:this.options.icon?l-o:l-o/2,bottom:this.options.icon?l:l+o/2}}getOriginBox(){return this.getBox(1)}isContain(t,e){if(!this.overlay.visible||!this.visible)return!1;let n=this.getOriginBox();return t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}constructor(t,e){var n,i,o;super(),this.context=t,this.visible=!0,this.size={width:0,height:0},this.position=new G,this.userData={},this.showTextStatus=!0,this.disposed=!1,this._changePosition=()=>{this.overlay.updatePosition(!0)},this.options=Wf(ee({},lbt,e),this),this.position.set(((n=e.position)==null?void 0:n.x)||0,((i=e.position)==null?void 0:i.y)||0,((o=e.position)==null?void 0:o.z)||0),this.overlay=new ap(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",a=>{let{x:l,y:c,height:f}=a;this.overlay.div.style.transform="translate3d(calc("+l+"px - 50%), calc("+(-f+c)+"px - "+(this.options.icon&&this.options.icon_position!=="center"?"100%":"50%")+"), 0)"}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",a=>{let{value:l}=a;l?this.img?this.img.setAttribute("src",l):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",a=>{let{value:l}=a,c=this.textDiv;if(c){let f=this.initText();this.div.replaceChild(f,c)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",a=>{let{value:l}=a;this.overlay.setOpacity(l)}),this.addEventListener("change-icon_size",a=>{let{value:l}=a;this.img&&(this.img.style.width=""+((l==null?void 0:l[0])||32)+"px",this.img.style.height=""+((l==null?void 0:l[1])||32)+"px",this.resetSize())}),this.addEventListener("change-icon_opacity",a=>{let{value:l}=a;this.img&&(this.img.style.opacity=""+l)}),this.addEventListener("change-icon_border",a=>{let{value:l}=a;this.img&&(this.img.style.border=l.width+"px solid "+l.color)}),this.addEventListener("change-background",a=>{let{value:l}=a;this.div.style.background=l})}};var Ete=H(Ge(),1),Ste=H(n0(),1),bte=H(r0(),1),Mte=H(i0(),1),wte=H(o0(),1),Tte=H(s0(),1),Ate=H(a0(),1),Cte=H(u0(),1);var LY=H(IY(),1);var e_=class extends Se{clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){this.clearHeatmap();let{width:e,height:n,leftTop:i,center:o}=this.getBox(t);this.heatmap=(0,LY.create)(ee({width:e,height:n,container:this.div},this.context.config.heatMap)),this.heatmap.setData(this.transformData(t,i)),this.initPlane(e,n);let a=this.context.center;this.position.set(o[0]-a[0],o[1]-a[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let n=new Ju(t,e),i=new Pi(this.div.firstChild);i.needsUpdate=!0;let o=new yi({transparent:!0,side:ys,map:i});o.needsUpdate=!0,this.plane=new en(n,o),this.plane.renderOrder=1e5,this.add(this.plane)}getTransMatrix(t){let{x:e,y:n}=t;return new Je().makeScale(1,-1).multiply(new Je().makeTranslation(0-e,0-n))}transformData(t,e){var n,i;let o=this.getTransMatrix(e);var a;let l=(a=(n=t.data[0])==null?void 0:n.value)!=null?a:0;var c;let f=(c=(i=t.data[0])==null?void 0:i.value)!=null?c:0;return{data:t.data.map(m=>{let v=new ft(m.x,m.y).applyMatrix3(o);return m.value>l&&(l=m.value),m.value<f&&(f=m.value),{x:v.x,y:v.y,value:m.value}}),max:l,min:f}}getBox(t){let e=Tn(t.data.map(c=>xr([c.x,c.y]))),n=Ho(e),i=n[2]-n[0],o=n[3]-n[1],a={x:n[0],y:n[3]},l=fh(e);return{width:i,height:o,leftTop:a,center:l.geometry.coordinates}}dispose(){this.clearHeatmap(),this.div=null,this.plane&&(this.remove(this.plane),Lr(this.plane))}constructor(t){super(),this.context=t,this.div=document.createElement("div")}};var n_=class extends Se{loadModel(){return At(this,null,function*(){let t=yield Ms.loadModel(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t})}dispose(){Lr(this),this.model=null}constructor(t,e){super(),this.context=t,this.options=e,this.model=null,this.position.copy(e.position||new G(0,0,0)),this.loadModel()}};var oQt=H(Ge(),1);var Zi=class extends Se{dispose(){Lr(this),this.children.forEach(t=>t.dispose==null?void 0:t.dispose.call(t)),this.clear()}constructor(t){super(),this.context=t}};var r_=class extends Zi{getCenter(){return new Be().setFromObject(this).getCenter(new G)}createGraphic(t){let e=new wo(this.context,t);return e.userData.data=t,this.add(e),this.graphicMap.set(t.id,e),e}removeGraphic(t){this.remove(t),this.graphicMap.delete(t.options.id),t.dispose()}removeGraphicById(t){this.graphicMap.has(t)&&this.removeGraphic(this.graphicMap.get(t))}getGraphicByNodeId(t){return this.graphicMap.get(t)||null}getGraphicByRaycaster(t){let e={distance:1e4,graphic:null,position:null},n=this.children.reduce((i,o)=>{if(o instanceof wo){let a=o.raycast(t);if(a){let{distance:l}=a;if(l<i.distance)return{distance:a.distance,position:a.position,graphic:o}}return i}else return i},e);return n===e?{graphics:[],position:null}:{graphics:[n.graphic],position:n.position}}setGraphicOptions(t,e){let n,i=this.graphicMap.get(t);i&&(typeof e=="function"?n=e(i.options):n=ee({},i.options,e),Object.keys(n).forEach(o=>{i.options[o]=n[o]}))}getGraphicPosition(t){let e=this.graphicMap.get(t);return e?[e.options.center_x,e.options.center_y]:null}constructor(t){super(t),this.graphicMap=new Map}};var fQt=H(w6(),1),pQt=H(Sn(),1);var NY=H(qs(),1);var i_=class extends Zi{clear(t){return t===void 0&&(t=!1),this.pois.forEach(e=>{e.options.built_in&&!t||e.dispose()}),this.pois=t?[]:this.pois.filter(e=>e.options.built_in),this}createPoi(t){let e=new Uh(this.context,t);return this.pushPoi(e),e.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(e)),e.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(e)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),e}changePoiLevelOrCollisionEnable(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),this.pushPoi(t))}removePoi(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),t.dispose())}removePoiById(t){let e=this.pois.find(n=>n.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(n=>n.options.id===t)||null}pushPoi(t){if(!t.options.collision_enable){this.pois.unshift(t);return}if(t.options.level===0){this.pois.push(t);return}for(let e=0;e<this.pois.length;e++){let n=this.pois[e];if(n.options.collision_enable&&n.options.level<=t.options.level){this.pois.splice(e,0,t);return}}this.pois.push(t)}getPoiByDeviceXy(t,e){return this.pois.filter(i=>i instanceof Uh&&i.isContain(t,e))}collisionDetection(){let t=[];this.pois.filter(n=>n.visible&&n.withinDisplayRange).forEach((n,i)=>{let{left:o,right:a,top:l,bottom:c}=n.getBox();if(i===0||!n.options.collision_enable){t.push({left:o,right:a,top:l,bottom:c}),n.parentSetVisible(!0);return}let f=t.some(g=>g.left<a&&g.right>o&&g.top<c&&g.bottom>l);n.parentSetVisible(!f),f||t.push({left:o,right:a,top:l,bottom:c})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(t=>t.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}constructor(t){super(t),this.pois=[],this.timer=new ui,this.onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})},this.registryEvent(),this.debounceCollisionDetection=(0,NY.debounce)(this.collisionDetection,10)}};var _Qt=H(w6(),1),yQt=H(Sn(),1);var up=class extends Zi{clear(){return this.pois.forEach(t=>{t.dispose()}),this.pois=[],this}createPoi(t){let e=new Di(this.context,t);return this.pushPoi(e),e}changePoiLevelOrCollisionEnable(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),this.pushPoi(t))}removePoi(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.remove(t),this.pois.splice(e,1),t.dispose())}removePoiById(t){let e=this.pois.find(n=>n.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(n=>n.options.id===t)||null}add(t){return this.children.some(e=>e.options.id===t.options.id)||(t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t))),super.add(t),this}pushPoi(t){if(t.parentSetVisible(!1),t.userData.type==="parkingSpace"&&(this.needChangeParkingSpaceVisibleByZoom=!0),this.add(t),!t.options.collision_enable){this.pois.unshift(t);return}if(t.options.level===0){this.pois.push(t);return}for(let e=0;e<this.pois.length;e++){let n=this.pois[e];if(n.options.collision_enable&&n.options.level<=t.options.level){this.pois.splice(e,0,t);return}}this.pois.push(t)}getPoiByDeviceXy(t,e){let n=new ft(t,e);return this.pois.filter(o=>o instanceof Di&&o.canSelect&&o.box.containsPoint(n))}collisionDetection(){let t=[],{camera:e}=this.context;e.updateMatrixWorld();let n=f=>f<=1&&f>=-1,i=e.projectionMatrix.clone();i.multiply(e.matrixWorldInverse);let o=e.zoom/this.context.basicZoom,a=25/30,l=Math.min(25,Math.max(1,o*a));this.pois.filter(f=>{if(f.visible){var g,m;if(!(l<=f.options.maxWeight&&l>=f.options.minWeight))return f.parentSetVisible(!1),!1;let v=f.spriteIcon?(g=f.spriteIcon)==null?void 0:g.matrixWorld:((m=f.spriteText)==null?void 0:m.matrixWorld)||f.matrixWorld,x=new G().setFromMatrixPosition(v);return x.applyMatrix4(i),f.screenPosition=x,n(x.x)&&n(x.y)&&n(x.z)?!0:(f.parentSetVisible(!1),!1)}return!1}).forEach((f,g)=>{let m=f.getBox(f.screenPosition);if(g===0||!f.options.collision_enable){t.push(m),f.parentSetVisible(!0);return}let v=t.some(x=>x.intersectsBox(m));f.parentSetVisible(!v),v||t.push(m)})}registryEvent(){this.context.addEventListener("update",this.onUpdate),this.context.addEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate),this.context.removeEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}onAddToScene(){this.registryEvent()}onRemoveFromScene(){this.unRegistryEvent()}dispose(){this.timer.dispose(),this.pois.forEach(t=>t.dispose()),this.pois.length=0,super.dispose(),this.unRegistryEvent()}constructor(t){super(t),this.pois=[],this.needChangeParkingSpaceVisibleByZoom=!1,this.timer=new ui,this.changeParkingSpaceVisibleByZoom=()=>{var e;let n=(e=this.parent)==null?void 0:e.parent;if(n&&n instanceof $a){let{clientSize:{width:i,height:o}}=this.context,{max:a,min:l}=n.box,f=Math.min(i/(a.x-l.x),o/(a.y-l.y))*(a.x-l.x)/60,g=this.context.camera.zoom>=f;this.pois.filter(m=>m.userData.type==="parkingSpace").map(m=>{m.visible=g,g||m.parentSetVisible(g)})}},this.onUpdate=()=>{this.needChangeParkingSpaceVisibleByZoom&&(this.changeParkingSpaceVisibleByZoom(),this.needChangeParkingSpaceVisibleByZoom=!1),this.timer.requestAnimationFrame(()=>{this.collisionDetection()})}}};var wQt=H(Xa(),1),TQt=H(Ge(),1);var OY=H(qs(),1);var o_=class extends Zi{createParkings(t,e,n){e===void 0&&(e=!0),this.parkingOptions=t,this.merged=e,e?(n?this.createMergedParkingByMergedElements(n):this.createMergedParking(t),t.map((i,o)=>{var a;(a=i.texts[0])==null||a.split(/[,,]/).map(l=>{this.parkingNoIndexMap.set(l,o)}),this.nodeIdIndexMap.set(i.id,o)})):this.createIndependentParking(t)}load(t,e){e===void 0&&(e=!0);var n;this.createParkings(t.elements,e,t.mergedElements),(n=t.mergedParkingTexture)!=null&&n.length?this.createMergedParkingTexture(t.mergedParkingTexture):this.createParkingTexture(t.elements)}createMergedParking(t){return At(this,null,function*(){let e=new s_(this.context,t);this.mergedParkingSpace=e,this.add(e)})}createMergedParkingByMergedElements(t){let e=new a_(this.context,t);this.mergedParkingSpace=e,this.add(e)}createIndependentParking(t){t.forEach(e=>{var n;let i=new wo(this.context,e);this.add(i),(n=e.texts[0])==null||n.split(/[,,]/).map(o=>{this.parkingNoGraphicMap.set(o,i)}),this.graphicMap.set(i.options.id,i)})}createParkingTexture(t){let e=t.filter(n=>E6[n.parkingType]).map(n=>{let i=new ft(...n.geometry.coords[0][0]),o=new ft(...n.geometry.coords[0][1]),a=new ft(...n.geometry.coords[0][2]),l=Math.min(i.distanceTo(o),o.distanceTo(a)),c=0;return l===i.distanceTo(o)?c=o.sub(i).angle()-Math.PI/2:c=a.sub(o).angle()-Math.PI/2,{uuid:n.id,iconUrl:E6[n.parkingType],name:n.texts[0],deltaHeight:(n.deltaHeight||0)+.001,airHeight:n.airHeight,height:n.height,geometry:n.geometry,opacity:n.fillOpacity,visible:!0,secondWidth:l-1,secondHeight:l-1,secondRotate:c,centerCoords:[n.center_coord_x,n.center_coord_y]}});if(e.length){let n=new lp(this.context,e);this.add(n)}}createMergedParkingTexture(t){t.map(e=>{e.iconUrl=E6[e.iconUrl];let n=new cp(this.context,e);this.add(n)})}changeParkingColor(t){this.merged?Object.keys(t).map(e=>{let n=this.parkingNoIndexMap.get(e);if(!(0,OY.isNil)(n)){var i;(i=this.mergedParkingSpace)==null||i.setParkingColorByIndex(n,t[e])}}):Object.keys(t).map(e=>{let n=this.parkingNoGraphicMap.get(e);n&&(n.options.fillColor=t[e])})}getGraphicPosition(t){if(this.merged){let e=this.parkingOptions.find(n=>n.id===t);return e?[e.center_x,e.center_y]:null}}dispose(){var t;(t=this.mergedParkingSpace)==null||t.dispose(),this.mergedParkingSpace=null,Lr(this),this.graphicMap.clear(),this.parkingNoGraphicMap.clear(),this.parkingNoIndexMap.clear(),this.nodeIdIndexMap.clear(),this.parkingOptions=[],super.dispose()}constructor(t){super(t),this.graphicMap=new Map,this.parkingNoGraphicMap=new Map,this.parkingOptions=[],this.merged=!1,this.parkingNoIndexMap=new Map,this.nodeIdIndexMap=new Map,this.mergedParkingSpace=null}};var OQt=H(Sn(),1);var u_=class extends Zi{addModels(t){let e=t.reduce((n,i)=>{let{url:o}=i;return n[o]?n[o].push(i):n[o]=[i],n},{});Object.values(e).forEach(n=>{let i=new l_(this.context,n);this.add(i)})}constructor(t){super(t)}};var ote=H(Ge(),1);function DY(r){return`${r.x}-${r.y}-${r.z}`}var ba=class{static generateLineMaterialKey({color:t,opacity:e}){return`${t}-${e}`}static createLineMaterial({color:t,opacity:e,vertexColors:n}){let i=this.generateLineMaterialKey({color:t,opacity:e,vertexColors:n});if(this.lineMaterialMap.has(i))return this.lineMaterialMap.get(i);let o=new ma({color:new ne(t).convertLinearToSRGB(),transparent:!0,opacity:e,vertexColors:n!=null?n:!1});return this.lineMaterialMap.set(i,o),o}static createMeshStandardMaterial({color:t,opacity:e}){let n=`${t}-${e}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let i=new t0({color:new ne(t).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:e,depthWrite:!0});return this.meshStandardMaterialMap.set(n,i),i}static createMeshBasicMaterial({color:t,opacity:e,vertexColors:n}){let i=`${t}-${e}-${n}`;if(this.meshBasicMaterialMap.has(i))return this.meshBasicMaterialMap.get(i);let o=new yi({color:t,transparent:!0,opacity:e,depthWrite:!0,vertexColors:n!=null?n:!1});return this.meshBasicMaterialMap.set(i,o),o}static createShaderMaterial({gradualColor:t,center:e,maxValue:n,opacity:i,direction:o,max:a,min:l}){let c=`${t.toString()}-${DY(e)}-${n}-${i}-${DY(o)}`;if(this.shaderMaterialMap.has(c))return this.shaderMaterialMap.get(c);let f=`
|
|
8170
|
+
`],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var v0=class{static GetMergeGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedShapeGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_shape_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedTexture2dGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetBufferGeometryByData(t){let e=new qe;return Object.keys(t.attributes).forEach(n=>{e.setAttribute(n,new He(t.attributes[n].array,t.attributes[n].itemSize))}),t.index&&e.setIndex(new He(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),n?ee({},t[0],n):null})}static dispose(){this.WorkerPool.dispose()}};v0.WorkerPool=new Pv(10,AR);var CY=H(qs(),1),Dh={id:"",height:.1,airHeight:0,area:0,group:"",fillColor:"#EFF4FB",strokeColor:"#ffffff",fillOpacity:1,strokeOpacity:1,strokeWidth:1,doors:[],visible:!0,geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},layerType:"",zIndex:0,stroke:!0,deltaHeight:0,userData:{},gradualColor:[],renderType:"single",colorFactor:.9,center_x:0,center_y:0,center_coord_x:0,center_coord_y:0,dashed:!1},wo=class extends Se{getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new G,e=new Be;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new G(0,0,0);let t=new Be,e=new G;return t.setFromObject(this),t.getSize(e),e}getPosition(){let{center_coord_x:t,center_coord_y:e}=this.options,n=this.getCenter();return n.setZ(n.z+this.options.height/2),new G(t,e,n.z+this.options.height/2)}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&this.options.strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initDoor(){var t;if((t=this.options.doors)!=null&&t.length&&this.options.geometry.type==="polygon"){let e=this.options.geometry.coords[0];this.options.doors.forEach(n=>{let i=n.type==="single"?.5:1,o=.5,a=K0(e,n.coord),l=new ft(...n.coord),c=new ft(...e[a]).sub(new ft(...n.coord)).normalize(),f=new ft().addVectors(l,c.clone().multiplyScalar(i)),g=new ft().addVectors(l,c.clone().multiplyScalar(-i)),m=new ft(-c.y,c.x),v=new ft().addVectors(f,m.clone().multiplyScalar(o));gT([v.x,v.y],e)||(m.multiplyScalar(-1),v=new ft().addVectors(f,m.clone().multiplyScalar(o)));let x=new ft().addVectors(g,m.clone().multiplyScalar(o)),S=[[f.x,f.y],[v.x,v.y],[x.x,x.y],[g.x,g.y]];e=this.options.geometry.coords[0]=[...e.slice(0,a+1),...S,...e.slice(a+1)]})}}initGeometry(){let t=Wm(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new bf(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=hn.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.secondUrl&&Mo.getTextureByUrl(this.options.secondUrl).then(n=>{n.wrapS=zs,n.wrapT=zs,n.needsUpdate=!0,t.map=n,t.side=qi}),this.options.height<=.1)return this.material=t,t;let e=hn.createMeshBasicMaterial({color:J0(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let n=new Be().setFromObject(this),i=t.clone().add(e.clone().multiplyScalar(1e3)),o=new da(i,e.clone().multiplyScalar(-1)),a=new G;o.intersectBox(n,a);let l=t.clone().add(e.clone().multiplyScalar(-1e3)),c=new da(l,e.clone()),f=new G;return c.intersectBox(n,f),{max:f,min:a}}initGradualMaterial(){let{max:t,min:e}=new Be().setFromObject(this),n=t.clone().sub(e),i=Math.max(n.x,n.y,n.z)/2,o=this.getPosition(),a=new G(-1,.2,0).normalize(),{max:l,min:c}=this.getMaxAndMin(o,a),f=hn.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:i,opacity:this.options.fillOpacity,direction:new G(-1,.2,0),max:l,min:c});if(this.options.height<=.1)return this.material=f,f;let g=this.getCenter(),m=new G(-1,.2,1).normalize(),{max:v,min:x}=this.getMaxAndMin(g,m),S=hn.createShaderMaterial({gradualColor:[J0(this.options.gradualColor[0],this.options.colorFactor),J0(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:i,opacity:this.options.fillOpacity,direction:new G(-1,.2,1),max:v,min:x});return this.material=[f,S],[f,S]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){if(this.options.dashed){let t=hn.createLineDashedMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}else{let t=hn.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new en(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options.height+this.options.deltaHeight,{coords:n}=this.options.geometry;for(let i=0;i<n.length;i++){let o=n[i];for(let a=0;a<o.length;a++){let l=o[a],c=a+1===o.length?o[0]:o[a+1];t.push(new G(l[0],l[1],e)),t.push(new G(c[0],c[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new qe().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new Yi(this.lineGeometry,this.lineMaterial);return t.position.z=this.options.airHeight+.01,this.options.dashed&&t.computeLineDistances(),this.line=t,this.add(t),t}raycast(t){if(!this.visible||this.options.geometry.type==="point")return!1;this.mesh.updateMatrixWorld(!0);let e=t.intersectObject(this.mesh);if(e[0]){let{point:n,distance:i}=e[0];return{position:n,distance:i}}return!1}dispose(){var t,e;(t=this.geometry)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e){if(super(),this.context=t,this.line=null,this.options=Wf((0,CY.cloneDeep)(ee({},Dh,e)),this),this.options.geometry.type==="point"){let[n,i]=this.options.geometry.coords;return this.position.set(n,i,this.options.height+this.options.airHeight),this}this.initDoor(),this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",n=>{let{value:i}=n;this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",n=>{let{value:i}=n;this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",n=>{let{value:i}=n;this.dispose(),this.init()}),this.addEventListener("change-strokeColor",n=>{let{value:i}=n;!this.options.stroke||!this.options.strokeOpacity||(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",n=>{let{value:i}=n;if(this.options.stroke)if(i)this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder();else{var o;this.line&&(this.remove(this.line),this.line=null),(o=this.lineGeometry)==null||o.dispose(),this.lineGeometry=void 0}}),this.addEventListener("change-airHeight",n=>{let{value:i}=n;this.position.z=i}),this.addEventListener("change-visible",n=>{let{value:i}=n;this.visible=i}),this.addEventListener("change-stroke",n=>{let{value:i}=n;if(i){if(this.line)return;this.initLineGeometry(),this.initLineMaterial(),this.createBorder()}else if(this.line){var o;this.remove(this.line),(o=this.lineGeometry)==null||o.dispose()}}),this.addEventListener("change-dashed",()=>{!this.options.stroke||!this.options.strokeOpacity||(this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-renderType",()=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-gradualColor",()=>{this.initMaterial(),this.initMesh()})}};var t_=class extends Se{initLight(){let t=hM(16777215,.5);return t.position.set(0,0,100),this.add(t),t}changeLightCamera(t){let e=t.x,n=t.y;this.directionalLight.shadow.camera.left=-e,this.directionalLight.shadow.camera.right=e,this.directionalLight.shadow.camera.top=n,this.directionalLight.shadow.camera.bottom=-n,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(e,n)}changeLightColor(t){this.directionalLight.color=new ne(t)}setPosition(t){this.position.copy(t),this.directionalLight.position.set(-t.x/2,-t.y/2,100)}initPlane(t,e){t===void 0&&(t=1e3),e===void 0&&(e=1e3);let n=new Ju(t,e),i=new Dm({transparent:!0,opacity:0,side:qi}),o=new en(n,i);return o.receiveShadow=!0,o.position.z=-10,this.add(o),this.plane=o,o}setTarget(t){this.directionalLight.target=t}transformOpacity(t){return t*this.basicOpacity}setOpacity(t){this.plane.material.opacity=this.transformOpacity(t)}dispose(){Lr(this,!0)}constructor(){super(),this.basicOpacity=.07,this.directionalLight=this.initLight(),this.initPlane()}};var zJt=H(Ge(),1);var RY=H(qs(),1);var ubt={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},ap=class extends bo{initObserver(){let t=new MutationObserver((0,RY.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){var t,e;if(this.element instanceof wo&&this.element.options.geometry.type==="polygon"){let{max:a,min:l}=new Be().setFromObject(this.element),c=(a.x+l.x)/2,f=(a.y+l.y)/2;return{left:new G(l.x,f,a.z),leftTop:new G(l.x,a.y,a.z),top:new G(c,a.y,a.z),rightTop:new G(a.x,a.y,a.z),right:new G(a.x,f,a.z),rightBottom:new G(a.x,l.y,a.z),bottom:new G(c,l.y,a.z),leftBottom:new G(l.x,l.y,a.z),center:new G(c,f,a.z)}}let{x:n,y:i,z:o}=((e=this.element)==null||(t=e.getPosition)==null?void 0:t.call(e))||this.position;return{left:new G(n,i,o),leftTop:new G(n,i,o),top:new G(n,i,o),rightTop:new G(n,i,o),right:new G(n,i,o),rightBottom:new G(n,i,o),bottom:new G(n,i,o),leftBottom:new G(n,i,o),center:new G(n,i,o)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,n=this.getPlacementPosition();return Object.keys(n).reduce((i,o)=>{let{x:a,y:l}=sn(n[o],this.context.camera,t,e);return i[o]={x:a,y:l},i},{})}checkOverflow(t,e){let{width:n,height:i}=this.context.clientSize;return e.x>0&&t.x<n&&e.y<i&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,n=this.getPlacementScreenPosition(),i=t/2,o=e/2,a=[{type:"center",getBox(l,c){return{max:{x:i+l,y:c-e},min:{x:l-i,y:c}}}},{type:"left",getBox(l,c){return{max:{x:l,y:c-o},min:{x:l-t,y:c+o}}}},{type:"leftTop",getBox(l,c){return{max:{x:l,y:c-e},min:{x:l-t,y:c}}}},{type:"top",getBox(l,c){return{max:{x:l+i,y:c-e},min:{x:l-i,y:c}}}},{type:"rightTop",getBox(l,c){return{max:{x:l+t,y:c-e},min:{x:l,y:c}}}},{type:"right",getBox(l,c){return{max:{x:l+t,y:c-o},min:{x:l,y:c+o}}}},{type:"rightBottom",getBox(l,c){return{max:{x:l+t,y:c},min:{x:l,y:c+e}}}},{type:"bottom",getBox(l,c){return{max:{x:l+i,y:c},min:{x:l-i,y:c+e}}}},{type:"leftBottom",getBox(l,c){return{max:{x:l,y:c},min:{x:l-t,y:c+o}}}}];for(let l=0;l<a.length;l++){let c=a[l],f=n[c.type],{max:g,min:m}=c.getBox(f.x,f.y);if(this.checkOverflow(g,m))return{type:c.type,position:f}}return{type:"center",position:n.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className="overlay_"+t.type,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,e){e===void 0&&(e="block"),t!==this.visible&&(this.div.style.display=t?e:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=""+t}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new Be().setFromObject(this.element).getCenter(new G):this.position}get withinDisplayRange(){let{x:t,y:e}=this.clientPos,{width:n,height:i}=this.context.clientSize;return t>=0&&t<=n&&e>=0&&e<=i}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:n,height:i,x:o,y:a}=this.context.clientSize;if(this.div){if(this.options.appendToBody){this.div.style.left=""+o+"px",this.div.style.top=""+(a+i)+"px";return}this.options.autoUpdate?(this.div.style.left=""+t+"px",this.div.style.bottom=""+(i-e)+"px"):this.dispatchEvent({type:"update-position",x:t,y:e,width:n,height:i})}}updatePosition(t){t===void 0&&(t=!1);let e=this.getPosition(),{width:n,height:i}=this.context.clientSize,{x:o,y:a}=sn(e,this.context.camera,n,i);this.clientPos.x===o&&this.clientPos.y===a&&!t||this._updatePosition(o,a)}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){var t,e;super.dispose(),this.unRegistryEvent(),this.unBindElement(),(t=this.observer)==null||t.disconnect(),(e=this.div)==null||e.remove(),this.div=null}constructor(t,e={}){super(),this.context=t,this.position=new G,this.clientPos={x:0,y:0},this.visible=!0,this.placement="top",this.observer=null,this.onUpdate=()=>{this.options.autoChangePlacement?this.usePlacement():this.updatePosition()},this.options=ee({},ubt,e),this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}};var lbt={texts:[{text:""}],level:1,icon_position:"bottom",collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},icon_opacity:1,icon_border:{color:"#586EE0",width:0},background:"",collision_hide_icon:!0,built_in:!1,box_only_icon:!1},Uh=class extends dn{get withinDisplayRange(){return this.overlay.withinDisplayRange}resetSize(){return At(this,null,function*(){if(yield xT(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:e}=this.img.getBoundingClientRect();this.size={width:t+2,height:e+2}}else{let{width:t,height:e}=this.div.getBoundingClientRect();this.size={width:t+2,height:e+2}}})}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(e=>{let n=document.createElement("div");if(n.style.whiteSpace="nowrap",e.styles)for(let[i,o]of Object.entries(e.styles))n.style[i]=o;n.textContent=e.text,t.appendChild(n)}),t}initIcon(){var t,e;let n=document.createElement("img");return n.setAttribute("src",this.options.icon),n.style.width=""+(((t=this.options.icon_size)==null?void 0:t[0])||32)+"px",n.style.height=""+(((e=this.options.icon_size)==null?void 0:e[1])||32)+"px",n.style.opacity=""+this.options.icon_opacity+"px",n.style.borderRadius="50%",this.options.icon_border.width&&(n.style.border=this.options.icon_border.width+"px solid "+this.options.icon_border.color),n.onload=()=>{this.resetSize()},this.img=n,n}registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t){t===void 0&&(t=this.context.config.poi.boxScale);let{width:e,height:n}=this.size,i=e*t,o=n*t,{x:a,y:l}=this.overlay.clientPos;return{left:a-i/2,right:a+i/2,top:this.options.icon?l-o:l-o/2,bottom:this.options.icon?l:l+o/2}}getOriginBox(){return this.getBox(1)}isContain(t,e){if(!this.overlay.visible||!this.visible)return!1;let n=this.getOriginBox();return t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}constructor(t,e){var n,i,o;super(),this.context=t,this.visible=!0,this.size={width:0,height:0},this.position=new G,this.userData={},this.showTextStatus=!0,this.disposed=!1,this._changePosition=()=>{this.overlay.updatePosition(!0)},this.options=Wf(ee({},lbt,e),this),this.position.set(((n=e.position)==null?void 0:n.x)||0,((i=e.position)==null?void 0:i.y)||0,((o=e.position)==null?void 0:o.z)||0),this.overlay=new ap(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",a=>{let{x:l,y:c,height:f}=a;this.overlay.div.style.transform="translate3d(calc("+l+"px - 50%), calc("+(-f+c)+"px - "+(this.options.icon&&this.options.icon_position!=="center"?"100%":"50%")+"), 0)"}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",a=>{let{value:l}=a;l?this.img?this.img.setAttribute("src",l):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",a=>{let{value:l}=a,c=this.textDiv;if(c){let f=this.initText();this.div.replaceChild(f,c)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",a=>{let{value:l}=a;this.overlay.setOpacity(l)}),this.addEventListener("change-icon_size",a=>{let{value:l}=a;this.img&&(this.img.style.width=""+((l==null?void 0:l[0])||32)+"px",this.img.style.height=""+((l==null?void 0:l[1])||32)+"px",this.resetSize())}),this.addEventListener("change-icon_opacity",a=>{let{value:l}=a;this.img&&(this.img.style.opacity=""+l)}),this.addEventListener("change-icon_border",a=>{let{value:l}=a;this.img&&(this.img.style.border=l.width+"px solid "+l.color)}),this.addEventListener("change-background",a=>{let{value:l}=a;this.div.style.background=l})}};var Ete=H(Ge(),1),Ste=H(n0(),1),bte=H(r0(),1),Mte=H(i0(),1),wte=H(o0(),1),Tte=H(s0(),1),Ate=H(a0(),1),Cte=H(u0(),1);var LY=H(IY(),1);var e_=class extends Se{clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){this.clearHeatmap();let{width:e,height:n,leftTop:i,center:o}=this.getBox(t);this.heatmap=(0,LY.create)(ee({width:e,height:n,container:this.div},this.context.config.heatMap)),this.heatmap.setData(this.transformData(t,i)),this.initPlane(e,n);let a=this.context.center;this.position.set(o[0]-a[0],o[1]-a[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let n=new Ju(t,e),i=new Pi(this.div.firstChild);i.needsUpdate=!0;let o=new yi({transparent:!0,side:ys,map:i});o.needsUpdate=!0,this.plane=new en(n,o),this.plane.renderOrder=1e5,this.add(this.plane)}getTransMatrix(t){let{x:e,y:n}=t;return new Je().makeScale(1,-1).multiply(new Je().makeTranslation(0-e,0-n))}transformData(t,e){var n,i;let o=this.getTransMatrix(e);var a;let l=(a=(n=t.data[0])==null?void 0:n.value)!=null?a:0;var c;let f=(c=(i=t.data[0])==null?void 0:i.value)!=null?c:0;return{data:t.data.map(m=>{let v=new ft(m.x,m.y).applyMatrix3(o);return m.value>l&&(l=m.value),m.value<f&&(f=m.value),{x:v.x,y:v.y,value:m.value}}),max:l,min:f}}getBox(t){let e=Tn(t.data.map(f=>xr([f.x,f.y]))),n=50,i=Ho(e),o=i[2]-i[0]+n*2,a=i[3]-i[1]+n*2,l={x:i[0]-n,y:i[3]+n},c=fh(e).geometry.coordinates;return{width:o,height:a,leftTop:l,center:c}}dispose(){this.clearHeatmap(),this.div.remove(),this.div=null,this.plane&&(this.remove(this.plane),Lr(this.plane))}constructor(t){super(),this.context=t,this.div=document.createElement("div")}};var n_=class extends Se{loadModel(){return At(this,null,function*(){let t=yield Ms.loadModel(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t})}dispose(){Lr(this),this.model=null}constructor(t,e){super(),this.context=t,this.options=e,this.model=null,this.position.copy(e.position||new G(0,0,0)),this.loadModel()}};var oQt=H(Ge(),1);var Zi=class extends Se{dispose(){Lr(this),this.children.forEach(t=>t.dispose==null?void 0:t.dispose.call(t)),this.clear()}constructor(t){super(),this.context=t}};var r_=class extends Zi{getCenter(){return new Be().setFromObject(this).getCenter(new G)}createGraphic(t){let e=new wo(this.context,t);return e.userData.data=t,this.add(e),this.graphicMap.set(t.id,e),e}removeGraphic(t){this.remove(t),this.graphicMap.delete(t.options.id),t.dispose()}removeGraphicById(t){this.graphicMap.has(t)&&this.removeGraphic(this.graphicMap.get(t))}getGraphicByNodeId(t){return this.graphicMap.get(t)||null}getGraphicByRaycaster(t){let e={distance:1e4,graphic:null,position:null},n=this.children.reduce((i,o)=>{if(o instanceof wo){let a=o.raycast(t);if(a){let{distance:l}=a;if(l<i.distance)return{distance:a.distance,position:a.position,graphic:o}}return i}else return i},e);return n===e?{graphics:[],position:null}:{graphics:[n.graphic],position:n.position}}setGraphicOptions(t,e){let n,i=this.graphicMap.get(t);i&&(typeof e=="function"?n=e(i.options):n=ee({},i.options,e),Object.keys(n).forEach(o=>{i.options[o]=n[o]}))}getGraphicPosition(t){let e=this.graphicMap.get(t);return e?[e.options.center_x,e.options.center_y]:null}constructor(t){super(t),this.graphicMap=new Map}};var fQt=H(w6(),1),pQt=H(Sn(),1);var NY=H(qs(),1);var i_=class extends Zi{clear(t){return t===void 0&&(t=!1),this.pois.forEach(e=>{e.options.built_in&&!t||e.dispose()}),this.pois=t?[]:this.pois.filter(e=>e.options.built_in),this}createPoi(t){let e=new Uh(this.context,t);return this.pushPoi(e),e.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(e)),e.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(e)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),e}changePoiLevelOrCollisionEnable(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),this.pushPoi(t))}removePoi(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),t.dispose())}removePoiById(t){let e=this.pois.find(n=>n.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(n=>n.options.id===t)||null}pushPoi(t){if(!t.options.collision_enable){this.pois.unshift(t);return}if(t.options.level===0){this.pois.push(t);return}for(let e=0;e<this.pois.length;e++){let n=this.pois[e];if(n.options.collision_enable&&n.options.level<=t.options.level){this.pois.splice(e,0,t);return}}this.pois.push(t)}getPoiByDeviceXy(t,e){return this.pois.filter(i=>i instanceof Uh&&i.isContain(t,e))}collisionDetection(){let t=[];this.pois.filter(n=>n.visible&&n.withinDisplayRange).forEach((n,i)=>{let{left:o,right:a,top:l,bottom:c}=n.getBox();if(i===0||!n.options.collision_enable){t.push({left:o,right:a,top:l,bottom:c}),n.parentSetVisible(!0);return}let f=t.some(g=>g.left<a&&g.right>o&&g.top<c&&g.bottom>l);n.parentSetVisible(!f),f||t.push({left:o,right:a,top:l,bottom:c})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(t=>t.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}constructor(t){super(t),this.pois=[],this.timer=new ui,this.onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})},this.registryEvent(),this.debounceCollisionDetection=(0,NY.debounce)(this.collisionDetection,10)}};var _Qt=H(w6(),1),yQt=H(Sn(),1);var up=class extends Zi{clear(){return this.pois.forEach(t=>{t.dispose()}),this.pois=[],this}createPoi(t){let e=new Di(this.context,t);return this.pushPoi(e),e}changePoiLevelOrCollisionEnable(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),this.pushPoi(t))}removePoi(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.remove(t),this.pois.splice(e,1),t.dispose())}removePoiById(t){let e=this.pois.find(n=>n.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(n=>n.options.id===t)||null}add(t){return this.children.some(e=>e.options.id===t.options.id)||(t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t))),super.add(t),this}pushPoi(t){if(t.parentSetVisible(!1),t.userData.type==="parkingSpace"&&(this.needChangeParkingSpaceVisibleByZoom=!0),this.add(t),!t.options.collision_enable){this.pois.unshift(t);return}if(t.options.level===0){this.pois.push(t);return}for(let e=0;e<this.pois.length;e++){let n=this.pois[e];if(n.options.collision_enable&&n.options.level<=t.options.level){this.pois.splice(e,0,t);return}}this.pois.push(t)}getPoiByDeviceXy(t,e){let n=new ft(t,e);return this.pois.filter(o=>o instanceof Di&&o.canSelect&&o.box.containsPoint(n))}collisionDetection(){let t=[],{camera:e}=this.context;e.updateMatrixWorld();let n=f=>f<=1&&f>=-1,i=e.projectionMatrix.clone();i.multiply(e.matrixWorldInverse);let o=e.zoom/this.context.basicZoom,a=25/30,l=Math.min(25,Math.max(1,o*a));this.pois.filter(f=>{if(f.visible){var g,m;if(!(l<=f.options.maxWeight&&l>=f.options.minWeight))return f.parentSetVisible(!1),!1;let v=f.spriteIcon?(g=f.spriteIcon)==null?void 0:g.matrixWorld:((m=f.spriteText)==null?void 0:m.matrixWorld)||f.matrixWorld,x=new G().setFromMatrixPosition(v);return x.applyMatrix4(i),f.screenPosition=x,n(x.x)&&n(x.y)&&n(x.z)?!0:(f.parentSetVisible(!1),!1)}return!1}).forEach((f,g)=>{let m=f.getBox(f.screenPosition);if(g===0||!f.options.collision_enable){t.push(m),f.parentSetVisible(!0);return}let v=t.some(x=>x.intersectsBox(m));f.parentSetVisible(!v),v||t.push(m)})}registryEvent(){this.context.addEventListener("update",this.onUpdate),this.context.addEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate),this.context.removeEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}onAddToScene(){this.registryEvent()}onRemoveFromScene(){this.unRegistryEvent()}dispose(){this.timer.dispose(),this.pois.forEach(t=>t.dispose()),this.pois.length=0,super.dispose(),this.unRegistryEvent()}constructor(t){super(t),this.pois=[],this.needChangeParkingSpaceVisibleByZoom=!1,this.timer=new ui,this.changeParkingSpaceVisibleByZoom=()=>{var e;let n=(e=this.parent)==null?void 0:e.parent;if(n&&n instanceof $a){let{clientSize:{width:i,height:o}}=this.context,{max:a,min:l}=n.box,f=Math.min(i/(a.x-l.x),o/(a.y-l.y))*(a.x-l.x)/60,g=this.context.camera.zoom>=f;this.pois.filter(m=>m.userData.type==="parkingSpace").map(m=>{m.visible=g,g||m.parentSetVisible(g)})}},this.onUpdate=()=>{this.needChangeParkingSpaceVisibleByZoom&&(this.changeParkingSpaceVisibleByZoom(),this.needChangeParkingSpaceVisibleByZoom=!1),this.timer.requestAnimationFrame(()=>{this.collisionDetection()})}}};var wQt=H(Xa(),1),TQt=H(Ge(),1);var OY=H(qs(),1);var o_=class extends Zi{createParkings(t,e,n){e===void 0&&(e=!0),this.parkingOptions=t,this.merged=e,e?(n?this.createMergedParkingByMergedElements(n):this.createMergedParking(t),t.map((i,o)=>{var a;(a=i.texts[0])==null||a.split(/[,,]/).map(l=>{this.parkingNoIndexMap.set(l,o)}),this.nodeIdIndexMap.set(i.id,o)})):this.createIndependentParking(t)}load(t,e){e===void 0&&(e=!0);var n;this.createParkings(t.elements,e,t.mergedElements),(n=t.mergedParkingTexture)!=null&&n.length?this.createMergedParkingTexture(t.mergedParkingTexture):this.createParkingTexture(t.elements)}createMergedParking(t){return At(this,null,function*(){let e=new s_(this.context,t);this.mergedParkingSpace=e,this.add(e)})}createMergedParkingByMergedElements(t){let e=new a_(this.context,t);this.mergedParkingSpace=e,this.add(e)}createIndependentParking(t){t.forEach(e=>{var n;let i=new wo(this.context,e);this.add(i),(n=e.texts[0])==null||n.split(/[,,]/).map(o=>{this.parkingNoGraphicMap.set(o,i)}),this.graphicMap.set(i.options.id,i)})}createParkingTexture(t){let e=t.filter(n=>E6[n.parkingType]).map(n=>{let i=new ft(...n.geometry.coords[0][0]),o=new ft(...n.geometry.coords[0][1]),a=new ft(...n.geometry.coords[0][2]),l=Math.min(i.distanceTo(o),o.distanceTo(a)),c=0;return l===i.distanceTo(o)?c=o.sub(i).angle()-Math.PI/2:c=a.sub(o).angle()-Math.PI/2,{uuid:n.id,iconUrl:E6[n.parkingType],name:n.texts[0],deltaHeight:(n.deltaHeight||0)+.001,airHeight:n.airHeight,height:n.height,geometry:n.geometry,opacity:n.fillOpacity,visible:!0,secondWidth:l-1,secondHeight:l-1,secondRotate:c,centerCoords:[n.center_coord_x,n.center_coord_y]}});if(e.length){let n=new lp(this.context,e);this.add(n)}}createMergedParkingTexture(t){t.map(e=>{e.iconUrl=E6[e.iconUrl];let n=new cp(this.context,e);this.add(n)})}changeParkingColor(t){this.merged?Object.keys(t).map(e=>{let n=this.parkingNoIndexMap.get(e);if(!(0,OY.isNil)(n)){var i;(i=this.mergedParkingSpace)==null||i.setParkingColorByIndex(n,t[e])}}):Object.keys(t).map(e=>{let n=this.parkingNoGraphicMap.get(e);n&&(n.options.fillColor=t[e])})}getGraphicPosition(t){if(this.merged){let e=this.parkingOptions.find(n=>n.id===t);return e?[e.center_x,e.center_y]:null}}dispose(){var t;(t=this.mergedParkingSpace)==null||t.dispose(),this.mergedParkingSpace=null,Lr(this),this.graphicMap.clear(),this.parkingNoGraphicMap.clear(),this.parkingNoIndexMap.clear(),this.nodeIdIndexMap.clear(),this.parkingOptions=[],super.dispose()}constructor(t){super(t),this.graphicMap=new Map,this.parkingNoGraphicMap=new Map,this.parkingOptions=[],this.merged=!1,this.parkingNoIndexMap=new Map,this.nodeIdIndexMap=new Map,this.mergedParkingSpace=null}};var OQt=H(Sn(),1);var u_=class extends Zi{addModels(t){let e=t.reduce((n,i)=>{let{url:o}=i;return n[o]?n[o].push(i):n[o]=[i],n},{});Object.values(e).forEach(n=>{let i=new l_(this.context,n);this.add(i)})}constructor(t){super(t)}};var ote=H(Ge(),1);function DY(r){return`${r.x}-${r.y}-${r.z}`}var ba=class{static generateLineMaterialKey({color:t,opacity:e}){return`${t}-${e}`}static createLineMaterial({color:t,opacity:e,vertexColors:n}){let i=this.generateLineMaterialKey({color:t,opacity:e,vertexColors:n});if(this.lineMaterialMap.has(i))return this.lineMaterialMap.get(i);let o=new ma({color:new ne(t).convertLinearToSRGB(),transparent:!0,opacity:e,vertexColors:n!=null?n:!1});return this.lineMaterialMap.set(i,o),o}static createMeshStandardMaterial({color:t,opacity:e}){let n=`${t}-${e}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let i=new t0({color:new ne(t).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:e,depthWrite:!0});return this.meshStandardMaterialMap.set(n,i),i}static createMeshBasicMaterial({color:t,opacity:e,vertexColors:n}){let i=`${t}-${e}-${n}`;if(this.meshBasicMaterialMap.has(i))return this.meshBasicMaterialMap.get(i);let o=new yi({color:t,transparent:!0,opacity:e,depthWrite:!0,vertexColors:n!=null?n:!1});return this.meshBasicMaterialMap.set(i,o),o}static createShaderMaterial({gradualColor:t,center:e,maxValue:n,opacity:i,direction:o,max:a,min:l}){let c=`${t.toString()}-${DY(e)}-${n}-${i}-${DY(o)}`;if(this.shaderMaterialMap.has(c))return this.shaderMaterialMap.get(c);let f=`
|
|
8171
8171
|
uniform vec3 uColor;
|
|
8172
8172
|
uniform vec3 uGradualColor;
|
|
8173
8173
|
uniform vec3 center;
|