@aibee/crc-bmap 0.12.30 → 0.12.31

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.
@@ -3823,7 +3823,7 @@ void main() {
3823
3823
  }
3824
3824
 
3825
3825
  }`,JS=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(this.texture===null){let i=new Pi,o=t.properties.get(i);o.__webglTexture=e.texture,(e.depthNear!=n.depthNear||e.depthFar!=n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}render(t,e){if(this.texture!==null){if(this.mesh===null){let n=e.cameras[0].viewport,i=new gr({extensions:{fragDepth:!0},vertexShader:v0t,fragmentShader:_0t,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new en(new Ju(20,20),i)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},QS=class extends Sn{constructor(t,e){super();let n=this,i=null,o=1,a=null,l="local-floor",c=1,f=null,g=null,m=null,v=null,x=null,S=null,w=new JS,E=e.getContextAttributes(),b=null,C=null,A=[],P=[],F=new ft,U=null,D=new Go;D.layers.enable(1),D.viewport=new Sr;let L=new Go;L.layers.enable(2),L.viewport=new Sr;let tt=[D,L],O=new $S;O.layers.enable(1),O.layers.enable(2);let V=null,W=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(dt){let jt=A[dt];return jt===void 0&&(jt=new _m,A[dt]=jt),jt.getTargetRaySpace()},this.getControllerGrip=function(dt){let jt=A[dt];return jt===void 0&&(jt=new _m,A[dt]=jt),jt.getGripSpace()},this.getHand=function(dt){let jt=A[dt];return jt===void 0&&(jt=new _m,A[dt]=jt),jt.getHandSpace()};function St(dt){let jt=P.indexOf(dt.inputSource);if(jt===-1)return;let ue=A[jt];ue!==void 0&&(ue.update(dt.inputSource,dt.frame,f||a),ue.dispatchEvent({type:dt.type,data:dt.inputSource}))}function j(){i.removeEventListener("select",St),i.removeEventListener("selectstart",St),i.removeEventListener("selectend",St),i.removeEventListener("squeeze",St),i.removeEventListener("squeezestart",St),i.removeEventListener("squeezeend",St),i.removeEventListener("end",j),i.removeEventListener("inputsourceschange",pt);for(let dt=0;dt<A.length;dt++){let jt=P[dt];jt!==null&&(P[dt]=null,A[dt].disconnect(jt))}V=null,W=null,w.reset(),t.setRenderTarget(b),x=null,v=null,m=null,i=null,C=null,he.stop(),n.isPresenting=!1,t.setPixelRatio(U),t.setSize(F.width,F.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(dt){o=dt,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(dt){l=dt,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return f||a},this.setReferenceSpace=function(dt){f=dt},this.getBaseLayer=function(){return v!==null?v:x},this.getBinding=function(){return m},this.getFrame=function(){return S},this.getSession=function(){return i},this.setSession=function(dt){return Tt(this,null,function*(){if(i=dt,i!==null){if(b=t.getRenderTarget(),i.addEventListener("select",St),i.addEventListener("selectstart",St),i.addEventListener("selectend",St),i.addEventListener("squeeze",St),i.addEventListener("squeezestart",St),i.addEventListener("squeezeend",St),i.addEventListener("end",j),i.addEventListener("inputsourceschange",pt),E.xrCompatible!==!0&&(yield e.makeXRCompatible()),U=t.getPixelRatio(),t.getSize(F),i.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let jt={antialias:i.renderState.layers===void 0?E.antialias:!0,alpha:!0,depth:E.depth,stencil:E.stencil,framebufferScaleFactor:o};x=new XRWebGLLayer(i,e,jt),i.updateRenderState({baseLayer:x}),t.setPixelRatio(1),t.setSize(x.framebufferWidth,x.framebufferHeight,!1),C=new Gl(x.framebufferWidth,x.framebufferHeight,{format:Qr,type:eh,colorSpace:t.outputColorSpace,stencilBuffer:E.stencil})}else{let jt=null,ue=null,me=null;E.depth&&(me=E.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,jt=E.stencil?cd:_f,ue=E.stencil?vf:Zc);let ae={colorFormat:e.RGBA8,depthFormat:me,scaleFactor:o};m=new XRWebGLBinding(i,e),v=m.createProjectionLayer(ae),i.updateRenderState({layers:[v]}),t.setPixelRatio(1),t.setSize(v.textureWidth,v.textureHeight,!1),C=new Gl(v.textureWidth,v.textureHeight,{format:Qr,type:eh,depthTexture:new B2(v.textureWidth,v.textureHeight,ue,void 0,void 0,void 0,void 0,void 0,void 0,jt),stencilBuffer:E.stencil,colorSpace:t.outputColorSpace,samples:E.antialias?4:0});let oe=t.properties.get(C);oe.__ignoreDepthValues=v.ignoreDepthValues}C.isXRRenderTarget=!0,this.setFoveation(c),f=null,a=yield i.requestReferenceSpace(l),he.setContext(i),he.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode};function pt(dt){for(let jt=0;jt<dt.removed.length;jt++){let ue=dt.removed[jt],me=P.indexOf(ue);me>=0&&(P[me]=null,A[me].disconnect(ue))}for(let jt=0;jt<dt.added.length;jt++){let ue=dt.added[jt],me=P.indexOf(ue);if(me===-1){for(let oe=0;oe<A.length;oe++)if(oe>=P.length){P.push(ue),me=oe;break}else if(P[oe]===null){P[oe]=ue,me=oe;break}if(me===-1)break}let ae=A[me];ae&&ae.connect(ue)}}let mt=new G,Lt=new G;function yt(dt,jt,ue){mt.setFromMatrixPosition(jt.matrixWorld),Lt.setFromMatrixPosition(ue.matrixWorld);let me=mt.distanceTo(Lt),ae=jt.projectionMatrix.elements,oe=ue.projectionMatrix.elements,Yt=ae[14]/(ae[10]-1),be=ae[14]/(ae[10]+1),ot=(ae[9]+1)/ae[5],te=(ae[9]-1)/ae[5],Dt=(ae[8]-1)/ae[0],$t=(oe[8]+1)/oe[0],kt=Yt*Dt,de=Yt*$t,ge=me/(-Dt+$t),qt=ge*-Dt;jt.matrixWorld.decompose(dt.position,dt.quaternion,dt.scale),dt.translateX(qt),dt.translateZ(ge),dt.matrixWorld.compose(dt.position,dt.quaternion,dt.scale),dt.matrixWorldInverse.copy(dt.matrixWorld).invert();let xe=Yt+ge,it=be+ge,X=kt-qt,Ut=de+(me-qt),zt=ot*be/it*xe,Et=te*be/it*xe;dt.projectionMatrix.makePerspective(X,Ut,zt,Et,xe,it),dt.projectionMatrixInverse.copy(dt.projectionMatrix).invert()}function bt(dt,jt){jt===null?dt.matrixWorld.copy(dt.matrix):dt.matrixWorld.multiplyMatrices(jt.matrixWorld,dt.matrix),dt.matrixWorldInverse.copy(dt.matrixWorld).invert()}this.updateCamera=function(dt){if(i===null)return;w.texture!==null&&(dt.near=w.depthNear,dt.far=w.depthFar),O.near=L.near=D.near=dt.near,O.far=L.far=D.far=dt.far,(V!==O.near||W!==O.far)&&(i.updateRenderState({depthNear:O.near,depthFar:O.far}),V=O.near,W=O.far,D.near=V,D.far=W,L.near=V,L.far=W,D.updateProjectionMatrix(),L.updateProjectionMatrix(),dt.updateProjectionMatrix());let jt=dt.parent,ue=O.cameras;bt(O,jt);for(let me=0;me<ue.length;me++)bt(ue[me],jt);ue.length===2?yt(O,D,L):O.projectionMatrix.copy(D.projectionMatrix),nt(dt,O,jt)};function nt(dt,jt,ue){ue===null?dt.matrix.copy(jt.matrixWorld):(dt.matrix.copy(ue.matrixWorld),dt.matrix.invert(),dt.matrix.multiply(jt.matrixWorld)),dt.matrix.decompose(dt.position,dt.quaternion,dt.scale),dt.updateMatrixWorld(!0),dt.projectionMatrix.copy(jt.projectionMatrix),dt.projectionMatrixInverse.copy(jt.projectionMatrixInverse),dt.isPerspectiveCamera&&(dt.fov=fd*2*Math.atan(1/dt.projectionMatrix.elements[5]),dt.zoom=1)}this.getCamera=function(){return O},this.getFoveation=function(){if(!(v===null&&x===null))return c},this.setFoveation=function(dt){c=dt,v!==null&&(v.fixedFoveation=dt),x!==null&&x.fixedFoveation!==void 0&&(x.fixedFoveation=dt)},this.hasDepthSensing=function(){return w.texture!==null};let Xt=null;function Vt(dt,jt){if(g=jt.getViewerPose(f||a),S=jt,g!==null){let ue=g.views;x!==null&&(t.setRenderTargetFramebuffer(C,x.framebuffer),t.setRenderTarget(C));let me=!1;ue.length!==O.cameras.length&&(O.cameras.length=0,me=!0);for(let oe=0;oe<ue.length;oe++){let Yt=ue[oe],be=null;if(x!==null)be=x.getViewport(Yt);else{let te=m.getViewSubImage(v,Yt);be=te.viewport,oe===0&&(t.setRenderTargetTextures(C,te.colorTexture,v.ignoreDepthValues?void 0:te.depthStencilTexture),t.setRenderTarget(C))}let ot=tt[oe];ot===void 0&&(ot=new Go,ot.layers.enable(oe),ot.viewport=new Sr,tt[oe]=ot),ot.matrix.fromArray(Yt.transform.matrix),ot.matrix.decompose(ot.position,ot.quaternion,ot.scale),ot.projectionMatrix.fromArray(Yt.projectionMatrix),ot.projectionMatrixInverse.copy(ot.projectionMatrix).invert(),ot.viewport.set(be.x,be.y,be.width,be.height),oe===0&&(O.matrix.copy(ot.matrix),O.matrix.decompose(O.position,O.quaternion,O.scale)),me===!0&&O.cameras.push(ot)}let ae=i.enabledFeatures;if(ae&&ae.includes("depth-sensing")){let oe=m.getDepthInformation(ue[0]);oe&&oe.isValid&&oe.texture&&w.init(t,oe,i.renderState)}}for(let ue=0;ue<A.length;ue++){let me=P[ue],ae=A[ue];me!==null&&ae!==void 0&&ae.update(me,jt,f||a)}w.render(t,O),Xt&&Xt(dt,jt),jt.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:jt}),S=null}let he=new FF;he.setAnimationLoop(Vt),this.setAnimationLoop=function(dt){Xt=dt},this.dispose=function(){}}},ff=new ga,y0t=new Ie;function x0t(r,t){function e(E,b){E.matrixAutoUpdate===!0&&E.updateMatrix(),b.value.copy(E.matrix)}function n(E,b){b.color.getRGB(E.fogColor.value,UF(r)),b.isFog?(E.fogNear.value=b.near,E.fogFar.value=b.far):b.isFogExp2&&(E.fogDensity.value=b.density)}function i(E,b,C,A,P){b.isMeshBasicMaterial||b.isMeshLambertMaterial?o(E,b):b.isMeshToonMaterial?(o(E,b),m(E,b)):b.isMeshPhongMaterial?(o(E,b),g(E,b)):b.isMeshStandardMaterial?(o(E,b),v(E,b),b.isMeshPhysicalMaterial&&x(E,b,P)):b.isMeshMatcapMaterial?(o(E,b),S(E,b)):b.isMeshDepthMaterial?o(E,b):b.isMeshDistanceMaterial?(o(E,b),w(E,b)):b.isMeshNormalMaterial?o(E,b):b.isLineBasicMaterial?(a(E,b),b.isLineDashedMaterial&&l(E,b)):b.isPointsMaterial?c(E,b,C,A):b.isSpriteMaterial?f(E,b):b.isShadowMaterial?(E.color.value.copy(b.color),E.opacity.value=b.opacity):b.isShaderMaterial&&(b.uniformsNeedUpdate=!1)}function o(E,b){E.opacity.value=b.opacity,b.color&&E.diffuse.value.copy(b.color),b.emissive&&E.emissive.value.copy(b.emissive).multiplyScalar(b.emissiveIntensity),b.map&&(E.map.value=b.map,e(b.map,E.mapTransform)),b.alphaMap&&(E.alphaMap.value=b.alphaMap,e(b.alphaMap,E.alphaMapTransform)),b.bumpMap&&(E.bumpMap.value=b.bumpMap,e(b.bumpMap,E.bumpMapTransform),E.bumpScale.value=b.bumpScale,b.side===pa&&(E.bumpScale.value*=-1)),b.normalMap&&(E.normalMap.value=b.normalMap,e(b.normalMap,E.normalMapTransform),E.normalScale.value.copy(b.normalScale),b.side===pa&&E.normalScale.value.negate()),b.displacementMap&&(E.displacementMap.value=b.displacementMap,e(b.displacementMap,E.displacementMapTransform),E.displacementScale.value=b.displacementScale,E.displacementBias.value=b.displacementBias),b.emissiveMap&&(E.emissiveMap.value=b.emissiveMap,e(b.emissiveMap,E.emissiveMapTransform)),b.specularMap&&(E.specularMap.value=b.specularMap,e(b.specularMap,E.specularMapTransform)),b.alphaTest>0&&(E.alphaTest.value=b.alphaTest);let C=t.get(b),A=C.envMap,P=C.envMapRotation;if(A&&(E.envMap.value=A,ff.copy(P),ff.x*=-1,ff.y*=-1,ff.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(ff.y*=-1,ff.z*=-1),E.envMapRotation.value.setFromMatrix4(y0t.makeRotationFromEuler(ff)),E.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,E.reflectivity.value=b.reflectivity,E.ior.value=b.ior,E.refractionRatio.value=b.refractionRatio),b.lightMap){E.lightMap.value=b.lightMap;let F=r._useLegacyLights===!0?Math.PI:1;E.lightMapIntensity.value=b.lightMapIntensity*F,e(b.lightMap,E.lightMapTransform)}b.aoMap&&(E.aoMap.value=b.aoMap,E.aoMapIntensity.value=b.aoMapIntensity,e(b.aoMap,E.aoMapTransform))}function a(E,b){E.diffuse.value.copy(b.color),E.opacity.value=b.opacity,b.map&&(E.map.value=b.map,e(b.map,E.mapTransform))}function l(E,b){E.dashSize.value=b.dashSize,E.totalSize.value=b.dashSize+b.gapSize,E.scale.value=b.scale}function c(E,b,C,A){E.diffuse.value.copy(b.color),E.opacity.value=b.opacity,E.size.value=b.size*C,E.scale.value=A*.5,b.map&&(E.map.value=b.map,e(b.map,E.uvTransform)),b.alphaMap&&(E.alphaMap.value=b.alphaMap,e(b.alphaMap,E.alphaMapTransform)),b.alphaTest>0&&(E.alphaTest.value=b.alphaTest)}function f(E,b){E.diffuse.value.copy(b.color),E.opacity.value=b.opacity,E.rotation.value=b.rotation,b.map&&(E.map.value=b.map,e(b.map,E.mapTransform)),b.alphaMap&&(E.alphaMap.value=b.alphaMap,e(b.alphaMap,E.alphaMapTransform)),b.alphaTest>0&&(E.alphaTest.value=b.alphaTest)}function g(E,b){E.specular.value.copy(b.specular),E.shininess.value=Math.max(b.shininess,1e-4)}function m(E,b){b.gradientMap&&(E.gradientMap.value=b.gradientMap)}function v(E,b){E.metalness.value=b.metalness,b.metalnessMap&&(E.metalnessMap.value=b.metalnessMap,e(b.metalnessMap,E.metalnessMapTransform)),E.roughness.value=b.roughness,b.roughnessMap&&(E.roughnessMap.value=b.roughnessMap,e(b.roughnessMap,E.roughnessMapTransform)),t.get(b).envMap&&(E.envMapIntensity.value=b.envMapIntensity)}function x(E,b,C){E.ior.value=b.ior,b.sheen>0&&(E.sheenColor.value.copy(b.sheenColor).multiplyScalar(b.sheen),E.sheenRoughness.value=b.sheenRoughness,b.sheenColorMap&&(E.sheenColorMap.value=b.sheenColorMap,e(b.sheenColorMap,E.sheenColorMapTransform)),b.sheenRoughnessMap&&(E.sheenRoughnessMap.value=b.sheenRoughnessMap,e(b.sheenRoughnessMap,E.sheenRoughnessMapTransform))),b.clearcoat>0&&(E.clearcoat.value=b.clearcoat,E.clearcoatRoughness.value=b.clearcoatRoughness,b.clearcoatMap&&(E.clearcoatMap.value=b.clearcoatMap,e(b.clearcoatMap,E.clearcoatMapTransform)),b.clearcoatRoughnessMap&&(E.clearcoatRoughnessMap.value=b.clearcoatRoughnessMap,e(b.clearcoatRoughnessMap,E.clearcoatRoughnessMapTransform)),b.clearcoatNormalMap&&(E.clearcoatNormalMap.value=b.clearcoatNormalMap,e(b.clearcoatNormalMap,E.clearcoatNormalMapTransform),E.clearcoatNormalScale.value.copy(b.clearcoatNormalScale),b.side===pa&&E.clearcoatNormalScale.value.negate())),b.iridescence>0&&(E.iridescence.value=b.iridescence,E.iridescenceIOR.value=b.iridescenceIOR,E.iridescenceThicknessMinimum.value=b.iridescenceThicknessRange[0],E.iridescenceThicknessMaximum.value=b.iridescenceThicknessRange[1],b.iridescenceMap&&(E.iridescenceMap.value=b.iridescenceMap,e(b.iridescenceMap,E.iridescenceMapTransform)),b.iridescenceThicknessMap&&(E.iridescenceThicknessMap.value=b.iridescenceThicknessMap,e(b.iridescenceThicknessMap,E.iridescenceThicknessMapTransform))),b.transmission>0&&(E.transmission.value=b.transmission,E.transmissionSamplerMap.value=C.texture,E.transmissionSamplerSize.value.set(C.width,C.height),b.transmissionMap&&(E.transmissionMap.value=b.transmissionMap,e(b.transmissionMap,E.transmissionMapTransform)),E.thickness.value=b.thickness,b.thicknessMap&&(E.thicknessMap.value=b.thicknessMap,e(b.thicknessMap,E.thicknessMapTransform)),E.attenuationDistance.value=b.attenuationDistance,E.attenuationColor.value.copy(b.attenuationColor)),b.anisotropy>0&&(E.anisotropyVector.value.set(b.anisotropy*Math.cos(b.anisotropyRotation),b.anisotropy*Math.sin(b.anisotropyRotation)),b.anisotropyMap&&(E.anisotropyMap.value=b.anisotropyMap,e(b.anisotropyMap,E.anisotropyMapTransform))),E.specularIntensity.value=b.specularIntensity,E.specularColor.value.copy(b.specularColor),b.specularColorMap&&(E.specularColorMap.value=b.specularColorMap,e(b.specularColorMap,E.specularColorMapTransform)),b.specularIntensityMap&&(E.specularIntensityMap.value=b.specularIntensityMap,e(b.specularIntensityMap,E.specularIntensityMapTransform))}function S(E,b){b.matcap&&(E.matcap.value=b.matcap)}function w(E,b){let C=t.get(b).light;E.referencePosition.value.setFromMatrixPosition(C.matrixWorld),E.nearDistance.value=C.shadow.camera.near,E.farDistance.value=C.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function E0t(r,t,e,n){let i={},o={},a=[],l=e.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(C,A){let P=A.program;n.uniformBlockBinding(C,P)}function f(C,A){let P=i[C.id];P===void 0&&(S(C),P=g(C),i[C.id]=P,C.addEventListener("dispose",E));let F=A.program;n.updateUBOMapping(C,F);let U=t.render.frame;o[C.id]!==U&&(v(C),o[C.id]=U)}function g(C){let A=m();C.__bindingPointIndex=A;let P=r.createBuffer(),F=C.__size,U=C.usage;return r.bindBuffer(r.UNIFORM_BUFFER,P),r.bufferData(r.UNIFORM_BUFFER,F,U),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,A,P),P}function m(){for(let C=0;C<l;C++)if(a.indexOf(C)===-1)return a.push(C),C;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function v(C){let A=i[C.id],P=C.uniforms,F=C.__cache;r.bindBuffer(r.UNIFORM_BUFFER,A);for(let U=0,D=P.length;U<D;U++){let L=Array.isArray(P[U])?P[U]:[P[U]];for(let tt=0,O=L.length;tt<O;tt++){let V=L[tt];if(x(V,U,tt,F)===!0){let W=V.__offset,St=Array.isArray(V.value)?V.value:[V.value],j=0;for(let pt=0;pt<St.length;pt++){let mt=St[pt],Lt=w(mt);typeof mt=="number"||typeof mt=="boolean"?(V.__data[0]=mt,r.bufferSubData(r.UNIFORM_BUFFER,W+j,V.__data)):mt.isMatrix3?(V.__data[0]=mt.elements[0],V.__data[1]=mt.elements[1],V.__data[2]=mt.elements[2],V.__data[3]=0,V.__data[4]=mt.elements[3],V.__data[5]=mt.elements[4],V.__data[6]=mt.elements[5],V.__data[7]=0,V.__data[8]=mt.elements[6],V.__data[9]=mt.elements[7],V.__data[10]=mt.elements[8],V.__data[11]=0):(mt.toArray(V.__data,j),j+=Lt.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,W,V.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function x(C,A,P,F){let U=C.value,D=A+"_"+P;if(F[D]===void 0)return typeof U=="number"||typeof U=="boolean"?F[D]=U:F[D]=U.clone(),!0;{let L=F[D];if(typeof U=="number"||typeof U=="boolean"){if(L!==U)return F[D]=U,!0}else if(L.equals(U)===!1)return L.copy(U),!0}return!1}function S(C){let A=C.uniforms,P=0,F=16;for(let D=0,L=A.length;D<L;D++){let tt=Array.isArray(A[D])?A[D]:[A[D]];for(let O=0,V=tt.length;O<V;O++){let W=tt[O],St=Array.isArray(W.value)?W.value:[W.value];for(let j=0,pt=St.length;j<pt;j++){let mt=St[j],Lt=w(mt),yt=P%F;yt!==0&&F-yt<Lt.boundary&&(P+=F-yt),W.__data=new Float32Array(Lt.storage/Float32Array.BYTES_PER_ELEMENT),W.__offset=P,P+=Lt.storage}}}let U=P%F;return U>0&&(P+=F-U),C.__size=P,C.__cache={},this}function w(C){let A={boundary:0,storage:0};return typeof C=="number"||typeof C=="boolean"?(A.boundary=4,A.storage=4):C.isVector2?(A.boundary=8,A.storage=8):C.isVector3||C.isColor?(A.boundary=16,A.storage=12):C.isVector4?(A.boundary=16,A.storage=16):C.isMatrix3?(A.boundary=48,A.storage=48):C.isMatrix4?(A.boundary=64,A.storage=64):C.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",C),A}function E(C){let A=C.target;A.removeEventListener("dispose",E);let P=a.indexOf(A.__bindingPointIndex);a.splice(P,1),r.deleteBuffer(i[A.id]),delete i[A.id],delete o[A.id]}function b(){for(let C in i)r.deleteBuffer(i[C]);a=[],i={},o={}}return{bind:c,update:f,dispose:b}}var wm=class{constructor(t={}){let{canvas:e=bit(),context:n=null,depth:i=!0,stencil:o=!0,alpha:a=!1,antialias:l=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:f=!1,powerPreference:g="default",failIfMajorPerformanceCaveat:m=!1}=t;this.isWebGLRenderer=!0;let v;n!==null?v=n.getContextAttributes().alpha:v=a;let x=new Uint32Array(4),S=new Int32Array(4),w=null,E=null,b=[],C=[];this.domElement=e,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=go,this._useLegacyLights=!1,this.toneMapping=th,this.toneMappingExposure=1;let A=this,P=!1,F=0,U=0,D=null,L=-1,tt=null,O=new Sr,V=new Sr,W=null,St=new ne(0),j=0,pt=e.width,mt=e.height,Lt=1,yt=null,bt=null,nt=new Sr(0,0,pt,mt),Xt=new Sr(0,0,pt,mt),Vt=!1,he=new B0,dt=!1,jt=!1,ue=null,me=new Ie,ae=new ft,oe=new G,Yt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function be(){return D===null?Lt:1}let ot=n;function te(rt,wt){for(let Bt=0;Bt<rt.length;Bt++){let It=rt[Bt],At=e.getContext(It,wt);if(At!==null)return At}return null}try{let rt={alpha:!0,depth:i,stencil:o,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:f,powerPreference:g,failIfMajorPerformanceCaveat:m};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Kb}`),e.addEventListener("webglcontextlost",Rt,!1),e.addEventListener("webglcontextrestored",Y,!1),e.addEventListener("webglcontextcreationerror",ht,!1),ot===null){let wt=["webgl2","webgl","experimental-webgl"];if(A.isWebGL1Renderer===!0&&wt.shift(),ot=te(wt,rt),ot===null)throw te(wt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&ot instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),ot.getShaderPrecisionFormat===void 0&&(ot.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(rt){throw console.error("THREE.WebGLRenderer: "+rt.message),rt}let Dt,$t,kt,de,ge,qt,xe,it,X,Ut,zt,Et,st,Ht,Gt,Kt,se,ut,N,z,Z,Q,$,vt;function gt(){Dt=new Fat(ot),$t=new Iat(ot,Dt,t),Dt.init($t),Q=new g0t(ot,Dt,$t),kt=new p0t(ot,Dt,$t),de=new Gat(ot),ge=new e0t,qt=new d0t(ot,Dt,kt,ge,$t,Q,de),xe=new Nat(A),it=new Uat(A),X=new Xit(ot,$t),$=new Rat(ot,Dt,X,$t),Ut=new Bat(ot,X,de,$),zt=new Wat(ot,Ut,X,de),N=new Hat(ot,$t,qt),Kt=new Lat(ge),Et=new t0t(A,xe,it,Dt,$t,$,Kt),st=new x0t(A,ge),Ht=new r0t,Gt=new l0t(Dt,$t),ut=new Cat(A,xe,it,kt,zt,v,c),se=new f0t(A,zt,$t),vt=new E0t(ot,de,$t,kt),z=new Pat(ot,Dt,de,$t),Z=new zat(ot,Dt,de,$t),de.programs=Et.programs,A.capabilities=$t,A.extensions=Dt,A.properties=ge,A.renderLists=Ht,A.shadowMap=se,A.state=kt,A.info=de}gt();let Pt=new QS(A,ot);this.xr=Pt,this.getContext=function(){return ot},this.getContextAttributes=function(){return ot.getContextAttributes()},this.forceContextLoss=function(){let rt=Dt.get("WEBGL_lose_context");rt&&rt.loseContext()},this.forceContextRestore=function(){let rt=Dt.get("WEBGL_lose_context");rt&&rt.restoreContext()},this.getPixelRatio=function(){return Lt},this.setPixelRatio=function(rt){rt!==void 0&&(Lt=rt,this.setSize(pt,mt,!1))},this.getSize=function(rt){return rt.set(pt,mt)},this.setSize=function(rt,wt,Bt=!0){if(Pt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}pt=rt,mt=wt,e.width=Math.floor(rt*Lt),e.height=Math.floor(wt*Lt),Bt===!0&&(e.style.width=rt+"px",e.style.height=wt+"px"),this.setViewport(0,0,rt,wt)},this.getDrawingBufferSize=function(rt){return rt.set(pt*Lt,mt*Lt).floor()},this.setDrawingBufferSize=function(rt,wt,Bt){pt=rt,mt=wt,Lt=Bt,e.width=Math.floor(rt*Bt),e.height=Math.floor(wt*Bt),this.setViewport(0,0,rt,wt)},this.getCurrentViewport=function(rt){return rt.copy(O)},this.getViewport=function(rt){return rt.copy(nt)},this.setViewport=function(rt,wt,Bt,It){rt.isVector4?nt.set(rt.x,rt.y,rt.z,rt.w):nt.set(rt,wt,Bt,It),kt.viewport(O.copy(nt).multiplyScalar(Lt).round())},this.getScissor=function(rt){return rt.copy(Xt)},this.setScissor=function(rt,wt,Bt,It){rt.isVector4?Xt.set(rt.x,rt.y,rt.z,rt.w):Xt.set(rt,wt,Bt,It),kt.scissor(V.copy(Xt).multiplyScalar(Lt).round())},this.getScissorTest=function(){return Vt},this.setScissorTest=function(rt){kt.setScissorTest(Vt=rt)},this.setOpaqueSort=function(rt){yt=rt},this.setTransparentSort=function(rt){bt=rt},this.getClearColor=function(rt){return rt.copy(ut.getClearColor())},this.setClearColor=function(){ut.setClearColor.apply(ut,arguments)},this.getClearAlpha=function(){return ut.getClearAlpha()},this.setClearAlpha=function(){ut.setClearAlpha.apply(ut,arguments)},this.clear=function(rt=!0,wt=!0,Bt=!0){let It=0;if(rt){let At=!1;if(D!==null){let we=D.texture.format;At=we===RF||we===CF||we===AF}if(At){let we=D.texture.type,Ee=we===eh||we===Zc||we===Qb||we===vf||we===MF||we===wF,Oe=ut.getClearColor(),Ae=ut.getClearAlpha(),Qe=Oe.r,Ue=Oe.g,Be=Oe.b;Ee?(x[0]=Qe,x[1]=Ue,x[2]=Be,x[3]=Ae,ot.clearBufferuiv(ot.COLOR,0,x)):(S[0]=Qe,S[1]=Ue,S[2]=Be,S[3]=Ae,ot.clearBufferiv(ot.COLOR,0,S))}else It|=ot.COLOR_BUFFER_BIT}wt&&(It|=ot.DEPTH_BUFFER_BIT),Bt&&(It|=ot.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ot.clear(It)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Rt,!1),e.removeEventListener("webglcontextrestored",Y,!1),e.removeEventListener("webglcontextcreationerror",ht,!1),Ht.dispose(),Gt.dispose(),ge.dispose(),xe.dispose(),it.dispose(),zt.dispose(),$.dispose(),vt.dispose(),Et.dispose(),se.dispose(),Pt.dispose(),Pt.removeEventListener("sessionstart",an),Pt.removeEventListener("sessionend",$e),ue&&(ue.dispose(),ue=null),cn.stop()};function Rt(rt){rt.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),P=!0}function Y(){console.log("THREE.WebGLRenderer: Context Restored."),P=!1;let rt=de.autoReset,wt=se.enabled,Bt=se.autoUpdate,It=se.needsUpdate,At=se.type;gt(),de.autoReset=rt,se.enabled=wt,se.autoUpdate=Bt,se.needsUpdate=It,se.type=At}function ht(rt){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",rt.statusMessage)}function at(rt){let wt=rt.target;wt.removeEventListener("dispose",at),_t(wt)}function _t(rt){Zt(rt),ge.remove(rt)}function Zt(rt){let wt=ge.get(rt).programs;wt!==void 0&&(wt.forEach(function(Bt){Et.releaseProgram(Bt)}),rt.isShaderMaterial&&Et.releaseShaderCache(rt))}this.renderBufferDirect=function(rt,wt,Bt,It,At,we){wt===null&&(wt=Yt);let Ee=At.isMesh&&At.matrixWorld.determinant()<0,Oe=xr(rt,wt,Bt,It,At);kt.setMaterial(It,Ee);let Ae=Bt.index,Qe=1;if(It.wireframe===!0){if(Ae=Ut.getWireframeAttribute(Bt),Ae===void 0)return;Qe=2}let Ue=Bt.drawRange,Be=Bt.attributes.position,vn=Ue.start*Qe,Ji=(Ue.start+Ue.count)*Qe;we!==null&&(vn=Math.max(vn,we.start*Qe),Ji=Math.min(Ji,(we.start+we.count)*Qe)),Ae!==null?(vn=Math.max(vn,0),Ji=Math.min(Ji,Ae.count)):Be!=null&&(vn=Math.max(vn,0),Ji=Math.min(Ji,Be.count));let ti=Ji-vn;if(ti<0||ti===1/0)return;$.setup(At,It,Oe,Bt,Ae);let Xo,Pr=z;if(Ae!==null&&(Xo=X.get(Ae),Pr=Z,Pr.setIndex(Xo)),At.isMesh)It.wireframe===!0?(kt.setLineWidth(It.wireframeLinewidth*be()),Pr.setMode(ot.LINES)):Pr.setMode(ot.TRIANGLES);else if(At.isLine){let Re=It.linewidth;Re===void 0&&(Re=1),kt.setLineWidth(Re*be()),At.isLineSegments?Pr.setMode(ot.LINES):At.isLineLoop?Pr.setMode(ot.LINE_LOOP):Pr.setMode(ot.LINE_STRIP)}else At.isPoints?Pr.setMode(ot.POINTS):At.isSprite&&Pr.setMode(ot.TRIANGLES);if(At.isBatchedMesh)Pr.renderMultiDraw(At._multiDrawStarts,At._multiDrawCounts,At._multiDrawCount);else if(At.isInstancedMesh)Pr.renderInstances(vn,ti,At.count);else if(Bt.isInstancedBufferGeometry){let Re=Bt._maxInstanceCount!==void 0?Bt._maxInstanceCount:1/0,ll=Math.min(Bt.instanceCount,Re);Pr.renderInstances(vn,ti,ll)}else Pr.render(vn,ti)};function ce(rt,wt,Bt){rt.transparent===!0&&rt.side===qi&&rt.forceSinglePass===!1?(rt.side=pa,rt.needsUpdate=!0,Tr(rt,wt,Bt),rt.side=ys,rt.needsUpdate=!0,Tr(rt,wt,Bt),rt.side=qi):Tr(rt,wt,Bt)}this.compile=function(rt,wt,Bt=null){Bt===null&&(Bt=rt),E=Gt.get(Bt),E.init(),C.push(E),Bt.traverseVisible(function(At){At.isLight&&At.layers.test(wt.layers)&&(E.pushLight(At),At.castShadow&&E.pushShadow(At))}),rt!==Bt&&rt.traverseVisible(function(At){At.isLight&&At.layers.test(wt.layers)&&(E.pushLight(At),At.castShadow&&E.pushShadow(At))}),E.setupLights(A._useLegacyLights);let It=new Set;return rt.traverse(function(At){let we=At.material;if(we)if(Array.isArray(we))for(let Ee=0;Ee<we.length;Ee++){let Oe=we[Ee];ce(Oe,Bt,At),It.add(Oe)}else ce(we,Bt,At),It.add(we)}),C.pop(),E=null,It},this.compileAsync=function(rt,wt,Bt=null){let It=this.compile(rt,wt,Bt);return new Promise(At=>{function we(){if(It.forEach(function(Ee){ge.get(Ee).currentProgram.isReady()&&It.delete(Ee)}),It.size===0){At(rt);return}setTimeout(we,10)}Dt.get("KHR_parallel_shader_compile")!==null?we():setTimeout(we,10)})};let Ce=null;function Pe(rt){Ce&&Ce(rt)}function an(){cn.stop()}function $e(){cn.start()}let cn=new FF;cn.setAnimationLoop(Pe),typeof self!="undefined"&&cn.setContext(self),this.setAnimationLoop=function(rt){Ce=rt,Pt.setAnimationLoop(rt),rt===null?cn.stop():cn.start()},Pt.addEventListener("sessionstart",an),Pt.addEventListener("sessionend",$e),this.render=function(rt,wt){if(wt!==void 0&&wt.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(P===!0)return;rt.matrixWorldAutoUpdate===!0&&rt.updateMatrixWorld(),wt.parent===null&&wt.matrixWorldAutoUpdate===!0&&wt.updateMatrixWorld(),Pt.enabled===!0&&Pt.isPresenting===!0&&(Pt.cameraAutoUpdate===!0&&Pt.updateCamera(wt),wt=Pt.getCamera()),rt.isScene===!0&&rt.onBeforeRender(A,rt,wt,D),E=Gt.get(rt,C.length),E.init(),C.push(E),me.multiplyMatrices(wt.projectionMatrix,wt.matrixWorldInverse),he.setFromProjectionMatrix(me),jt=this.localClippingEnabled,dt=Kt.init(this.clippingPlanes,jt),w=Ht.get(rt,b.length),w.init(),b.push(w),dn(rt,wt,0,A.sortObjects),w.finish(),A.sortObjects===!0&&w.sort(yt,bt),this.info.render.frame++,dt===!0&&Kt.beginShadows();let Bt=E.state.shadowsArray;if(se.render(Bt,rt,wt),dt===!0&&Kt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Pt.enabled===!1||Pt.isPresenting===!1||Pt.hasDepthSensing()===!1)&&ut.render(w,rt),E.setupLights(A._useLegacyLights),wt.isArrayCamera){let It=wt.cameras;for(let At=0,we=It.length;At<we;At++){let Ee=It[At];Zr(w,rt,Ee,Ee.viewport)}}else Zr(w,rt,wt);D!==null&&(qt.updateMultisampleRenderTarget(D),qt.updateRenderTargetMipmap(D)),rt.isScene===!0&&rt.onAfterRender(A,rt,wt),$.resetDefaultState(),L=-1,tt=null,C.pop(),C.length>0?E=C[C.length-1]:E=null,b.pop(),b.length>0?w=b[b.length-1]:w=null};function dn(rt,wt,Bt,It){if(rt.visible===!1)return;if(rt.layers.test(wt.layers)){if(rt.isGroup)Bt=rt.renderOrder;else if(rt.isLOD)rt.autoUpdate===!0&&rt.update(wt);else if(rt.isLight)E.pushLight(rt),rt.castShadow&&E.pushShadow(rt);else if(rt.isSprite){if(!rt.frustumCulled||he.intersectsSprite(rt)){It&&oe.setFromMatrixPosition(rt.matrixWorld).applyMatrix4(me);let Ee=zt.update(rt),Oe=rt.material;Oe.visible&&w.push(rt,Ee,Oe,Bt,oe.z,null)}}else if((rt.isMesh||rt.isLine||rt.isPoints)&&(!rt.frustumCulled||he.intersectsObject(rt))){let Ee=zt.update(rt),Oe=rt.material;if(It&&(rt.boundingSphere!==void 0?(rt.boundingSphere===null&&rt.computeBoundingSphere(),oe.copy(rt.boundingSphere.center)):(Ee.boundingSphere===null&&Ee.computeBoundingSphere(),oe.copy(Ee.boundingSphere.center)),oe.applyMatrix4(rt.matrixWorld).applyMatrix4(me)),Array.isArray(Oe)){let Ae=Ee.groups;for(let Qe=0,Ue=Ae.length;Qe<Ue;Qe++){let Be=Ae[Qe],vn=Oe[Be.materialIndex];vn&&vn.visible&&w.push(rt,Ee,vn,Bt,oe.z,Be)}}else Oe.visible&&w.push(rt,Ee,Oe,Bt,oe.z,null)}}let we=rt.children;for(let Ee=0,Oe=we.length;Ee<Oe;Ee++)dn(we[Ee],wt,Bt,It)}function Zr(rt,wt,Bt,It){let At=rt.opaque,we=rt.transmissive,Ee=rt.transparent;E.setupLightsView(Bt),dt===!0&&Kt.setGlobalState(A.clippingPlanes,Bt),we.length>0&&Ui(At,we,wt,Bt),It&&kt.viewport(O.copy(It)),At.length>0&&wr(At,wt,Bt),we.length>0&&wr(we,wt,Bt),Ee.length>0&&wr(Ee,wt,Bt),kt.buffers.depth.setTest(!0),kt.buffers.depth.setMask(!0),kt.buffers.color.setMask(!0),kt.setPolygonOffset(!1)}function Ui(rt,wt,Bt,It){if((Bt.isScene===!0?Bt.overrideMaterial:null)!==null)return;let we=$t.isWebGL2;ue===null&&(ue=new Gl(1,1,{generateMipmaps:!0,type:Dt.has("EXT_color_buffer_half_float")?F0:eh,minFilter:yu,samples:we?4:0})),A.getDrawingBufferSize(ae),we?ue.setSize(ae.x,ae.y):ue.setSize(I2(ae.x),I2(ae.y));let Ee=A.getRenderTarget();A.setRenderTarget(ue),A.getClearColor(St),j=A.getClearAlpha(),j<1&&A.setClearColor(16777215,.5),A.clear();let Oe=A.toneMapping;A.toneMapping=th,wr(rt,Bt,It),qt.updateMultisampleRenderTarget(ue),qt.updateRenderTargetMipmap(ue);let Ae=!1;for(let Qe=0,Ue=wt.length;Qe<Ue;Qe++){let Be=wt[Qe],vn=Be.object,Ji=Be.geometry,ti=Be.material,Xo=Be.group;if(ti.side===qi&&vn.layers.test(It.layers)){let Pr=ti.side;ti.side=pa,ti.needsUpdate=!0,Ge(vn,Bt,It,Ji,ti,Xo),ti.side=Pr,ti.needsUpdate=!0,Ae=!0}}Ae===!0&&(qt.updateMultisampleRenderTarget(ue),qt.updateRenderTargetMipmap(ue)),A.setRenderTarget(Ee),A.setClearColor(St,j),A.toneMapping=Oe}function wr(rt,wt,Bt){let It=wt.isScene===!0?wt.overrideMaterial:null;for(let At=0,we=rt.length;At<we;At++){let Ee=rt[At],Oe=Ee.object,Ae=Ee.geometry,Qe=It===null?Ee.material:It,Ue=Ee.group;Oe.layers.test(Bt.layers)&&Ge(Oe,wt,Bt,Ae,Qe,Ue)}}function Ge(rt,wt,Bt,It,At,we){rt.onBeforeRender(A,wt,Bt,It,At,we),rt.modelViewMatrix.multiplyMatrices(Bt.matrixWorldInverse,rt.matrixWorld),rt.normalMatrix.getNormalMatrix(rt.modelViewMatrix),At.onBeforeRender(A,wt,Bt,It,rt,we),At.transparent===!0&&At.side===qi&&At.forceSinglePass===!1?(At.side=pa,At.needsUpdate=!0,A.renderBufferDirect(Bt,wt,It,At,rt,we),At.side=ys,At.needsUpdate=!0,A.renderBufferDirect(Bt,wt,It,At,rt,we),At.side=qi):A.renderBufferDirect(Bt,wt,It,At,rt,we),rt.onAfterRender(A,wt,Bt,It,At,we)}function Tr(rt,wt,Bt){wt.isScene!==!0&&(wt=Yt);let It=ge.get(rt),At=E.state.lights,we=E.state.shadowsArray,Ee=At.state.version,Oe=Et.getParameters(rt,At.state,we,wt,Bt),Ae=Et.getProgramCacheKey(Oe),Qe=It.programs;It.environment=rt.isMeshStandardMaterial?wt.environment:null,It.fog=wt.fog,It.envMap=(rt.isMeshStandardMaterial?it:xe).get(rt.envMap||It.environment),It.envMapRotation=It.environment!==null&&rt.envMap===null?wt.environmentRotation:rt.envMapRotation,Qe===void 0&&(rt.addEventListener("dispose",at),Qe=new Map,It.programs=Qe);let Ue=Qe.get(Ae);if(Ue!==void 0){if(It.currentProgram===Ue&&It.lightsStateVersion===Ee)return Nr(rt,Oe),Ue}else Oe.uniforms=Et.getUniforms(rt),rt.onBuild(Bt,Oe,A),rt.onBeforeCompile(Oe,A),Ue=Et.acquireProgram(Oe,Ae),Qe.set(Ae,Ue),It.uniforms=Oe.uniforms;let Be=It.uniforms;return(!rt.isShaderMaterial&&!rt.isRawShaderMaterial||rt.clipping===!0)&&(Be.clippingPlanes=Kt.uniform),Nr(rt,Oe),It.needsLights=$i(rt),It.lightsStateVersion=Ee,It.needsLights&&(Be.ambientLightColor.value=At.state.ambient,Be.lightProbe.value=At.state.probe,Be.directionalLights.value=At.state.directional,Be.directionalLightShadows.value=At.state.directionalShadow,Be.spotLights.value=At.state.spot,Be.spotLightShadows.value=At.state.spotShadow,Be.rectAreaLights.value=At.state.rectArea,Be.ltc_1.value=At.state.rectAreaLTC1,Be.ltc_2.value=At.state.rectAreaLTC2,Be.pointLights.value=At.state.point,Be.pointLightShadows.value=At.state.pointShadow,Be.hemisphereLights.value=At.state.hemi,Be.directionalShadowMap.value=At.state.directionalShadowMap,Be.directionalShadowMatrix.value=At.state.directionalShadowMatrix,Be.spotShadowMap.value=At.state.spotShadowMap,Be.spotLightMatrix.value=At.state.spotLightMatrix,Be.spotLightMap.value=At.state.spotLightMap,Be.pointShadowMap.value=At.state.pointShadowMap,Be.pointShadowMatrix.value=At.state.pointShadowMatrix),It.currentProgram=Ue,It.uniformsList=null,Ue}function kr(rt){if(rt.uniformsList===null){let wt=rt.currentProgram.getUniforms();rt.uniformsList=ad.seqWithValue(wt.seq,rt.uniforms)}return rt.uniformsList}function Nr(rt,wt){let Bt=ge.get(rt);Bt.outputColorSpace=wt.outputColorSpace,Bt.batching=wt.batching,Bt.instancing=wt.instancing,Bt.instancingColor=wt.instancingColor,Bt.instancingMorph=wt.instancingMorph,Bt.skinning=wt.skinning,Bt.morphTargets=wt.morphTargets,Bt.morphNormals=wt.morphNormals,Bt.morphColors=wt.morphColors,Bt.morphTargetsCount=wt.morphTargetsCount,Bt.numClippingPlanes=wt.numClippingPlanes,Bt.numIntersection=wt.numClipIntersection,Bt.vertexAlphas=wt.vertexAlphas,Bt.vertexTangents=wt.vertexTangents,Bt.toneMapping=wt.toneMapping}function xr(rt,wt,Bt,It,At){wt.isScene!==!0&&(wt=Yt),qt.resetTextureUnits();let we=wt.fog,Ee=It.isMeshStandardMaterial?wt.environment:null,Oe=D===null?A.outputColorSpace:D.isXRRenderTarget===!0?D.texture.colorSpace:Ii,Ae=(It.isMeshStandardMaterial?it:xe).get(It.envMap||Ee),Qe=It.vertexColors===!0&&!!Bt.attributes.color&&Bt.attributes.color.itemSize===4,Ue=!!Bt.attributes.tangent&&(!!It.normalMap||It.anisotropy>0),Be=!!Bt.morphAttributes.position,vn=!!Bt.morphAttributes.normal,Ji=!!Bt.morphAttributes.color,ti=th;It.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(ti=A.toneMapping);let Xo=Bt.morphAttributes.position||Bt.morphAttributes.normal||Bt.morphAttributes.color,Pr=Xo!==void 0?Xo.length:0,Re=ge.get(It),ll=E.state.lights;if(dt===!0&&(jt===!0||rt!==tt)){let Ao=rt===tt&&It.id===L;Kt.setState(It,rt,Ao)}let _n=!1;It.version===Re.__version?(Re.needsLights&&Re.lightsStateVersion!==ll.state.version||Re.outputColorSpace!==Oe||At.isBatchedMesh&&Re.batching===!1||!At.isBatchedMesh&&Re.batching===!0||At.isInstancedMesh&&Re.instancing===!1||!At.isInstancedMesh&&Re.instancing===!0||At.isSkinnedMesh&&Re.skinning===!1||!At.isSkinnedMesh&&Re.skinning===!0||At.isInstancedMesh&&Re.instancingColor===!0&&At.instanceColor===null||At.isInstancedMesh&&Re.instancingColor===!1&&At.instanceColor!==null||At.isInstancedMesh&&Re.instancingMorph===!0&&At.morphTexture===null||At.isInstancedMesh&&Re.instancingMorph===!1&&At.morphTexture!==null||Re.envMap!==Ae||It.fog===!0&&Re.fog!==we||Re.numClippingPlanes!==void 0&&(Re.numClippingPlanes!==Kt.numPlanes||Re.numIntersection!==Kt.numIntersection)||Re.vertexAlphas!==Qe||Re.vertexTangents!==Ue||Re.morphTargets!==Be||Re.morphNormals!==vn||Re.morphColors!==Ji||Re.toneMapping!==ti||$t.isWebGL2===!0&&Re.morphTargetsCount!==Pr)&&(_n=!0):(_n=!0,Re.__version=It.version);let ws=Re.currentProgram;_n===!0&&(ws=Tr(It,wt,At));let kh=!1,nn=!1,tu=!1,Ar=ws.getUniforms(),wa=Re.uniforms;if(kt.useProgram(ws.program)&&(kh=!0,nn=!0,tu=!0),It.id!==L&&(L=It.id,nn=!0),kh||tt!==rt){Ar.setValue(ot,"projectionMatrix",rt.projectionMatrix),Ar.setValue(ot,"viewMatrix",rt.matrixWorldInverse);let Ao=Ar.map.cameraPosition;Ao!==void 0&&Ao.setValue(ot,oe.setFromMatrixPosition(rt.matrixWorld)),$t.logarithmicDepthBuffer&&Ar.setValue(ot,"logDepthBufFC",2/(Math.log(rt.far+1)/Math.LN2)),(It.isMeshPhongMaterial||It.isMeshToonMaterial||It.isMeshLambertMaterial||It.isMeshBasicMaterial||It.isMeshStandardMaterial||It.isShaderMaterial)&&Ar.setValue(ot,"isOrthographic",rt.isOrthographicCamera===!0),tt!==rt&&(tt=rt,nn=!0,tu=!0)}if(At.isSkinnedMesh){Ar.setOptional(ot,At,"bindMatrix"),Ar.setOptional(ot,At,"bindMatrixInverse");let Ao=At.skeleton;Ao&&($t.floatVertexTextures?(Ao.boneTexture===null&&Ao.computeBoneTexture(),Ar.setValue(ot,"boneTexture",Ao.boneTexture,qt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}At.isBatchedMesh&&(Ar.setOptional(ot,At,"batchingTexture"),Ar.setValue(ot,"batchingTexture",At._matricesTexture,qt));let Xe=Bt.morphAttributes;if((Xe.position!==void 0||Xe.normal!==void 0||Xe.color!==void 0&&$t.isWebGL2===!0)&&N.update(At,Bt,ws),(nn||Re.receiveShadow!==At.receiveShadow)&&(Re.receiveShadow=At.receiveShadow,Ar.setValue(ot,"receiveShadow",At.receiveShadow)),It.isMeshGouraudMaterial&&It.envMap!==null&&(wa.envMap.value=Ae,wa.flipEnvMap.value=Ae.isCubeTexture&&Ae.isRenderTargetTexture===!1?-1:1),nn&&(Ar.setValue(ot,"toneMappingExposure",A.toneMappingExposure),Re.needsLights&&To(wa,tu),we&&It.fog===!0&&st.refreshFogUniforms(wa,we),st.refreshMaterialUniforms(wa,It,Lt,mt,ue),ad.upload(ot,kr(Re),wa,qt)),It.isShaderMaterial&&It.uniformsNeedUpdate===!0&&(ad.upload(ot,kr(Re),wa,qt),It.uniformsNeedUpdate=!1),It.isSpriteMaterial&&Ar.setValue(ot,"center",At.center),Ar.setValue(ot,"modelViewMatrix",At.modelViewMatrix),Ar.setValue(ot,"normalMatrix",At.normalMatrix),Ar.setValue(ot,"modelMatrix",At.matrixWorld),It.isShaderMaterial||It.isRawShaderMaterial){let Ao=It.uniformsGroups;for(let cl=0,xc=Ao.length;cl<xc;cl++)if($t.isWebGL2){let Co=Ao[cl];vt.update(Co,ws),vt.bind(Co,ws)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return ws}function To(rt,wt){rt.ambientLightColor.needsUpdate=wt,rt.lightProbe.needsUpdate=wt,rt.directionalLights.needsUpdate=wt,rt.directionalLightShadows.needsUpdate=wt,rt.pointLights.needsUpdate=wt,rt.pointLightShadows.needsUpdate=wt,rt.spotLights.needsUpdate=wt,rt.spotLightShadows.needsUpdate=wt,rt.rectAreaLights.needsUpdate=wt,rt.hemisphereLights.needsUpdate=wt}function $i(rt){return rt.isMeshLambertMaterial||rt.isMeshToonMaterial||rt.isMeshPhongMaterial||rt.isMeshStandardMaterial||rt.isShadowMaterial||rt.isShaderMaterial&&rt.lights===!0}this.getActiveCubeFace=function(){return F},this.getActiveMipmapLevel=function(){return U},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(rt,wt,Bt){ge.get(rt.texture).__webglTexture=wt,ge.get(rt.depthTexture).__webglTexture=Bt;let It=ge.get(rt);It.__hasExternalTextures=!0,It.__autoAllocateDepthBuffer=Bt===void 0,It.__autoAllocateDepthBuffer||Dt.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),It.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(rt,wt){let Bt=ge.get(rt);Bt.__webglFramebuffer=wt,Bt.__useDefaultFramebuffer=wt===void 0},this.setRenderTarget=function(rt,wt=0,Bt=0){D=rt,F=wt,U=Bt;let It=!0,At=null,we=!1,Ee=!1;if(rt){let Ae=ge.get(rt);Ae.__useDefaultFramebuffer!==void 0?(kt.bindFramebuffer(ot.FRAMEBUFFER,null),It=!1):Ae.__webglFramebuffer===void 0?qt.setupRenderTarget(rt):Ae.__hasExternalTextures&&qt.rebindTextures(rt,ge.get(rt.texture).__webglTexture,ge.get(rt.depthTexture).__webglTexture);let Qe=rt.texture;(Qe.isData3DTexture||Qe.isDataArrayTexture||Qe.isCompressedArrayTexture)&&(Ee=!0);let Ue=ge.get(rt).__webglFramebuffer;rt.isWebGLCubeRenderTarget?(Array.isArray(Ue[wt])?At=Ue[wt][Bt]:At=Ue[wt],we=!0):$t.isWebGL2&&rt.samples>0&&qt.useMultisampledRTT(rt)===!1?At=ge.get(rt).__webglMultisampledFramebuffer:Array.isArray(Ue)?At=Ue[Bt]:At=Ue,O.copy(rt.viewport),V.copy(rt.scissor),W=rt.scissorTest}else O.copy(nt).multiplyScalar(Lt).floor(),V.copy(Xt).multiplyScalar(Lt).floor(),W=Vt;if(kt.bindFramebuffer(ot.FRAMEBUFFER,At)&&$t.drawBuffers&&It&&kt.drawBuffers(rt,At),kt.viewport(O),kt.scissor(V),kt.setScissorTest(W),we){let Ae=ge.get(rt.texture);ot.framebufferTexture2D(ot.FRAMEBUFFER,ot.COLOR_ATTACHMENT0,ot.TEXTURE_CUBE_MAP_POSITIVE_X+wt,Ae.__webglTexture,Bt)}else if(Ee){let Ae=ge.get(rt.texture),Qe=wt||0;ot.framebufferTextureLayer(ot.FRAMEBUFFER,ot.COLOR_ATTACHMENT0,Ae.__webglTexture,Bt||0,Qe)}L=-1},this.readRenderTargetPixels=function(rt,wt,Bt,It,At,we,Ee){if(!(rt&&rt.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Oe=ge.get(rt).__webglFramebuffer;if(rt.isWebGLCubeRenderTarget&&Ee!==void 0&&(Oe=Oe[Ee]),Oe){kt.bindFramebuffer(ot.FRAMEBUFFER,Oe);try{let Ae=rt.texture,Qe=Ae.format,Ue=Ae.type;if(Qe!==Qr&&Q.convert(Qe)!==ot.getParameter(ot.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Be=Ue===F0&&(Dt.has("EXT_color_buffer_half_float")||$t.isWebGL2&&Dt.has("EXT_color_buffer_float"));if(Ue!==eh&&Q.convert(Ue)!==ot.getParameter(ot.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ue===_s&&($t.isWebGL2||Dt.has("OES_texture_float")||Dt.has("WEBGL_color_buffer_float")))&&!Be){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}wt>=0&&wt<=rt.width-It&&Bt>=0&&Bt<=rt.height-At&&ot.readPixels(wt,Bt,It,At,Q.convert(Qe),Q.convert(Ue),we)}finally{let Ae=D!==null?ge.get(D).__webglFramebuffer:null;kt.bindFramebuffer(ot.FRAMEBUFFER,Ae)}}},this.copyFramebufferToTexture=function(rt,wt,Bt=0){let It=Math.pow(2,-Bt),At=Math.floor(wt.image.width*It),we=Math.floor(wt.image.height*It);qt.setTexture2D(wt,0),ot.copyTexSubImage2D(ot.TEXTURE_2D,Bt,0,0,rt.x,rt.y,At,we),kt.unbindTexture()},this.copyTextureToTexture=function(rt,wt,Bt,It=0){let At=wt.image.width,we=wt.image.height,Ee=Q.convert(Bt.format),Oe=Q.convert(Bt.type);qt.setTexture2D(Bt,0),ot.pixelStorei(ot.UNPACK_FLIP_Y_WEBGL,Bt.flipY),ot.pixelStorei(ot.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Bt.premultiplyAlpha),ot.pixelStorei(ot.UNPACK_ALIGNMENT,Bt.unpackAlignment),wt.isDataTexture?ot.texSubImage2D(ot.TEXTURE_2D,It,rt.x,rt.y,At,we,Ee,Oe,wt.image.data):wt.isCompressedTexture?ot.compressedTexSubImage2D(ot.TEXTURE_2D,It,rt.x,rt.y,wt.mipmaps[0].width,wt.mipmaps[0].height,Ee,wt.mipmaps[0].data):ot.texSubImage2D(ot.TEXTURE_2D,It,rt.x,rt.y,Ee,Oe,wt.image),It===0&&Bt.generateMipmaps&&ot.generateMipmap(ot.TEXTURE_2D),kt.unbindTexture()},this.copyTextureToTexture3D=function(rt,wt,Bt,It,At=0){if(A.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let we=Math.round(rt.max.x-rt.min.x),Ee=Math.round(rt.max.y-rt.min.y),Oe=rt.max.z-rt.min.z+1,Ae=Q.convert(It.format),Qe=Q.convert(It.type),Ue;if(It.isData3DTexture)qt.setTexture3D(It,0),Ue=ot.TEXTURE_3D;else if(It.isDataArrayTexture||It.isCompressedArrayTexture)qt.setTexture2DArray(It,0),Ue=ot.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ot.pixelStorei(ot.UNPACK_FLIP_Y_WEBGL,It.flipY),ot.pixelStorei(ot.UNPACK_PREMULTIPLY_ALPHA_WEBGL,It.premultiplyAlpha),ot.pixelStorei(ot.UNPACK_ALIGNMENT,It.unpackAlignment);let Be=ot.getParameter(ot.UNPACK_ROW_LENGTH),vn=ot.getParameter(ot.UNPACK_IMAGE_HEIGHT),Ji=ot.getParameter(ot.UNPACK_SKIP_PIXELS),ti=ot.getParameter(ot.UNPACK_SKIP_ROWS),Xo=ot.getParameter(ot.UNPACK_SKIP_IMAGES),Pr=Bt.isCompressedTexture?Bt.mipmaps[At]:Bt.image;ot.pixelStorei(ot.UNPACK_ROW_LENGTH,Pr.width),ot.pixelStorei(ot.UNPACK_IMAGE_HEIGHT,Pr.height),ot.pixelStorei(ot.UNPACK_SKIP_PIXELS,rt.min.x),ot.pixelStorei(ot.UNPACK_SKIP_ROWS,rt.min.y),ot.pixelStorei(ot.UNPACK_SKIP_IMAGES,rt.min.z),Bt.isDataTexture||Bt.isData3DTexture?ot.texSubImage3D(Ue,At,wt.x,wt.y,wt.z,we,Ee,Oe,Ae,Qe,Pr.data):It.isCompressedArrayTexture?ot.compressedTexSubImage3D(Ue,At,wt.x,wt.y,wt.z,we,Ee,Oe,Ae,Pr.data):ot.texSubImage3D(Ue,At,wt.x,wt.y,wt.z,we,Ee,Oe,Ae,Qe,Pr),ot.pixelStorei(ot.UNPACK_ROW_LENGTH,Be),ot.pixelStorei(ot.UNPACK_IMAGE_HEIGHT,vn),ot.pixelStorei(ot.UNPACK_SKIP_PIXELS,Ji),ot.pixelStorei(ot.UNPACK_SKIP_ROWS,ti),ot.pixelStorei(ot.UNPACK_SKIP_IMAGES,Xo),At===0&&It.generateMipmaps&&ot.generateMipmap(Ue),kt.unbindTexture()},this.initTexture=function(rt){rt.isCubeTexture?qt.setTextureCube(rt,0):rt.isData3DTexture?qt.setTexture3D(rt,0):rt.isDataArrayTexture||rt.isCompressedArrayTexture?qt.setTexture2DArray(rt,0):qt.setTexture2D(rt,0),kt.unbindTexture()},this.resetState=function(){F=0,U=0,D=null,kt.reset(),$.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return zl}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===eM?"display-p3":"srgb",e.unpackColorSpace=Ir.workingColorSpace===ix?"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(t){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=t}},tb=class extends wm{};tb.prototype.isWebGL1Renderer=!0;var eb=class r{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new ne(t),this.density=e}clone(){return new r(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}},nb=class r{constructor(t,e=1,n=1e3){this.isFog=!0,this.name="",this.color=new ne(t),this.near=e,this.far=n}clone(){return new r(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},Tm=class extends Se{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ga,this.environmentRotation=new ga,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),e.object.environmentRotation=this.environmentRotation.toArray(),e}},rh=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=BS,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=xu()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return OF("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,o=this.stride;i<o;i++)this.array[t+i]=e.array[n+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=xu()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=xu()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.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}}},Fs=new G,ns=class r{constructor(t,e,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)Fs.fromBufferAttribute(this,e),Fs.applyMatrix4(t),this.setXYZ(e,Fs.x,Fs.y,Fs.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Fs.fromBufferAttribute(this,e),Fs.applyNormalMatrix(t),this.setXYZ(e,Fs.x,Fs.y,Fs.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Fs.fromBufferAttribute(this,e),Fs.transformDirection(t),this.setXYZ(e,Fs.x,Fs.y,Fs.z);return this}getComponent(t,e){let n=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(n=$u(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=Hr(n,this.array)),this.data.array[t*this.data.stride+this.offset+e]=n,this}setX(t,e){return this.normalized&&(e=Hr(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=Hr(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=Hr(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=Hr(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=$u(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=$u(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=$u(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=$u(e,this.array)),e}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=Hr(e,this.array),n=Hr(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=Hr(e,this.array),n=Hr(n,this.array),i=Hr(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this}setXYZW(t,e,n,i,o){return t=t*this.data.stride+this.offset,this.normalized&&(e=Hr(e,this.array),n=Hr(n,this.array),i=Hr(i,this.array),o=Hr(o,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=o,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)e.push(this.data.array[i+o])}return new He(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new r(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)e.push(this.data.array[i+o])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},Vl=class extends ji{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ne(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},Xc,cm=new G,jp=new G,Yp=new G,Zp=new ft,hm=new ft,HF=new Ie,o2=new G,fm=new G,s2=new G,GU=new ft,MS=new ft,kU=new ft,Ha=class extends Se{constructor(t=new Vl){if(super(),this.isSprite=!0,this.type="Sprite",Xc===void 0){Xc=new qe;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new rh(e,5);Xc.setIndex([0,1,2,0,2,3]),Xc.setAttribute("position",new ns(n,3,0,!1)),Xc.setAttribute("uv",new ns(n,2,3,!1))}this.geometry=Xc,this.material=t,this.center=new ft(.5,.5)}raycast(t,e){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),jp.setFromMatrixScale(this.matrixWorld),HF.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Yp.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&jp.multiplyScalar(-Yp.z);let n=this.material.rotation,i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));let a=this.center;a2(o2.set(-.5,-.5,0),Yp,a,jp,i,o),a2(fm.set(.5,-.5,0),Yp,a,jp,i,o),a2(s2.set(.5,.5,0),Yp,a,jp,i,o),GU.set(0,0),MS.set(1,0),kU.set(1,1);let l=t.ray.intersectTriangle(o2,fm,s2,!1,cm);if(l===null&&(a2(fm.set(-.5,.5,0),Yp,a,jp,i,o),MS.set(0,1),l=t.ray.intersectTriangle(o2,s2,fm,!1,cm),l===null))return;let c=t.ray.origin.distanceTo(cm);c<t.near||c>t.far||e.push({distance:c,point:cm.clone(),uv:$c.getInterpolation(cm,o2,fm,s2,GU,MS,kU,new ft),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}};Ha.Dispose=function(){Xc.dispose(),Xc=void 0};function a2(r,t,e,n,i,o){Zp.subVectors(r,e).addScalar(.5).multiply(n),i!==void 0?(hm.x=o*Zp.x-i*Zp.y,hm.y=i*Zp.x+o*Zp.y):hm.copy(Zp),r.copy(t),r.x+=hm.x,r.y+=hm.y,r.applyMatrix4(HF)}var u2=new G,VU=new G,rb=class extends Se{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);let e=t.levels;for(let n=0,i=e.length;n<i;n++){let o=e[n];this.addLevel(o.object.clone(),o.distance,o.hysteresis)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0,n=0){e=Math.abs(e);let i=this.levels,o;for(o=0;o<i.length&&!(e<i[o].distance);o++);return i.splice(o,0,{distance:e,hysteresis:n,object:t}),this.add(t),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){let e=this.levels;if(e.length>0){let n,i;for(n=1,i=e.length;n<i;n++){let o=e[n].distance;if(e[n].object.visible&&(o-=o*e[n].hysteresis),t<o)break}return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){u2.setFromMatrixPosition(this.matrixWorld);let i=t.ray.origin.distanceTo(u2);this.getObjectForDistance(i).raycast(t,e)}}update(t){let e=this.levels;if(e.length>1){u2.setFromMatrixPosition(t.matrixWorld),VU.setFromMatrixPosition(this.matrixWorld);let n=u2.distanceTo(VU)/t.zoom;e[0].object.visible=!0;let i,o;for(i=1,o=e.length;i<o;i++){let a=e[i].distance;if(e[i].object.visible&&(a-=a*e[i].hysteresis),n>=a)e[i-1].object.visible=!1,e[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<o;i++)e[i].object.visible=!1}}toJSON(t){let e=super.toJSON(t);this.autoUpdate===!1&&(e.object.autoUpdate=!1),e.object.levels=[];let n=this.levels;for(let i=0,o=n.length;i<o;i++){let a=n[i];e.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return e}},HU=new G,WU=new Sr,qU=new Sr,S0t=new G,XU=new Ie,l2=new G,wS=new ai,jU=new Ie,TS=new da,Am=class extends en{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=TD,this.bindMatrix=new Ie,this.bindMatrixInverse=new Ie,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let t=this.geometry;this.boundingBox===null&&(this.boundingBox=new Fe),this.boundingBox.makeEmpty();let e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,l2),this.boundingBox.expandByPoint(l2)}computeBoundingSphere(){let t=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new ai),this.boundingSphere.makeEmpty();let e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,l2),this.boundingSphere.expandByPoint(l2)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){let n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),wS.copy(this.boundingSphere),wS.applyMatrix4(i),t.ray.intersectsSphere(wS)!==!1&&(jU.copy(i).invert(),TS.copy(t.ray).applyMatrix4(jU),!(this.boundingBox!==null&&TS.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(t,e,TS)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let t=new Sr,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;n<i;n++){t.fromBufferAttribute(e,n);let o=1/t.manhattanLength();o!==1/0?t.multiplyScalar(o):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===TD?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Grt?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){let n=this.skeleton,i=this.geometry;WU.fromBufferAttribute(i.attributes.skinIndex,t),qU.fromBufferAttribute(i.attributes.skinWeight,t),HU.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let o=0;o<4;o++){let a=qU.getComponent(o);if(a!==0){let l=WU.getComponent(o);XU.multiplyMatrices(n.bones[l].matrixWorld,n.boneInverses[l]),e.addScaledVector(S0t.copy(HU).applyMatrix4(XU),a)}}return e.applyMatrix4(this.bindMatrixInverse)}},dd=class extends Se{constructor(){super(),this.isBone=!0,this.type="Bone"}},mo=class extends Pi{constructor(t=null,e=1,n=1,i,o,a,l,c,f=so,g=so,m,v){super(null,a,l,c,f,g,i,o,m,v),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},YU=new Ie,b0t=new Ie,Cm=class r{constructor(t=[],e=[]){this.uuid=xu(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(t.length*16),e.length===0)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Ie)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){let n=new Ie;this.bones[t]&&n.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){let n=this.bones[t];n&&n.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){let n=this.bones[t];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){let t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let o=0,a=t.length;o<a;o++){let l=t[o]?t[o].matrixWorld:b0t;YU.multiplyMatrices(l,e[o]),YU.toArray(n,o*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new r(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(this.bones.length*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);let e=new Float32Array(t*t*4);e.set(this.boneMatrices);let n=new mo(e,t,t,Qr,_s);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){let i=this.bones[e];if(i.name===t)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,i=t.bones.length;n<i;n++){let o=t.bones[n],a=e[o];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",o),a=new dd),this.bones.push(a),this.boneInverses.push(new Ie().fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){let t={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;let e=this.bones,n=this.boneInverses;for(let i=0,o=e.length;i<o;i++){let a=e[i];t.bones.push(a.uuid);let l=n[i];t.boneInverses.push(l.toArray())}return t}},uo=class extends He{constructor(t,e,n,i=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){let t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}},Kp=new Ie,ZU=new Ie,c2=[],KU=new Fe,M0t=new Ie,pm=new en,dm=new ai,Gs=class extends en{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new uo(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,M0t)}computeBoundingBox(){let t=this.geometry,e=this.count;this.boundingBox===null&&(this.boundingBox=new Fe),t.boundingBox===null&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,Kp),KU.copy(t.boundingBox).applyMatrix4(Kp),this.boundingBox.union(KU)}computeBoundingSphere(){let t=this.geometry,e=this.count;this.boundingSphere===null&&(this.boundingSphere=new ai),t.boundingSphere===null&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,Kp),dm.copy(t.boundingSphere).applyMatrix4(Kp),this.boundingSphere.union(dm)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,t*3)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,t*16)}getMorphAt(t,e){let n=e.morphTargetInfluences,i=this.morphTexture.source.data.data,o=n.length+1,a=t*o+1;for(let l=0;l<n.length;l++)n[l]=i[a+l]}raycast(t,e){let n=this.matrixWorld,i=this.count;if(pm.geometry=this.geometry,pm.material=this.material,pm.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),dm.copy(this.boundingSphere),dm.applyMatrix4(n),t.ray.intersectsSphere(dm)!==!1))for(let o=0;o<i;o++){this.getMatrixAt(o,Kp),ZU.multiplyMatrices(n,Kp),pm.matrixWorld=ZU,pm.raycast(t,c2);for(let a=0,l=c2.length;a<l;a++){let c=c2[a];c.instanceId=o,c.object=this,e.push(c)}c2.length=0}}setColorAt(t,e){this.instanceColor===null&&(this.instanceColor=new uo(new Float32Array(this.instanceMatrix.count*3),3)),e.toArray(this.instanceColor.array,t*3)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,t*16)}setMorphAt(t,e){let n=e.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new mo(new Float32Array(i*this.count),i,this.count,TF,_s));let o=this.morphTexture.source.data.data,a=0;for(let f=0;f<n.length;f++)a+=n[f];let l=this.geometry.morphTargetsRelative?1:1-a,c=i*t;o[c]=l,o.set(n,c+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}};function w0t(r,t){return r.z-t.z}function T0t(r,t){return t.z-r.z}var ib=class{constructor(){this.index=0,this.pool=[],this.list=[]}push(t,e){let n=this.pool,i=this.list;this.index>=n.length&&n.push({start:-1,count:-1,z:-1});let o=n[this.index];i.push(o),this.index++,o.start=t.start,o.count=t.count,o.z=e}reset(){this.list.length=0,this.index=0}},$p="batchId",qc=new Ie,$U=new Ie,A0t=new Ie,JU=new Ie,AS=new B0,h2=new Fe,pf=new ai,gm=new G,CS=new ib,ms=new en,f2=[];function C0t(r,t,e=0){let n=t.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==t.array.constructor){let i=r.count;for(let o=0;o<i;o++)for(let a=0;a<n;a++)t.setComponent(o+e,a,r.getComponent(o,a))}else t.array.set(r.array,e*n);t.needsUpdate=!0}var ob=class extends en{get maxGeometryCount(){return this._maxGeometryCount}constructor(t,e,n=e*2,i){super(new qe,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawRanges=[],this._reservedRanges=[],this._visibility=[],this._active=[],this._bounds=[],this._maxGeometryCount=t,this._maxVertexCount=e,this._maxIndexCount=n,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(t),this._multiDrawStarts=new Int32Array(t),this._multiDrawCount=0,this._visibilityChanged=!0,this._matricesTexture=null,this._initMatricesTexture()}_initMatricesTexture(){let t=Math.sqrt(this._maxGeometryCount*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);let e=new Float32Array(t*t*4),n=new mo(e,t,t,Qr,_s);this._matricesTexture=n}_initializeGeometry(t){let e=this.geometry,n=this._maxVertexCount,i=this._maxGeometryCount,o=this._maxIndexCount;if(this._geometryInitialized===!1){for(let l in t.attributes){let c=t.getAttribute(l),{array:f,itemSize:g,normalized:m}=c,v=new f.constructor(n*g),x=new c.constructor(v,g,m);x.setUsage(c.usage),e.setAttribute(l,x)}if(t.getIndex()!==null){let l=n>65536?new Uint32Array(o):new Uint16Array(o);e.setIndex(new He(l,1))}let a=i>65536?new Uint32Array(n):new Uint16Array(n);e.setAttribute($p,new He(a,1)),this._geometryInitialized=!0}}_validateGeometry(t){if(t.getAttribute($p))throw new Error(`BatchedMesh: Geometry cannot use attribute "${$p}"`);let e=this.geometry;if(!!t.getIndex()!=!!e.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(let n in e.attributes){if(n===$p)continue;if(!t.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);let i=t.getAttribute(n),o=e.getAttribute(n);if(i.itemSize!==o.itemSize||i.normalized!==o.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Fe);let t=this._geometryCount,e=this.boundingBox,n=this._active;e.makeEmpty();for(let i=0;i<t;i++)n[i]!==!1&&(this.getMatrixAt(i,qc),this.getBoundingBoxAt(i,h2).applyMatrix4(qc),e.union(h2))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ai);let t=this._geometryCount,e=this.boundingSphere,n=this._active;e.makeEmpty();for(let i=0;i<t;i++)n[i]!==!1&&(this.getMatrixAt(i,qc),this.getBoundingSphereAt(i,pf).applyMatrix4(qc),e.union(pf))}addGeometry(t,e=-1,n=-1){if(this._initializeGeometry(t),this._validateGeometry(t),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");let i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1},o=null,a=this._reservedRanges,l=this._drawRanges,c=this._bounds;this._geometryCount!==0&&(o=a[a.length-1]),e===-1?i.vertexCount=t.getAttribute("position").count:i.vertexCount=e,o===null?i.vertexStart=0:i.vertexStart=o.vertexStart+o.vertexCount;let f=t.getIndex(),g=f!==null;if(g&&(n===-1?i.indexCount=f.count:i.indexCount=n,o===null?i.indexStart=0:i.indexStart=o.indexStart+o.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");let m=this._visibility,v=this._active,x=this._matricesTexture,S=this._matricesTexture.image.data;m.push(!0),v.push(!0);let w=this._geometryCount;this._geometryCount++,A0t.toArray(S,w*16),x.needsUpdate=!0,a.push(i),l.push({start:g?i.indexStart:i.vertexStart,count:-1}),c.push({boxInitialized:!1,box:new Fe,sphereInitialized:!1,sphere:new ai});let E=this.geometry.getAttribute($p);for(let b=0;b<i.vertexCount;b++)E.setX(i.vertexStart+b,w);return E.needsUpdate=!0,this.setGeometryAt(w,t),w}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);let n=this.geometry,i=n.getIndex()!==null,o=n.getIndex(),a=e.getIndex(),l=this._reservedRanges[t];if(i&&a.count>l.indexCount||e.attributes.position.count>l.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");let c=l.vertexStart,f=l.vertexCount;for(let x in n.attributes){if(x===$p)continue;let S=e.getAttribute(x),w=n.getAttribute(x);C0t(S,w,c);let E=S.itemSize;for(let b=S.count,C=f;b<C;b++){let A=c+b;for(let P=0;P<E;P++)w.setComponent(A,P,0)}w.needsUpdate=!0}if(i){let x=l.indexStart;for(let S=0;S<a.count;S++)o.setX(x+S,c+a.getX(S));for(let S=a.count,w=l.indexCount;S<w;S++)o.setX(x+S,c);o.needsUpdate=!0}let g=this._bounds[t];e.boundingBox!==null?(g.box.copy(e.boundingBox),g.boxInitialized=!0):g.boxInitialized=!1,e.boundingSphere!==null?(g.sphere.copy(e.boundingSphere),g.sphereInitialized=!0):g.sphereInitialized=!1;let m=this._drawRanges[t],v=e.getAttribute("position");return m.count=i?a.count:v.count,this._visibilityChanged=!0,t}deleteGeometry(t){let e=this._active;return t>=e.length||e[t]===!1?this:(e[t]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(t,e){if(this._active[t]===!1)return null;let i=this._bounds[t],o=i.box,a=this.geometry;if(i.boxInitialized===!1){o.makeEmpty();let l=a.index,c=a.attributes.position,f=this._drawRanges[t];for(let g=f.start,m=f.start+f.count;g<m;g++){let v=g;l&&(v=l.getX(v)),o.expandByPoint(gm.fromBufferAttribute(c,v))}i.boxInitialized=!0}return e.copy(o),e}getBoundingSphereAt(t,e){if(this._active[t]===!1)return null;let i=this._bounds[t],o=i.sphere,a=this.geometry;if(i.sphereInitialized===!1){o.makeEmpty(),this.getBoundingBoxAt(t,h2),h2.getCenter(o.center);let l=a.index,c=a.attributes.position,f=this._drawRanges[t],g=0;for(let m=f.start,v=f.start+f.count;m<v;m++){let x=m;l&&(x=l.getX(x)),gm.fromBufferAttribute(c,x),g=Math.max(g,o.center.distanceToSquared(gm))}o.radius=Math.sqrt(g),i.sphereInitialized=!0}return e.copy(o),e}setMatrixAt(t,e){let n=this._active,i=this._matricesTexture,o=this._matricesTexture.image.data,a=this._geometryCount;return t>=a||n[t]===!1?this:(e.toArray(o,t*16),i.needsUpdate=!0,this)}getMatrixAt(t,e){let n=this._active,i=this._matricesTexture.image.data,o=this._geometryCount;return t>=o||n[t]===!1?null:e.fromArray(i,t*16)}setVisibleAt(t,e){let n=this._visibility,i=this._active,o=this._geometryCount;return t>=o||i[t]===!1||n[t]===e?this:(n[t]=e,this._visibilityChanged=!0,this)}getVisibleAt(t){let e=this._visibility,n=this._active,i=this._geometryCount;return t>=i||n[t]===!1?!1:e[t]}raycast(t,e){let n=this._visibility,i=this._active,o=this._drawRanges,a=this._geometryCount,l=this.matrixWorld,c=this.geometry;ms.material=this.material,ms.geometry.index=c.index,ms.geometry.attributes=c.attributes,ms.geometry.boundingBox===null&&(ms.geometry.boundingBox=new Fe),ms.geometry.boundingSphere===null&&(ms.geometry.boundingSphere=new ai);for(let f=0;f<a;f++){if(!n[f]||!i[f])continue;let g=o[f];ms.geometry.setDrawRange(g.start,g.count),this.getMatrixAt(f,ms.matrixWorld).premultiply(l),this.getBoundingBoxAt(f,ms.geometry.boundingBox),this.getBoundingSphereAt(f,ms.geometry.boundingSphere),ms.raycast(t,f2);for(let m=0,v=f2.length;m<v;m++){let x=f2[m];x.object=this,x.batchId=f,e.push(x)}f2.length=0}ms.material=null,ms.geometry.index=null,ms.geometry.attributes={},ms.geometry.setDrawRange(0,1/0)}copy(t){return super.copy(t),this.geometry=t.geometry.clone(),this.perObjectFrustumCulled=t.perObjectFrustumCulled,this.sortObjects=t.sortObjects,this.boundingBox=t.boundingBox!==null?t.boundingBox.clone():null,this.boundingSphere=t.boundingSphere!==null?t.boundingSphere.clone():null,this._drawRanges=t._drawRanges.map(e=>Mp({},e)),this._reservedRanges=t._reservedRanges.map(e=>Mp({},e)),this._visibility=t._visibility.slice(),this._active=t._active.slice(),this._bounds=t._bounds.map(e=>({boxInitialized:e.boxInitialized,box:e.box.clone(),sphereInitialized:e.sphereInitialized,sphere:e.sphere.clone()})),this._maxGeometryCount=t._maxGeometryCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._geometryCount=t._geometryCount,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(t,e,n,i,o){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let a=i.getIndex(),l=a===null?1:a.array.BYTES_PER_ELEMENT,c=this._active,f=this._visibility,g=this._multiDrawStarts,m=this._multiDrawCounts,v=this._drawRanges,x=this.perObjectFrustumCulled;x&&(JU.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),AS.setFromProjectionMatrix(JU,t.coordinateSystem));let S=0;if(this.sortObjects){$U.copy(this.matrixWorld).invert(),gm.setFromMatrixPosition(n.matrixWorld).applyMatrix4($U);for(let b=0,C=f.length;b<C;b++)if(f[b]&&c[b]){this.getMatrixAt(b,qc),this.getBoundingSphereAt(b,pf).applyMatrix4(qc);let A=!1;if(x&&(A=!AS.intersectsSphere(pf)),!A){let P=gm.distanceTo(pf.center);CS.push(v[b],P)}}let w=CS.list,E=this.customSort;E===null?w.sort(o.transparent?T0t:w0t):E.call(this,w,n);for(let b=0,C=w.length;b<C;b++){let A=w[b];g[S]=A.start*l,m[S]=A.count,S++}CS.reset()}else for(let w=0,E=f.length;w<E;w++)if(f[w]&&c[w]){let b=!1;if(x&&(this.getMatrixAt(w,qc),this.getBoundingSphereAt(w,pf).applyMatrix4(qc),b=!AS.intersectsSphere(pf)),!b){let C=v[w];g[S]=C.start*l,m[S]=C.count,S++}}this._multiDrawCount=S,this._visibilityChanged=!1}onBeforeShadow(t,e,n,i,o,a){this.onBeforeRender(t,null,i,o,a)}},ma=class extends ji{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ne(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}},QU=new G,tF=new G,eF=new Ie,RS=new da,p2=new ai,Hl=class extends Se{constructor(t=new qe,e=new ma){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,n=[0];for(let i=1,o=e.count;i<o;i++)QU.fromBufferAttribute(e,i-1),tF.fromBufferAttribute(e,i),n[i]=n[i-1],n[i]+=QU.distanceTo(tF);t.setAttribute("lineDistance",new We(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){let n=this.geometry,i=this.matrixWorld,o=t.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),p2.copy(n.boundingSphere),p2.applyMatrix4(i),p2.radius+=o,t.ray.intersectsSphere(p2)===!1)return;eF.copy(i).invert(),RS.copy(t.ray).applyMatrix4(eF);let l=o/((this.scale.x+this.scale.y+this.scale.z)/3),c=l*l,f=new G,g=new G,m=new G,v=new G,x=this.isLineSegments?2:1,S=n.index,E=n.attributes.position;if(S!==null){let b=Math.max(0,a.start),C=Math.min(S.count,a.start+a.count);for(let A=b,P=C-1;A<P;A+=x){let F=S.getX(A),U=S.getX(A+1);if(f.fromBufferAttribute(E,F),g.fromBufferAttribute(E,U),RS.distanceSqToSegment(f,g,v,m)>c)continue;v.applyMatrix4(this.matrixWorld);let L=t.ray.origin.distanceTo(v);L<t.near||L>t.far||e.push({distance:L,point:m.clone().applyMatrix4(this.matrixWorld),index:A,face:null,faceIndex:null,object:this})}}else{let b=Math.max(0,a.start),C=Math.min(E.count,a.start+a.count);for(let A=b,P=C-1;A<P;A+=x){if(f.fromBufferAttribute(E,A),g.fromBufferAttribute(E,A+1),RS.distanceSqToSegment(f,g,v,m)>c)continue;v.applyMatrix4(this.matrixWorld);let U=t.ray.origin.distanceTo(v);U<t.near||U>t.far||e.push({distance:U,point:m.clone().applyMatrix4(this.matrixWorld),index:A,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,a=i.length;o<a;o++){let l=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=o}}}}},nF=new G,rF=new G,Yi=class extends Hl{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,n=[];for(let i=0,o=e.count;i<o;i+=2)nF.fromBufferAttribute(e,i),rF.fromBufferAttribute(e,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+nF.distanceTo(rF);t.setAttribute("lineDistance",new We(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},Rm=class extends Hl{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}},gd=class extends ji{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ne(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},iF=new Ie,sb=new da,d2=new ai,g2=new G,Pm=class extends Se{constructor(t=new qe,e=new gd){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){let n=this.geometry,i=this.matrixWorld,o=t.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),d2.copy(n.boundingSphere),d2.applyMatrix4(i),d2.radius+=o,t.ray.intersectsSphere(d2)===!1)return;iF.copy(i).invert(),sb.copy(t.ray).applyMatrix4(iF);let l=o/((this.scale.x+this.scale.y+this.scale.z)/3),c=l*l,f=n.index,m=n.attributes.position;if(f!==null){let v=Math.max(0,a.start),x=Math.min(f.count,a.start+a.count);for(let S=v,w=x;S<w;S++){let E=f.getX(S);g2.fromBufferAttribute(m,E),oF(g2,E,c,i,t,e,this)}}else{let v=Math.max(0,a.start),x=Math.min(m.count,a.start+a.count);for(let S=v,w=x;S<w;S++)g2.fromBufferAttribute(m,S),oF(g2,S,c,i,t,e,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,a=i.length;o<a;o++){let l=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=o}}}}};function oF(r,t,e,n,i,o,a){let l=sb.distanceSqToPoint(r);if(l<e){let c=new G;sb.closestPointToPoint(r,c),c.applyMatrix4(n);let f=i.ray.origin.distanceTo(c);if(f<i.near||f>i.far)return;o.push({distance:f,distanceToRay:Math.sqrt(l),point:c,index:t,face:null,object:a})}}var Su=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){let n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){let e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){let e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){let t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let e=[],n,i=this.getPoint(0),o=0;e.push(0);for(let a=1;a<=t;a++)n=this.getPoint(a/t),o+=n.distanceTo(i),e.push(o),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){let n=this.getLengths(),i=0,o=n.length,a;e?a=e:a=t*n[o-1];let l=0,c=o-1,f;for(;l<=c;)if(i=Math.floor(l+(c-l)/2),f=n[i]-a,f<0)l=i+1;else if(f>0)c=i-1;else{c=i;break}if(i=c,n[i]===a)return i/(o-1);let g=n[i],v=n[i+1]-g,x=(a-g)/v;return(i+x)/(o-1)}getTangent(t,e){let i=t-1e-4,o=t+1e-4;i<0&&(i=0),o>1&&(o=1);let a=this.getPoint(i),l=this.getPoint(o),c=e||(a.isVector2?new ft:new G);return c.copy(l).sub(a).normalize(),c}getTangentAt(t,e){let n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){let n=new G,i=[],o=[],a=[],l=new G,c=new Ie;for(let x=0;x<=t;x++){let S=x/t;i[x]=this.getTangentAt(S,new G)}o[0]=new G,a[0]=new G;let f=Number.MAX_VALUE,g=Math.abs(i[0].x),m=Math.abs(i[0].y),v=Math.abs(i[0].z);g<=f&&(f=g,n.set(1,0,0)),m<=f&&(f=m,n.set(0,1,0)),v<=f&&n.set(0,0,1),l.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],l),a[0].crossVectors(i[0],o[0]);for(let x=1;x<=t;x++){if(o[x]=o[x-1].clone(),a[x]=a[x-1].clone(),l.crossVectors(i[x-1],i[x]),l.length()>Number.EPSILON){l.normalize();let S=Math.acos(Ri(i[x-1].dot(i[x]),-1,1));o[x].applyMatrix4(c.makeRotationAxis(l,S))}a[x].crossVectors(i[x],o[x])}if(e===!0){let x=Math.acos(Ri(o[0].dot(o[t]),-1,1));x/=t,i[0].dot(l.crossVectors(o[0],o[t]))>0&&(x=-x);for(let S=1;S<=t;S++)o[S].applyMatrix4(c.makeRotationAxis(i[S],x*S)),a[S].crossVectors(i[S],o[S])}return{tangents:i,normals:o,binormals:a}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}},Im=class extends Su{constructor(t=0,e=0,n=1,i=1,o=0,a=Math.PI*2,l=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=a,this.aClockwise=l,this.aRotation=c}getPoint(t,e=new ft){let n=e,i=Math.PI*2,o=this.aEndAngle-this.aStartAngle,a=Math.abs(o)<Number.EPSILON;for(;o<0;)o+=i;for(;o>i;)o-=i;o<Number.EPSILON&&(a?o=0:o=i),this.aClockwise===!0&&!a&&(o===i?o=-i:o=o-i);let l=this.aStartAngle+t*o,c=this.aX+this.xRadius*Math.cos(l),f=this.aY+this.yRadius*Math.sin(l);if(this.aRotation!==0){let g=Math.cos(this.aRotation),m=Math.sin(this.aRotation),v=c-this.aX,x=f-this.aY;c=v*g-x*m+this.aX,f=v*m+x*g+this.aY}return n.set(c,f)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){let t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}},ab=class extends Im{constructor(t,e,n,i,o,a){super(t,e,n,n,i,o,a),this.isArcCurve=!0,this.type="ArcCurve"}};function iM(){let r=0,t=0,e=0,n=0;function i(o,a,l,c){r=o,t=l,e=-3*o+3*a-2*l-c,n=2*o-2*a+l+c}return{initCatmullRom:function(o,a,l,c,f){i(a,l,f*(l-o),f*(c-a))},initNonuniformCatmullRom:function(o,a,l,c,f,g,m){let v=(a-o)/f-(l-o)/(f+g)+(l-a)/g,x=(l-a)/g-(c-a)/(g+m)+(c-l)/m;v*=g,x*=g,i(a,l,v,x)},calc:function(o){let a=o*o,l=a*o;return r+t*o+e*a+n*l}}}var m2=new G,PS=new iM,IS=new iM,LS=new iM,ub=class extends Su{constructor(t=[],e=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(t,e=new G){let n=e,i=this.points,o=i.length,a=(o-(this.closed?0:1))*t,l=Math.floor(a),c=a-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:c===0&&l===o-1&&(l=o-2,c=1);let f,g;this.closed||l>0?f=i[(l-1)%o]:(m2.subVectors(i[0],i[1]).add(i[0]),f=m2);let m=i[l%o],v=i[(l+1)%o];if(this.closed||l+2<o?g=i[(l+2)%o]:(m2.subVectors(i[o-1],i[o-2]).add(i[o-1]),g=m2),this.curveType==="centripetal"||this.curveType==="chordal"){let x=this.curveType==="chordal"?.5:.25,S=Math.pow(f.distanceToSquared(m),x),w=Math.pow(m.distanceToSquared(v),x),E=Math.pow(v.distanceToSquared(g),x);w<1e-4&&(w=1),S<1e-4&&(S=w),E<1e-4&&(E=w),PS.initNonuniformCatmullRom(f.x,m.x,v.x,g.x,S,w,E),IS.initNonuniformCatmullRom(f.y,m.y,v.y,g.y,S,w,E),LS.initNonuniformCatmullRom(f.z,m.z,v.z,g.z,S,w,E)}else this.curveType==="catmullrom"&&(PS.initCatmullRom(f.x,m.x,v.x,g.x,this.tension),IS.initCatmullRom(f.y,m.y,v.y,g.y,this.tension),LS.initCatmullRom(f.z,m.z,v.z,g.z,this.tension));return n.set(PS.calc(c),IS.calc(c),LS.calc(c)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){let i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let i=t.points[e];this.points.push(new G().fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}};function sF(r,t,e,n,i){let o=(n-t)*.5,a=(i-e)*.5,l=r*r,c=r*l;return(2*e-2*n+o+a)*c+(-3*e+3*n-2*o-a)*l+o*r+e}function R0t(r,t){let e=1-r;return e*e*t}function P0t(r,t){return 2*(1-r)*r*t}function I0t(r,t){return r*r*t}function ym(r,t,e,n){return R0t(r,t)+P0t(r,e)+I0t(r,n)}function L0t(r,t){let e=1-r;return e*e*e*t}function N0t(r,t){let e=1-r;return 3*e*e*r*t}function O0t(r,t){return 3*(1-r)*r*r*t}function D0t(r,t){return r*r*r*t}function xm(r,t,e,n,i){return L0t(r,t)+N0t(r,e)+O0t(r,n)+D0t(r,i)}var k2=class extends Su{constructor(t=new ft,e=new ft,n=new ft,i=new ft){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new ft){let n=e,i=this.v0,o=this.v1,a=this.v2,l=this.v3;return n.set(xm(t,i.x,o.x,a.x,l.x),xm(t,i.y,o.y,a.y,l.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},lb=class extends Su{constructor(t=new G,e=new G,n=new G,i=new G){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new G){let n=e,i=this.v0,o=this.v1,a=this.v2,l=this.v3;return n.set(xm(t,i.x,o.x,a.x,l.x),xm(t,i.y,o.y,a.y,l.y),xm(t,i.z,o.z,a.z,l.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},V2=class extends Su{constructor(t=new ft,e=new ft){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new ft){let n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new ft){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},cb=class extends Su{constructor(t=new G,e=new G){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new G){let n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new G){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},H2=class extends Su{constructor(t=new ft,e=new ft,n=new ft){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new ft){let n=e,i=this.v0,o=this.v1,a=this.v2;return n.set(ym(t,i.x,o.x,a.x),ym(t,i.y,o.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},W2=class extends Su{constructor(t=new G,e=new G,n=new G){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new G){let n=e,i=this.v0,o=this.v1,a=this.v2;return n.set(ym(t,i.x,o.x,a.x),ym(t,i.y,o.y,a.y),ym(t,i.z,o.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},q2=class extends Su{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new ft){let n=e,i=this.points,o=(i.length-1)*t,a=Math.floor(o),l=o-a,c=i[a===0?a:a-1],f=i[a],g=i[a>i.length-2?i.length-1:a+1],m=i[a>i.length-3?i.length-1:a+2];return n.set(sF(l,c.x,f.x,g.x,m.x),sF(l,c.y,f.y,g.y,m.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let i=t.points[e];this.points.push(i.clone())}return this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){let i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let i=t.points[e];this.points.push(new ft().fromArray(i))}return this}},X2=Object.freeze({__proto__:null,ArcCurve:ab,CatmullRomCurve3:ub,CubicBezierCurve:k2,CubicBezierCurve3:lb,EllipseCurve:Im,LineCurve:V2,LineCurve3:cb,QuadraticBezierCurve:H2,QuadraticBezierCurve3:W2,SplineCurve:q2}),hb=class extends Su{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){let t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){let n=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new X2[n](e,t))}return this}getPoint(t,e){let n=t*this.getLength(),i=this.getCurveLengths(),o=0;for(;o<i.length;){if(i[o]>=n){let a=i[o]-n,l=this.curves[o],c=l.getLength(),f=c===0?0:1-a/c;return l.getPointAt(f,e)}o++}return null}getLength(){let t=this.getCurveLengths();return t[t.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 t=[],e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){let e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){let e=[],n;for(let i=0,o=this.curves;i<o.length;i++){let a=o[i],l=a.isEllipseCurve?t*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,c=a.getPoints(l);for(let f=0;f<c.length;f++){let g=c[f];n&&n.equals(g)||(e.push(g),n=g)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){let i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){let t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){let i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){let i=t.curves[e];this.curves.push(new X2[i.type]().fromJSON(i))}return this}},Sf=class extends hb{constructor(t){super(),this.type="Path",this.currentPoint=new ft,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){let n=new V2(this.currentPoint.clone(),new ft(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){let o=new H2(this.currentPoint.clone(),new ft(t,e),new ft(n,i));return this.curves.push(o),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,o,a){let l=new k2(this.currentPoint.clone(),new ft(t,e),new ft(n,i),new ft(o,a));return this.curves.push(l),this.currentPoint.set(o,a),this}splineThru(t){let e=[this.currentPoint.clone()].concat(t),n=new q2(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,o,a){let l=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(t+l,e+c,n,i,o,a),this}absarc(t,e,n,i,o,a){return this.absellipse(t,e,n,n,i,o,a),this}ellipse(t,e,n,i,o,a,l,c){let f=this.currentPoint.x,g=this.currentPoint.y;return this.absellipse(t+f,e+g,n,i,o,a,l,c),this}absellipse(t,e,n,i,o,a,l,c){let f=new Im(t,e,n,i,o,a,l,c);if(this.curves.length>0){let m=f.getPoint(0);m.equals(this.currentPoint)||this.lineTo(m.x,m.y)}this.curves.push(f);let g=f.getPoint(1);return this.currentPoint.copy(g),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}},j2=class r extends qe{constructor(t=[new ft(0,-.5),new ft(.5,0),new ft(0,.5)],e=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=Ri(i,0,Math.PI*2);let o=[],a=[],l=[],c=[],f=[],g=1/e,m=new G,v=new ft,x=new G,S=new G,w=new G,E=0,b=0;for(let C=0;C<=t.length-1;C++)switch(C){case 0:E=t[C+1].x-t[C].x,b=t[C+1].y-t[C].y,x.x=b*1,x.y=-E,x.z=b*0,w.copy(x),x.normalize(),c.push(x.x,x.y,x.z);break;case t.length-1:c.push(w.x,w.y,w.z);break;default:E=t[C+1].x-t[C].x,b=t[C+1].y-t[C].y,x.x=b*1,x.y=-E,x.z=b*0,S.copy(x),x.x+=w.x,x.y+=w.y,x.z+=w.z,x.normalize(),c.push(x.x,x.y,x.z),w.copy(S)}for(let C=0;C<=e;C++){let A=n+C*g*i,P=Math.sin(A),F=Math.cos(A);for(let U=0;U<=t.length-1;U++){m.x=t[U].x*P,m.y=t[U].y,m.z=t[U].x*F,a.push(m.x,m.y,m.z),v.x=C/e,v.y=U/(t.length-1),l.push(v.x,v.y);let D=c[3*U+0]*P,L=c[3*U+1],tt=c[3*U+0]*F;f.push(D,L,tt)}}for(let C=0;C<e;C++)for(let A=0;A<t.length-1;A++){let P=A+C*t.length,F=P,U=P+t.length,D=P+t.length+1,L=P+1;o.push(F,U,L),o.push(D,L,U)}this.setIndex(o),this.setAttribute("position",new We(a,3)),this.setAttribute("uv",new We(l,2)),this.setAttribute("normal",new We(f,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.points,t.segments,t.phiStart,t.phiLength)}},fb=class r extends j2{constructor(t=1,e=1,n=4,i=8){let o=new Sf;o.absarc(0,-e/2,t,Math.PI*1.5,0),o.absarc(0,e/2,t,0,Math.PI*.5),super(o.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:t,length:e,capSegments:n,radialSegments:i}}static fromJSON(t){return new r(t.radius,t.length,t.capSegments,t.radialSegments)}},pb=class r extends qe{constructor(t=1,e=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},e=Math.max(3,e);let o=[],a=[],l=[],c=[],f=new G,g=new ft;a.push(0,0,0),l.push(0,0,1),c.push(.5,.5);for(let m=0,v=3;m<=e;m++,v+=3){let x=n+m/e*i;f.x=t*Math.cos(x),f.y=t*Math.sin(x),a.push(f.x,f.y,f.z),l.push(0,0,1),g.x=(a[v]/t+1)/2,g.y=(a[v+1]/t+1)/2,c.push(g.x,g.y)}for(let m=1;m<=e;m++)o.push(m,m+1,0);this.setIndex(o),this.setAttribute("position",new We(a,3)),this.setAttribute("normal",new We(l,3)),this.setAttribute("uv",new We(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.radius,t.segments,t.thetaStart,t.thetaLength)}},Y2=class r extends qe{constructor(t=1,e=1,n=1,i=32,o=1,a=!1,l=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:o,openEnded:a,thetaStart:l,thetaLength:c};let f=this;i=Math.floor(i),o=Math.floor(o);let g=[],m=[],v=[],x=[],S=0,w=[],E=n/2,b=0;C(),a===!1&&(t>0&&A(!0),e>0&&A(!1)),this.setIndex(g),this.setAttribute("position",new We(m,3)),this.setAttribute("normal",new We(v,3)),this.setAttribute("uv",new We(x,2));function C(){let P=new G,F=new G,U=0,D=(e-t)/n;for(let L=0;L<=o;L++){let tt=[],O=L/o,V=O*(e-t)+t;for(let W=0;W<=i;W++){let St=W/i,j=St*c+l,pt=Math.sin(j),mt=Math.cos(j);F.x=V*pt,F.y=-O*n+E,F.z=V*mt,m.push(F.x,F.y,F.z),P.set(pt,D,mt).normalize(),v.push(P.x,P.y,P.z),x.push(St,1-O),tt.push(S++)}w.push(tt)}for(let L=0;L<i;L++)for(let tt=0;tt<o;tt++){let O=w[tt][L],V=w[tt+1][L],W=w[tt+1][L+1],St=w[tt][L+1];g.push(O,V,St),g.push(V,W,St),U+=6}f.addGroup(b,U,0),b+=U}function A(P){let F=S,U=new ft,D=new G,L=0,tt=P===!0?t:e,O=P===!0?1:-1;for(let W=1;W<=i;W++)m.push(0,E*O,0),v.push(0,O,0),x.push(.5,.5),S++;let V=S;for(let W=0;W<=i;W++){let j=W/i*c+l,pt=Math.cos(j),mt=Math.sin(j);D.x=tt*mt,D.y=E*O,D.z=tt*pt,m.push(D.x,D.y,D.z),v.push(0,O,0),U.x=pt*.5+.5,U.y=mt*.5*O+.5,x.push(U.x,U.y),S++}for(let W=0;W<i;W++){let St=F+W,j=V+W;P===!0?g.push(j,j+1,St):g.push(j+1,j,St),L+=3}f.addGroup(b,L,P===!0?1:2),b+=L}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},db=class r extends Y2{constructor(t=1,e=1,n=32,i=1,o=!1,a=0,l=Math.PI*2){super(0,t,e,n,i,o,a,l),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:l}}static fromJSON(t){return new r(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},bf=class r extends qe{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};let o=[],a=[];l(i),f(n),g(),this.setAttribute("position",new We(o,3)),this.setAttribute("normal",new We(o.slice(),3)),this.setAttribute("uv",new We(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function l(C){let A=new G,P=new G,F=new G;for(let U=0;U<e.length;U+=3)x(e[U+0],A),x(e[U+1],P),x(e[U+2],F),c(A,P,F,C)}function c(C,A,P,F){let U=F+1,D=[];for(let L=0;L<=U;L++){D[L]=[];let tt=C.clone().lerp(P,L/U),O=A.clone().lerp(P,L/U),V=U-L;for(let W=0;W<=V;W++)W===0&&L===U?D[L][W]=tt:D[L][W]=tt.clone().lerp(O,W/V)}for(let L=0;L<U;L++)for(let tt=0;tt<2*(U-L)-1;tt++){let O=Math.floor(tt/2);tt%2===0?(v(D[L][O+1]),v(D[L+1][O]),v(D[L][O])):(v(D[L][O+1]),v(D[L+1][O+1]),v(D[L+1][O]))}}function f(C){let A=new G;for(let P=0;P<o.length;P+=3)A.x=o[P+0],A.y=o[P+1],A.z=o[P+2],A.normalize().multiplyScalar(C),o[P+0]=A.x,o[P+1]=A.y,o[P+2]=A.z}function g(){let C=new G;for(let A=0;A<o.length;A+=3){C.x=o[A+0],C.y=o[A+1],C.z=o[A+2];let P=E(C)/2/Math.PI+.5,F=b(C)/Math.PI+.5;a.push(P,1-F)}S(),m()}function m(){for(let C=0;C<a.length;C+=6){let A=a[C+0],P=a[C+2],F=a[C+4],U=Math.max(A,P,F),D=Math.min(A,P,F);U>.9&&D<.1&&(A<.2&&(a[C+0]+=1),P<.2&&(a[C+2]+=1),F<.2&&(a[C+4]+=1))}}function v(C){o.push(C.x,C.y,C.z)}function x(C,A){let P=C*3;A.x=t[P+0],A.y=t[P+1],A.z=t[P+2]}function S(){let C=new G,A=new G,P=new G,F=new G,U=new ft,D=new ft,L=new ft;for(let tt=0,O=0;tt<o.length;tt+=9,O+=6){C.set(o[tt+0],o[tt+1],o[tt+2]),A.set(o[tt+3],o[tt+4],o[tt+5]),P.set(o[tt+6],o[tt+7],o[tt+8]),U.set(a[O+0],a[O+1]),D.set(a[O+2],a[O+3]),L.set(a[O+4],a[O+5]),F.copy(C).add(A).add(P).divideScalar(3);let V=E(F);w(U,O+0,C,V),w(D,O+2,A,V),w(L,O+4,P,V)}}function w(C,A,P,F){F<0&&C.x===1&&(a[A]=C.x-1),P.x===0&&P.z===0&&(a[A]=F/2/Math.PI+.5)}function E(C){return Math.atan2(C.z,-C.x)}function b(C){return Math.atan2(-C.y,Math.sqrt(C.x*C.x+C.z*C.z))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.vertices,t.indices,t.radius,t.details)}},gb=class r extends bf{constructor(t=1,e=0){let n=(1+Math.sqrt(5))/2,i=1/n,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(o,a,t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new r(t.radius,t.detail)}},v2=new G,_2=new G,NS=new G,y2=new $c,mb=class extends qe{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},t!==null){let i=Math.pow(10,4),o=Math.cos(od*e),a=t.getIndex(),l=t.getAttribute("position"),c=a?a.count:l.count,f=[0,0,0],g=["a","b","c"],m=new Array(3),v={},x=[];for(let S=0;S<c;S+=3){a?(f[0]=a.getX(S),f[1]=a.getX(S+1),f[2]=a.getX(S+2)):(f[0]=S,f[1]=S+1,f[2]=S+2);let{a:w,b:E,c:b}=y2;if(w.fromBufferAttribute(l,f[0]),E.fromBufferAttribute(l,f[1]),b.fromBufferAttribute(l,f[2]),y2.getNormal(NS),m[0]=`${Math.round(w.x*i)},${Math.round(w.y*i)},${Math.round(w.z*i)}`,m[1]=`${Math.round(E.x*i)},${Math.round(E.y*i)},${Math.round(E.z*i)}`,m[2]=`${Math.round(b.x*i)},${Math.round(b.y*i)},${Math.round(b.z*i)}`,!(m[0]===m[1]||m[1]===m[2]||m[2]===m[0]))for(let C=0;C<3;C++){let A=(C+1)%3,P=m[C],F=m[A],U=y2[g[C]],D=y2[g[A]],L=`${P}_${F}`,tt=`${F}_${P}`;tt in v&&v[tt]?(NS.dot(v[tt].normal)<=o&&(x.push(U.x,U.y,U.z),x.push(D.x,D.y,D.z)),v[tt]=null):L in v||(v[L]={index0:f[C],index1:f[A],normal:NS.clone()})}}for(let S in v)if(v[S]){let{index0:w,index1:E}=v[S];v2.fromBufferAttribute(l,w),_2.fromBufferAttribute(l,E),x.push(v2.x,v2.y,v2.z),x.push(_2.x,_2.y,_2.z)}this.setAttribute("position",new We(x,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}},Qu=class extends Sf{constructor(t){super(t),this.uuid=xu(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){let i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){let t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){let i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){let i=t.holes[e];this.holes.push(new Sf().fromJSON(i))}return this}},U0t={triangulate:function(r,t,e=2){let n=t&&t.length,i=n?t[0]*e:r.length,o=WF(r,0,i,e,!0),a=[];if(!o||o.next===o.prev)return a;let l,c,f,g,m,v,x;if(n&&(o=k0t(r,t,o,e)),r.length>80*e){l=f=r[0],c=g=r[1];for(let S=e;S<i;S+=e)m=r[S],v=r[S+1],m<l&&(l=m),v<c&&(c=v),m>f&&(f=m),v>g&&(g=v);x=Math.max(f-l,g-c),x=x!==0?32767/x:0}return Lm(o,a,e,l,c,x,0),a}};function WF(r,t,e,n,i){let o,a;if(i===J0t(r,t,e,n)>0)for(o=t;o<e;o+=n)a=aF(o,r[o],r[o+1],a);else for(o=e-n;o>=t;o-=n)a=aF(o,r[o],r[o+1],a);return a&&sx(a,a.next)&&(Om(a),a=a.next),a}function Mf(r,t){if(!r)return r;t||(t=r);let e=r,n;do if(n=!1,!e.steiner&&(sx(e,e.next)||_i(e.prev,e,e.next)===0)){if(Om(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function Lm(r,t,e,n,i,o,a){if(!r)return;!a&&o&&X0t(r,n,i,o);let l=r,c,f;for(;r.prev!==r.next;){if(c=r.prev,f=r.next,o?B0t(r,n,i,o):F0t(r)){t.push(c.i/e|0),t.push(r.i/e|0),t.push(f.i/e|0),Om(r),r=f.next,l=f.next;continue}if(r=f,r===l){a?a===1?(r=z0t(Mf(r),t,e),Lm(r,t,e,n,i,o,2)):a===2&&G0t(r,t,e,n,i,o):Lm(Mf(r),t,e,n,i,o,1);break}}}function F0t(r){let t=r.prev,e=r,n=r.next;if(_i(t,e,n)>=0)return!1;let i=t.x,o=e.x,a=n.x,l=t.y,c=e.y,f=n.y,g=i<o?i<a?i:a:o<a?o:a,m=l<c?l<f?l:f:c<f?c:f,v=i>o?i>a?i:a:o>a?o:a,x=l>c?l>f?l:f:c>f?c:f,S=n.next;for(;S!==t;){if(S.x>=g&&S.x<=v&&S.y>=m&&S.y<=x&&rd(i,l,o,c,a,f,S.x,S.y)&&_i(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function B0t(r,t,e,n){let i=r.prev,o=r,a=r.next;if(_i(i,o,a)>=0)return!1;let l=i.x,c=o.x,f=a.x,g=i.y,m=o.y,v=a.y,x=l<c?l<f?l:f:c<f?c:f,S=g<m?g<v?g:v:m<v?m:v,w=l>c?l>f?l:f:c>f?c:f,E=g>m?g>v?g:v:m>v?m:v,b=vb(x,S,t,e,n),C=vb(w,E,t,e,n),A=r.prevZ,P=r.nextZ;for(;A&&A.z>=b&&P&&P.z<=C;){if(A.x>=x&&A.x<=w&&A.y>=S&&A.y<=E&&A!==i&&A!==a&&rd(l,g,c,m,f,v,A.x,A.y)&&_i(A.prev,A,A.next)>=0||(A=A.prevZ,P.x>=x&&P.x<=w&&P.y>=S&&P.y<=E&&P!==i&&P!==a&&rd(l,g,c,m,f,v,P.x,P.y)&&_i(P.prev,P,P.next)>=0))return!1;P=P.nextZ}for(;A&&A.z>=b;){if(A.x>=x&&A.x<=w&&A.y>=S&&A.y<=E&&A!==i&&A!==a&&rd(l,g,c,m,f,v,A.x,A.y)&&_i(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;P&&P.z<=C;){if(P.x>=x&&P.x<=w&&P.y>=S&&P.y<=E&&P!==i&&P!==a&&rd(l,g,c,m,f,v,P.x,P.y)&&_i(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}function z0t(r,t,e){let n=r;do{let i=n.prev,o=n.next.next;!sx(i,o)&&qF(i,n,n.next,o)&&Nm(i,o)&&Nm(o,i)&&(t.push(i.i/e|0),t.push(n.i/e|0),t.push(o.i/e|0),Om(n),Om(n.next),n=r=o),n=n.next}while(n!==r);return Mf(n)}function G0t(r,t,e,n,i,o){let a=r;do{let l=a.next.next;for(;l!==a.prev;){if(a.i!==l.i&&Z0t(a,l)){let c=XF(a,l);a=Mf(a,a.next),c=Mf(c,c.next),Lm(a,t,e,n,i,o,0),Lm(c,t,e,n,i,o,0);return}l=l.next}a=a.next}while(a!==r)}function k0t(r,t,e,n){let i=[],o,a,l,c,f;for(o=0,a=t.length;o<a;o++)l=t[o]*n,c=o<a-1?t[o+1]*n:r.length,f=WF(r,l,c,n,!1),f===f.next&&(f.steiner=!0),i.push(Y0t(f));for(i.sort(V0t),o=0;o<i.length;o++)e=H0t(i[o],e);return e}function V0t(r,t){return r.x-t.x}function H0t(r,t){let e=W0t(r,t);if(!e)return t;let n=XF(e,r);return Mf(n,n.next),Mf(e,e.next)}function W0t(r,t){let e=t,n=-1/0,i,o=r.x,a=r.y;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){let v=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(v<=o&&v>n&&(n=v,i=e.x<e.next.x?e:e.next,v===o))return i}e=e.next}while(e!==t);if(!i)return null;let l=i,c=i.x,f=i.y,g=1/0,m;e=i;do o>=e.x&&e.x>=c&&o!==e.x&&rd(a<f?o:n,a,c,f,a<f?n:o,a,e.x,e.y)&&(m=Math.abs(a-e.y)/(o-e.x),Nm(e,r)&&(m<g||m===g&&(e.x>i.x||e.x===i.x&&q0t(i,e)))&&(i=e,g=m)),e=e.next;while(e!==l);return i}function q0t(r,t){return _i(r.prev,r,t.prev)<0&&_i(t.next,r,r.next)<0}function X0t(r,t,e,n){let i=r;do i.z===0&&(i.z=vb(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,j0t(i)}function j0t(r){let t,e,n,i,o,a,l,c,f=1;do{for(e=r,r=null,o=null,a=0;e;){for(a++,n=e,l=0,t=0;t<f&&(l++,n=n.nextZ,!!n);t++);for(c=f;l>0||c>0&&n;)l!==0&&(c===0||!n||e.z<=n.z)?(i=e,e=e.nextZ,l--):(i=n,n=n.nextZ,c--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;e=n}o.nextZ=null,f*=2}while(a>1);return r}function vb(r,t,e,n,i){return r=(r-e)*i|0,t=(t-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function Y0t(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function rd(r,t,e,n,i,o,a,l){return(i-a)*(t-l)>=(r-a)*(o-l)&&(r-a)*(n-l)>=(e-a)*(t-l)&&(e-a)*(o-l)>=(i-a)*(n-l)}function Z0t(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!K0t(r,t)&&(Nm(r,t)&&Nm(t,r)&&$0t(r,t)&&(_i(r.prev,r,t.prev)||_i(r,t.prev,t))||sx(r,t)&&_i(r.prev,r,r.next)>0&&_i(t.prev,t,t.next)>0)}function _i(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function sx(r,t){return r.x===t.x&&r.y===t.y}function qF(r,t,e,n){let i=E2(_i(r,t,e)),o=E2(_i(r,t,n)),a=E2(_i(e,n,r)),l=E2(_i(e,n,t));return!!(i!==o&&a!==l||i===0&&x2(r,e,t)||o===0&&x2(r,n,t)||a===0&&x2(e,r,n)||l===0&&x2(e,t,n))}function x2(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function E2(r){return r>0?1:r<0?-1:0}function K0t(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&qF(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Nm(r,t){return _i(r.prev,r,r.next)<0?_i(r,t,r.next)>=0&&_i(r,r.prev,t)>=0:_i(r,t,r.prev)<0||_i(r,r.next,t)<0}function $0t(r,t){let e=r,n=!1,i=(r.x+t.x)/2,o=(r.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&i<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==r);return n}function XF(r,t){let e=new _b(r.i,r.x,r.y),n=new _b(t.i,t.x,t.y),i=r.next,o=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,n.next=e,e.prev=n,o.next=n,n.prev=o,n}function aF(r,t,e,n){let i=new _b(r,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Om(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _b(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function J0t(r,t,e,n){let i=0;for(let o=t,a=e-n;o<e;o+=n)i+=(r[a]-r[o])*(r[o+1]+r[a+1]),a=o;return i}var nh=class r{static area(t){let e=t.length,n=0;for(let i=e-1,o=0;o<e;i=o++)n+=t[i].x*t[o].y-t[o].x*t[i].y;return n*.5}static isClockWise(t){return r.area(t)<0}static triangulateShape(t,e){let n=[],i=[],o=[];uF(t),lF(n,t);let a=t.length;e.forEach(uF);for(let c=0;c<e.length;c++)i.push(a),a+=e[c].length,lF(n,e[c]);let l=U0t.triangulate(n,i);for(let c=0;c<l.length;c+=3)o.push(l.slice(c,c+3));return o}};function uF(r){let t=r.length;t>2&&r[t-1].equals(r[0])&&r.pop()}function lF(r,t){for(let e=0;e<t.length;e++)r.push(t[e].x),r.push(t[e].y)}var wf=class r extends qe{constructor(t=new Qu([new ft(.5,.5),new ft(-.5,.5),new ft(-.5,-.5),new ft(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];let n=this,i=[],o=[];for(let l=0,c=t.length;l<c;l++){let f=t[l];a(f)}this.setAttribute("position",new We(i,3)),this.setAttribute("uv",new We(o,2)),this.computeVertexNormals();function a(l){let c=[],f=e.curveSegments!==void 0?e.curveSegments:12,g=e.steps!==void 0?e.steps:1,m=e.depth!==void 0?e.depth:1,v=e.bevelEnabled!==void 0?e.bevelEnabled:!0,x=e.bevelThickness!==void 0?e.bevelThickness:.2,S=e.bevelSize!==void 0?e.bevelSize:x-.1,w=e.bevelOffset!==void 0?e.bevelOffset:0,E=e.bevelSegments!==void 0?e.bevelSegments:3,b=e.extrudePath,C=e.UVGenerator!==void 0?e.UVGenerator:Q0t,A,P=!1,F,U,D,L;b&&(A=b.getSpacedPoints(g),P=!0,v=!1,F=b.computeFrenetFrames(g,!1),U=new G,D=new G,L=new G),v||(E=0,x=0,S=0,w=0);let tt=l.extractPoints(f),O=tt.shape,V=tt.holes;if(!nh.isClockWise(O)){O=O.reverse();for(let ot=0,te=V.length;ot<te;ot++){let Dt=V[ot];nh.isClockWise(Dt)&&(V[ot]=Dt.reverse())}}let St=nh.triangulateShape(O,V),j=O;for(let ot=0,te=V.length;ot<te;ot++){let Dt=V[ot];O=O.concat(Dt)}function pt(ot,te,Dt){return te||console.error("THREE.ExtrudeGeometry: vec does not exist"),ot.clone().addScaledVector(te,Dt)}let mt=O.length,Lt=St.length;function yt(ot,te,Dt){let $t,kt,de,ge=ot.x-te.x,qt=ot.y-te.y,xe=Dt.x-ot.x,it=Dt.y-ot.y,X=ge*ge+qt*qt,Ut=ge*it-qt*xe;if(Math.abs(Ut)>Number.EPSILON){let zt=Math.sqrt(X),Et=Math.sqrt(xe*xe+it*it),st=te.x-qt/zt,Ht=te.y+ge/zt,Gt=Dt.x-it/Et,Kt=Dt.y+xe/Et,se=((Gt-st)*it-(Kt-Ht)*xe)/(ge*it-qt*xe);$t=st+ge*se-ot.x,kt=Ht+qt*se-ot.y;let ut=$t*$t+kt*kt;if(ut<=2)return new ft($t,kt);de=Math.sqrt(ut/2)}else{let zt=!1;ge>Number.EPSILON?xe>Number.EPSILON&&(zt=!0):ge<-Number.EPSILON?xe<-Number.EPSILON&&(zt=!0):Math.sign(qt)===Math.sign(it)&&(zt=!0),zt?($t=-qt,kt=ge,de=Math.sqrt(X)):($t=ge,kt=qt,de=Math.sqrt(X/2))}return new ft($t/de,kt/de)}let bt=[];for(let ot=0,te=j.length,Dt=te-1,$t=ot+1;ot<te;ot++,Dt++,$t++)Dt===te&&(Dt=0),$t===te&&($t=0),bt[ot]=yt(j[ot],j[Dt],j[$t]);let nt=[],Xt,Vt=bt.concat();for(let ot=0,te=V.length;ot<te;ot++){let Dt=V[ot];Xt=[];for(let $t=0,kt=Dt.length,de=kt-1,ge=$t+1;$t<kt;$t++,de++,ge++)de===kt&&(de=0),ge===kt&&(ge=0),Xt[$t]=yt(Dt[$t],Dt[de],Dt[ge]);nt.push(Xt),Vt=Vt.concat(Xt)}for(let ot=0;ot<E;ot++){let te=ot/E,Dt=x*Math.cos(te*Math.PI/2),$t=S*Math.sin(te*Math.PI/2)+w;for(let kt=0,de=j.length;kt<de;kt++){let ge=pt(j[kt],bt[kt],$t);me(ge.x,ge.y,-Dt)}for(let kt=0,de=V.length;kt<de;kt++){let ge=V[kt];Xt=nt[kt];for(let qt=0,xe=ge.length;qt<xe;qt++){let it=pt(ge[qt],Xt[qt],$t);me(it.x,it.y,-Dt)}}}let he=S+w;for(let ot=0;ot<mt;ot++){let te=v?pt(O[ot],Vt[ot],he):O[ot];P?(D.copy(F.normals[0]).multiplyScalar(te.x),U.copy(F.binormals[0]).multiplyScalar(te.y),L.copy(A[0]).add(D).add(U),me(L.x,L.y,L.z)):me(te.x,te.y,0)}for(let ot=1;ot<=g;ot++)for(let te=0;te<mt;te++){let Dt=v?pt(O[te],Vt[te],he):O[te];P?(D.copy(F.normals[ot]).multiplyScalar(Dt.x),U.copy(F.binormals[ot]).multiplyScalar(Dt.y),L.copy(A[ot]).add(D).add(U),me(L.x,L.y,L.z)):me(Dt.x,Dt.y,m/g*ot)}for(let ot=E-1;ot>=0;ot--){let te=ot/E,Dt=x*Math.cos(te*Math.PI/2),$t=S*Math.sin(te*Math.PI/2)+w;for(let kt=0,de=j.length;kt<de;kt++){let ge=pt(j[kt],bt[kt],$t);me(ge.x,ge.y,m+Dt)}for(let kt=0,de=V.length;kt<de;kt++){let ge=V[kt];Xt=nt[kt];for(let qt=0,xe=ge.length;qt<xe;qt++){let it=pt(ge[qt],Xt[qt],$t);P?me(it.x,it.y+A[g-1].y,A[g-1].x+Dt):me(it.x,it.y,m+Dt)}}}dt(),jt();function dt(){let ot=i.length/3;if(v){let te=0,Dt=mt*te;for(let $t=0;$t<Lt;$t++){let kt=St[$t];ae(kt[2]+Dt,kt[1]+Dt,kt[0]+Dt)}te=g+E*2,Dt=mt*te;for(let $t=0;$t<Lt;$t++){let kt=St[$t];ae(kt[0]+Dt,kt[1]+Dt,kt[2]+Dt)}}else{for(let te=0;te<Lt;te++){let Dt=St[te];ae(Dt[2],Dt[1],Dt[0])}for(let te=0;te<Lt;te++){let Dt=St[te];ae(Dt[0]+mt*g,Dt[1]+mt*g,Dt[2]+mt*g)}}n.addGroup(ot,i.length/3-ot,0)}function jt(){let ot=i.length/3,te=0;ue(j,te),te+=j.length;for(let Dt=0,$t=V.length;Dt<$t;Dt++){let kt=V[Dt];ue(kt,te),te+=kt.length}n.addGroup(ot,i.length/3-ot,1)}function ue(ot,te){let Dt=ot.length;for(;--Dt>=0;){let $t=Dt,kt=Dt-1;kt<0&&(kt=ot.length-1);for(let de=0,ge=g+E*2;de<ge;de++){let qt=mt*de,xe=mt*(de+1),it=te+$t+qt,X=te+kt+qt,Ut=te+kt+xe,zt=te+$t+xe;oe(it,X,Ut,zt)}}}function me(ot,te,Dt){c.push(ot),c.push(te),c.push(Dt)}function ae(ot,te,Dt){Yt(ot),Yt(te),Yt(Dt);let $t=i.length/3,kt=C.generateTopUV(n,i,$t-3,$t-2,$t-1);be(kt[0]),be(kt[1]),be(kt[2])}function oe(ot,te,Dt,$t){Yt(ot),Yt(te),Yt($t),Yt(te),Yt(Dt),Yt($t);let kt=i.length/3,de=C.generateSideWallUV(n,i,kt-6,kt-3,kt-2,kt-1);be(de[0]),be(de[1]),be(de[3]),be(de[1]),be(de[2]),be(de[3])}function Yt(ot){i.push(c[ot*3+0]),i.push(c[ot*3+1]),i.push(c[ot*3+2])}function be(ot){o.push(ot.x),o.push(ot.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes,n=this.parameters.options;return tlt(e,n,t)}static fromJSON(t,e){let n=[];for(let o=0,a=t.shapes.length;o<a;o++){let l=e[t.shapes[o]];n.push(l)}let i=t.options.extrudePath;return i!==void 0&&(t.options.extrudePath=new X2[i.type]().fromJSON(i)),new r(n,t.options)}},Q0t={generateTopUV:function(r,t,e,n,i){let o=t[e*3],a=t[e*3+1],l=t[n*3],c=t[n*3+1],f=t[i*3],g=t[i*3+1];return[new ft(o,a),new ft(l,c),new ft(f,g)]},generateSideWallUV:function(r,t,e,n,i,o){let a=t[e*3],l=t[e*3+1],c=t[e*3+2],f=t[n*3],g=t[n*3+1],m=t[n*3+2],v=t[i*3],x=t[i*3+1],S=t[i*3+2],w=t[o*3],E=t[o*3+1],b=t[o*3+2];return Math.abs(l-g)<Math.abs(a-f)?[new ft(a,1-c),new ft(f,1-m),new ft(v,1-S),new ft(w,1-b)]:[new ft(l,1-c),new ft(g,1-m),new ft(x,1-S),new ft(E,1-b)]}};function tlt(r,t,e){if(e.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){let o=r[n];e.shapes.push(o.uuid)}else e.shapes.push(r.uuid);return e.options=Object.assign({},t),t.extrudePath!==void 0&&(e.options.extrudePath=t.extrudePath.toJSON()),e}var yb=class r extends bf{constructor(t=1,e=0){let n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,o,t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new r(t.radius,t.detail)}},xb=class r extends bf{constructor(t=1,e=0){let n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new r(t.radius,t.detail)}},Eb=class r extends qe{constructor(t=.5,e=1,n=32,i=1,o=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:o,thetaLength:a},n=Math.max(3,n),i=Math.max(1,i);let l=[],c=[],f=[],g=[],m=t,v=(e-t)/i,x=new G,S=new ft;for(let w=0;w<=i;w++){for(let E=0;E<=n;E++){let b=o+E/n*a;x.x=m*Math.cos(b),x.y=m*Math.sin(b),c.push(x.x,x.y,x.z),f.push(0,0,1),S.x=(x.x/e+1)/2,S.y=(x.y/e+1)/2,g.push(S.x,S.y)}m+=v}for(let w=0;w<i;w++){let E=w*(n+1);for(let b=0;b<n;b++){let C=b+E,A=C,P=C+n+1,F=C+n+2,U=C+1;l.push(A,P,U),l.push(P,F,U)}}this.setIndex(l),this.setAttribute("position",new We(c,3)),this.setAttribute("normal",new We(f,3)),this.setAttribute("uv",new We(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}},Tf=class r extends qe{constructor(t=new Qu([new ft(0,.5),new ft(-.5,-.5),new ft(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};let n=[],i=[],o=[],a=[],l=0,c=0;if(Array.isArray(t)===!1)f(t);else for(let g=0;g<t.length;g++)f(t[g]),this.addGroup(l,c,g),l+=c,c=0;this.setIndex(n),this.setAttribute("position",new We(i,3)),this.setAttribute("normal",new We(o,3)),this.setAttribute("uv",new We(a,2));function f(g){let m=i.length/3,v=g.extractPoints(e),x=v.shape,S=v.holes;nh.isClockWise(x)===!1&&(x=x.reverse());for(let E=0,b=S.length;E<b;E++){let C=S[E];nh.isClockWise(C)===!0&&(S[E]=C.reverse())}let w=nh.triangulateShape(x,S);for(let E=0,b=S.length;E<b;E++){let C=S[E];x=x.concat(C)}for(let E=0,b=x.length;E<b;E++){let C=x[E];i.push(C.x,C.y,0),o.push(0,0,1),a.push(C.x,C.y)}for(let E=0,b=w.length;E<b;E++){let C=w[E],A=C[0]+m,P=C[1]+m,F=C[2]+m;n.push(A,P,F),c+=3}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes;return elt(e,t)}static fromJSON(t,e){let n=[];for(let i=0,o=t.shapes.length;i<o;i++){let a=e[t.shapes[i]];n.push(a)}return new r(n,t.curveSegments)}};function elt(r,t){if(t.shapes=[],Array.isArray(r))for(let e=0,n=r.length;e<n;e++){let i=r[e];t.shapes.push(i.uuid)}else t.shapes.push(r.uuid);return t}var Sb=class r extends qe{constructor(t=1,e=32,n=16,i=0,o=Math.PI*2,a=0,l=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:o,thetaStart:a,thetaLength:l},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));let c=Math.min(a+l,Math.PI),f=0,g=[],m=new G,v=new G,x=[],S=[],w=[],E=[];for(let b=0;b<=n;b++){let C=[],A=b/n,P=0;b===0&&a===0?P=.5/e:b===n&&c===Math.PI&&(P=-.5/e);for(let F=0;F<=e;F++){let U=F/e;m.x=-t*Math.cos(i+U*o)*Math.sin(a+A*l),m.y=t*Math.cos(a+A*l),m.z=t*Math.sin(i+U*o)*Math.sin(a+A*l),S.push(m.x,m.y,m.z),v.copy(m).normalize(),w.push(v.x,v.y,v.z),E.push(U+P,1-A),C.push(f++)}g.push(C)}for(let b=0;b<n;b++)for(let C=0;C<e;C++){let A=g[b][C+1],P=g[b][C],F=g[b+1][C],U=g[b+1][C+1];(b!==0||a>0)&&x.push(A,P,U),(b!==n-1||c<Math.PI)&&x.push(P,F,U)}this.setIndex(x),this.setAttribute("position",new We(S,3)),this.setAttribute("normal",new We(w,3)),this.setAttribute("uv",new We(E,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},bb=class r extends bf{constructor(t=1,e=0){let n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new r(t.radius,t.detail)}},Mb=class r extends qe{constructor(t=1,e=.4,n=12,i=48,o=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:o},n=Math.floor(n),i=Math.floor(i);let a=[],l=[],c=[],f=[],g=new G,m=new G,v=new G;for(let x=0;x<=n;x++)for(let S=0;S<=i;S++){let w=S/i*o,E=x/n*Math.PI*2;m.x=(t+e*Math.cos(E))*Math.cos(w),m.y=(t+e*Math.cos(E))*Math.sin(w),m.z=e*Math.sin(E),l.push(m.x,m.y,m.z),g.x=t*Math.cos(w),g.y=t*Math.sin(w),v.subVectors(m,g).normalize(),c.push(v.x,v.y,v.z),f.push(S/i),f.push(x/n)}for(let x=1;x<=n;x++)for(let S=1;S<=i;S++){let w=(i+1)*x+S-1,E=(i+1)*(x-1)+S-1,b=(i+1)*(x-1)+S,C=(i+1)*x+S;a.push(w,E,C),a.push(E,b,C)}this.setIndex(a),this.setAttribute("position",new We(l,3)),this.setAttribute("normal",new We(c,3)),this.setAttribute("uv",new We(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},wb=class r extends qe{constructor(t=1,e=.4,n=64,i=8,o=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:o,q:a},n=Math.floor(n),i=Math.floor(i);let l=[],c=[],f=[],g=[],m=new G,v=new G,x=new G,S=new G,w=new G,E=new G,b=new G;for(let A=0;A<=n;++A){let P=A/n*o*Math.PI*2;C(P,o,a,t,x),C(P+.01,o,a,t,S),E.subVectors(S,x),b.addVectors(S,x),w.crossVectors(E,b),b.crossVectors(w,E),w.normalize(),b.normalize();for(let F=0;F<=i;++F){let U=F/i*Math.PI*2,D=-e*Math.cos(U),L=e*Math.sin(U);m.x=x.x+(D*b.x+L*w.x),m.y=x.y+(D*b.y+L*w.y),m.z=x.z+(D*b.z+L*w.z),c.push(m.x,m.y,m.z),v.subVectors(m,x).normalize(),f.push(v.x,v.y,v.z),g.push(A/n),g.push(F/i)}}for(let A=1;A<=n;A++)for(let P=1;P<=i;P++){let F=(i+1)*(A-1)+(P-1),U=(i+1)*A+(P-1),D=(i+1)*A+P,L=(i+1)*(A-1)+P;l.push(F,U,L),l.push(U,D,L)}this.setIndex(l),this.setAttribute("position",new We(c,3)),this.setAttribute("normal",new We(f,3)),this.setAttribute("uv",new We(g,2));function C(A,P,F,U,D){let L=Math.cos(A),tt=Math.sin(A),O=F/P*A,V=Math.cos(O);D.x=U*(2+V)*.5*L,D.y=U*(2+V)*tt*.5,D.z=U*Math.sin(O)*.5}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}},Tb=class r extends qe{constructor(t=new W2(new G(-1,-1,0),new G(-1,1,0),new G(1,1,0)),e=64,n=1,i=8,o=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:o};let a=t.computeFrenetFrames(e,o);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;let l=new G,c=new G,f=new ft,g=new G,m=[],v=[],x=[],S=[];w(),this.setIndex(S),this.setAttribute("position",new We(m,3)),this.setAttribute("normal",new We(v,3)),this.setAttribute("uv",new We(x,2));function w(){for(let A=0;A<e;A++)E(A);E(o===!1?e:0),C(),b()}function E(A){g=t.getPointAt(A/e,g);let P=a.normals[A],F=a.binormals[A];for(let U=0;U<=i;U++){let D=U/i*Math.PI*2,L=Math.sin(D),tt=-Math.cos(D);c.x=tt*P.x+L*F.x,c.y=tt*P.y+L*F.y,c.z=tt*P.z+L*F.z,c.normalize(),v.push(c.x,c.y,c.z),l.x=g.x+n*c.x,l.y=g.y+n*c.y,l.z=g.z+n*c.z,m.push(l.x,l.y,l.z)}}function b(){for(let A=1;A<=e;A++)for(let P=1;P<=i;P++){let F=(i+1)*(A-1)+(P-1),U=(i+1)*A+(P-1),D=(i+1)*A+P,L=(i+1)*(A-1)+P;S.push(F,U,L),S.push(U,D,L)}}function C(){for(let A=0;A<=e;A++)for(let P=0;P<=i;P++)f.x=A/e,f.y=P/i,x.push(f.x,f.y)}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new r(new X2[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}},Dm=class extends qe{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},t!==null){let e=[],n=new Set,i=new G,o=new G;if(t.index!==null){let a=t.attributes.position,l=t.index,c=t.groups;c.length===0&&(c=[{start:0,count:l.count,materialIndex:0}]);for(let f=0,g=c.length;f<g;++f){let m=c[f],v=m.start,x=m.count;for(let S=v,w=v+x;S<w;S+=3)for(let E=0;E<3;E++){let b=l.getX(S+E),C=l.getX(S+(E+1)%3);i.fromBufferAttribute(a,b),o.fromBufferAttribute(a,C),cF(i,o,n)===!0&&(e.push(i.x,i.y,i.z),e.push(o.x,o.y,o.z))}}}else{let a=t.attributes.position;for(let l=0,c=a.count/3;l<c;l++)for(let f=0;f<3;f++){let g=3*l+f,m=3*l+(f+1)%3;i.fromBufferAttribute(a,g),o.fromBufferAttribute(a,m),cF(i,o,n)===!0&&(e.push(i.x,i.y,i.z),e.push(o.x,o.y,o.z))}}this.setAttribute("position",new We(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}};function cF(r,t,e){let n=`${r.x},${r.y},${r.z}-${t.x},${t.y},${t.z}`,i=`${t.x},${t.y},${t.z}-${r.x},${r.y},${r.z}`;return e.has(n)===!0||e.has(i)===!0?!1:(e.add(n),e.add(i),!0)}var hF=Object.freeze({__proto__:null,BoxGeometry:Eu,CapsuleGeometry:fb,CircleGeometry:pb,ConeGeometry:db,CylinderGeometry:Y2,DodecahedronGeometry:gb,EdgesGeometry:mb,ExtrudeGeometry:wf,IcosahedronGeometry:yb,LatheGeometry:j2,OctahedronGeometry:xb,PlaneGeometry:Ju,PolyhedronGeometry:bf,RingGeometry:Eb,ShapeGeometry:Tf,SphereGeometry:Sb,TetrahedronGeometry:bb,TorusGeometry:Mb,TorusKnotGeometry:wb,TubeGeometry:Tb,WireframeGeometry:Dm}),Um=class extends ji{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new ne(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}},Ab=class extends gr{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},t0=class extends ji{constructor(t){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ne(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ne(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Df,this.normalScale=new ft(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ga,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},Wa=class extends t0{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ft(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ri(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ne(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new ne(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ne(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}},Cb=class extends ji{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ne(16777215),this.specular=new ne(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ne(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Df,this.normalScale=new ft(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ga,this.combine=nx,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},Rb=class extends ji{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ne(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ne(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Df,this.normalScale=new ft(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},Pb=class extends ji{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Df,this.normalScale=new ft(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}},Ib=class extends ji{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ne(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ne(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Df,this.normalScale=new ft(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ga,this.combine=nx,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},Lb=class extends ji{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ne(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Df,this.normalScale=new ft(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}},Af=class extends ma{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}};function S2(r,t,e){return!r||!e&&r.constructor===t?r:typeof t.BYTES_PER_ELEMENT=="number"?new t(r):Array.prototype.slice.call(r)}function nlt(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function rlt(r){function t(i,o){return r[i]-r[o]}let e=r.length,n=new Array(e);for(let i=0;i!==e;++i)n[i]=i;return n.sort(t),n}function fF(r,t,e){let n=r.length,i=new r.constructor(n);for(let o=0,a=0;a!==n;++o){let l=e[o]*t;for(let c=0;c!==t;++c)i[a++]=r[l+c]}return i}function jF(r,t,e,n){let i=1,o=r[0];for(;o!==void 0&&o[n]===void 0;)o=r[i++];if(o===void 0)return;let a=o[n];if(a!==void 0)if(Array.isArray(a))do a=o[n],a!==void 0&&(t.push(o.time),e.push.apply(e,a)),o=r[i++];while(o!==void 0);else if(a.toArray!==void 0)do a=o[n],a!==void 0&&(t.push(o.time),a.toArray(e,e.length)),o=r[i++];while(o!==void 0);else do a=o[n],a!==void 0&&(t.push(o.time),e.push(a)),o=r[i++];while(o!==void 0)}var ih=class{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,n=this._cachedIndex,i=e[n],o=e[n-1];t:{e:{let a;n:{r:if(!(t<i)){for(let l=n+2;;){if(i===void 0){if(t<o)break r;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===l)break;if(o=i,i=e[++n],t<i)break e}a=e.length;break n}if(!(t>=o)){let l=e[1];t<l&&(n=2,o=l);for(let c=n-2;;){if(o===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=o,o=e[--n-1],t>=o)break e}a=n,n=0;break n}break t}for(;n<a;){let l=n+a>>>1;t<e[l]?a=l:n=l+1}if(i=e[n],o=e[n-1],o===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,o,i)}return this.interpolate_(n,o,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,o=t*i;for(let a=0;a!==i;++a)e[a]=n[o+a];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Nb=class extends ih{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Jp,endingEnd:Jp}}intervalChanged_(t,e,n){let i=this.parameterPositions,o=t-2,a=t+1,l=i[o],c=i[a];if(l===void 0)switch(this.getSettings_().endingStart){case Qp:o=t,l=2*e-n;break;case T2:o=i.length-2,l=e+i[o]-i[o+1];break;default:o=t,l=n}if(c===void 0)switch(this.getSettings_().endingEnd){case Qp:a=t,c=2*n-e;break;case T2:a=1,c=n+i[1]-i[0];break;default:a=t-1,c=e}let f=(n-e)*.5,g=this.valueSize;this._weightPrev=f/(e-l),this._weightNext=f/(c-n),this._offsetPrev=o*g,this._offsetNext=a*g}interpolate_(t,e,n,i){let o=this.resultBuffer,a=this.sampleValues,l=this.valueSize,c=t*l,f=c-l,g=this._offsetPrev,m=this._offsetNext,v=this._weightPrev,x=this._weightNext,S=(n-e)/(i-e),w=S*S,E=w*S,b=-v*E+2*v*w-v*S,C=(1+v)*E+(-1.5-2*v)*w+(-.5+v)*S+1,A=(-1-x)*E+(1.5+x)*w+.5*S,P=x*E-x*w;for(let F=0;F!==l;++F)o[F]=b*a[g+F]+C*a[f+F]+A*a[c+F]+P*a[m+F];return o}},Z2=class extends ih{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){let o=this.resultBuffer,a=this.sampleValues,l=this.valueSize,c=t*l,f=c-l,g=(n-e)/(i-e),m=1-g;for(let v=0;v!==l;++v)o[v]=a[f+v]*m+a[c+v]*g;return o}},Ob=class extends ih{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}},bu=class{constructor(t,e,n,i){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=S2(e,this.TimeBufferType),this.values=S2(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:S2(t.times,Array),values:S2(t.values,Array)};let i=t.getInterpolation();i!==t.DefaultInterpolation&&(n.interpolation=i)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new Ob(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Z2(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Nb(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case hd:e=this.InterpolantFactoryMethodDiscrete;break;case Ef:e=this.InterpolantFactoryMethodLinear;break;case Q3:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return hd;case this.InterpolantFactoryMethodLinear:return Ef;case this.InterpolantFactoryMethodSmooth:return Q3}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){let n=this.times,i=n.length,o=0,a=i-1;for(;o!==i&&n[o]<t;)++o;for(;a!==-1&&n[a]>e;)--a;if(++a,o!==0||a!==i){o>=a&&(a=Math.max(a,1),o=a-1);let l=this.getValueSize();this.times=n.slice(o,a),this.values=this.values.slice(o*l,a*l)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,i=this.values,o=n.length;o===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let l=0;l!==o;l++){let c=n[l];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,l,c),t=!1;break}if(a!==null&&a>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,l,c,a),t=!1;break}a=c}if(i!==void 0&&nlt(i))for(let l=0,c=i.length;l!==c;++l){let f=i[l];if(isNaN(f)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,f),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Q3,o=t.length-1,a=1;for(let l=1;l<o;++l){let c=!1,f=t[l],g=t[l+1];if(f!==g&&(l!==1||f!==t[0]))if(i)c=!0;else{let m=l*n,v=m-n,x=m+n;for(let S=0;S!==n;++S){let w=e[m+S];if(w!==e[v+S]||w!==e[x+S]){c=!0;break}}}if(c){if(l!==a){t[a]=t[l];let m=l*n,v=a*n;for(let x=0;x!==n;++x)e[v+x]=e[m+x]}++a}}if(o>0){t[a]=t[o];for(let l=o*n,c=a*n,f=0;f!==n;++f)e[c+f]=e[l+f];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*n)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,i=new n(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}};bu.prototype.TimeBufferType=Float32Array;bu.prototype.ValueBufferType=Float32Array;bu.prototype.DefaultInterpolation=Ef;var oh=class extends bu{};oh.prototype.ValueTypeName="bool";oh.prototype.ValueBufferType=Array;oh.prototype.DefaultInterpolation=hd;oh.prototype.InterpolantFactoryMethodLinear=void 0;oh.prototype.InterpolantFactoryMethodSmooth=void 0;var K2=class extends bu{};K2.prototype.ValueTypeName="color";var Wl=class extends bu{};Wl.prototype.ValueTypeName="number";var Db=class extends ih{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){let o=this.resultBuffer,a=this.sampleValues,l=this.valueSize,c=(n-e)/(i-e),f=t*l;for(let g=f+l;f!==g;f+=4)Xi.slerpFlat(o,0,a,f-l,a,f,c);return o}},z0=class extends bu{InterpolantFactoryMethodLinear(t){return new Db(this.times,this.values,this.getValueSize(),t)}};z0.prototype.ValueTypeName="quaternion";z0.prototype.DefaultInterpolation=Ef;z0.prototype.InterpolantFactoryMethodSmooth=void 0;var sh=class extends bu{};sh.prototype.ValueTypeName="string";sh.prototype.ValueBufferType=Array;sh.prototype.DefaultInterpolation=hd;sh.prototype.InterpolantFactoryMethodLinear=void 0;sh.prototype.InterpolantFactoryMethodSmooth=void 0;var ql=class extends bu{};ql.prototype.ValueTypeName="vector";var Cf=class{constructor(t,e=-1,n,i=tM){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=xu(),this.duration<0&&this.resetDuration()}static parse(t){let e=[],n=t.tracks,i=1/(t.fps||1);for(let a=0,l=n.length;a!==l;++a)e.push(olt(n[a]).scale(i));let o=new this(t.name,t.duration,e,t.blendMode);return o.uuid=t.uuid,o}static toJSON(t){let e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let o=0,a=n.length;o!==a;++o)e.push(bu.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(t,e,n,i){let o=e.length,a=[];for(let l=0;l<o;l++){let c=[],f=[];c.push((l+o-1)%o,l,(l+1)%o),f.push(0,1,0);let g=rlt(c);c=fF(c,1,g),f=fF(f,1,g),!i&&c[0]===0&&(c.push(o),f.push(f[0])),a.push(new Wl(".morphTargetInfluences["+e[l].name+"]",c,f).scale(1/n))}return new this(t,-1,a)}static findByName(t,e){let n=t;if(!Array.isArray(t)){let i=t;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===e)return n[i];return null}static CreateClipsFromMorphTargetSequences(t,e,n){let i={},o=/^([\w-]*?)([\d]+)$/;for(let l=0,c=t.length;l<c;l++){let f=t[l],g=f.name.match(o);if(g&&g.length>1){let m=g[1],v=i[m];v||(i[m]=v=[]),v.push(f)}}let a=[];for(let l in i)a.push(this.CreateFromMorphTargetSequence(l,i[l],e,n));return a}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let n=function(m,v,x,S,w){if(x.length!==0){let E=[],b=[];jF(x,E,b,S),E.length!==0&&w.push(new m(v,E,b))}},i=[],o=t.name||"default",a=t.fps||30,l=t.blendMode,c=t.length||-1,f=t.hierarchy||[];for(let m=0;m<f.length;m++){let v=f[m].keys;if(!(!v||v.length===0))if(v[0].morphTargets){let x={},S;for(S=0;S<v.length;S++)if(v[S].morphTargets)for(let w=0;w<v[S].morphTargets.length;w++)x[v[S].morphTargets[w]]=-1;for(let w in x){let E=[],b=[];for(let C=0;C!==v[S].morphTargets.length;++C){let A=v[S];E.push(A.time),b.push(A.morphTarget===w?1:0)}i.push(new Wl(".morphTargetInfluence["+w+"]",E,b))}c=x.length*a}else{let x=".bones["+e[m].name+"]";n(ql,x+".position",v,"pos",i),n(z0,x+".quaternion",v,"rot",i),n(ql,x+".scale",v,"scl",i)}}return i.length===0?null:new this(o,c,i,l)}resetDuration(){let t=this.tracks,e=0;for(let n=0,i=t.length;n!==i;++n){let o=this.tracks[n];e=Math.max(e,o.times[o.times.length-1])}return this.duration=e,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){let t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}};function ilt(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Wl;case"vector":case"vector2":case"vector3":case"vector4":return ql;case"color":return K2;case"quaternion":return z0;case"bool":case"boolean":return oh;case"string":return sh}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function olt(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=ilt(r.type);if(r.times===void 0){let e=[],n=[];jF(r.keys,e,n,"value"),r.times=e,r.values=n}return t.parse!==void 0?t.parse(r):new t(r.name,r.times,r.values,r.interpolation)}var Jc={enabled:!1,files:{},add:function(r,t){this.enabled!==!1&&(this.files[r]=t)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}},$2=class{constructor(t,e,n){let i=this,o=!1,a=0,l=0,c,f=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(g){l++,o===!1&&i.onStart!==void 0&&i.onStart(g,a,l),o=!0},this.itemEnd=function(g){a++,i.onProgress!==void 0&&i.onProgress(g,a,l),a===l&&(o=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(g){i.onError!==void 0&&i.onError(g)},this.resolveURL=function(g){return c?c(g):g},this.setURLModifier=function(g){return c=g,this},this.addHandler=function(g,m){return f.push(g,m),this},this.removeHandler=function(g){let m=f.indexOf(g);return m!==-1&&f.splice(m,2),this},this.getHandler=function(g){for(let m=0,v=f.length;m<v;m+=2){let x=f[m],S=f[m+1];if(x.global&&(x.lastIndex=0),x.test(g))return S}return null}}},slt=new $2,ks=class{constructor(t){this.manager=t!==void 0?t:slt,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let n=this;return new Promise(function(i,o){n.load(t,i,e,o)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};ks.DEFAULT_MATERIAL_NAME="__DEFAULT";var Ul={},Ub=class extends Error{constructor(t,e){super(t),this.response=e}},qa=class extends ks{constructor(t){super(t)}load(t,e,n,i){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);let o=Jc.get(t);if(o!==void 0)return this.manager.itemStart(t),setTimeout(()=>{e&&e(o),this.manager.itemEnd(t)},0),o;if(Ul[t]!==void 0){Ul[t].push({onLoad:e,onProgress:n,onError:i});return}Ul[t]=[],Ul[t].push({onLoad:e,onProgress:n,onError:i});let a=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),l=this.mimeType,c=this.responseType;fetch(a).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream=="undefined"||f.body===void 0||f.body.getReader===void 0)return f;let g=Ul[t],m=f.body.getReader(),v=f.headers.get("Content-Length")||f.headers.get("X-File-Size"),x=v?parseInt(v):0,S=x!==0,w=0,E=new ReadableStream({start(b){C();function C(){m.read().then(({done:A,value:P})=>{if(A)b.close();else{w+=P.byteLength;let F=new ProgressEvent("progress",{lengthComputable:S,loaded:w,total:x});for(let U=0,D=g.length;U<D;U++){let L=g[U];L.onProgress&&L.onProgress(F)}b.enqueue(P),C()}})}}});return new Response(E)}else throw new Ub(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(c){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(g=>new DOMParser().parseFromString(g,l));case"json":return f.json();default:if(l===void 0)return f.text();{let m=/charset="?([^;"\s]*)"?/i.exec(l),v=m&&m[1]?m[1].toLowerCase():void 0,x=new TextDecoder(v);return f.arrayBuffer().then(S=>x.decode(S))}}}).then(f=>{Jc.add(t,f);let g=Ul[t];delete Ul[t];for(let m=0,v=g.length;m<v;m++){let x=g[m];x.onLoad&&x.onLoad(f)}}).catch(f=>{let g=Ul[t];if(g===void 0)throw this.manager.itemError(t),f;delete Ul[t];for(let m=0,v=g.length;m<v;m++){let x=g[m];x.onError&&x.onError(f)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}};var Fm=class extends ks{constructor(t){super(t)}load(t,e,n,i){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);let o=this,a=Jc.get(t);if(a!==void 0)return o.manager.itemStart(t),setTimeout(function(){e&&e(a),o.manager.itemEnd(t)},0),a;let l=Sm("img");function c(){g(),Jc.add(t,this),e&&e(this),o.manager.itemEnd(t)}function f(m){g(),i&&i(m),o.manager.itemError(t),o.manager.itemEnd(t)}function g(){l.removeEventListener("load",c,!1),l.removeEventListener("error",f,!1)}return l.addEventListener("load",c,!1),l.addEventListener("error",f,!1),t.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(l.crossOrigin=this.crossOrigin),o.manager.itemStart(t),l.src=t,l}};var J2=class extends ks{constructor(t){super(t)}load(t,e,n,i){let o=this,a=new mo,l=new qa(this.manager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(o.withCredentials),l.load(t,function(c){let f;try{f=o.parse(c)}catch(g){if(i!==void 0)i(g);else{console.error(g);return}}f.image!==void 0?a.image=f.image:f.data!==void 0&&(a.image.width=f.width,a.image.height=f.height,a.image.data=f.data),a.wrapS=f.wrapS!==void 0?f.wrapS:vs,a.wrapT=f.wrapT!==void 0?f.wrapT:vs,a.magFilter=f.magFilter!==void 0?f.magFilter:tn,a.minFilter=f.minFilter!==void 0?f.minFilter:tn,a.anisotropy=f.anisotropy!==void 0?f.anisotropy:1,f.colorSpace!==void 0&&(a.colorSpace=f.colorSpace),f.flipY!==void 0&&(a.flipY=f.flipY),f.format!==void 0&&(a.format=f.format),f.type!==void 0&&(a.type=f.type),f.mipmaps!==void 0&&(a.mipmaps=f.mipmaps,a.minFilter=yu),f.mipmapCount===1&&(a.minFilter=tn),f.generateMipmaps!==void 0&&(a.generateMipmaps=f.generateMipmaps),a.needsUpdate=!0,e&&e(a,f)},n,i),a}},G0=class extends ks{constructor(t){super(t)}load(t,e,n,i){let o=new Pi,a=new Fm(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,function(l){o.image=l,o.needsUpdate=!0,e!==void 0&&e(o)},n,i),o}},Xl=class extends Se{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new ne(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){let e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,this.groundColor!==void 0&&(e.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(e.object.distance=this.distance),this.angle!==void 0&&(e.object.angle=this.angle),this.decay!==void 0&&(e.object.decay=this.decay),this.penumbra!==void 0&&(e.object.penumbra=this.penumbra),this.shadow!==void 0&&(e.object.shadow=this.shadow.toJSON()),e}},Fb=class extends Xl{constructor(t,e,n){super(t,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Se.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ne(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}},OS=new Ie,pF=new G,dF=new G,Bm=class{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ft(512,512),this.map=null,this.mapPass=null,this.matrix=new Ie,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new B0,this._frameExtents=new ft(1,1),this._viewportCount=1,this._viewports=[new Sr(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){let e=this.camera,n=this.matrix;pF.setFromMatrixPosition(t.matrixWorld),e.position.copy(pF),dF.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(dF),e.updateMatrixWorld(),OS.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(OS),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(OS)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let t={};return this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}},Bb=class extends Bm{constructor(){super(new Go(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){let e=this.camera,n=fd*2*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,o=t.distance||e.far;(n!==e.fov||i!==e.aspect||o!==e.far)&&(e.fov=n,e.aspect=i,e.far=o,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}},zm=class extends Xl{constructor(t,e,n=0,i=Math.PI/3,o=0,a=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Se.DEFAULT_UP),this.updateMatrix(),this.target=new Se,this.distance=n,this.angle=i,this.penumbra=o,this.decay=a,this.map=null,this.shadow=new Bb}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}},gF=new Ie,mm=new G,DS=new G,zb=class extends Bm{constructor(){super(new Go(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new ft(4,2),this._viewportCount=6,this._viewports=[new Sr(2,1,1,1),new Sr(0,1,1,1),new Sr(3,1,1,1),new Sr(1,1,1,1),new Sr(3,0,1,1),new Sr(1,0,1,1)],this._cubeDirections=[new G(1,0,0),new G(-1,0,0),new G(0,0,1),new G(0,0,-1),new G(0,1,0),new G(0,-1,0)],this._cubeUps=[new G(0,1,0),new G(0,1,0),new G(0,1,0),new G(0,1,0),new G(0,0,1),new G(0,0,-1)]}updateMatrices(t,e=0){let n=this.camera,i=this.matrix,o=t.distance||n.far;o!==n.far&&(n.far=o,n.updateProjectionMatrix()),mm.setFromMatrixPosition(t.matrixWorld),n.position.copy(mm),DS.copy(n.position),DS.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(DS),n.updateMatrixWorld(),i.makeTranslation(-mm.x,-mm.y,-mm.z),gF.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(gF)}},Gm=class extends Xl{constructor(t,e,n=0,i=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new zb}get power(){return this.intensity*4*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}},Gb=class extends Bm{constructor(){super(new kl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},Rf=class extends Xl{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Se.DEFAULT_UP),this.updateMatrix(),this.target=new Se,this.shadow=new Gb}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}},Pf=class extends Xl{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}},kb=class extends Xl{constructor(t,e,n=10,i=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){let e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}},Vb=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new G)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){let n=t.x,i=t.y,o=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.282095),e.addScaledVector(a[1],.488603*i),e.addScaledVector(a[2],.488603*o),e.addScaledVector(a[3],.488603*n),e.addScaledVector(a[4],1.092548*(n*i)),e.addScaledVector(a[5],1.092548*(i*o)),e.addScaledVector(a[6],.315392*(3*o*o-1)),e.addScaledVector(a[7],1.092548*(n*o)),e.addScaledVector(a[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){let n=t.x,i=t.y,o=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.886227),e.addScaledVector(a[1],2*.511664*i),e.addScaledVector(a[2],2*.511664*o),e.addScaledVector(a[3],2*.511664*n),e.addScaledVector(a[4],2*.429043*n*i),e.addScaledVector(a[5],2*.429043*i*o),e.addScaledVector(a[6],.743125*o*o-.247708),e.addScaledVector(a[7],2*.429043*n*o),e.addScaledVector(a[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(t,e=0){let n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+i*3);return this}toArray(t=[],e=0){let n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+i*3);return t}static getBasisAt(t,e){let n=t.x,i=t.y,o=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*o,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*o,e[6]=.315392*(3*o*o-1),e[7]=1.092548*n*o,e[8]=.546274*(n*n-i*i)}},Hb=class extends Xl{constructor(t=new Vb,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){let e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}},Wb=class r extends ks{constructor(t){super(t),this.textures={}}load(t,e,n,i){let o=this,a=new qa(o.manager);a.setPath(o.path),a.setRequestHeader(o.requestHeader),a.setWithCredentials(o.withCredentials),a.load(t,function(l){try{e(o.parse(JSON.parse(l)))}catch(c){i?i(c):console.error(c),o.manager.itemError(t)}},n,i)}parse(t){let e=this.textures;function n(o){return e[o]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",o),e[o]}let i=r.createMaterialFromType(t.type);if(t.uuid!==void 0&&(i.uuid=t.uuid),t.name!==void 0&&(i.name=t.name),t.color!==void 0&&i.color!==void 0&&i.color.setHex(t.color),t.roughness!==void 0&&(i.roughness=t.roughness),t.metalness!==void 0&&(i.metalness=t.metalness),t.sheen!==void 0&&(i.sheen=t.sheen),t.sheenColor!==void 0&&(i.sheenColor=new ne().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(i.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(t.emissive),t.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(t.specular),t.specularIntensity!==void 0&&(i.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(i.shininess=t.shininess),t.clearcoat!==void 0&&(i.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=t.clearcoatRoughness),t.iridescence!==void 0&&(i.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(i.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=t.iridescenceThicknessRange),t.transmission!==void 0&&(i.transmission=t.transmission),t.thickness!==void 0&&(i.thickness=t.thickness),t.attenuationDistance!==void 0&&(i.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(i.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(i.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(i.fog=t.fog),t.flatShading!==void 0&&(i.flatShading=t.flatShading),t.blending!==void 0&&(i.blending=t.blending),t.combine!==void 0&&(i.combine=t.combine),t.side!==void 0&&(i.side=t.side),t.shadowSide!==void 0&&(i.shadowSide=t.shadowSide),t.opacity!==void 0&&(i.opacity=t.opacity),t.transparent!==void 0&&(i.transparent=t.transparent),t.alphaTest!==void 0&&(i.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(i.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(i.depthFunc=t.depthFunc),t.depthTest!==void 0&&(i.depthTest=t.depthTest),t.depthWrite!==void 0&&(i.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(i.colorWrite=t.colorWrite),t.blendSrc!==void 0&&(i.blendSrc=t.blendSrc),t.blendDst!==void 0&&(i.blendDst=t.blendDst),t.blendEquation!==void 0&&(i.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(i.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(i.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(i.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(i.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(i.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(i.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(i.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(i.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(i.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(i.stencilWrite=t.stencilWrite),t.wireframe!==void 0&&(i.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(i.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(i.rotation=t.rotation),t.linewidth!==void 0&&(i.linewidth=t.linewidth),t.dashSize!==void 0&&(i.dashSize=t.dashSize),t.gapSize!==void 0&&(i.gapSize=t.gapSize),t.scale!==void 0&&(i.scale=t.scale),t.polygonOffset!==void 0&&(i.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(i.dithering=t.dithering),t.alphaToCoverage!==void 0&&(i.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(i.forceSinglePass=t.forceSinglePass),t.visible!==void 0&&(i.visible=t.visible),t.toneMapped!==void 0&&(i.toneMapped=t.toneMapped),t.userData!==void 0&&(i.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?i.vertexColors=t.vertexColors>0:i.vertexColors=t.vertexColors),t.uniforms!==void 0)for(let o in t.uniforms){let a=t.uniforms[o];switch(i.uniforms[o]={},a.type){case"t":i.uniforms[o].value=n(a.value);break;case"c":i.uniforms[o].value=new ne().setHex(a.value);break;case"v2":i.uniforms[o].value=new ft().fromArray(a.value);break;case"v3":i.uniforms[o].value=new G().fromArray(a.value);break;case"v4":i.uniforms[o].value=new Sr().fromArray(a.value);break;case"m3":i.uniforms[o].value=new Je().fromArray(a.value);break;case"m4":i.uniforms[o].value=new Ie().fromArray(a.value);break;default:i.uniforms[o].value=a.value}}if(t.defines!==void 0&&(i.defines=t.defines),t.vertexShader!==void 0&&(i.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(i.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(i.glslVersion=t.glslVersion),t.extensions!==void 0)for(let o in t.extensions)i.extensions[o]=t.extensions[o];if(t.lights!==void 0&&(i.lights=t.lights),t.clipping!==void 0&&(i.clipping=t.clipping),t.size!==void 0&&(i.size=t.size),t.sizeAttenuation!==void 0&&(i.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(i.map=n(t.map)),t.matcap!==void 0&&(i.matcap=n(t.matcap)),t.alphaMap!==void 0&&(i.alphaMap=n(t.alphaMap)),t.bumpMap!==void 0&&(i.bumpMap=n(t.bumpMap)),t.bumpScale!==void 0&&(i.bumpScale=t.bumpScale),t.normalMap!==void 0&&(i.normalMap=n(t.normalMap)),t.normalMapType!==void 0&&(i.normalMapType=t.normalMapType),t.normalScale!==void 0){let o=t.normalScale;Array.isArray(o)===!1&&(o=[o,o]),i.normalScale=new ft().fromArray(o)}return t.displacementMap!==void 0&&(i.displacementMap=n(t.displacementMap)),t.displacementScale!==void 0&&(i.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(i.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(i.roughnessMap=n(t.roughnessMap)),t.metalnessMap!==void 0&&(i.metalnessMap=n(t.metalnessMap)),t.emissiveMap!==void 0&&(i.emissiveMap=n(t.emissiveMap)),t.emissiveIntensity!==void 0&&(i.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(i.specularMap=n(t.specularMap)),t.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(t.specularIntensityMap)),t.specularColorMap!==void 0&&(i.specularColorMap=n(t.specularColorMap)),t.envMap!==void 0&&(i.envMap=n(t.envMap)),t.envMapRotation!==void 0&&i.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(i.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(i.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(i.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(i.lightMap=n(t.lightMap)),t.lightMapIntensity!==void 0&&(i.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(i.aoMap=n(t.aoMap)),t.aoMapIntensity!==void 0&&(i.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(i.gradientMap=n(t.gradientMap)),t.clearcoatMap!==void 0&&(i.clearcoatMap=n(t.clearcoatMap)),t.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),t.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),t.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ft().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(i.iridescenceMap=n(t.iridescenceMap)),t.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(t.iridescenceThicknessMap)),t.transmissionMap!==void 0&&(i.transmissionMap=n(t.transmissionMap)),t.thicknessMap!==void 0&&(i.thicknessMap=n(t.thicknessMap)),t.anisotropyMap!==void 0&&(i.anisotropyMap=n(t.anisotropyMap)),t.sheenColorMap!==void 0&&(i.sheenColorMap=n(t.sheenColorMap)),t.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}static createMaterialFromType(t){let e={ShadowMaterial:Um,SpriteMaterial:Vl,RawShaderMaterial:Ab,ShaderMaterial:gr,PointsMaterial:gd,MeshPhysicalMaterial:Wa,MeshStandardMaterial:t0,MeshPhongMaterial:Cb,MeshToonMaterial:Rb,MeshNormalMaterial:Pb,MeshLambertMaterial:Ib,MeshDepthMaterial:z2,MeshDistanceMaterial:G2,MeshBasicMaterial:yi,MeshMatcapMaterial:Lb,LineDashedMaterial:Af,LineBasicMaterial:ma,Material:ji};return new e[t]}},k0=class{static decodeText(t){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(t);let e="";for(let n=0,i=t.length;n<i;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(n){return e}}static extractUrlBase(t){let e=t.lastIndexOf("/");return e===-1?"./":t.slice(0,e+1)}static resolveURL(t,e){return typeof t!="string"||t===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}},km=class extends qe{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){let t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}},qb=class extends ks{constructor(t){super(t)}load(t,e,n,i){let o=this,a=new qa(o.manager);a.setPath(o.path),a.setRequestHeader(o.requestHeader),a.setWithCredentials(o.withCredentials),a.load(t,function(l){try{e(o.parse(JSON.parse(l)))}catch(c){i?i(c):console.error(c),o.manager.itemError(t)}},n,i)}parse(t){let e={},n={};function i(x,S){if(e[S]!==void 0)return e[S];let E=x.interleavedBuffers[S],b=o(x,E.buffer),C=td(E.type,b),A=new rh(C,E.stride);return A.uuid=E.uuid,e[S]=A,A}function o(x,S){if(n[S]!==void 0)return n[S];let E=x.arrayBuffers[S],b=new Uint32Array(E).buffer;return n[S]=b,b}let a=t.isInstancedBufferGeometry?new km:new qe,l=t.data.index;if(l!==void 0){let x=td(l.type,l.array);a.setIndex(new He(x,1))}let c=t.data.attributes;for(let x in c){let S=c[x],w;if(S.isInterleavedBufferAttribute){let E=i(t.data,S.data);w=new ns(E,S.itemSize,S.offset,S.normalized)}else{let E=td(S.type,S.array),b=S.isInstancedBufferAttribute?uo:He;w=new b(E,S.itemSize,S.normalized)}S.name!==void 0&&(w.name=S.name),S.usage!==void 0&&w.setUsage(S.usage),a.setAttribute(x,w)}let f=t.data.morphAttributes;if(f)for(let x in f){let S=f[x],w=[];for(let E=0,b=S.length;E<b;E++){let C=S[E],A;if(C.isInterleavedBufferAttribute){let P=i(t.data,C.data);A=new ns(P,C.itemSize,C.offset,C.normalized)}else{let P=td(C.type,C.array);A=new He(P,C.itemSize,C.normalized)}C.name!==void 0&&(A.name=C.name),w.push(A)}a.morphAttributes[x]=w}t.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);let m=t.data.groups||t.data.drawcalls||t.data.offsets;if(m!==void 0)for(let x=0,S=m.length;x!==S;++x){let w=m[x];a.addGroup(w.start,w.count,w.materialIndex)}let v=t.data.boundingSphere;if(v!==void 0){let x=new G;v.center!==void 0&&x.fromArray(v.center),a.boundingSphere=new ai(x,v.radius)}return t.name&&(a.name=t.name),t.userData&&(a.userData=t.userData),a}},Mu=class extends ks{constructor(t){super(t)}load(t,e,n,i){let o=this,a=this.path===""?k0.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||a;let l=new qa(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(t,function(c){let f=null;try{f=JSON.parse(c)}catch(m){i!==void 0&&i(m),console.error("THREE:ObjectLoader: Can't parse "+t+".",m.message);return}let g=f.metadata;if(g===void 0||g.type===void 0||g.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+t)),console.error("THREE.ObjectLoader: Can't load "+t);return}o.parse(f,e)},n,i)}loadAsync(t,e){return Tt(this,null,function*(){let n=this,i=this.path===""?k0.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||i;let o=new qa(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials);let a=yield o.loadAsync(t,e),l=JSON.parse(a),c=l.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+t);return yield n.parseAsync(l)})}parse(t,e){let n=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),o=this.parseGeometries(t.geometries,i),a=this.parseImages(t.images,function(){e!==void 0&&e(f)}),l=this.parseTextures(t.textures,a),c=this.parseMaterials(t.materials,l),f=this.parseObject(t.object,o,c,l,n),g=this.parseSkeletons(t.skeletons,f);if(this.bindSkeletons(f,g),e!==void 0){let m=!1;for(let v in a)if(a[v].data instanceof HTMLImageElement){m=!0;break}m===!1&&e(f)}return f}parseAsync(t){return Tt(this,null,function*(){let e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,n),o=yield this.parseImagesAsync(t.images),a=this.parseTextures(t.textures,o),l=this.parseMaterials(t.materials,a),c=this.parseObject(t.object,i,l,a,e),f=this.parseSkeletons(t.skeletons,c);return this.bindSkeletons(c,f),c})}parseShapes(t){let e={};if(t!==void 0)for(let n=0,i=t.length;n<i;n++){let o=new Qu().fromJSON(t[n]);e[o.uuid]=o}return e}parseSkeletons(t,e){let n={},i={};if(e.traverse(function(o){o.isBone&&(i[o.uuid]=o)}),t!==void 0)for(let o=0,a=t.length;o<a;o++){let l=new Cm().fromJSON(t[o],i);n[l.uuid]=l}return n}parseGeometries(t,e){let n={};if(t!==void 0){let i=new qb;for(let o=0,a=t.length;o<a;o++){let l,c=t[o];switch(c.type){case"BufferGeometry":case"InstancedBufferGeometry":l=i.parse(c);break;default:c.type in hF?l=hF[c.type].fromJSON(c,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`)}l.uuid=c.uuid,c.name!==void 0&&(l.name=c.name),c.userData!==void 0&&(l.userData=c.userData),n[c.uuid]=l}}return n}parseMaterials(t,e){let n={},i={};if(t!==void 0){let o=new Wb;o.setTextures(e);for(let a=0,l=t.length;a<l;a++){let c=t[a];n[c.uuid]===void 0&&(n[c.uuid]=o.parse(c)),i[c.uuid]=n[c.uuid]}}return i}parseAnimations(t){let e={};if(t!==void 0)for(let n=0;n<t.length;n++){let i=t[n],o=Cf.parse(i);e[o.uuid]=o}return e}parseImages(t,e){let n=this,i={},o;function a(c){return n.manager.itemStart(c),o.load(c,function(){n.manager.itemEnd(c)},void 0,function(){n.manager.itemError(c),n.manager.itemEnd(c)})}function l(c){if(typeof c=="string"){let f=c,g=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(f)?f:n.resourcePath+f;return a(g)}else return c.data?{data:td(c.type,c.data),width:c.width,height:c.height}:null}if(t!==void 0&&t.length>0){let c=new $2(e);o=new Fm(c),o.setCrossOrigin(this.crossOrigin);for(let f=0,g=t.length;f<g;f++){let m=t[f],v=m.url;if(Array.isArray(v)){let x=[];for(let S=0,w=v.length;S<w;S++){let E=v[S],b=l(E);b!==null&&(b instanceof HTMLImageElement?x.push(b):x.push(new mo(b.data,b.width,b.height)))}i[m.uuid]=new Kc(x)}else{let x=l(m.url);i[m.uuid]=new Kc(x)}}}return i}parseImagesAsync(t){return Tt(this,null,function*(){let e=this,n={},i;function o(a){return Tt(this,null,function*(){if(typeof a=="string"){let l=a,c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l)?l:e.resourcePath+l;return yield i.loadAsync(c)}else return a.data?{data:td(a.type,a.data),width:a.width,height:a.height}:null})}if(t!==void 0&&t.length>0){i=new Fm(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,l=t.length;a<l;a++){let c=t[a],f=c.url;if(Array.isArray(f)){let g=[];for(let m=0,v=f.length;m<v;m++){let x=f[m],S=yield o(x);S!==null&&(S instanceof HTMLImageElement?g.push(S):g.push(new mo(S.data,S.width,S.height)))}n[c.uuid]=new Kc(g)}else{let g=yield o(c.url);n[c.uuid]=new Kc(g)}}}return n})}parseTextures(t,e){function n(o,a){return typeof o=="number"?o:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",o),a[o])}let i={};if(t!==void 0)for(let o=0,a=t.length;o<a;o++){let l=t[o];l.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',l.uuid),e[l.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",l.image);let c=e[l.image],f=c.data,g;Array.isArray(f)?(g=new Mm,f.length===6&&(g.needsUpdate=!0)):(f&&f.data?g=new mo:g=new Pi,f&&(g.needsUpdate=!0)),g.source=c,g.uuid=l.uuid,l.name!==void 0&&(g.name=l.name),l.mapping!==void 0&&(g.mapping=n(l.mapping,alt)),l.channel!==void 0&&(g.channel=l.channel),l.offset!==void 0&&g.offset.fromArray(l.offset),l.repeat!==void 0&&g.repeat.fromArray(l.repeat),l.center!==void 0&&g.center.fromArray(l.center),l.rotation!==void 0&&(g.rotation=l.rotation),l.wrap!==void 0&&(g.wrapS=n(l.wrap[0],mF),g.wrapT=n(l.wrap[1],mF)),l.format!==void 0&&(g.format=l.format),l.internalFormat!==void 0&&(g.internalFormat=l.internalFormat),l.type!==void 0&&(g.type=l.type),l.colorSpace!==void 0&&(g.colorSpace=l.colorSpace),l.minFilter!==void 0&&(g.minFilter=n(l.minFilter,vF)),l.magFilter!==void 0&&(g.magFilter=n(l.magFilter,vF)),l.anisotropy!==void 0&&(g.anisotropy=l.anisotropy),l.flipY!==void 0&&(g.flipY=l.flipY),l.generateMipmaps!==void 0&&(g.generateMipmaps=l.generateMipmaps),l.premultiplyAlpha!==void 0&&(g.premultiplyAlpha=l.premultiplyAlpha),l.unpackAlignment!==void 0&&(g.unpackAlignment=l.unpackAlignment),l.compareFunction!==void 0&&(g.compareFunction=l.compareFunction),l.userData!==void 0&&(g.userData=l.userData),i[l.uuid]=g}return i}parseObject(t,e,n,i,o){let a;function l(v){return e[v]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",v),e[v]}function c(v){if(v!==void 0){if(Array.isArray(v)){let x=[];for(let S=0,w=v.length;S<w;S++){let E=v[S];n[E]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",E),x.push(n[E])}return x}return n[v]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",v),n[v]}}function f(v){return i[v]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",v),i[v]}let g,m;switch(t.type){case"Scene":a=new Tm,t.background!==void 0&&(Number.isInteger(t.background)?a.background=new ne(t.background):a.background=f(t.background)),t.environment!==void 0&&(a.environment=f(t.environment)),t.fog!==void 0&&(t.fog.type==="Fog"?a.fog=new nb(t.fog.color,t.fog.near,t.fog.far):t.fog.type==="FogExp2"&&(a.fog=new eb(t.fog.color,t.fog.density)),t.fog.name!==""&&(a.fog.name=t.fog.name)),t.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=t.backgroundBlurriness),t.backgroundIntensity!==void 0&&(a.backgroundIntensity=t.backgroundIntensity),t.backgroundRotation!==void 0&&a.backgroundRotation.fromArray(t.backgroundRotation),t.environmentRotation!==void 0&&a.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":a=new Go(t.fov,t.aspect,t.near,t.far),t.focus!==void 0&&(a.focus=t.focus),t.zoom!==void 0&&(a.zoom=t.zoom),t.filmGauge!==void 0&&(a.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(a.filmOffset=t.filmOffset),t.view!==void 0&&(a.view=Object.assign({},t.view));break;case"OrthographicCamera":a=new kl(t.left,t.right,t.top,t.bottom,t.near,t.far),t.zoom!==void 0&&(a.zoom=t.zoom),t.view!==void 0&&(a.view=Object.assign({},t.view));break;case"AmbientLight":a=new Pf(t.color,t.intensity);break;case"DirectionalLight":a=new Rf(t.color,t.intensity);break;case"PointLight":a=new Gm(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":a=new kb(t.color,t.intensity,t.width,t.height);break;case"SpotLight":a=new zm(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":a=new Fb(t.color,t.groundColor,t.intensity);break;case"LightProbe":a=new Hb().fromJSON(t);break;case"SkinnedMesh":g=l(t.geometry),m=c(t.material),a=new Am(g,m),t.bindMode!==void 0&&(a.bindMode=t.bindMode),t.bindMatrix!==void 0&&a.bindMatrix.fromArray(t.bindMatrix),t.skeleton!==void 0&&(a.skeleton=t.skeleton);break;case"Mesh":g=l(t.geometry),m=c(t.material),a=new en(g,m);break;case"InstancedMesh":g=l(t.geometry),m=c(t.material);let v=t.count,x=t.instanceMatrix,S=t.instanceColor;a=new Gs(g,m,v),a.instanceMatrix=new uo(new Float32Array(x.array),16),S!==void 0&&(a.instanceColor=new uo(new Float32Array(S.array),S.itemSize));break;case"BatchedMesh":g=l(t.geometry),m=c(t.material),a=new ob(t.maxGeometryCount,t.maxVertexCount,t.maxIndexCount,m),a.geometry=g,a.perObjectFrustumCulled=t.perObjectFrustumCulled,a.sortObjects=t.sortObjects,a._drawRanges=t.drawRanges,a._reservedRanges=t.reservedRanges,a._visibility=t.visibility,a._active=t.active,a._bounds=t.bounds.map(w=>{let E=new Fe;E.min.fromArray(w.boxMin),E.max.fromArray(w.boxMax);let b=new ai;return b.radius=w.sphereRadius,b.center.fromArray(w.sphereCenter),{boxInitialized:w.boxInitialized,box:E,sphereInitialized:w.sphereInitialized,sphere:b}}),a._maxGeometryCount=t.maxGeometryCount,a._maxVertexCount=t.maxVertexCount,a._maxIndexCount=t.maxIndexCount,a._geometryInitialized=t.geometryInitialized,a._geometryCount=t.geometryCount,a._matricesTexture=f(t.matricesTexture.uuid);break;case"LOD":a=new rb;break;case"Line":a=new Hl(l(t.geometry),c(t.material));break;case"LineLoop":a=new Rm(l(t.geometry),c(t.material));break;case"LineSegments":a=new Yi(l(t.geometry),c(t.material));break;case"PointCloud":case"Points":a=new Pm(l(t.geometry),c(t.material));break;case"Sprite":a=new Ha(c(t.material));break;case"Group":a=new es;break;case"Bone":a=new dd;break;default:a=new Se}if(a.uuid=t.uuid,t.name!==void 0&&(a.name=t.name),t.matrix!==void 0?(a.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=t.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(t.position!==void 0&&a.position.fromArray(t.position),t.rotation!==void 0&&a.rotation.fromArray(t.rotation),t.quaternion!==void 0&&a.quaternion.fromArray(t.quaternion),t.scale!==void 0&&a.scale.fromArray(t.scale)),t.up!==void 0&&a.up.fromArray(t.up),t.castShadow!==void 0&&(a.castShadow=t.castShadow),t.receiveShadow!==void 0&&(a.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.bias!==void 0&&(a.shadow.bias=t.shadow.bias),t.shadow.normalBias!==void 0&&(a.shadow.normalBias=t.shadow.normalBias),t.shadow.radius!==void 0&&(a.shadow.radius=t.shadow.radius),t.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(a.visible=t.visible),t.frustumCulled!==void 0&&(a.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(a.renderOrder=t.renderOrder),t.userData!==void 0&&(a.userData=t.userData),t.layers!==void 0&&(a.layers.mask=t.layers),t.children!==void 0){let v=t.children;for(let x=0;x<v.length;x++)a.add(this.parseObject(v[x],e,n,i,o))}if(t.animations!==void 0){let v=t.animations;for(let x=0;x<v.length;x++){let S=v[x];a.animations.push(o[S])}}if(t.type==="LOD"){t.autoUpdate!==void 0&&(a.autoUpdate=t.autoUpdate);let v=t.levels;for(let x=0;x<v.length;x++){let S=v[x],w=a.getObjectByProperty("uuid",S.object);w!==void 0&&a.addLevel(w,S.distance,S.hysteresis)}}return a}bindSkeletons(t,e){Object.keys(e).length!==0&&t.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){let i=e[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}},alt={UVMapping:Jb,CubeReflectionMapping:yf,CubeRefractionMapping:xf,EquirectangularReflectionMapping:ud,EquirectangularRefractionMapping:w2,CubeUVReflectionMapping:Vm},mF={RepeatWrapping:zs,ClampToEdgeWrapping:vs,MirroredRepeatWrapping:ld},vF={NearestFilter:so,NearestMipmapNearestFilter:Em,NearestMipmapLinearFilter:jc,LinearFilter:tn,LinearMipmapNearestFilter:id,LinearMipmapLinearFilter:yu},Q2=class extends ks{constructor(t){super(t),this.isImageBitmapLoader=!0,typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,n,i){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);let o=this,a=Jc.get(t);if(a!==void 0){if(o.manager.itemStart(t),a.then){a.then(f=>{e&&e(f),o.manager.itemEnd(t)}).catch(f=>{i&&i(f)});return}return setTimeout(function(){e&&e(a),o.manager.itemEnd(t)},0),a}let l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader;let c=fetch(t,l).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(f){return Jc.add(t,f),e&&e(f),o.manager.itemEnd(t),f}).catch(function(f){i&&i(f),Jc.remove(t),o.manager.itemError(t),o.manager.itemEnd(t)});Jc.add(t,c),o.manager.itemStart(t)}};var Xb=class{constructor(t,e,n){this.binding=t,this.valueSize=n;let i,o,a;switch(e){case"quaternion":i=this._slerp,o=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,o=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,o=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=o,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){let n=this.buffer,i=this.valueSize,o=t*i+i,a=this.cumulativeWeight;if(a===0){for(let l=0;l!==i;++l)n[o+l]=n[l];a=e}else{a+=e;let l=e/a;this._mixBufferRegion(n,o,0,l,i)}this.cumulativeWeight=a}accumulateAdditive(t){let e=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){let e=this.valueSize,n=this.buffer,i=t*e+e,o=this.cumulativeWeight,a=this.cumulativeWeightAdditive,l=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,o<1){let c=e*this._origIndex;this._mixBufferRegion(n,i,c,1-o,e)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let c=e,f=e+e;c!==f;++c)if(n[c]!==n[c+e]){l.setValue(n,i);break}}saveOriginalState(){let t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let o=n,a=i;o!==a;++o)e[o]=e[i+o%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let t=this.valueSize*3;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){let t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,i,o){if(i>=.5)for(let a=0;a!==o;++a)t[e+a]=t[n+a]}_slerp(t,e,n,i){Xi.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,o){let a=this._workIndex*o;Xi.multiplyQuaternionsFlat(t,a,t,e,t,n),Xi.slerpFlat(t,e,t,e,t,a,i)}_lerp(t,e,n,i,o){let a=1-i;for(let l=0;l!==o;++l){let c=e+l;t[c]=t[c]*a+t[n+l]*i}}_lerpAdditive(t,e,n,i,o){for(let a=0;a!==o;++a){let l=e+a;t[l]=t[l]+t[n+a]*i}}},oM="\\[\\]\\.:\\/",ult=new RegExp("["+oM+"]","g"),sM="[^"+oM+"]",llt="[^"+oM.replace("\\.","")+"]",clt=/((?:WC+[\/:])*)/.source.replace("WC",sM),hlt=/(WCOD+)?/.source.replace("WCOD",llt),flt=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",sM),plt=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",sM),dlt=new RegExp("^"+clt+hlt+flt+plt+"$"),glt=["material","materials","bones","map"],jb=class{constructor(t,e,n){let i=n||Jr.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(t,e)}setValue(t,e){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},Jr=class r{constructor(t,e,n){this.path=e,this.parsedPath=n||r.parseTrackName(e),this.node=r.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new r.Composite(t,e,n):new r(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(ult,"")}static parseTrackName(t){let e=dlt.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let o=n.nodeName.substring(i+1);glt.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){let n=function(o){for(let a=0;a<o.length;a++){let l=o[a];if(l.name===e||l.uuid===e)return l;let c=n(l.children);if(c)return c}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,n=e.objectName,i=e.propertyName,o=e.propertyIndex;if(t||(t=r.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let f=e.objectIndex;switch(n){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let g=0;g<t.length;g++)if(t[g].name===f){f=g;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(f!==void 0){if(t[f]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[f]}}let a=t[i];if(a===void 0){let f=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+f+"."+i+" but it wasn't found.",t);return}let l=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?l=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(l=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(o!==void 0){if(i==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[o]!==void 0&&(o=t.morphTargetDictionary[o])}c=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=o}else a.fromArray!==void 0&&a.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(c=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][l]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Jr.Composite=jb;Jr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Jr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Jr.prototype.GetterByBindingType=[Jr.prototype._getValue_direct,Jr.prototype._getValue_array,Jr.prototype._getValue_arrayElement,Jr.prototype._getValue_toArray];Jr.prototype.SetterByBindingTypeAndVersioning=[[Jr.prototype._setValue_direct,Jr.prototype._setValue_direct_setNeedsUpdate,Jr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Jr.prototype._setValue_array,Jr.prototype._setValue_array_setNeedsUpdate,Jr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Jr.prototype._setValue_arrayElement,Jr.prototype._setValue_arrayElement_setNeedsUpdate,Jr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Jr.prototype._setValue_fromArray,Jr.prototype._setValue_fromArray_setNeedsUpdate,Jr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Yb=class{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;let o=e.tracks,a=o.length,l=new Array(a),c={endingStart:Jp,endingEnd:Jp};for(let f=0;f!==a;++f){let g=o[f].createInterpolant(null);l[f]=g,g.settings=c}this._interpolantSettings=c,this._interpolants=l,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Zrt,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){let i=this._clip.duration,o=t._clip.duration,a=o/i,l=i/o;t.warp(1,a,e),this.warp(l,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){let t=this._weightInterpolant;return t!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){let i=this._mixer,o=i.time,a=this.timeScale,l=this._timeScaleInterpolant;l===null&&(l=i._lendControlInterpolant(),this._timeScaleInterpolant=l);let c=l.parameterPositions,f=l.sampleValues;return c[0]=o,c[1]=o+n,f[0]=t/a,f[1]=e/a,this}stopWarping(){let t=this._timeScaleInterpolant;return t!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled){this._updateWeight(t);return}let o=this._startTime;if(o!==null){let c=(t-o)*n;c<0||n===0?e=0:(this._startTime=null,e=n*c)}e*=this._updateTimeScale(t);let a=this._updateTime(e),l=this._updateWeight(t);if(l>0){let c=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case $rt:for(let g=0,m=c.length;g!==m;++g)c[g].evaluate(a),f[g].accumulateAdditive(l);break;case tM:default:for(let g=0,m=c.length;g!==m;++g)c[g].evaluate(a),f[g].accumulate(i,l)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;let n=this._weightInterpolant;if(n!==null){let i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;let n=this._timeScaleInterpolant;if(n!==null){let i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopWarping(),e===0?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){let e=this._clip.duration,n=this.loop,i=this.time+t,o=this._loopCount,a=n===Krt;if(t===0)return o===-1?i:a&&(o&1)===1?e-i:i;if(n===Yrt){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else if(i<0)i=0;else{this.time=i;break t}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(o===-1&&(t>=0?(o=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=e||i<0){let l=Math.floor(i/e);i-=e*l,o+=Math.abs(l);let c=this.repetitions-o;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(c===1){let f=t<0;this._setEndings(f,!f,a)}else this._setEndings(!1,!1,a);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:l})}}else this.time=i;if(a&&(o&1)===1)return e-i}return i}_setEndings(t,e,n){let i=this._interpolantSettings;n?(i.endingStart=Qp,i.endingEnd=Qp):(t?i.endingStart=this.zeroSlopeAtStart?Qp:Jp:i.endingStart=T2,e?i.endingEnd=this.zeroSlopeAtEnd?Qp:Jp:i.endingEnd=T2)}_scheduleFading(t,e,n){let i=this._mixer,o=i.time,a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);let l=a.parameterPositions,c=a.sampleValues;return l[0]=o,c[0]=e,l[1]=o+t,c[1]=n,this}},mlt=new Float32Array(1),tx=class extends Sn{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){let n=t._localRoot||this._root,i=t._clip.tracks,o=i.length,a=t._propertyBindings,l=t._interpolants,c=n.uuid,f=this._bindingsByRootAndName,g=f[c];g===void 0&&(g={},f[c]=g);for(let m=0;m!==o;++m){let v=i[m],x=v.name,S=g[x];if(S!==void 0)++S.referenceCount,a[m]=S;else{if(S=a[m],S!==void 0){S._cacheIndex===null&&(++S.referenceCount,this._addInactiveBinding(S,c,x));continue}let w=e&&e._propertyBindings[m].binding.parsedPath;S=new Xb(Jr.create(n,x,w),v.ValueTypeName,v.getValueSize()),++S.referenceCount,this._addInactiveBinding(S,c,x),a[m]=S}l[m].resultBuffer=S.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(t._cacheIndex===null){let n=(t._localRoot||this._root).uuid,i=t._clip.uuid,o=this._actionsByClip[i];this._bindAction(t,o&&o.knownActions[0]),this._addInactiveAction(t,i,n)}let e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){let o=e[n];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){let e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){let o=e[n];--o.useCount===0&&(o.restoreOriginalState(),this._takeBackBinding(o))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){let e=t._cacheIndex;return e!==null&&e<this._nActiveActions}_addInactiveAction(t,e,n){let i=this._actions,o=this._actionsByClip,a=o[e];if(a===void 0)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,o[e]=a;else{let l=a.knownActions;t._byClipCacheIndex=l.length,l.push(t)}t._cacheIndex=i.length,i.push(t),a.actionByRoot[n]=t}_removeInactiveAction(t){let e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;let o=t._clip.uuid,a=this._actionsByClip,l=a[o],c=l.knownActions,f=c[c.length-1],g=t._byClipCacheIndex;f._byClipCacheIndex=g,c[g]=f,c.pop(),t._byClipCacheIndex=null;let m=l.actionByRoot,v=(t._localRoot||this._root).uuid;delete m[v],c.length===0&&delete a[o],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){let e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){let o=e[n];--o.referenceCount===0&&this._removeInactiveBinding(o)}}_lendAction(t){let e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,o=e[i];t._cacheIndex=i,e[i]=t,o._cacheIndex=n,e[n]=o}_takeBackAction(t){let e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,o=e[i];t._cacheIndex=i,e[i]=t,o._cacheIndex=n,e[n]=o}_addInactiveBinding(t,e,n){let i=this._bindingsByRootAndName,o=this._bindings,a=i[e];a===void 0&&(a={},i[e]=a),a[n]=t,t._cacheIndex=o.length,o.push(t)}_removeInactiveBinding(t){let e=this._bindings,n=t.binding,i=n.rootNode.uuid,o=n.path,a=this._bindingsByRootAndName,l=a[i],c=e[e.length-1],f=t._cacheIndex;c._cacheIndex=f,e[f]=c,e.pop(),delete l[o],Object.keys(l).length===0&&delete a[i]}_lendBinding(t){let e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,o=e[i];t._cacheIndex=i,e[i]=t,o._cacheIndex=n,e[n]=o}_takeBackBinding(t){let e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,o=e[i];t._cacheIndex=i,e[i]=t,o._cacheIndex=n,e[n]=o}_lendControlInterpolant(){let t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return n===void 0&&(n=new Z2(new Float32Array(2),new Float32Array(2),1,mlt),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){let e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,o=e[i];t.__cacheIndex=i,e[i]=t,o.__cacheIndex=n,e[n]=o}clipAction(t,e,n){let i=e||this._root,o=i.uuid,a=typeof t=="string"?Cf.findByName(i,t):t,l=a!==null?a.uuid:t,c=this._actionsByClip[l],f=null;if(n===void 0&&(a!==null?n=a.blendMode:n=tM),c!==void 0){let m=c.actionByRoot[o];if(m!==void 0&&m.blendMode===n)return m;f=c.knownActions[0],a===null&&(a=f._clip)}if(a===null)return null;let g=new Yb(this,a,e,n);return this._bindAction(g,f),this._addInactiveAction(g,l,o),g}existingAction(t,e){let n=e||this._root,i=n.uuid,o=typeof t=="string"?Cf.findByName(n,t):t,a=o?o.uuid:t,l=this._actionsByClip[a];return l!==void 0&&l.actionByRoot[i]||null}stopAllAction(){let t=this._actions,e=this._nActiveActions;for(let n=e-1;n>=0;--n)t[n].stop();return this}update(t){t*=this.timeScale;let e=this._actions,n=this._nActiveActions,i=this.time+=t,o=Math.sign(t),a=this._accuIndex^=1;for(let f=0;f!==n;++f)e[f]._update(i,t,o,a);let l=this._bindings,c=this._nActiveBindings;for(let f=0;f!==c;++f)l[f].apply(a);return this}setTime(t){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){let e=this._actions,n=t.uuid,i=this._actionsByClip,o=i[n];if(o!==void 0){let a=o.knownActions;for(let l=0,c=a.length;l!==c;++l){let f=a[l];this._deactivateAction(f);let g=f._cacheIndex,m=e[e.length-1];f._cacheIndex=null,f._byClipCacheIndex=null,m._cacheIndex=g,e[g]=m,e.pop(),this._removeInactiveBindingsForAction(f)}delete i[n]}}uncacheRoot(t){let e=t.uuid,n=this._actionsByClip;for(let a in n){let l=n[a].actionByRoot,c=l[e];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}let i=this._bindingsByRootAndName,o=i[e];if(o!==void 0)for(let a in o){let l=o[a];l.restoreOriginalState(),this._removeInactiveBinding(l)}}uncacheAction(t,e){let n=this.existingAction(t,e);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}};var If=class extends rh{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){let e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){let e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}};var _F=new Ie,md=class{constructor(t,e,n=0,i=1/0){this.ray=new da(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new bm,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return _F.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(_F),this}intersectObject(t,e=!0,n=[]){return Zb(t,this,n,e),n.sort(yF),n}intersectObjects(t,e=!0,n=[]){for(let i=0,o=t.length;i<o;i++)Zb(t[i],this,n,e);return n.sort(yF),n}};function yF(r,t){return r.distance-t.distance}function Zb(r,t,e,n){if(r.layers.test(t.layers)&&r.raycast(t,e),n===!0){let i=r.children;for(let o=0,a=i.length;o<a;o++)Zb(i[o],t,e,!0)}}var Lf=class{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(Ri(e/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var xF=new ft,V0=class{constructor(t=new ft(1/0,1/0),e=new ft(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let n=xF.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,xF).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},EF=new G,b2=new G,ex=class{constructor(t=new G,e=new G){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){EF.subVectors(t,this.start),b2.subVectors(this.end,this.start);let n=b2.dot(b2),o=b2.dot(EF)/n;return e&&(o=Ri(o,0,1)),o}closestPointToPoint(t,e,n){let i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Kb}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Kb);var noe=H(ze(),1);var JTt=H(n0(),1),QTt=H(r0(),1),tAt=H(i0(),1),eAt=H(o0(),1),nAt=H(s0(),1),rAt=H(a0(),1),iAt=H(u0(),1),oAt=H(ze(),1),ui=class{requestAnimationFrame(t){let e=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(e),t()});return this.tasks.requestAnimation.add(e),e}cancelAnimationFrame(t){this.tasks.requestAnimation.delete(t),window.cancelAnimationFrame(t)}setTimeout(t,e){let n=window.setTimeout(()=>{this.tasks.timeout.delete(n),t()},e);return this.tasks.timeout.add(n),n}clearTimeout(t){this.tasks.timeout.delete(t),window.clearTimeout(t)}setInterval(t,e){let n=window.setInterval(()=>{t()},e);return this.tasks.interval.add(n),n}clearInterval(t){this.tasks.interval.delete(t),window.clearInterval(t)}requestIdleCallback(t,e){let n=window.requestIdleCallback(i=>{this.tasks.requestIdleCallback.delete(n),t(i)},e);return this.tasks.requestIdleCallback.add(n),n}cancelIdleCallback(t){this.tasks.requestIdleCallback.delete(t),window.cancelIdleCallback(t)}dispose(){this.tasks.requestAnimation.forEach(t=>{window.cancelAnimationFrame(t)}),this.tasks.requestAnimation.clear(),this.tasks.requestIdleCallback.forEach(t=>{window.cancelIdleCallback(t)}),this.tasks.requestIdleCallback.clear(),this.tasks.timeout.forEach(t=>{window.clearTimeout(t)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(t=>{window.clearInterval(t)}),this.tasks.interval.clear()}constructor(){this.tasks={requestAnimation:new Set,requestIdleCallback:new Set,timeout:new Set,interval:new Set}}};var aAt=H(ze(),1),uAt=H(En(),1);function cM(){let r=new es,t=new Pf(16777215,2.6);return r.add(t),r}function qm(r,t){t===void 0&&(t=[]);let e=new Qu(r.map(n=>new ft(...n)));return t.length&&t.forEach(n=>{var i=new Sf(n.map(o=>new ft(...o)));e.holes.push(i)}),e}function hM(r,t){r===void 0&&(r=16777215),t===void 0&&(t=1);let e=new Rf(r,t);return e.castShadow=!0,e.shadow.radius=8,e.shadow.bias=-.001,e.shadow.mapSize.set(256,256),e.shadow.camera.left=-200,e.shadow.camera.right=200,e.shadow.camera.top=200,e.shadow.camera.bottom=-200,e}function Lr(r,t){if(t&&r.children&&r.children.length&&r.children.forEach(e=>{Lr(e,t)}),r.isMesh){let e=r;e.geometry&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(n=>{n.dispose()}):e.material.dispose())}r.isLight&&(r.dispose==null||r.dispose.call(r))}var yAt=H(Xa(),1);function yM(r){return/[\u4E00-\u9FA5]+/g.test(r)}var iYt=H(ze(),1);var ko=63710088e-1,EAt={centimeters:ko*100,centimetres:ko*100,degrees:ko/111325,feet:ko*3.28084,inches:ko*39.37,kilometers:ko/1e3,kilometres:ko/1e3,meters:ko,metres:ko,miles:ko/1609.344,millimeters:ko*1e3,millimetres:ko*1e3,nauticalmiles:ko/1852,radians:1,yards:ko*1.0936},SAt={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/ko,yards:1.0936133};function xs(r,t,e){e===void 0&&(e={});var n={type:"Feature"};return(e.id===0||e.id)&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.properties=t||{},n.geometry=r,n}function Rr(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!H0(r[0])||!H0(r[1]))throw new Error("coordinates must contain numbers");var n={type:"Point",coordinates:r};return xs(n,t,e)}function br(r,t,e){e===void 0&&(e={});for(var n=0,i=r;n<i.length;n++){var o=i[n];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<o[o.length-1].length;a++)if(o[o.length-1][a]!==o[0][a])throw new Error("First and last Position are not equivalent.")}var l={type:"Polygon",coordinates:r};return xs(l,t,e)}function Vo(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var n={type:"LineString",coordinates:r};return xs(n,t,e)}function lr(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}function xM(r,t,e){e===void 0&&(e={});var n={type:"MultiPoint",coordinates:r};return xs(n,t,e)}function W0(r,t,e){e===void 0&&(e={});var n={type:"MultiPolygon",coordinates:r};return xs(n,t,e)}function H0(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function yo(r,t,e){if(r!==null)for(var n,i,o,a,l,c,f,g=0,m=0,v,x=r.type,S=x==="FeatureCollection",w=x==="Feature",E=S?r.features.length:1,b=0;b<E;b++){f=S?r.features[b].geometry:w?r.geometry:r,v=f?f.type==="GeometryCollection":!1,l=v?f.geometries.length:1;for(var C=0;C<l;C++){var A=0,P=0;if(a=v?f.geometries[C]:f,a!==null){c=a.coordinates;var F=a.type;switch(g=e&&(F==="Polygon"||F==="MultiPolygon")?1:0,F){case null:break;case"Point":if(t(c,m,b,A,P)===!1)return!1;m++,A++;break;case"LineString":case"MultiPoint":for(n=0;n<c.length;n++){if(t(c[n],m,b,A,P)===!1)return!1;m++,F==="MultiPoint"&&A++}F==="LineString"&&A++;break;case"Polygon":case"MultiLineString":for(n=0;n<c.length;n++){for(i=0;i<c[n].length-g;i++){if(t(c[n][i],m,b,A,P)===!1)return!1;m++}F==="MultiLineString"&&A++,F==="Polygon"&&P++}F==="Polygon"&&A++;break;case"MultiPolygon":for(n=0;n<c.length;n++){for(P=0,i=0;i<c[n].length;i++){for(o=0;o<c[n][i].length-g;o++){if(t(c[n][i][o],m,b,A,P)===!1)return!1;m++}P++}A++}break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(yo(a.geometries[n],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function XB(r,t,e,n){var i=e;return yo(r,function(o,a,l,c,f){a===0&&e===void 0?i=o:i=t(i,o,a,l,c,f)},n),i}function hh(r,t){var e,n,i,o,a,l,c,f,g,m,v=0,x=r.type==="FeatureCollection",S=r.type==="Feature",w=x?r.features.length:1;for(e=0;e<w;e++){for(l=x?r.features[e].geometry:S?r.geometry:r,f=x?r.features[e].properties:S?r.properties:{},g=x?r.features[e].bbox:S?r.bbox:void 0,m=x?r.features[e].id:S?r.id:void 0,c=l?l.type==="GeometryCollection":!1,a=c?l.geometries.length:1,i=0;i<a;i++){if(o=c?l.geometries[i]:l,o===null){if(t(null,v,f,g,m)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,v,f,g,m)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<o.geometries.length;n++)if(t(o.geometries[n],v,f,g,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function ja(r,t){hh(r,function(e,n,i,o,a){var l=e===null?null:e.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return t(xs(e,i,{bbox:o,id:a}),n,0)===!1?!1:void 0}var c;switch(l){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var f=0;f<e.coordinates.length;f++){var g=e.coordinates[f],m={type:c,coordinates:g};if(t(xs(m,i),n,f)===!1)return!1}})}function EM(r){var t=[1/0,1/0,-1/0,-1/0];return yo(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}EM.default=EM;var Ho=EM;function rs(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function SM(r,t,e){if(!r)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!r.geometry||r.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+r.geometry.type)}function xo(r){return r.type==="Feature"?r.geometry:r}var Rht=H(px(),1);var zht=H(cz(),1);function Li(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("point is required");if(!t)throw new Error("polygon is required");var n=rs(r),i=xo(t),o=i.type,a=t.bbox,l=i.coordinates;if(a&&Ght(n,a)===!1)return!1;o==="Polygon"&&(l=[l]);for(var c=!1,f=0;f<l.length&&!c;f++)if(hz(n,l[f][0],e.ignoreBoundary)){for(var g=!1,m=1;m<l[f].length&&!g;)hz(n,l[f][m],!e.ignoreBoundary)&&(g=!0),m++;g||(c=!0)}return c}function hz(r,t,e){var n=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var i=0,o=t.length-1;i<t.length;o=i++){var a=t[i][0],l=t[i][1],c=t[o][0],f=t[o][1],g=r[1]*(a-c)+l*(c-r[0])+f*(r[0]-a)===0&&(a-r[0])*(c-r[0])<=0&&(l-r[1])*(f-r[1])<=0;if(g)return!e;var m=l>r[1]!=f>r[1]&&r[0]<(c-a)*(r[1]-l)/(f-l)+a;m&&(n=!n)}return n}function Ght(r,t){return t[0]<=r[0]&&t[1]<=r[1]&&t[2]>=r[0]&&t[3]>=r[1]}var dz=new ArrayBuffer(16),$Ct=new Float64Array(dz),JCt=new Uint32Array(dz);var eft=H(BM(),1);var MPt=function(){function r(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(var e=0;e<this.length-1;e++){var n=this.points[e],i=this.points[e+1];this.centers.push({x:(n.x+i.x)/2,y:(n.y+i.y)/2,z:(n.z+i.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var o=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,a=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,l=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+o),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+a),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+l)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+o),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+a),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+l)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return r.prototype.cacheSteps=function(t){var e=[],n=this.pos(0);e.push(0);for(var i=0;i<this.duration;i+=10){var o=this.pos(i),a=Math.sqrt((o.x-n.x)*(o.x-n.x)+(o.y-n.y)*(o.y-n.y)+(o.z-n.z)*(o.z-n.z));a>t&&(e.push(i),n=o)}return e},r.prototype.vector=function(t){var e=this.pos(t+10),n=this.pos(t-10);return{angle:180*Math.atan2(e.y-n.y,e.x-n.x)/3.14,speed:Math.sqrt((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)+(n.z-e.z)*(n.z-e.z))}},r.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var n=e/this.duration;if(n>=1)return this.points[this.length-1];var i=Math.floor((this.points.length-1)*n),o=(this.length-1)*n-i;return nft(o,this.points[i],this.controls[i][1],this.controls[i+1][0],this.points[i+1])},r}();function nft(r,t,e,n,i){var o=rft(r),a={x:i.x*o[0]+n.x*o[1]+e.x*o[2]+t.x*o[3],y:i.y*o[0]+n.y*o[1]+e.y*o[2]+t.y*o[3],z:i.z*o[0]+n.z*o[1]+e.z*o[2]+t.z*o[3]};return a}function rft(r){var t=r*r,e=t*r;return[e,3*t*(1-r),3*r*(1-r)*(1-r),(1-r)*(1-r)*(1-r)]}function Zm(r,t){t===void 0&&(t={});var e=Number(r[0]),n=Number(r[1]),i=Number(r[2]),o=Number(r[3]);if(r.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var a=[e,n],l=[e,o],c=[i,o],f=[i,n];return br([[a,f,c,l,a]],t.properties,{bbox:r,id:t.id})}function ift(r){return Zm(Ho(r))}var zM=ift;function oft(r,t){t===void 0&&(t={});var e=Ho(r),n=(e[0]+e[2])/2,i=(e[1]+e[3])/2;return Rr([n,i],t.properties,t)}var fh=oft;var Sft=H(wz(),1);var Zft=H(Px(),1);var $ft=H(px(),1);var tpt=H(BM(),1);var Hz=Math.PI/180,Wz=180/Math.PI,nv=function(r,t){this.lon=r,this.lat=t,this.x=Hz*r,this.y=Hz*t};nv.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};nv.prototype.antipode=function(){var r=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new nv(t,r)};var qz=function(){this.coords=[],this.length=0};qz.prototype.move_to=function(r){this.length++,this.coords.push(r)};var ow=function(r){this.properties=r||{},this.geometries=[]};ow.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var r=[],t=0;t<this.geometries.length;t++)r.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:r},type:"Feature",properties:this.properties}};ow.prototype.wkt=function(){for(var r="",t="LINESTRING(",e=function(o){t+=o[0]+" "+o[1]+","},n=0;n<this.geometries.length;n++){if(this.geometries[n].coords.length===0)return"LINESTRING(empty)";var i=this.geometries[n].coords;i.forEach(e),r+=t.substring(0,t.length-1)+")"}return r};var Xz=function(r,t,e){if(!r||r.x===void 0||r.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new nv(r.x,r.y),this.end=new nv(t.x,t.y),this.properties=e||{};var n=this.start.x-this.end.x,i=this.start.y-this.end.y,o=Math.pow(Math.sin(i/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(n/2),2);if(this.g=2*Math.asin(Math.sqrt(o)),this.g===Math.PI)throw new Error("it appears "+r.view()+" and "+t.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+r+" and "+t)};Xz.prototype.interpolate=function(r){var t=Math.sin((1-r)*this.g)/Math.sin(this.g),e=Math.sin(r*this.g)/Math.sin(this.g),n=t*Math.cos(this.start.y)*Math.cos(this.start.x)+e*Math.cos(this.end.y)*Math.cos(this.end.x),i=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),o=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),a=Wz*Math.atan2(o,Math.sqrt(Math.pow(n,2)+Math.pow(i,2))),l=Wz*Math.atan2(i,n);return[l,a]};Xz.prototype.Arc=function(r,t){var e=[];if(!r||r<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var n=1/(r-1),i=0;i<r;++i){var o=n*i,a=this.interpolate(o);e.push(a)}for(var l=!1,c=0,f=t&&t.offset?t.offset:10,g=180-f,m=-180+f,v=360-f,x=1;x<e.length;++x){var S=e[x-1][0],w=e[x][0],E=Math.abs(w-S);E>v&&(w>g&&S<m||S>g&&w<m)?l=!0:E>c&&(c=E)}var b=[];if(l&&c<f){var C=[];b.push(C);for(var A=0;A<e.length;++A){var P=parseFloat(e[A][0]);if(A>0&&Math.abs(P-e[A-1][0])>v){var F=parseFloat(e[A-1][0]),U=parseFloat(e[A-1][1]),D=parseFloat(e[A][0]),L=parseFloat(e[A][1]);if(F>-180&&F<m&&D===180&&A+1<e.length&&e[A-1][0]>-180&&e[A-1][0]<m){C.push([-180,e[A][1]]),A++,C.push([e[A][0],e[A][1]]);continue}else if(F>g&&F<180&&D===-180&&A+1<e.length&&e[A-1][0]>g&&e[A-1][0]<180){C.push([180,e[A][1]]),A++,C.push([e[A][0],e[A][1]]);continue}if(F<m&&D>g){var tt=F;F=D,D=tt;var O=U;U=L,L=O}if(F>g&&D<m&&(D+=360),F<=180&&D>=180&&F<D){var V=(180-F)/(D-F),W=V*L+(1-V)*U;C.push([e[A-1][0]>g?180:-180,W]),C=[],C.push([e[A-1][0]>g?-180:180,W]),b.push(C)}else C=[],b.push(C);C.push([P,e[A][1]])}else C.push([e[A][0],e[A][1]])}}else{var St=[];b.push(St);for(var j=0;j<e.length;++j)St.push([e[j][0],e[j][1]])}for(var pt=new ow(this.properties),mt=0;mt<b.length;++mt){var Lt=new qz;pt.geometries.push(Lt);for(var yt=b[mt],bt=0;bt<yt.length;++bt)Lt.move_to(yt[bt])}return pt};var rpt=H(Px(),1);var ngt=H(Px(),1);var rgt=H(Nw(),1);var sgt=H(px(),1);var Tn=[],An=[],Cn=[],Rn=[],Pn=[],In=[],Ln=[],Nn=[],On=[],Dn=[],Un=[],Fn=[],Bn=[],zn=[],Gn=[],kn=[],Vn=[],Hn=[],Wn=[],qn=[],Xn=[],jn=[],Yn=[],Zn=[];Ln[85]=Dn[85]=-1;Nn[85]=Un[85]=0;On[85]=Fn[85]=1;Wn[85]=jn[85]=1;qn[85]=Yn[85]=0;Xn[85]=Zn[85]=1;Tn[85]=Rn[85]=0;An[85]=Pn[85]=-1;Cn[85]=Gn[85]=0;kn[85]=Bn[85]=0;Vn[85]=zn[85]=1;In[85]=Hn[85]=1;jn[1]=jn[169]=0;Yn[1]=Yn[169]=-1;Zn[1]=Zn[169]=0;Bn[1]=Bn[169]=-1;zn[1]=zn[169]=0;Gn[1]=Gn[169]=0;Dn[4]=Dn[166]=0;Un[4]=Un[166]=-1;Fn[4]=Fn[166]=1;kn[4]=kn[166]=1;Vn[4]=Vn[166]=0;Hn[4]=Hn[166]=0;Ln[16]=Ln[154]=0;Nn[16]=Nn[154]=1;On[16]=On[154]=1;Rn[16]=Rn[154]=1;Pn[16]=Pn[154]=0;In[16]=In[154]=1;Wn[64]=Wn[106]=0;qn[64]=qn[106]=1;Xn[64]=Xn[106]=0;Tn[64]=Tn[106]=-1;An[64]=An[106]=0;Cn[64]=Cn[106]=1;Wn[2]=Wn[168]=0;qn[2]=qn[168]=-1;Xn[2]=Xn[168]=1;jn[2]=jn[168]=0;Yn[2]=Yn[168]=-1;Zn[2]=Zn[168]=0;Bn[2]=Bn[168]=-1;zn[2]=zn[168]=0;Gn[2]=Gn[168]=0;kn[2]=kn[168]=-1;Vn[2]=Vn[168]=0;Hn[2]=Hn[168]=1;Ln[8]=Ln[162]=0;Nn[8]=Nn[162]=-1;On[8]=On[162]=0;Dn[8]=Dn[162]=0;Un[8]=Un[162]=-1;Fn[8]=Fn[162]=1;Bn[8]=Bn[162]=1;zn[8]=zn[162]=0;Gn[8]=Gn[162]=1;kn[8]=kn[162]=1;Vn[8]=Vn[162]=0;Hn[8]=Hn[162]=0;Ln[32]=Ln[138]=0;Nn[32]=Nn[138]=1;On[32]=On[138]=1;Dn[32]=Dn[138]=0;Un[32]=Un[138]=1;Fn[32]=Fn[138]=0;Tn[32]=Tn[138]=1;An[32]=An[138]=0;Cn[32]=Cn[138]=0;Rn[32]=Rn[138]=1;Pn[32]=Pn[138]=0;In[32]=In[138]=1;jn[128]=jn[42]=0;Yn[128]=Yn[42]=1;Zn[128]=Zn[42]=1;Wn[128]=Wn[42]=0;qn[128]=qn[42]=1;Xn[128]=Xn[42]=0;Tn[128]=Tn[42]=-1;An[128]=An[42]=0;Cn[128]=Cn[42]=1;Rn[128]=Rn[42]=-1;Pn[128]=Pn[42]=0;In[128]=In[42]=0;Dn[5]=Dn[165]=-1;Un[5]=Un[165]=0;Fn[5]=Fn[165]=0;jn[5]=jn[165]=1;Yn[5]=Yn[165]=0;Zn[5]=Zn[165]=0;kn[20]=kn[150]=0;Vn[20]=Vn[150]=1;Hn[20]=Hn[150]=1;Rn[20]=Rn[150]=0;Pn[20]=Pn[150]=-1;In[20]=In[150]=1;Ln[80]=Ln[90]=-1;Nn[80]=Nn[90]=0;On[80]=On[90]=1;Wn[80]=Wn[90]=1;qn[80]=qn[90]=0;Xn[80]=Xn[90]=1;Bn[65]=Bn[105]=0;zn[65]=zn[105]=1;Gn[65]=Gn[105]=0;Tn[65]=Tn[105]=0;An[65]=An[105]=-1;Cn[65]=Cn[105]=0;Ln[160]=Ln[10]=-1;Nn[160]=Nn[10]=0;On[160]=On[10]=1;Dn[160]=Dn[10]=-1;Un[160]=Un[10]=0;Fn[160]=Fn[10]=0;jn[160]=jn[10]=1;Yn[160]=Yn[10]=0;Zn[160]=Zn[10]=0;Wn[160]=Wn[10]=1;qn[160]=qn[10]=0;Xn[160]=Xn[10]=1;kn[130]=kn[40]=0;Vn[130]=Vn[40]=1;Hn[130]=Hn[40]=1;Bn[130]=Bn[40]=0;zn[130]=zn[40]=1;Gn[130]=Gn[40]=0;Tn[130]=Tn[40]=0;An[130]=An[40]=-1;Cn[130]=Cn[40]=0;Rn[130]=Rn[40]=0;Pn[130]=Pn[40]=-1;In[130]=In[40]=1;Dn[37]=Dn[133]=0;Un[37]=Un[133]=1;Fn[37]=Fn[133]=1;jn[37]=jn[133]=0;Yn[37]=Yn[133]=1;Zn[37]=Zn[133]=0;Tn[37]=Tn[133]=-1;An[37]=An[133]=0;Cn[37]=Cn[133]=0;Rn[37]=Rn[133]=1;Pn[37]=Pn[133]=0;In[37]=In[133]=0;kn[148]=kn[22]=-1;Vn[148]=Vn[22]=0;Hn[148]=Hn[22]=0;jn[148]=jn[22]=0;Yn[148]=Yn[22]=-1;Zn[148]=Zn[22]=1;Wn[148]=Wn[22]=0;qn[148]=qn[22]=1;Xn[148]=Xn[22]=1;Rn[148]=Rn[22]=-1;Pn[148]=Pn[22]=0;In[148]=In[22]=1;Ln[82]=Ln[88]=0;Nn[82]=Nn[88]=-1;On[82]=On[88]=1;kn[82]=kn[88]=1;Vn[82]=Vn[88]=0;Hn[82]=Hn[88]=1;Bn[82]=Bn[88]=-1;zn[82]=zn[88]=0;Gn[82]=Gn[88]=1;Wn[82]=Wn[88]=0;qn[82]=qn[88]=-1;Xn[82]=Xn[88]=0;Ln[73]=Ln[97]=0;Nn[73]=Nn[97]=1;On[73]=On[97]=0;Dn[73]=Dn[97]=0;Un[73]=Un[97]=-1;Fn[73]=Fn[97]=0;Bn[73]=Bn[97]=1;zn[73]=zn[97]=0;Gn[73]=Gn[97]=0;Tn[73]=Tn[97]=1;An[73]=An[97]=0;Cn[73]=Cn[97]=1;Ln[145]=Ln[25]=0;Nn[145]=Nn[25]=-1;On[145]=On[25]=0;Bn[145]=Bn[25]=1;zn[145]=zn[25]=0;Gn[145]=Gn[25]=1;jn[145]=jn[25]=0;Yn[145]=Yn[25]=1;Zn[145]=Zn[25]=1;Rn[145]=Rn[25]=-1;Pn[145]=Pn[25]=0;In[145]=In[25]=0;Dn[70]=Dn[100]=0;Un[70]=Un[100]=1;Fn[70]=Fn[100]=0;kn[70]=kn[100]=-1;Vn[70]=Vn[100]=0;Hn[70]=Hn[100]=1;Wn[70]=Wn[100]=0;qn[70]=qn[100]=-1;Xn[70]=Xn[100]=1;Tn[70]=Tn[100]=1;An[70]=An[100]=0;Cn[70]=Cn[100]=0;Dn[101]=Dn[69]=0;Un[101]=Un[69]=1;Fn[101]=Fn[69]=0;Tn[101]=Tn[69]=1;An[101]=An[69]=0;Cn[101]=Cn[69]=0;jn[149]=jn[21]=0;Yn[149]=Yn[21]=1;Zn[149]=Zn[21]=1;Rn[149]=Rn[21]=-1;Pn[149]=Pn[21]=0;In[149]=In[21]=0;kn[86]=kn[84]=-1;Vn[86]=Vn[84]=0;Hn[86]=Hn[84]=1;Wn[86]=Wn[84]=0;qn[86]=qn[84]=-1;Xn[86]=Xn[84]=1;Ln[89]=Ln[81]=0;Nn[89]=Nn[81]=-1;On[89]=On[81]=0;Bn[89]=Bn[81]=1;zn[89]=zn[81]=0;Gn[89]=Gn[81]=1;Ln[96]=Ln[74]=0;Nn[96]=Nn[74]=1;On[96]=On[74]=0;Dn[96]=Dn[74]=-1;Un[96]=Un[74]=0;Fn[96]=Fn[74]=1;Wn[96]=Wn[74]=1;qn[96]=qn[74]=0;Xn[96]=Xn[74]=0;Tn[96]=Tn[74]=1;An[96]=An[74]=0;Cn[96]=Cn[74]=1;Ln[24]=Ln[146]=0;Nn[24]=Nn[146]=-1;On[24]=On[146]=1;kn[24]=kn[146]=1;Vn[24]=Vn[146]=0;Hn[24]=Hn[146]=1;Bn[24]=Bn[146]=0;zn[24]=zn[146]=1;Gn[24]=Gn[146]=1;Rn[24]=Rn[146]=0;Pn[24]=Pn[146]=-1;In[24]=In[146]=0;Dn[6]=Dn[164]=-1;Un[6]=Un[164]=0;Fn[6]=Fn[164]=1;kn[6]=kn[164]=-1;Vn[6]=Vn[164]=0;Hn[6]=Hn[164]=0;jn[6]=jn[164]=0;Yn[6]=Yn[164]=-1;Zn[6]=Zn[164]=1;Wn[6]=Wn[164]=1;qn[6]=qn[164]=0;Xn[6]=Xn[164]=0;Bn[129]=Bn[41]=0;zn[129]=zn[41]=1;Gn[129]=Gn[41]=1;jn[129]=jn[41]=0;Yn[129]=Yn[41]=1;Zn[129]=Zn[41]=0;Tn[129]=Tn[41]=-1;An[129]=An[41]=0;Cn[129]=Cn[41]=0;Rn[129]=Rn[41]=0;Pn[129]=Pn[41]=-1;In[129]=In[41]=0;kn[66]=kn[104]=0;Vn[66]=Vn[104]=1;Hn[66]=Hn[104]=0;Bn[66]=Bn[104]=-1;zn[66]=zn[104]=0;Gn[66]=Gn[104]=1;Wn[66]=Wn[104]=0;qn[66]=qn[104]=-1;Xn[66]=Xn[104]=0;Tn[66]=Tn[104]=0;An[66]=An[104]=-1;Cn[66]=Cn[104]=1;Ln[144]=Ln[26]=-1;Nn[144]=Nn[26]=0;On[144]=On[26]=0;jn[144]=jn[26]=1;Yn[144]=Yn[26]=0;Zn[144]=Zn[26]=1;Wn[144]=Wn[26]=0;qn[144]=qn[26]=1;Xn[144]=Xn[26]=1;Rn[144]=Rn[26]=-1;Pn[144]=Pn[26]=0;In[144]=In[26]=1;Dn[36]=Dn[134]=0;Un[36]=Un[134]=1;Fn[36]=Fn[134]=1;kn[36]=kn[134]=0;Vn[36]=Vn[134]=1;Hn[36]=Hn[134]=0;Tn[36]=Tn[134]=0;An[36]=An[134]=-1;Cn[36]=Cn[134]=1;Rn[36]=Rn[134]=1;Pn[36]=Pn[134]=0;In[36]=In[134]=0;Ln[9]=Ln[161]=-1;Nn[9]=Nn[161]=0;On[9]=On[161]=0;Dn[9]=Dn[161]=0;Un[9]=Un[161]=-1;Fn[9]=Fn[161]=0;Bn[9]=Bn[161]=1;zn[9]=zn[161]=0;Gn[9]=Gn[161]=0;jn[9]=jn[161]=1;Yn[9]=Yn[161]=0;Zn[9]=Zn[161]=1;Ln[136]=0;Nn[136]=1;On[136]=1;Dn[136]=0;Un[136]=1;Fn[136]=0;kn[136]=-1;Vn[136]=0;Hn[136]=1;Bn[136]=-1;zn[136]=0;Gn[136]=0;jn[136]=0;Yn[136]=-1;Zn[136]=0;Wn[136]=0;qn[136]=-1;Xn[136]=1;Tn[136]=1;An[136]=0;Cn[136]=0;Rn[136]=1;Pn[136]=0;In[136]=1;Ln[34]=0;Nn[34]=-1;On[34]=0;Dn[34]=0;Un[34]=-1;Fn[34]=1;kn[34]=1;Vn[34]=0;Hn[34]=0;Bn[34]=1;zn[34]=0;Gn[34]=1;jn[34]=0;Yn[34]=1;Zn[34]=1;Wn[34]=0;qn[34]=1;Xn[34]=0;Tn[34]=-1;An[34]=0;Cn[34]=1;Rn[34]=-1;Pn[34]=0;In[34]=0;Ln[35]=0;Nn[35]=1;On[35]=1;Dn[35]=0;Un[35]=-1;Fn[35]=1;kn[35]=1;Vn[35]=0;Hn[35]=0;Bn[35]=-1;zn[35]=0;Gn[35]=0;jn[35]=0;Yn[35]=-1;Zn[35]=0;Wn[35]=0;qn[35]=1;Xn[35]=0;Tn[35]=-1;An[35]=0;Cn[35]=1;Rn[35]=1;Pn[35]=0;In[35]=1;Ln[153]=0;Nn[153]=1;On[153]=1;Bn[153]=-1;zn[153]=0;Gn[153]=0;jn[153]=0;Yn[153]=-1;Zn[153]=0;Rn[153]=1;Pn[153]=0;In[153]=1;Dn[102]=0;Un[102]=-1;Fn[102]=1;kn[102]=1;Vn[102]=0;Hn[102]=0;Wn[102]=0;qn[102]=1;Xn[102]=0;Tn[102]=-1;An[102]=0;Cn[102]=1;Ln[155]=0;Nn[155]=-1;On[155]=0;Bn[155]=1;zn[155]=0;Gn[155]=1;jn[155]=0;Yn[155]=1;Zn[155]=1;Rn[155]=-1;Pn[155]=0;In[155]=0;Dn[103]=0;Un[103]=1;Fn[103]=0;kn[103]=-1;Vn[103]=0;Hn[103]=1;Wn[103]=0;qn[103]=-1;Xn[103]=1;Tn[103]=1;An[103]=0;Cn[103]=0;Ln[152]=0;Nn[152]=1;On[152]=1;kn[152]=-1;Vn[152]=0;Hn[152]=1;Bn[152]=-1;zn[152]=0;Gn[152]=0;jn[152]=0;Yn[152]=-1;Zn[152]=0;Wn[152]=0;qn[152]=-1;Xn[152]=1;Rn[152]=1;Pn[152]=0;In[152]=1;Ln[156]=0;Nn[156]=-1;On[156]=1;kn[156]=1;Vn[156]=0;Hn[156]=1;Bn[156]=-1;zn[156]=0;Gn[156]=0;jn[156]=0;Yn[156]=-1;Zn[156]=0;Wn[156]=0;qn[156]=1;Xn[156]=1;Rn[156]=-1;Pn[156]=0;In[156]=1;Ln[137]=0;Nn[137]=1;On[137]=1;Dn[137]=0;Un[137]=1;Fn[137]=0;Bn[137]=-1;zn[137]=0;Gn[137]=0;jn[137]=0;Yn[137]=-1;Zn[137]=0;Tn[137]=1;An[137]=0;Cn[137]=0;Rn[137]=1;Pn[137]=0;In[137]=1;Ln[139]=0;Nn[139]=1;On[139]=1;Dn[139]=0;Un[139]=-1;Fn[139]=0;Bn[139]=1;zn[139]=0;Gn[139]=0;jn[139]=0;Yn[139]=1;Zn[139]=0;Tn[139]=-1;An[139]=0;Cn[139]=0;Rn[139]=1;Pn[139]=0;In[139]=1;Ln[98]=0;Nn[98]=-1;On[98]=0;Dn[98]=0;Un[98]=-1;Fn[98]=1;kn[98]=1;Vn[98]=0;Hn[98]=0;Bn[98]=1;zn[98]=0;Gn[98]=1;Wn[98]=0;qn[98]=1;Xn[98]=0;Tn[98]=-1;An[98]=0;Cn[98]=1;Ln[99]=0;Nn[99]=1;On[99]=0;Dn[99]=0;Un[99]=-1;Fn[99]=1;kn[99]=1;Vn[99]=0;Hn[99]=0;Bn[99]=-1;zn[99]=0;Gn[99]=1;Wn[99]=0;qn[99]=-1;Xn[99]=0;Tn[99]=1;An[99]=0;Cn[99]=1;Dn[38]=0;Un[38]=-1;Fn[38]=1;kn[38]=1;Vn[38]=0;Hn[38]=0;jn[38]=0;Yn[38]=1;Zn[38]=1;Wn[38]=0;qn[38]=1;Xn[38]=0;Tn[38]=-1;An[38]=0;Cn[38]=1;Rn[38]=-1;Pn[38]=0;In[38]=0;Dn[39]=0;Un[39]=1;Fn[39]=1;kn[39]=-1;Vn[39]=0;Hn[39]=0;jn[39]=0;Yn[39]=-1;Zn[39]=1;Wn[39]=0;qn[39]=1;Xn[39]=0;Tn[39]=-1;An[39]=0;Cn[39]=1;Rn[39]=1;Pn[39]=0;In[39]=0;var Ow=function(r){return[[r.bottomleft,0],[0,0],[0,r.leftbottom]]},Dw=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0]]},Uw=function(r){return[[r.topright,1],[1,1],[1,r.righttop]]},Fw=function(r){return[[0,r.lefttop],[0,1],[r.topleft,1]]},Bw=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop]]},zw=function(r){return[[r.bottomright,0],[r.bottomleft,0],[1,r.righttop],[1,r.rightbottom]]},Gw=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.topleft,1],[r.topright,1]]},kw=function(r){return[[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},agt=function(r){return[[0,0],[0,r.leftbottom],[1,r.rightbottom],[1,0]]},ugt=function(r){return[[1,0],[r.bottomright,0],[r.topright,1],[1,1]]},lgt=function(r){return[[1,1],[1,r.righttop],[0,r.lefttop],[0,1]]},cgt=function(r){return[[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},hgt=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.leftbottom],[0,r.lefttop]]},fgt=function(r){return[[r.topleft,1],[r.topright,1],[r.bottomright,0],[r.bottomleft,0]]},pgt=function(){return[[0,0],[0,1],[1,1],[1,0]]},dgt=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,1],[r.topleft,1]]},ggt=function(r){return[[r.topright,1],[1,1],[1,0],[0,0],[0,r.leftbottom]]},mgt=function(r){return[[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[1,1]]},vgt=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,1]]},_gt=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.lefttop],[0,1],[r.topleft,1]]},ygt=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[r.topright,1]]},xgt=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop]]},Egt=function(r){return[[r.topright,1],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1]]},Sgt=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},bgt=function(r){return[[1,1],[1,r.righttop],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},Mgt=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[r.topleft,1],[r.topright,1]]},wgt=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom]]},Tgt=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},Agt=function(r){return[[1,1],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},Cgt=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1]]},Rgt=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},Pgt=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},Igt=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},Lgt=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},Ngt=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},Ogt=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},Dgt=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},Ugt=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},Fgt=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},Bgt=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},tr=[],er=[],nr=[],rr=[],ir=[],or=[],sr=[],ar=[];rr[1]=ir[1]=18;rr[169]=ir[169]=18;nr[4]=er[4]=12;nr[166]=er[166]=12;tr[16]=ar[16]=4;tr[154]=ar[154]=4;or[64]=sr[64]=22;or[106]=sr[106]=22;nr[2]=or[2]=17;rr[2]=ir[2]=18;nr[168]=or[168]=17;rr[168]=ir[168]=18;tr[8]=rr[8]=9;er[8]=nr[8]=12;tr[162]=rr[162]=9;er[162]=nr[162]=12;tr[32]=ar[32]=4;er[32]=sr[32]=1;tr[138]=ar[138]=4;er[138]=sr[138]=1;ir[128]=ar[128]=21;or[128]=sr[128]=22;ir[42]=ar[42]=21;or[42]=sr[42]=22;er[5]=ir[5]=14;er[165]=ir[165]=14;nr[20]=ar[20]=6;nr[150]=ar[150]=6;tr[80]=or[80]=11;tr[90]=or[90]=11;rr[65]=sr[65]=3;rr[105]=sr[105]=3;tr[160]=or[160]=11;er[160]=ir[160]=14;tr[10]=or[10]=11;er[10]=ir[10]=14;nr[130]=ar[130]=6;rr[130]=sr[130]=3;nr[40]=ar[40]=6;rr[40]=sr[40]=3;er[101]=sr[101]=1;er[69]=sr[69]=1;ir[149]=ar[149]=21;ir[21]=ar[21]=21;nr[86]=or[86]=17;nr[84]=or[84]=17;tr[89]=rr[89]=9;tr[81]=rr[81]=9;tr[96]=sr[96]=0;er[96]=or[96]=15;tr[74]=sr[74]=0;er[74]=or[74]=15;tr[24]=nr[24]=8;rr[24]=ar[24]=7;tr[146]=nr[146]=8;rr[146]=ar[146]=7;er[6]=or[6]=15;nr[6]=ir[6]=16;er[164]=or[164]=15;nr[164]=ir[164]=16;rr[129]=ar[129]=7;ir[129]=sr[129]=20;rr[41]=ar[41]=7;ir[41]=sr[41]=20;nr[66]=sr[66]=2;rr[66]=or[66]=19;nr[104]=sr[104]=2;rr[104]=or[104]=19;tr[144]=ir[144]=10;or[144]=ar[144]=23;tr[26]=ir[26]=10;or[26]=ar[26]=23;er[36]=ar[36]=5;nr[36]=sr[36]=2;er[134]=ar[134]=5;nr[134]=sr[134]=2;tr[9]=ir[9]=10;er[9]=rr[9]=13;tr[161]=ir[161]=10;er[161]=rr[161]=13;er[37]=ar[37]=5;ir[37]=sr[37]=20;er[133]=ar[133]=5;ir[133]=sr[133]=20;nr[148]=ir[148]=16;or[148]=ar[148]=23;nr[22]=ir[22]=16;or[22]=ar[22]=23;tr[82]=nr[82]=8;rr[82]=or[82]=19;tr[88]=nr[88]=8;rr[88]=or[88]=19;tr[73]=sr[73]=0;er[73]=rr[73]=13;tr[97]=sr[97]=0;er[97]=rr[97]=13;tr[145]=rr[145]=9;ir[145]=ar[145]=21;tr[25]=rr[25]=9;ir[25]=ar[25]=21;er[70]=sr[70]=1;nr[70]=or[70]=17;er[100]=sr[100]=1;nr[100]=or[100]=17;tr[34]=rr[34]=9;er[34]=nr[34]=12;ir[34]=ar[34]=21;or[34]=sr[34]=22;tr[136]=ar[136]=4;er[136]=sr[136]=1;nr[136]=or[136]=17;rr[136]=ir[136]=18;tr[35]=ar[35]=4;er[35]=nr[35]=12;rr[35]=ir[35]=18;or[35]=sr[35]=22;tr[153]=ar[153]=4;rr[153]=ir[153]=18;er[102]=nr[102]=12;or[102]=sr[102]=22;tr[155]=rr[155]=9;ir[155]=ar[155]=23;er[103]=sr[103]=1;nr[103]=or[103]=17;tr[152]=ar[152]=4;nr[152]=or[152]=17;rr[152]=ir[152]=18;tr[156]=nr[156]=8;rr[156]=ir[156]=18;or[156]=ar[156]=23;tr[137]=ar[137]=4;er[137]=sr[137]=1;rr[137]=ir[137]=18;tr[139]=ar[139]=4;er[139]=rr[139]=13;ir[139]=sr[139]=20;tr[98]=rr[98]=9;er[98]=nr[98]=12;or[98]=sr[98]=22;tr[99]=sr[99]=0;er[99]=nr[99]=12;rr[99]=or[99]=19;er[38]=nr[38]=12;ir[38]=ar[38]=21;or[38]=sr[38]=22;er[39]=ar[39]=5;nr[39]=ir[39]=16;or[39]=sr[39]=22;var ve=[];ve[1]=ve[169]=Ow;ve[4]=ve[166]=Dw;ve[16]=ve[154]=Uw;ve[64]=ve[106]=Fw;ve[168]=ve[2]=Bw;ve[162]=ve[8]=zw;ve[138]=ve[32]=Gw;ve[42]=ve[128]=kw;ve[5]=ve[165]=agt;ve[20]=ve[150]=ugt;ve[80]=ve[90]=lgt;ve[65]=ve[105]=cgt;ve[160]=ve[10]=hgt;ve[130]=ve[40]=fgt;ve[85]=pgt;ve[101]=ve[69]=dgt;ve[149]=ve[21]=ggt;ve[86]=ve[84]=mgt;ve[89]=ve[81]=vgt;ve[96]=ve[74]=_gt;ve[24]=ve[146]=ygt;ve[6]=ve[164]=xgt;ve[129]=ve[41]=Egt;ve[66]=ve[104]=Sgt;ve[144]=ve[26]=bgt;ve[36]=ve[134]=Mgt;ve[9]=ve[161]=wgt;ve[37]=ve[133]=Tgt;ve[148]=ve[22]=Agt;ve[82]=ve[88]=Cgt;ve[73]=ve[97]=Rgt;ve[145]=ve[25]=Pgt;ve[70]=ve[100]=Igt;ve[34]=function(r){return[kw(r),zw(r)]};ve[35]=Lgt;ve[136]=function(r){return[Gw(r),Bw(r)]};ve[153]=function(r){return[Uw(r),Ow(r)]};ve[102]=function(r){return[Dw(r),Fw(r)]};ve[155]=Ngt;ve[103]=Ogt;ve[152]=function(r){return[Uw(r),Bw(r)]};ve[156]=Dgt;ve[137]=function(r){return[Gw(r),Ow(r)]};ve[139]=Ugt;ve[98]=function(r){return[zw(r),Fw(r)]};ve[99]=Fgt;ve[38]=function(r){return[Dw(r),kw(r)]};ve[39]=Bgt;function Ggt(r){return(r>0)-(r<0)||+r}function Fd(r,t,e){var n=t[0]-r[0],i=t[1]-r[1],o=e[0]-t[0],a=e[1]-t[1];return Ggt(n*a-o*i)}function NV(r,t){var e=r.geometry.coordinates[0].map(function(a){return a[0]}),n=r.geometry.coordinates[0].map(function(a){return a[1]}),i=t.geometry.coordinates[0].map(function(a){return a[0]}),o=t.geometry.coordinates[0].map(function(a){return a[1]});return Math.max.apply(null,e)===Math.max.apply(null,i)&&Math.max.apply(null,n)===Math.max.apply(null,o)&&Math.min.apply(null,e)===Math.min.apply(null,i)&&Math.min.apply(null,n)===Math.min.apply(null,o)}function Vw(r,t){return t.geometry.coordinates[0].every(function(e){return Li(Rr(e),r)})}function OV(r,t){return r[0]===t[0]&&r[1]===t[1]}var kgt=function(){function r(t){this.id=r.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return r.buildId=function(t){return t.join(",")},r.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},r.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},r.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},r.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,n){var i=e.to,o=n.to;if(i.coordinates[0]-t.coordinates[0]>=0&&o.coordinates[0]-t.coordinates[0]<0)return 1;if(i.coordinates[0]-t.coordinates[0]<0&&o.coordinates[0]-t.coordinates[0]>=0)return-1;if(i.coordinates[0]-t.coordinates[0]===0&&o.coordinates[0]-t.coordinates[0]===0)return i.coordinates[1]-t.coordinates[1]>=0||o.coordinates[1]-t.coordinates[1]>=0?i.coordinates[1]-o.coordinates[1]:o.coordinates[1]-i.coordinates[1];var a=Fd(t.coordinates,i.coordinates,o.coordinates);if(a<0)return 1;if(a>0)return-1;var l=Math.pow(i.coordinates[0]-t.coordinates[0],2)+Math.pow(i.coordinates[1]-t.coordinates[1],2),c=Math.pow(o.coordinates[0]-t.coordinates[0],2)+Math.pow(o.coordinates[1]-t.coordinates[1],2);return l-c}),this.outerEdgesSorted=!0)},r.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},r.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},r.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},r}(),Hw=kgt;var Vgt=function(){function r(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return r.prototype.getSymetric=function(){return this.symetric||(this.symetric=new r(this.to,this.from),this.symetric.symetric=this),this.symetric},r.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},r.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},r.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},r.prototype.toLineString=function(){return Vo([this.from.coordinates,this.to.coordinates])},r.prototype.compareTo=function(t){return Fd(t.from.coordinates,t.to.coordinates,this.to.coordinates)},r}(),DV=Vgt;var Hgt=function(){function r(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return r.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},r.prototype.get=function(t){return this.edges[t]},Object.defineProperty(r.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),r.prototype.forEach=function(t){this.edges.forEach(t)},r.prototype.map=function(t){return this.edges.map(t)},r.prototype.some=function(t){return this.edges.some(t)},r.prototype.isValid=function(){return!0},r.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(a,l,c){return l.from.coordinates[1]>t.edges[a].from.coordinates[1]&&(a=c),a},0),n=(e===0?this.length:e)-1,i=(e+1)%this.length,o=Fd(this.edges[n].from.coordinates,this.edges[e].from.coordinates,this.edges[i].from.coordinates);return o===0?this.edges[n].from.coordinates[0]>this.edges[i].from.coordinates[0]:o>0},r.prototype.toMultiPoint=function(){return xM(this.edges.map(function(t){return t.from.coordinates}))},r.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map(function(e){return e.from.coordinates});return t.push(this.edges[0].from.coordinates),this.polygon=br([t])},r.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=zM(this.toPolygon())},r.findEdgeRingContaining=function(t,e){var n=t.getEnvelope(),i,o;return e.forEach(function(a){var l=a.getEnvelope();if(o&&(i=o.getEnvelope()),!NV(l,n)&&Vw(l,n)){for(var c=t.map(function(S){return S.from.coordinates}),f=void 0,g=function(S){a.some(function(w){return OV(S,w.from.coordinates)})||(f=S)},m=0,v=c;m<v.length;m++){var x=v[m];g(x)}f&&a.inside(Rr(f))&&(!o||Vw(i,l))&&(o=a)}}),o},r.prototype.inside=function(t){return Li(t,this.toPolygon())},r}(),Ww=Hgt;function Wgt(r){if(!r)throw new Error("No geojson passed");if(r.type!=="FeatureCollection"&&r.type!=="GeometryCollection"&&r.type!=="MultiLineString"&&r.type!=="LineString"&&r.type!=="Feature")throw new Error("Invalid input type '"+r.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var LUt=function(){function r(){this.edges=[],this.nodes={}}return r.fromGeoJson=function(t){Wgt(t);var e=new r;return ja(t,function(n){SM(n,"LineString","Graph::fromGeoJson"),XB(n,function(i,o){if(i){var a=e.getNode(i),l=e.getNode(o);e.addEdge(a,l)}return o})}),e},r.prototype.getNode=function(t){var e=Hw.buildId(t),n=this.nodes[e];return n||(n=this.nodes[e]=new Hw(t)),n},r.prototype.addEdge=function(t,e){var n=new DV(t,e),i=n.getSymetric();this.edges.push(n),this.edges.push(i)},r.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},r.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var n=t.getOuterEdges().map(function(i){return i.to});this.removeNode(t),n.forEach(function(i){return e._removeIfDangle(i)})}},r.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))})},r.prototype._computeNextCWEdges=function(t){var e=this;typeof t=="undefined"?Object.keys(this.nodes).forEach(function(n){return e._computeNextCWEdges(e.nodes[n])}):t.getOuterEdges().forEach(function(n,i){t.getOuterEdge((i===0?t.getOuterEdges().length:i)-1).symetric.next=n})},r.prototype._computeNextCCWEdges=function(t,e){for(var n=t.getOuterEdges(),i,o,a=n.length-1;a>=0;--a){var l=n[a],c=l.symetric,f=void 0,g=void 0;l.label===e&&(f=l),c.label===e&&(g=c),!(!f||!g)&&(g&&(o=g),f&&(o&&(o.next=f,o=void 0),i||(i=f)))}o&&(o.next=i)},r.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(n){if(!(n.label>=0)){t.push(n);var i=n;do i.label=e,i=i.next;while(!n.isEqual(i));e++}}),t},r.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(n){n.label=void 0}),this._findLabeledEdgeRings().forEach(function(n){t._findIntersectionNodes(n).forEach(function(i){t._computeNextCCWEdges(i,n.label)})});var e=[];return this.edges.forEach(function(n){n.ring||e.push(t._findEdgeRing(n))}),e},r.prototype._findIntersectionNodes=function(t){var e=[],n=t,i=function(){var o=0;n.from.getOuterEdges().forEach(function(a){a.label===t.label&&++o}),o>1&&e.push(n.from),n=n.next};do i();while(!t.isEqual(n));return e},r.prototype._findEdgeRing=function(t){var e=t,n=new Ww;do n.push(e),e.ring=n,e=e.next;while(!t.isEqual(e));return n},r.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(n){return e.removeEdge(n)}),t.innerEdges.forEach(function(n){return e.removeEdge(n)}),delete this.nodes[t.id]},r.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},r}();var Ygt=H(qw(),1);var Zgt=H(qw(),1);var $gt=H(WV(),1);var imt=H(tH(),1);function nH(r){for(var t=r,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function smt(){return new rH(function(r){return r.f})}var Zw={search:function(r,t,e,n){r.cleanDirty(),n=n||{};var i=n.heuristic||Zw.heuristics.manhattan,o=n.closest||!1,a=smt(),l=t;for(t.h=i(t,e),a.push(t);a.size()>0;){var c=a.pop();if(c===e)return nH(c);c.closed=!0;for(var f=r.neighbors(c),g=0,m=f.length;g<m;++g){var v=f[g];if(!(v.closed||v.isWall())){var x=c.g+v.getCost(c),S=v.visited;(!S||x<v.g)&&(v.visited=!0,v.parent=c,v.h=v.h||i(v,e),v.g=x,v.f=v.g+v.h,r.markDirty(v),o&&(v.h<l.h||v.h===l.h&&v.g<l.g)&&(l=v),S?a.rescoreElement(v):a.push(v))}}}return o?nH(l):[]},heuristics:{manhattan:function(r,t){var e=Math.abs(t.x-r.x),n=Math.abs(t.y-r.y);return e+n},diagonal:function(r,t){var e=1,n=Math.sqrt(2),i=Math.abs(t.x-r.x),o=Math.abs(t.y-r.y);return e*(i+o)+(n-2*e)*Math.min(i,o)}},cleanNode:function(r){r.f=0,r.g=0,r.h=0,r.visited=!1,r.closed=!1,r.parent=null}};function hv(r,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<r.length;e++){this.grid[e]=[];for(var n=0,i=r[e];n<i.length;n++){var o=new n1(e,n,i[n]);this.grid[e][n]=o,this.nodes.push(o)}}this.init()}hv.prototype.init=function(){this.dirtyNodes=[];for(var r=0;r<this.nodes.length;r++)Zw.cleanNode(this.nodes[r])};hv.prototype.cleanDirty=function(){for(var r=0;r<this.dirtyNodes.length;r++)Zw.cleanNode(this.dirtyNodes[r]);this.dirtyNodes=[]};hv.prototype.markDirty=function(r){this.dirtyNodes.push(r)};hv.prototype.neighbors=function(r){var t=[],e=r.x,n=r.y,i=this.grid;return i[e-1]&&i[e-1][n]&&t.push(i[e-1][n]),i[e+1]&&i[e+1][n]&&t.push(i[e+1][n]),i[e]&&i[e][n-1]&&t.push(i[e][n-1]),i[e]&&i[e][n+1]&&t.push(i[e][n+1]),this.diagonal&&(i[e-1]&&i[e-1][n-1]&&t.push(i[e-1][n-1]),i[e+1]&&i[e+1][n-1]&&t.push(i[e+1][n-1]),i[e-1]&&i[e-1][n+1]&&t.push(i[e-1][n+1]),i[e+1]&&i[e+1][n+1]&&t.push(i[e+1][n+1])),t};hv.prototype.toString=function(){for(var r=[],t=this.grid,e,n,i,o,a=0,l=t.length;a<l;a++){for(e=[],n=t[a],i=0,o=n.length;i<o;i++)e.push(n[i].weight);r.push(e.join(" "))}return r.join(`
3826
- `)};function n1(r,t,e){this.x=r,this.y=t,this.weight=e}n1.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};n1.prototype.getCost=function(r){return r&&r.x!==this.x&&r.y!==this.y?this.weight*1.41421:this.weight};n1.prototype.isWall=function(){return this.weight===0};function rH(r){this.content=[],this.scoreFunction=r}rH.prototype={push:function(r){this.content.push(r),this.sinkDown(this.content.length-1)},pop:function(){var r=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),r},remove:function(r){var t=this.content.indexOf(r),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(r)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(r){this.sinkDown(this.content.indexOf(r))},sinkDown:function(r){for(var t=this.content[r];r>0;){var e=(r+1>>1)-1,n=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(n))this.content[e]=t,this.content[r]=n,r=e;else break}},bubbleUp:function(r){for(var t=this.content.length,e=this.content[r],n=this.scoreFunction(e);;){var i=r+1<<1,o=i-1,a=null,l;if(o<t){var c=this.content[o];l=this.scoreFunction(c),l<n&&(a=o)}if(i<t){var f=this.content[i],g=this.scoreFunction(f);g<(a===null?n:l)&&(a=i)}if(a!==null)this.content[r]=this.content[a],this.content[a]=e,r=a;else break}}};function Kw(){this._=null}function zd(r){r.U=r.C=r.L=r.R=r.P=r.N=null}Kw.prototype={constructor:Kw,insert:function(r,t){var e,n,i;if(r){if(t.P=r,t.N=r.N,r.N&&(r.N.P=t),r.N=t,r.R){for(r=r.R;r.L;)r=r.L;r.L=t}else r.R=t;e=r}else this._?(r=iH(this._),t.P=null,t.N=r,r.P=r.L=t,e=r):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,r=t;e&&e.C;)n=e.U,e===n.L?(i=n.R,i&&i.C?(e.C=i.C=!1,n.C=!0,r=n):(r===e.R&&(fv(this,e),r=e,e=r.U),e.C=!1,n.C=!0,pv(this,n))):(i=n.L,i&&i.C?(e.C=i.C=!1,n.C=!0,r=n):(r===e.L&&(pv(this,e),r=e,e=r.U),e.C=!1,n.C=!0,fv(this,n))),e=r.U;this._.C=!1},remove:function(r){r.N&&(r.N.P=r.P),r.P&&(r.P.N=r.N),r.N=r.P=null;var t=r.U,e,n=r.L,i=r.R,o,a;if(n?i?o=iH(i):o=n:o=i,t?t.L===r?t.L=o:t.R=o:this._=o,n&&i?(a=o.C,o.C=r.C,o.L=n,n.U=o,o!==i?(t=o.U,o.U=r.U,r=o.R,t.L=r,o.R=i,i.U=o):(o.U=t,t=o,r=o.R)):(a=r.C,r=o),r&&(r.U=t),!a){if(r&&r.C){r.C=!1;return}do{if(r===this._)break;if(r===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,fv(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,pv(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,fv(this,t),r=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,pv(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,fv(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,pv(this,t),r=this._;break}e.C=!0,r=t,t=t.U}while(!r.C);r&&(r.C=!1)}}};function fv(r,t){var e=t,n=t.R,i=e.U;i?i.L===e?i.L=n:i.R=n:r._=n,n.U=i,e.U=n,e.R=n.L,e.R&&(e.R.U=e),n.L=e}function pv(r,t){var e=t,n=t.L,i=e.U;i?i.L===e?i.L=n:i.R=n:r._=n,n.U=i,e.U=n,e.L=n.R,e.L&&(e.L.U=e),n.R=e}function iH(r){for(;r.L;)r=r.L;return r}var $w=Kw;function Gd(r,t,e,n){var i=[null,null],o=qo.push(i)-1;return i.left=r,i.right=t,e&&dv(i,r,t,e),n&&dv(i,t,r,n),Vs[r.index].halfedges.push(o),Vs[t.index].halfedges.push(o),i}function kd(r,t,e){var n=[t,e];return n.left=r,n}function dv(r,t,e,n){!r[0]&&!r[1]?(r[0]=n,r.left=t,r.right=e):r.left===e?r[1]=n:r[0]=n}function amt(r,t,e,n,i){var o=r[0],a=r[1],l=o[0],c=o[1],f=a[0],g=a[1],m=0,v=1,x=f-l,S=g-c,w;if(w=t-l,!(!x&&w>0)){if(w/=x,x<0){if(w<m)return;w<v&&(v=w)}else if(x>0){if(w>v)return;w>m&&(m=w)}if(w=n-l,!(!x&&w<0)){if(w/=x,x<0){if(w>v)return;w>m&&(m=w)}else if(x>0){if(w<m)return;w<v&&(v=w)}if(w=e-c,!(!S&&w>0)){if(w/=S,S<0){if(w<m)return;w<v&&(v=w)}else if(S>0){if(w>v)return;w>m&&(m=w)}if(w=i-c,!(!S&&w<0)){if(w/=S,S<0){if(w>v)return;w>m&&(m=w)}else if(S>0){if(w<m)return;w<v&&(v=w)}return!(m>0)&&!(v<1)||(m>0&&(r[0]=[l+m*x,c+m*S]),v<1&&(r[1]=[l+v*x,c+v*S])),!0}}}}}function umt(r,t,e,n,i){var o=r[1];if(o)return!0;var a=r[0],l=r.left,c=r.right,f=l[0],g=l[1],m=c[0],v=c[1],x=(f+m)/2,S=(g+v)/2,w,E;if(v===g){if(x<t||x>=n)return;if(f>m){if(!a)a=[x,e];else if(a[1]>=i)return;o=[x,i]}else{if(!a)a=[x,i];else if(a[1]<e)return;o=[x,e]}}else if(w=(f-m)/(v-g),E=S-w*x,w<-1||w>1)if(f>m){if(!a)a=[(e-E)/w,e];else if(a[1]>=i)return;o=[(i-E)/w,i]}else{if(!a)a=[(i-E)/w,i];else if(a[1]<e)return;o=[(e-E)/w,e]}else if(g<v){if(!a)a=[t,w*t+E];else if(a[0]>=n)return;o=[n,w*n+E]}else{if(!a)a=[n,w*n+E];else if(a[0]<t)return;o=[t,w*t+E]}return r[0]=a,r[1]=o,!0}function oH(r,t,e,n){for(var i=qo.length,o;i--;)(!umt(o=qo[i],r,t,e,n)||!amt(o,r,t,e,n)||!(Math.abs(o[0][0]-o[1][0])>Yr||Math.abs(o[0][1]-o[1][1])>Yr))&&delete qo[i]}function sH(r){return Vs[r.index]={site:r,halfedges:[]}}function lmt(r,t){var e=r.site,n=t.left,i=t.right;return e===i&&(i=n,n=e),i?Math.atan2(i[1]-n[1],i[0]-n[0]):(e===n?(n=t[1],i=t[0]):(n=t[0],i=t[1]),Math.atan2(n[0]-i[0],i[1]-n[1]))}function Jw(r,t){return t[+(t.left!==r.site)]}function cmt(r,t){return t[+(t.left===r.site)]}function aH(){for(var r=0,t=Vs.length,e,n,i,o;r<t;++r)if((e=Vs[r])&&(o=(n=e.halfedges).length)){var a=new Array(o),l=new Array(o);for(i=0;i<o;++i)a[i]=i,l[i]=lmt(e,qo[n[i]]);for(a.sort(function(c,f){return l[f]-l[c]}),i=0;i<o;++i)l[i]=n[a[i]];for(i=0;i<o;++i)n[i]=l[i]}}function uH(r,t,e,n){var i=Vs.length,o,a,l,c,f,g,m,v,x,S,w,E,b=!0;for(o=0;o<i;++o)if(a=Vs[o]){for(l=a.site,f=a.halfedges,c=f.length;c--;)qo[f[c]]||f.splice(c,1);for(c=0,g=f.length;c<g;)S=cmt(a,qo[f[c]]),w=S[0],E=S[1],m=Jw(a,qo[f[++c%g]]),v=m[0],x=m[1],(Math.abs(w-v)>Yr||Math.abs(E-x)>Yr)&&(f.splice(c,0,qo.push(kd(l,S,Math.abs(w-r)<Yr&&n-E>Yr?[r,Math.abs(v-r)<Yr?x:n]:Math.abs(E-n)<Yr&&e-w>Yr?[Math.abs(x-n)<Yr?v:e,n]:Math.abs(w-e)<Yr&&E-t>Yr?[e,Math.abs(v-e)<Yr?x:t]:Math.abs(E-t)<Yr&&w-r>Yr?[Math.abs(x-t)<Yr?v:r,t]:null))-1),++g);g&&(b=!1)}if(b){var C,A,P,F=1/0;for(o=0,b=null;o<i;++o)(a=Vs[o])&&(l=a.site,C=l[0]-r,A=l[1]-t,P=C*C+A*A,P<F&&(F=P,b=a));if(b){var U=[r,t],D=[r,n],L=[e,n],tt=[e,t];b.halfedges.push(qo.push(kd(l=b.site,U,D))-1,qo.push(kd(l,D,L))-1,qo.push(kd(l,L,tt))-1,qo.push(kd(l,tt,U))-1)}}for(o=0;o<i;++o)(a=Vs[o])&&(a.halfedges.length||delete Vs[o])}var lH=[],r1;function hmt(){zd(this),this.x=this.y=this.arc=this.site=this.cy=null}function kf(r){var t=r.P,e=r.N;if(!(!t||!e)){var n=t.site,i=r.site,o=e.site;if(n!==o){var a=i[0],l=i[1],c=n[0]-a,f=n[1]-l,g=o[0]-a,m=o[1]-l,v=2*(c*m-f*g);if(!(v>=-cH)){var x=c*c+f*f,S=g*g+m*m,w=(m*x-f*S)/v,E=(c*S-g*x)/v,b=lH.pop()||new hmt;b.arc=r,b.site=i,b.x=w+a,b.y=(b.cy=E+l)+Math.sqrt(w*w+E*E),r.circle=b;for(var C=null,A=Vd._;A;)if(b.y<A.y||b.y===A.y&&b.x<=A.x)if(A.L)A=A.L;else{C=A.P;break}else if(A.R)A=A.R;else{C=A;break}Vd.insert(C,b),C||(r1=b)}}}}function Vf(r){var t=r.circle;t&&(t.P||(r1=t.N),Vd.remove(t),lH.push(t),zd(t),r.circle=null)}var fH=[];function fmt(){zd(this),this.edge=this.site=this.circle=null}function hH(r){var t=fH.pop()||new fmt;return t.site=r,t}function Qw(r){Vf(r),Hf.remove(r),fH.push(r),zd(r)}function pH(r){var t=r.circle,e=t.x,n=t.cy,i=[e,n],o=r.P,a=r.N,l=[r];Qw(r);for(var c=o;c.circle&&Math.abs(e-c.circle.x)<Yr&&Math.abs(n-c.circle.cy)<Yr;)o=c.P,l.unshift(c),Qw(c),c=o;l.unshift(c),Vf(c);for(var f=a;f.circle&&Math.abs(e-f.circle.x)<Yr&&Math.abs(n-f.circle.cy)<Yr;)a=f.N,l.push(f),Qw(f),f=a;l.push(f),Vf(f);var g=l.length,m;for(m=1;m<g;++m)f=l[m],c=l[m-1],dv(f.edge,c.site,f.site,i);c=l[0],f=l[g-1],f.edge=Gd(c.site,f.site,null,i),kf(c),kf(f)}function dH(r){for(var t=r[0],e=r[1],n,i,o,a,l=Hf._;l;)if(o=gH(l,e)-t,o>Yr)l=l.L;else if(a=t-pmt(l,e),a>Yr){if(!l.R){n=l;break}l=l.R}else{o>-Yr?(n=l.P,i=l):a>-Yr?(n=l,i=l.N):n=i=l;break}sH(r);var c=hH(r);if(Hf.insert(n,c),!(!n&&!i)){if(n===i){Vf(n),i=hH(n.site),Hf.insert(c,i),c.edge=i.edge=Gd(n.site,c.site),kf(n),kf(i);return}if(!i){c.edge=Gd(n.site,c.site);return}Vf(n),Vf(i);var f=n.site,g=f[0],m=f[1],v=r[0]-g,x=r[1]-m,S=i.site,w=S[0]-g,E=S[1]-m,b=2*(v*E-x*w),C=v*v+x*x,A=w*w+E*E,P=[(E*C-x*A)/b+g,(v*A-w*C)/b+m];dv(i.edge,f,S,P),c.edge=Gd(f,r,null,P),i.edge=Gd(r,S,null,P),kf(n),kf(i)}}function gH(r,t){var e=r.site,n=e[0],i=e[1],o=i-t;if(!o)return n;var a=r.P;if(!a)return-1/0;e=a.site;var l=e[0],c=e[1],f=c-t;if(!f)return l;var g=l-n,m=1/o-1/f,v=g/f;return m?(-v+Math.sqrt(v*v-2*m*(g*g/(-2*f)-c+f/2+i-o/2)))/m+n:(n+l)/2}function pmt(r,t){var e=r.N;if(e)return gH(e,t);var n=r.site;return n[1]===t?n[0]:1/0}var Yr=1e-6,cH=1e-12,Hf,Vs,Vd,qo;function dmt(r,t,e){return(r[0]-e[0])*(t[1]-r[1])-(r[0]-t[0])*(e[1]-r[1])}function gmt(r,t){return t[1]-r[1]||t[0]-r[0]}function i1(r,t){var e=r.sort(gmt).pop(),n,i,o;for(qo=[],Vs=new Array(r.length),Hf=new $w,Vd=new $w;;)if(o=r1,e&&(!o||e[1]<o.y||e[1]===o.y&&e[0]<o.x))(e[0]!==n||e[1]!==i)&&(dH(e),n=e[0],i=e[1]),e=r.pop();else if(o)pH(o.arc);else break;if(aH(),t){var a=+t[0][0],l=+t[0][1],c=+t[1][0],f=+t[1][1];oH(a,l,c,f),uH(a,l,c,f)}this.edges=qo,this.cells=Vs,Hf=Vd=qo=Vs=null}i1.prototype={constructor:i1,polygons:function(){var r=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(n){return Jw(t,r[n])});return e.data=t.site.data,e})},triangles:function(){var r=[],t=this.edges;return this.cells.forEach(function(e,n){if(l=(o=e.halfedges).length)for(var i=e.site,o,a=-1,l,c,f=t[o[l-1]],g=f.left===i?f.right:f.left;++a<l;)c=g,f=t[o[a]],g=f.left===i?f.right:f.left,c&&g&&n<c.index&&n<g.index&&dmt(i,c,g)<0&&r.push([i.data,c.data,g.data])}),r},links:function(){return this.edges.filter(function(r){return r.right}).map(function(r){return{source:r.left.data,target:r.right.data}})},find:function(r,t,e){for(var n=this,i,o=n._found||0,a=n.cells.length,l;!(l=n.cells[o]);)if(++o>=a)return null;var c=r-l.site[0],f=t-l.site[1],g=c*c+f*f;do l=n.cells[i=o],o=null,l.halfedges.forEach(function(m){var v=n.edges[m],x=v.left;if(!((x===l.site||!x)&&!(x=v.right))){var S=r-x[0],w=t-x[1],E=S*S+w*w;E<g&&(g=E,o=x.index)}});while(o!==null);return n._found=i,e==null||g<=e*e?l.site:null}};var bmt=H(Hd(),1);var dT=H(yH(),1);function va(){return new a1}function a1(){this.reset()}a1.prototype={constructor:a1,reset:function(){this.s=this.t=0},add:function(r){xH(s1,r,this.t),xH(this,s1.s,this.s),this.s?this.t+=s1.t:this.s=s1.t},valueOf:function(){return this.s}};var s1=new a1;function xH(r,t,e){var n=r.s=t+e,i=n-t,o=n-i;r.t=t-o+(e-i)}var Mr=1e-6;var Wr=Math.PI,bo=Wr/2,u1=Wr/4,Y0=Wr*2,Wf=180/Wr,_a=Wr/180,Ni=Math.abs,c0=Math.atan,ya=Math.atan2,cr=Math.cos;var l1=Math.exp;var gv=Math.log;var bn=Math.sin;var os=Math.sqrt,mv=Math.tan;function nT(r){return r>1?0:r<-1?Wr:Math.acos(r)}function Hs(r){return r>1?bo:r<-1?-bo:Math.asin(r)}function h0(){}var Mmt=va(),Tzt=va();function qf(r){var t=r[0],e=r[1],n=cr(e);return[n*cr(t),n*bn(t),bn(e)]}function vv(r,t){return[r[1]*t[2]-r[2]*t[1],r[2]*t[0]-r[0]*t[2],r[0]*t[1]-r[1]*t[0]]}function _v(r){var t=os(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}var Uzt=va();function SH(r,t){return[r>Wr?r-Y0:r<-Wr?r+Y0:r,t]}SH.invert=SH;function rT(){var r=[],t;return{point:function(e,n){t.push([e,n])},lineStart:function(){r.push(t=[])},lineEnd:h0,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function iT(r,t){return Ni(r[0]-t[0])<Mr&&Ni(r[1]-t[1])<Mr}function c1(r,t,e,n){this.x=r,this.z=t,this.o=e,this.e=n,this.v=!1,this.n=this.p=null}function oT(r,t,e,n,i){var o=[],a=[],l,c;if(r.forEach(function(S){if(!((w=S.length-1)<=0)){var w,E=S[0],b=S[w],C;if(iT(E,b)){for(i.lineStart(),l=0;l<w;++l)i.point((E=S[l])[0],E[1]);i.lineEnd();return}o.push(C=new c1(E,S,null,!0)),a.push(C.o=new c1(E,null,C,!1)),o.push(C=new c1(b,S,null,!1)),a.push(C.o=new c1(b,null,C,!0))}}),!!o.length){for(a.sort(t),bH(o),bH(a),l=0,c=a.length;l<c;++l)a[l].e=e=!e;for(var f=o[0],g,m;;){for(var v=f,x=!0;v.v;)if((v=v.n)===f)return;g=v.z,i.lineStart();do{if(v.v=v.o.v=!0,v.e){if(x)for(l=0,c=g.length;l<c;++l)i.point((m=g[l])[0],m[1]);else n(v.x,v.n.x,1,i);v=v.n}else{if(x)for(g=v.p.z,l=g.length-1;l>=0;--l)i.point((m=g[l])[0],m[1]);else n(v.x,v.p.x,-1,i);v=v.p}v=v.o,g=v.z,x=!x}while(!v.v);i.lineEnd()}}}function bH(r){if(t=r.length){for(var t,e=0,n=r[0],i;++e<t;)n.n=i=r[e],i.p=n,n=i;n.n=i=r[0],i.p=n}}function mh(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function sT(r){return r.length===1&&(r=Amt(r)),{left:function(t,e,n,i){for(n==null&&(n=0),i==null&&(i=t.length);n<i;){var o=n+i>>>1;r(t[o],e)<0?n=o+1:i=o}return n},right:function(t,e,n,i){for(n==null&&(n=0),i==null&&(i=t.length);n<i;){var o=n+i>>>1;r(t[o],e)>0?i=o:n=o+1}return n}}}function Amt(r){return function(t,e){return mh(r(t),e)}}var MH=sT(mh),Cmt=MH.right,Rmt=MH.left;var wH=Array.prototype,Imt=wH.slice,Lmt=wH.map;var CGt=Math.sqrt(50),RGt=Math.sqrt(10),PGt=Math.sqrt(2);function f1(r){for(var t=r.length,e,n=-1,i=0,o,a;++n<t;)i+=r[n].length;for(o=new Array(i);--t>=0;)for(a=r[t],e=a.length;--e>=0;)o[--i]=a[e];return o}var Gmt=1e9,pVt=-Gmt;var aT=va();function uT(r,t){var e=t[0],n=t[1],i=[bn(e),-cr(e),0],o=0,a=0;aT.reset();for(var l=0,c=r.length;l<c;++l)if(g=(f=r[l]).length)for(var f,g,m=f[g-1],v=m[0],x=m[1]/2+u1,S=bn(x),w=cr(x),E=0;E<g;++E,v=C,S=P,w=F,m=b){var b=f[E],C=b[0],A=b[1]/2+u1,P=bn(A),F=cr(A),U=C-v,D=U>=0?1:-1,L=D*U,tt=L>Wr,O=S*P;if(aT.add(ya(O*D*bn(L),w*F+O*cr(L))),o+=tt?U+D*Y0:U,tt^v>=e^C>=e){var V=vv(qf(m),qf(b));_v(V);var W=vv(i,V);_v(W);var St=(tt^U>=0?-1:1)*Hs(W[2]);(n>St||n===St&&(V[0]||V[1]))&&(a+=tt^U>=0?1:-1)}}return(o<-Mr||o<Mr&&aT<-Mr)^a&1}var bVt=va();var VVt=va(),HVt=va();var Hmt=1/0;var XVt=-Hmt;function lT(r){this._context=r}lT.prototype={_radius:4.5,pointRadius:function(r){return this._radius=r,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._context.moveTo(r,t),this._point=1;break}case 1:{this._context.lineTo(r,t);break}default:{this._context.moveTo(r+this._radius,t),this._context.arc(r,t,this._radius,0,Y0);break}}},result:h0};var nHt=va();function cT(){this._string=[]}cT.prototype={_radius:4.5,_circle:CH(4.5),pointRadius:function(r){return(r=+r)!==this._radius&&(this._radius=r,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._string.push("M",r,",",t),this._point=1;break}case 1:{this._string.push("L",r,",",t);break}default:{this._circle==null&&(this._circle=CH(this._radius)),this._string.push("M",r,",",t,this._circle);break}}},result:function(){if(this._string.length){var r=this._string.join("");return this._string=[],r}else return null}};function CH(r){return"m0,"+r+"a"+r+","+r+" 0 1,1 0,"+-2*r+"a"+r+","+r+" 0 1,1 0,"+2*r+"z"}function hT(r,t,e,n){return function(i,o){var a=t(o),l=i.invert(n[0],n[1]),c=rT(),f=t(c),g=!1,m,v,x,S={point:w,lineStart:b,lineEnd:C,polygonStart:function(){S.point=A,S.lineStart=P,S.lineEnd=F,v=[],m=[]},polygonEnd:function(){S.point=w,S.lineStart=b,S.lineEnd=C,v=f1(v);var U=uT(m,l);v.length?(g||(o.polygonStart(),g=!0),oT(v,Xmt,U,e,o)):U&&(g||(o.polygonStart(),g=!0),o.lineStart(),e(null,null,1,o),o.lineEnd()),g&&(o.polygonEnd(),g=!1),v=m=null},sphere:function(){o.polygonStart(),o.lineStart(),e(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function w(U,D){var L=i(U,D);r(U=L[0],D=L[1])&&o.point(U,D)}function E(U,D){var L=i(U,D);a.point(L[0],L[1])}function b(){S.point=E,a.lineStart()}function C(){S.point=w,a.lineEnd()}function A(U,D){x.push([U,D]);var L=i(U,D);f.point(L[0],L[1])}function P(){f.lineStart(),x=[]}function F(){A(x[0][0],x[0][1]),f.lineEnd();var U=f.clean(),D=c.result(),L,tt=D.length,O,V,W;if(x.pop(),m.push(x),x=null,!!tt){if(U&1){if(V=D[0],(O=V.length-1)>0){for(g||(o.polygonStart(),g=!0),o.lineStart(),L=0;L<O;++L)o.point((W=V[L])[0],W[1]);o.lineEnd()}return}tt>1&&U&2&&D.push(D.pop().concat(D.shift())),v.push(D.filter(qmt))}}return S}}function qmt(r){return r.length>1}function Xmt(r,t){return((r=r.x)[0]<0?r[1]-bo-Mr:bo-r[1])-((t=t.x)[0]<0?t[1]-bo-Mr:bo-t[1])}var jmt=hT(function(){return!0},Ymt,Kmt,[-Wr,-bo]);function Ymt(r){var t=NaN,e=NaN,n=NaN,i;return{lineStart:function(){r.lineStart(),i=1},point:function(o,a){var l=o>0?Wr:-Wr,c=Ni(o-t);Ni(c-Wr)<Mr?(r.point(t,e=(e+a)/2>0?bo:-bo),r.point(n,e),r.lineEnd(),r.lineStart(),r.point(l,e),r.point(o,e),i=0):n!==l&&c>=Wr&&(Ni(t-n)<Mr&&(t-=n*Mr),Ni(o-l)<Mr&&(o-=l*Mr),e=Zmt(t,e,o,a),r.point(n,e),r.lineEnd(),r.lineStart(),r.point(l,e),i=0),r.point(t=o,e=a),n=l},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-i}}}function Zmt(r,t,e,n){var i,o,a=bn(r-e);return Ni(a)>Mr?c0((bn(t)*(o=cr(n))*bn(e)-bn(n)*(i=cr(t))*bn(r))/(i*o*a)):(t+n)/2}function Kmt(r,t,e,n){var i;if(r==null)i=e*bo,n.point(-Wr,i),n.point(0,i),n.point(Wr,i),n.point(Wr,0),n.point(Wr,-i),n.point(0,-i),n.point(-Wr,-i),n.point(-Wr,0),n.point(-Wr,i);else if(Ni(r[0]-t[0])>Mr){var o=r[0]<t[0]?Wr:-Wr;i=e*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(t[0],t[1])}function p1(r){return function(t){var e=new fT;for(var n in r)e[n]=r[n];return e.stream=t,e}}function fT(){}fT.prototype={constructor:fT,point:function(r,t){this.stream.point(r,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var HHt=cr(30*_a);var r4t=p1({point:function(r,t){this.stream.point(r*_a,t*_a)}});function d1(r){return function(t,e){var n=cr(t),i=cr(e),o=r(n*i);return[o*i*bn(t),o*bn(e)]}}function Z0(r){return function(t,e){var n=os(t*t+e*e),i=r(n),o=bn(i),a=cr(i);return[ya(t*o,n*a),Hs(n&&e*o/n)]}}var DH=d1(function(r){return os(2/(1+r))});DH.invert=Z0(function(r){return 2*Hs(r/2)});var UH=d1(function(r){return(r=nT(r))&&r/bn(r)});UH.invert=Z0(function(r){return r});function pT(r,t){return[r,gv(mv((bo+t)/2))]}pT.invert=function(r,t){return[r,2*c0(l1(t))-bo]};function g1(r,t){return[r,t]}g1.invert=g1;function FH(r,t){var e=cr(t),n=cr(r)*e;return[e*bn(r)/n,bn(t)/n]}FH.invert=Z0(c0);function BH(r,t){var e=t*t,n=e*e;return[r*(.8707-.131979*e+n*(-.013791+n*(.003971*e-.001529*n))),t*(1.007226+e*(.015085+n*(-.044475+.028874*e-.005916*n)))]}BH.invert=function(r,t){var e=t,n=25,i;do{var o=e*e,a=o*o;e-=i=(e*(1.007226+o*(.015085+a*(-.044475+.028874*o-.005916*a)))-t)/(1.007226+o*(.015085*3+a*(-.044475*7+.028874*9*o-.005916*11*a)))}while(Ni(i)>Mr&&--n>0);return[r/(.8707+(o=e*e)*(-.131979+o*(-.013791+o*o*o*(.003971-.001529*o)))),e]};function zH(r,t){return[cr(t)*bn(r),bn(t)]}zH.invert=Z0(Hs);function GH(r,t){var e=cr(t),n=1+cr(r)*e;return[e*bn(r)/n,bn(t)/n]}GH.invert=Z0(function(r){return 2*c0(r)});function kH(r,t){return[gv(mv((bo+t)/2)),-r]}kH.invert=function(r,t){return[-t,2*c0(l1(r))-bo]};var nvt=H(Hd(),1);var VH=H(Hd(),1);function qd(r,t,e){e===void 0&&(e={});var n=xo(r),i=xo(t),o=VH.default.intersection(n.coordinates,i.coordinates);return o.length===0?null:o.length===1?br(o[0],e.properties):W0(o,e.properties)}var ivt=H(Hd(),1);var ovt=H(Hd(),1);function sn(r,t,e,n){let i=r.clone().project(t),o=e/2,a=n/2,l=Math.round(i.x*o+o),c=Math.round(-i.y*a+a);return{x:l,y:c}}function dvt(r,t,e,n,i){if(!i)return null;e=Math.min(1,e),n=Math.min(1,n);let o=r/e*2-1,a=1-t/n*2;return new G(o,a,0).unproject(i)}function yv(r){let t=lr(r.map(n=>Rr(n)));return fh(t).geometry.coordinates}function Yl(r,t,e){return r.x>=t.x&&r.x<=e.x&&r.y>=t.y&&r.y<=e.y}function gvt(r){let t=0,e=new G;for(let n=1;n<r.length;n++){let i=new G(r[n-1][0],r[n-1][1],0),o=new G(r[n][0],r[n][1],0),a=o.distanceTo(i);a>t&&(t=a,e=o.clone().sub(i).normalize())}return e}function zr(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}function Ws(r){let t=0;for(let e=0;e<r.length-1;e++)t+=zr(r[e],r[e+1]);return t}function xv(r,t,e){let n=new ft(t[0]-r[0],t[1]-r[1]),i=new ft(t[0]-e[0],t[1]-e[1]),a=n.angleTo(i)*180/Math.PI,l=new ft(t[0]-r[0],t[1]-r[1]);return new ft(e[0]-r[0],e[1]-r[1]).cross(l)>0?a:-a}function mvt(r,t){let e=Math.min(zr(r[0][0],r[0][1]),zr(r[0][2],r[0][1]))-1;t||(t=yv(r[0]));let n=vvt(t,e),i=new ft(r[0][0][0],r[0][0][1]),o=new ft(r[0][1][0],r[0][1][1]),a=new ft(r[0][2][0],r[0][2][1]),c=(i.distanceTo(o)>o.distanceTo(a)?o.clone().sub(i):a.clone().sub(o)).angleTo(new ft(0,1)),f=new Je;return f.multiply(new Je().translate(t[0],t[1])).multiply(new Je().rotate(c)).multiply(new Je().translate(-t[0],-t[1])),[n.map(g=>{let m=new ft(g[0],g[1]).applyMatrix3(f);return[m.x,m.y]})]}function vvt(r,t){let e=t/2;return[[r[0]-e,r[1]+e],[r[0]+e,r[1]+e],[r[0]+e,r[1]-e],[r[0]-e,r[1]-e],[r[0]-e,r[1]+e]]}function K0(r,t){let e=0,n=1/0,[i,o]=t;for(let a=0;a<r.length-1;a++){let[l,c]=r[a],[f,g]=r[a+1],m=Math.min(l,f)<=i&&i<=Math.max(l,f),v=Math.min(c,g)<=o&&o<=Math.max(c,g);if(m&&v){let x=Math.abs((f-l)*(o-c)-(g-c)*(i-l));x<n&&(n=x,e=a)}}return e}function gT(r,t){let e=r[0],n=r[1],i=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){let l=t[o][0],c=t[o][1],f=t[a][0],g=t[a][1];c>n!=g>n&&e<(f-l)*(n-c)/(g-c)+l&&(i=!i)}return i}var cYt=H(HH(),1);function Xf(r,t){return new Proxy(r,{get:(e,n,i)=>Reflect.get(e,n,i),set:(e,n,i,o)=>{let a=Reflect.get(e,n,o),l=Reflect.set(e,n,i,o);return a!==i&&t.dispatchEvent({type:"change-"+n,value:i}),l}})}var SYt=H(ze(),1),bYt=H(_T(),1);function Ya(r,t){return Promise.race([r,new Promise((e,n)=>{setTimeout(()=>n(new Error("Promise timeout")),t)})])}function Ev(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function yT(r,t){let e=Ev("svg");return e.setAttribute("width",r),e.setAttribute("height",t),e.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",e}function Xd(r,t){r===void 0&&(r="2");let e=Ev("circle");return e.setAttribute("r",r),e.setAttribute("fill",t),e}function Sv(r){let t=Ev("line");return t.setAttribute("stroke",r),t}function Zl(r,t){let e=Ev("rect");return e.setAttribute("stroke",r),e.setAttribute("fill",t),e}function _h(r,t,e){r.setAttribute("cx",""+t),r.setAttribute("cy",""+e)}function wu(r,t,e){t&&(r.setAttribute("x1",""+t.x),r.setAttribute("y1",""+t.y)),e&&(r.setAttribute("x2",""+e.x),r.setAttribute("y2",""+e.y))}function bs(r,t,e,n,i){r.setAttribute("x",""+t),r.setAttribute("y",""+e),r.setAttribute("width",""+n),r.setAttribute("height",""+i)}function xT(){return Promise.resolve()}function _1(){return new Promise(r=>{requestAnimationFrame(r)})}function ET(r){return r===void 0&&(r=1),new Promise(t=>{function e(){r<=0?t(!0):(r--,window.requestAnimationFrame(e))}window.requestAnimationFrame(e)})}var zYt=H(bv(),1),GYt=H(Xa(),1),kYt=H(E1(),1);function z_t(r){return parseInt(r.replace("#","0x"),16)}function G_t(r,t){let e=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16),o=Math.round(e*t),a=Math.round(n*t),l=Math.round(i*t);return"#"+(1<<24|o<<16|a<<8|l).toString(16).slice(1)}function J0(r,t){t===void 0&&(t=.85);let e,n,i;if(r.startsWith("#"))e=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16);else{let a=r.slice(4,-1).split(",");e=parseInt(a[0].trim()),n=parseInt(a[1].trim()),i=parseInt(a[2].trim())}return e=Math.min(Math.floor(e*t),255),n=Math.min(Math.floor(n*t),255),i=Math.min(Math.floor(i*t),255),"#"+((1<<24)+(e<<16)+(n<<8)+i).toString(16).slice(1)}function S1(r,t){r=r.replace(/^#/,"");let e=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return t!==void 0?"rgba("+e+", "+n+", "+i+", "+t+")":"rgb("+e+", "+n+", "+i+")"}var HYt=H(Xa(),1),Yf=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,LT=(navigator.userAgent||"").toLocaleLowerCase(),yh=/ios|iphone/i.test(LT),k_t=/android|adr|linux/gi.test(LT);function Zf(r){return Yf?r==="Meta":r==="Control"}var jYt=H(n0(),1),YYt=H(r0(),1),ZYt=H(i0(),1),KYt=H(o0(),1),$Yt=H(s0(),1),JYt=H(a0(),1),QYt=H(u0(),1),t8t=H(ze(),1),NT="__once__",OT=class{on(t,e){if(typeof e!="function")return;let n=this.events.get(t);return n?n.add(e):this.events.set(t,new Set([e]))}once(t,e){if(typeof e!="function")return;let n=""+NT+t,i=this.events.get(n);return i?i.add(e):this.events.set(n,new Set([e]))}off(t,e){let n=this.events.get(t),i=this.events.get(""+NT+t);!n&&!i||(e===void 0&&(n==null||n.clear(),i==null||i.clear()),n!=null&&n.has(e)&&n.delete(e),i!=null&&i.has(e)&&i.delete(e))}offAll(){this.events.clear()}emit(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];let o=this.events.get(t),a=this.events.get(""+NT+t);!o&&!a||(o==null||o.forEach(l=>{typeof l=="function"&&l(...n)}),a==null||a.forEach(l=>{typeof l=="function"&&l(...n)}),a==null||a.clear())}constructor(){this.events=new Map}};var ss=function(r){return r.SWITCH_FLOOR_BEFORE="switch_floor_before",r.SWITCH_FLOOR_GROUND="switch_floor_ground",r.SWITCH_FLOOR_AFTER="switch_floor_after",r}({});var h8t=H(Kf(),1);function $f(r){return Object.keys(r).sort().map(t=>t+"="+r[t]).join("&")}function ayt(r,t){return new Promise((e,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),Object.keys(t.headers||{}).forEach(o=>{i.setRequestHeader(o,t.headers[o])}),t.responseType&&(i.responseType=t.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(t.responseType==="arraybuffer")e(i.response);else try{let o=JSON.parse(i.responseText);e(o)}catch(o){n(o)}else n(i.statusText)},i.onerror=()=>{n(i.statusText)},i.send()})}var m8t=H(ze(),1),v8t=H(En(),1);var mW=H(gW(),1);function vW(r,t){let e=r.clone().normalize(),n=t.clone().normalize();return Math.acos(e.dot(n))}function uyt(r){let t=0;return r.reduce((e,n)=>{let[i,o]=e,[a,l]=n;return t+=Math.sqrt((a-i)**2+(l-o)**2),[a,l]}),t/r.length}function kT(r,t){if(t===void 0&&(t=.25),uyt(r)<t)return r;let e=(0,mW.default)(r);return kT(e,t)}function Mv(r,t,e,n,i,o){t===void 0&&(t=!1),e===void 0&&(e=!0),n===void 0&&(n=5),i===void 0&&(i=150),o===void 0&&(o=3);let a=[],l=!t;if(a.push(r[0]),r.length<2)return a;for(let f=0;f<r.length-2;f+=1){let g=r[f],m=r[f+1],v=r[f+2],x=new ft(g[0]-m[0],g[1]-m[1]),S=new ft(v[0]-m[0],v[1]-m[1]),w=vW(x,S)/Math.PI*180,E=x.length()+S.length();(!l||w<i&&E>.01||E>n)&&(a.push(r[f+1]),l=!0)}if(a.push(r[r.length-1]),!e)return a;let c=[];c.push(a[0]);for(let f=0;f<a.length-2;f+=1){let g=new ft(a[f][0],a[f][1]),m=new ft(a[f+1][0],a[f+1][1]),v=new ft(a[f+2][0],a[f+2][1]),x=g.distanceTo(m)/2,S=v.distanceTo(m)/2,w=m.clone(),E=m.clone();w.add(g.clone().sub(m).normalize().multiplyScalar(x>o?o/2:x)),E.add(v.clone().sub(m).normalize().multiplyScalar(S>o?o/2:S));let b=[[w.x,w.y],[m.x,m.y],[E.x,E.y]];c.push(...kT(b,o/25))}return c.push(a[a.length-1]),_W(c)}function _W(r){if(r.length<=1)return r;let t=[],e;return r.forEach(n=>{let[i,o]=n;e?i===e[0]&&o===e[1]||(e=[i,o],t.push([i,o])):(e=[i,o],t.push([i,o]))}),t}function VT(r,t,e){let n=Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2);if(n===0)return{distance:Math.sqrt((r[0]-t[0])**2+(r[1]-t[1])**2),closestPoint:t.slice(0)};let i=Math.max(0,Math.min(1,((r[0]-t[0])*(e[0]-t[0])+(r[1]-t[1])*(e[1]-t[1]))/n**2)),o=[t[0]+i*(e[0]-t[0]),t[1]+i*(e[1]-t[1])];return{distance:Math.sqrt((r[0]-o[0])**2+(r[1]-o[1])**2),closestPoint:o}}function lyt(r,t,e){let[n,i]=r,[o,a]=t,l=Math.sqrt(Math.pow(o-n,2)+Math.pow(a-i,2));if(l===0||l<e)return[...t];let c=e/l,f=n+(o-n)*c,g=i+(a-i)*c;return[f,g]}var Q0=function(r){return r.START="start",r.END="end",r.FRONT="front",r.RIGHT="right",r.LEFT="left",r.RIGHT_FRONT="right_front",r.LEFT_FRONT="left_front",r.RIGHT_BACK="right_back",r.LEFT_BACK="left_back",r}({});function M1(r,t,e){let n=xv(r,t,e);return w1(n)}function w1(r){return 180-Math.abs(r)<15?"front":r>135?"right_front":r<-135?"left_front":r<=135&&r>=60?"right":r>=-135&&r<=-60?"left":r<60&&r>0?"right_back":r>-60&&r<0?"left_back":"front"}function cyt(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let t=[{direction:"start",distance:zr(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let n=M1(r[e-2],r[e-1],r[e]);if(n==="front"){let i=t[t.length-1],o=zr(r[e-1],r[e]);i.distance+=o,e!==2&&i.points.push(r[e-1])}else t.push({direction:n,distance:zr(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}function HT(r,t){if(r.length<2)return-1;let e=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=[t[0]-i[0],t[1]-i[1]],l=[o[0]-i[0],o[1]-i[1]],c=Math.min(o[0],i[0])<=t[0]&&t[0]<=Math.max(o[0],i[0]),f=Math.min(o[1],i[1])<=t[1]&&t[1]<=Math.max(o[1],i[1]);if(c&&f){let g=a[0]*l[1]-a[1]*l[0];if(Math.abs(g)<1e-6){let m=Math.sqrt((t[0]-i[0])**2+(t[1]-i[1])**2);return e+m}}e+=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2)}return-1}function Jf(r,t){if(r.length<2){var e;return(e=r[0])!=null?e:null}let n=0;for(let i=1;i<r.length;i++){let o=r[i-1],a=r[i],l=Math.sqrt((a[0]-o[0])**2+(a[1]-o[1])**2);if(n+=l,n>=t){let c=(t-(n-l))/l,f=o[0]+(a[0]-o[0])*c,g=o[1]+(a[1]-o[1])*c;return[f,g]}}return null}var A8t=H(En(),1),C8t=H(ze(),1),R8t=H(Xa(),1),tl=H(XT(),1);var Tu="___",jT=class{initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(n=>{let i=""+e.floor+Tu+n.id;if(this.pointMap.set(i,n),this.nodeMap.set(""+n.floor+Tu+n.nodeId,i),n.type==="straightLadder"){let o=this.straightLadderMap.get(n.name)||[];o.push(ee({},n)),this.straightLadderMap.set(n.name,o)}if(n.type==="staircase"){let o=this.staircaseMap.get(n.name)||[];o.push(ee({},n)),this.staircaseMap.set(n.name,o)}if(n.type==="escalator"){let o=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?o.end={floor:n.floor,id:n.id}:o.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,o)}if(n.type==="facility"){let o=this.facilityMap.get(n.targetId)||[];o.push(ee({},n)),this.facilityMap.set(n.targetId,o)}}),e.lines.filter(n=>n.direction!=="no").forEach(n=>{var i,o;let a=""+e.floor+Tu+n.from,l=""+e.floor+Tu+n.to,c=(i=this.pointMap.get(a))==null?void 0:i.cds,f=(o=this.pointMap.get(l))==null?void 0:o.cds;if(c!=null&&c.length&&(f!=null&&f.length)){let g=zr(c,f);this.addLineItem(a,l,g),n.direction==="double"&&this.addLineItem(l,a,g)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(t,e,n,i){i===void 0&&(i=this.lineMap);let o=i.get(t)||new Map;o.set(e,n),i.set(t,o)}addFacilityToLineMap(t,e,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(o=>{let[a,l]=o;if(!(l.length<2))for(let g=0;g<l.length;g++){let m=""+l[g].floor+Tu+l[g].id;for(let v=0;v<l.length;v++)if(g!==v){var c,f;let x=""+l[v].floor+Tu+l[v].id,S=(c=this.pointMap.get(m))==null?void 0:c.cds,w=(f=this.pointMap.get(x))==null?void 0:f.cds;if(S!=null&&S.length&&(w!=null&&w.length))if(l[g].type==="straightLadder"){let E=e;this.addLineItem(m,x,E,i)}else{let E=n;this.addLineItem(m,x,E,i)}}}}),this.escalatorMap.forEach((o,a)=>{if(o.start&&o.end){var l,c;let f=""+o.start.floor+Tu+o.start.id,g=""+o.end.floor+Tu+o.end.id,m=(l=this.pointMap.get(f))==null?void 0:l.cds,v=(c=this.pointMap.get(g))==null?void 0:c.cds;if(m!=null&&m.length&&(v!=null&&v.length)){let x=t;this.addLineItem(f,g,x,i)}}})}initBaseRoute(){let t=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,t),this.baseRoute=new tl.default(t)}initEscalatorRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new tl.default(t)}initStraightLadderRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new tl.default(t)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility?!0:this.checkStart(t)}transformStart(t){var e;if(t.nodeId){let n=this.nodeMap.get(""+t.floor+Tu+t.nodeId);if(n){let[i,o]=n.split(Tu);return{floor:i,id:o}}}if((e=t.coord)!=null&&e.length){let n=this.roadInfo.find(o=>o.floor===t.floor);if(!n)return null;let i=n.points.reduce((o,a)=>{let l=zr(t.coord,a.cds);return l<o.min&&(o.min=l,o.point=a),o},{min:1/0,point:n.points[0]});return{floor:i.point.floor,id:i.point.id}}return null}transformEnd(t){if(t.floor){let e=this.transformStart(t);if(e)return e}if(t.facility){let e=this.facilityMap.get(t.facility);if(e!=null&&e.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,n){if(n===void 0&&(n=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let i=this.transformStart(t);if(!i)return"no-start";let o=this.transformEnd(e);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o);if(o.facility){let l=this.facilityMap.get(o.facility).filter(f=>o.floor?f.floor===o.floor:!0);if(!l.length)return null;let c=l.map(f=>a(i,{floor:f.floor,id:f.id})).filter(f=>!!f);return c.reduce((f,g)=>{let m=g.reduce((v,x)=>v+Ws(x.points),0);return m<f.distance&&(f.distance=m,f.path=g),f},{distance:1/0,path:c[0]}).path}}getRoutePath(t,e,n){let i=""+t.floor+Tu+t.id,o=""+e.floor+Tu+e.id,a=n.path(i,o);if(!a)return null;let l=[];return a.map(c=>{let f=this.pointMap.get(c);if(f){var g;let{floor:m}=f;if(((g=l[l.length-1])==null?void 0:g.floor)===m){let v=l[l.length-1];v.points.push(f.cds),v.endType=f.type,v.destId=f.nodeId,v.distance=Ws(v.points)}else l.push({floor:m,points:[f.cds],endType:f.type,destId:f.nodeId,distance:0})}}),l}getBasePath(t,e){return this.getRoutePath(t,e,this.baseRoute)}getEscalatorPath(t,e){return this.getRoutePath(t,e,this.escalatorRoute)}getStraightLadderPath(t,e){return this.getRoutePath(t,e,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new tl.default,this.escalatorRoute=new tl.default,this.straightLadderRoute=new tl.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.staircaseMap=new Map,this.lineMap=new Map,this.baseRoute=new tl.default,this.escalatorRoute=new tl.default,this.straightLadderRoute=new tl.default}};var H8t=H(ze(),1),W8t=H(Xa(),1),q8t=H(En(),1),X8t=H(n0(),1),j8t=H(r0(),1),Y8t=H(i0(),1),Z8t=H(o0(),1),K8t=H(s0(),1),$8t=H(a0(),1),J8t=H(u0(),1),Q8t=H(C1(),1),t9t=H(R1(),1),as=H(XT(),1);var xa=H(qs(),1);var hr="___",KT=class{isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let n=[];try{n=JSON.parse(e.entry_end_floor)}catch(o){n=[]}let i=[];try{i=JSON.parse(e.entry_start_floor)}catch(o){i=[]}return ee({},e,{entry_start_floor:i,entry_end_floor:n})})}getParkingSpaceInfo(t,e){let n=""+t+hr+e;var i;return(i=this.parkingMap.get(n))!=null?i:null}getNodeInfo(t,e){let n=""+t+hr+e,i=this.nodeMap.get(n);if(!(i!=null&&i.length))return null;let o=this.pointMap.get(i[0]);return o!=null?o:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let n=new Date,i=n.getHours()*60+n.getMinutes();t.length&&(t.forEach(o=>{let a=(o.points||[]).filter(l=>!(0,xa.isNil)(l.passWeight)&&l.passWeight!==1&&!(0,xa.isNil)(l.coverageArea)&&l.coverageArea!==0);(o.points||[]).filter(l=>l.openStatus!==!1).filter(l=>{if(!l.startTime||!l.endTime)return!0;let[c,f]=l.startTime.split(":").map(S=>+S),[g,m]=l.endTime.split(":").map(S=>+S),v=c*60+f,x=g*60+m;return i>=v&&i<=x}).forEach(l=>{l.floor=o.floor;let c=""+o.floor+hr+l.id,f=""+o.floor+hr+l.nodeId,g=this.nodeMap.get(f)||[];if(g.push(""+o.floor+hr+(l.relatedId||l.id)),this.nodeMap.set(""+o.floor+hr+l.nodeId,g),this.pointMap.set(c,l),this.isFacilityByType(l.type)){let m=this.facilities.find(v=>v.id===+l.targetId);if(m){switch(m.entry_infra_type){case"straightLadder":if(m.entry_end_floor.find(w=>w.floor===o.floor)&&m.entry_start_floor.find(w=>w.floor===o.floor)){let w=this.straightLadderMap.get(l.targetId)||[];w.push(ee({},l)),this.straightLadderMap.set(l.targetId,w)}break;case"staircase":if(m.entry_end_floor.find(w=>w.floor===o.floor)&&m.entry_start_floor.find(w=>w.floor===o.floor)){let w=this.staircaseMap.get(l.targetId)||[];w.push(ee({},l)),this.staircaseMap.set(l.targetId,w)}break;case"escalator":let x=this.escalatorMap.get(l.targetId)||[];if(m.entry_start_floor.find(w=>w.floor===o.floor)){let w=x.find(E=>{var b;return((b=E.end)==null?void 0:b.floor)!==o.floor&&!E.start});w?w.start=l:x.push({start:l})}if(m.entry_end_floor.find(w=>w.floor===o.floor)){let w=x.find(E=>{var b;return((b=E.start)==null?void 0:b.floor)!==o.floor&&!E.end});w?w.end=l:x.push({end:l})}this.escalatorMap.set(l.targetId,x);break;case"ramp":let S=this.rampMap.get(l.targetId)||[];if(m.entry_start_floor.find(w=>w.floor===o.floor)){let w=S.find(E=>{var b;return((b=E.end)==null?void 0:b.floor)!==o.floor&&!E.start});w?w.start=l:S.push({start:l})}if(m.entry_end_floor.find(w=>w.floor===o.floor)){let w=S.find(E=>{var b;return((b=E.start)==null?void 0:b.floor)!==o.floor&&!E.end});w?w.end=l:S.push({end:l})}this.rampMap.set(l.targetId,S);break;case"connectionPoint":if(m.entry_end_floor.find(w=>w.floor===o.floor)&&m.entry_start_floor.find(w=>w.floor===o.floor)){let w=this.connectionPointMap.get(l.targetId)||[];w.push(ee({},l)),this.connectionPointMap.set(l.targetId,w)}break}let v=this.facilityMap.get(l.targetId)||[];v.push(ee({},l)),this.facilityMap.set(l.targetId,v)}}l.type==="parkingSpace"&&l.name.split(/[,,]/).forEach(v=>{this.parkingMap.set(""+o.floor+hr+v,l)})}),(o.lines||[]).filter(l=>l.to!==l.from).forEach(l=>{let c=""+o.floor+hr+l.from,f=""+o.floor+hr+l.to,g=this.pointMap.get(c),m=this.pointMap.get(f);if(!g||!m)return;let v=g.cds,x=m.cds,S=zr(v,x);if(a.forEach(w=>{(w.id===l.from||w.id===l.to)&&(S=S/w.passWeight);let E=zr(v,w.cds)<=w.coverageArea,b=zr(x,w.cds)<=w.coverageArea;(E||b)&&(S=S/w.passWeight)}),!g.permission&&!m.permission){switch(this.addLineItem(c,f,S),this.addLineItem(f,c,S),l.direction){case"double":this.addLineItem(c,f,S,this.forwardLineMap),this.addLineItem(f,c,S,this.forwardLineMap);break;case"single":this.addLineItem(c,f,S,this.forwardLineMap);break;case"back":this.addLineItem(f,c,S,this.forwardLineMap);break}(g.type==="parkingSpace"||m.type==="parkingSpace")&&l.direction==="noDir"&&(this.addLineItem(c,f,S,this.forwardLineMap),this.addLineItem(f,c,S,this.forwardLineMap))}else g.permission&&(this.setPermissionLine(c,f,g.permission,S,""),this.setPermissionLine(f,c,g.permission,S,"")),m.permission&&m.permission!==g.permission&&(this.setPermissionLine(c,f,m.permission,S,""),this.setPermissionLine(f,c,m.permission,S,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,n,i,o){this.getPermissionMap(n).add({fromKey:t,toKey:e,distance:i,type:o})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let n=0;n<t.length;n++){let i=""+t[n].floor+hr+t[n].id,o=this.pointMap.get(i);if(o){for(let a=0;a<t.length;a++)if(n!==a){let l=""+t[a].floor+hr+t[a].id,c=this.pointMap.get(l);if(!c)continue;o.permission&&this.setPermissionLine(i,l,o.permission,1,"straightLadder"),c.permission&&c.permission!==o.permission&&this.setPermissionLine(i,l,c.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let n=0;n<t.length;n++){let i=""+t[n].floor+hr+t[n].id,o=this.pointMap.get(i);if(o){for(let a=0;a<t.length;a++)if(n!==a){let l=""+t[a].floor+hr+t[a].id,c=this.pointMap.get(l);if(!c)continue;o.permission&&this.setPermissionLine(i,l,o.permission,1,"staircase"),c.permission&&c.permission!==o.permission&&this.setPermissionLine(i,l,c.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(n=>{if(n.start&&n.end){let i=""+n.start.floor+hr+n.start.id,o=""+n.end.floor+hr+n.end.id,a=this.pointMap.get(i),l=this.pointMap.get(o);a&&l&&(a.permission&&this.setPermissionLine(i,o,a.permission,1,"escalator"),l.permission&&l.permission!==a.permission&&this.setPermissionLine(i,o,l.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(n=>{if(n.start&&n.end){let i=""+n.start.floor+hr+n.start.id,o=""+n.end.floor+hr+n.end.id,a=this.pointMap.get(i),l=this.pointMap.get(o);a&&l&&(a.permission&&this.setPermissionLine(i,o,a.permission,10,"ramp"),l.permission&&l.permission!==a.permission&&this.setPermissionLine(i,o,l.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{if(t.length<2){this.connectionPointMap.delete(e);return}for(let n=0;n<t.length;n++){let i=""+t[n].floor+hr+t[n].id,o=this.pointMap.get(i);if(o){for(let a=0;a<t.length;a++)if(n!==a){let l=""+t[a].floor+hr+t[a].id,c=this.pointMap.get(l);if(!c)continue;o.permission&&this.setPermissionLine(i,l,o.permission,1,"connectionPoint"),c.permission&&c.permission!==o.permission&&this.setPermissionLine(i,l,c.permission,1,"connectionPoint")}}}})}addPermissionLineToMap(t,e,n,i){this.getPermissionMap(t).forEach(a=>{e.includes(a.type)&&(a.type===""?this.addLineItem(a.fromKey,a.toKey,a.distance,n):this.addLineItem(a.fromKey,a.toKey,i.get(a.type),n))})}addLineItem(t,e,n,i){i===void 0&&(i=this.lineMap);let o=i.get(t)||new Map;o.set(e,n),i.set(t,o)}addFacilityToLineMap(t,e,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(o=>{let[a,l]=o;if(!(l.length<2))for(let c=0;c<l.length;c++){let f=""+l[c].floor+hr+l[c].id,g=this.pointMap.get(f);if(!(!g||g.permission)){for(let m=0;m<l.length;m++)if(c!==m){let v=""+l[m].floor+hr+l[m].id,x=this.pointMap.get(v);if(!x||x.permission)continue;if(l[c].type==="straightLadder"){let S=e;this.addLineItem(f,v,S,i)}else{let S=n;this.addLineItem(f,v,S,i)}}}}}),this.escalatorMap.forEach((o,a)=>{o.forEach(l=>{if(l.start&&l.end){let c=""+l.start.floor+hr+l.start.id,f=""+l.end.floor+hr+l.end.id,g=this.pointMap.get(c),m=this.pointMap.get(f);if(g&&m&&!g.permission&&!m.permission){let v=t;this.addLineItem(c,f,v,i)}}})}),this.connectionPointMap.forEach((o,a)=>{if(!(o.length<2))for(let l=0;l<o.length;l++){let c=""+o[l].floor+hr+o[l].id,f=this.pointMap.get(c);if(!(!f||f.permission)){for(let g=0;g<o.length;g++)if(l!==g){let m=""+o[g].floor+hr+o[g].id,v=this.pointMap.get(m);if(!v||v.permission)continue;this.addLineItem(c,m,100,i)}}}})}initBaseRoute(){let t=new Map((0,xa.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,t),this.baseRoute=new as.default(t)}initEscalatorRoute(){let t=new Map((0,xa.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new as.default(t)}initStraightLadderRoute(){let t=new Map((0,xa.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new as.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(n=>{if(n.start&&n.end){let i=""+n.start.floor+hr+n.start.id,o=""+n.end.floor+hr+n.end.id,a=this.pointMap.get(i),l=this.pointMap.get(o);a&&l&&!a.permission&&!l.permission&&this.addLineItem(i,o,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{if(!(t.length<2))for(let n=0;n<t.length;n++){let i=""+t[n].floor+hr+t[n].id,o=this.pointMap.get(i);if(!(!o||o.permission)){for(let a=0;a<t.length;a++)if(n!==a){let l=""+t[a].floor+hr+t[a].id,c=this.pointMap.get(l);if(!c||c.permission)continue;this.addLineItem(i,l,100,this.forwardLineMap)}}}}),this.forwardRoute=new as.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t,e,n){n===void 0&&(n={});var i;if(t.nodeId){let o=this.nodeMap.get(""+t.floor+hr+t.nodeId);if(o!=null&&o.length)return o.map(a=>{let[l,c]=a.split(hr);return{floor:l,id:c}})}if((i=t.coord)!=null&&i.length){let o=this.roadInfo.find(f=>f.floor===t.floor);if(!o)return null;let a=o.points.filter(f=>f.isStarted),l=o.points.filter(f=>{let g=""+f.floor+hr+f.id;if(e==="forward"){if(!this.forwardLineMap.has(g)||n.adsorptionIntersection&&a.length&&!f.isStarted)return!1}else if(!this.lineMap.has(g))return!1;return!0});if(!l.length)return null;let c=l.reduce((f,g)=>{if(g.relatedId)return f;let m=zr(t.coord,g.cds);return m<f.min&&(f.min=m,f.point=g),f},{min:1/0,point:l[0]});return[{floor:o.floor,id:c.point.id}]}return null}transformEnd(t,e){if(t.floor){if(t.parkingSpace){let i=this.parkingMap.get(""+t.floor+hr+t.parkingSpace);if(i)return[{floor:t.floor,id:i.id}]}let n=this.transformStart(t,e);if(n)return n}if(t.facility){let i=this.facilities.filter(o=>+o.type_id==+t.facility).map(o=>o.id).map(o=>this.facilityMap.get(""+o)).flat(2);if(i!=null&&i.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,n,i,o,a){if(n===void 0&&(n=""),a===void 0&&(a={}),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let l=this.transformStart(t,n,a);if(!l)return"no-start";let c=this.transformEnd(e,n);if(!c)return"no-end";let f=[];if(Array.isArray(c))for(let v=0;v<l.length;v++){let x=l[v];for(let S=0;S<c.length;S++){let w=c[S];if(x.floor===w.floor&&x.id===w.id)return"near"}}else{f=this.facilities.filter(x=>+x.type_id==+e.facility).map(x=>x.id).map(x=>this.facilityMap.get(""+x)).flat(2).filter(x=>x).filter(x=>c.floor?x.floor===c.floor:!0);for(let x=0;x<l.length;x++){let S=l[x];for(let w=0;w<f.length;w++){let E=f[w];if(S.floor===E.floor&&S.id===E.id)return"near"}}}let g;switch(n){case"escalator":g=this.getEscalatorPath.bind(this);break;case"straightLadder":g=this.getStraightLadderPath.bind(this);break;case"forward":g=this.getForwardPath.bind(this);break;default:g=this.getBasePath.bind(this);break}let m=null;return l.forEach(v=>{if(Array.isArray(c))c.forEach(x=>{let S=g(v,x,i,o);S&&S&&(!m||S[0].consume<m[0].consume)&&(m=S)});else{if(!f.length)return null;let x=f.map(S=>g(v,{floor:S.floor,id:S.id},i,o)).filter(S=>!!S);m=x.reduce((S,w)=>{let E=w[0].consume;return E<S.distance&&(S.distance=E,S.path=w),S},{distance:1/0,path:x[0]}).path}}),m}getRoutePath(t,e,n){let i=""+t.floor+hr+t.id,o=""+e.floor+hr+e.id,a=n.path(i,o);if(!a)return null;let l=[],c=a.reduce((f,g,m,v)=>{if(m===0)return 0;let x=v[m-1],S=n.graph.get(x).get(g);return f+S},0);return a.map(f=>{let g=this.pointMap.get(f);if(g){var m;let{floor:v}=g,x=g.type;if(this.isFacilityByType(g.type)){let S=this.facilities.find(w=>w.id===+g.targetId);S&&(x=S.entry_infra_type)}if(((m=l[l.length-1])==null?void 0:m.floor)===v){let S=l[l.length-1];S.points.push(g.cds),S.pointInfos.push(g),S.endType=x,S.destId=g.nodeId,S.distance=Ws(S.points)}else l.push({floor:v,points:[g.cds],pointInfos:[g],endType:x,destId:g.nodeId,distance:0,consume:c})}}),l}getBasePath(t,e,n){if(!n)return this.getRoutePath(t,e,this.baseRoute);let i=(0,xa.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder","connectionPoint"],i,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let o=new as.default(i);return this.getRoutePath(t,e,o)}getEscalatorPath(t,e,n){if(!n)return this.getRoutePath(t,e,this.escalatorRoute);let i=(0,xa.cloneDeep)(this.escalatorRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder","connectionPoint"],i,new Map([["escalator",1*o],["connectionPoint",100],["straightLadder",this.lift_priority*o],["staircase",3e4*o]]));let a=new as.default(i);return this.getRoutePath(t,e,a)}getStraightLadderPath(t,e,n){if(!n)return this.getRoutePath(t,e,this.straightLadderRoute);let i=(0,xa.cloneDeep)(this.straightLadderRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder","connectionPoint"],i,new Map([["escalator",3*o],["connectionPoint",100],["straightLadder",1*o],["staircase",3e4*o]]));let a=new as.default(i);return this.getRoutePath(t,e,a)}getForwardPath(t,e,n,i){let o=new Map,a=v=>{let x=this.forwardRoute.graph.get(c);v.forEach(S=>{let w=x.get(S);(0,xa.isNil)(w)||(o.set(S,w),x.delete(S))})},l=()=>{let v=this.forwardRoute.graph.get(c);o.forEach((x,S)=>{v.set(S,x)})},c=""+t.floor+hr+t.id;if(!(0,xa.isNil)(i)){let v=this.forwardLineMap.get(c),x=this.pointMap.get(c);if(x&&(v!=null&&v.size)&&v.size>1){let S=new ft(x.cds[0],x.cds[1]),w=new Map;v.forEach((b,C)=>{let A=this.pointMap.get(C);if(A){let P=new ft(A.cds[0],A.cds[1]),U=360-(new ft().subVectors(P,S).angle()/Math.PI*180-90+360)%360;w.set(C,U)}});let E=Array.from(w).filter(b=>{let[C,A]=b;return Math.abs(A-i)<=60}).map(b=>{let[C]=b;return C});if(E.length)E.forEach(b=>w.delete(b)),a([...w.keys()]);else{let b=Array.from(w).reduce((C,A)=>{let P=Math.abs(A[1]-i);return P<C.diff?{diff:P,key:A[0]}:C},{diff:1/0,key:""});w.delete(b.key),a([...w.keys()])}}}if(!n){let v=this.getRoutePath(t,e,this.forwardRoute);return l(),v||this.getRoutePath(t,e,this.forwardRoute)}let f=(0,xa.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],f,new Map([["ramp",10]]));let g=new as.default(f),m=this.getRoutePath(t,e,g);if(l(),m)return m;{let v=(0,xa.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],v,new Map([["ramp",10]]));let x=new as.default(v);return this.getRoutePath(t,e,x)}}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new as.default,this.escalatorRoute=new as.default,this.straightLadderRoute=new as.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.baseRoute=new as.default,this.escalatorRoute=new as.default,this.straightLadderRoute=new as.default,this.forwardLineMap=new Map,this.forwardRoute=new as.default}};var i9t=H(n0(),1),o9t=H(r0(),1),s9t=H(i0(),1),a9t=H(o0(),1),u9t=H(s0(),1),l9t=H(a0(),1),c9t=H(u0(),1),h9t=H(ze(),1),Sh=class{static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let t=this.createKey();for(;this.keySet.has(t);)t=this.createKey();return t}static removeKey(t){this.keySet.delete(t)}static dispose(){this.keySet.clear()}};Sh.keySet=new Set;var p9t=H(bv(),1),d9t=H(Xa(),1);function $T(r){return r.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function fi(r,t,e){return new Promise((n,i)=>{let o=Sh.genUniqueKey(),a=l=>{let{data:c}=l;c.type===""+t+"_result"&&c.key===o&&(Sh.removeKey(o),self.removeEventListener("message",a),c.error?i(c.error):n(c.data))};r.addEventListener("message",a),r.postMessage({type:t,key:o,data:e})})}function Vyt(r){let t={};for(let n in r)n.startsWith("on")&&(t[$T(n.slice(2))]=r[n]);let e=n=>Tt(this,null,function*(){let{data:i}=n;if(t[i.type])try{let o=yield t[i.type](i.data);if(o!=null&&o.$transfer&&Array.isArray(o.$transfer)){let a=o.$transfer;delete o.$transfer,self.postMessage({type:""+i.type+"_result",key:i.key,data:o},a)}else self.postMessage({type:""+i.type+"_result",key:i.key,data:o})}catch(o){self.postMessage({type:""+i.type+"_result",key:i.key,error:o})}else self.postMessage({type:""+i.type+"_result",key:i.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}function Hyt(r,t){t===void 0&&(t=16711680);let e=new ma({color:t}),n=new qe().setFromPoints(r);return new Hl(n,e)}function Wyt(r,t){t===void 0&&(t=16711680);let e=new ma({color:t}),n=new Eu(1,1,1),i=new en(n,e);return i.position.copy(r),i}var S9t=H(sf(),1),b9t=H(ze(),1);function Av(r,t,e){e===void 0&&(e=0),r.forEach(n=>{if(n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"){var i;n.geometry.coords.map(o=>{Array.isArray(o)&&o.forEach(a=>{a[0]-=t[0],a[1]-=t[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(o=>o.map(a=>Qf(a,t)))),(i=n.doors)!=null&&i.length&&n.doors.map(o=>{o.coord=Qf(o.coordinate,t)}),n.center&&(n.centerCoords=Qf(n.center,t))}else n.geometry.coords=Qf(n.geometry.cds,t),n.center&&(n.centerCoords=Qf(n.center,t));if(n.center_x&&n.center_y){let[o,a]=Qf([n.center_x,n.center_y],t);n.center_coord_x=o,n.center_coord_y=a}});for(let n=0;n<r.length;n++){let i=r[n];i.deltaHeight=1e-5*(e+n+1)}}function Qf(r,t){return[r[0]-t[0],r[1]-t[1]]}var L9t=H(n0(),1),N9t=H(r0(),1),O9t=H(i0(),1),D9t=H(o0(),1),U9t=H(s0(),1),F9t=H(a0(),1),B9t=H(u0(),1),z9t=H(ze(),1);var tp=Object.freeze({Linear:Object.freeze({None:function(r){return r},In:function(r){return this.None(r)},Out:function(r){return this.None(r)},InOut:function(r){return this.None(r)}}),Quadratic:Object.freeze({In:function(r){return r*r},Out:function(r){return r*(2-r)},InOut:function(r){return(r*=2)<1?.5*r*r:-.5*(--r*(r-2)-1)}}),Cubic:Object.freeze({In:function(r){return r*r*r},Out:function(r){return--r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r:.5*((r-=2)*r*r+2)}}),Quartic:Object.freeze({In:function(r){return r*r*r*r},Out:function(r){return 1- --r*r*r*r},InOut:function(r){return(r*=2)<1?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)}}),Quintic:Object.freeze({In:function(r){return r*r*r*r*r},Out:function(r){return--r*r*r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)}}),Sinusoidal:Object.freeze({In:function(r){return 1-Math.sin((1-r)*Math.PI/2)},Out:function(r){return Math.sin(r*Math.PI/2)},InOut:function(r){return .5*(1-Math.sin(Math.PI*(.5-r)))}}),Exponential:Object.freeze({In:function(r){return r===0?0:Math.pow(1024,r-1)},Out:function(r){return r===1?1:1-Math.pow(2,-10*r)},InOut:function(r){return r===0?0:r===1?1:(r*=2)<1?.5*Math.pow(1024,r-1):.5*(-Math.pow(2,-10*(r-1))+2)}}),Circular:Object.freeze({In:function(r){return 1-Math.sqrt(1-r*r)},Out:function(r){return Math.sqrt(1- --r*r)},InOut:function(r){return(r*=2)<1?-.5*(Math.sqrt(1-r*r)-1):.5*(Math.sqrt(1-(r-=2)*r)+1)}}),Elastic:Object.freeze({In:function(r){return r===0?0:r===1?1:-Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI)},Out:function(r){return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r-.1)*5*Math.PI)+1},InOut:function(r){return r===0?0:r===1?1:(r*=2,r<1?-.5*Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI):.5*Math.pow(2,-10*(r-1))*Math.sin((r-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(r){var t=1.70158;return r===1?1:r*r*((t+1)*r-t)},Out:function(r){var t=1.70158;return r===0?0:--r*r*((t+1)*r+t)+1},InOut:function(r){var t=2.5949095;return(r*=2)<1?.5*(r*r*((t+1)*r-t)):.5*((r-=2)*r*((t+1)*r+t)+2)}}),Bounce:Object.freeze({In:function(r){return 1-tp.Bounce.Out(1-r)},Out:function(r){return r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375},InOut:function(r){return r<.5?tp.Bounce.In(r*2)*.5:tp.Bounce.Out(r*2-1)*.5+.5}}),generatePow:function(r){return r===void 0&&(r=4),r=r<Number.EPSILON?Number.EPSILON:r,r=r>1e4?1e4:r,{In:function(t){return Math.pow(t,r)},Out:function(t){return 1-Math.pow(1-t,r)},InOut:function(t){return t<.5?Math.pow(t*2,r)/2:(1-Math.pow(2-t*2,r))/2+.5}}}}),Cv=function(){return performance.now()},Rv=function(){function r(){this._tweens={},this._tweensAddedDuringUpdate={}}return r.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},r.prototype.removeAll=function(){this._tweens={}},r.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},r.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},r.prototype.update=function(t,e){t===void 0&&(t=Cv()),e===void 0&&(e=!1);var n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var o=this._tweens[n[i]],a=!e;o&&o.update(t,a)===!1&&!e&&delete this._tweens[n[i]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},r}(),Zd={Linear:function(r,t){var e=r.length-1,n=e*t,i=Math.floor(n),o=Zd.Utils.Linear;return t<0?o(r[0],r[1],n):t>1?o(r[e],r[e-1],e-n):o(r[i],r[i+1>e?e:i+1],n-i)},Bezier:function(r,t){for(var e=0,n=r.length-1,i=Math.pow,o=Zd.Utils.Bernstein,a=0;a<=n;a++)e+=i(1-t,n-a)*i(t,a)*r[a]*o(n,a);return e},CatmullRom:function(r,t){var e=r.length-1,n=e*t,i=Math.floor(n),o=Zd.Utils.CatmullRom;return r[0]===r[e]?(t<0&&(i=Math.floor(n=e*(1+t))),o(r[(i-1+e)%e],r[i],r[(i+1)%e],r[(i+2)%e],n-i)):t<0?r[0]-(o(r[0],r[0],r[1],r[1],-n)-r[0]):t>1?r[e]-(o(r[e],r[e],r[e-1],r[e-1],n-e)-r[e]):o(r[i?i-1:0],r[i],r[e<i+1?e:i+1],r[e<i+2?e:i+2],n-i)},Utils:{Linear:function(r,t,e){return(t-r)*e+r},Bernstein:function(r,t){var e=Zd.Utils.Factorial;return e(r)/e(t)/e(r-t)},Factorial:function(){var r=[1];return function(t){var e=1;if(r[t])return r[t];for(var n=t;n>1;n--)e*=n;return r[t]=e,e}}(),CatmullRom:function(r,t,e,n,i){var o=(e-r)*.5,a=(n-t)*.5,l=i*i,c=i*l;return(2*t-2*e+o+a)*c+(-3*t+3*e-2*o-a)*l+o*i+t}}},ZW=function(){function r(){}return r.nextId=function(){return r._nextId++},r._nextId=0,r}(),JT=new Rv,Za=function(){function r(t,e){e===void 0&&(e=JT),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=tp.Linear.None,this._interpolationFunction=Zd.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=ZW.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return r.prototype.getId=function(){return this._id},r.prototype.isPlaying=function(){return this._isPlaying},r.prototype.isPaused=function(){return this._isPaused},r.prototype.to=function(t,e){if(e===void 0&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=e,this},r.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t,this},r.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},r.prototype.start=function(t,e){if(t===void 0&&(t=Cv()),e===void 0&&(e=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var o in this._valuesEnd)i[o]=this._valuesEnd[o];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},r.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},r.prototype._setupProperties=function(t,e,n,i,o){for(var a in n){var l=t[a],c=Array.isArray(l),f=c?"array":typeof l,g=!c&&Array.isArray(n[a]);if(!(f==="undefined"||f==="function")){if(g){var m=n[a];if(m.length===0)continue;for(var v=[l],x=0,S=m.length;x<S;x+=1){var w=this._handleRelativeValue(l,m[x]);if(isNaN(w)){g=!1,console.warn("Found invalid interpolation list. Skipping.");break}v.push(w)}g&&(n[a]=v)}if((f==="object"||c)&&l&&!g){e[a]=c?[]:{};var E=l;for(var b in E)e[a][b]=E[b];i[a]=c?[]:{};var m=n[a];if(!this._isDynamic){var C={};for(var b in m)C[b]=m[b];n[a]=m=C}this._setupProperties(E,e[a],m,i[a],o)}else(typeof e[a]=="undefined"||o)&&(e[a]=l),c||(e[a]*=1),g?i[a]=n[a].slice().reverse():i[a]=e[a]||0}}},r.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},r.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},r.prototype.pause=function(t){return t===void 0&&(t=Cv()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this),this)},r.prototype.resume=function(t){return t===void 0&&(t=Cv()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},r.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},r.prototype.group=function(t){return t===void 0&&(t=JT),this._group=t,this},r.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},r.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},r.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},r.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},r.prototype.easing=function(t){return t===void 0&&(t=tp.Linear.None),this._easingFunction=t,this},r.prototype.interpolation=function(t){return t===void 0&&(t=Zd.Linear),this._interpolationFunction=t,this},r.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},r.prototype.onStart=function(t){return this._onStartCallback=t,this},r.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},r.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},r.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},r.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},r.prototype.onStop=function(t){return this._onStopCallback=t,this},r.prototype.update=function(t,e){if(t===void 0&&(t=Cv()),e===void 0&&(e=!0),this._isPaused)return!0;var n,i,o=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>o)return!1;e&&this.start(t,!0)}if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0),i=(t-this._startTime)/this._duration,i=this._duration===0||i>1?1:i;var a=this._easingFunction(i);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,i),i===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(n in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[n]=="string"&&(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var l=0,c=this._chainedTweens.length;l<c;l++)this._chainedTweens[l].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},r.prototype._updateProperties=function(t,e,n,i){for(var o in n)if(e[o]!==void 0){var a=e[o]||0,l=n[o],c=Array.isArray(t[o]),f=Array.isArray(l),g=!c&&f;g?t[o]=this._interpolationFunction(l,i):typeof l=="object"&&l?this._updateProperties(t[o],a,l,i):(l=this._handleRelativeValue(a,l),typeof l=="number"&&(t[o]=a+(l-a)*i))}},r.prototype._handleRelativeValue=function(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)},r.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],n=this._valuesEnd[t];typeof n=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(n):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=e},r}();var w9t=ZW.nextId,el=JT,T9t=el.getAll.bind(el),A9t=el.removeAll.bind(el),C9t=el.add.bind(el),R9t=el.remove.bind(el),P9t=el.update.bind(el);var Kl=class{update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(t=>{this.tweenStore.add(t),t.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(t=>{t.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(t){this.group.remove(t)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(t=>t.stop()),this.group.removeAll()}dispose(){this.clear()}constructor(){this.pauseTween=!1,this.tweenStore=new Set,this.group=new Rv}};var Pv=class extends Sn{registryEvent(){this.ctn.addEventListener("pointerdown",this._pointerDown),this.ctn.addEventListener("pointerup",this._pointerUp)}unRegistryEvent(){this.ctn.removeEventListener("pointerdown",this._pointerDown),this.ctn.removeEventListener("pointerup",this._pointerUp)}dispose(){this.unRegistryEvent()}constructor(t){super(),this.ctn=t,this._pointerDown=e=>{this.point={x:e.offsetX,y:e.offsetY}},this._pointerUp=e=>{if(!this.point)return;let{offsetX:n,offsetY:i}=e,{x:o,y:a}=this.point;Math.hypot(o-n+(a-i))>3||this.dispatchEvent({type:"click",e})},this.registryEvent()}};var q9t=H(ze(),1),X9t=H(En(),1),j9t=H(bv(),1),Y9t=H(Xa(),1),KW=H(qs(),1);var ep=class extends Sn{_isEffectiveTask(t){return t&&typeof t.run=="function"}_getIndexByTid(t){return this._task.findIndex(e=>e.tid===t)}_createTask(t){return this._isEffectiveTask(t)?ee({},t,{tid:++this._id,meta:t.meta||{}}):!1}get task(){return[...this._task]}getTasks(){return[...this._task]}add(t){if(this._isEffectiveTask(t)){let e=this._createTask(t);return this._task.push(e),this.started&&!this.activeTask&&this.start(),e.tid}return!1}replace(t,e){if(!this._isEffectiveTask(e))return console.warn("[TaskQueue] replace\u65B9\u6CD5\u4F20\u5165\u7684task\u53C2\u6570\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;let n=this._getIndexByTid(t);if(n===-1)return console.warn("[TaskQueue] \u6CA1\u6709\u627E\u5230id="+t+"\u7684\u4EFB\u52A1"),!1;let i=this._createTask(e);return this._task.splice(n,1,i),i.tid}replaceByMetaType(t){var e;let n=(e=t.meta)==null?void 0:e.type;if((0,KW.isNil)(n))return this.add(t);{let i=this._task.find(o=>o.meta.type===n);return i?this.replace(i.tid,t):this.add(t)}}remove(t){let e=this._getIndexByTid(t);return e===-1?(console.warn("[TaskQueue] remove\u65B9\u6CD5\u4F20\u5165\u7684id\uFF1A"+t+"\u627E\u4E0D\u5230\u5BF9\u5E94\u7684task"),!1):(this._task.splice(e,1),!0)}clear(){this._task.length=0}start(){this.started=!0,!this.activeTask&&this._task.length&&this.exec()}stop(){this.started=!1}exec(){return Tt(this,null,function*(){if(!this.started||!this._task.length)return!1;let t=this._task.shift();this.activeTask=t,this.dispatchEvent({type:"active-task-start",task:t});let e;try{e=yield t.run()}catch(n){console.warn("[task run err]",n,t)}return this.activeTask=null,this.dispatchEvent({type:"active-task-end",task:t,res:e}),this.exec()})}constructor(t=!0){super(),this._task=[],this.started=!1,this.activeTask=null,this._id=0,t&&this.start()}};var J9t=H(En(),1);var Iv=class extends Sn{getWorker(){return new Promise(t=>{let e=this.pool.find(i=>i.state==="leisure");if(e){e.state="used",t(e.worker);return}if(this.pool.length<this.max&&this.workerConstructor){let i=this.workerConstructor();this.pool.push({worker:i,state:"used"}),t(i);return}let n=()=>{let i=this.pool.find(o=>o.state==="leisure");i&&(this.removeEventListener("release",n),i.state="used",t(i.worker))};this.addEventListener("release",n)})}releaseWorker(t){let e=this.pool.find(n=>n.worker===t);e&&(e.state="leisure",this.dispatchEvent({type:"release",worker:t}))}dispose(){this._listeners={},this.pool.forEach(t=>{t.worker.terminate()}),this.pool=[]}constructor(t=10,e){super(),this.max=10,this.pool=[],this.max=t,this.workerConstructor=e}};var Zi=class extends Sn{dispose(){this._listeners={}}};var Lv=class{filter(t){let e=this.estimate,n=this.errorEstimate+this.processNoise,i=n/(n+this.measurementNoise);return this.estimate=e+i*(t-e),this.errorEstimate=(1-i)*n,this.estimate}constructor(t={}){this.estimate=0,this.errorEstimate=1,this.processNoise=.1,this.measurementNoise=1,this.measurementNoise=t.measurementNoise||1,this.processNoise=t.processNoise||.1,this.errorEstimate=t.errorEstimate||1}};var MZt=H(ip(),1),wZt=H(ec(),1),TZt=H(nc(),1),AZt=H(rc(),1),CZt=H(ic(),1),RZt=H(oc(),1),PZt=H(sc(),1),IZt=H(ac(),1),LZt=H(uc(),1),NZt=H(lc(),1),OZt=H(cc(),1),DZt=H(hc(),1),UZt=H(fc(),1),FZt=H(pc(),1),BZt=H(dc(),1),zZt=H(En(),1);function Rh(r,t=!1){let e=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),o={},a={},l=r[0].morphTargetsRelative,c=new qe,f=0;for(let g=0;g<r.length;++g){let m=r[g],v=0;if(e!==(m.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let x in m.attributes){if(!n.has(x))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+'. All geometries must have compatible attributes; make sure "'+x+'" attribute exists among all geometries, or in none of them.'),null;o[x]===void 0&&(o[x]=[]),o[x].push(m.attributes[x]),v++}if(v!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". Make sure all geometries have the same number of attributes."),null;if(l!==m.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let x in m.morphAttributes){if(!i.has(x))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphAttributes must be consistent throughout all geometries."),null;a[x]===void 0&&(a[x]=[]),a[x].push(m.morphAttributes[x])}if(t){let x;if(e)x=m.index.count;else if(m.attributes.position!==void 0)x=m.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". The geometry must have either an index or a position attribute"),null;c.addGroup(f,x,g),f+=x}}if(e){let g=0,m=[];for(let v=0;v<r.length;++v){let x=r[v].index;for(let S=0;S<x.count;++S)m.push(x.getX(S)+g);g+=r[v].attributes.position.count}c.setIndex(m)}for(let g in o){let m=DX(o[g]);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" attribute."),null;c.setAttribute(g,m)}for(let g in a){let m=a[g][0].length;if(m===0)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[g]=[];for(let v=0;v<m;++v){let x=[];for(let w=0;w<a[g].length;++w)x.push(a[g][w][v]);let S=DX(x);if(!S)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" morphAttribute."),null;c.morphAttributes[g].push(S)}}return c}function DX(r){let t,e,n,i=-1,o=0;for(let f=0;f<r.length;++f){let g=r[f];if(t===void 0&&(t=g.array.constructor),t!==g.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=g.itemSize),e!==g.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=g.normalized),n!==g.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(i===-1&&(i=g.gpuType),i!==g.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;o+=g.count*e}let a=new t(o),l=new He(a,e,n),c=0;for(let f=0;f<r.length;++f){let g=r[f];if(g.isInterleavedBufferAttribute){let m=c/e;for(let v=0,x=g.count;v<x;v++)for(let S=0;S<e;S++){let w=g.getComponent(v,S);l.setComponent(v+m,S,w)}}else a.set(g.array,c);c+=g.count*e}return i!==void 0&&(l.gpuType=i),l}function iC(r,t){if(t===IF)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(t===Hm||t===rx){let e=r.getIndex();if(e===null){let a=[],l=r.getAttribute("position");if(l!==void 0){for(let c=0;c<l.count;c++)a.push(c);r.setIndex(a),e=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}let n=e.count-2,i=[];if(t===Hm)for(let a=1;a<=n;a++)i.push(e.getX(0)),i.push(e.getX(a)),i.push(e.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(i.push(e.getX(a)),i.push(e.getX(a+1)),i.push(e.getX(a+2))):(i.push(e.getX(a+2)),i.push(e.getX(a+1)),i.push(e.getX(a)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let o=r.clone();return o.setIndex(i),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),r}function pEt(r,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let n=r.filter(l=>l.geometry.type==="polygon");if(!n.length)return null;let i=n.map(l=>{var c;let f=l.geometry.coords,g=qm(f[0],f.slice(1)),m=new wf(g,{steps:1,bevelEnabled:!1,depth:l.height,curveSegments:4});(c=l).deltaHeight||(c.deltaHeight=0),m.translate(0,0,l.airHeight+l.deltaHeight);let v=m.attributes.position.count,x=new Float32Array(v).fill(l.height+l.airHeight+l.deltaHeight);if(m.setAttribute("maxZ",new He(x,1)),m.setAttribute("opacity",new He(new Float32Array(v).fill(l.fillOpacity),1)),e){let E=new Float32Array(v).fill(l.airHeight+l.deltaHeight);m.setAttribute("minZ",new He(E,1))}let S=new ne(l.fillColor).convertLinearToSRGB(),w=new Float32Array(v*3);for(let E=0;E<v;E++)w[E*3]=S.r,w[E*3+1]=S.g,w[E*3+2]=S.b;return m.setAttribute("color",new He(w,3)),m}),o=Rh(i);i.forEach(l=>l.dispose());let a={geometry:o};return o.dispose(),t&&(a.lineGeometry=UX(n)||void 0),a}function UX(r){let{points:t,colors:e,opacities:n}=Q1(r);if(!t.length)return null;let i=new qe().setFromPoints(t);return i.setAttribute("color",new He(new Float32Array(e),3)),i.setAttribute("opacity",new He(new Float32Array(n),1)),i}function Q1(r){let t=[],e=[],n=[];return r.filter(i=>i.strokeOpacity>0).map(i=>{let o=i.height+(i.deltaHeight||0)+i.airHeight,{coords:a}=i.geometry,{strokeColor:l,strokeOpacity:c}=i,f=new ne(l).convertLinearToSRGB();for(let g=0;g<a.length;g++){let m=a[g];for(let v=0;v<m.length;v++){let x=m[v],S=v+1===m.length?m[0]:m[v+1];t.push(new G(x[0],x[1],o)),t.push(new G(S[0],S[1],o)),e.push(f.r,f.g,f.b),e.push(f.r,f.g,f.b),n.push(c),n.push(c)}}}),{points:t,colors:e,opacities:n}}var Zre=H(ze(),1),Kre=H(n0(),1),$re=H(r0(),1),Jre=H(i0(),1),Qre=H(o0(),1),tie=H(s0(),1),eie=H(a0(),1),nie=H(u0(),1),rie=H(En(),1);var MJt=H(ze(),1),wJt=H(En(),1);var XZt=H(ze(),1);pe.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new ft(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};ao.line={uniforms:Uf.merge([pe.common,pe.fog,pe.line]),vertexShader:`
3826
+ `)};function n1(r,t,e){this.x=r,this.y=t,this.weight=e}n1.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};n1.prototype.getCost=function(r){return r&&r.x!==this.x&&r.y!==this.y?this.weight*1.41421:this.weight};n1.prototype.isWall=function(){return this.weight===0};function rH(r){this.content=[],this.scoreFunction=r}rH.prototype={push:function(r){this.content.push(r),this.sinkDown(this.content.length-1)},pop:function(){var r=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),r},remove:function(r){var t=this.content.indexOf(r),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(r)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(r){this.sinkDown(this.content.indexOf(r))},sinkDown:function(r){for(var t=this.content[r];r>0;){var e=(r+1>>1)-1,n=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(n))this.content[e]=t,this.content[r]=n,r=e;else break}},bubbleUp:function(r){for(var t=this.content.length,e=this.content[r],n=this.scoreFunction(e);;){var i=r+1<<1,o=i-1,a=null,l;if(o<t){var c=this.content[o];l=this.scoreFunction(c),l<n&&(a=o)}if(i<t){var f=this.content[i],g=this.scoreFunction(f);g<(a===null?n:l)&&(a=i)}if(a!==null)this.content[r]=this.content[a],this.content[a]=e,r=a;else break}}};function Kw(){this._=null}function zd(r){r.U=r.C=r.L=r.R=r.P=r.N=null}Kw.prototype={constructor:Kw,insert:function(r,t){var e,n,i;if(r){if(t.P=r,t.N=r.N,r.N&&(r.N.P=t),r.N=t,r.R){for(r=r.R;r.L;)r=r.L;r.L=t}else r.R=t;e=r}else this._?(r=iH(this._),t.P=null,t.N=r,r.P=r.L=t,e=r):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,r=t;e&&e.C;)n=e.U,e===n.L?(i=n.R,i&&i.C?(e.C=i.C=!1,n.C=!0,r=n):(r===e.R&&(fv(this,e),r=e,e=r.U),e.C=!1,n.C=!0,pv(this,n))):(i=n.L,i&&i.C?(e.C=i.C=!1,n.C=!0,r=n):(r===e.L&&(pv(this,e),r=e,e=r.U),e.C=!1,n.C=!0,fv(this,n))),e=r.U;this._.C=!1},remove:function(r){r.N&&(r.N.P=r.P),r.P&&(r.P.N=r.N),r.N=r.P=null;var t=r.U,e,n=r.L,i=r.R,o,a;if(n?i?o=iH(i):o=n:o=i,t?t.L===r?t.L=o:t.R=o:this._=o,n&&i?(a=o.C,o.C=r.C,o.L=n,n.U=o,o!==i?(t=o.U,o.U=r.U,r=o.R,t.L=r,o.R=i,i.U=o):(o.U=t,t=o,r=o.R)):(a=r.C,r=o),r&&(r.U=t),!a){if(r&&r.C){r.C=!1;return}do{if(r===this._)break;if(r===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,fv(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,pv(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,fv(this,t),r=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,pv(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,fv(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,pv(this,t),r=this._;break}e.C=!0,r=t,t=t.U}while(!r.C);r&&(r.C=!1)}}};function fv(r,t){var e=t,n=t.R,i=e.U;i?i.L===e?i.L=n:i.R=n:r._=n,n.U=i,e.U=n,e.R=n.L,e.R&&(e.R.U=e),n.L=e}function pv(r,t){var e=t,n=t.L,i=e.U;i?i.L===e?i.L=n:i.R=n:r._=n,n.U=i,e.U=n,e.L=n.R,e.L&&(e.L.U=e),n.R=e}function iH(r){for(;r.L;)r=r.L;return r}var $w=Kw;function Gd(r,t,e,n){var i=[null,null],o=qo.push(i)-1;return i.left=r,i.right=t,e&&dv(i,r,t,e),n&&dv(i,t,r,n),Vs[r.index].halfedges.push(o),Vs[t.index].halfedges.push(o),i}function kd(r,t,e){var n=[t,e];return n.left=r,n}function dv(r,t,e,n){!r[0]&&!r[1]?(r[0]=n,r.left=t,r.right=e):r.left===e?r[1]=n:r[0]=n}function amt(r,t,e,n,i){var o=r[0],a=r[1],l=o[0],c=o[1],f=a[0],g=a[1],m=0,v=1,x=f-l,S=g-c,w;if(w=t-l,!(!x&&w>0)){if(w/=x,x<0){if(w<m)return;w<v&&(v=w)}else if(x>0){if(w>v)return;w>m&&(m=w)}if(w=n-l,!(!x&&w<0)){if(w/=x,x<0){if(w>v)return;w>m&&(m=w)}else if(x>0){if(w<m)return;w<v&&(v=w)}if(w=e-c,!(!S&&w>0)){if(w/=S,S<0){if(w<m)return;w<v&&(v=w)}else if(S>0){if(w>v)return;w>m&&(m=w)}if(w=i-c,!(!S&&w<0)){if(w/=S,S<0){if(w>v)return;w>m&&(m=w)}else if(S>0){if(w<m)return;w<v&&(v=w)}return!(m>0)&&!(v<1)||(m>0&&(r[0]=[l+m*x,c+m*S]),v<1&&(r[1]=[l+v*x,c+v*S])),!0}}}}}function umt(r,t,e,n,i){var o=r[1];if(o)return!0;var a=r[0],l=r.left,c=r.right,f=l[0],g=l[1],m=c[0],v=c[1],x=(f+m)/2,S=(g+v)/2,w,E;if(v===g){if(x<t||x>=n)return;if(f>m){if(!a)a=[x,e];else if(a[1]>=i)return;o=[x,i]}else{if(!a)a=[x,i];else if(a[1]<e)return;o=[x,e]}}else if(w=(f-m)/(v-g),E=S-w*x,w<-1||w>1)if(f>m){if(!a)a=[(e-E)/w,e];else if(a[1]>=i)return;o=[(i-E)/w,i]}else{if(!a)a=[(i-E)/w,i];else if(a[1]<e)return;o=[(e-E)/w,e]}else if(g<v){if(!a)a=[t,w*t+E];else if(a[0]>=n)return;o=[n,w*n+E]}else{if(!a)a=[n,w*n+E];else if(a[0]<t)return;o=[t,w*t+E]}return r[0]=a,r[1]=o,!0}function oH(r,t,e,n){for(var i=qo.length,o;i--;)(!umt(o=qo[i],r,t,e,n)||!amt(o,r,t,e,n)||!(Math.abs(o[0][0]-o[1][0])>Yr||Math.abs(o[0][1]-o[1][1])>Yr))&&delete qo[i]}function sH(r){return Vs[r.index]={site:r,halfedges:[]}}function lmt(r,t){var e=r.site,n=t.left,i=t.right;return e===i&&(i=n,n=e),i?Math.atan2(i[1]-n[1],i[0]-n[0]):(e===n?(n=t[1],i=t[0]):(n=t[0],i=t[1]),Math.atan2(n[0]-i[0],i[1]-n[1]))}function Jw(r,t){return t[+(t.left!==r.site)]}function cmt(r,t){return t[+(t.left===r.site)]}function aH(){for(var r=0,t=Vs.length,e,n,i,o;r<t;++r)if((e=Vs[r])&&(o=(n=e.halfedges).length)){var a=new Array(o),l=new Array(o);for(i=0;i<o;++i)a[i]=i,l[i]=lmt(e,qo[n[i]]);for(a.sort(function(c,f){return l[f]-l[c]}),i=0;i<o;++i)l[i]=n[a[i]];for(i=0;i<o;++i)n[i]=l[i]}}function uH(r,t,e,n){var i=Vs.length,o,a,l,c,f,g,m,v,x,S,w,E,b=!0;for(o=0;o<i;++o)if(a=Vs[o]){for(l=a.site,f=a.halfedges,c=f.length;c--;)qo[f[c]]||f.splice(c,1);for(c=0,g=f.length;c<g;)S=cmt(a,qo[f[c]]),w=S[0],E=S[1],m=Jw(a,qo[f[++c%g]]),v=m[0],x=m[1],(Math.abs(w-v)>Yr||Math.abs(E-x)>Yr)&&(f.splice(c,0,qo.push(kd(l,S,Math.abs(w-r)<Yr&&n-E>Yr?[r,Math.abs(v-r)<Yr?x:n]:Math.abs(E-n)<Yr&&e-w>Yr?[Math.abs(x-n)<Yr?v:e,n]:Math.abs(w-e)<Yr&&E-t>Yr?[e,Math.abs(v-e)<Yr?x:t]:Math.abs(E-t)<Yr&&w-r>Yr?[Math.abs(x-t)<Yr?v:r,t]:null))-1),++g);g&&(b=!1)}if(b){var C,A,P,F=1/0;for(o=0,b=null;o<i;++o)(a=Vs[o])&&(l=a.site,C=l[0]-r,A=l[1]-t,P=C*C+A*A,P<F&&(F=P,b=a));if(b){var U=[r,t],D=[r,n],L=[e,n],tt=[e,t];b.halfedges.push(qo.push(kd(l=b.site,U,D))-1,qo.push(kd(l,D,L))-1,qo.push(kd(l,L,tt))-1,qo.push(kd(l,tt,U))-1)}}for(o=0;o<i;++o)(a=Vs[o])&&(a.halfedges.length||delete Vs[o])}var lH=[],r1;function hmt(){zd(this),this.x=this.y=this.arc=this.site=this.cy=null}function kf(r){var t=r.P,e=r.N;if(!(!t||!e)){var n=t.site,i=r.site,o=e.site;if(n!==o){var a=i[0],l=i[1],c=n[0]-a,f=n[1]-l,g=o[0]-a,m=o[1]-l,v=2*(c*m-f*g);if(!(v>=-cH)){var x=c*c+f*f,S=g*g+m*m,w=(m*x-f*S)/v,E=(c*S-g*x)/v,b=lH.pop()||new hmt;b.arc=r,b.site=i,b.x=w+a,b.y=(b.cy=E+l)+Math.sqrt(w*w+E*E),r.circle=b;for(var C=null,A=Vd._;A;)if(b.y<A.y||b.y===A.y&&b.x<=A.x)if(A.L)A=A.L;else{C=A.P;break}else if(A.R)A=A.R;else{C=A;break}Vd.insert(C,b),C||(r1=b)}}}}function Vf(r){var t=r.circle;t&&(t.P||(r1=t.N),Vd.remove(t),lH.push(t),zd(t),r.circle=null)}var fH=[];function fmt(){zd(this),this.edge=this.site=this.circle=null}function hH(r){var t=fH.pop()||new fmt;return t.site=r,t}function Qw(r){Vf(r),Hf.remove(r),fH.push(r),zd(r)}function pH(r){var t=r.circle,e=t.x,n=t.cy,i=[e,n],o=r.P,a=r.N,l=[r];Qw(r);for(var c=o;c.circle&&Math.abs(e-c.circle.x)<Yr&&Math.abs(n-c.circle.cy)<Yr;)o=c.P,l.unshift(c),Qw(c),c=o;l.unshift(c),Vf(c);for(var f=a;f.circle&&Math.abs(e-f.circle.x)<Yr&&Math.abs(n-f.circle.cy)<Yr;)a=f.N,l.push(f),Qw(f),f=a;l.push(f),Vf(f);var g=l.length,m;for(m=1;m<g;++m)f=l[m],c=l[m-1],dv(f.edge,c.site,f.site,i);c=l[0],f=l[g-1],f.edge=Gd(c.site,f.site,null,i),kf(c),kf(f)}function dH(r){for(var t=r[0],e=r[1],n,i,o,a,l=Hf._;l;)if(o=gH(l,e)-t,o>Yr)l=l.L;else if(a=t-pmt(l,e),a>Yr){if(!l.R){n=l;break}l=l.R}else{o>-Yr?(n=l.P,i=l):a>-Yr?(n=l,i=l.N):n=i=l;break}sH(r);var c=hH(r);if(Hf.insert(n,c),!(!n&&!i)){if(n===i){Vf(n),i=hH(n.site),Hf.insert(c,i),c.edge=i.edge=Gd(n.site,c.site),kf(n),kf(i);return}if(!i){c.edge=Gd(n.site,c.site);return}Vf(n),Vf(i);var f=n.site,g=f[0],m=f[1],v=r[0]-g,x=r[1]-m,S=i.site,w=S[0]-g,E=S[1]-m,b=2*(v*E-x*w),C=v*v+x*x,A=w*w+E*E,P=[(E*C-x*A)/b+g,(v*A-w*C)/b+m];dv(i.edge,f,S,P),c.edge=Gd(f,r,null,P),i.edge=Gd(r,S,null,P),kf(n),kf(i)}}function gH(r,t){var e=r.site,n=e[0],i=e[1],o=i-t;if(!o)return n;var a=r.P;if(!a)return-1/0;e=a.site;var l=e[0],c=e[1],f=c-t;if(!f)return l;var g=l-n,m=1/o-1/f,v=g/f;return m?(-v+Math.sqrt(v*v-2*m*(g*g/(-2*f)-c+f/2+i-o/2)))/m+n:(n+l)/2}function pmt(r,t){var e=r.N;if(e)return gH(e,t);var n=r.site;return n[1]===t?n[0]:1/0}var Yr=1e-6,cH=1e-12,Hf,Vs,Vd,qo;function dmt(r,t,e){return(r[0]-e[0])*(t[1]-r[1])-(r[0]-t[0])*(e[1]-r[1])}function gmt(r,t){return t[1]-r[1]||t[0]-r[0]}function i1(r,t){var e=r.sort(gmt).pop(),n,i,o;for(qo=[],Vs=new Array(r.length),Hf=new $w,Vd=new $w;;)if(o=r1,e&&(!o||e[1]<o.y||e[1]===o.y&&e[0]<o.x))(e[0]!==n||e[1]!==i)&&(dH(e),n=e[0],i=e[1]),e=r.pop();else if(o)pH(o.arc);else break;if(aH(),t){var a=+t[0][0],l=+t[0][1],c=+t[1][0],f=+t[1][1];oH(a,l,c,f),uH(a,l,c,f)}this.edges=qo,this.cells=Vs,Hf=Vd=qo=Vs=null}i1.prototype={constructor:i1,polygons:function(){var r=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(n){return Jw(t,r[n])});return e.data=t.site.data,e})},triangles:function(){var r=[],t=this.edges;return this.cells.forEach(function(e,n){if(l=(o=e.halfedges).length)for(var i=e.site,o,a=-1,l,c,f=t[o[l-1]],g=f.left===i?f.right:f.left;++a<l;)c=g,f=t[o[a]],g=f.left===i?f.right:f.left,c&&g&&n<c.index&&n<g.index&&dmt(i,c,g)<0&&r.push([i.data,c.data,g.data])}),r},links:function(){return this.edges.filter(function(r){return r.right}).map(function(r){return{source:r.left.data,target:r.right.data}})},find:function(r,t,e){for(var n=this,i,o=n._found||0,a=n.cells.length,l;!(l=n.cells[o]);)if(++o>=a)return null;var c=r-l.site[0],f=t-l.site[1],g=c*c+f*f;do l=n.cells[i=o],o=null,l.halfedges.forEach(function(m){var v=n.edges[m],x=v.left;if(!((x===l.site||!x)&&!(x=v.right))){var S=r-x[0],w=t-x[1],E=S*S+w*w;E<g&&(g=E,o=x.index)}});while(o!==null);return n._found=i,e==null||g<=e*e?l.site:null}};var bmt=H(Hd(),1);var dT=H(yH(),1);function va(){return new a1}function a1(){this.reset()}a1.prototype={constructor:a1,reset:function(){this.s=this.t=0},add:function(r){xH(s1,r,this.t),xH(this,s1.s,this.s),this.s?this.t+=s1.t:this.s=s1.t},valueOf:function(){return this.s}};var s1=new a1;function xH(r,t,e){var n=r.s=t+e,i=n-t,o=n-i;r.t=t-o+(e-i)}var Mr=1e-6;var Wr=Math.PI,bo=Wr/2,u1=Wr/4,Y0=Wr*2,Wf=180/Wr,_a=Wr/180,Ni=Math.abs,c0=Math.atan,ya=Math.atan2,cr=Math.cos;var l1=Math.exp;var gv=Math.log;var bn=Math.sin;var os=Math.sqrt,mv=Math.tan;function nT(r){return r>1?0:r<-1?Wr:Math.acos(r)}function Hs(r){return r>1?bo:r<-1?-bo:Math.asin(r)}function h0(){}var Mmt=va(),Tzt=va();function qf(r){var t=r[0],e=r[1],n=cr(e);return[n*cr(t),n*bn(t),bn(e)]}function vv(r,t){return[r[1]*t[2]-r[2]*t[1],r[2]*t[0]-r[0]*t[2],r[0]*t[1]-r[1]*t[0]]}function _v(r){var t=os(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}var Uzt=va();function SH(r,t){return[r>Wr?r-Y0:r<-Wr?r+Y0:r,t]}SH.invert=SH;function rT(){var r=[],t;return{point:function(e,n){t.push([e,n])},lineStart:function(){r.push(t=[])},lineEnd:h0,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function iT(r,t){return Ni(r[0]-t[0])<Mr&&Ni(r[1]-t[1])<Mr}function c1(r,t,e,n){this.x=r,this.z=t,this.o=e,this.e=n,this.v=!1,this.n=this.p=null}function oT(r,t,e,n,i){var o=[],a=[],l,c;if(r.forEach(function(S){if(!((w=S.length-1)<=0)){var w,E=S[0],b=S[w],C;if(iT(E,b)){for(i.lineStart(),l=0;l<w;++l)i.point((E=S[l])[0],E[1]);i.lineEnd();return}o.push(C=new c1(E,S,null,!0)),a.push(C.o=new c1(E,null,C,!1)),o.push(C=new c1(b,S,null,!1)),a.push(C.o=new c1(b,null,C,!0))}}),!!o.length){for(a.sort(t),bH(o),bH(a),l=0,c=a.length;l<c;++l)a[l].e=e=!e;for(var f=o[0],g,m;;){for(var v=f,x=!0;v.v;)if((v=v.n)===f)return;g=v.z,i.lineStart();do{if(v.v=v.o.v=!0,v.e){if(x)for(l=0,c=g.length;l<c;++l)i.point((m=g[l])[0],m[1]);else n(v.x,v.n.x,1,i);v=v.n}else{if(x)for(g=v.p.z,l=g.length-1;l>=0;--l)i.point((m=g[l])[0],m[1]);else n(v.x,v.p.x,-1,i);v=v.p}v=v.o,g=v.z,x=!x}while(!v.v);i.lineEnd()}}}function bH(r){if(t=r.length){for(var t,e=0,n=r[0],i;++e<t;)n.n=i=r[e],i.p=n,n=i;n.n=i=r[0],i.p=n}}function mh(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function sT(r){return r.length===1&&(r=Amt(r)),{left:function(t,e,n,i){for(n==null&&(n=0),i==null&&(i=t.length);n<i;){var o=n+i>>>1;r(t[o],e)<0?n=o+1:i=o}return n},right:function(t,e,n,i){for(n==null&&(n=0),i==null&&(i=t.length);n<i;){var o=n+i>>>1;r(t[o],e)>0?i=o:n=o+1}return n}}}function Amt(r){return function(t,e){return mh(r(t),e)}}var MH=sT(mh),Cmt=MH.right,Rmt=MH.left;var wH=Array.prototype,Imt=wH.slice,Lmt=wH.map;var CGt=Math.sqrt(50),RGt=Math.sqrt(10),PGt=Math.sqrt(2);function f1(r){for(var t=r.length,e,n=-1,i=0,o,a;++n<t;)i+=r[n].length;for(o=new Array(i);--t>=0;)for(a=r[t],e=a.length;--e>=0;)o[--i]=a[e];return o}var Gmt=1e9,pVt=-Gmt;var aT=va();function uT(r,t){var e=t[0],n=t[1],i=[bn(e),-cr(e),0],o=0,a=0;aT.reset();for(var l=0,c=r.length;l<c;++l)if(g=(f=r[l]).length)for(var f,g,m=f[g-1],v=m[0],x=m[1]/2+u1,S=bn(x),w=cr(x),E=0;E<g;++E,v=C,S=P,w=F,m=b){var b=f[E],C=b[0],A=b[1]/2+u1,P=bn(A),F=cr(A),U=C-v,D=U>=0?1:-1,L=D*U,tt=L>Wr,O=S*P;if(aT.add(ya(O*D*bn(L),w*F+O*cr(L))),o+=tt?U+D*Y0:U,tt^v>=e^C>=e){var V=vv(qf(m),qf(b));_v(V);var W=vv(i,V);_v(W);var St=(tt^U>=0?-1:1)*Hs(W[2]);(n>St||n===St&&(V[0]||V[1]))&&(a+=tt^U>=0?1:-1)}}return(o<-Mr||o<Mr&&aT<-Mr)^a&1}var bVt=va();var VVt=va(),HVt=va();var Hmt=1/0;var XVt=-Hmt;function lT(r){this._context=r}lT.prototype={_radius:4.5,pointRadius:function(r){return this._radius=r,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._context.moveTo(r,t),this._point=1;break}case 1:{this._context.lineTo(r,t);break}default:{this._context.moveTo(r+this._radius,t),this._context.arc(r,t,this._radius,0,Y0);break}}},result:h0};var nHt=va();function cT(){this._string=[]}cT.prototype={_radius:4.5,_circle:CH(4.5),pointRadius:function(r){return(r=+r)!==this._radius&&(this._radius=r,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._string.push("M",r,",",t),this._point=1;break}case 1:{this._string.push("L",r,",",t);break}default:{this._circle==null&&(this._circle=CH(this._radius)),this._string.push("M",r,",",t,this._circle);break}}},result:function(){if(this._string.length){var r=this._string.join("");return this._string=[],r}else return null}};function CH(r){return"m0,"+r+"a"+r+","+r+" 0 1,1 0,"+-2*r+"a"+r+","+r+" 0 1,1 0,"+2*r+"z"}function hT(r,t,e,n){return function(i,o){var a=t(o),l=i.invert(n[0],n[1]),c=rT(),f=t(c),g=!1,m,v,x,S={point:w,lineStart:b,lineEnd:C,polygonStart:function(){S.point=A,S.lineStart=P,S.lineEnd=F,v=[],m=[]},polygonEnd:function(){S.point=w,S.lineStart=b,S.lineEnd=C,v=f1(v);var U=uT(m,l);v.length?(g||(o.polygonStart(),g=!0),oT(v,Xmt,U,e,o)):U&&(g||(o.polygonStart(),g=!0),o.lineStart(),e(null,null,1,o),o.lineEnd()),g&&(o.polygonEnd(),g=!1),v=m=null},sphere:function(){o.polygonStart(),o.lineStart(),e(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function w(U,D){var L=i(U,D);r(U=L[0],D=L[1])&&o.point(U,D)}function E(U,D){var L=i(U,D);a.point(L[0],L[1])}function b(){S.point=E,a.lineStart()}function C(){S.point=w,a.lineEnd()}function A(U,D){x.push([U,D]);var L=i(U,D);f.point(L[0],L[1])}function P(){f.lineStart(),x=[]}function F(){A(x[0][0],x[0][1]),f.lineEnd();var U=f.clean(),D=c.result(),L,tt=D.length,O,V,W;if(x.pop(),m.push(x),x=null,!!tt){if(U&1){if(V=D[0],(O=V.length-1)>0){for(g||(o.polygonStart(),g=!0),o.lineStart(),L=0;L<O;++L)o.point((W=V[L])[0],W[1]);o.lineEnd()}return}tt>1&&U&2&&D.push(D.pop().concat(D.shift())),v.push(D.filter(qmt))}}return S}}function qmt(r){return r.length>1}function Xmt(r,t){return((r=r.x)[0]<0?r[1]-bo-Mr:bo-r[1])-((t=t.x)[0]<0?t[1]-bo-Mr:bo-t[1])}var jmt=hT(function(){return!0},Ymt,Kmt,[-Wr,-bo]);function Ymt(r){var t=NaN,e=NaN,n=NaN,i;return{lineStart:function(){r.lineStart(),i=1},point:function(o,a){var l=o>0?Wr:-Wr,c=Ni(o-t);Ni(c-Wr)<Mr?(r.point(t,e=(e+a)/2>0?bo:-bo),r.point(n,e),r.lineEnd(),r.lineStart(),r.point(l,e),r.point(o,e),i=0):n!==l&&c>=Wr&&(Ni(t-n)<Mr&&(t-=n*Mr),Ni(o-l)<Mr&&(o-=l*Mr),e=Zmt(t,e,o,a),r.point(n,e),r.lineEnd(),r.lineStart(),r.point(l,e),i=0),r.point(t=o,e=a),n=l},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-i}}}function Zmt(r,t,e,n){var i,o,a=bn(r-e);return Ni(a)>Mr?c0((bn(t)*(o=cr(n))*bn(e)-bn(n)*(i=cr(t))*bn(r))/(i*o*a)):(t+n)/2}function Kmt(r,t,e,n){var i;if(r==null)i=e*bo,n.point(-Wr,i),n.point(0,i),n.point(Wr,i),n.point(Wr,0),n.point(Wr,-i),n.point(0,-i),n.point(-Wr,-i),n.point(-Wr,0),n.point(-Wr,i);else if(Ni(r[0]-t[0])>Mr){var o=r[0]<t[0]?Wr:-Wr;i=e*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(t[0],t[1])}function p1(r){return function(t){var e=new fT;for(var n in r)e[n]=r[n];return e.stream=t,e}}function fT(){}fT.prototype={constructor:fT,point:function(r,t){this.stream.point(r,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var HHt=cr(30*_a);var r4t=p1({point:function(r,t){this.stream.point(r*_a,t*_a)}});function d1(r){return function(t,e){var n=cr(t),i=cr(e),o=r(n*i);return[o*i*bn(t),o*bn(e)]}}function Z0(r){return function(t,e){var n=os(t*t+e*e),i=r(n),o=bn(i),a=cr(i);return[ya(t*o,n*a),Hs(n&&e*o/n)]}}var DH=d1(function(r){return os(2/(1+r))});DH.invert=Z0(function(r){return 2*Hs(r/2)});var UH=d1(function(r){return(r=nT(r))&&r/bn(r)});UH.invert=Z0(function(r){return r});function pT(r,t){return[r,gv(mv((bo+t)/2))]}pT.invert=function(r,t){return[r,2*c0(l1(t))-bo]};function g1(r,t){return[r,t]}g1.invert=g1;function FH(r,t){var e=cr(t),n=cr(r)*e;return[e*bn(r)/n,bn(t)/n]}FH.invert=Z0(c0);function BH(r,t){var e=t*t,n=e*e;return[r*(.8707-.131979*e+n*(-.013791+n*(.003971*e-.001529*n))),t*(1.007226+e*(.015085+n*(-.044475+.028874*e-.005916*n)))]}BH.invert=function(r,t){var e=t,n=25,i;do{var o=e*e,a=o*o;e-=i=(e*(1.007226+o*(.015085+a*(-.044475+.028874*o-.005916*a)))-t)/(1.007226+o*(.015085*3+a*(-.044475*7+.028874*9*o-.005916*11*a)))}while(Ni(i)>Mr&&--n>0);return[r/(.8707+(o=e*e)*(-.131979+o*(-.013791+o*o*o*(.003971-.001529*o)))),e]};function zH(r,t){return[cr(t)*bn(r),bn(t)]}zH.invert=Z0(Hs);function GH(r,t){var e=cr(t),n=1+cr(r)*e;return[e*bn(r)/n,bn(t)/n]}GH.invert=Z0(function(r){return 2*c0(r)});function kH(r,t){return[gv(mv((bo+t)/2)),-r]}kH.invert=function(r,t){return[-t,2*c0(l1(r))-bo]};var nvt=H(Hd(),1);var VH=H(Hd(),1);function qd(r,t,e){e===void 0&&(e={});var n=xo(r),i=xo(t),o=VH.default.intersection(n.coordinates,i.coordinates);return o.length===0?null:o.length===1?br(o[0],e.properties):W0(o,e.properties)}var ivt=H(Hd(),1);var ovt=H(Hd(),1);function sn(r,t,e,n){let i=r.clone().project(t),o=e/2,a=n/2,l=Math.round(i.x*o+o),c=Math.round(-i.y*a+a);return{x:l,y:c}}function dvt(r,t,e,n,i){if(!i)return null;e=Math.min(1,e),n=Math.min(1,n);let o=r/e*2-1,a=1-t/n*2;return new G(o,a,0).unproject(i)}function yv(r){let t=lr(r.map(n=>Rr(n)));return fh(t).geometry.coordinates}function Yl(r,t,e){return r.x>=t.x&&r.x<=e.x&&r.y>=t.y&&r.y<=e.y}function gvt(r){let t=0,e=new G;for(let n=1;n<r.length;n++){let i=new G(r[n-1][0],r[n-1][1],0),o=new G(r[n][0],r[n][1],0),a=o.distanceTo(i);a>t&&(t=a,e=o.clone().sub(i).normalize())}return e}function zr(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}function Ws(r){let t=0;for(let e=0;e<r.length-1;e++)t+=zr(r[e],r[e+1]);return t}function xv(r,t,e){let n=new ft(t[0]-r[0],t[1]-r[1]),i=new ft(t[0]-e[0],t[1]-e[1]),a=n.angleTo(i)*180/Math.PI,l=new ft(t[0]-r[0],t[1]-r[1]);return new ft(e[0]-r[0],e[1]-r[1]).cross(l)>0?a:-a}function mvt(r,t){let e=Math.min(zr(r[0][0],r[0][1]),zr(r[0][2],r[0][1]))-1;t||(t=yv(r[0]));let n=vvt(t,e),i=new ft(r[0][0][0],r[0][0][1]),o=new ft(r[0][1][0],r[0][1][1]),a=new ft(r[0][2][0],r[0][2][1]),c=(i.distanceTo(o)>o.distanceTo(a)?o.clone().sub(i):a.clone().sub(o)).angleTo(new ft(0,1)),f=new Je;return f.multiply(new Je().translate(t[0],t[1])).multiply(new Je().rotate(c)).multiply(new Je().translate(-t[0],-t[1])),[n.map(g=>{let m=new ft(g[0],g[1]).applyMatrix3(f);return[m.x,m.y]})]}function vvt(r,t){let e=t/2;return[[r[0]-e,r[1]+e],[r[0]+e,r[1]+e],[r[0]+e,r[1]-e],[r[0]-e,r[1]-e],[r[0]-e,r[1]+e]]}function K0(r,t){let e=0,n=1/0,[i,o]=t;for(let a=0;a<r.length-1;a++){let[l,c]=r[a],[f,g]=r[a+1],m=Math.min(l,f)<=i&&i<=Math.max(l,f),v=Math.min(c,g)<=o&&o<=Math.max(c,g);if(m&&v){let x=Math.abs((f-l)*(o-c)-(g-c)*(i-l));x<n&&(n=x,e=a)}}return e}function gT(r,t){let e=r[0],n=r[1],i=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){let l=t[o][0],c=t[o][1],f=t[a][0],g=t[a][1];c>n!=g>n&&e<(f-l)*(n-c)/(g-c)+l&&(i=!i)}return i}var cYt=H(HH(),1);function Xf(r,t){return new Proxy(r,{get:(e,n,i)=>Reflect.get(e,n,i),set:(e,n,i,o)=>{let a=Reflect.get(e,n,o),l=Reflect.set(e,n,i,o);return a!==i&&t.dispatchEvent({type:"change-"+n,value:i}),l}})}var SYt=H(ze(),1),bYt=H(_T(),1);function Ya(r,t){return Promise.race([r,new Promise((e,n)=>{setTimeout(()=>n(new Error("Promise timeout")),t)})])}function Ev(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function yT(r,t){let e=Ev("svg");return e.setAttribute("width",r),e.setAttribute("height",t),e.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",e}function Xd(r,t){r===void 0&&(r="2");let e=Ev("circle");return e.setAttribute("r",r),e.setAttribute("fill",t),e}function Sv(r){let t=Ev("line");return t.setAttribute("stroke",r),t}function Zl(r,t){let e=Ev("rect");return e.setAttribute("stroke",r),e.setAttribute("fill",t),e}function _h(r,t,e){r.setAttribute("cx",""+t),r.setAttribute("cy",""+e)}function wu(r,t,e){t&&(r.setAttribute("x1",""+t.x),r.setAttribute("y1",""+t.y)),e&&(r.setAttribute("x2",""+e.x),r.setAttribute("y2",""+e.y))}function bs(r,t,e,n,i){r.setAttribute("x",""+t),r.setAttribute("y",""+e),r.setAttribute("width",""+n),r.setAttribute("height",""+i)}function xT(){return Promise.resolve()}function _1(){return new Promise(r=>{requestAnimationFrame(r)})}function ET(r){return r===void 0&&(r=1),new Promise(t=>{function e(){r<=0?t(!0):(r--,window.requestAnimationFrame(e))}window.requestAnimationFrame(e)})}var zYt=H(bv(),1),GYt=H(Xa(),1),kYt=H(E1(),1);function z_t(r){return parseInt(r.replace("#","0x"),16)}function G_t(r,t){let e=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16),o=Math.round(e*t),a=Math.round(n*t),l=Math.round(i*t);return"#"+(1<<24|o<<16|a<<8|l).toString(16).slice(1)}function J0(r,t){t===void 0&&(t=.85);let e,n,i;if(r.startsWith("#"))e=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16);else{let a=r.slice(4,-1).split(",");e=parseInt(a[0].trim()),n=parseInt(a[1].trim()),i=parseInt(a[2].trim())}return e=Math.min(Math.floor(e*t),255),n=Math.min(Math.floor(n*t),255),i=Math.min(Math.floor(i*t),255),"#"+((1<<24)+(e<<16)+(n<<8)+i).toString(16).slice(1)}function S1(r,t){r=r.replace(/^#/,"");let e=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return t!==void 0?"rgba("+e+", "+n+", "+i+", "+t+")":"rgb("+e+", "+n+", "+i+")"}var HYt=H(Xa(),1),Yf=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,LT=(navigator.userAgent||"").toLocaleLowerCase(),yh=/ios|iphone/i.test(LT),k_t=/android|adr|linux/gi.test(LT);function Zf(r){return Yf?r==="Meta":r==="Control"}var jYt=H(n0(),1),YYt=H(r0(),1),ZYt=H(i0(),1),KYt=H(o0(),1),$Yt=H(s0(),1),JYt=H(a0(),1),QYt=H(u0(),1),t8t=H(ze(),1),NT="__once__",OT=class{on(t,e){if(typeof e!="function")return;let n=this.events.get(t);return n?n.add(e):this.events.set(t,new Set([e]))}once(t,e){if(typeof e!="function")return;let n=""+NT+t,i=this.events.get(n);return i?i.add(e):this.events.set(n,new Set([e]))}off(t,e){let n=this.events.get(t),i=this.events.get(""+NT+t);!n&&!i||(e===void 0&&(n==null||n.clear(),i==null||i.clear()),n!=null&&n.has(e)&&n.delete(e),i!=null&&i.has(e)&&i.delete(e))}offAll(){this.events.clear()}emit(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];let o=this.events.get(t),a=this.events.get(""+NT+t);!o&&!a||(o==null||o.forEach(l=>{typeof l=="function"&&l(...n)}),a==null||a.forEach(l=>{typeof l=="function"&&l(...n)}),a==null||a.clear())}constructor(){this.events=new Map}};var ss=function(r){return r.SWITCH_FLOOR_BEFORE="switch_floor_before",r.SWITCH_FLOOR_GROUND="switch_floor_ground",r.SWITCH_FLOOR_AFTER="switch_floor_after",r}({});var h8t=H(Kf(),1);function $f(r){return Object.keys(r).sort().map(t=>t+"="+r[t]).join("&")}function ayt(r,t){return new Promise((e,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),Object.keys(t.headers||{}).forEach(o=>{i.setRequestHeader(o,t.headers[o])}),t.responseType&&(i.responseType=t.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(t.responseType==="arraybuffer")e(i.response);else try{let o=JSON.parse(i.responseText);e(o)}catch(o){n(o)}else n(i.statusText)},i.onerror=()=>{n(i.statusText)},i.send()})}var m8t=H(ze(),1),v8t=H(En(),1);var mW=H(gW(),1);function vW(r,t){let e=r.clone().normalize(),n=t.clone().normalize();return Math.acos(e.dot(n))}function uyt(r){let t=0;return r.reduce((e,n)=>{let[i,o]=e,[a,l]=n;return t+=Math.sqrt((a-i)**2+(l-o)**2),[a,l]}),t/r.length}function kT(r,t){if(t===void 0&&(t=.25),uyt(r)<t)return r;let e=(0,mW.default)(r);return kT(e,t)}function Mv(r,t,e,n,i,o){t===void 0&&(t=!1),e===void 0&&(e=!0),n===void 0&&(n=5),i===void 0&&(i=150),o===void 0&&(o=3);let a=[],l=!t;if(a.push(r[0]),r.length<2)return a;for(let f=0;f<r.length-2;f+=1){let g=r[f],m=r[f+1],v=r[f+2],x=new ft(g[0]-m[0],g[1]-m[1]),S=new ft(v[0]-m[0],v[1]-m[1]),w=vW(x,S)/Math.PI*180,E=x.length()+S.length();(!l||w<i&&E>.01||E>n)&&(a.push(r[f+1]),l=!0)}if(a.push(r[r.length-1]),!e)return a;let c=[];c.push(a[0]);for(let f=0;f<a.length-2;f+=1){let g=new ft(a[f][0],a[f][1]),m=new ft(a[f+1][0],a[f+1][1]),v=new ft(a[f+2][0],a[f+2][1]),x=g.distanceTo(m)/2,S=v.distanceTo(m)/2,w=m.clone(),E=m.clone();w.add(g.clone().sub(m).normalize().multiplyScalar(x>o?o/2:x)),E.add(v.clone().sub(m).normalize().multiplyScalar(S>o?o/2:S));let b=[[w.x,w.y],[m.x,m.y],[E.x,E.y]];c.push(...kT(b,o/25))}return c.push(a[a.length-1]),_W(c)}function _W(r){if(r.length<=1)return r;let t=[],e;return r.forEach(n=>{let[i,o]=n;e?i===e[0]&&o===e[1]||(e=[i,o],t.push([i,o])):(e=[i,o],t.push([i,o]))}),t}function VT(r,t,e){let n=Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2);if(n===0)return{distance:Math.sqrt((r[0]-t[0])**2+(r[1]-t[1])**2),closestPoint:t.slice(0)};let i=Math.max(0,Math.min(1,((r[0]-t[0])*(e[0]-t[0])+(r[1]-t[1])*(e[1]-t[1]))/n**2)),o=[t[0]+i*(e[0]-t[0]),t[1]+i*(e[1]-t[1])];return{distance:Math.sqrt((r[0]-o[0])**2+(r[1]-o[1])**2),closestPoint:o}}function lyt(r,t,e){let[n,i]=r,[o,a]=t,l=Math.sqrt(Math.pow(o-n,2)+Math.pow(a-i,2));if(l===0||l<e)return[...t];let c=e/l,f=n+(o-n)*c,g=i+(a-i)*c;return[f,g]}var Q0=function(r){return r.START="start",r.END="end",r.FRONT="front",r.RIGHT="right",r.LEFT="left",r.RIGHT_FRONT="right_front",r.LEFT_FRONT="left_front",r.RIGHT_BACK="right_back",r.LEFT_BACK="left_back",r}({});function M1(r,t,e){let n=xv(r,t,e);return w1(n)}function w1(r){return 180-Math.abs(r)<15?"front":r>135?"right_front":r<-135?"left_front":r<=135&&r>=60?"right":r>=-135&&r<=-60?"left":r<60&&r>0?"right_back":r>-60&&r<0?"left_back":"front"}function cyt(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let t=[{direction:"start",distance:zr(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let n=M1(r[e-2],r[e-1],r[e]);if(n==="front"){let i=t[t.length-1],o=zr(r[e-1],r[e]);i.distance+=o,e!==2&&i.points.push(r[e-1])}else t.push({direction:n,distance:zr(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}function HT(r,t){if(r.length<2)return-1;let e=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=[t[0]-i[0],t[1]-i[1]],l=[o[0]-i[0],o[1]-i[1]],c=Math.min(o[0],i[0])<=t[0]&&t[0]<=Math.max(o[0],i[0]),f=Math.min(o[1],i[1])<=t[1]&&t[1]<=Math.max(o[1],i[1]);if(c&&f){let g=a[0]*l[1]-a[1]*l[0];if(Math.abs(g)<1e-6){let m=Math.sqrt((t[0]-i[0])**2+(t[1]-i[1])**2);return e+m}}e+=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2)}return-1}function Jf(r,t){if(r.length<2){var e;return(e=r[0])!=null?e:null}let n=0;for(let i=1;i<r.length;i++){let o=r[i-1],a=r[i],l=Math.sqrt((a[0]-o[0])**2+(a[1]-o[1])**2);if(n+=l,n>=t){let c=(t-(n-l))/l,f=o[0]+(a[0]-o[0])*c,g=o[1]+(a[1]-o[1])*c;return[f,g]}}return null}var A8t=H(En(),1),C8t=H(ze(),1),R8t=H(Xa(),1),tl=H(XT(),1);var Tu="___",jT=class{initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(n=>{let i=""+e.floor+Tu+n.id;if(this.pointMap.set(i,n),this.nodeMap.set(""+n.floor+Tu+n.nodeId,i),n.type==="straightLadder"){let o=this.straightLadderMap.get(n.name)||[];o.push(ee({},n)),this.straightLadderMap.set(n.name,o)}if(n.type==="staircase"){let o=this.staircaseMap.get(n.name)||[];o.push(ee({},n)),this.staircaseMap.set(n.name,o)}if(n.type==="escalator"){let o=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?o.end={floor:n.floor,id:n.id}:o.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,o)}if(n.type==="facility"){let o=this.facilityMap.get(n.targetId)||[];o.push(ee({},n)),this.facilityMap.set(n.targetId,o)}}),e.lines.filter(n=>n.direction!=="no").forEach(n=>{var i,o;let a=""+e.floor+Tu+n.from,l=""+e.floor+Tu+n.to,c=(i=this.pointMap.get(a))==null?void 0:i.cds,f=(o=this.pointMap.get(l))==null?void 0:o.cds;if(c!=null&&c.length&&(f!=null&&f.length)){let g=zr(c,f);this.addLineItem(a,l,g),n.direction==="double"&&this.addLineItem(l,a,g)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(t,e,n,i){i===void 0&&(i=this.lineMap);let o=i.get(t)||new Map;o.set(e,n),i.set(t,o)}addFacilityToLineMap(t,e,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(o=>{let[a,l]=o;if(!(l.length<2))for(let g=0;g<l.length;g++){let m=""+l[g].floor+Tu+l[g].id;for(let v=0;v<l.length;v++)if(g!==v){var c,f;let x=""+l[v].floor+Tu+l[v].id,S=(c=this.pointMap.get(m))==null?void 0:c.cds,w=(f=this.pointMap.get(x))==null?void 0:f.cds;if(S!=null&&S.length&&(w!=null&&w.length))if(l[g].type==="straightLadder"){let E=e;this.addLineItem(m,x,E,i)}else{let E=n;this.addLineItem(m,x,E,i)}}}}),this.escalatorMap.forEach((o,a)=>{if(o.start&&o.end){var l,c;let f=""+o.start.floor+Tu+o.start.id,g=""+o.end.floor+Tu+o.end.id,m=(l=this.pointMap.get(f))==null?void 0:l.cds,v=(c=this.pointMap.get(g))==null?void 0:c.cds;if(m!=null&&m.length&&(v!=null&&v.length)){let x=t;this.addLineItem(f,g,x,i)}}})}initBaseRoute(){let t=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,t),this.baseRoute=new tl.default(t)}initEscalatorRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new tl.default(t)}initStraightLadderRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new tl.default(t)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility?!0:this.checkStart(t)}transformStart(t){var e;if(t.nodeId){let n=this.nodeMap.get(""+t.floor+Tu+t.nodeId);if(n){let[i,o]=n.split(Tu);return{floor:i,id:o}}}if((e=t.coord)!=null&&e.length){let n=this.roadInfo.find(o=>o.floor===t.floor);if(!n)return null;let i=n.points.reduce((o,a)=>{let l=zr(t.coord,a.cds);return l<o.min&&(o.min=l,o.point=a),o},{min:1/0,point:n.points[0]});return{floor:i.point.floor,id:i.point.id}}return null}transformEnd(t){if(t.floor){let e=this.transformStart(t);if(e)return e}if(t.facility){let e=this.facilityMap.get(t.facility);if(e!=null&&e.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,n){if(n===void 0&&(n=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let i=this.transformStart(t);if(!i)return"no-start";let o=this.transformEnd(e);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o);if(o.facility){let l=this.facilityMap.get(o.facility).filter(f=>o.floor?f.floor===o.floor:!0);if(!l.length)return null;let c=l.map(f=>a(i,{floor:f.floor,id:f.id})).filter(f=>!!f);return c.reduce((f,g)=>{let m=g.reduce((v,x)=>v+Ws(x.points),0);return m<f.distance&&(f.distance=m,f.path=g),f},{distance:1/0,path:c[0]}).path}}getRoutePath(t,e,n){let i=""+t.floor+Tu+t.id,o=""+e.floor+Tu+e.id,a=n.path(i,o);if(!a)return null;let l=[];return a.map(c=>{let f=this.pointMap.get(c);if(f){var g;let{floor:m}=f;if(((g=l[l.length-1])==null?void 0:g.floor)===m){let v=l[l.length-1];v.points.push(f.cds),v.endType=f.type,v.destId=f.nodeId,v.distance=Ws(v.points)}else l.push({floor:m,points:[f.cds],endType:f.type,destId:f.nodeId,distance:0})}}),l}getBasePath(t,e){return this.getRoutePath(t,e,this.baseRoute)}getEscalatorPath(t,e){return this.getRoutePath(t,e,this.escalatorRoute)}getStraightLadderPath(t,e){return this.getRoutePath(t,e,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new tl.default,this.escalatorRoute=new tl.default,this.straightLadderRoute=new tl.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.staircaseMap=new Map,this.lineMap=new Map,this.baseRoute=new tl.default,this.escalatorRoute=new tl.default,this.straightLadderRoute=new tl.default}};var H8t=H(ze(),1),W8t=H(Xa(),1),q8t=H(En(),1),X8t=H(n0(),1),j8t=H(r0(),1),Y8t=H(i0(),1),Z8t=H(o0(),1),K8t=H(s0(),1),$8t=H(a0(),1),J8t=H(u0(),1),Q8t=H(C1(),1),t9t=H(R1(),1),as=H(XT(),1);var xa=H(qs(),1);var hr="___",KT=class{isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let n=[];try{n=JSON.parse(e.entry_end_floor)}catch(o){n=[]}let i=[];try{i=JSON.parse(e.entry_start_floor)}catch(o){i=[]}return ee({},e,{entry_start_floor:i,entry_end_floor:n})})}getParkingSpaceInfo(t,e){let n=""+t+hr+e;var i;return(i=this.parkingMap.get(n))!=null?i:null}getNodeInfo(t,e){let n=""+t+hr+e,i=this.nodeMap.get(n);if(!(i!=null&&i.length))return null;let o=this.pointMap.get(i[0]);return o!=null?o:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let n=new Date,i=n.getHours()*60+n.getMinutes();t.length&&(t.forEach(o=>{let a=(o.points||[]).filter(l=>!(0,xa.isNil)(l.passWeight)&&l.passWeight!==1&&!(0,xa.isNil)(l.coverageArea)&&l.coverageArea!==0);(o.points||[]).filter(l=>l.openStatus!==!1).filter(l=>{if(!l.startTime||!l.endTime)return!0;let[c,f]=l.startTime.split(":").map(S=>+S),[g,m]=l.endTime.split(":").map(S=>+S),v=c*60+f,x=g*60+m;return i>=v&&i<=x}).forEach(l=>{l.floor=o.floor;let c=""+o.floor+hr+l.id,f=""+o.floor+hr+l.nodeId,g=this.nodeMap.get(f)||[];if(g.push(""+o.floor+hr+(l.relatedId||l.id)),this.nodeMap.set(""+o.floor+hr+l.nodeId,g),this.pointMap.set(c,l),this.isFacilityByType(l.type)){let m=this.facilities.find(v=>v.id===+l.targetId);if(m){switch(m.entry_infra_type){case"straightLadder":if(m.entry_end_floor.find(w=>w.floor===o.floor)&&m.entry_start_floor.find(w=>w.floor===o.floor)){let w=this.straightLadderMap.get(l.targetId)||[];w.push(ee({},l)),this.straightLadderMap.set(l.targetId,w)}break;case"staircase":if(m.entry_end_floor.find(w=>w.floor===o.floor)&&m.entry_start_floor.find(w=>w.floor===o.floor)){let w=this.staircaseMap.get(l.targetId)||[];w.push(ee({},l)),this.staircaseMap.set(l.targetId,w)}break;case"escalator":let x=this.escalatorMap.get(l.targetId)||[];if(m.entry_start_floor.find(w=>w.floor===o.floor)){let w=x.find(E=>{var b;return((b=E.end)==null?void 0:b.floor)!==o.floor&&!E.start});w?w.start=l:x.push({start:l})}if(m.entry_end_floor.find(w=>w.floor===o.floor)){let w=x.find(E=>{var b;return((b=E.start)==null?void 0:b.floor)!==o.floor&&!E.end});w?w.end=l:x.push({end:l})}this.escalatorMap.set(l.targetId,x);break;case"ramp":let S=this.rampMap.get(l.targetId)||[];if(m.entry_start_floor.find(w=>w.floor===o.floor)){let w=S.find(E=>{var b;return((b=E.end)==null?void 0:b.floor)!==o.floor&&!E.start});w?w.start=l:S.push({start:l})}if(m.entry_end_floor.find(w=>w.floor===o.floor)){let w=S.find(E=>{var b;return((b=E.start)==null?void 0:b.floor)!==o.floor&&!E.end});w?w.end=l:S.push({end:l})}this.rampMap.set(l.targetId,S);break;case"connectionPoint":if(m.entry_end_floor.find(w=>w.floor===o.floor)&&m.entry_start_floor.find(w=>w.floor===o.floor)){let w=this.connectionPointMap.get(l.targetId)||[];w.push(ee({},l)),this.connectionPointMap.set(l.targetId,w)}break}let v=this.facilityMap.get(l.targetId)||[];v.push(ee({},l)),this.facilityMap.set(l.targetId,v)}}l.type==="parkingSpace"&&l.name.split(/[,,]/).forEach(v=>{this.parkingMap.set(""+o.floor+hr+v,l)})}),(o.lines||[]).filter(l=>l.to!==l.from).forEach(l=>{let c=""+o.floor+hr+l.from,f=""+o.floor+hr+l.to,g=this.pointMap.get(c),m=this.pointMap.get(f);if(!g||!m)return;let v=g.cds,x=m.cds,S=zr(v,x);if(a.forEach(w=>{(w.id===l.from||w.id===l.to)&&(S=S/w.passWeight);let E=zr(v,w.cds)<=w.coverageArea,b=zr(x,w.cds)<=w.coverageArea;(E||b)&&(S=S/w.passWeight)}),!g.permission&&!m.permission){switch(this.addLineItem(c,f,S),this.addLineItem(f,c,S),l.direction){case"double":this.addLineItem(c,f,S,this.forwardLineMap),this.addLineItem(f,c,S,this.forwardLineMap);break;case"single":this.addLineItem(c,f,S,this.forwardLineMap);break;case"back":this.addLineItem(f,c,S,this.forwardLineMap);break}(g.type==="parkingSpace"||m.type==="parkingSpace")&&l.direction==="noDir"&&(this.addLineItem(c,f,S,this.forwardLineMap),this.addLineItem(f,c,S,this.forwardLineMap))}else g.permission&&(this.setPermissionLine(c,f,g.permission,S,""),this.setPermissionLine(f,c,g.permission,S,"")),m.permission&&m.permission!==g.permission&&(this.setPermissionLine(c,f,m.permission,S,""),this.setPermissionLine(f,c,m.permission,S,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,n,i,o){this.getPermissionMap(n).add({fromKey:t,toKey:e,distance:i,type:o})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let n=0;n<t.length;n++){let i=""+t[n].floor+hr+t[n].id,o=this.pointMap.get(i);if(o){for(let a=0;a<t.length;a++)if(n!==a){let l=""+t[a].floor+hr+t[a].id,c=this.pointMap.get(l);if(!c)continue;o.permission&&this.setPermissionLine(i,l,o.permission,1,"straightLadder"),c.permission&&c.permission!==o.permission&&this.setPermissionLine(i,l,c.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let n=0;n<t.length;n++){let i=""+t[n].floor+hr+t[n].id,o=this.pointMap.get(i);if(o){for(let a=0;a<t.length;a++)if(n!==a){let l=""+t[a].floor+hr+t[a].id,c=this.pointMap.get(l);if(!c)continue;o.permission&&this.setPermissionLine(i,l,o.permission,1,"staircase"),c.permission&&c.permission!==o.permission&&this.setPermissionLine(i,l,c.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(n=>{if(n.start&&n.end){let i=""+n.start.floor+hr+n.start.id,o=""+n.end.floor+hr+n.end.id,a=this.pointMap.get(i),l=this.pointMap.get(o);a&&l&&(a.permission&&this.setPermissionLine(i,o,a.permission,1,"escalator"),l.permission&&l.permission!==a.permission&&this.setPermissionLine(i,o,l.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(n=>{if(n.start&&n.end){let i=""+n.start.floor+hr+n.start.id,o=""+n.end.floor+hr+n.end.id,a=this.pointMap.get(i),l=this.pointMap.get(o);a&&l&&(a.permission&&this.setPermissionLine(i,o,a.permission,10,"ramp"),l.permission&&l.permission!==a.permission&&this.setPermissionLine(i,o,l.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{if(t.length<2){this.connectionPointMap.delete(e);return}for(let n=0;n<t.length;n++){let i=""+t[n].floor+hr+t[n].id,o=this.pointMap.get(i);if(o){for(let a=0;a<t.length;a++)if(n!==a){let l=""+t[a].floor+hr+t[a].id,c=this.pointMap.get(l);if(!c)continue;o.permission&&this.setPermissionLine(i,l,o.permission,1,"connectionPoint"),c.permission&&c.permission!==o.permission&&this.setPermissionLine(i,l,c.permission,1,"connectionPoint")}}}})}addPermissionLineToMap(t,e,n,i){this.getPermissionMap(t).forEach(a=>{e.includes(a.type)&&(a.type===""?this.addLineItem(a.fromKey,a.toKey,a.distance,n):this.addLineItem(a.fromKey,a.toKey,i.get(a.type),n))})}addLineItem(t,e,n,i){i===void 0&&(i=this.lineMap);let o=i.get(t)||new Map;o.set(e,n),i.set(t,o)}addFacilityToLineMap(t,e,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(o=>{let[a,l]=o;if(!(l.length<2))for(let c=0;c<l.length;c++){let f=""+l[c].floor+hr+l[c].id,g=this.pointMap.get(f);if(!(!g||g.permission)){for(let m=0;m<l.length;m++)if(c!==m){let v=""+l[m].floor+hr+l[m].id,x=this.pointMap.get(v);if(!x||x.permission)continue;if(l[c].type==="straightLadder"){let S=e;this.addLineItem(f,v,S,i)}else{let S=n;this.addLineItem(f,v,S,i)}}}}}),this.escalatorMap.forEach((o,a)=>{o.forEach(l=>{if(l.start&&l.end){let c=""+l.start.floor+hr+l.start.id,f=""+l.end.floor+hr+l.end.id,g=this.pointMap.get(c),m=this.pointMap.get(f);if(g&&m&&!g.permission&&!m.permission){let v=t;this.addLineItem(c,f,v,i)}}})}),this.connectionPointMap.forEach((o,a)=>{if(!(o.length<2))for(let l=0;l<o.length;l++){let c=""+o[l].floor+hr+o[l].id,f=this.pointMap.get(c);if(!(!f||f.permission)){for(let g=0;g<o.length;g++)if(l!==g){let m=""+o[g].floor+hr+o[g].id,v=this.pointMap.get(m);if(!v||v.permission)continue;this.addLineItem(c,m,100,i)}}}})}initBaseRoute(){let t=new Map((0,xa.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100*this.lift_priority,3e4,t),this.baseRoute=new as.default(t)}initEscalatorRoute(){let t=new Map((0,xa.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new as.default(t)}initStraightLadderRoute(){let t=new Map((0,xa.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new as.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(n=>{if(n.start&&n.end){let i=""+n.start.floor+hr+n.start.id,o=""+n.end.floor+hr+n.end.id,a=this.pointMap.get(i),l=this.pointMap.get(o);a&&l&&!a.permission&&!l.permission&&this.addLineItem(i,o,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{if(!(t.length<2))for(let n=0;n<t.length;n++){let i=""+t[n].floor+hr+t[n].id,o=this.pointMap.get(i);if(!(!o||o.permission)){for(let a=0;a<t.length;a++)if(n!==a){let l=""+t[a].floor+hr+t[a].id,c=this.pointMap.get(l);if(!c||c.permission)continue;this.addLineItem(i,l,100,this.forwardLineMap)}}}}),this.forwardRoute=new as.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t,e,n){n===void 0&&(n={});var i;if(t.nodeId){let o=this.nodeMap.get(""+t.floor+hr+t.nodeId);if(o!=null&&o.length)return o.map(a=>{let[l,c]=a.split(hr);return{floor:l,id:c}})}if((i=t.coord)!=null&&i.length){let o=this.roadInfo.find(f=>f.floor===t.floor);if(!o)return null;let a=o.points.filter(f=>f.isStarted),l=o.points.filter(f=>{let g=""+f.floor+hr+f.id;if(e==="forward"){if(!this.forwardLineMap.has(g)||n.adsorptionIntersection&&a.length&&!f.isStarted)return!1}else if(!this.lineMap.has(g))return!1;return!0});if(!l.length)return null;let c=l.reduce((f,g)=>{if(g.relatedId)return f;let m=zr(t.coord,g.cds);return m<f.min&&(f.min=m,f.point=g),f},{min:1/0,point:l[0]});return[{floor:o.floor,id:c.point.id}]}return null}transformEnd(t,e){if(t.floor){if(t.parkingSpace){let i=this.parkingMap.get(""+t.floor+hr+t.parkingSpace);if(i)return[{floor:t.floor,id:i.id}]}let n=this.transformStart(t,e);if(n)return n}if(t.facility){let i=this.facilities.filter(o=>+o.type_id==+t.facility).map(o=>o.id).map(o=>this.facilityMap.get(""+o)).flat(2);if(i!=null&&i.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,n,i,o,a){if(n===void 0&&(n=""),a===void 0&&(a={}),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let l=this.transformStart(t,n,a);if(!l)return"no-start";let c=this.transformEnd(e,n);if(!c)return"no-end";let f=[];if(Array.isArray(c))for(let v=0;v<l.length;v++){let x=l[v];for(let S=0;S<c.length;S++){let w=c[S];if(x.floor===w.floor&&x.id===w.id)return"near"}}else{f=this.facilities.filter(x=>+x.type_id==+e.facility).map(x=>x.id).map(x=>this.facilityMap.get(""+x)).flat(2).filter(x=>x).filter(x=>c.floor?x.floor===c.floor:!0);for(let x=0;x<l.length;x++){let S=l[x];for(let w=0;w<f.length;w++){let E=f[w];if(S.floor===E.floor&&S.id===E.id)return"near"}}}let g;switch(n){case"escalator":g=this.getEscalatorPath.bind(this);break;case"straightLadder":g=this.getStraightLadderPath.bind(this);break;case"forward":g=this.getForwardPath.bind(this);break;default:g=this.getBasePath.bind(this);break}let m=null;return l.forEach(v=>{if(Array.isArray(c))c.forEach(x=>{let S=g(v,x,i,o);S&&S&&(!m||S[0].consume<m[0].consume)&&(m=S)});else{if(!f.length)return null;let x=f.map(S=>g(v,{floor:S.floor,id:S.id},i,o)).filter(S=>!!S);m=x.reduce((S,w)=>{let E=w[0].consume;return E<S.distance&&(S.distance=E,S.path=w),S},{distance:1/0,path:x[0]}).path}}),m}getRoutePath(t,e,n){let i=""+t.floor+hr+t.id,o=""+e.floor+hr+e.id,a=n.path(i,o);if(!a)return null;let l=[],c=a.reduce((f,g,m,v)=>{if(m===0)return 0;let x=v[m-1],S=n.graph.get(x).get(g);return f+S},0);return a.map(f=>{let g=this.pointMap.get(f);if(g){var m;let{floor:v}=g,x=g.type;if(this.isFacilityByType(g.type)){let S=this.facilities.find(w=>w.id===+g.targetId);S&&(x=S.entry_infra_type)}if(((m=l[l.length-1])==null?void 0:m.floor)===v){let S=l[l.length-1];S.points.push(g.cds),S.pointInfos.push(g),S.endType=x,S.destId=g.nodeId,S.distance=Ws(S.points)}else l.push({floor:v,points:[g.cds],pointInfos:[g],endType:x,destId:g.nodeId,distance:0,consume:c})}}),l}getBasePath(t,e,n){if(!n)return this.getRoutePath(t,e,this.baseRoute);let i=(0,xa.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder","connectionPoint"],i,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100*this.lift_priority],["staircase",3e4]]));let o=new as.default(i);return this.getRoutePath(t,e,o)}getEscalatorPath(t,e,n){if(!n)return this.getRoutePath(t,e,this.escalatorRoute);let i=(0,xa.cloneDeep)(this.escalatorRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder","connectionPoint"],i,new Map([["escalator",1*o],["connectionPoint",100],["straightLadder",this.lift_priority*o],["staircase",3e4*o]]));let a=new as.default(i);return this.getRoutePath(t,e,a)}getStraightLadderPath(t,e,n){if(!n)return this.getRoutePath(t,e,this.straightLadderRoute);let i=(0,xa.cloneDeep)(this.straightLadderRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder","connectionPoint"],i,new Map([["escalator",3*o],["connectionPoint",100],["straightLadder",1*o],["staircase",3e4*o]]));let a=new as.default(i);return this.getRoutePath(t,e,a)}getForwardPath(t,e,n,i){let o=new Map,a=v=>{let x=this.forwardRoute.graph.get(c);v.forEach(S=>{let w=x.get(S);(0,xa.isNil)(w)||(o.set(S,w),x.delete(S))})},l=()=>{let v=this.forwardRoute.graph.get(c);o.forEach((x,S)=>{v.set(S,x)})},c=""+t.floor+hr+t.id;if(!(0,xa.isNil)(i)){let v=this.forwardLineMap.get(c),x=this.pointMap.get(c);if(x&&(v!=null&&v.size)&&v.size>1){let S=new ft(x.cds[0],x.cds[1]),w=new Map;v.forEach((b,C)=>{let A=this.pointMap.get(C);if(A){let P=new ft(A.cds[0],A.cds[1]),U=360-(new ft().subVectors(P,S).angle()/Math.PI*180-90+360)%360;w.set(C,U)}});let E=Array.from(w).filter(b=>{let[C,A]=b;return Math.abs(A-i)<=60}).map(b=>{let[C]=b;return C});if(E.length)E.forEach(b=>w.delete(b)),a([...w.keys()]);else{let b=Array.from(w).reduce((C,A)=>{let P=Math.abs(A[1]-i);return P<C.diff?{diff:P,key:A[0]}:C},{diff:1/0,key:""});w.delete(b.key),a([...w.keys()])}}}if(!n){let v=this.getRoutePath(t,e,this.forwardRoute);return l(),v||this.getRoutePath(t,e,this.forwardRoute)}let f=(0,xa.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],f,new Map([["ramp",10]]));let g=new as.default(f),m=this.getRoutePath(t,e,g);if(l(),m)return m;{let v=(0,xa.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],v,new Map([["ramp",10]]));let x=new as.default(v);return this.getRoutePath(t,e,x)}}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new as.default,this.escalatorRoute=new as.default,this.straightLadderRoute=new as.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.baseRoute=new as.default,this.escalatorRoute=new as.default,this.straightLadderRoute=new as.default,this.forwardLineMap=new Map,this.forwardRoute=new as.default}};var i9t=H(n0(),1),o9t=H(r0(),1),s9t=H(i0(),1),a9t=H(o0(),1),u9t=H(s0(),1),l9t=H(a0(),1),c9t=H(u0(),1),h9t=H(ze(),1),Sh=class{static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let t=this.createKey();for(;this.keySet.has(t);)t=this.createKey();return t}static removeKey(t){this.keySet.delete(t)}static dispose(){this.keySet.clear()}};Sh.keySet=new Set;var p9t=H(bv(),1),d9t=H(Xa(),1);function $T(r){return r.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function fi(r,t,e){return new Promise((n,i)=>{let o=Sh.genUniqueKey(),a=l=>{let{data:c}=l;c.type===""+t+"_result"&&c.key===o&&(Sh.removeKey(o),self.removeEventListener("message",a),c.error?i(c.error):n(c.data))};r.addEventListener("message",a),r.postMessage({type:t,key:o,data:e})})}function Vyt(r){let t={};for(let n in r)n.startsWith("on")&&(t[$T(n.slice(2))]=r[n]);let e=n=>Tt(this,null,function*(){let{data:i}=n;if(t[i.type])try{let o=yield t[i.type](i.data);if(o!=null&&o.$transfer&&Array.isArray(o.$transfer)){let a=o.$transfer;delete o.$transfer,self.postMessage({type:""+i.type+"_result",key:i.key,data:o},a)}else self.postMessage({type:""+i.type+"_result",key:i.key,data:o})}catch(o){self.postMessage({type:""+i.type+"_result",key:i.key,error:o})}else self.postMessage({type:""+i.type+"_result",key:i.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}function Hyt(r,t){t===void 0&&(t=16711680);let e=new ma({color:t}),n=new qe().setFromPoints(r);return new Hl(n,e)}function Wyt(r,t){t===void 0&&(t=16711680);let e=new ma({color:t}),n=new Eu(1,1,1),i=new en(n,e);return i.position.copy(r),i}var S9t=H(sf(),1),b9t=H(ze(),1);function Av(r,t,e){e===void 0&&(e=0),r.forEach(n=>{if(n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"){var i;n.geometry.coords.map(o=>{Array.isArray(o)&&o.forEach(a=>{a[0]-=t[0],a[1]-=t[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(o=>o.map(a=>Qf(a,t)))),(i=n.doors)!=null&&i.length&&n.doors.map(o=>{o.coord=Qf(o.coordinate,t)}),n.center&&(n.centerCoords=Qf(n.center,t))}else n.geometry.coords=Qf(n.geometry.cds,t),n.center&&(n.centerCoords=Qf(n.center,t));if(n.center_x&&n.center_y){let[o,a]=Qf([n.center_x,n.center_y],t);n.center_coord_x=o,n.center_coord_y=a}});for(let n=0;n<r.length;n++){let i=r[n];i.deltaHeight=1e-5*(e+n+1)}}function Qf(r,t){return[r[0]-t[0],r[1]-t[1]]}var L9t=H(n0(),1),N9t=H(r0(),1),O9t=H(i0(),1),D9t=H(o0(),1),U9t=H(s0(),1),F9t=H(a0(),1),B9t=H(u0(),1),z9t=H(ze(),1);var tp=Object.freeze({Linear:Object.freeze({None:function(r){return r},In:function(r){return this.None(r)},Out:function(r){return this.None(r)},InOut:function(r){return this.None(r)}}),Quadratic:Object.freeze({In:function(r){return r*r},Out:function(r){return r*(2-r)},InOut:function(r){return(r*=2)<1?.5*r*r:-.5*(--r*(r-2)-1)}}),Cubic:Object.freeze({In:function(r){return r*r*r},Out:function(r){return--r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r:.5*((r-=2)*r*r+2)}}),Quartic:Object.freeze({In:function(r){return r*r*r*r},Out:function(r){return 1- --r*r*r*r},InOut:function(r){return(r*=2)<1?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)}}),Quintic:Object.freeze({In:function(r){return r*r*r*r*r},Out:function(r){return--r*r*r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)}}),Sinusoidal:Object.freeze({In:function(r){return 1-Math.sin((1-r)*Math.PI/2)},Out:function(r){return Math.sin(r*Math.PI/2)},InOut:function(r){return .5*(1-Math.sin(Math.PI*(.5-r)))}}),Exponential:Object.freeze({In:function(r){return r===0?0:Math.pow(1024,r-1)},Out:function(r){return r===1?1:1-Math.pow(2,-10*r)},InOut:function(r){return r===0?0:r===1?1:(r*=2)<1?.5*Math.pow(1024,r-1):.5*(-Math.pow(2,-10*(r-1))+2)}}),Circular:Object.freeze({In:function(r){return 1-Math.sqrt(1-r*r)},Out:function(r){return Math.sqrt(1- --r*r)},InOut:function(r){return(r*=2)<1?-.5*(Math.sqrt(1-r*r)-1):.5*(Math.sqrt(1-(r-=2)*r)+1)}}),Elastic:Object.freeze({In:function(r){return r===0?0:r===1?1:-Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI)},Out:function(r){return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r-.1)*5*Math.PI)+1},InOut:function(r){return r===0?0:r===1?1:(r*=2,r<1?-.5*Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI):.5*Math.pow(2,-10*(r-1))*Math.sin((r-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(r){var t=1.70158;return r===1?1:r*r*((t+1)*r-t)},Out:function(r){var t=1.70158;return r===0?0:--r*r*((t+1)*r+t)+1},InOut:function(r){var t=2.5949095;return(r*=2)<1?.5*(r*r*((t+1)*r-t)):.5*((r-=2)*r*((t+1)*r+t)+2)}}),Bounce:Object.freeze({In:function(r){return 1-tp.Bounce.Out(1-r)},Out:function(r){return r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375},InOut:function(r){return r<.5?tp.Bounce.In(r*2)*.5:tp.Bounce.Out(r*2-1)*.5+.5}}),generatePow:function(r){return r===void 0&&(r=4),r=r<Number.EPSILON?Number.EPSILON:r,r=r>1e4?1e4:r,{In:function(t){return Math.pow(t,r)},Out:function(t){return 1-Math.pow(1-t,r)},InOut:function(t){return t<.5?Math.pow(t*2,r)/2:(1-Math.pow(2-t*2,r))/2+.5}}}}),Cv=function(){return performance.now()},Rv=function(){function r(){this._tweens={},this._tweensAddedDuringUpdate={}}return r.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},r.prototype.removeAll=function(){this._tweens={}},r.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},r.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},r.prototype.update=function(t,e){t===void 0&&(t=Cv()),e===void 0&&(e=!1);var n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var o=this._tweens[n[i]],a=!e;o&&o.update(t,a)===!1&&!e&&delete this._tweens[n[i]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},r}(),Zd={Linear:function(r,t){var e=r.length-1,n=e*t,i=Math.floor(n),o=Zd.Utils.Linear;return t<0?o(r[0],r[1],n):t>1?o(r[e],r[e-1],e-n):o(r[i],r[i+1>e?e:i+1],n-i)},Bezier:function(r,t){for(var e=0,n=r.length-1,i=Math.pow,o=Zd.Utils.Bernstein,a=0;a<=n;a++)e+=i(1-t,n-a)*i(t,a)*r[a]*o(n,a);return e},CatmullRom:function(r,t){var e=r.length-1,n=e*t,i=Math.floor(n),o=Zd.Utils.CatmullRom;return r[0]===r[e]?(t<0&&(i=Math.floor(n=e*(1+t))),o(r[(i-1+e)%e],r[i],r[(i+1)%e],r[(i+2)%e],n-i)):t<0?r[0]-(o(r[0],r[0],r[1],r[1],-n)-r[0]):t>1?r[e]-(o(r[e],r[e],r[e-1],r[e-1],n-e)-r[e]):o(r[i?i-1:0],r[i],r[e<i+1?e:i+1],r[e<i+2?e:i+2],n-i)},Utils:{Linear:function(r,t,e){return(t-r)*e+r},Bernstein:function(r,t){var e=Zd.Utils.Factorial;return e(r)/e(t)/e(r-t)},Factorial:function(){var r=[1];return function(t){var e=1;if(r[t])return r[t];for(var n=t;n>1;n--)e*=n;return r[t]=e,e}}(),CatmullRom:function(r,t,e,n,i){var o=(e-r)*.5,a=(n-t)*.5,l=i*i,c=i*l;return(2*t-2*e+o+a)*c+(-3*t+3*e-2*o-a)*l+o*i+t}}},ZW=function(){function r(){}return r.nextId=function(){return r._nextId++},r._nextId=0,r}(),JT=new Rv,Za=function(){function r(t,e){e===void 0&&(e=JT),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=tp.Linear.None,this._interpolationFunction=Zd.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=ZW.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return r.prototype.getId=function(){return this._id},r.prototype.isPlaying=function(){return this._isPlaying},r.prototype.isPaused=function(){return this._isPaused},r.prototype.to=function(t,e){if(e===void 0&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=e,this},r.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t,this},r.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},r.prototype.start=function(t,e){if(t===void 0&&(t=Cv()),e===void 0&&(e=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var o in this._valuesEnd)i[o]=this._valuesEnd[o];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},r.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},r.prototype._setupProperties=function(t,e,n,i,o){for(var a in n){var l=t[a],c=Array.isArray(l),f=c?"array":typeof l,g=!c&&Array.isArray(n[a]);if(!(f==="undefined"||f==="function")){if(g){var m=n[a];if(m.length===0)continue;for(var v=[l],x=0,S=m.length;x<S;x+=1){var w=this._handleRelativeValue(l,m[x]);if(isNaN(w)){g=!1,console.warn("Found invalid interpolation list. Skipping.");break}v.push(w)}g&&(n[a]=v)}if((f==="object"||c)&&l&&!g){e[a]=c?[]:{};var E=l;for(var b in E)e[a][b]=E[b];i[a]=c?[]:{};var m=n[a];if(!this._isDynamic){var C={};for(var b in m)C[b]=m[b];n[a]=m=C}this._setupProperties(E,e[a],m,i[a],o)}else(typeof e[a]=="undefined"||o)&&(e[a]=l),c||(e[a]*=1),g?i[a]=n[a].slice().reverse():i[a]=e[a]||0}}},r.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},r.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},r.prototype.pause=function(t){return t===void 0&&(t=Cv()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this),this)},r.prototype.resume=function(t){return t===void 0&&(t=Cv()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},r.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},r.prototype.group=function(t){return t===void 0&&(t=JT),this._group=t,this},r.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},r.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},r.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},r.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},r.prototype.easing=function(t){return t===void 0&&(t=tp.Linear.None),this._easingFunction=t,this},r.prototype.interpolation=function(t){return t===void 0&&(t=Zd.Linear),this._interpolationFunction=t,this},r.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},r.prototype.onStart=function(t){return this._onStartCallback=t,this},r.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},r.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},r.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},r.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},r.prototype.onStop=function(t){return this._onStopCallback=t,this},r.prototype.update=function(t,e){if(t===void 0&&(t=Cv()),e===void 0&&(e=!0),this._isPaused)return!0;var n,i,o=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>o)return!1;e&&this.start(t,!0)}if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0),i=(t-this._startTime)/this._duration,i=this._duration===0||i>1?1:i;var a=this._easingFunction(i);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,i),i===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(n in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[n]=="string"&&(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var l=0,c=this._chainedTweens.length;l<c;l++)this._chainedTweens[l].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},r.prototype._updateProperties=function(t,e,n,i){for(var o in n)if(e[o]!==void 0){var a=e[o]||0,l=n[o],c=Array.isArray(t[o]),f=Array.isArray(l),g=!c&&f;g?t[o]=this._interpolationFunction(l,i):typeof l=="object"&&l?this._updateProperties(t[o],a,l,i):(l=this._handleRelativeValue(a,l),typeof l=="number"&&(t[o]=a+(l-a)*i))}},r.prototype._handleRelativeValue=function(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)},r.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],n=this._valuesEnd[t];typeof n=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(n):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=e},r}();var w9t=ZW.nextId,el=JT,T9t=el.getAll.bind(el),A9t=el.removeAll.bind(el),C9t=el.add.bind(el),R9t=el.remove.bind(el),P9t=el.update.bind(el);var Kl=class{update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(t=>{this.tweenStore.add(t),t.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(t=>{t.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(t){this.group.remove(t)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(t=>t.stop()),this.group.removeAll()}dispose(){this.clear()}constructor(){this.pauseTween=!1,this.tweenStore=new Set,this.group=new Rv}};var Pv=class extends Sn{registryEvent(){this.ctn.addEventListener("pointerdown",this._pointerDown),this.ctn.addEventListener("pointerup",this._pointerUp)}unRegistryEvent(){this.ctn.removeEventListener("pointerdown",this._pointerDown),this.ctn.removeEventListener("pointerup",this._pointerUp)}dispose(){this.unRegistryEvent()}constructor(t){super(),this.ctn=t,this._pointerDown=e=>{this.point={x:e.offsetX,y:e.offsetY}},this._pointerUp=e=>{if(!this.point)return;let{offsetX:n,offsetY:i}=e,{x:o,y:a}=this.point;Math.hypot(o-n+(a-i))>3||this.dispatchEvent({type:"click",e})},this.registryEvent()}};var q9t=H(ze(),1),X9t=H(En(),1),j9t=H(bv(),1),Y9t=H(Xa(),1),KW=H(qs(),1);var ep=class extends Sn{_isEffectiveTask(t){return t&&typeof t.run=="function"}_getIndexByTid(t){return this._task.findIndex(e=>e.tid===t)}_createTask(t){return this._isEffectiveTask(t)?ee({},t,{tid:++this._id,meta:t.meta||{}}):!1}get task(){return[...this._task]}getTasks(){return[...this._task]}add(t){if(this._isEffectiveTask(t)){let e=this._createTask(t);return this._task.push(e),this.started&&!this.activeTask&&this.start(),e.tid}return!1}replace(t,e){if(!this._isEffectiveTask(e))return console.warn("[TaskQueue] replace\u65B9\u6CD5\u4F20\u5165\u7684task\u53C2\u6570\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;let n=this._getIndexByTid(t);if(n===-1)return console.warn("[TaskQueue] \u6CA1\u6709\u627E\u5230id="+t+"\u7684\u4EFB\u52A1"),!1;let i=this._createTask(e);return this._task.splice(n,1,i),i.tid}replaceByMetaType(t){var e;let n=(e=t.meta)==null?void 0:e.type;if((0,KW.isNil)(n))return this.add(t);{let i=this._task.find(o=>o.meta.type===n);return i?this.replace(i.tid,t):this.add(t)}}remove(t){let e=this._getIndexByTid(t);return e===-1?(console.warn("[TaskQueue] remove\u65B9\u6CD5\u4F20\u5165\u7684id\uFF1A"+t+"\u627E\u4E0D\u5230\u5BF9\u5E94\u7684task"),!1):(this._task.splice(e,1),!0)}clear(){this._task.length=0}start(){this.started=!0,!this.activeTask&&this._task.length&&this.exec()}stop(){this.started=!1}exec(){return Tt(this,null,function*(){if(!this.started||!this._task.length)return!1;let t=this._task.shift();this.activeTask=t,this.dispatchEvent({type:"active-task-start",task:t});let e;try{e=yield t.run()}catch(n){console.warn("[task run err]",n,t)}return this.activeTask=null,this.dispatchEvent({type:"active-task-end",task:t,res:e}),this.exec()})}constructor(t=!0){super(),this._task=[],this.started=!1,this.activeTask=null,this._id=0,t&&this.start()}};var J9t=H(En(),1);var Iv=class extends Sn{getWorker(){return new Promise(t=>{let e=this.pool.find(i=>i.state==="leisure");if(e){e.state="used",t(e.worker);return}if(this.pool.length<this.max&&this.workerConstructor){let i=this.workerConstructor();this.pool.push({worker:i,state:"used"}),t(i);return}let n=()=>{let i=this.pool.find(o=>o.state==="leisure");i&&(this.removeEventListener("release",n),i.state="used",t(i.worker))};this.addEventListener("release",n)})}releaseWorker(t){let e=this.pool.find(n=>n.worker===t);e&&(e.state="leisure",this.dispatchEvent({type:"release",worker:t}))}dispose(){this._listeners={},this.pool.forEach(t=>{t.worker.terminate()}),this.pool=[]}constructor(t=10,e){super(),this.max=10,this.pool=[],this.max=t,this.workerConstructor=e}};var Zi=class extends Sn{dispose(){this._listeners={}}};var Lv=class{filter(t){let e=this.estimate,n=this.errorEstimate+this.processNoise,i=n/(n+this.measurementNoise);return this.estimate=e+i*(t-e),this.errorEstimate=(1-i)*n,this.estimate}constructor(t={}){this.estimate=0,this.errorEstimate=1,this.processNoise=.1,this.measurementNoise=1,this.measurementNoise=t.measurementNoise||1,this.processNoise=t.processNoise||.1,this.errorEstimate=t.errorEstimate||1}};var MZt=H(ip(),1),wZt=H(ec(),1),TZt=H(nc(),1),AZt=H(rc(),1),CZt=H(ic(),1),RZt=H(oc(),1),PZt=H(sc(),1),IZt=H(ac(),1),LZt=H(uc(),1),NZt=H(lc(),1),OZt=H(cc(),1),DZt=H(hc(),1),UZt=H(fc(),1),FZt=H(pc(),1),BZt=H(dc(),1),zZt=H(En(),1);function Rh(r,t=!1){let e=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),o={},a={},l=r[0].morphTargetsRelative,c=new qe,f=0;for(let g=0;g<r.length;++g){let m=r[g],v=0;if(e!==(m.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let x in m.attributes){if(!n.has(x))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+'. All geometries must have compatible attributes; make sure "'+x+'" attribute exists among all geometries, or in none of them.'),null;o[x]===void 0&&(o[x]=[]),o[x].push(m.attributes[x]),v++}if(v!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". Make sure all geometries have the same number of attributes."),null;if(l!==m.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let x in m.morphAttributes){if(!i.has(x))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphAttributes must be consistent throughout all geometries."),null;a[x]===void 0&&(a[x]=[]),a[x].push(m.morphAttributes[x])}if(t){let x;if(e)x=m.index.count;else if(m.attributes.position!==void 0)x=m.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". The geometry must have either an index or a position attribute"),null;c.addGroup(f,x,g),f+=x}}if(e){let g=0,m=[];for(let v=0;v<r.length;++v){let x=r[v].index;for(let S=0;S<x.count;++S)m.push(x.getX(S)+g);g+=r[v].attributes.position.count}c.setIndex(m)}for(let g in o){let m=DX(o[g]);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" attribute."),null;c.setAttribute(g,m)}for(let g in a){let m=a[g][0].length;if(m===0)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[g]=[];for(let v=0;v<m;++v){let x=[];for(let w=0;w<a[g].length;++w)x.push(a[g][w][v]);let S=DX(x);if(!S)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" morphAttribute."),null;c.morphAttributes[g].push(S)}}return c}function DX(r){let t,e,n,i=-1,o=0;for(let f=0;f<r.length;++f){let g=r[f];if(t===void 0&&(t=g.array.constructor),t!==g.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=g.itemSize),e!==g.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=g.normalized),n!==g.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(i===-1&&(i=g.gpuType),i!==g.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;o+=g.count*e}let a=new t(o),l=new He(a,e,n),c=0;for(let f=0;f<r.length;++f){let g=r[f];if(g.isInterleavedBufferAttribute){let m=c/e;for(let v=0,x=g.count;v<x;v++)for(let S=0;S<e;S++){let w=g.getComponent(v,S);l.setComponent(v+m,S,w)}}else a.set(g.array,c);c+=g.count*e}return i!==void 0&&(l.gpuType=i),l}function iC(r,t){if(t===IF)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(t===Hm||t===rx){let e=r.getIndex();if(e===null){let a=[],l=r.getAttribute("position");if(l!==void 0){for(let c=0;c<l.count;c++)a.push(c);r.setIndex(a),e=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}let n=e.count-2,i=[];if(t===Hm)for(let a=1;a<=n;a++)i.push(e.getX(0)),i.push(e.getX(a)),i.push(e.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(i.push(e.getX(a)),i.push(e.getX(a+1)),i.push(e.getX(a+2))):(i.push(e.getX(a+2)),i.push(e.getX(a+1)),i.push(e.getX(a)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let o=r.clone();return o.setIndex(i),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),r}function pEt(r,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let n=r.filter(l=>l.geometry.type==="polygon");if(!n.length)return null;let i=n.map(l=>{var c;let f=l.geometry.coords,g=qm(f[0],f.slice(1)),m=new wf(g,{steps:1,bevelEnabled:!1,depth:l.height,curveSegments:4});(c=l).deltaHeight||(c.deltaHeight=0),m.translate(0,0,l.airHeight+l.deltaHeight);let v=m.attributes.position.count,x=new Float32Array(v).fill(l.height+l.airHeight+l.deltaHeight);if(m.setAttribute("maxZ",new He(x,1)),m.setAttribute("opacity",new He(new Float32Array(v).fill(l.fillOpacity),1)),e){let E=new Float32Array(v).fill(l.airHeight+l.deltaHeight);m.setAttribute("minZ",new He(E,1))}let S=new ne(l.fillColor).convertLinearToSRGB(),w=new Float32Array(v*3);for(let E=0;E<v;E++)w[E*3]=S.r,w[E*3+1]=S.g,w[E*3+2]=S.b;return m.setAttribute("color",new He(w,3)),m}),o=Rh(i);i.forEach(l=>l.dispose());let a={geometry:o};return o.dispose(),t&&(a.lineGeometry=UX(n)||void 0),a}function UX(r){let{points:t,colors:e,opacities:n}=Q1(r);if(!t.length)return null;let i=new qe().setFromPoints(t);return i.setAttribute("color",new He(new Float32Array(e),3)),i.setAttribute("opacity",new He(new Float32Array(n),1)),i}function Q1(r){let t=[],e=[],n=[];return r.filter(i=>i.strokeOpacity>0).map(i=>{let o=i.height+(i.deltaHeight||0)+i.airHeight,{coords:a}=i.geometry,{strokeColor:l,strokeOpacity:c}=i,f=new ne(l).convertLinearToSRGB();for(let g=0;g<a.length;g++){let m=a[g];for(let v=0;v<m.length;v++){let x=m[v],S=v+1===m.length?m[0]:m[v+1];t.push(new G(x[0],x[1],o)),t.push(new G(S[0],S[1],o)),e.push(f.r,f.g,f.b),e.push(f.r,f.g,f.b),n.push(c),n.push(c)}}}),{points:t,colors:e,opacities:n}}var Zre=H(ze(),1),Kre=H(n0(),1),$re=H(r0(),1),Jre=H(i0(),1),Qre=H(o0(),1),tie=H(s0(),1),eie=H(a0(),1),nie=H(u0(),1),rie=H(En(),1);var MJt=H(ze(),1),wJt=H(En(),1);var XZt=H(ze(),1);pe.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new ft(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};ao.line={uniforms:Uf.merge([pe.common,pe.fog,pe.line]),vertexShader:`
3827
3827
  #include <common>
3828
3828
  #include <color_pars_vertex>
3829
3829
  #include <fog_pars_vertex>
@@ -19838,7 +19838,7 @@ void main() {
19838
19838
  }
19839
19839
 
19840
19840
  }\`,pv=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,o){if(this.texture===null){let s=new Us,c=t.properties.get(s);c.__webglTexture=e.texture,(e.depthNear!=o.depthNear||e.depthFar!=o.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}render(t,e){if(this.texture!==null){if(this.mesh===null){let o=e.cameras[0].viewport,s=new Pa({extensions:{fragDepth:!0},vertexShader:uX,fragmentShader:lX,uniforms:{depthColor:{value:this.texture},depthWidth:{value:o.z},depthHeight:{value:o.w}}});this.mesh=new ra(new zd(20,20),s)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},dv=class extends Ku{constructor(t,e){super();let o=this,s=null,c=1,p=null,h="local-floor",g=1,m=null,_=null,w=null,x=null,b=null,T=null,I=new pv,S=e.getContextAttributes(),E=null,R=null,C=[],F=[],W=new ze,X=null,q=new gs;q.layers.enable(1),q.viewport=new ji;let D=new gs;D.layers.enable(2),D.viewport=new ji;let xt=[q,D],B=new hv;B.layers.enable(1),B.layers.enable(2);let j=null,J=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ut){let Ut=C[ut];return Ut===void 0&&(Ut=new ih,C[ut]=Ut),Ut.getTargetRaySpace()},this.getControllerGrip=function(ut){let Ut=C[ut];return Ut===void 0&&(Ut=new ih,C[ut]=Ut),Ut.getGripSpace()},this.getHand=function(ut){let Ut=C[ut];return Ut===void 0&&(Ut=new ih,C[ut]=Ut),Ut.getHandSpace()};function Dt(ut){let Ut=F.indexOf(ut.inputSource);if(Ut===-1)return;let jt=C[Ut];jt!==void 0&&(jt.update(ut.inputSource,ut.frame,m||p),jt.dispatchEvent({type:ut.type,data:ut.inputSource}))}function Q(){s.removeEventListener("select",Dt),s.removeEventListener("selectstart",Dt),s.removeEventListener("selectend",Dt),s.removeEventListener("squeeze",Dt),s.removeEventListener("squeezestart",Dt),s.removeEventListener("squeezeend",Dt),s.removeEventListener("end",Q),s.removeEventListener("inputsourceschange",At);for(let ut=0;ut<C.length;ut++){let Ut=F[ut];Ut!==null&&(F[ut]=null,C[ut].disconnect(Ut))}j=null,J=null,I.reset(),t.setRenderTarget(E),b=null,x=null,w=null,s=null,R=null,ae.stop(),o.isPresenting=!1,t.setPixelRatio(X),t.setSize(W.width,W.height,!1),o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ut){c=ut,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ut){h=ut,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return m||p},this.setReferenceSpace=function(ut){m=ut},this.getBaseLayer=function(){return x!==null?x:b},this.getBinding=function(){return w},this.getFrame=function(){return T},this.getSession=function(){return s},this.setSession=function(ut){return pp(this,null,function*(){if(s=ut,s!==null){if(E=t.getRenderTarget(),s.addEventListener("select",Dt),s.addEventListener("selectstart",Dt),s.addEventListener("selectend",Dt),s.addEventListener("squeeze",Dt),s.addEventListener("squeezestart",Dt),s.addEventListener("squeezeend",Dt),s.addEventListener("end",Q),s.addEventListener("inputsourceschange",At),S.xrCompatible!==!0&&(yield e.makeXRCompatible()),X=t.getPixelRatio(),t.getSize(W),s.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let Ut={antialias:s.renderState.layers===void 0?S.antialias:!0,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:c};b=new XRWebGLLayer(s,e,Ut),s.updateRenderState({baseLayer:b}),t.setPixelRatio(1),t.setSize(b.framebufferWidth,b.framebufferHeight,!1),R=new du(b.framebufferWidth,b.framebufferHeight,{format:na,type:$u,colorSpace:t.outputColorSpace,stencilBuffer:S.stencil})}else{let Ut=null,jt=null,ce=null;S.depth&&(ce=S.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,Ut=S.stencil?Vc:Dl,jt=S.stencil?Ol:Wu);let te={colorFormat:e.RGBA8,depthFormat:ce,scaleFactor:c};w=new XRWebGLBinding(s,e),x=w.createProjectionLayer(te),s.updateRenderState({layers:[x]}),t.setPixelRatio(1),t.setSize(x.textureWidth,x.textureHeight,!1),R=new du(x.textureWidth,x.textureHeight,{format:na,type:$u,depthTexture:new kd(x.textureWidth,x.textureHeight,jt,void 0,void 0,void 0,void 0,void 0,void 0,Ut),stencilBuffer:S.stencil,colorSpace:t.outputColorSpace,samples:S.antialias?4:0});let $t=t.properties.get(R);$t.__ignoreDepthValues=x.ignoreDepthValues}R.isXRRenderTarget=!0,this.setFoveation(g),m=null,p=yield s.requestReferenceSpace(h),ae.setContext(s),ae.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode};function At(ut){for(let Ut=0;Ut<ut.removed.length;Ut++){let jt=ut.removed[Ut],ce=F.indexOf(jt);ce>=0&&(F[ce]=null,C[ce].disconnect(jt))}for(let Ut=0;Ut<ut.added.length;Ut++){let jt=ut.added[Ut],ce=F.indexOf(jt);if(ce===-1){for(let $t=0;$t<C.length;$t++)if($t>=F.length){F.push(jt),ce=$t;break}else if(F[$t]===null){F[$t]=jt,ce=$t;break}if(ce===-1)break}let te=C[ce];te&&te.connect(jt)}}let Mt=new Pt,Lt=new Pt;function pt(ut,Ut,jt){Mt.setFromMatrixPosition(Ut.matrixWorld),Lt.setFromMatrixPosition(jt.matrixWorld);let ce=Mt.distanceTo(Lt),te=Ut.projectionMatrix.elements,$t=jt.projectionMatrix.elements,qt=te[14]/(te[10]-1),xe=te[14]/(te[10]+1),ft=(te[9]+1)/te[5],Xe=(te[9]-1)/te[5],ee=(te[8]-1)/te[0],ge=($t[8]+1)/$t[0],fe=qt*ee,Te=qt*ge,be=ce/(-ee+ge),Wt=be*-ee;Ut.matrixWorld.decompose(ut.position,ut.quaternion,ut.scale),ut.translateX(Wt),ut.translateZ(be),ut.matrixWorld.compose(ut.position,ut.quaternion,ut.scale),ut.matrixWorldInverse.copy(ut.matrixWorld).invert();let Me=qt+be,tt=xe+be,z=fe-Wt,It=Te+(ce-Wt),Ot=ft*xe/tt*Me,dt=Xe*xe/tt*Me;ut.projectionMatrix.makePerspective(z,It,Ot,dt,Me,tt),ut.projectionMatrixInverse.copy(ut.projectionMatrix).invert()}function yt(ut,Ut){Ut===null?ut.matrixWorld.copy(ut.matrix):ut.matrixWorld.multiplyMatrices(Ut.matrixWorld,ut.matrix),ut.matrixWorldInverse.copy(ut.matrixWorld).invert()}this.updateCamera=function(ut){if(s===null)return;I.texture!==null&&(ut.near=I.depthNear,ut.far=I.depthFar),B.near=D.near=q.near=ut.near,B.far=D.far=q.far=ut.far,(j!==B.near||J!==B.far)&&(s.updateRenderState({depthNear:B.near,depthFar:B.far}),j=B.near,J=B.far,q.near=j,q.far=J,D.near=j,D.far=J,q.updateProjectionMatrix(),D.updateProjectionMatrix(),ut.updateProjectionMatrix());let Ut=ut.parent,jt=B.cameras;yt(B,Ut);for(let ce=0;ce<jt.length;ce++)yt(jt[ce],Ut);jt.length===2?pt(B,q,D):B.projectionMatrix.copy(q.projectionMatrix),K(ut,B,Ut)};function K(ut,Ut,jt){jt===null?ut.matrix.copy(Ut.matrixWorld):(ut.matrix.copy(jt.matrixWorld),ut.matrix.invert(),ut.matrix.multiply(Ut.matrixWorld)),ut.matrix.decompose(ut.position,ut.quaternion,ut.scale),ut.updateMatrixWorld(!0),ut.projectionMatrix.copy(Ut.projectionMatrix),ut.projectionMatrixInverse.copy(Ut.projectionMatrixInverse),ut.isPerspectiveCamera&&(ut.fov=Jy*2*Math.atan(1/ut.projectionMatrix.elements[5]),ut.zoom=1)}this.getCamera=function(){return B},this.getFoveation=function(){if(!(x===null&&b===null))return g},this.setFoveation=function(ut){g=ut,x!==null&&(x.fixedFoveation=ut),b!==null&&b.fixedFoveation!==void 0&&(b.fixedFoveation=ut)},this.hasDepthSensing=function(){return I.texture!==null};let Bt=null;function Gt(ut,Ut){if(_=Ut.getViewerPose(m||p),T=Ut,_!==null){let jt=_.views;b!==null&&(t.setRenderTargetFramebuffer(R,b.framebuffer),t.setRenderTarget(R));let ce=!1;jt.length!==B.cameras.length&&(B.cameras.length=0,ce=!0);for(let $t=0;$t<jt.length;$t++){let qt=jt[$t],xe=null;if(b!==null)xe=b.getViewport(qt);else{let Xe=w.getViewSubImage(x,qt);xe=Xe.viewport,$t===0&&(t.setRenderTargetTextures(R,Xe.colorTexture,x.ignoreDepthValues?void 0:Xe.depthStencilTexture),t.setRenderTarget(R))}let ft=xt[$t];ft===void 0&&(ft=new gs,ft.layers.enable($t),ft.viewport=new ji,xt[$t]=ft),ft.matrix.fromArray(qt.transform.matrix),ft.matrix.decompose(ft.position,ft.quaternion,ft.scale),ft.projectionMatrix.fromArray(qt.projectionMatrix),ft.projectionMatrixInverse.copy(ft.projectionMatrix).invert(),ft.viewport.set(xe.x,xe.y,xe.width,xe.height),$t===0&&(B.matrix.copy(ft.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),ce===!0&&B.cameras.push(ft)}let te=s.enabledFeatures;if(te&&te.includes("depth-sensing")){let $t=w.getDepthInformation(jt[0]);$t&&$t.isValid&&$t.texture&&I.init(t,$t,s.renderState)}}for(let jt=0;jt<C.length;jt++){let ce=F[jt],te=C[jt];ce!==null&&te!==void 0&&te.update(ce,Ut,m||p)}I.render(t,B),Bt&&Bt(ut,Ut),Ut.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:Ut}),T=null}let ae=new _C;ae.setAnimationLoop(Gt),this.setAnimationLoop=function(ut){Bt=ut},this.dispose=function(){}}},Cl=new Ul,cX=new vi;function fX(n,t){function e(S,E){S.matrixAutoUpdate===!0&&S.updateMatrix(),E.value.copy(S.matrix)}function o(S,E){E.color.getRGB(S.fogColor.value,vC(n)),E.isFog?(S.fogNear.value=E.near,S.fogFar.value=E.far):E.isFogExp2&&(S.fogDensity.value=E.density)}function s(S,E,R,C,F){E.isMeshBasicMaterial||E.isMeshLambertMaterial?c(S,E):E.isMeshToonMaterial?(c(S,E),w(S,E)):E.isMeshPhongMaterial?(c(S,E),_(S,E)):E.isMeshStandardMaterial?(c(S,E),x(S,E),E.isMeshPhysicalMaterial&&b(S,E,F)):E.isMeshMatcapMaterial?(c(S,E),T(S,E)):E.isMeshDepthMaterial?c(S,E):E.isMeshDistanceMaterial?(c(S,E),I(S,E)):E.isMeshNormalMaterial?c(S,E):E.isLineBasicMaterial?(p(S,E),E.isLineDashedMaterial&&h(S,E)):E.isPointsMaterial?g(S,E,R,C):E.isSpriteMaterial?m(S,E):E.isShadowMaterial?(S.color.value.copy(E.color),S.opacity.value=E.opacity):E.isShaderMaterial&&(E.uniformsNeedUpdate=!1)}function c(S,E){S.opacity.value=E.opacity,E.color&&S.diffuse.value.copy(E.color),E.emissive&&S.emissive.value.copy(E.emissive).multiplyScalar(E.emissiveIntensity),E.map&&(S.map.value=E.map,e(E.map,S.mapTransform)),E.alphaMap&&(S.alphaMap.value=E.alphaMap,e(E.alphaMap,S.alphaMapTransform)),E.bumpMap&&(S.bumpMap.value=E.bumpMap,e(E.bumpMap,S.bumpMapTransform),S.bumpScale.value=E.bumpScale,E.side===$o&&(S.bumpScale.value*=-1)),E.normalMap&&(S.normalMap.value=E.normalMap,e(E.normalMap,S.normalMapTransform),S.normalScale.value.copy(E.normalScale),E.side===$o&&S.normalScale.value.negate()),E.displacementMap&&(S.displacementMap.value=E.displacementMap,e(E.displacementMap,S.displacementMapTransform),S.displacementScale.value=E.displacementScale,S.displacementBias.value=E.displacementBias),E.emissiveMap&&(S.emissiveMap.value=E.emissiveMap,e(E.emissiveMap,S.emissiveMapTransform)),E.specularMap&&(S.specularMap.value=E.specularMap,e(E.specularMap,S.specularMapTransform)),E.alphaTest>0&&(S.alphaTest.value=E.alphaTest);let R=t.get(E),C=R.envMap,F=R.envMapRotation;if(C&&(S.envMap.value=C,Cl.copy(F),Cl.x*=-1,Cl.y*=-1,Cl.z*=-1,C.isCubeTexture&&C.isRenderTargetTexture===!1&&(Cl.y*=-1,Cl.z*=-1),S.envMapRotation.value.setFromMatrix4(cX.makeRotationFromEuler(Cl)),S.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=E.reflectivity,S.ior.value=E.ior,S.refractionRatio.value=E.refractionRatio),E.lightMap){S.lightMap.value=E.lightMap;let W=n._useLegacyLights===!0?Math.PI:1;S.lightMapIntensity.value=E.lightMapIntensity*W,e(E.lightMap,S.lightMapTransform)}E.aoMap&&(S.aoMap.value=E.aoMap,S.aoMapIntensity.value=E.aoMapIntensity,e(E.aoMap,S.aoMapTransform))}function p(S,E){S.diffuse.value.copy(E.color),S.opacity.value=E.opacity,E.map&&(S.map.value=E.map,e(E.map,S.mapTransform))}function h(S,E){S.dashSize.value=E.dashSize,S.totalSize.value=E.dashSize+E.gapSize,S.scale.value=E.scale}function g(S,E,R,C){S.diffuse.value.copy(E.color),S.opacity.value=E.opacity,S.size.value=E.size*R,S.scale.value=C*.5,E.map&&(S.map.value=E.map,e(E.map,S.uvTransform)),E.alphaMap&&(S.alphaMap.value=E.alphaMap,e(E.alphaMap,S.alphaMapTransform)),E.alphaTest>0&&(S.alphaTest.value=E.alphaTest)}function m(S,E){S.diffuse.value.copy(E.color),S.opacity.value=E.opacity,S.rotation.value=E.rotation,E.map&&(S.map.value=E.map,e(E.map,S.mapTransform)),E.alphaMap&&(S.alphaMap.value=E.alphaMap,e(E.alphaMap,S.alphaMapTransform)),E.alphaTest>0&&(S.alphaTest.value=E.alphaTest)}function _(S,E){S.specular.value.copy(E.specular),S.shininess.value=Math.max(E.shininess,1e-4)}function w(S,E){E.gradientMap&&(S.gradientMap.value=E.gradientMap)}function x(S,E){S.metalness.value=E.metalness,E.metalnessMap&&(S.metalnessMap.value=E.metalnessMap,e(E.metalnessMap,S.metalnessMapTransform)),S.roughness.value=E.roughness,E.roughnessMap&&(S.roughnessMap.value=E.roughnessMap,e(E.roughnessMap,S.roughnessMapTransform)),t.get(E).envMap&&(S.envMapIntensity.value=E.envMapIntensity)}function b(S,E,R){S.ior.value=E.ior,E.sheen>0&&(S.sheenColor.value.copy(E.sheenColor).multiplyScalar(E.sheen),S.sheenRoughness.value=E.sheenRoughness,E.sheenColorMap&&(S.sheenColorMap.value=E.sheenColorMap,e(E.sheenColorMap,S.sheenColorMapTransform)),E.sheenRoughnessMap&&(S.sheenRoughnessMap.value=E.sheenRoughnessMap,e(E.sheenRoughnessMap,S.sheenRoughnessMapTransform))),E.clearcoat>0&&(S.clearcoat.value=E.clearcoat,S.clearcoatRoughness.value=E.clearcoatRoughness,E.clearcoatMap&&(S.clearcoatMap.value=E.clearcoatMap,e(E.clearcoatMap,S.clearcoatMapTransform)),E.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=E.clearcoatRoughnessMap,e(E.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),E.clearcoatNormalMap&&(S.clearcoatNormalMap.value=E.clearcoatNormalMap,e(E.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(E.clearcoatNormalScale),E.side===$o&&S.clearcoatNormalScale.value.negate())),E.iridescence>0&&(S.iridescence.value=E.iridescence,S.iridescenceIOR.value=E.iridescenceIOR,S.iridescenceThicknessMinimum.value=E.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=E.iridescenceThicknessRange[1],E.iridescenceMap&&(S.iridescenceMap.value=E.iridescenceMap,e(E.iridescenceMap,S.iridescenceMapTransform)),E.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=E.iridescenceThicknessMap,e(E.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),E.transmission>0&&(S.transmission.value=E.transmission,S.transmissionSamplerMap.value=R.texture,S.transmissionSamplerSize.value.set(R.width,R.height),E.transmissionMap&&(S.transmissionMap.value=E.transmissionMap,e(E.transmissionMap,S.transmissionMapTransform)),S.thickness.value=E.thickness,E.thicknessMap&&(S.thicknessMap.value=E.thicknessMap,e(E.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=E.attenuationDistance,S.attenuationColor.value.copy(E.attenuationColor)),E.anisotropy>0&&(S.anisotropyVector.value.set(E.anisotropy*Math.cos(E.anisotropyRotation),E.anisotropy*Math.sin(E.anisotropyRotation)),E.anisotropyMap&&(S.anisotropyMap.value=E.anisotropyMap,e(E.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=E.specularIntensity,S.specularColor.value.copy(E.specularColor),E.specularColorMap&&(S.specularColorMap.value=E.specularColorMap,e(E.specularColorMap,S.specularColorMapTransform)),E.specularIntensityMap&&(S.specularIntensityMap.value=E.specularIntensityMap,e(E.specularIntensityMap,S.specularIntensityMapTransform))}function T(S,E){E.matcap&&(S.matcap.value=E.matcap)}function I(S,E){let R=t.get(E).light;S.referencePosition.value.setFromMatrixPosition(R.matrixWorld),S.nearDistance.value=R.shadow.camera.near,S.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:s}}function hX(n,t,e,o){let s={},c={},p=[],h=e.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function g(R,C){let F=C.program;o.uniformBlockBinding(R,F)}function m(R,C){let F=s[R.id];F===void 0&&(T(R),F=_(R),s[R.id]=F,R.addEventListener("dispose",S));let W=C.program;o.updateUBOMapping(R,W);let X=t.render.frame;c[R.id]!==X&&(x(R),c[R.id]=X)}function _(R){let C=w();R.__bindingPointIndex=C;let F=n.createBuffer(),W=R.__size,X=R.usage;return n.bindBuffer(n.UNIFORM_BUFFER,F),n.bufferData(n.UNIFORM_BUFFER,W,X),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,C,F),F}function w(){for(let R=0;R<h;R++)if(p.indexOf(R)===-1)return p.push(R),R;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function x(R){let C=s[R.id],F=R.uniforms,W=R.__cache;n.bindBuffer(n.UNIFORM_BUFFER,C);for(let X=0,q=F.length;X<q;X++){let D=Array.isArray(F[X])?F[X]:[F[X]];for(let xt=0,B=D.length;xt<B;xt++){let j=D[xt];if(b(j,X,xt,W)===!0){let J=j.__offset,Dt=Array.isArray(j.value)?j.value:[j.value],Q=0;for(let At=0;At<Dt.length;At++){let Mt=Dt[At],Lt=I(Mt);typeof Mt=="number"||typeof Mt=="boolean"?(j.__data[0]=Mt,n.bufferSubData(n.UNIFORM_BUFFER,J+Q,j.__data)):Mt.isMatrix3?(j.__data[0]=Mt.elements[0],j.__data[1]=Mt.elements[1],j.__data[2]=Mt.elements[2],j.__data[3]=0,j.__data[4]=Mt.elements[3],j.__data[5]=Mt.elements[4],j.__data[6]=Mt.elements[5],j.__data[7]=0,j.__data[8]=Mt.elements[6],j.__data[9]=Mt.elements[7],j.__data[10]=Mt.elements[8],j.__data[11]=0):(Mt.toArray(j.__data,Q),Q+=Lt.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,J,j.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function b(R,C,F,W){let X=R.value,q=C+"_"+F;if(W[q]===void 0)return typeof X=="number"||typeof X=="boolean"?W[q]=X:W[q]=X.clone(),!0;{let D=W[q];if(typeof X=="number"||typeof X=="boolean"){if(D!==X)return W[q]=X,!0}else if(D.equals(X)===!1)return D.copy(X),!0}return!1}function T(R){let C=R.uniforms,F=0,W=16;for(let q=0,D=C.length;q<D;q++){let xt=Array.isArray(C[q])?C[q]:[C[q]];for(let B=0,j=xt.length;B<j;B++){let J=xt[B],Dt=Array.isArray(J.value)?J.value:[J.value];for(let Q=0,At=Dt.length;Q<At;Q++){let Mt=Dt[Q],Lt=I(Mt),pt=F%W;pt!==0&&W-pt<Lt.boundary&&(F+=W-pt),J.__data=new Float32Array(Lt.storage/Float32Array.BYTES_PER_ELEMENT),J.__offset=F,F+=Lt.storage}}}let X=F%W;return X>0&&(F+=W-X),R.__size=F,R.__cache={},this}function I(R){let C={boundary:0,storage:0};return typeof R=="number"||typeof R=="boolean"?(C.boundary=4,C.storage=4):R.isVector2?(C.boundary=8,C.storage=8):R.isVector3||R.isColor?(C.boundary=16,C.storage=12):R.isVector4?(C.boundary=16,C.storage=16):R.isMatrix3?(C.boundary=48,C.storage=48):R.isMatrix4?(C.boundary=64,C.storage=64):R.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",R),C}function S(R){let C=R.target;C.removeEventListener("dispose",S);let F=p.indexOf(C.__bindingPointIndex);p.splice(F,1),n.deleteBuffer(s[C.id]),delete s[C.id],delete c[C.id]}function E(){for(let R in s)n.deleteBuffer(s[R]);p=[],s={},c={}}return{bind:g,update:m,dispose:E}}var gv=class{constructor(t={}){let{canvas:e=m6(),context:o=null,depth:s=!0,stencil:c=!0,alpha:p=!1,antialias:h=!1,premultipliedAlpha:g=!0,preserveDrawingBuffer:m=!1,powerPreference:_="default",failIfMajorPerformanceCaveat:w=!1}=t;this.isWebGLRenderer=!0;let x;o!==null?x=o.getContextAttributes().alpha:x=p;let b=new Uint32Array(4),T=new Int32Array(4),I=null,S=null,E=[],R=[];this.domElement=e,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=Aa,this._useLegacyLights=!1,this.toneMapping=Yu,this.toneMappingExposure=1;let C=this,F=!1,W=0,X=0,q=null,D=-1,xt=null,B=new ji,j=new ji,J=null,Dt=new ar(0),Q=0,At=e.width,Mt=e.height,Lt=1,pt=null,yt=null,K=new ji(0,0,At,Mt),Bt=new ji(0,0,At,Mt),Gt=!1,ae=new Bd,ut=!1,Ut=!1,jt=null,ce=new vi,te=new ze,$t=new Pt,qt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function xe(){return q===null?Lt:1}let ft=o;function Xe(Z,mt){for(let Rt=0;Rt<Z.length;Rt++){let St=Z[Rt],vt=e.getContext(St,mt);if(vt!==null)return vt}return null}try{let Z={alpha:!0,depth:s,stencil:c,antialias:h,premultipliedAlpha:g,preserveDrawingBuffer:m,powerPreference:_,failIfMajorPerformanceCaveat:w};if("setAttribute"in e&&e.setAttribute("data-engine",\`three.js r\${Iv}\`),e.addEventListener("webglcontextlost",Et,!1),e.addEventListener("webglcontextrestored",G,!1),e.addEventListener("webglcontextcreationerror",st,!1),ft===null){let mt=["webgl2","webgl","experimental-webgl"];if(C.isWebGL1Renderer===!0&&mt.shift(),ft=Xe(mt,Z),ft===null)throw Xe(mt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&ft instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),ft.getShaderPrecisionFormat===void 0&&(ft.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Z){throw console.error("THREE.WebGLRenderer: "+Z.message),Z}let ee,ge,fe,Te,be,Wt,Me,tt,z,It,Ot,dt,Ht,Ce,Vt,Zt,ne,rt,P,N,k,$,V,ht;function at(){ee=new CW(ft),ge=new wW(ft,ee,t),ee.init(ge),$=new sX(ft,ee,ge),fe=new iX(ft,ee,ge),Te=new RW(ft),be=new X9,Wt=new oX(ft,ee,fe,be,ge,$,Te),Me=new MW(C),tt=new TW(C),z=new U6(ft,ge),V=new xW(ft,ee,z,ge),It=new PW(ft,z,Te,V),Ot=new DW(ft,It,z,Te),P=new OW(ft,ge,Wt),Zt=new SW(be),dt=new W9(C,Me,tt,ee,ge,V,Zt),Ht=new fX(C,be),Ce=new $9,Vt=new tX(ee,ge),rt=new _W(C,Me,tt,fe,Ot,x,g),ne=new rX(C,Ot,ge),ht=new hX(ft,Te,ge,fe),N=new EW(ft,ee,Te,ge),k=new IW(ft,ee,Te,ge),Te.programs=dt.programs,C.capabilities=ge,C.extensions=ee,C.properties=be,C.renderLists=Ce,C.shadowMap=ne,C.state=fe,C.info=Te}at();let wt=new dv(C,ft);this.xr=wt,this.getContext=function(){return ft},this.getContextAttributes=function(){return ft.getContextAttributes()},this.forceContextLoss=function(){let Z=ee.get("WEBGL_lose_context");Z&&Z.loseContext()},this.forceContextRestore=function(){let Z=ee.get("WEBGL_lose_context");Z&&Z.restoreContext()},this.getPixelRatio=function(){return Lt},this.setPixelRatio=function(Z){Z!==void 0&&(Lt=Z,this.setSize(At,Mt,!1))},this.getSize=function(Z){return Z.set(At,Mt)},this.setSize=function(Z,mt,Rt=!0){if(wt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}At=Z,Mt=mt,e.width=Math.floor(Z*Lt),e.height=Math.floor(mt*Lt),Rt===!0&&(e.style.width=Z+"px",e.style.height=mt+"px"),this.setViewport(0,0,Z,mt)},this.getDrawingBufferSize=function(Z){return Z.set(At*Lt,Mt*Lt).floor()},this.setDrawingBufferSize=function(Z,mt,Rt){At=Z,Mt=mt,Lt=Rt,e.width=Math.floor(Z*Rt),e.height=Math.floor(mt*Rt),this.setViewport(0,0,Z,mt)},this.getCurrentViewport=function(Z){return Z.copy(B)},this.getViewport=function(Z){return Z.copy(K)},this.setViewport=function(Z,mt,Rt,St){Z.isVector4?K.set(Z.x,Z.y,Z.z,Z.w):K.set(Z,mt,Rt,St),fe.viewport(B.copy(K).multiplyScalar(Lt).round())},this.getScissor=function(Z){return Z.copy(Bt)},this.setScissor=function(Z,mt,Rt,St){Z.isVector4?Bt.set(Z.x,Z.y,Z.z,Z.w):Bt.set(Z,mt,Rt,St),fe.scissor(j.copy(Bt).multiplyScalar(Lt).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(Z){fe.setScissorTest(Gt=Z)},this.setOpaqueSort=function(Z){pt=Z},this.setTransparentSort=function(Z){yt=Z},this.getClearColor=function(Z){return Z.copy(rt.getClearColor())},this.setClearColor=function(){rt.setClearColor.apply(rt,arguments)},this.getClearAlpha=function(){return rt.getClearAlpha()},this.setClearAlpha=function(){rt.setClearAlpha.apply(rt,arguments)},this.clear=function(Z=!0,mt=!0,Rt=!0){let St=0;if(Z){let vt=!1;if(q!==null){let he=q.texture.format;vt=he===hC||he===fC||he===cC}if(vt){let he=q.texture.type,ue=he===$u||he===Wu||he===Rv||he===Ol||he===uC||he===lC,we=rt.getClearColor(),de=rt.getClearAlpha(),Be=we.r,Ae=we.g,Pe=we.b;ue?(b[0]=Be,b[1]=Ae,b[2]=Pe,b[3]=de,ft.clearBufferuiv(ft.COLOR,0,b)):(T[0]=Be,T[1]=Ae,T[2]=Pe,T[3]=de,ft.clearBufferiv(ft.COLOR,0,T))}else St|=ft.COLOR_BUFFER_BIT}mt&&(St|=ft.DEPTH_BUFFER_BIT),Rt&&(St|=ft.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ft.clear(St)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Et,!1),e.removeEventListener("webglcontextrestored",G,!1),e.removeEventListener("webglcontextcreationerror",st,!1),Ce.dispose(),Vt.dispose(),be.dispose(),Me.dispose(),tt.dispose(),Ot.dispose(),V.dispose(),ht.dispose(),dt.dispose(),ne.dispose(),wt.dispose(),wt.removeEventListener("sessionstart",He),wt.removeEventListener("sessionend",Ue),jt&&(jt.dispose(),jt=null),Ye.stop()};function Et(Z){Z.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),F=!0}function G(){console.log("THREE.WebGLRenderer: Context Restored."),F=!1;let Z=Te.autoReset,mt=ne.enabled,Rt=ne.autoUpdate,St=ne.needsUpdate,vt=ne.type;at(),Te.autoReset=Z,ne.enabled=mt,ne.autoUpdate=Rt,ne.needsUpdate=St,ne.type=vt}function st(Z){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",Z.statusMessage)}function et(Z){let mt=Z.target;mt.removeEventListener("dispose",et),lt(mt)}function lt(Z){Ft(Z),be.remove(Z)}function Ft(Z){let mt=be.get(Z).programs;mt!==void 0&&(mt.forEach(function(Rt){dt.releaseProgram(Rt)}),Z.isShaderMaterial&&dt.releaseShaderCache(Z))}this.renderBufferDirect=function(Z,mt,Rt,St,vt,he){mt===null&&(mt=qt);let ue=vt.isMesh&&vt.matrixWorld.determinant()<0,we=Qn(Z,mt,Rt,St,vt);fe.setMaterial(St,ue);let de=Rt.index,Be=1;if(St.wireframe===!0){if(de=It.getWireframeAttribute(Rt),de===void 0)return;Be=2}let Ae=Rt.drawRange,Pe=Rt.attributes.position,nn=Ae.start*Be,si=(Ae.start+Ae.count)*Be;he!==null&&(nn=Math.max(nn,he.start*Be),si=Math.min(si,(he.start+he.count)*Be)),de!==null?(nn=Math.max(nn,0),si=Math.min(si,de.count)):Pe!=null&&(nn=Math.max(nn,0),si=Math.min(si,Pe.count));let br=si-nn;if(br<0||br===1/0)return;V.setup(vt,St,we,Rt,de);let Vi,sr=N;if(de!==null&&(Vi=z.get(de),sr=k,sr.setIndex(Vi)),vt.isMesh)St.wireframe===!0?(fe.setLineWidth(St.wireframeLinewidth*xe()),sr.setMode(ft.LINES)):sr.setMode(ft.TRIANGLES);else if(vt.isLine){let ye=St.linewidth;ye===void 0&&(ye=1),fe.setLineWidth(ye*xe()),vt.isLineSegments?sr.setMode(ft.LINES):vt.isLineLoop?sr.setMode(ft.LINE_LOOP):sr.setMode(ft.LINE_STRIP)}else vt.isPoints?sr.setMode(ft.POINTS):vt.isSprite&&sr.setMode(ft.TRIANGLES);if(vt.isBatchedMesh)sr.renderMultiDraw(vt._multiDrawStarts,vt._multiDrawCounts,vt._multiDrawCount);else if(vt.isInstancedMesh)sr.renderInstances(nn,br,vt.count);else if(Rt.isInstancedBufferGeometry){let ye=Rt._maxInstanceCount!==void 0?Rt._maxInstanceCount:1/0,Ua=Math.min(Rt.instanceCount,ye);sr.renderInstances(nn,br,Ua)}else sr.render(nn,br)};function Kt(Z,mt,Rt){Z.transparent===!0&&Z.side===cu&&Z.forceSinglePass===!1?(Z.side=$o,Z.needsUpdate=!0,rr(Z,mt,Rt),Z.side=Ju,Z.needsUpdate=!0,rr(Z,mt,Rt),Z.side=cu):rr(Z,mt,Rt)}this.compile=function(Z,mt,Rt=null){Rt===null&&(Rt=Z),S=Vt.get(Rt),S.init(),R.push(S),Rt.traverseVisible(function(vt){vt.isLight&&vt.layers.test(mt.layers)&&(S.pushLight(vt),vt.castShadow&&S.pushShadow(vt))}),Z!==Rt&&Z.traverseVisible(function(vt){vt.isLight&&vt.layers.test(mt.layers)&&(S.pushLight(vt),vt.castShadow&&S.pushShadow(vt))}),S.setupLights(C._useLegacyLights);let St=new Set;return Z.traverse(function(vt){let he=vt.material;if(he)if(Array.isArray(he))for(let ue=0;ue<he.length;ue++){let we=he[ue];Kt(we,Rt,vt),St.add(we)}else Kt(he,Rt,vt),St.add(he)}),R.pop(),S=null,St},this.compileAsync=function(Z,mt,Rt=null){let St=this.compile(Z,mt,Rt);return new Promise(vt=>{function he(){if(St.forEach(function(ue){be.get(ue).currentProgram.isReady()&&St.delete(ue)}),St.size===0){vt(Z);return}setTimeout(he,10)}ee.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let me=null;function ve(Z){me&&me(Z)}function He(){Ye.stop()}function Ue(){Ye.start()}let Ye=new _C;Ye.setAnimationLoop(ve),typeof self!="undefined"&&Ye.setContext(self),this.setAnimationLoop=function(Z){me=Z,wt.setAnimationLoop(Z),Z===null?Ye.stop():Ye.start()},wt.addEventListener("sessionstart",He),wt.addEventListener("sessionend",Ue),this.render=function(Z,mt){if(mt!==void 0&&mt.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(F===!0)return;Z.matrixWorldAutoUpdate===!0&&Z.updateMatrixWorld(),mt.parent===null&&mt.matrixWorldAutoUpdate===!0&&mt.updateMatrixWorld(),wt.enabled===!0&&wt.isPresenting===!0&&(wt.cameraAutoUpdate===!0&&wt.updateCamera(mt),mt=wt.getCamera()),Z.isScene===!0&&Z.onBeforeRender(C,Z,mt,q),S=Vt.get(Z,R.length),S.init(),R.push(S),ce.multiplyMatrices(mt.projectionMatrix,mt.matrixWorldInverse),ae.setFromProjectionMatrix(ce),Ut=this.localClippingEnabled,ut=Zt.init(this.clippingPlanes,Ut),I=Ce.get(Z,E.length),I.init(),E.push(I),je(Z,mt,0,C.sortObjects),I.finish(),C.sortObjects===!0&&I.sort(pt,yt),this.info.render.frame++,ut===!0&&Zt.beginShadows();let Rt=S.state.shadowsArray;if(ne.render(Rt,Z,mt),ut===!0&&Zt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(wt.enabled===!1||wt.isPresenting===!1||wt.hasDepthSensing()===!1)&&rt.render(I,Z),S.setupLights(C._useLegacyLights),mt.isArrayCamera){let St=mt.cameras;for(let vt=0,he=St.length;vt<he;vt++){let ue=St[vt];wr(I,Z,ue,ue.viewport)}}else wr(I,Z,mt);q!==null&&(Wt.updateMultisampleRenderTarget(q),Wt.updateRenderTargetMipmap(q)),Z.isScene===!0&&Z.onAfterRender(C,Z,mt),V.resetDefaultState(),D=-1,xt=null,R.pop(),R.length>0?S=R[R.length-1]:S=null,E.pop(),E.length>0?I=E[E.length-1]:I=null};function je(Z,mt,Rt,St){if(Z.visible===!1)return;if(Z.layers.test(mt.layers)){if(Z.isGroup)Rt=Z.renderOrder;else if(Z.isLOD)Z.autoUpdate===!0&&Z.update(mt);else if(Z.isLight)S.pushLight(Z),Z.castShadow&&S.pushShadow(Z);else if(Z.isSprite){if(!Z.frustumCulled||ae.intersectsSprite(Z)){St&&$t.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(ce);let ue=Ot.update(Z),we=Z.material;we.visible&&I.push(Z,ue,we,Rt,$t.z,null)}}else if((Z.isMesh||Z.isLine||Z.isPoints)&&(!Z.frustumCulled||ae.intersectsObject(Z))){let ue=Ot.update(Z),we=Z.material;if(St&&(Z.boundingSphere!==void 0?(Z.boundingSphere===null&&Z.computeBoundingSphere(),$t.copy(Z.boundingSphere.center)):(ue.boundingSphere===null&&ue.computeBoundingSphere(),$t.copy(ue.boundingSphere.center)),$t.applyMatrix4(Z.matrixWorld).applyMatrix4(ce)),Array.isArray(we)){let de=ue.groups;for(let Be=0,Ae=de.length;Be<Ae;Be++){let Pe=de[Be],nn=we[Pe.materialIndex];nn&&nn.visible&&I.push(Z,ue,nn,Rt,$t.z,Pe)}}else we.visible&&I.push(Z,ue,we,Rt,$t.z,null)}}let he=Z.children;for(let ue=0,we=he.length;ue<we;ue++)je(he[ue],mt,Rt,St)}function wr(Z,mt,Rt,St){let vt=Z.opaque,he=Z.transmissive,ue=Z.transparent;S.setupLightsView(Rt),ut===!0&&Zt.setGlobalState(C.clippingPlanes,Rt),he.length>0&&Jr(vt,he,mt,Rt),St&&fe.viewport(B.copy(St)),vt.length>0&&nr(vt,mt,Rt),he.length>0&&nr(he,mt,Rt),ue.length>0&&nr(ue,mt,Rt),fe.buffers.depth.setTest(!0),fe.buffers.depth.setMask(!0),fe.buffers.color.setMask(!0),fe.setPolygonOffset(!1)}function Jr(Z,mt,Rt,St){if((Rt.isScene===!0?Rt.overrideMaterial:null)!==null)return;let he=ge.isWebGL2;jt===null&&(jt=new du(1,1,{generateMipmaps:!0,type:ee.has("EXT_color_buffer_half_float")?oh:$u,minFilter:Ll,samples:he?4:0})),C.getDrawingBufferSize(te),he?jt.setSize(te.x,te.y):jt.setSize(Ky(te.x),Ky(te.y));let ue=C.getRenderTarget();C.setRenderTarget(jt),C.getClearColor(Dt),Q=C.getClearAlpha(),Q<1&&C.setClearColor(16777215,.5),C.clear();let we=C.toneMapping;C.toneMapping=Yu,nr(Z,Rt,St),Wt.updateMultisampleRenderTarget(jt),Wt.updateRenderTargetMipmap(jt);let de=!1;for(let Be=0,Ae=mt.length;Be<Ae;Be++){let Pe=mt[Be],nn=Pe.object,si=Pe.geometry,br=Pe.material,Vi=Pe.group;if(br.side===cu&&nn.layers.test(St.layers)){let sr=br.side;br.side=$o,br.needsUpdate=!0,Ie(nn,Rt,St,si,br,Vi),br.side=sr,br.needsUpdate=!0,de=!0}}de===!0&&(Wt.updateMultisampleRenderTarget(jt),Wt.updateRenderTargetMipmap(jt)),C.setRenderTarget(ue),C.setClearColor(Dt,Q),C.toneMapping=we}function nr(Z,mt,Rt){let St=mt.isScene===!0?mt.overrideMaterial:null;for(let vt=0,he=Z.length;vt<he;vt++){let ue=Z[vt],we=ue.object,de=ue.geometry,Be=St===null?ue.material:St,Ae=ue.group;we.layers.test(Rt.layers)&&Ie(we,mt,Rt,de,Be,Ae)}}function Ie(Z,mt,Rt,St,vt,he){Z.onBeforeRender(C,mt,Rt,St,vt,he),Z.modelViewMatrix.multiplyMatrices(Rt.matrixWorldInverse,Z.matrixWorld),Z.normalMatrix.getNormalMatrix(Z.modelViewMatrix),vt.onBeforeRender(C,mt,Rt,St,Z,he),vt.transparent===!0&&vt.side===cu&&vt.forceSinglePass===!1?(vt.side=$o,vt.needsUpdate=!0,C.renderBufferDirect(Rt,mt,St,vt,Z,he),vt.side=Ju,vt.needsUpdate=!0,C.renderBufferDirect(Rt,mt,St,vt,Z,he),vt.side=cu):C.renderBufferDirect(Rt,mt,St,vt,Z,he),Z.onAfterRender(C,mt,Rt,St,vt,he)}function rr(Z,mt,Rt){mt.isScene!==!0&&(mt=qt);let St=be.get(Z),vt=S.state.lights,he=S.state.shadowsArray,ue=vt.state.version,we=dt.getParameters(Z,vt.state,he,mt,Rt),de=dt.getProgramCacheKey(we),Be=St.programs;St.environment=Z.isMeshStandardMaterial?mt.environment:null,St.fog=mt.fog,St.envMap=(Z.isMeshStandardMaterial?tt:Me).get(Z.envMap||St.environment),St.envMapRotation=St.environment!==null&&Z.envMap===null?mt.environmentRotation:Z.envMapRotation,Be===void 0&&(Z.addEventListener("dispose",et),Be=new Map,St.programs=Be);let Ae=Be.get(de);if(Ae!==void 0){if(St.currentProgram===Ae&&St.lightsStateVersion===ue)return ur(Z,we),Ae}else we.uniforms=dt.getUniforms(Z),Z.onBuild(Rt,we,C),Z.onBeforeCompile(we,C),Ae=dt.acquireProgram(we,de),Be.set(de,Ae),St.uniforms=we.uniforms;let Pe=St.uniforms;return(!Z.isShaderMaterial&&!Z.isRawShaderMaterial||Z.clipping===!0)&&(Pe.clippingPlanes=Zt.uniform),ur(Z,we),St.needsLights=oi(Z),St.lightsStateVersion=ue,St.needsLights&&(Pe.ambientLightColor.value=vt.state.ambient,Pe.lightProbe.value=vt.state.probe,Pe.directionalLights.value=vt.state.directional,Pe.directionalLightShadows.value=vt.state.directionalShadow,Pe.spotLights.value=vt.state.spot,Pe.spotLightShadows.value=vt.state.spotShadow,Pe.rectAreaLights.value=vt.state.rectArea,Pe.ltc_1.value=vt.state.rectAreaLTC1,Pe.ltc_2.value=vt.state.rectAreaLTC2,Pe.pointLights.value=vt.state.point,Pe.pointLightShadows.value=vt.state.pointShadow,Pe.hemisphereLights.value=vt.state.hemi,Pe.directionalShadowMap.value=vt.state.directionalShadowMap,Pe.directionalShadowMatrix.value=vt.state.directionalShadowMatrix,Pe.spotShadowMap.value=vt.state.spotShadowMap,Pe.spotLightMatrix.value=vt.state.spotLightMatrix,Pe.spotLightMap.value=vt.state.spotLightMap,Pe.pointShadowMap.value=vt.state.pointShadowMap,Pe.pointShadowMatrix.value=vt.state.pointShadowMatrix),St.currentProgram=Ae,St.uniformsList=null,Ae}function pr(Z){if(Z.uniformsList===null){let mt=Z.currentProgram.getUniforms();Z.uniformsList=kc.seqWithValue(mt.seq,Z.uniforms)}return Z.uniformsList}function ur(Z,mt){let Rt=be.get(Z);Rt.outputColorSpace=mt.outputColorSpace,Rt.batching=mt.batching,Rt.instancing=mt.instancing,Rt.instancingColor=mt.instancingColor,Rt.instancingMorph=mt.instancingMorph,Rt.skinning=mt.skinning,Rt.morphTargets=mt.morphTargets,Rt.morphNormals=mt.morphNormals,Rt.morphColors=mt.morphColors,Rt.morphTargetsCount=mt.morphTargetsCount,Rt.numClippingPlanes=mt.numClippingPlanes,Rt.numIntersection=mt.numClipIntersection,Rt.vertexAlphas=mt.vertexAlphas,Rt.vertexTangents=mt.vertexTangents,Rt.toneMapping=mt.toneMapping}function Qn(Z,mt,Rt,St,vt){mt.isScene!==!0&&(mt=qt),Wt.resetTextureUnits();let he=mt.fog,ue=St.isMeshStandardMaterial?mt.environment:null,we=q===null?C.outputColorSpace:q.isXRRenderTarget===!0?q.texture.colorSpace:tl,de=(St.isMeshStandardMaterial?tt:Me).get(St.envMap||ue),Be=St.vertexColors===!0&&!!Rt.attributes.color&&Rt.attributes.color.itemSize===4,Ae=!!Rt.attributes.tangent&&(!!St.normalMap||St.anisotropy>0),Pe=!!Rt.morphAttributes.position,nn=!!Rt.morphAttributes.normal,si=!!Rt.morphAttributes.color,br=Yu;St.toneMapped&&(q===null||q.isXRRenderTarget===!0)&&(br=C.toneMapping);let Vi=Rt.morphAttributes.position||Rt.morphAttributes.normal||Rt.morphAttributes.color,sr=Vi!==void 0?Vi.length:0,ye=be.get(St),Ua=S.state.lights;if(ut===!0&&(Ut===!0||Z!==xt)){let Ai=Z===xt&&St.id===D;Zt.setState(St,Z,Ai)}let rn=!1;St.version===ye.__version?(ye.needsLights&&ye.lightsStateVersion!==Ua.state.version||ye.outputColorSpace!==we||vt.isBatchedMesh&&ye.batching===!1||!vt.isBatchedMesh&&ye.batching===!0||vt.isInstancedMesh&&ye.instancing===!1||!vt.isInstancedMesh&&ye.instancing===!0||vt.isSkinnedMesh&&ye.skinning===!1||!vt.isSkinnedMesh&&ye.skinning===!0||vt.isInstancedMesh&&ye.instancingColor===!0&&vt.instanceColor===null||vt.isInstancedMesh&&ye.instancingColor===!1&&vt.instanceColor!==null||vt.isInstancedMesh&&ye.instancingMorph===!0&&vt.morphTexture===null||vt.isInstancedMesh&&ye.instancingMorph===!1&&vt.morphTexture!==null||ye.envMap!==de||St.fog===!0&&ye.fog!==he||ye.numClippingPlanes!==void 0&&(ye.numClippingPlanes!==Zt.numPlanes||ye.numIntersection!==Zt.numIntersection)||ye.vertexAlphas!==Be||ye.vertexTangents!==Ae||ye.morphTargets!==Pe||ye.morphNormals!==nn||ye.morphColors!==si||ye.toneMapping!==br||ge.isWebGL2===!0&&ye.morphTargetsCount!==sr)&&(rn=!0):(rn=!0,ye.__version=St.version);let fo=ye.currentProgram;rn===!0&&(fo=rr(St,mt,vt));let ul=!1,Ge=!1,vs=!1,ir=fo.getUniforms(),Qo=ye.uniforms;if(fe.useProgram(fo.program)&&(ul=!0,Ge=!0,vs=!0),St.id!==D&&(D=St.id,Ge=!0),ul||xt!==Z){ir.setValue(ft,"projectionMatrix",Z.projectionMatrix),ir.setValue(ft,"viewMatrix",Z.matrixWorldInverse);let Ai=ir.map.cameraPosition;Ai!==void 0&&Ai.setValue(ft,$t.setFromMatrixPosition(Z.matrixWorld)),ge.logarithmicDepthBuffer&&ir.setValue(ft,"logDepthBufFC",2/(Math.log(Z.far+1)/Math.LN2)),(St.isMeshPhongMaterial||St.isMeshToonMaterial||St.isMeshLambertMaterial||St.isMeshBasicMaterial||St.isMeshStandardMaterial||St.isShaderMaterial)&&ir.setValue(ft,"isOrthographic",Z.isOrthographicCamera===!0),xt!==Z&&(xt=Z,Ge=!0,vs=!0)}if(vt.isSkinnedMesh){ir.setOptional(ft,vt,"bindMatrix"),ir.setOptional(ft,vt,"bindMatrixInverse");let Ai=vt.skeleton;Ai&&(ge.floatVertexTextures?(Ai.boneTexture===null&&Ai.computeBoneTexture(),ir.setValue(ft,"boneTexture",Ai.boneTexture,Wt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}vt.isBatchedMesh&&(ir.setOptional(ft,vt,"batchingTexture"),ir.setValue(ft,"batchingTexture",vt._matricesTexture,Wt));let Le=Rt.morphAttributes;if((Le.position!==void 0||Le.normal!==void 0||Le.color!==void 0&&ge.isWebGL2===!0)&&P.update(vt,Rt,fo),(Ge||ye.receiveShadow!==vt.receiveShadow)&&(ye.receiveShadow=vt.receiveShadow,ir.setValue(ft,"receiveShadow",vt.receiveShadow)),St.isMeshGouraudMaterial&&St.envMap!==null&&(Qo.envMap.value=de,Qo.flipEnvMap.value=de.isCubeTexture&&de.isRenderTargetTexture===!1?-1:1),Ge&&(ir.setValue(ft,"toneMappingExposure",C.toneMappingExposure),ye.needsLights&&bi(Qo,vs),he&&St.fog===!0&&Ht.refreshFogUniforms(Qo,he),Ht.refreshMaterialUniforms(Qo,St,Lt,Mt,jt),kc.upload(ft,pr(ye),Qo,Wt)),St.isShaderMaterial&&St.uniformsNeedUpdate===!0&&(kc.upload(ft,pr(ye),Qo,Wt),St.uniformsNeedUpdate=!1),St.isSpriteMaterial&&ir.setValue(ft,"center",vt.center),ir.setValue(ft,"modelViewMatrix",vt.modelViewMatrix),ir.setValue(ft,"normalMatrix",vt.normalMatrix),ir.setValue(ft,"modelMatrix",vt.matrixWorld),St.isShaderMaterial||St.isRawShaderMaterial){let Ai=St.uniformsGroups;for(let Ba=0,mu=Ai.length;Ba<mu;Ba++)if(ge.isWebGL2){let Ti=Ai[Ba];ht.update(Ti,fo),ht.bind(Ti,fo)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return fo}function bi(Z,mt){Z.ambientLightColor.needsUpdate=mt,Z.lightProbe.needsUpdate=mt,Z.directionalLights.needsUpdate=mt,Z.directionalLightShadows.needsUpdate=mt,Z.pointLights.needsUpdate=mt,Z.pointLightShadows.needsUpdate=mt,Z.spotLights.needsUpdate=mt,Z.spotLightShadows.needsUpdate=mt,Z.rectAreaLights.needsUpdate=mt,Z.hemisphereLights.needsUpdate=mt}function oi(Z){return Z.isMeshLambertMaterial||Z.isMeshToonMaterial||Z.isMeshPhongMaterial||Z.isMeshStandardMaterial||Z.isShadowMaterial||Z.isShaderMaterial&&Z.lights===!0}this.getActiveCubeFace=function(){return W},this.getActiveMipmapLevel=function(){return X},this.getRenderTarget=function(){return q},this.setRenderTargetTextures=function(Z,mt,Rt){be.get(Z.texture).__webglTexture=mt,be.get(Z.depthTexture).__webglTexture=Rt;let St=be.get(Z);St.__hasExternalTextures=!0,St.__autoAllocateDepthBuffer=Rt===void 0,St.__autoAllocateDepthBuffer||ee.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),St.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(Z,mt){let Rt=be.get(Z);Rt.__webglFramebuffer=mt,Rt.__useDefaultFramebuffer=mt===void 0},this.setRenderTarget=function(Z,mt=0,Rt=0){q=Z,W=mt,X=Rt;let St=!0,vt=null,he=!1,ue=!1;if(Z){let de=be.get(Z);de.__useDefaultFramebuffer!==void 0?(fe.bindFramebuffer(ft.FRAMEBUFFER,null),St=!1):de.__webglFramebuffer===void 0?Wt.setupRenderTarget(Z):de.__hasExternalTextures&&Wt.rebindTextures(Z,be.get(Z.texture).__webglTexture,be.get(Z.depthTexture).__webglTexture);let Be=Z.texture;(Be.isData3DTexture||Be.isDataArrayTexture||Be.isCompressedArrayTexture)&&(ue=!0);let Ae=be.get(Z).__webglFramebuffer;Z.isWebGLCubeRenderTarget?(Array.isArray(Ae[mt])?vt=Ae[mt][Rt]:vt=Ae[mt],he=!0):ge.isWebGL2&&Z.samples>0&&Wt.useMultisampledRTT(Z)===!1?vt=be.get(Z).__webglMultisampledFramebuffer:Array.isArray(Ae)?vt=Ae[Rt]:vt=Ae,B.copy(Z.viewport),j.copy(Z.scissor),J=Z.scissorTest}else B.copy(K).multiplyScalar(Lt).floor(),j.copy(Bt).multiplyScalar(Lt).floor(),J=Gt;if(fe.bindFramebuffer(ft.FRAMEBUFFER,vt)&&ge.drawBuffers&&St&&fe.drawBuffers(Z,vt),fe.viewport(B),fe.scissor(j),fe.setScissorTest(J),he){let de=be.get(Z.texture);ft.framebufferTexture2D(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,ft.TEXTURE_CUBE_MAP_POSITIVE_X+mt,de.__webglTexture,Rt)}else if(ue){let de=be.get(Z.texture),Be=mt||0;ft.framebufferTextureLayer(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,de.__webglTexture,Rt||0,Be)}D=-1},this.readRenderTargetPixels=function(Z,mt,Rt,St,vt,he,ue){if(!(Z&&Z.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=be.get(Z).__webglFramebuffer;if(Z.isWebGLCubeRenderTarget&&ue!==void 0&&(we=we[ue]),we){fe.bindFramebuffer(ft.FRAMEBUFFER,we);try{let de=Z.texture,Be=de.format,Ae=de.type;if(Be!==na&&$.convert(Be)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Pe=Ae===oh&&(ee.has("EXT_color_buffer_half_float")||ge.isWebGL2&&ee.has("EXT_color_buffer_float"));if(Ae!==$u&&$.convert(Ae)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ae===fu&&(ge.isWebGL2||ee.has("OES_texture_float")||ee.has("WEBGL_color_buffer_float")))&&!Pe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}mt>=0&&mt<=Z.width-St&&Rt>=0&&Rt<=Z.height-vt&&ft.readPixels(mt,Rt,St,vt,$.convert(Be),$.convert(Ae),he)}finally{let de=q!==null?be.get(q).__webglFramebuffer:null;fe.bindFramebuffer(ft.FRAMEBUFFER,de)}}},this.copyFramebufferToTexture=function(Z,mt,Rt=0){let St=Math.pow(2,-Rt),vt=Math.floor(mt.image.width*St),he=Math.floor(mt.image.height*St);Wt.setTexture2D(mt,0),ft.copyTexSubImage2D(ft.TEXTURE_2D,Rt,0,0,Z.x,Z.y,vt,he),fe.unbindTexture()},this.copyTextureToTexture=function(Z,mt,Rt,St=0){let vt=mt.image.width,he=mt.image.height,ue=$.convert(Rt.format),we=$.convert(Rt.type);Wt.setTexture2D(Rt,0),ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,Rt.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Rt.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,Rt.unpackAlignment),mt.isDataTexture?ft.texSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,vt,he,ue,we,mt.image.data):mt.isCompressedTexture?ft.compressedTexSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,mt.mipmaps[0].width,mt.mipmaps[0].height,ue,mt.mipmaps[0].data):ft.texSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,ue,we,mt.image),St===0&&Rt.generateMipmaps&&ft.generateMipmap(ft.TEXTURE_2D),fe.unbindTexture()},this.copyTextureToTexture3D=function(Z,mt,Rt,St,vt=0){if(C.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let he=Math.round(Z.max.x-Z.min.x),ue=Math.round(Z.max.y-Z.min.y),we=Z.max.z-Z.min.z+1,de=$.convert(St.format),Be=$.convert(St.type),Ae;if(St.isData3DTexture)Wt.setTexture3D(St,0),Ae=ft.TEXTURE_3D;else if(St.isDataArrayTexture||St.isCompressedArrayTexture)Wt.setTexture2DArray(St,0),Ae=ft.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,St.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,St.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,St.unpackAlignment);let Pe=ft.getParameter(ft.UNPACK_ROW_LENGTH),nn=ft.getParameter(ft.UNPACK_IMAGE_HEIGHT),si=ft.getParameter(ft.UNPACK_SKIP_PIXELS),br=ft.getParameter(ft.UNPACK_SKIP_ROWS),Vi=ft.getParameter(ft.UNPACK_SKIP_IMAGES),sr=Rt.isCompressedTexture?Rt.mipmaps[vt]:Rt.image;ft.pixelStorei(ft.UNPACK_ROW_LENGTH,sr.width),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,sr.height),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,Z.min.x),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,Z.min.y),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,Z.min.z),Rt.isDataTexture||Rt.isData3DTexture?ft.texSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,Be,sr.data):St.isCompressedArrayTexture?ft.compressedTexSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,sr.data):ft.texSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,Be,sr),ft.pixelStorei(ft.UNPACK_ROW_LENGTH,Pe),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,nn),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,si),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,br),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,Vi),vt===0&&St.generateMipmaps&&ft.generateMipmap(Ae),fe.unbindTexture()},this.initTexture=function(Z){Z.isCubeTexture?Wt.setTextureCube(Z,0):Z.isData3DTexture?Wt.setTexture3D(Z,0):Z.isDataArrayTexture||Z.isCompressedArrayTexture?Wt.setTexture2DArray(Z,0):Wt.setTexture2D(Z,0),fe.unbindTexture()},this.resetState=function(){W=0,X=0,q=null,fe.reset(),V.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return hu}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Lv?"display-p3":"srgb",e.unpackColorSpace=xr.workingColorSpace===Vd?"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(t){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=t}},mv=class extends gv{};mv.prototype.isWebGL1Renderer=!0;var yv=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=$y,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Zu()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return mC("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,o){t*=this.stride,o*=e.stride;for(let s=0,c=this.stride;s<c;s++)this.array[t+s]=e.array[o+s];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Zu()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),o=new this.constructor(e,this.stride);return o.setUsage(this.usage),o}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Zu()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.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}}},wo=new Pt,qd=class n{constructor(t,e,o,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=o,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,o=this.data.count;e<o;e++)wo.fromBufferAttribute(this,e),wo.applyMatrix4(t),this.setXYZ(e,wo.x,wo.y,wo.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)wo.fromBufferAttribute(this,e),wo.applyNormalMatrix(t),this.setXYZ(e,wo.x,wo.y,wo.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)wo.fromBufferAttribute(this,e),wo.transformDirection(t),this.setXYZ(e,wo.x,wo.y,wo.z);return this}getComponent(t,e){let o=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(o=Ca(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=_r(o,this.array)),this.data.array[t*this.data.stride+this.offset+e]=o,this}setX(t,e){return this.normalized&&(e=_r(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=_r(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=_r(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=_r(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Ca(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Ca(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Ca(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Ca(e,this.array)),e}setXY(t,e,o){return t=t*this.data.stride+this.offset,this.normalized&&(e=_r(e,this.array),o=_r(o,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this}setXYZ(t,e,o,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=_r(e,this.array),o=_r(o,this.array),s=_r(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this.data.array[t+2]=s,this}setXYZW(t,e,o,s,c){return t=t*this.data.stride+this.offset,this.normalized&&(e=_r(e,this.array),o=_r(o,this.array),s=_r(s,this.array),c=_r(c,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this.data.array[t+2]=s,this.data.array[t+3]=c,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let o=0;o<this.count;o++){let s=o*this.data.stride+this.offset;for(let c=0;c<this.itemSize;c++)e.push(this.data.array[s+c])}return new ms(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new n(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let o=0;o<this.count;o++){let s=o*this.data.stride+this.offset;for(let c=0;c<this.itemSize;c++)e.push(this.data.array[s+c])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},vv=class extends Bl{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ar(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},Hu,eh=new Pt,Nc=new Pt,Oc=new Pt,Dc=new ze,nh=new ze,bC=new vi,yd=new Pt,rh=new Pt,vd=new Pt,nC=new ze,ky=new ze,rC=new ze,_v=class extends ia{constructor(t=new vv){if(super(),this.isSprite=!0,this.type="Sprite",Hu===void 0){Hu=new Qu;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),o=new yv(e,5);Hu.setIndex([0,1,2,0,2,3]),Hu.setAttribute("position",new qd(o,3,0,!1)),Hu.setAttribute("uv",new qd(o,2,3,!1))}this.geometry=Hu,this.material=t,this.center=new ze(.5,.5)}raycast(t,e){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Nc.setFromMatrixScale(this.matrixWorld),bC.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Oc.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Nc.multiplyScalar(-Oc.z);let o=this.material.rotation,s,c;o!==0&&(c=Math.cos(o),s=Math.sin(o));let p=this.center;_d(yd.set(-.5,-.5,0),Oc,p,Nc,s,c),_d(rh.set(.5,-.5,0),Oc,p,Nc,s,c),_d(vd.set(.5,.5,0),Oc,p,Nc,s,c),nC.set(0,0),ky.set(1,0),rC.set(1,1);let h=t.ray.intersectTriangle(yd,rh,vd,!1,eh);if(h===null&&(_d(rh.set(-.5,.5,0),Oc,p,Nc,s,c),ky.set(0,1),h=t.ray.intersectTriangle(yd,vd,rh,!1,eh),h===null))return;let g=t.ray.origin.distanceTo(eh);g<t.near||g>t.far||e.push({distance:g,point:eh.clone(),uv:Nl.getInterpolation(eh,yd,rh,vd,nC,ky,rC,new ze),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}};_v.Dispose=function(){Hu.dispose(),Hu=void 0};function _d(n,t,e,o,s,c){Dc.subVectors(n,e).addScalar(.5).multiply(o),s!==void 0?(nh.x=c*Dc.x-s*Dc.y,nh.y=s*Dc.x+c*Dc.y):nh.copy(Dc),n.copy(t),n.x+=nh.x,n.y+=nh.y,n.applyMatrix4(bC)}function xd(n,t,e){return!n||!e&&n.constructor===t?n:typeof t.BYTES_PER_ELEMENT=="number"?new t(n):Array.prototype.slice.call(n)}function pX(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var Xc=class{constructor(t,e,o,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,s=e[o],c=e[o-1];t:{e:{let p;n:{r:if(!(t<s)){for(let h=o+2;;){if(s===void 0){if(t<c)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===h)break;if(c=s,s=e[++o],t<s)break e}p=e.length;break n}if(!(t>=c)){let h=e[1];t<h&&(o=2,c=h);for(let g=o-2;;){if(c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===g)break;if(s=c,c=e[--o-1],t>=c)break e}p=o,o=0;break n}break t}for(;o<p;){let h=o+p>>>1;t<e[h]?p=h:o=h+1}if(s=e[o],c=e[o-1],c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,c,s)}return this.interpolate_(o,c,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,s=this.valueSize,c=t*s;for(let p=0;p!==s;++p)e[p]=o[c+p];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},xv=class extends Xc{constructor(t,e,o,s){super(t,e,o,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:fT,endingEnd:fT}}intervalChanged_(t,e,o){let s=this.parameterPositions,c=t-2,p=t+1,h=s[c],g=s[p];if(h===void 0)switch(this.getSettings_().endingStart){case hT:c=t,h=2*e-o;break;case pT:c=s.length-2,h=e+s[c]-s[c+1];break;default:c=t,h=o}if(g===void 0)switch(this.getSettings_().endingEnd){case hT:p=t,g=2*o-e;break;case pT:p=1,g=o+s[1]-s[0];break;default:p=t-1,g=e}let m=(o-e)*.5,_=this.valueSize;this._weightPrev=m/(e-h),this._weightNext=m/(g-o),this._offsetPrev=c*_,this._offsetNext=p*_}interpolate_(t,e,o,s){let c=this.resultBuffer,p=this.sampleValues,h=this.valueSize,g=t*h,m=g-h,_=this._offsetPrev,w=this._offsetNext,x=this._weightPrev,b=this._weightNext,T=(o-e)/(s-e),I=T*T,S=I*T,E=-x*S+2*x*I-x*T,R=(1+x)*S+(-1.5-2*x)*I+(-.5+x)*T+1,C=(-1-b)*S+(1.5+b)*I+.5*T,F=b*S-b*I;for(let W=0;W!==h;++W)c[W]=E*p[_+W]+R*p[m+W]+C*p[g+W]+F*p[w+W];return c}},Ev=class extends Xc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let c=this.resultBuffer,p=this.sampleValues,h=this.valueSize,g=t*h,m=g-h,_=(o-e)/(s-e),w=1-_;for(let x=0;x!==h;++x)c[x]=p[m+x]*w+p[g+x]*_;return c}},wv=class extends Xc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t){return this.copySampleValue_(t-1)}},oa=class{constructor(t,e,o,s){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=xd(e,this.TimeBufferType),this.values=xd(o,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,o;if(e.toJSON!==this.toJSON)o=e.toJSON(t);else{o={name:t.name,times:xd(t.times,Array),values:xd(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(o.interpolation=s)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new wv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Ev(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new xv(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case wd:e=this.InterpolantFactoryMethodDiscrete;break;case Sd:e=this.InterpolantFactoryMethodLinear;break;case dy:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let o="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(o);return console.warn("THREE.KeyframeTrack:",o),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return wd;case this.InterpolantFactoryMethodLinear:return Sd;case this.InterpolantFactoryMethodSmooth:return dy}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]*=t}return this}trim(t,e){let o=this.times,s=o.length,c=0,p=s-1;for(;c!==s&&o[c]<t;)++c;for(;p!==-1&&o[p]>e;)--p;if(++p,c!==0||p!==s){c>=p&&(p=Math.max(p,1),c=p-1);let h=this.getValueSize();this.times=o.slice(c,p),this.values=this.values.slice(c*h,p*h)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let o=this.times,s=this.values,c=o.length;c===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let p=null;for(let h=0;h!==c;h++){let g=o[h];if(typeof g=="number"&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,h,g),t=!1;break}if(p!==null&&p>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,h,g,p),t=!1;break}p=g}if(s!==void 0&&pX(s))for(let h=0,g=s.length;h!==g;++h){let m=s[h];if(isNaN(m)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,h,m),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),s=this.getInterpolation()===dy,c=t.length-1,p=1;for(let h=1;h<c;++h){let g=!1,m=t[h],_=t[h+1];if(m!==_&&(h!==1||m!==t[0]))if(s)g=!0;else{let w=h*o,x=w-o,b=w+o;for(let T=0;T!==o;++T){let I=e[w+T];if(I!==e[x+T]||I!==e[b+T]){g=!0;break}}}if(g){if(h!==p){t[p]=t[h];let w=h*o,x=p*o;for(let b=0;b!==o;++b)e[x+b]=e[w+b]}++p}}if(c>0){t[p]=t[c];for(let h=c*o,g=p*o,m=0;m!==o;++m)e[g+m]=e[h+m];++p}return p!==t.length?(this.times=t.slice(0,p),this.values=e.slice(0,p*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,s=new o(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};oa.prototype.TimeBufferType=Float32Array;oa.prototype.ValueBufferType=Float32Array;oa.prototype.DefaultInterpolation=Sd;var zl=class extends oa{};zl.prototype.ValueTypeName="bool";zl.prototype.ValueBufferType=Array;zl.prototype.DefaultInterpolation=wd;zl.prototype.InterpolantFactoryMethodLinear=void 0;zl.prototype.InterpolantFactoryMethodSmooth=void 0;var Sv=class extends oa{};Sv.prototype.ValueTypeName="color";var Mv=class extends oa{};Mv.prototype.ValueTypeName="number";var bv=class extends Xc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let c=this.resultBuffer,p=this.sampleValues,h=this.valueSize,g=(o-e)/(s-e),m=t*h;for(let _=m+h;m!==_;m+=4)ju.slerpFlat(c,0,p,m-h,p,m,g);return c}},uh=class extends oa{InterpolantFactoryMethodLinear(t){return new bv(this.times,this.values,this.getValueSize(),t)}};uh.prototype.ValueTypeName="quaternion";uh.prototype.DefaultInterpolation=Sd;uh.prototype.InterpolantFactoryMethodSmooth=void 0;var Gl=class extends oa{};Gl.prototype.ValueTypeName="string";Gl.prototype.ValueBufferType=Array;Gl.prototype.DefaultInterpolation=wd;Gl.prototype.InterpolantFactoryMethodLinear=void 0;Gl.prototype.InterpolantFactoryMethodSmooth=void 0;var Av=class extends oa{};Av.prototype.ValueTypeName="vector";var Tv=class{constructor(t,e,o){let s=this,c=!1,p=0,h=0,g,m=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(_){h++,c===!1&&s.onStart!==void 0&&s.onStart(_,p,h),c=!0},this.itemEnd=function(_){p++,s.onProgress!==void 0&&s.onProgress(_,p,h),p===h&&(c=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(_){s.onError!==void 0&&s.onError(_)},this.resolveURL=function(_){return g?g(_):_},this.setURLModifier=function(_){return g=_,this},this.addHandler=function(_,w){return m.push(_,w),this},this.removeHandler=function(_){let w=m.indexOf(_);return w!==-1&&m.splice(w,2),this},this.getHandler=function(_){for(let w=0,x=m.length;w<x;w+=2){let b=m[w],T=m[w+1];if(b.global&&(b.lastIndex=0),b.test(_))return T}return null}}},dX=new Tv,Cv=class{constructor(t){this.manager=t!==void 0?t:dX,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(s,c){o.load(t,s,e,c)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};Cv.DEFAULT_MATERIAL_NAME="__DEFAULT";var Ov="\\\\[\\\\]\\\\.:\\\\/",gX=new RegExp("["+Ov+"]","g"),Dv="[^"+Ov+"]",mX="[^"+Ov.replace("\\\\.","")+"]",yX=/((?:WC+[\\/:])*)/.source.replace("WC",Dv),vX=/(WCOD+)?/.source.replace("WCOD",mX),_X=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Dv),xX=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Dv),EX=new RegExp("^"+yX+vX+_X+xX+"$"),wX=["material","materials","bones","map"],Pv=class{constructor(t,e,o){let s=o||Or.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,s=this._bindings[o];s!==void 0&&s.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let s=this._targetGroup.nCachedObjects_,c=o.length;s!==c;++s)o[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].unbind()}},Or=class n{constructor(t,e,o){this.path=e,this.parsedPath=o||n.parseTrackName(e),this.node=n.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,o){return t&&t.isAnimationObjectGroup?new n.Composite(t,e,o):new n(t,e,o)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(gX,"")}static parseTrackName(t){let e=EX.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let o={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=o.nodeName&&o.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let c=o.nodeName.substring(s+1);wX.indexOf(c)!==-1&&(o.nodeName=o.nodeName.substring(0,s),o.objectName=c)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return o}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let o=t.skeleton.getBoneByName(e);if(o!==void 0)return o}if(t.children){let o=function(c){for(let p=0;p<c.length;p++){let h=c[p];if(h.name===e||h.uuid===e)return h;let g=o(h.children);if(g)return g}return null},s=o(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)t[e++]=o[s]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)o[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)o[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)o[s]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,o=e.objectName,s=e.propertyName,c=e.propertyIndex;if(t||(t=n.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(o){let m=e.objectIndex;switch(o){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let _=0;_<t.length;_++)if(t[_].name===m){m=_;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[o]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[o]}if(m!==void 0){if(t[m]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[m]}}let p=t[s];if(p===void 0){let m=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+m+"."+s+" but it wasn't found.",t);return}let h=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?h=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(h=this.Versioning.MatrixWorldNeedsUpdate);let g=this.BindingType.Direct;if(c!==void 0){if(s==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[c]!==void 0&&(c=t.morphTargetDictionary[c])}g=this.BindingType.ArrayElement,this.resolvedProperty=p,this.propertyIndex=c}else p.fromArray!==void 0&&p.toArray!==void 0?(g=this.BindingType.HasFromToArray,this.resolvedProperty=p):Array.isArray(p)?(g=this.BindingType.EntireArray,this.resolvedProperty=p):this.propertyName=s;this.getValue=this.GetterByBindingType[g],this.setValue=this.SetterByBindingTypeAndVersioning[g][h]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Or.Composite=Pv;Or.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Or.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Or.prototype.GetterByBindingType=[Or.prototype._getValue_direct,Or.prototype._getValue_array,Or.prototype._getValue_arrayElement,Or.prototype._getValue_toArray];Or.prototype.SetterByBindingTypeAndVersioning=[[Or.prototype._setValue_direct,Or.prototype._setValue_direct_setNeedsUpdate,Or.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Or.prototype._setValue_array,Or.prototype._setValue_array_setNeedsUpdate,Or.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Or.prototype._setValue_arrayElement,Or.prototype._setValue_arrayElement_setNeedsUpdate,Or.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Or.prototype._setValue_fromArray,Or.prototype._setValue_fromArray_setNeedsUpdate,Or.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Ytt=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Iv}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Iv);var zi=63710088e-1,Jtt={centimeters:zi*100,centimetres:zi*100,degrees:zi/111325,feet:zi*3.28084,inches:zi*39.37,kilometers:zi/1e3,kilometres:zi/1e3,meters:zi,metres:zi,miles:zi/1609.344,millimeters:zi*1e3,millimetres:zi*1e3,nauticalmiles:zi/1852,radians:1,yards:zi*1.0936},Ktt={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/zi,yards:1.0936133};function bo(n,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=n,o}function Pr(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ia(n[0])||!Ia(n[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:n};return bo(o,t,e)}function Dr(n,t,e){e===void 0&&(e={});for(var o=0,s=n;o<s.length;o++){var c=s[o];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var p=0;p<c[c.length-1].length;p++)if(c[c.length-1][p]!==c[0][p])throw new Error("First and last Position are not equivalent.")}var h={type:"Polygon",coordinates:n};return bo(h,t,e)}function Gi(n,t,e){if(e===void 0&&(e={}),n.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:n};return bo(o,t,e)}function Fv(n,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:n};return bo(o,t,e)}function Ia(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function Ei(n,t,e){if(n!==null)for(var o,s,c,p,h,g,m,_=0,w=0,x,b=n.type,T=b==="FeatureCollection",I=b==="Feature",S=T?n.features.length:1,E=0;E<S;E++){m=T?n.features[E].geometry:I?n.geometry:n,x=m?m.type==="GeometryCollection":!1,h=x?m.geometries.length:1;for(var R=0;R<h;R++){var C=0,F=0;if(p=x?m.geometries[R]:m,p!==null){g=p.coordinates;var W=p.type;switch(_=e&&(W==="Polygon"||W==="MultiPolygon")?1:0,W){case null:break;case"Point":if(t(g,w,E,C,F)===!1)return!1;w++,C++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],w,E,C,F)===!1)return!1;w++,W==="MultiPoint"&&C++}W==="LineString"&&C++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(s=0;s<g[o].length-_;s++){if(t(g[o][s],w,E,C,F)===!1)return!1;w++}W==="MultiLineString"&&C++,W==="Polygon"&&F++}W==="Polygon"&&C++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(F=0,s=0;s<g[o].length;s++){for(c=0;c<g[o][s].length-_;c++){if(t(g[o][s][c],w,E,C,F)===!1)return!1;w++}F++}C++}break;case"GeometryCollection":for(o=0;o<p.geometries.length;o++)if(Ei(p.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function AC(n,t,e,o){var s=e;return Ei(n,function(c,p,h,g,m){p===0&&e===void 0?s=c:s=t(s,c,p,h,g,m)},o),s}function el(n,t){var e,o,s,c,p,h,g,m,_,w,x=0,b=n.type==="FeatureCollection",T=n.type==="Feature",I=b?n.features.length:1;for(e=0;e<I;e++){for(h=b?n.features[e].geometry:T?n.geometry:n,m=b?n.features[e].properties:T?n.properties:{},_=b?n.features[e].bbox:T?n.bbox:void 0,w=b?n.features[e].id:T?n.id:void 0,g=h?h.type==="GeometryCollection":!1,p=g?h.geometries.length:1,s=0;s<p;s++){if(c=g?h.geometries[s]:h,c===null){if(t(null,x,m,_,w)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(c,x,m,_,w)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<c.geometries.length;o++)if(t(c.geometries[o],x,m,_,w)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}x++}}function ys(n,t){el(n,function(e,o,s,c,p){var h=e===null?null:e.type;switch(h){case null:case"Point":case"LineString":case"Polygon":return t(bo(e,s,{bbox:c,id:p}),o,0)===!1?!1:void 0}var g;switch(h){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var m=0;m<e.coordinates.length;m++){var _=e.coordinates[m],w={type:g,coordinates:_};if(t(bo(w,s),o,m)===!1)return!1}})}function Uv(n){var t=[1/0,1/0,-1/0,-1/0];return Ei(n,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Uv.default=Uv;var Ao=Uv;function Qi(n){if(!n)throw new Error("coord is required");if(!Array.isArray(n)){if(n.type==="Feature"&&n.geometry!==null&&n.geometry.type==="Point")return n.geometry.coordinates;if(n.type==="Point")return n.coordinates}if(Array.isArray(n)&&n.length>=2&&!Array.isArray(n[0])&&!Array.isArray(n[1]))return n;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Bv(n,t,e){if(!n)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!n||n.type!=="Feature"||!n.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!n.geometry||n.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+n.geometry.type)}function to(n){return n.type==="Feature"?n.geometry:n}var IX=Je(Xd(),1);var GX=Je(VC(),1);function ki(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=Qi(n),s=to(t),c=s.type,p=t.bbox,h=s.coordinates;if(p&&kX(o,p)===!1)return!1;c==="Polygon"&&(h=[h]);for(var g=!1,m=0;m<h.length&&!g;m++)if(WC(o,h[m][0],e.ignoreBoundary)){for(var _=!1,w=1;w<h[m].length&&!_;)WC(o,h[m][w],!e.ignoreBoundary)&&(_=!0),w++;_||(g=!0)}return g}function WC(n,t,e){var o=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var s=0,c=t.length-1;s<t.length;c=s++){var p=t[s][0],h=t[s][1],g=t[c][0],m=t[c][1],_=n[1]*(p-g)+h*(g-n[0])+m*(n[0]-p)===0&&(p-n[0])*(g-n[0])<=0&&(h-n[1])*(m-n[1])<=0;if(_)return!e;var w=h>n[1]!=m>n[1]&&n[0]<(g-p)*(n[1]-h)/(m-h)+p;w&&(o=!o)}return o}function kX(n,t){return t[0]<=n[0]&&t[1]<=n[1]&&t[2]>=n[0]&&t[3]>=n[1]}var $C=new ArrayBuffer(16),Cnt=new Float64Array($C),Pnt=new Uint32Array($C);var n7=Je(t_(),1);var eit=function(){function n(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(var e=0;e<this.length-1;e++){var o=this.points[e],s=this.points[e+1];this.centers.push({x:(o.x+s.x)/2,y:(o.y+s.y)/2,z:(o.z+s.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var c=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,p=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,h=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+c),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+p),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+h)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+c),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+p),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+h)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return n.prototype.cacheSteps=function(t){var e=[],o=this.pos(0);e.push(0);for(var s=0;s<this.duration;s+=10){var c=this.pos(s),p=Math.sqrt((c.x-o.x)*(c.x-o.x)+(c.y-o.y)*(c.y-o.y)+(c.z-o.z)*(c.z-o.z));p>t&&(e.push(s),o=c)}return e},n.prototype.vector=function(t){var e=this.pos(t+10),o=this.pos(t-10);return{angle:180*Math.atan2(e.y-o.y,e.x-o.x)/3.14,speed:Math.sqrt((o.x-e.x)*(o.x-e.x)+(o.y-e.y)*(o.y-e.y)+(o.z-e.z)*(o.z-e.z))}},n.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var o=e/this.duration;if(o>=1)return this.points[this.length-1];var s=Math.floor((this.points.length-1)*o),c=(this.length-1)*o-s;return r7(c,this.points[s],this.controls[s][1],this.controls[s+1][0],this.points[s+1])},n}();function r7(n,t,e,o,s){var c=i7(n),p={x:s.x*c[0]+o.x*c[1]+e.x*c[2]+t.x*c[3],y:s.y*c[0]+o.y*c[1]+e.y*c[2]+t.y*c[3],z:s.z*c[0]+o.z*c[1]+e.z*c[2]+t.z*c[3]};return p}function i7(n){var t=n*n,e=t*n;return[e,3*t*(1-n),3*n*(1-n)*(1-n),(1-n)*(1-n)*(1-n)]}function hh(n,t){t===void 0&&(t={});var e=Number(n[0]),o=Number(n[1]),s=Number(n[2]),c=Number(n[3]);if(n.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var p=[e,o],h=[e,c],g=[s,c],m=[s,o];return Dr([[p,m,g,h,p]],t.properties,{bbox:n,id:t.id})}function o7(n){return hh(Ao(n))}var e_=o7;var w7=Je(oP(),1);var Z7=Je(lg(),1);var K7=Je(Xd(),1);var tY=Je(t_(),1);var SP=Math.PI/180,MP=180/Math.PI,_h=function(n,t){this.lon=n,this.lat=t,this.x=SP*n,this.y=SP*t};_h.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};_h.prototype.antipode=function(){var n=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new _h(t,n)};var bP=function(){this.coords=[],this.length=0};bP.prototype.move_to=function(n){this.length++,this.coords.push(n)};var E_=function(n){this.properties=n||{},this.geometries=[]};E_.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var n=[],t=0;t<this.geometries.length;t++)n.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:n},type:"Feature",properties:this.properties}};E_.prototype.wkt=function(){for(var n="",t="LINESTRING(",e=function(c){t+=c[0]+" "+c[1]+","},o=0;o<this.geometries.length;o++){if(this.geometries[o].coords.length===0)return"LINESTRING(empty)";var s=this.geometries[o].coords;s.forEach(e),n+=t.substring(0,t.length-1)+")"}return n};var AP=function(n,t,e){if(!n||n.x===void 0||n.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new _h(n.x,n.y),this.end=new _h(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,s=this.start.y-this.end.y,c=Math.pow(Math.sin(s/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(o/2),2);if(this.g=2*Math.asin(Math.sqrt(c)),this.g===Math.PI)throw new Error("it appears "+n.view()+" and "+t.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+n+" and "+t)};AP.prototype.interpolate=function(n){var t=Math.sin((1-n)*this.g)/Math.sin(this.g),e=Math.sin(n*this.g)/Math.sin(this.g),o=t*Math.cos(this.start.y)*Math.cos(this.start.x)+e*Math.cos(this.end.y)*Math.cos(this.end.x),s=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),c=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),p=MP*Math.atan2(c,Math.sqrt(Math.pow(o,2)+Math.pow(s,2))),h=MP*Math.atan2(s,o);return[h,p]};AP.prototype.Arc=function(n,t){var e=[];if(!n||n<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var o=1/(n-1),s=0;s<n;++s){var c=o*s,p=this.interpolate(c);e.push(p)}for(var h=!1,g=0,m=t&&t.offset?t.offset:10,_=180-m,w=-180+m,x=360-m,b=1;b<e.length;++b){var T=e[b-1][0],I=e[b][0],S=Math.abs(I-T);S>x&&(I>_&&T<w||T>_&&I<w)?h=!0:S>g&&(g=S)}var E=[];if(h&&g<m){var R=[];E.push(R);for(var C=0;C<e.length;++C){var F=parseFloat(e[C][0]);if(C>0&&Math.abs(F-e[C-1][0])>x){var W=parseFloat(e[C-1][0]),X=parseFloat(e[C-1][1]),q=parseFloat(e[C][0]),D=parseFloat(e[C][1]);if(W>-180&&W<w&&q===180&&C+1<e.length&&e[C-1][0]>-180&&e[C-1][0]<w){R.push([-180,e[C][1]]),C++,R.push([e[C][0],e[C][1]]);continue}else if(W>_&&W<180&&q===-180&&C+1<e.length&&e[C-1][0]>_&&e[C-1][0]<180){R.push([180,e[C][1]]),C++,R.push([e[C][0],e[C][1]]);continue}if(W<w&&q>_){var xt=W;W=q,q=xt;var B=X;X=D,D=B}if(W>_&&q<w&&(q+=360),W<=180&&q>=180&&W<q){var j=(180-W)/(q-W),J=j*D+(1-j)*X;R.push([e[C-1][0]>_?180:-180,J]),R=[],R.push([e[C-1][0]>_?-180:180,J]),E.push(R)}else R=[],E.push(R);R.push([F,e[C][1]])}else R.push([e[C][0],e[C][1]])}}else{var Dt=[];E.push(Dt);for(var Q=0;Q<e.length;++Q)Dt.push([e[Q][0],e[Q][1]])}for(var At=new E_(this.properties),Mt=0;Mt<E.length;++Mt){var Lt=new bP;At.geometries.push(Lt);for(var pt=E[Mt],yt=0;yt<pt.length;++yt)Lt.move_to(pt[yt])}return At};var rY=Je(lg(),1);var nZ=Je(lg(),1);var rZ=Je(Z_(),1);var sZ=Je(Xd(),1);var ln=[],cn=[],fn=[],hn=[],pn=[],dn=[],gn=[],mn=[],yn=[],vn=[],_n=[],xn=[],En=[],wn=[],Sn=[],Mn=[],bn=[],An=[],Tn=[],Cn=[],Pn=[],In=[],Rn=[],Ln=[];gn[85]=vn[85]=-1;mn[85]=_n[85]=0;yn[85]=xn[85]=1;Tn[85]=In[85]=1;Cn[85]=Rn[85]=0;Pn[85]=Ln[85]=1;ln[85]=hn[85]=0;cn[85]=pn[85]=-1;fn[85]=Sn[85]=0;Mn[85]=En[85]=0;bn[85]=wn[85]=1;dn[85]=An[85]=1;In[1]=In[169]=0;Rn[1]=Rn[169]=-1;Ln[1]=Ln[169]=0;En[1]=En[169]=-1;wn[1]=wn[169]=0;Sn[1]=Sn[169]=0;vn[4]=vn[166]=0;_n[4]=_n[166]=-1;xn[4]=xn[166]=1;Mn[4]=Mn[166]=1;bn[4]=bn[166]=0;An[4]=An[166]=0;gn[16]=gn[154]=0;mn[16]=mn[154]=1;yn[16]=yn[154]=1;hn[16]=hn[154]=1;pn[16]=pn[154]=0;dn[16]=dn[154]=1;Tn[64]=Tn[106]=0;Cn[64]=Cn[106]=1;Pn[64]=Pn[106]=0;ln[64]=ln[106]=-1;cn[64]=cn[106]=0;fn[64]=fn[106]=1;Tn[2]=Tn[168]=0;Cn[2]=Cn[168]=-1;Pn[2]=Pn[168]=1;In[2]=In[168]=0;Rn[2]=Rn[168]=-1;Ln[2]=Ln[168]=0;En[2]=En[168]=-1;wn[2]=wn[168]=0;Sn[2]=Sn[168]=0;Mn[2]=Mn[168]=-1;bn[2]=bn[168]=0;An[2]=An[168]=1;gn[8]=gn[162]=0;mn[8]=mn[162]=-1;yn[8]=yn[162]=0;vn[8]=vn[162]=0;_n[8]=_n[162]=-1;xn[8]=xn[162]=1;En[8]=En[162]=1;wn[8]=wn[162]=0;Sn[8]=Sn[162]=1;Mn[8]=Mn[162]=1;bn[8]=bn[162]=0;An[8]=An[162]=0;gn[32]=gn[138]=0;mn[32]=mn[138]=1;yn[32]=yn[138]=1;vn[32]=vn[138]=0;_n[32]=_n[138]=1;xn[32]=xn[138]=0;ln[32]=ln[138]=1;cn[32]=cn[138]=0;fn[32]=fn[138]=0;hn[32]=hn[138]=1;pn[32]=pn[138]=0;dn[32]=dn[138]=1;In[128]=In[42]=0;Rn[128]=Rn[42]=1;Ln[128]=Ln[42]=1;Tn[128]=Tn[42]=0;Cn[128]=Cn[42]=1;Pn[128]=Pn[42]=0;ln[128]=ln[42]=-1;cn[128]=cn[42]=0;fn[128]=fn[42]=1;hn[128]=hn[42]=-1;pn[128]=pn[42]=0;dn[128]=dn[42]=0;vn[5]=vn[165]=-1;_n[5]=_n[165]=0;xn[5]=xn[165]=0;In[5]=In[165]=1;Rn[5]=Rn[165]=0;Ln[5]=Ln[165]=0;Mn[20]=Mn[150]=0;bn[20]=bn[150]=1;An[20]=An[150]=1;hn[20]=hn[150]=0;pn[20]=pn[150]=-1;dn[20]=dn[150]=1;gn[80]=gn[90]=-1;mn[80]=mn[90]=0;yn[80]=yn[90]=1;Tn[80]=Tn[90]=1;Cn[80]=Cn[90]=0;Pn[80]=Pn[90]=1;En[65]=En[105]=0;wn[65]=wn[105]=1;Sn[65]=Sn[105]=0;ln[65]=ln[105]=0;cn[65]=cn[105]=-1;fn[65]=fn[105]=0;gn[160]=gn[10]=-1;mn[160]=mn[10]=0;yn[160]=yn[10]=1;vn[160]=vn[10]=-1;_n[160]=_n[10]=0;xn[160]=xn[10]=0;In[160]=In[10]=1;Rn[160]=Rn[10]=0;Ln[160]=Ln[10]=0;Tn[160]=Tn[10]=1;Cn[160]=Cn[10]=0;Pn[160]=Pn[10]=1;Mn[130]=Mn[40]=0;bn[130]=bn[40]=1;An[130]=An[40]=1;En[130]=En[40]=0;wn[130]=wn[40]=1;Sn[130]=Sn[40]=0;ln[130]=ln[40]=0;cn[130]=cn[40]=-1;fn[130]=fn[40]=0;hn[130]=hn[40]=0;pn[130]=pn[40]=-1;dn[130]=dn[40]=1;vn[37]=vn[133]=0;_n[37]=_n[133]=1;xn[37]=xn[133]=1;In[37]=In[133]=0;Rn[37]=Rn[133]=1;Ln[37]=Ln[133]=0;ln[37]=ln[133]=-1;cn[37]=cn[133]=0;fn[37]=fn[133]=0;hn[37]=hn[133]=1;pn[37]=pn[133]=0;dn[37]=dn[133]=0;Mn[148]=Mn[22]=-1;bn[148]=bn[22]=0;An[148]=An[22]=0;In[148]=In[22]=0;Rn[148]=Rn[22]=-1;Ln[148]=Ln[22]=1;Tn[148]=Tn[22]=0;Cn[148]=Cn[22]=1;Pn[148]=Pn[22]=1;hn[148]=hn[22]=-1;pn[148]=pn[22]=0;dn[148]=dn[22]=1;gn[82]=gn[88]=0;mn[82]=mn[88]=-1;yn[82]=yn[88]=1;Mn[82]=Mn[88]=1;bn[82]=bn[88]=0;An[82]=An[88]=1;En[82]=En[88]=-1;wn[82]=wn[88]=0;Sn[82]=Sn[88]=1;Tn[82]=Tn[88]=0;Cn[82]=Cn[88]=-1;Pn[82]=Pn[88]=0;gn[73]=gn[97]=0;mn[73]=mn[97]=1;yn[73]=yn[97]=0;vn[73]=vn[97]=0;_n[73]=_n[97]=-1;xn[73]=xn[97]=0;En[73]=En[97]=1;wn[73]=wn[97]=0;Sn[73]=Sn[97]=0;ln[73]=ln[97]=1;cn[73]=cn[97]=0;fn[73]=fn[97]=1;gn[145]=gn[25]=0;mn[145]=mn[25]=-1;yn[145]=yn[25]=0;En[145]=En[25]=1;wn[145]=wn[25]=0;Sn[145]=Sn[25]=1;In[145]=In[25]=0;Rn[145]=Rn[25]=1;Ln[145]=Ln[25]=1;hn[145]=hn[25]=-1;pn[145]=pn[25]=0;dn[145]=dn[25]=0;vn[70]=vn[100]=0;_n[70]=_n[100]=1;xn[70]=xn[100]=0;Mn[70]=Mn[100]=-1;bn[70]=bn[100]=0;An[70]=An[100]=1;Tn[70]=Tn[100]=0;Cn[70]=Cn[100]=-1;Pn[70]=Pn[100]=1;ln[70]=ln[100]=1;cn[70]=cn[100]=0;fn[70]=fn[100]=0;vn[101]=vn[69]=0;_n[101]=_n[69]=1;xn[101]=xn[69]=0;ln[101]=ln[69]=1;cn[101]=cn[69]=0;fn[101]=fn[69]=0;In[149]=In[21]=0;Rn[149]=Rn[21]=1;Ln[149]=Ln[21]=1;hn[149]=hn[21]=-1;pn[149]=pn[21]=0;dn[149]=dn[21]=0;Mn[86]=Mn[84]=-1;bn[86]=bn[84]=0;An[86]=An[84]=1;Tn[86]=Tn[84]=0;Cn[86]=Cn[84]=-1;Pn[86]=Pn[84]=1;gn[89]=gn[81]=0;mn[89]=mn[81]=-1;yn[89]=yn[81]=0;En[89]=En[81]=1;wn[89]=wn[81]=0;Sn[89]=Sn[81]=1;gn[96]=gn[74]=0;mn[96]=mn[74]=1;yn[96]=yn[74]=0;vn[96]=vn[74]=-1;_n[96]=_n[74]=0;xn[96]=xn[74]=1;Tn[96]=Tn[74]=1;Cn[96]=Cn[74]=0;Pn[96]=Pn[74]=0;ln[96]=ln[74]=1;cn[96]=cn[74]=0;fn[96]=fn[74]=1;gn[24]=gn[146]=0;mn[24]=mn[146]=-1;yn[24]=yn[146]=1;Mn[24]=Mn[146]=1;bn[24]=bn[146]=0;An[24]=An[146]=1;En[24]=En[146]=0;wn[24]=wn[146]=1;Sn[24]=Sn[146]=1;hn[24]=hn[146]=0;pn[24]=pn[146]=-1;dn[24]=dn[146]=0;vn[6]=vn[164]=-1;_n[6]=_n[164]=0;xn[6]=xn[164]=1;Mn[6]=Mn[164]=-1;bn[6]=bn[164]=0;An[6]=An[164]=0;In[6]=In[164]=0;Rn[6]=Rn[164]=-1;Ln[6]=Ln[164]=1;Tn[6]=Tn[164]=1;Cn[6]=Cn[164]=0;Pn[6]=Pn[164]=0;En[129]=En[41]=0;wn[129]=wn[41]=1;Sn[129]=Sn[41]=1;In[129]=In[41]=0;Rn[129]=Rn[41]=1;Ln[129]=Ln[41]=0;ln[129]=ln[41]=-1;cn[129]=cn[41]=0;fn[129]=fn[41]=0;hn[129]=hn[41]=0;pn[129]=pn[41]=-1;dn[129]=dn[41]=0;Mn[66]=Mn[104]=0;bn[66]=bn[104]=1;An[66]=An[104]=0;En[66]=En[104]=-1;wn[66]=wn[104]=0;Sn[66]=Sn[104]=1;Tn[66]=Tn[104]=0;Cn[66]=Cn[104]=-1;Pn[66]=Pn[104]=0;ln[66]=ln[104]=0;cn[66]=cn[104]=-1;fn[66]=fn[104]=1;gn[144]=gn[26]=-1;mn[144]=mn[26]=0;yn[144]=yn[26]=0;In[144]=In[26]=1;Rn[144]=Rn[26]=0;Ln[144]=Ln[26]=1;Tn[144]=Tn[26]=0;Cn[144]=Cn[26]=1;Pn[144]=Pn[26]=1;hn[144]=hn[26]=-1;pn[144]=pn[26]=0;dn[144]=dn[26]=1;vn[36]=vn[134]=0;_n[36]=_n[134]=1;xn[36]=xn[134]=1;Mn[36]=Mn[134]=0;bn[36]=bn[134]=1;An[36]=An[134]=0;ln[36]=ln[134]=0;cn[36]=cn[134]=-1;fn[36]=fn[134]=1;hn[36]=hn[134]=1;pn[36]=pn[134]=0;dn[36]=dn[134]=0;gn[9]=gn[161]=-1;mn[9]=mn[161]=0;yn[9]=yn[161]=0;vn[9]=vn[161]=0;_n[9]=_n[161]=-1;xn[9]=xn[161]=0;En[9]=En[161]=1;wn[9]=wn[161]=0;Sn[9]=Sn[161]=0;In[9]=In[161]=1;Rn[9]=Rn[161]=0;Ln[9]=Ln[161]=1;gn[136]=0;mn[136]=1;yn[136]=1;vn[136]=0;_n[136]=1;xn[136]=0;Mn[136]=-1;bn[136]=0;An[136]=1;En[136]=-1;wn[136]=0;Sn[136]=0;In[136]=0;Rn[136]=-1;Ln[136]=0;Tn[136]=0;Cn[136]=-1;Pn[136]=1;ln[136]=1;cn[136]=0;fn[136]=0;hn[136]=1;pn[136]=0;dn[136]=1;gn[34]=0;mn[34]=-1;yn[34]=0;vn[34]=0;_n[34]=-1;xn[34]=1;Mn[34]=1;bn[34]=0;An[34]=0;En[34]=1;wn[34]=0;Sn[34]=1;In[34]=0;Rn[34]=1;Ln[34]=1;Tn[34]=0;Cn[34]=1;Pn[34]=0;ln[34]=-1;cn[34]=0;fn[34]=1;hn[34]=-1;pn[34]=0;dn[34]=0;gn[35]=0;mn[35]=1;yn[35]=1;vn[35]=0;_n[35]=-1;xn[35]=1;Mn[35]=1;bn[35]=0;An[35]=0;En[35]=-1;wn[35]=0;Sn[35]=0;In[35]=0;Rn[35]=-1;Ln[35]=0;Tn[35]=0;Cn[35]=1;Pn[35]=0;ln[35]=-1;cn[35]=0;fn[35]=1;hn[35]=1;pn[35]=0;dn[35]=1;gn[153]=0;mn[153]=1;yn[153]=1;En[153]=-1;wn[153]=0;Sn[153]=0;In[153]=0;Rn[153]=-1;Ln[153]=0;hn[153]=1;pn[153]=0;dn[153]=1;vn[102]=0;_n[102]=-1;xn[102]=1;Mn[102]=1;bn[102]=0;An[102]=0;Tn[102]=0;Cn[102]=1;Pn[102]=0;ln[102]=-1;cn[102]=0;fn[102]=1;gn[155]=0;mn[155]=-1;yn[155]=0;En[155]=1;wn[155]=0;Sn[155]=1;In[155]=0;Rn[155]=1;Ln[155]=1;hn[155]=-1;pn[155]=0;dn[155]=0;vn[103]=0;_n[103]=1;xn[103]=0;Mn[103]=-1;bn[103]=0;An[103]=1;Tn[103]=0;Cn[103]=-1;Pn[103]=1;ln[103]=1;cn[103]=0;fn[103]=0;gn[152]=0;mn[152]=1;yn[152]=1;Mn[152]=-1;bn[152]=0;An[152]=1;En[152]=-1;wn[152]=0;Sn[152]=0;In[152]=0;Rn[152]=-1;Ln[152]=0;Tn[152]=0;Cn[152]=-1;Pn[152]=1;hn[152]=1;pn[152]=0;dn[152]=1;gn[156]=0;mn[156]=-1;yn[156]=1;Mn[156]=1;bn[156]=0;An[156]=1;En[156]=-1;wn[156]=0;Sn[156]=0;In[156]=0;Rn[156]=-1;Ln[156]=0;Tn[156]=0;Cn[156]=1;Pn[156]=1;hn[156]=-1;pn[156]=0;dn[156]=1;gn[137]=0;mn[137]=1;yn[137]=1;vn[137]=0;_n[137]=1;xn[137]=0;En[137]=-1;wn[137]=0;Sn[137]=0;In[137]=0;Rn[137]=-1;Ln[137]=0;ln[137]=1;cn[137]=0;fn[137]=0;hn[137]=1;pn[137]=0;dn[137]=1;gn[139]=0;mn[139]=1;yn[139]=1;vn[139]=0;_n[139]=-1;xn[139]=0;En[139]=1;wn[139]=0;Sn[139]=0;In[139]=0;Rn[139]=1;Ln[139]=0;ln[139]=-1;cn[139]=0;fn[139]=0;hn[139]=1;pn[139]=0;dn[139]=1;gn[98]=0;mn[98]=-1;yn[98]=0;vn[98]=0;_n[98]=-1;xn[98]=1;Mn[98]=1;bn[98]=0;An[98]=0;En[98]=1;wn[98]=0;Sn[98]=1;Tn[98]=0;Cn[98]=1;Pn[98]=0;ln[98]=-1;cn[98]=0;fn[98]=1;gn[99]=0;mn[99]=1;yn[99]=0;vn[99]=0;_n[99]=-1;xn[99]=1;Mn[99]=1;bn[99]=0;An[99]=0;En[99]=-1;wn[99]=0;Sn[99]=1;Tn[99]=0;Cn[99]=-1;Pn[99]=0;ln[99]=1;cn[99]=0;fn[99]=1;vn[38]=0;_n[38]=-1;xn[38]=1;Mn[38]=1;bn[38]=0;An[38]=0;In[38]=0;Rn[38]=1;Ln[38]=1;Tn[38]=0;Cn[38]=1;Pn[38]=0;ln[38]=-1;cn[38]=0;fn[38]=1;hn[38]=-1;pn[38]=0;dn[38]=0;vn[39]=0;_n[39]=1;xn[39]=1;Mn[39]=-1;bn[39]=0;An[39]=0;In[39]=0;Rn[39]=-1;Ln[39]=1;Tn[39]=0;Cn[39]=1;Pn[39]=0;ln[39]=-1;cn[39]=0;fn[39]=1;hn[39]=1;pn[39]=0;dn[39]=0;var J_=function(n){return[[n.bottomleft,0],[0,0],[0,n.leftbottom]]},K_=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0]]},j_=function(n){return[[n.topright,1],[1,1],[1,n.righttop]]},Q_=function(n){return[[0,n.lefttop],[0,1],[n.topleft,1]]},t1=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop]]},e1=function(n){return[[n.bottomright,0],[n.bottomleft,0],[1,n.righttop],[1,n.rightbottom]]},n1=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.topleft,1],[n.topright,1]]},r1=function(n){return[[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},aZ=function(n){return[[0,0],[0,n.leftbottom],[1,n.rightbottom],[1,0]]},uZ=function(n){return[[1,0],[n.bottomright,0],[n.topright,1],[1,1]]},lZ=function(n){return[[1,1],[1,n.righttop],[0,n.lefttop],[0,1]]},cZ=function(n){return[[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},fZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.leftbottom],[0,n.lefttop]]},hZ=function(n){return[[n.topleft,1],[n.topright,1],[n.bottomright,0],[n.bottomleft,0]]},pZ=function(){return[[0,0],[0,1],[1,1],[1,0]]},dZ=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,1],[n.topleft,1]]},gZ=function(n){return[[n.topright,1],[1,1],[1,0],[0,0],[0,n.leftbottom]]},mZ=function(n){return[[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[1,1]]},yZ=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,1]]},vZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.lefttop],[0,1],[n.topleft,1]]},_Z=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[n.topright,1]]},xZ=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop]]},EZ=function(n){return[[n.topright,1],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1]]},wZ=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},SZ=function(n){return[[1,1],[1,n.righttop],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},MZ=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[n.topleft,1],[n.topright,1]]},bZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom]]},AZ=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},TZ=function(n){return[[1,1],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},CZ=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1]]},PZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},IZ=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},RZ=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},LZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},NZ=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},OZ=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},DZ=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},FZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},UZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},BZ=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},Un=[],Bn=[],zn=[],Gn=[],kn=[],qn=[],Hn=[],Vn=[];Gn[1]=kn[1]=18;Gn[169]=kn[169]=18;zn[4]=Bn[4]=12;zn[166]=Bn[166]=12;Un[16]=Vn[16]=4;Un[154]=Vn[154]=4;qn[64]=Hn[64]=22;qn[106]=Hn[106]=22;zn[2]=qn[2]=17;Gn[2]=kn[2]=18;zn[168]=qn[168]=17;Gn[168]=kn[168]=18;Un[8]=Gn[8]=9;Bn[8]=zn[8]=12;Un[162]=Gn[162]=9;Bn[162]=zn[162]=12;Un[32]=Vn[32]=4;Bn[32]=Hn[32]=1;Un[138]=Vn[138]=4;Bn[138]=Hn[138]=1;kn[128]=Vn[128]=21;qn[128]=Hn[128]=22;kn[42]=Vn[42]=21;qn[42]=Hn[42]=22;Bn[5]=kn[5]=14;Bn[165]=kn[165]=14;zn[20]=Vn[20]=6;zn[150]=Vn[150]=6;Un[80]=qn[80]=11;Un[90]=qn[90]=11;Gn[65]=Hn[65]=3;Gn[105]=Hn[105]=3;Un[160]=qn[160]=11;Bn[160]=kn[160]=14;Un[10]=qn[10]=11;Bn[10]=kn[10]=14;zn[130]=Vn[130]=6;Gn[130]=Hn[130]=3;zn[40]=Vn[40]=6;Gn[40]=Hn[40]=3;Bn[101]=Hn[101]=1;Bn[69]=Hn[69]=1;kn[149]=Vn[149]=21;kn[21]=Vn[21]=21;zn[86]=qn[86]=17;zn[84]=qn[84]=17;Un[89]=Gn[89]=9;Un[81]=Gn[81]=9;Un[96]=Hn[96]=0;Bn[96]=qn[96]=15;Un[74]=Hn[74]=0;Bn[74]=qn[74]=15;Un[24]=zn[24]=8;Gn[24]=Vn[24]=7;Un[146]=zn[146]=8;Gn[146]=Vn[146]=7;Bn[6]=qn[6]=15;zn[6]=kn[6]=16;Bn[164]=qn[164]=15;zn[164]=kn[164]=16;Gn[129]=Vn[129]=7;kn[129]=Hn[129]=20;Gn[41]=Vn[41]=7;kn[41]=Hn[41]=20;zn[66]=Hn[66]=2;Gn[66]=qn[66]=19;zn[104]=Hn[104]=2;Gn[104]=qn[104]=19;Un[144]=kn[144]=10;qn[144]=Vn[144]=23;Un[26]=kn[26]=10;qn[26]=Vn[26]=23;Bn[36]=Vn[36]=5;zn[36]=Hn[36]=2;Bn[134]=Vn[134]=5;zn[134]=Hn[134]=2;Un[9]=kn[9]=10;Bn[9]=Gn[9]=13;Un[161]=kn[161]=10;Bn[161]=Gn[161]=13;Bn[37]=Vn[37]=5;kn[37]=Hn[37]=20;Bn[133]=Vn[133]=5;kn[133]=Hn[133]=20;zn[148]=kn[148]=16;qn[148]=Vn[148]=23;zn[22]=kn[22]=16;qn[22]=Vn[22]=23;Un[82]=zn[82]=8;Gn[82]=qn[82]=19;Un[88]=zn[88]=8;Gn[88]=qn[88]=19;Un[73]=Hn[73]=0;Bn[73]=Gn[73]=13;Un[97]=Hn[97]=0;Bn[97]=Gn[97]=13;Un[145]=Gn[145]=9;kn[145]=Vn[145]=21;Un[25]=Gn[25]=9;kn[25]=Vn[25]=21;Bn[70]=Hn[70]=1;zn[70]=qn[70]=17;Bn[100]=Hn[100]=1;zn[100]=qn[100]=17;Un[34]=Gn[34]=9;Bn[34]=zn[34]=12;kn[34]=Vn[34]=21;qn[34]=Hn[34]=22;Un[136]=Vn[136]=4;Bn[136]=Hn[136]=1;zn[136]=qn[136]=17;Gn[136]=kn[136]=18;Un[35]=Vn[35]=4;Bn[35]=zn[35]=12;Gn[35]=kn[35]=18;qn[35]=Hn[35]=22;Un[153]=Vn[153]=4;Gn[153]=kn[153]=18;Bn[102]=zn[102]=12;qn[102]=Hn[102]=22;Un[155]=Gn[155]=9;kn[155]=Vn[155]=23;Bn[103]=Hn[103]=1;zn[103]=qn[103]=17;Un[152]=Vn[152]=4;zn[152]=qn[152]=17;Gn[152]=kn[152]=18;Un[156]=zn[156]=8;Gn[156]=kn[156]=18;qn[156]=Vn[156]=23;Un[137]=Vn[137]=4;Bn[137]=Hn[137]=1;Gn[137]=kn[137]=18;Un[139]=Vn[139]=4;Bn[139]=Gn[139]=13;kn[139]=Hn[139]=20;Un[98]=Gn[98]=9;Bn[98]=zn[98]=12;qn[98]=Hn[98]=22;Un[99]=Hn[99]=0;Bn[99]=zn[99]=12;Gn[99]=qn[99]=19;Bn[38]=zn[38]=12;kn[38]=Vn[38]=21;qn[38]=Hn[38]=22;Bn[39]=Vn[39]=5;zn[39]=kn[39]=16;qn[39]=Hn[39]=22;var re=[];re[1]=re[169]=J_;re[4]=re[166]=K_;re[16]=re[154]=j_;re[64]=re[106]=Q_;re[168]=re[2]=t1;re[162]=re[8]=e1;re[138]=re[32]=n1;re[42]=re[128]=r1;re[5]=re[165]=aZ;re[20]=re[150]=uZ;re[80]=re[90]=lZ;re[65]=re[105]=cZ;re[160]=re[10]=fZ;re[130]=re[40]=hZ;re[85]=pZ;re[101]=re[69]=dZ;re[149]=re[21]=gZ;re[86]=re[84]=mZ;re[89]=re[81]=yZ;re[96]=re[74]=vZ;re[24]=re[146]=_Z;re[6]=re[164]=xZ;re[129]=re[41]=EZ;re[66]=re[104]=wZ;re[144]=re[26]=SZ;re[36]=re[134]=MZ;re[9]=re[161]=bZ;re[37]=re[133]=AZ;re[148]=re[22]=TZ;re[82]=re[88]=CZ;re[73]=re[97]=PZ;re[145]=re[25]=IZ;re[70]=re[100]=RZ;re[34]=function(n){return[r1(n),e1(n)]};re[35]=LZ;re[136]=function(n){return[n1(n),t1(n)]};re[153]=function(n){return[j_(n),J_(n)]};re[102]=function(n){return[K_(n),Q_(n)]};re[155]=NZ;re[103]=OZ;re[152]=function(n){return[j_(n),t1(n)]};re[156]=DZ;re[137]=function(n){return[n1(n),J_(n)]};re[139]=FZ;re[98]=function(n){return[e1(n),Q_(n)]};re[99]=UZ;re[38]=function(n){return[K_(n),r1(n)]};re[39]=BZ;function GZ(n){return(n>0)-(n<0)||+n}function cf(n,t,e){var o=t[0]-n[0],s=t[1]-n[1],c=e[0]-t[0],p=e[1]-t[1];return GZ(o*p-c*s)}function pL(n,t){var e=n.geometry.coordinates[0].map(function(p){return p[0]}),o=n.geometry.coordinates[0].map(function(p){return p[1]}),s=t.geometry.coordinates[0].map(function(p){return p[0]}),c=t.geometry.coordinates[0].map(function(p){return p[1]});return Math.max.apply(null,e)===Math.max.apply(null,s)&&Math.max.apply(null,o)===Math.max.apply(null,c)&&Math.min.apply(null,e)===Math.min.apply(null,s)&&Math.min.apply(null,o)===Math.min.apply(null,c)}function i1(n,t){return t.geometry.coordinates[0].every(function(e){return ki(Pr(e),n)})}function dL(n,t){return n[0]===t[0]&&n[1]===t[1]}var kZ=function(){function n(t){this.id=n.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return n.buildId=function(t){return t.join(",")},n.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},n.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},n.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},n.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,o){var s=e.to,c=o.to;if(s.coordinates[0]-t.coordinates[0]>=0&&c.coordinates[0]-t.coordinates[0]<0)return 1;if(s.coordinates[0]-t.coordinates[0]<0&&c.coordinates[0]-t.coordinates[0]>=0)return-1;if(s.coordinates[0]-t.coordinates[0]===0&&c.coordinates[0]-t.coordinates[0]===0)return s.coordinates[1]-t.coordinates[1]>=0||c.coordinates[1]-t.coordinates[1]>=0?s.coordinates[1]-c.coordinates[1]:c.coordinates[1]-s.coordinates[1];var p=cf(t.coordinates,s.coordinates,c.coordinates);if(p<0)return 1;if(p>0)return-1;var h=Math.pow(s.coordinates[0]-t.coordinates[0],2)+Math.pow(s.coordinates[1]-t.coordinates[1],2),g=Math.pow(c.coordinates[0]-t.coordinates[0],2)+Math.pow(c.coordinates[1]-t.coordinates[1],2);return h-g}),this.outerEdgesSorted=!0)},n.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},n.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},n.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},n}(),o1=kZ;var qZ=function(){function n(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return n.prototype.getSymetric=function(){return this.symetric||(this.symetric=new n(this.to,this.from),this.symetric.symetric=this),this.symetric},n.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},n.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},n.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},n.prototype.toLineString=function(){return Gi([this.from.coordinates,this.to.coordinates])},n.prototype.compareTo=function(t){return cf(t.from.coordinates,t.to.coordinates,this.to.coordinates)},n}(),gL=qZ;var HZ=function(){function n(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return n.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},n.prototype.get=function(t){return this.edges[t]},Object.defineProperty(n.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),n.prototype.forEach=function(t){this.edges.forEach(t)},n.prototype.map=function(t){return this.edges.map(t)},n.prototype.some=function(t){return this.edges.some(t)},n.prototype.isValid=function(){return!0},n.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(p,h,g){return h.from.coordinates[1]>t.edges[p].from.coordinates[1]&&(p=g),p},0),o=(e===0?this.length:e)-1,s=(e+1)%this.length,c=cf(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[s].from.coordinates);return c===0?this.edges[o].from.coordinates[0]>this.edges[s].from.coordinates[0]:c>0},n.prototype.toMultiPoint=function(){return Fv(this.edges.map(function(t){return t.from.coordinates}))},n.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map(function(e){return e.from.coordinates});return t.push(this.edges[0].from.coordinates),this.polygon=Dr([t])},n.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=e_(this.toPolygon())},n.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),s,c;return e.forEach(function(p){var h=p.getEnvelope();if(c&&(s=c.getEnvelope()),!pL(h,o)&&i1(h,o)){for(var g=t.map(function(T){return T.from.coordinates}),m=void 0,_=function(T){p.some(function(I){return dL(T,I.from.coordinates)})||(m=T)},w=0,x=g;w<x.length;w++){var b=x[w];_(b)}m&&p.inside(Pr(m))&&(!c||i1(s,h))&&(c=p)}}),c},n.prototype.inside=function(t){return ki(t,this.toPolygon())},n}(),s1=HZ;function VZ(n){if(!n)throw new Error("No geojson passed");if(n.type!=="FeatureCollection"&&n.type!=="GeometryCollection"&&n.type!=="MultiLineString"&&n.type!=="LineString"&&n.type!=="Feature")throw new Error("Invalid input type '"+n.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var lct=function(){function n(){this.edges=[],this.nodes={}}return n.fromGeoJson=function(t){VZ(t);var e=new n;return ys(t,function(o){Bv(o,"LineString","Graph::fromGeoJson"),AC(o,function(s,c){if(s){var p=e.getNode(s),h=e.getNode(c);e.addEdge(p,h)}return c})}),e},n.prototype.getNode=function(t){var e=o1.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new o1(t)),o},n.prototype.addEdge=function(t,e){var o=new gL(t,e),s=o.getSymetric();this.edges.push(o),this.edges.push(s)},n.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},n.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var o=t.getOuterEdges().map(function(s){return s.to});this.removeNode(t),o.forEach(function(s){return e._removeIfDangle(s)})}},n.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))})},n.prototype._computeNextCWEdges=function(t){var e=this;typeof t=="undefined"?Object.keys(this.nodes).forEach(function(o){return e._computeNextCWEdges(e.nodes[o])}):t.getOuterEdges().forEach(function(o,s){t.getOuterEdge((s===0?t.getOuterEdges().length:s)-1).symetric.next=o})},n.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),s,c,p=o.length-1;p>=0;--p){var h=o[p],g=h.symetric,m=void 0,_=void 0;h.label===e&&(m=h),g.label===e&&(_=g),!(!m||!_)&&(_&&(c=_),m&&(c&&(c.next=m,c=void 0),s||(s=m)))}c&&(c.next=s)},n.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var s=o;do s.label=e,s=s.next;while(!o.isEqual(s));e++}}),t},n.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(o){o.label=void 0}),this._findLabeledEdgeRings().forEach(function(o){t._findIntersectionNodes(o).forEach(function(s){t._computeNextCCWEdges(s,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},n.prototype._findIntersectionNodes=function(t){var e=[],o=t,s=function(){var c=0;o.from.getOuterEdges().forEach(function(p){p.label===t.label&&++c}),c>1&&e.push(o.from),o=o.next};do s();while(!t.isEqual(o));return e},n.prototype._findEdgeRing=function(t){var e=t,o=new s1;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},n.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(o){return e.removeEdge(o)}),t.innerEdges.forEach(function(o){return e.removeEdge(o)}),delete this.nodes[t.id]},n.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},n}();var $Z=Je(a1(),1);var ZZ=Je(a1(),1);var KZ=Je(ML(),1);var iJ=Je(OL(),1);function FL(n){for(var t=n,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function sJ(){return new UL(function(n){return n.f})}var f1={search:function(n,t,e,o){n.cleanDirty(),o=o||{};var s=o.heuristic||f1.heuristics.manhattan,c=o.closest||!1,p=sJ(),h=t;for(t.h=s(t,e),p.push(t);p.size()>0;){var g=p.pop();if(g===e)return FL(g);g.closed=!0;for(var m=n.neighbors(g),_=0,w=m.length;_<w;++_){var x=m[_];if(!(x.closed||x.isWall())){var b=g.g+x.getCost(g),T=x.visited;(!T||b<x.g)&&(x.visited=!0,x.parent=g,x.h=x.h||s(x,e),x.g=b,x.f=x.g+x.h,n.markDirty(x),c&&(x.h<h.h||x.h===h.h&&x.g<h.g)&&(h=x),T?p.rescoreElement(x):p.push(x))}}}return c?FL(h):[]},heuristics:{manhattan:function(n,t){var e=Math.abs(t.x-n.x),o=Math.abs(t.y-n.y);return e+o},diagonal:function(n,t){var e=1,o=Math.sqrt(2),s=Math.abs(t.x-n.x),c=Math.abs(t.y-n.y);return e*(s+c)+(o-2*e)*Math.min(s,c)}},cleanNode:function(n){n.f=0,n.g=0,n.h=0,n.visited=!1,n.closed=!1,n.parent=null}};function Ch(n,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<n.length;e++){this.grid[e]=[];for(var o=0,s=n[e];o<s.length;o++){var c=new Fg(e,o,s[o]);this.grid[e][o]=c,this.nodes.push(c)}}this.init()}Ch.prototype.init=function(){this.dirtyNodes=[];for(var n=0;n<this.nodes.length;n++)f1.cleanNode(this.nodes[n])};Ch.prototype.cleanDirty=function(){for(var n=0;n<this.dirtyNodes.length;n++)f1.cleanNode(this.dirtyNodes[n]);this.dirtyNodes=[]};Ch.prototype.markDirty=function(n){this.dirtyNodes.push(n)};Ch.prototype.neighbors=function(n){var t=[],e=n.x,o=n.y,s=this.grid;return s[e-1]&&s[e-1][o]&&t.push(s[e-1][o]),s[e+1]&&s[e+1][o]&&t.push(s[e+1][o]),s[e]&&s[e][o-1]&&t.push(s[e][o-1]),s[e]&&s[e][o+1]&&t.push(s[e][o+1]),this.diagonal&&(s[e-1]&&s[e-1][o-1]&&t.push(s[e-1][o-1]),s[e+1]&&s[e+1][o-1]&&t.push(s[e+1][o-1]),s[e-1]&&s[e-1][o+1]&&t.push(s[e-1][o+1]),s[e+1]&&s[e+1][o+1]&&t.push(s[e+1][o+1])),t};Ch.prototype.toString=function(){for(var n=[],t=this.grid,e,o,s,c,p=0,h=t.length;p<h;p++){for(e=[],o=t[p],s=0,c=o.length;s<c;s++)e.push(o[s].weight);n.push(e.join(" "))}return n.join(\`
19841
- \`)};function Fg(n,t,e){this.x=n,this.y=t,this.weight=e}Fg.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Fg.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};Fg.prototype.isWall=function(){return this.weight===0};function UL(n){this.content=[],this.scoreFunction=n}UL.prototype={push:function(n){this.content.push(n),this.sinkDown(this.content.length-1)},pop:function(){var n=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),n},remove:function(n){var t=this.content.indexOf(n),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(n)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(n){this.sinkDown(this.content.indexOf(n))},sinkDown:function(n){for(var t=this.content[n];n>0;){var e=(n+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[n]=o,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],o=this.scoreFunction(e);;){var s=n+1<<1,c=s-1,p=null,h;if(c<t){var g=this.content[c];h=this.scoreFunction(g),h<o&&(p=c)}if(s<t){var m=this.content[s],_=this.scoreFunction(m);_<(p===null?o:h)&&(p=s)}if(p!==null)this.content[n]=this.content[p],this.content[p]=e,n=p;else break}}};function h1(){this._=null}function hf(n){n.U=n.C=n.L=n.R=n.P=n.N=null}h1.prototype={constructor:h1,insert:function(n,t){var e,o,s;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=BL(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)o=e.U,e===o.L?(s=o.R,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.R&&(Ph(this,e),n=e,e=n.U),e.C=!1,o.C=!0,Ih(this,o))):(s=o.L,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.L&&(Ih(this,e),n=e,e=n.U),e.C=!1,o.C=!0,Ph(this,o))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t=n.U,e,o=n.L,s=n.R,c,p;if(o?s?c=BL(s):c=o:c=s,t?t.L===n?t.L=c:t.R=c:this._=c,o&&s?(p=c.C,c.C=n.C,c.L=o,o.U=c,c!==s?(t=c.U,c.U=n.U,n=c.R,t.L=n,c.R=s,s.U=c):(c.U=t,t=c,n=c.R)):(p=n.C,n=c),n&&(n.U=t),!p){if(n&&n.C){n.C=!1;return}do{if(n===this._)break;if(n===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,Ph(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,Ih(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Ph(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,Ih(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,Ph(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,Ih(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function Ph(n,t){var e=t,o=t.R,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function Ih(n,t){var e=t,o=t.L,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function BL(n){for(;n.L;)n=n.L;return n}var p1=h1;function pf(n,t,e,o){var s=[null,null],c=Hi.push(s)-1;return s.left=n,s.right=t,e&&Rh(s,n,t,e),o&&Rh(s,t,n,o),To[n.index].halfedges.push(c),To[t.index].halfedges.push(c),s}function df(n,t,e){var o=[t,e];return o.left=n,o}function Rh(n,t,e,o){!n[0]&&!n[1]?(n[0]=o,n.left=t,n.right=e):n.left===e?n[1]=o:n[0]=o}function aJ(n,t,e,o,s){var c=n[0],p=n[1],h=c[0],g=c[1],m=p[0],_=p[1],w=0,x=1,b=m-h,T=_-g,I;if(I=t-h,!(!b&&I>0)){if(I/=b,b<0){if(I<w)return;I<x&&(x=I)}else if(b>0){if(I>x)return;I>w&&(w=I)}if(I=o-h,!(!b&&I<0)){if(I/=b,b<0){if(I>x)return;I>w&&(w=I)}else if(b>0){if(I<w)return;I<x&&(x=I)}if(I=e-g,!(!T&&I>0)){if(I/=T,T<0){if(I<w)return;I<x&&(x=I)}else if(T>0){if(I>x)return;I>w&&(w=I)}if(I=s-g,!(!T&&I<0)){if(I/=T,T<0){if(I>x)return;I>w&&(w=I)}else if(T>0){if(I<w)return;I<x&&(x=I)}return!(w>0)&&!(x<1)||(w>0&&(n[0]=[h+w*b,g+w*T]),x<1&&(n[1]=[h+x*b,g+x*T])),!0}}}}}function uJ(n,t,e,o,s){var c=n[1];if(c)return!0;var p=n[0],h=n.left,g=n.right,m=h[0],_=h[1],w=g[0],x=g[1],b=(m+w)/2,T=(_+x)/2,I,S;if(x===_){if(b<t||b>=o)return;if(m>w){if(!p)p=[b,e];else if(p[1]>=s)return;c=[b,s]}else{if(!p)p=[b,s];else if(p[1]<e)return;c=[b,e]}}else if(I=(m-w)/(x-_),S=T-I*b,I<-1||I>1)if(m>w){if(!p)p=[(e-S)/I,e];else if(p[1]>=s)return;c=[(s-S)/I,s]}else{if(!p)p=[(s-S)/I,s];else if(p[1]<e)return;c=[(e-S)/I,e]}else if(_<x){if(!p)p=[t,I*t+S];else if(p[0]>=o)return;c=[o,I*o+S]}else{if(!p)p=[o,I*o+S];else if(p[0]<t)return;c=[t,I*t+S]}return n[0]=p,n[1]=c,!0}function zL(n,t,e,o){for(var s=Hi.length,c;s--;)(!uJ(c=Hi[s],n,t,e,o)||!aJ(c,n,t,e,o)||!(Math.abs(c[0][0]-c[1][0])>Er||Math.abs(c[0][1]-c[1][1])>Er))&&delete Hi[s]}function GL(n){return To[n.index]={site:n,halfedges:[]}}function lJ(n,t){var e=n.site,o=t.left,s=t.right;return e===s&&(s=o,o=e),s?Math.atan2(s[1]-o[1],s[0]-o[0]):(e===o?(o=t[1],s=t[0]):(o=t[0],s=t[1]),Math.atan2(o[0]-s[0],s[1]-o[1]))}function d1(n,t){return t[+(t.left!==n.site)]}function cJ(n,t){return t[+(t.left===n.site)]}function kL(){for(var n=0,t=To.length,e,o,s,c;n<t;++n)if((e=To[n])&&(c=(o=e.halfedges).length)){var p=new Array(c),h=new Array(c);for(s=0;s<c;++s)p[s]=s,h[s]=lJ(e,Hi[o[s]]);for(p.sort(function(g,m){return h[m]-h[g]}),s=0;s<c;++s)h[s]=o[p[s]];for(s=0;s<c;++s)o[s]=h[s]}}function qL(n,t,e,o){var s=To.length,c,p,h,g,m,_,w,x,b,T,I,S,E=!0;for(c=0;c<s;++c)if(p=To[c]){for(h=p.site,m=p.halfedges,g=m.length;g--;)Hi[m[g]]||m.splice(g,1);for(g=0,_=m.length;g<_;)T=cJ(p,Hi[m[g]]),I=T[0],S=T[1],w=d1(p,Hi[m[++g%_]]),x=w[0],b=w[1],(Math.abs(I-x)>Er||Math.abs(S-b)>Er)&&(m.splice(g,0,Hi.push(df(h,T,Math.abs(I-n)<Er&&o-S>Er?[n,Math.abs(x-n)<Er?b:o]:Math.abs(S-o)<Er&&e-I>Er?[Math.abs(b-o)<Er?x:e,o]:Math.abs(I-e)<Er&&S-t>Er?[e,Math.abs(x-e)<Er?b:t]:Math.abs(S-t)<Er&&I-n>Er?[Math.abs(b-t)<Er?x:n,t]:null))-1),++_);_&&(E=!1)}if(E){var R,C,F,W=1/0;for(c=0,E=null;c<s;++c)(p=To[c])&&(h=p.site,R=h[0]-n,C=h[1]-t,F=R*R+C*C,F<W&&(W=F,E=p));if(E){var X=[n,t],q=[n,o],D=[e,o],xt=[e,t];E.halfedges.push(Hi.push(df(h=E.site,X,q))-1,Hi.push(df(h,q,D))-1,Hi.push(df(h,D,xt))-1,Hi.push(df(h,xt,X))-1)}}for(c=0;c<s;++c)(p=To[c])&&(p.halfedges.length||delete To[c])}var HL=[],Ug;function fJ(){hf(this),this.x=this.y=this.arc=this.site=this.cy=null}function Wl(n){var t=n.P,e=n.N;if(!(!t||!e)){var o=t.site,s=n.site,c=e.site;if(o!==c){var p=s[0],h=s[1],g=o[0]-p,m=o[1]-h,_=c[0]-p,w=c[1]-h,x=2*(g*w-m*_);if(!(x>=-VL)){var b=g*g+m*m,T=_*_+w*w,I=(w*b-m*T)/x,S=(g*T-_*b)/x,E=HL.pop()||new fJ;E.arc=n,E.site=s,E.x=I+p,E.y=(E.cy=S+h)+Math.sqrt(I*I+S*S),n.circle=E;for(var R=null,C=gf._;C;)if(E.y<C.y||E.y===C.y&&E.x<=C.x)if(C.L)C=C.L;else{R=C.P;break}else if(C.R)C=C.R;else{R=C;break}gf.insert(R,E),R||(Ug=E)}}}}function Xl(n){var t=n.circle;t&&(t.P||(Ug=t.N),gf.remove(t),HL.push(t),hf(t),n.circle=null)}var XL=[];function hJ(){hf(this),this.edge=this.site=this.circle=null}function WL(n){var t=XL.pop()||new hJ;return t.site=n,t}function g1(n){Xl(n),Yl.remove(n),XL.push(n),hf(n)}function YL(n){var t=n.circle,e=t.x,o=t.cy,s=[e,o],c=n.P,p=n.N,h=[n];g1(n);for(var g=c;g.circle&&Math.abs(e-g.circle.x)<Er&&Math.abs(o-g.circle.cy)<Er;)c=g.P,h.unshift(g),g1(g),g=c;h.unshift(g),Xl(g);for(var m=p;m.circle&&Math.abs(e-m.circle.x)<Er&&Math.abs(o-m.circle.cy)<Er;)p=m.N,h.push(m),g1(m),m=p;h.push(m),Xl(m);var _=h.length,w;for(w=1;w<_;++w)m=h[w],g=h[w-1],Rh(m.edge,g.site,m.site,s);g=h[0],m=h[_-1],m.edge=pf(g.site,m.site,null,s),Wl(g),Wl(m)}function $L(n){for(var t=n[0],e=n[1],o,s,c,p,h=Yl._;h;)if(c=ZL(h,e)-t,c>Er)h=h.L;else if(p=t-pJ(h,e),p>Er){if(!h.R){o=h;break}h=h.R}else{c>-Er?(o=h.P,s=h):p>-Er?(o=h,s=h.N):o=s=h;break}GL(n);var g=WL(n);if(Yl.insert(o,g),!(!o&&!s)){if(o===s){Xl(o),s=WL(o.site),Yl.insert(g,s),g.edge=s.edge=pf(o.site,g.site),Wl(o),Wl(s);return}if(!s){g.edge=pf(o.site,g.site);return}Xl(o),Xl(s);var m=o.site,_=m[0],w=m[1],x=n[0]-_,b=n[1]-w,T=s.site,I=T[0]-_,S=T[1]-w,E=2*(x*S-b*I),R=x*x+b*b,C=I*I+S*S,F=[(S*R-b*C)/E+_,(x*C-I*R)/E+w];Rh(s.edge,m,T,F),g.edge=pf(m,n,null,F),s.edge=pf(n,T,null,F),Wl(o),Wl(s)}}function ZL(n,t){var e=n.site,o=e[0],s=e[1],c=s-t;if(!c)return o;var p=n.P;if(!p)return-1/0;e=p.site;var h=e[0],g=e[1],m=g-t;if(!m)return h;var _=h-o,w=1/c-1/m,x=_/m;return w?(-x+Math.sqrt(x*x-2*w*(_*_/(-2*m)-g+m/2+s-c/2)))/w+o:(o+h)/2}function pJ(n,t){var e=n.N;if(e)return ZL(e,t);var o=n.site;return o[1]===t?o[0]:1/0}var Er=1e-6,VL=1e-12,Yl,To,gf,Hi;function dJ(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function gJ(n,t){return t[1]-n[1]||t[0]-n[0]}function Bg(n,t){var e=n.sort(gJ).pop(),o,s,c;for(Hi=[],To=new Array(n.length),Yl=new p1,gf=new p1;;)if(c=Ug,e&&(!c||e[1]<c.y||e[1]===c.y&&e[0]<c.x))(e[0]!==o||e[1]!==s)&&($L(e),o=e[0],s=e[1]),e=n.pop();else if(c)YL(c.arc);else break;if(kL(),t){var p=+t[0][0],h=+t[0][1],g=+t[1][0],m=+t[1][1];zL(p,h,g,m),qL(p,h,g,m)}this.edges=Hi,this.cells=To,Yl=gf=Hi=To=null}Bg.prototype={constructor:Bg,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return d1(t,n[o])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,o){if(h=(c=e.halfedges).length)for(var s=e.site,c,p=-1,h,g,m=t[c[h-1]],_=m.left===s?m.right:m.left;++p<h;)g=_,m=t[c[p]],_=m.left===s?m.right:m.left,g&&_&&o<g.index&&o<_.index&&dJ(s,g,_)<0&&n.push([s.data,g.data,_.data])}),n},links:function(){return this.edges.filter(function(n){return n.right}).map(function(n){return{source:n.left.data,target:n.right.data}})},find:function(n,t,e){for(var o=this,s,c=o._found||0,p=o.cells.length,h;!(h=o.cells[c]);)if(++c>=p)return null;var g=n-h.site[0],m=t-h.site[1],_=g*g+m*m;do h=o.cells[s=c],c=null,h.halfedges.forEach(function(w){var x=o.edges[w],b=x.left;if(!((b===h.site||!b)&&!(b=x.right))){var T=n-b[0],I=t-b[1],S=T*T+I*I;S<_&&(_=S,c=b.index)}});while(c!==null);return o._found=s,e==null||_<=e*e?h.site:null}};var SJ=Je(mf(),1);var I1=Je(QL(),1);function Zo(){return new kg}function kg(){this.reset()}kg.prototype={constructor:kg,reset:function(){this.s=this.t=0},add:function(n){tN(Gg,n,this.t),tN(this,Gg.s,this.s),this.s?this.t+=Gg.t:this.s=Gg.t},valueOf:function(){return this.s}};var Gg=new kg;function tN(n,t,e){var o=n.s=t+e,s=o-t,c=o-s;n.t=t-c+(e-s)}var er=1e-6;var gr=Math.PI,Mi=gr/2,qg=gr/4,Oa=gr*2,$l=180/gr,Jo=gr/180,Zr=Math.abs,aa=Math.atan,Ko=Math.atan2,Wn=Math.cos;var Hg=Math.exp;var Lh=Math.log;var an=Math.sin;var no=Math.sqrt,Nh=Math.tan;function v1(n){return n>1?0:n<-1?gr:Math.acos(n)}function Co(n){return n>1?Mi:n<-1?-Mi:Math.asin(n)}function ua(){}var MJ=Zo(),rpt=Zo();function Zl(n){var t=n[0],e=n[1],o=Wn(e);return[o*Wn(t),o*an(t),an(e)]}function Oh(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function Dh(n){var t=no(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var ppt=Zo();function nN(n,t){return[n>gr?n-Oa:n<-gr?n+Oa:n,t]}nN.invert=nN;function _1(){var n=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){n.push(t=[])},lineEnd:ua,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function x1(n,t){return Zr(n[0]-t[0])<er&&Zr(n[1]-t[1])<er}function Vg(n,t,e,o){this.x=n,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function E1(n,t,e,o,s){var c=[],p=[],h,g;if(n.forEach(function(T){if(!((I=T.length-1)<=0)){var I,S=T[0],E=T[I],R;if(x1(S,E)){for(s.lineStart(),h=0;h<I;++h)s.point((S=T[h])[0],S[1]);s.lineEnd();return}c.push(R=new Vg(S,T,null,!0)),p.push(R.o=new Vg(S,null,R,!1)),c.push(R=new Vg(E,T,null,!1)),p.push(R.o=new Vg(E,null,R,!0))}}),!!c.length){for(p.sort(t),rN(c),rN(p),h=0,g=p.length;h<g;++h)p[h].e=e=!e;for(var m=c[0],_,w;;){for(var x=m,b=!0;x.v;)if((x=x.n)===m)return;_=x.z,s.lineStart();do{if(x.v=x.o.v=!0,x.e){if(b)for(h=0,g=_.length;h<g;++h)s.point((w=_[h])[0],w[1]);else o(x.x,x.n.x,1,s);x=x.n}else{if(b)for(_=x.p.z,h=_.length-1;h>=0;--h)s.point((w=_[h])[0],w[1]);else o(x.x,x.p.x,-1,s);x=x.p}x=x.o,_=x.z,b=!b}while(!x.v);s.lineEnd()}}}function rN(n){if(t=n.length){for(var t,e=0,o=n[0],s;++e<t;)o.n=s=n[e],s.p=o,o=s;o.n=s=n[0],s.p=o}}function sl(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function w1(n){return n.length===1&&(n=TJ(n)),{left:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var c=o+s>>>1;n(t[c],e)<0?o=c+1:s=c}return o},right:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var c=o+s>>>1;n(t[c],e)>0?s=c:o=c+1}return o}}}function TJ(n){return function(t,e){return sl(n(t),e)}}var iN=w1(sl),CJ=iN.right,PJ=iN.left;var oN=Array.prototype,RJ=oN.slice,LJ=oN.map;var odt=Math.sqrt(50),sdt=Math.sqrt(10),adt=Math.sqrt(2);function Xg(n){for(var t=n.length,e,o=-1,s=0,c,p;++o<t;)s+=n[o].length;for(c=new Array(s);--t>=0;)for(p=n[t],e=p.length;--e>=0;)c[--s]=p[e];return c}var GJ=1e9,Vgt=-GJ;var S1=Zo();function M1(n,t){var e=t[0],o=t[1],s=[an(e),-Wn(e),0],c=0,p=0;S1.reset();for(var h=0,g=n.length;h<g;++h)if(_=(m=n[h]).length)for(var m,_,w=m[_-1],x=w[0],b=w[1]/2+qg,T=an(b),I=Wn(b),S=0;S<_;++S,x=R,T=F,I=W,w=E){var E=m[S],R=E[0],C=E[1]/2+qg,F=an(C),W=Wn(C),X=R-x,q=X>=0?1:-1,D=q*X,xt=D>gr,B=T*F;if(S1.add(Ko(B*q*an(D),I*W+B*Wn(D))),c+=xt?X+q*Oa:X,xt^x>=e^R>=e){var j=Oh(Zl(w),Zl(E));Dh(j);var J=Oh(s,j);Dh(J);var Dt=(xt^X>=0?-1:1)*Co(J[2]);(o>Dt||o===Dt&&(j[0]||j[1]))&&(p+=xt^X>=0?1:-1)}}return(c<-er||c<er&&S1<-er)^p&1}var tmt=Zo();var _mt=Zo(),xmt=Zo();var HJ=1/0;var Smt=-HJ;function b1(n){this._context=n}b1.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._context.moveTo(n,t),this._point=1;break}case 1:{this._context.lineTo(n,t);break}default:{this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,Oa);break}}},result:ua};var Nmt=Zo();function A1(){this._string=[]}A1.prototype={_radius:4.5,_circle:uN(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._string.push("M",n,",",t),this._point=1;break}case 1:{this._string.push("L",n,",",t);break}default:{this._circle==null&&(this._circle=uN(this._radius)),this._string.push("M",n,",",t,this._circle);break}}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}else return null}};function uN(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function T1(n,t,e,o){return function(s,c){var p=t(c),h=s.invert(o[0],o[1]),g=_1(),m=t(g),_=!1,w,x,b,T={point:I,lineStart:E,lineEnd:R,polygonStart:function(){T.point=C,T.lineStart=F,T.lineEnd=W,x=[],w=[]},polygonEnd:function(){T.point=I,T.lineStart=E,T.lineEnd=R,x=Xg(x);var X=M1(w,h);x.length?(_||(c.polygonStart(),_=!0),E1(x,XJ,X,e,c)):X&&(_||(c.polygonStart(),_=!0),c.lineStart(),e(null,null,1,c),c.lineEnd()),_&&(c.polygonEnd(),_=!1),x=w=null},sphere:function(){c.polygonStart(),c.lineStart(),e(null,null,1,c),c.lineEnd(),c.polygonEnd()}};function I(X,q){var D=s(X,q);n(X=D[0],q=D[1])&&c.point(X,q)}function S(X,q){var D=s(X,q);p.point(D[0],D[1])}function E(){T.point=S,p.lineStart()}function R(){T.point=I,p.lineEnd()}function C(X,q){b.push([X,q]);var D=s(X,q);m.point(D[0],D[1])}function F(){m.lineStart(),b=[]}function W(){C(b[0][0],b[0][1]),m.lineEnd();var X=m.clean(),q=g.result(),D,xt=q.length,B,j,J;if(b.pop(),w.push(b),b=null,!!xt){if(X&1){if(j=q[0],(B=j.length-1)>0){for(_||(c.polygonStart(),_=!0),c.lineStart(),D=0;D<B;++D)c.point((J=j[D])[0],J[1]);c.lineEnd()}return}xt>1&&X&2&&q.push(q.pop().concat(q.shift())),x.push(q.filter(WJ))}}return T}}function WJ(n){return n.length>1}function XJ(n,t){return((n=n.x)[0]<0?n[1]-Mi-er:Mi-n[1])-((t=t.x)[0]<0?t[1]-Mi-er:Mi-t[1])}var YJ=T1(function(){return!0},$J,JJ,[-gr,-Mi]);function $J(n){var t=NaN,e=NaN,o=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(c,p){var h=c>0?gr:-gr,g=Zr(c-t);Zr(g-gr)<er?(n.point(t,e=(e+p)/2>0?Mi:-Mi),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(h,e),n.point(c,e),s=0):o!==h&&g>=gr&&(Zr(t-o)<er&&(t-=o*er),Zr(c-h)<er&&(c-=h*er),e=ZJ(t,e,c,p),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(h,e),s=0),n.point(t=c,e=p),o=h},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function ZJ(n,t,e,o){var s,c,p=an(n-e);return Zr(p)>er?aa((an(t)*(c=Wn(o))*an(e)-an(o)*(s=Wn(t))*an(n))/(s*c*p)):(t+o)/2}function JJ(n,t,e,o){var s;if(n==null)s=e*Mi,o.point(-gr,s),o.point(0,s),o.point(gr,s),o.point(gr,0),o.point(gr,-s),o.point(0,-s),o.point(-gr,-s),o.point(-gr,0),o.point(-gr,s);else if(Zr(n[0]-t[0])>er){var c=n[0]<t[0]?gr:-gr;s=e*c/2,o.point(-c,s),o.point(0,s),o.point(c,s)}else o.point(t[0],t[1])}function Yg(n){return function(t){var e=new C1;for(var o in n)e[o]=n[o];return e.stream=t,e}}function C1(){}C1.prototype={constructor:C1,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var x0t=Wn(30*Jo);var O0t=Yg({point:function(n,t){this.stream.point(n*Jo,t*Jo)}});function $g(n){return function(t,e){var o=Wn(t),s=Wn(e),c=n(o*s);return[c*s*an(t),c*an(e)]}}function Da(n){return function(t,e){var o=no(t*t+e*e),s=n(o),c=an(s),p=Wn(s);return[Ko(t*c,o*p),Co(o&&e*c/o)]}}var gN=$g(function(n){return no(2/(1+n))});gN.invert=Da(function(n){return 2*Co(n/2)});var mN=$g(function(n){return(n=v1(n))&&n/an(n)});mN.invert=Da(function(n){return n});function P1(n,t){return[n,Lh(Nh((Mi+t)/2))]}P1.invert=function(n,t){return[n,2*aa(Hg(t))-Mi]};function Zg(n,t){return[n,t]}Zg.invert=Zg;function yN(n,t){var e=Wn(t),o=Wn(n)*e;return[e*an(n)/o,an(t)/o]}yN.invert=Da(aa);function vN(n,t){var e=t*t,o=e*e;return[n*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}vN.invert=function(n,t){var e=t,o=25,s;do{var c=e*e,p=c*c;e-=s=(e*(1.007226+c*(.015085+p*(-.044475+.028874*c-.005916*p)))-t)/(1.007226+c*(.015085*3+p*(-.044475*7+.028874*9*c-.005916*11*p)))}while(Zr(s)>er&&--o>0);return[n/(.8707+(c=e*e)*(-.131979+c*(-.013791+c*c*c*(.003971-.001529*c)))),e]};function _N(n,t){return[Wn(t)*an(n),an(t)]}_N.invert=Da(Co);function xN(n,t){var e=Wn(t),o=1+Wn(n)*e;return[e*an(n)/o,an(t)/o]}xN.invert=Da(function(n){return 2*aa(n)});function EN(n,t){return[Lh(Nh((Mi+t)/2)),-n]}EN.invert=function(n,t){return[-t,2*aa(Hg(n))-Mi]};var nK=Je(mf(),1);var rK=Je(mf(),1);var oK=Je(mf(),1);var sK=Je(mf(),1);function Fa(n,t){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}function SN(n){let t=0;for(let e=0;e<n.length-1;e++)t+=Fa(n[e],n[e+1]);return t}function MN(n,t,e){let o=new ze(t[0]-n[0],t[1]-n[1]),s=new ze(t[0]-e[0],t[1]-e[1]),p=o.angleTo(s)*180/Math.PI,h=new ze(t[0]-n[0],t[1]-n[1]);return new ze(e[0]-n[0],e[1]-n[1]).cross(h)>0?p:-p}var jo=Je(bN(),1);var Xn="___",Jg=class{isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let o=[];try{o=JSON.parse(e.entry_end_floor)}catch(c){o=[]}let s=[];try{s=JSON.parse(e.entry_start_floor)}catch(c){s=[]}return Ru({},e,{entry_start_floor:s,entry_end_floor:o})})}getParkingSpaceInfo(t,e){let o=""+t+Xn+e;var s;return(s=this.parkingMap.get(o))!=null?s:null}getNodeInfo(t,e){let o=""+t+Xn+e,s=this.nodeMap.get(o);if(!(s!=null&&s.length))return null;let c=this.pointMap.get(s[0]);return c!=null?c:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let o=new Date,s=o.getHours()*60+o.getMinutes();t.length&&(t.forEach(c=>{let p=(c.points||[]).filter(h=>!(0,jo.isNil)(h.passWeight)&&h.passWeight!==1&&!(0,jo.isNil)(h.coverageArea)&&h.coverageArea!==0);(c.points||[]).filter(h=>h.openStatus!==!1).filter(h=>{if(!h.startTime||!h.endTime)return!0;let[g,m]=h.startTime.split(":").map(T=>+T),[_,w]=h.endTime.split(":").map(T=>+T),x=g*60+m,b=_*60+w;return s>=x&&s<=b}).forEach(h=>{h.floor=c.floor;let g=""+c.floor+Xn+h.id,m=""+c.floor+Xn+h.nodeId,_=this.nodeMap.get(m)||[];if(_.push(""+c.floor+Xn+(h.relatedId||h.id)),this.nodeMap.set(""+c.floor+Xn+h.nodeId,_),this.pointMap.set(g,h),this.isFacilityByType(h.type)){let w=this.facilities.find(x=>x.id===+h.targetId);if(w){switch(w.entry_infra_type){case"straightLadder":if(w.entry_end_floor.find(I=>I.floor===c.floor)&&w.entry_start_floor.find(I=>I.floor===c.floor)){let I=this.straightLadderMap.get(h.targetId)||[];I.push(Ru({},h)),this.straightLadderMap.set(h.targetId,I)}break;case"staircase":if(w.entry_end_floor.find(I=>I.floor===c.floor)&&w.entry_start_floor.find(I=>I.floor===c.floor)){let I=this.staircaseMap.get(h.targetId)||[];I.push(Ru({},h)),this.staircaseMap.set(h.targetId,I)}break;case"escalator":let b=this.escalatorMap.get(h.targetId)||[];if(w.entry_start_floor.find(I=>I.floor===c.floor)){let I=b.find(S=>{var E;return((E=S.end)==null?void 0:E.floor)!==c.floor&&!S.start});I?I.start=h:b.push({start:h})}if(w.entry_end_floor.find(I=>I.floor===c.floor)){let I=b.find(S=>{var E;return((E=S.start)==null?void 0:E.floor)!==c.floor&&!S.end});I?I.end=h:b.push({end:h})}this.escalatorMap.set(h.targetId,b);break;case"ramp":let T=this.rampMap.get(h.targetId)||[];if(w.entry_start_floor.find(I=>I.floor===c.floor)){let I=T.find(S=>{var E;return((E=S.end)==null?void 0:E.floor)!==c.floor&&!S.start});I?I.start=h:T.push({start:h})}if(w.entry_end_floor.find(I=>I.floor===c.floor)){let I=T.find(S=>{var E;return((E=S.start)==null?void 0:E.floor)!==c.floor&&!S.end});I?I.end=h:T.push({end:h})}this.rampMap.set(h.targetId,T);break;case"connectionPoint":if(w.entry_end_floor.find(I=>I.floor===c.floor)&&w.entry_start_floor.find(I=>I.floor===c.floor)){let I=this.connectionPointMap.get(h.targetId)||[];I.push(Ru({},h)),this.connectionPointMap.set(h.targetId,I)}break}let x=this.facilityMap.get(h.targetId)||[];x.push(Ru({},h)),this.facilityMap.set(h.targetId,x)}}h.type==="parkingSpace"&&h.name.split(/[,\uFF0C]/).forEach(x=>{this.parkingMap.set(""+c.floor+Xn+x,h)})}),(c.lines||[]).filter(h=>h.to!==h.from).forEach(h=>{let g=""+c.floor+Xn+h.from,m=""+c.floor+Xn+h.to,_=this.pointMap.get(g),w=this.pointMap.get(m);if(!_||!w)return;let x=_.cds,b=w.cds,T=Fa(x,b);if(p.forEach(I=>{(I.id===h.from||I.id===h.to)&&(T=T/I.passWeight);let S=Fa(x,I.cds)<=I.coverageArea,E=Fa(b,I.cds)<=I.coverageArea;(S||E)&&(T=T/I.passWeight)}),!_.permission&&!w.permission){switch(this.addLineItem(g,m,T),this.addLineItem(m,g,T),h.direction){case"double":this.addLineItem(g,m,T,this.forwardLineMap),this.addLineItem(m,g,T,this.forwardLineMap);break;case"single":this.addLineItem(g,m,T,this.forwardLineMap);break;case"back":this.addLineItem(m,g,T,this.forwardLineMap);break}(_.type==="parkingSpace"||w.type==="parkingSpace")&&h.direction==="noDir"&&(this.addLineItem(g,m,T,this.forwardLineMap),this.addLineItem(m,g,T,this.forwardLineMap))}else _.permission&&(this.setPermissionLine(g,m,_.permission,T,""),this.setPermissionLine(m,g,_.permission,T,"")),w.permission&&w.permission!==_.permission&&(this.setPermissionLine(g,m,w.permission,T,""),this.setPermissionLine(m,g,w.permission,T,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,o,s,c){this.getPermissionMap(o).add({fromKey:t,toKey:e,distance:s,type:c})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,c=this.pointMap.get(s);if(c){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g)continue;c.permission&&this.setPermissionLine(s,h,c.permission,1,"straightLadder"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,h,g.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,c=this.pointMap.get(s);if(c){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g)continue;c.permission&&this.setPermissionLine(s,h,c.permission,1,"staircase"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,h,g.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Xn+o.start.id,c=""+o.end.floor+Xn+o.end.id,p=this.pointMap.get(s),h=this.pointMap.get(c);p&&h&&(p.permission&&this.setPermissionLine(s,c,p.permission,1,"escalator"),h.permission&&h.permission!==p.permission&&this.setPermissionLine(s,c,h.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Xn+o.start.id,c=""+o.end.floor+Xn+o.end.id,p=this.pointMap.get(s),h=this.pointMap.get(c);p&&h&&(p.permission&&this.setPermissionLine(s,c,p.permission,10,"ramp"),h.permission&&h.permission!==p.permission&&this.setPermissionLine(s,c,h.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{if(t.length<2){this.connectionPointMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,c=this.pointMap.get(s);if(c){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g)continue;c.permission&&this.setPermissionLine(s,h,c.permission,1,"connectionPoint"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,h,g.permission,1,"connectionPoint")}}}})}addPermissionLineToMap(t,e,o,s){this.getPermissionMap(t).forEach(p=>{e.includes(p.type)&&(p.type===""?this.addLineItem(p.fromKey,p.toKey,p.distance,o):this.addLineItem(p.fromKey,p.toKey,s.get(p.type),o))})}addLineItem(t,e,o,s){s===void 0&&(s=this.lineMap);let c=s.get(t)||new Map;c.set(e,o),s.set(t,c)}addFacilityToLineMap(t,e,o,s){[...this.straightLadderMap,...this.staircaseMap].forEach(c=>{let[p,h]=c;if(!(h.length<2))for(let g=0;g<h.length;g++){let m=""+h[g].floor+Xn+h[g].id,_=this.pointMap.get(m);if(!(!_||_.permission)){for(let w=0;w<h.length;w++)if(g!==w){let x=""+h[w].floor+Xn+h[w].id,b=this.pointMap.get(x);if(!b||b.permission)continue;if(h[g].type==="straightLadder"){let T=e;this.addLineItem(m,x,T,s)}else{let T=o;this.addLineItem(m,x,T,s)}}}}}),this.escalatorMap.forEach((c,p)=>{c.forEach(h=>{if(h.start&&h.end){let g=""+h.start.floor+Xn+h.start.id,m=""+h.end.floor+Xn+h.end.id,_=this.pointMap.get(g),w=this.pointMap.get(m);if(_&&w&&!_.permission&&!w.permission){let x=t;this.addLineItem(g,m,x,s)}}})}),this.connectionPointMap.forEach((c,p)=>{if(!(c.length<2))for(let h=0;h<c.length;h++){let g=""+c[h].floor+Xn+c[h].id,m=this.pointMap.get(g);if(!(!m||m.permission)){for(let _=0;_<c.length;_++)if(h!==_){let w=""+c[_].floor+Xn+c[_].id,x=this.pointMap.get(w);if(!x||x.permission)continue;this.addLineItem(g,w,100,s)}}}})}initBaseRoute(){let t=new Map((0,jo.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,t),this.baseRoute=new ro.default(t)}initEscalatorRoute(){let t=new Map((0,jo.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new ro.default(t)}initStraightLadderRoute(){let t=new Map((0,jo.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new ro.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Xn+o.start.id,c=""+o.end.floor+Xn+o.end.id,p=this.pointMap.get(s),h=this.pointMap.get(c);p&&h&&!p.permission&&!h.permission&&this.addLineItem(s,c,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{if(!(t.length<2))for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,c=this.pointMap.get(s);if(!(!c||c.permission)){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g||g.permission)continue;this.addLineItem(s,h,100,this.forwardLineMap)}}}}),this.forwardRoute=new ro.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t,e,o){o===void 0&&(o={});var s;if(t.nodeId){let c=this.nodeMap.get(""+t.floor+Xn+t.nodeId);if(c!=null&&c.length)return c.map(p=>{let[h,g]=p.split(Xn);return{floor:h,id:g}})}if((s=t.coord)!=null&&s.length){let c=this.roadInfo.find(m=>m.floor===t.floor);if(!c)return null;let p=c.points.filter(m=>m.isStarted),h=c.points.filter(m=>{let _=""+m.floor+Xn+m.id;if(e==="forward"){if(!this.forwardLineMap.has(_)||o.adsorptionIntersection&&p.length&&!m.isStarted)return!1}else if(!this.lineMap.has(_))return!1;return!0});if(!h.length)return null;let g=h.reduce((m,_)=>{if(_.relatedId)return m;let w=Fa(t.coord,_.cds);return w<m.min&&(m.min=w,m.point=_),m},{min:1/0,point:h[0]});return[{floor:c.floor,id:g.point.id}]}return null}transformEnd(t,e){if(t.floor){if(t.parkingSpace){let s=this.parkingMap.get(""+t.floor+Xn+t.parkingSpace);if(s)return[{floor:t.floor,id:s.id}]}let o=this.transformStart(t,e);if(o)return o}if(t.facility){let s=this.facilities.filter(c=>+c.type_id==+t.facility).map(c=>c.id).map(c=>this.facilityMap.get(""+c)).flat(2);if(s!=null&&s.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o,s,c,p){if(o===void 0&&(o=""),p===void 0&&(p={}),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let h=this.transformStart(t,o,p);if(!h)return"no-start";let g=this.transformEnd(e,o);if(!g)return"no-end";let m=[];if(Array.isArray(g))for(let x=0;x<h.length;x++){let b=h[x];for(let T=0;T<g.length;T++){let I=g[T];if(b.floor===I.floor&&b.id===I.id)return"near"}}else{m=this.facilities.filter(b=>+b.type_id==+e.facility).map(b=>b.id).map(b=>this.facilityMap.get(""+b)).flat(2).filter(b=>b).filter(b=>g.floor?b.floor===g.floor:!0);for(let b=0;b<h.length;b++){let T=h[b];for(let I=0;I<m.length;I++){let S=m[I];if(T.floor===S.floor&&T.id===S.id)return"near"}}}let _;switch(o){case"escalator":_=this.getEscalatorPath.bind(this);break;case"straightLadder":_=this.getStraightLadderPath.bind(this);break;case"forward":_=this.getForwardPath.bind(this);break;default:_=this.getBasePath.bind(this);break}let w=null;return h.forEach(x=>{if(Array.isArray(g))g.forEach(b=>{let T=_(x,b,s,c);T&&T&&(!w||T[0].consume<w[0].consume)&&(w=T)});else{if(!m.length)return null;let b=m.map(T=>_(x,{floor:T.floor,id:T.id},s,c)).filter(T=>!!T);w=b.reduce((T,I)=>{let S=I[0].consume;return S<T.distance&&(T.distance=S,T.path=I),T},{distance:1/0,path:b[0]}).path}}),w}getRoutePath(t,e,o){let s=""+t.floor+Xn+t.id,c=""+e.floor+Xn+e.id,p=o.path(s,c);if(!p)return null;let h=[],g=p.reduce((m,_,w,x)=>{if(w===0)return 0;let b=x[w-1],T=o.graph.get(b).get(_);return m+T},0);return p.map(m=>{let _=this.pointMap.get(m);if(_){var w;let{floor:x}=_,b=_.type;if(this.isFacilityByType(_.type)){let T=this.facilities.find(I=>I.id===+_.targetId);T&&(b=T.entry_infra_type)}if(((w=h[h.length-1])==null?void 0:w.floor)===x){let T=h[h.length-1];T.points.push(_.cds),T.pointInfos.push(_),T.endType=b,T.destId=_.nodeId,T.distance=SN(T.points)}else h.push({floor:x,points:[_.cds],pointInfos:[_],endType:b,destId:_.nodeId,distance:0,consume:g})}}),h}getBasePath(t,e,o){if(!o)return this.getRoutePath(t,e,this.baseRoute);let s=(0,jo.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let c=new ro.default(s);return this.getRoutePath(t,e,c)}getEscalatorPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.escalatorRoute);let s=(0,jo.cloneDeep)(this.escalatorRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",1*c],["connectionPoint",100],["straightLadder",this.lift_priority*c],["staircase",3e4*c]]));let p=new ro.default(s);return this.getRoutePath(t,e,p)}getStraightLadderPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.straightLadderRoute);let s=(0,jo.cloneDeep)(this.straightLadderRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",3*c],["connectionPoint",100],["straightLadder",1*c],["staircase",3e4*c]]));let p=new ro.default(s);return this.getRoutePath(t,e,p)}getForwardPath(t,e,o,s){let c=new Map,p=x=>{let b=this.forwardRoute.graph.get(g);x.forEach(T=>{let I=b.get(T);(0,jo.isNil)(I)||(c.set(T,I),b.delete(T))})},h=()=>{let x=this.forwardRoute.graph.get(g);c.forEach((b,T)=>{x.set(T,b)})},g=""+t.floor+Xn+t.id;if(!(0,jo.isNil)(s)){let x=this.forwardLineMap.get(g),b=this.pointMap.get(g);if(b&&(x!=null&&x.size)&&x.size>1){let T=new ze(b.cds[0],b.cds[1]),I=new Map;x.forEach((E,R)=>{let C=this.pointMap.get(R);if(C){let F=new ze(C.cds[0],C.cds[1]),X=360-(new ze().subVectors(F,T).angle()/Math.PI*180-90+360)%360;I.set(R,X)}});let S=Array.from(I).filter(E=>{let[R,C]=E;return Math.abs(C-s)<=60}).map(E=>{let[R]=E;return R});if(S.length)S.forEach(E=>I.delete(E)),p([...I.keys()]);else{let E=Array.from(I).reduce((R,C)=>{let F=Math.abs(C[1]-s);return F<R.diff?{diff:F,key:C[0]}:R},{diff:1/0,key:""});I.delete(E.key),p([...I.keys()])}}}if(!o){let x=this.getRoutePath(t,e,this.forwardRoute);return h(),x||this.getRoutePath(t,e,this.forwardRoute)}let m=(0,jo.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],m,new Map([["ramp",10]]));let _=new ro.default(m),w=this.getRoutePath(t,e,_);if(h(),w)return w;{let x=(0,jo.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],x,new Map([["ramp",10]]));let b=new ro.default(x);return this.getRoutePath(t,e,b)}}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new ro.default,this.escalatorRoute=new ro.default,this.straightLadderRoute=new ro.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.baseRoute=new ro.default,this.escalatorRoute=new ro.default,this.straightLadderRoute=new ro.default,this.forwardLineMap=new Map,this.forwardRoute=new ro.default}};var rwt=Je(Gp(),1),iwt=Je(ty(),1);var gK=Je(IN(),1);function mK(n,t,e){let o=MN(n,t,e);return yK(o)}function yK(n){return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function RN(n){if(!n.length)return[];if(n.length===1)return[{direction:"start",distance:0,points:n}];let t=[{direction:"start",distance:Fa(n[0],n[1]),points:[n[0],n[1]]}];for(let e=2;e<n.length;e++){let o=mK(n[e-2],n[e-1],n[e]);if(o==="front"){let s=t[t.length-1],c=Fa(n[e-1],n[e]);s.distance+=c,e!==2&&s.points.push(n[e-1])}else t.push({direction:o,distance:Fa(n[e-1],n[e]),points:[n[e-1],n[e]]})}return t.push({direction:"end",distance:0,points:[n[n.length-1]]}),t}var gwt=Je(i2(),1),mwt=Je(Xp(),1);function o2(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function s2(n){let t={};for(let o in n)o.startsWith("on")&&(t[o2(o.slice(2))]=n[o]);let e=o=>pp(this,null,function*(){let{data:s}=o;if(t[s.type])try{let c=yield t[s.type](s.data);if(c!=null&&c.$transfer&&Array.isArray(c.$transfer)){let p=c.$transfer;delete c.$transfer,self.postMessage({type:""+s.type+"_result",key:s.key,data:c},p)}else self.postMessage({type:""+s.type+"_result",key:s.key,data:c})}catch(c){self.postMessage({type:""+s.type+"_result",key:s.key,error:c})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var B1=new Jg;s2({onSetRoadInfo(n){let{roadData:t,facilities:e}=n;B1.initRoute(t,e)},onGetPath(n){let{start:t,end:e,type:o,permission:s,travelDirection:c,options:p}=n;return B1.getPath(t,e,o,s,c,p)},onGetDirectionPath(n){return RN(n)},onClear(){B1.clear()}});
19841
+ \`)};function Fg(n,t,e){this.x=n,this.y=t,this.weight=e}Fg.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Fg.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};Fg.prototype.isWall=function(){return this.weight===0};function UL(n){this.content=[],this.scoreFunction=n}UL.prototype={push:function(n){this.content.push(n),this.sinkDown(this.content.length-1)},pop:function(){var n=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),n},remove:function(n){var t=this.content.indexOf(n),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(n)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(n){this.sinkDown(this.content.indexOf(n))},sinkDown:function(n){for(var t=this.content[n];n>0;){var e=(n+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[n]=o,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],o=this.scoreFunction(e);;){var s=n+1<<1,c=s-1,p=null,h;if(c<t){var g=this.content[c];h=this.scoreFunction(g),h<o&&(p=c)}if(s<t){var m=this.content[s],_=this.scoreFunction(m);_<(p===null?o:h)&&(p=s)}if(p!==null)this.content[n]=this.content[p],this.content[p]=e,n=p;else break}}};function h1(){this._=null}function hf(n){n.U=n.C=n.L=n.R=n.P=n.N=null}h1.prototype={constructor:h1,insert:function(n,t){var e,o,s;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=BL(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)o=e.U,e===o.L?(s=o.R,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.R&&(Ph(this,e),n=e,e=n.U),e.C=!1,o.C=!0,Ih(this,o))):(s=o.L,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.L&&(Ih(this,e),n=e,e=n.U),e.C=!1,o.C=!0,Ph(this,o))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t=n.U,e,o=n.L,s=n.R,c,p;if(o?s?c=BL(s):c=o:c=s,t?t.L===n?t.L=c:t.R=c:this._=c,o&&s?(p=c.C,c.C=n.C,c.L=o,o.U=c,c!==s?(t=c.U,c.U=n.U,n=c.R,t.L=n,c.R=s,s.U=c):(c.U=t,t=c,n=c.R)):(p=n.C,n=c),n&&(n.U=t),!p){if(n&&n.C){n.C=!1;return}do{if(n===this._)break;if(n===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,Ph(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,Ih(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Ph(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,Ih(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,Ph(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,Ih(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function Ph(n,t){var e=t,o=t.R,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function Ih(n,t){var e=t,o=t.L,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function BL(n){for(;n.L;)n=n.L;return n}var p1=h1;function pf(n,t,e,o){var s=[null,null],c=Hi.push(s)-1;return s.left=n,s.right=t,e&&Rh(s,n,t,e),o&&Rh(s,t,n,o),To[n.index].halfedges.push(c),To[t.index].halfedges.push(c),s}function df(n,t,e){var o=[t,e];return o.left=n,o}function Rh(n,t,e,o){!n[0]&&!n[1]?(n[0]=o,n.left=t,n.right=e):n.left===e?n[1]=o:n[0]=o}function aJ(n,t,e,o,s){var c=n[0],p=n[1],h=c[0],g=c[1],m=p[0],_=p[1],w=0,x=1,b=m-h,T=_-g,I;if(I=t-h,!(!b&&I>0)){if(I/=b,b<0){if(I<w)return;I<x&&(x=I)}else if(b>0){if(I>x)return;I>w&&(w=I)}if(I=o-h,!(!b&&I<0)){if(I/=b,b<0){if(I>x)return;I>w&&(w=I)}else if(b>0){if(I<w)return;I<x&&(x=I)}if(I=e-g,!(!T&&I>0)){if(I/=T,T<0){if(I<w)return;I<x&&(x=I)}else if(T>0){if(I>x)return;I>w&&(w=I)}if(I=s-g,!(!T&&I<0)){if(I/=T,T<0){if(I>x)return;I>w&&(w=I)}else if(T>0){if(I<w)return;I<x&&(x=I)}return!(w>0)&&!(x<1)||(w>0&&(n[0]=[h+w*b,g+w*T]),x<1&&(n[1]=[h+x*b,g+x*T])),!0}}}}}function uJ(n,t,e,o,s){var c=n[1];if(c)return!0;var p=n[0],h=n.left,g=n.right,m=h[0],_=h[1],w=g[0],x=g[1],b=(m+w)/2,T=(_+x)/2,I,S;if(x===_){if(b<t||b>=o)return;if(m>w){if(!p)p=[b,e];else if(p[1]>=s)return;c=[b,s]}else{if(!p)p=[b,s];else if(p[1]<e)return;c=[b,e]}}else if(I=(m-w)/(x-_),S=T-I*b,I<-1||I>1)if(m>w){if(!p)p=[(e-S)/I,e];else if(p[1]>=s)return;c=[(s-S)/I,s]}else{if(!p)p=[(s-S)/I,s];else if(p[1]<e)return;c=[(e-S)/I,e]}else if(_<x){if(!p)p=[t,I*t+S];else if(p[0]>=o)return;c=[o,I*o+S]}else{if(!p)p=[o,I*o+S];else if(p[0]<t)return;c=[t,I*t+S]}return n[0]=p,n[1]=c,!0}function zL(n,t,e,o){for(var s=Hi.length,c;s--;)(!uJ(c=Hi[s],n,t,e,o)||!aJ(c,n,t,e,o)||!(Math.abs(c[0][0]-c[1][0])>Er||Math.abs(c[0][1]-c[1][1])>Er))&&delete Hi[s]}function GL(n){return To[n.index]={site:n,halfedges:[]}}function lJ(n,t){var e=n.site,o=t.left,s=t.right;return e===s&&(s=o,o=e),s?Math.atan2(s[1]-o[1],s[0]-o[0]):(e===o?(o=t[1],s=t[0]):(o=t[0],s=t[1]),Math.atan2(o[0]-s[0],s[1]-o[1]))}function d1(n,t){return t[+(t.left!==n.site)]}function cJ(n,t){return t[+(t.left===n.site)]}function kL(){for(var n=0,t=To.length,e,o,s,c;n<t;++n)if((e=To[n])&&(c=(o=e.halfedges).length)){var p=new Array(c),h=new Array(c);for(s=0;s<c;++s)p[s]=s,h[s]=lJ(e,Hi[o[s]]);for(p.sort(function(g,m){return h[m]-h[g]}),s=0;s<c;++s)h[s]=o[p[s]];for(s=0;s<c;++s)o[s]=h[s]}}function qL(n,t,e,o){var s=To.length,c,p,h,g,m,_,w,x,b,T,I,S,E=!0;for(c=0;c<s;++c)if(p=To[c]){for(h=p.site,m=p.halfedges,g=m.length;g--;)Hi[m[g]]||m.splice(g,1);for(g=0,_=m.length;g<_;)T=cJ(p,Hi[m[g]]),I=T[0],S=T[1],w=d1(p,Hi[m[++g%_]]),x=w[0],b=w[1],(Math.abs(I-x)>Er||Math.abs(S-b)>Er)&&(m.splice(g,0,Hi.push(df(h,T,Math.abs(I-n)<Er&&o-S>Er?[n,Math.abs(x-n)<Er?b:o]:Math.abs(S-o)<Er&&e-I>Er?[Math.abs(b-o)<Er?x:e,o]:Math.abs(I-e)<Er&&S-t>Er?[e,Math.abs(x-e)<Er?b:t]:Math.abs(S-t)<Er&&I-n>Er?[Math.abs(b-t)<Er?x:n,t]:null))-1),++_);_&&(E=!1)}if(E){var R,C,F,W=1/0;for(c=0,E=null;c<s;++c)(p=To[c])&&(h=p.site,R=h[0]-n,C=h[1]-t,F=R*R+C*C,F<W&&(W=F,E=p));if(E){var X=[n,t],q=[n,o],D=[e,o],xt=[e,t];E.halfedges.push(Hi.push(df(h=E.site,X,q))-1,Hi.push(df(h,q,D))-1,Hi.push(df(h,D,xt))-1,Hi.push(df(h,xt,X))-1)}}for(c=0;c<s;++c)(p=To[c])&&(p.halfedges.length||delete To[c])}var HL=[],Ug;function fJ(){hf(this),this.x=this.y=this.arc=this.site=this.cy=null}function Wl(n){var t=n.P,e=n.N;if(!(!t||!e)){var o=t.site,s=n.site,c=e.site;if(o!==c){var p=s[0],h=s[1],g=o[0]-p,m=o[1]-h,_=c[0]-p,w=c[1]-h,x=2*(g*w-m*_);if(!(x>=-VL)){var b=g*g+m*m,T=_*_+w*w,I=(w*b-m*T)/x,S=(g*T-_*b)/x,E=HL.pop()||new fJ;E.arc=n,E.site=s,E.x=I+p,E.y=(E.cy=S+h)+Math.sqrt(I*I+S*S),n.circle=E;for(var R=null,C=gf._;C;)if(E.y<C.y||E.y===C.y&&E.x<=C.x)if(C.L)C=C.L;else{R=C.P;break}else if(C.R)C=C.R;else{R=C;break}gf.insert(R,E),R||(Ug=E)}}}}function Xl(n){var t=n.circle;t&&(t.P||(Ug=t.N),gf.remove(t),HL.push(t),hf(t),n.circle=null)}var XL=[];function hJ(){hf(this),this.edge=this.site=this.circle=null}function WL(n){var t=XL.pop()||new hJ;return t.site=n,t}function g1(n){Xl(n),Yl.remove(n),XL.push(n),hf(n)}function YL(n){var t=n.circle,e=t.x,o=t.cy,s=[e,o],c=n.P,p=n.N,h=[n];g1(n);for(var g=c;g.circle&&Math.abs(e-g.circle.x)<Er&&Math.abs(o-g.circle.cy)<Er;)c=g.P,h.unshift(g),g1(g),g=c;h.unshift(g),Xl(g);for(var m=p;m.circle&&Math.abs(e-m.circle.x)<Er&&Math.abs(o-m.circle.cy)<Er;)p=m.N,h.push(m),g1(m),m=p;h.push(m),Xl(m);var _=h.length,w;for(w=1;w<_;++w)m=h[w],g=h[w-1],Rh(m.edge,g.site,m.site,s);g=h[0],m=h[_-1],m.edge=pf(g.site,m.site,null,s),Wl(g),Wl(m)}function $L(n){for(var t=n[0],e=n[1],o,s,c,p,h=Yl._;h;)if(c=ZL(h,e)-t,c>Er)h=h.L;else if(p=t-pJ(h,e),p>Er){if(!h.R){o=h;break}h=h.R}else{c>-Er?(o=h.P,s=h):p>-Er?(o=h,s=h.N):o=s=h;break}GL(n);var g=WL(n);if(Yl.insert(o,g),!(!o&&!s)){if(o===s){Xl(o),s=WL(o.site),Yl.insert(g,s),g.edge=s.edge=pf(o.site,g.site),Wl(o),Wl(s);return}if(!s){g.edge=pf(o.site,g.site);return}Xl(o),Xl(s);var m=o.site,_=m[0],w=m[1],x=n[0]-_,b=n[1]-w,T=s.site,I=T[0]-_,S=T[1]-w,E=2*(x*S-b*I),R=x*x+b*b,C=I*I+S*S,F=[(S*R-b*C)/E+_,(x*C-I*R)/E+w];Rh(s.edge,m,T,F),g.edge=pf(m,n,null,F),s.edge=pf(n,T,null,F),Wl(o),Wl(s)}}function ZL(n,t){var e=n.site,o=e[0],s=e[1],c=s-t;if(!c)return o;var p=n.P;if(!p)return-1/0;e=p.site;var h=e[0],g=e[1],m=g-t;if(!m)return h;var _=h-o,w=1/c-1/m,x=_/m;return w?(-x+Math.sqrt(x*x-2*w*(_*_/(-2*m)-g+m/2+s-c/2)))/w+o:(o+h)/2}function pJ(n,t){var e=n.N;if(e)return ZL(e,t);var o=n.site;return o[1]===t?o[0]:1/0}var Er=1e-6,VL=1e-12,Yl,To,gf,Hi;function dJ(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function gJ(n,t){return t[1]-n[1]||t[0]-n[0]}function Bg(n,t){var e=n.sort(gJ).pop(),o,s,c;for(Hi=[],To=new Array(n.length),Yl=new p1,gf=new p1;;)if(c=Ug,e&&(!c||e[1]<c.y||e[1]===c.y&&e[0]<c.x))(e[0]!==o||e[1]!==s)&&($L(e),o=e[0],s=e[1]),e=n.pop();else if(c)YL(c.arc);else break;if(kL(),t){var p=+t[0][0],h=+t[0][1],g=+t[1][0],m=+t[1][1];zL(p,h,g,m),qL(p,h,g,m)}this.edges=Hi,this.cells=To,Yl=gf=Hi=To=null}Bg.prototype={constructor:Bg,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return d1(t,n[o])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,o){if(h=(c=e.halfedges).length)for(var s=e.site,c,p=-1,h,g,m=t[c[h-1]],_=m.left===s?m.right:m.left;++p<h;)g=_,m=t[c[p]],_=m.left===s?m.right:m.left,g&&_&&o<g.index&&o<_.index&&dJ(s,g,_)<0&&n.push([s.data,g.data,_.data])}),n},links:function(){return this.edges.filter(function(n){return n.right}).map(function(n){return{source:n.left.data,target:n.right.data}})},find:function(n,t,e){for(var o=this,s,c=o._found||0,p=o.cells.length,h;!(h=o.cells[c]);)if(++c>=p)return null;var g=n-h.site[0],m=t-h.site[1],_=g*g+m*m;do h=o.cells[s=c],c=null,h.halfedges.forEach(function(w){var x=o.edges[w],b=x.left;if(!((b===h.site||!b)&&!(b=x.right))){var T=n-b[0],I=t-b[1],S=T*T+I*I;S<_&&(_=S,c=b.index)}});while(c!==null);return o._found=s,e==null||_<=e*e?h.site:null}};var SJ=Je(mf(),1);var I1=Je(QL(),1);function Zo(){return new kg}function kg(){this.reset()}kg.prototype={constructor:kg,reset:function(){this.s=this.t=0},add:function(n){tN(Gg,n,this.t),tN(this,Gg.s,this.s),this.s?this.t+=Gg.t:this.s=Gg.t},valueOf:function(){return this.s}};var Gg=new kg;function tN(n,t,e){var o=n.s=t+e,s=o-t,c=o-s;n.t=t-c+(e-s)}var er=1e-6;var gr=Math.PI,Mi=gr/2,qg=gr/4,Oa=gr*2,$l=180/gr,Jo=gr/180,Zr=Math.abs,aa=Math.atan,Ko=Math.atan2,Wn=Math.cos;var Hg=Math.exp;var Lh=Math.log;var an=Math.sin;var no=Math.sqrt,Nh=Math.tan;function v1(n){return n>1?0:n<-1?gr:Math.acos(n)}function Co(n){return n>1?Mi:n<-1?-Mi:Math.asin(n)}function ua(){}var MJ=Zo(),rpt=Zo();function Zl(n){var t=n[0],e=n[1],o=Wn(e);return[o*Wn(t),o*an(t),an(e)]}function Oh(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function Dh(n){var t=no(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var ppt=Zo();function nN(n,t){return[n>gr?n-Oa:n<-gr?n+Oa:n,t]}nN.invert=nN;function _1(){var n=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){n.push(t=[])},lineEnd:ua,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function x1(n,t){return Zr(n[0]-t[0])<er&&Zr(n[1]-t[1])<er}function Vg(n,t,e,o){this.x=n,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function E1(n,t,e,o,s){var c=[],p=[],h,g;if(n.forEach(function(T){if(!((I=T.length-1)<=0)){var I,S=T[0],E=T[I],R;if(x1(S,E)){for(s.lineStart(),h=0;h<I;++h)s.point((S=T[h])[0],S[1]);s.lineEnd();return}c.push(R=new Vg(S,T,null,!0)),p.push(R.o=new Vg(S,null,R,!1)),c.push(R=new Vg(E,T,null,!1)),p.push(R.o=new Vg(E,null,R,!0))}}),!!c.length){for(p.sort(t),rN(c),rN(p),h=0,g=p.length;h<g;++h)p[h].e=e=!e;for(var m=c[0],_,w;;){for(var x=m,b=!0;x.v;)if((x=x.n)===m)return;_=x.z,s.lineStart();do{if(x.v=x.o.v=!0,x.e){if(b)for(h=0,g=_.length;h<g;++h)s.point((w=_[h])[0],w[1]);else o(x.x,x.n.x,1,s);x=x.n}else{if(b)for(_=x.p.z,h=_.length-1;h>=0;--h)s.point((w=_[h])[0],w[1]);else o(x.x,x.p.x,-1,s);x=x.p}x=x.o,_=x.z,b=!b}while(!x.v);s.lineEnd()}}}function rN(n){if(t=n.length){for(var t,e=0,o=n[0],s;++e<t;)o.n=s=n[e],s.p=o,o=s;o.n=s=n[0],s.p=o}}function sl(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function w1(n){return n.length===1&&(n=TJ(n)),{left:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var c=o+s>>>1;n(t[c],e)<0?o=c+1:s=c}return o},right:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var c=o+s>>>1;n(t[c],e)>0?s=c:o=c+1}return o}}}function TJ(n){return function(t,e){return sl(n(t),e)}}var iN=w1(sl),CJ=iN.right,PJ=iN.left;var oN=Array.prototype,RJ=oN.slice,LJ=oN.map;var odt=Math.sqrt(50),sdt=Math.sqrt(10),adt=Math.sqrt(2);function Xg(n){for(var t=n.length,e,o=-1,s=0,c,p;++o<t;)s+=n[o].length;for(c=new Array(s);--t>=0;)for(p=n[t],e=p.length;--e>=0;)c[--s]=p[e];return c}var GJ=1e9,Vgt=-GJ;var S1=Zo();function M1(n,t){var e=t[0],o=t[1],s=[an(e),-Wn(e),0],c=0,p=0;S1.reset();for(var h=0,g=n.length;h<g;++h)if(_=(m=n[h]).length)for(var m,_,w=m[_-1],x=w[0],b=w[1]/2+qg,T=an(b),I=Wn(b),S=0;S<_;++S,x=R,T=F,I=W,w=E){var E=m[S],R=E[0],C=E[1]/2+qg,F=an(C),W=Wn(C),X=R-x,q=X>=0?1:-1,D=q*X,xt=D>gr,B=T*F;if(S1.add(Ko(B*q*an(D),I*W+B*Wn(D))),c+=xt?X+q*Oa:X,xt^x>=e^R>=e){var j=Oh(Zl(w),Zl(E));Dh(j);var J=Oh(s,j);Dh(J);var Dt=(xt^X>=0?-1:1)*Co(J[2]);(o>Dt||o===Dt&&(j[0]||j[1]))&&(p+=xt^X>=0?1:-1)}}return(c<-er||c<er&&S1<-er)^p&1}var tmt=Zo();var _mt=Zo(),xmt=Zo();var HJ=1/0;var Smt=-HJ;function b1(n){this._context=n}b1.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._context.moveTo(n,t),this._point=1;break}case 1:{this._context.lineTo(n,t);break}default:{this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,Oa);break}}},result:ua};var Nmt=Zo();function A1(){this._string=[]}A1.prototype={_radius:4.5,_circle:uN(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._string.push("M",n,",",t),this._point=1;break}case 1:{this._string.push("L",n,",",t);break}default:{this._circle==null&&(this._circle=uN(this._radius)),this._string.push("M",n,",",t,this._circle);break}}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}else return null}};function uN(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function T1(n,t,e,o){return function(s,c){var p=t(c),h=s.invert(o[0],o[1]),g=_1(),m=t(g),_=!1,w,x,b,T={point:I,lineStart:E,lineEnd:R,polygonStart:function(){T.point=C,T.lineStart=F,T.lineEnd=W,x=[],w=[]},polygonEnd:function(){T.point=I,T.lineStart=E,T.lineEnd=R,x=Xg(x);var X=M1(w,h);x.length?(_||(c.polygonStart(),_=!0),E1(x,XJ,X,e,c)):X&&(_||(c.polygonStart(),_=!0),c.lineStart(),e(null,null,1,c),c.lineEnd()),_&&(c.polygonEnd(),_=!1),x=w=null},sphere:function(){c.polygonStart(),c.lineStart(),e(null,null,1,c),c.lineEnd(),c.polygonEnd()}};function I(X,q){var D=s(X,q);n(X=D[0],q=D[1])&&c.point(X,q)}function S(X,q){var D=s(X,q);p.point(D[0],D[1])}function E(){T.point=S,p.lineStart()}function R(){T.point=I,p.lineEnd()}function C(X,q){b.push([X,q]);var D=s(X,q);m.point(D[0],D[1])}function F(){m.lineStart(),b=[]}function W(){C(b[0][0],b[0][1]),m.lineEnd();var X=m.clean(),q=g.result(),D,xt=q.length,B,j,J;if(b.pop(),w.push(b),b=null,!!xt){if(X&1){if(j=q[0],(B=j.length-1)>0){for(_||(c.polygonStart(),_=!0),c.lineStart(),D=0;D<B;++D)c.point((J=j[D])[0],J[1]);c.lineEnd()}return}xt>1&&X&2&&q.push(q.pop().concat(q.shift())),x.push(q.filter(WJ))}}return T}}function WJ(n){return n.length>1}function XJ(n,t){return((n=n.x)[0]<0?n[1]-Mi-er:Mi-n[1])-((t=t.x)[0]<0?t[1]-Mi-er:Mi-t[1])}var YJ=T1(function(){return!0},$J,JJ,[-gr,-Mi]);function $J(n){var t=NaN,e=NaN,o=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(c,p){var h=c>0?gr:-gr,g=Zr(c-t);Zr(g-gr)<er?(n.point(t,e=(e+p)/2>0?Mi:-Mi),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(h,e),n.point(c,e),s=0):o!==h&&g>=gr&&(Zr(t-o)<er&&(t-=o*er),Zr(c-h)<er&&(c-=h*er),e=ZJ(t,e,c,p),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(h,e),s=0),n.point(t=c,e=p),o=h},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function ZJ(n,t,e,o){var s,c,p=an(n-e);return Zr(p)>er?aa((an(t)*(c=Wn(o))*an(e)-an(o)*(s=Wn(t))*an(n))/(s*c*p)):(t+o)/2}function JJ(n,t,e,o){var s;if(n==null)s=e*Mi,o.point(-gr,s),o.point(0,s),o.point(gr,s),o.point(gr,0),o.point(gr,-s),o.point(0,-s),o.point(-gr,-s),o.point(-gr,0),o.point(-gr,s);else if(Zr(n[0]-t[0])>er){var c=n[0]<t[0]?gr:-gr;s=e*c/2,o.point(-c,s),o.point(0,s),o.point(c,s)}else o.point(t[0],t[1])}function Yg(n){return function(t){var e=new C1;for(var o in n)e[o]=n[o];return e.stream=t,e}}function C1(){}C1.prototype={constructor:C1,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var x0t=Wn(30*Jo);var O0t=Yg({point:function(n,t){this.stream.point(n*Jo,t*Jo)}});function $g(n){return function(t,e){var o=Wn(t),s=Wn(e),c=n(o*s);return[c*s*an(t),c*an(e)]}}function Da(n){return function(t,e){var o=no(t*t+e*e),s=n(o),c=an(s),p=Wn(s);return[Ko(t*c,o*p),Co(o&&e*c/o)]}}var gN=$g(function(n){return no(2/(1+n))});gN.invert=Da(function(n){return 2*Co(n/2)});var mN=$g(function(n){return(n=v1(n))&&n/an(n)});mN.invert=Da(function(n){return n});function P1(n,t){return[n,Lh(Nh((Mi+t)/2))]}P1.invert=function(n,t){return[n,2*aa(Hg(t))-Mi]};function Zg(n,t){return[n,t]}Zg.invert=Zg;function yN(n,t){var e=Wn(t),o=Wn(n)*e;return[e*an(n)/o,an(t)/o]}yN.invert=Da(aa);function vN(n,t){var e=t*t,o=e*e;return[n*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}vN.invert=function(n,t){var e=t,o=25,s;do{var c=e*e,p=c*c;e-=s=(e*(1.007226+c*(.015085+p*(-.044475+.028874*c-.005916*p)))-t)/(1.007226+c*(.015085*3+p*(-.044475*7+.028874*9*c-.005916*11*p)))}while(Zr(s)>er&&--o>0);return[n/(.8707+(c=e*e)*(-.131979+c*(-.013791+c*c*c*(.003971-.001529*c)))),e]};function _N(n,t){return[Wn(t)*an(n),an(t)]}_N.invert=Da(Co);function xN(n,t){var e=Wn(t),o=1+Wn(n)*e;return[e*an(n)/o,an(t)/o]}xN.invert=Da(function(n){return 2*aa(n)});function EN(n,t){return[Lh(Nh((Mi+t)/2)),-n]}EN.invert=function(n,t){return[-t,2*aa(Hg(n))-Mi]};var nK=Je(mf(),1);var rK=Je(mf(),1);var oK=Je(mf(),1);var sK=Je(mf(),1);function Fa(n,t){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}function SN(n){let t=0;for(let e=0;e<n.length-1;e++)t+=Fa(n[e],n[e+1]);return t}function MN(n,t,e){let o=new ze(t[0]-n[0],t[1]-n[1]),s=new ze(t[0]-e[0],t[1]-e[1]),p=o.angleTo(s)*180/Math.PI,h=new ze(t[0]-n[0],t[1]-n[1]);return new ze(e[0]-n[0],e[1]-n[1]).cross(h)>0?p:-p}var jo=Je(bN(),1);var Xn="___",Jg=class{isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let o=[];try{o=JSON.parse(e.entry_end_floor)}catch(c){o=[]}let s=[];try{s=JSON.parse(e.entry_start_floor)}catch(c){s=[]}return Ru({},e,{entry_start_floor:s,entry_end_floor:o})})}getParkingSpaceInfo(t,e){let o=""+t+Xn+e;var s;return(s=this.parkingMap.get(o))!=null?s:null}getNodeInfo(t,e){let o=""+t+Xn+e,s=this.nodeMap.get(o);if(!(s!=null&&s.length))return null;let c=this.pointMap.get(s[0]);return c!=null?c:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let o=new Date,s=o.getHours()*60+o.getMinutes();t.length&&(t.forEach(c=>{let p=(c.points||[]).filter(h=>!(0,jo.isNil)(h.passWeight)&&h.passWeight!==1&&!(0,jo.isNil)(h.coverageArea)&&h.coverageArea!==0);(c.points||[]).filter(h=>h.openStatus!==!1).filter(h=>{if(!h.startTime||!h.endTime)return!0;let[g,m]=h.startTime.split(":").map(T=>+T),[_,w]=h.endTime.split(":").map(T=>+T),x=g*60+m,b=_*60+w;return s>=x&&s<=b}).forEach(h=>{h.floor=c.floor;let g=""+c.floor+Xn+h.id,m=""+c.floor+Xn+h.nodeId,_=this.nodeMap.get(m)||[];if(_.push(""+c.floor+Xn+(h.relatedId||h.id)),this.nodeMap.set(""+c.floor+Xn+h.nodeId,_),this.pointMap.set(g,h),this.isFacilityByType(h.type)){let w=this.facilities.find(x=>x.id===+h.targetId);if(w){switch(w.entry_infra_type){case"straightLadder":if(w.entry_end_floor.find(I=>I.floor===c.floor)&&w.entry_start_floor.find(I=>I.floor===c.floor)){let I=this.straightLadderMap.get(h.targetId)||[];I.push(Ru({},h)),this.straightLadderMap.set(h.targetId,I)}break;case"staircase":if(w.entry_end_floor.find(I=>I.floor===c.floor)&&w.entry_start_floor.find(I=>I.floor===c.floor)){let I=this.staircaseMap.get(h.targetId)||[];I.push(Ru({},h)),this.staircaseMap.set(h.targetId,I)}break;case"escalator":let b=this.escalatorMap.get(h.targetId)||[];if(w.entry_start_floor.find(I=>I.floor===c.floor)){let I=b.find(S=>{var E;return((E=S.end)==null?void 0:E.floor)!==c.floor&&!S.start});I?I.start=h:b.push({start:h})}if(w.entry_end_floor.find(I=>I.floor===c.floor)){let I=b.find(S=>{var E;return((E=S.start)==null?void 0:E.floor)!==c.floor&&!S.end});I?I.end=h:b.push({end:h})}this.escalatorMap.set(h.targetId,b);break;case"ramp":let T=this.rampMap.get(h.targetId)||[];if(w.entry_start_floor.find(I=>I.floor===c.floor)){let I=T.find(S=>{var E;return((E=S.end)==null?void 0:E.floor)!==c.floor&&!S.start});I?I.start=h:T.push({start:h})}if(w.entry_end_floor.find(I=>I.floor===c.floor)){let I=T.find(S=>{var E;return((E=S.start)==null?void 0:E.floor)!==c.floor&&!S.end});I?I.end=h:T.push({end:h})}this.rampMap.set(h.targetId,T);break;case"connectionPoint":if(w.entry_end_floor.find(I=>I.floor===c.floor)&&w.entry_start_floor.find(I=>I.floor===c.floor)){let I=this.connectionPointMap.get(h.targetId)||[];I.push(Ru({},h)),this.connectionPointMap.set(h.targetId,I)}break}let x=this.facilityMap.get(h.targetId)||[];x.push(Ru({},h)),this.facilityMap.set(h.targetId,x)}}h.type==="parkingSpace"&&h.name.split(/[,\uFF0C]/).forEach(x=>{this.parkingMap.set(""+c.floor+Xn+x,h)})}),(c.lines||[]).filter(h=>h.to!==h.from).forEach(h=>{let g=""+c.floor+Xn+h.from,m=""+c.floor+Xn+h.to,_=this.pointMap.get(g),w=this.pointMap.get(m);if(!_||!w)return;let x=_.cds,b=w.cds,T=Fa(x,b);if(p.forEach(I=>{(I.id===h.from||I.id===h.to)&&(T=T/I.passWeight);let S=Fa(x,I.cds)<=I.coverageArea,E=Fa(b,I.cds)<=I.coverageArea;(S||E)&&(T=T/I.passWeight)}),!_.permission&&!w.permission){switch(this.addLineItem(g,m,T),this.addLineItem(m,g,T),h.direction){case"double":this.addLineItem(g,m,T,this.forwardLineMap),this.addLineItem(m,g,T,this.forwardLineMap);break;case"single":this.addLineItem(g,m,T,this.forwardLineMap);break;case"back":this.addLineItem(m,g,T,this.forwardLineMap);break}(_.type==="parkingSpace"||w.type==="parkingSpace")&&h.direction==="noDir"&&(this.addLineItem(g,m,T,this.forwardLineMap),this.addLineItem(m,g,T,this.forwardLineMap))}else _.permission&&(this.setPermissionLine(g,m,_.permission,T,""),this.setPermissionLine(m,g,_.permission,T,"")),w.permission&&w.permission!==_.permission&&(this.setPermissionLine(g,m,w.permission,T,""),this.setPermissionLine(m,g,w.permission,T,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,o,s,c){this.getPermissionMap(o).add({fromKey:t,toKey:e,distance:s,type:c})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,c=this.pointMap.get(s);if(c){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g)continue;c.permission&&this.setPermissionLine(s,h,c.permission,1,"straightLadder"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,h,g.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,c=this.pointMap.get(s);if(c){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g)continue;c.permission&&this.setPermissionLine(s,h,c.permission,1,"staircase"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,h,g.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Xn+o.start.id,c=""+o.end.floor+Xn+o.end.id,p=this.pointMap.get(s),h=this.pointMap.get(c);p&&h&&(p.permission&&this.setPermissionLine(s,c,p.permission,1,"escalator"),h.permission&&h.permission!==p.permission&&this.setPermissionLine(s,c,h.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Xn+o.start.id,c=""+o.end.floor+Xn+o.end.id,p=this.pointMap.get(s),h=this.pointMap.get(c);p&&h&&(p.permission&&this.setPermissionLine(s,c,p.permission,10,"ramp"),h.permission&&h.permission!==p.permission&&this.setPermissionLine(s,c,h.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{if(t.length<2){this.connectionPointMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,c=this.pointMap.get(s);if(c){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g)continue;c.permission&&this.setPermissionLine(s,h,c.permission,1,"connectionPoint"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,h,g.permission,1,"connectionPoint")}}}})}addPermissionLineToMap(t,e,o,s){this.getPermissionMap(t).forEach(p=>{e.includes(p.type)&&(p.type===""?this.addLineItem(p.fromKey,p.toKey,p.distance,o):this.addLineItem(p.fromKey,p.toKey,s.get(p.type),o))})}addLineItem(t,e,o,s){s===void 0&&(s=this.lineMap);let c=s.get(t)||new Map;c.set(e,o),s.set(t,c)}addFacilityToLineMap(t,e,o,s){[...this.straightLadderMap,...this.staircaseMap].forEach(c=>{let[p,h]=c;if(!(h.length<2))for(let g=0;g<h.length;g++){let m=""+h[g].floor+Xn+h[g].id,_=this.pointMap.get(m);if(!(!_||_.permission)){for(let w=0;w<h.length;w++)if(g!==w){let x=""+h[w].floor+Xn+h[w].id,b=this.pointMap.get(x);if(!b||b.permission)continue;if(h[g].type==="straightLadder"){let T=e;this.addLineItem(m,x,T,s)}else{let T=o;this.addLineItem(m,x,T,s)}}}}}),this.escalatorMap.forEach((c,p)=>{c.forEach(h=>{if(h.start&&h.end){let g=""+h.start.floor+Xn+h.start.id,m=""+h.end.floor+Xn+h.end.id,_=this.pointMap.get(g),w=this.pointMap.get(m);if(_&&w&&!_.permission&&!w.permission){let x=t;this.addLineItem(g,m,x,s)}}})}),this.connectionPointMap.forEach((c,p)=>{if(!(c.length<2))for(let h=0;h<c.length;h++){let g=""+c[h].floor+Xn+c[h].id,m=this.pointMap.get(g);if(!(!m||m.permission)){for(let _=0;_<c.length;_++)if(h!==_){let w=""+c[_].floor+Xn+c[_].id,x=this.pointMap.get(w);if(!x||x.permission)continue;this.addLineItem(g,w,100,s)}}}})}initBaseRoute(){let t=new Map((0,jo.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100*this.lift_priority,3e4,t),this.baseRoute=new ro.default(t)}initEscalatorRoute(){let t=new Map((0,jo.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new ro.default(t)}initStraightLadderRoute(){let t=new Map((0,jo.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new ro.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Xn+o.start.id,c=""+o.end.floor+Xn+o.end.id,p=this.pointMap.get(s),h=this.pointMap.get(c);p&&h&&!p.permission&&!h.permission&&this.addLineItem(s,c,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{if(!(t.length<2))for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,c=this.pointMap.get(s);if(!(!c||c.permission)){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g||g.permission)continue;this.addLineItem(s,h,100,this.forwardLineMap)}}}}),this.forwardRoute=new ro.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t,e,o){o===void 0&&(o={});var s;if(t.nodeId){let c=this.nodeMap.get(""+t.floor+Xn+t.nodeId);if(c!=null&&c.length)return c.map(p=>{let[h,g]=p.split(Xn);return{floor:h,id:g}})}if((s=t.coord)!=null&&s.length){let c=this.roadInfo.find(m=>m.floor===t.floor);if(!c)return null;let p=c.points.filter(m=>m.isStarted),h=c.points.filter(m=>{let _=""+m.floor+Xn+m.id;if(e==="forward"){if(!this.forwardLineMap.has(_)||o.adsorptionIntersection&&p.length&&!m.isStarted)return!1}else if(!this.lineMap.has(_))return!1;return!0});if(!h.length)return null;let g=h.reduce((m,_)=>{if(_.relatedId)return m;let w=Fa(t.coord,_.cds);return w<m.min&&(m.min=w,m.point=_),m},{min:1/0,point:h[0]});return[{floor:c.floor,id:g.point.id}]}return null}transformEnd(t,e){if(t.floor){if(t.parkingSpace){let s=this.parkingMap.get(""+t.floor+Xn+t.parkingSpace);if(s)return[{floor:t.floor,id:s.id}]}let o=this.transformStart(t,e);if(o)return o}if(t.facility){let s=this.facilities.filter(c=>+c.type_id==+t.facility).map(c=>c.id).map(c=>this.facilityMap.get(""+c)).flat(2);if(s!=null&&s.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o,s,c,p){if(o===void 0&&(o=""),p===void 0&&(p={}),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let h=this.transformStart(t,o,p);if(!h)return"no-start";let g=this.transformEnd(e,o);if(!g)return"no-end";let m=[];if(Array.isArray(g))for(let x=0;x<h.length;x++){let b=h[x];for(let T=0;T<g.length;T++){let I=g[T];if(b.floor===I.floor&&b.id===I.id)return"near"}}else{m=this.facilities.filter(b=>+b.type_id==+e.facility).map(b=>b.id).map(b=>this.facilityMap.get(""+b)).flat(2).filter(b=>b).filter(b=>g.floor?b.floor===g.floor:!0);for(let b=0;b<h.length;b++){let T=h[b];for(let I=0;I<m.length;I++){let S=m[I];if(T.floor===S.floor&&T.id===S.id)return"near"}}}let _;switch(o){case"escalator":_=this.getEscalatorPath.bind(this);break;case"straightLadder":_=this.getStraightLadderPath.bind(this);break;case"forward":_=this.getForwardPath.bind(this);break;default:_=this.getBasePath.bind(this);break}let w=null;return h.forEach(x=>{if(Array.isArray(g))g.forEach(b=>{let T=_(x,b,s,c);T&&T&&(!w||T[0].consume<w[0].consume)&&(w=T)});else{if(!m.length)return null;let b=m.map(T=>_(x,{floor:T.floor,id:T.id},s,c)).filter(T=>!!T);w=b.reduce((T,I)=>{let S=I[0].consume;return S<T.distance&&(T.distance=S,T.path=I),T},{distance:1/0,path:b[0]}).path}}),w}getRoutePath(t,e,o){let s=""+t.floor+Xn+t.id,c=""+e.floor+Xn+e.id,p=o.path(s,c);if(!p)return null;let h=[],g=p.reduce((m,_,w,x)=>{if(w===0)return 0;let b=x[w-1],T=o.graph.get(b).get(_);return m+T},0);return p.map(m=>{let _=this.pointMap.get(m);if(_){var w;let{floor:x}=_,b=_.type;if(this.isFacilityByType(_.type)){let T=this.facilities.find(I=>I.id===+_.targetId);T&&(b=T.entry_infra_type)}if(((w=h[h.length-1])==null?void 0:w.floor)===x){let T=h[h.length-1];T.points.push(_.cds),T.pointInfos.push(_),T.endType=b,T.destId=_.nodeId,T.distance=SN(T.points)}else h.push({floor:x,points:[_.cds],pointInfos:[_],endType:b,destId:_.nodeId,distance:0,consume:g})}}),h}getBasePath(t,e,o){if(!o)return this.getRoutePath(t,e,this.baseRoute);let s=(0,jo.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100*this.lift_priority],["staircase",3e4]]));let c=new ro.default(s);return this.getRoutePath(t,e,c)}getEscalatorPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.escalatorRoute);let s=(0,jo.cloneDeep)(this.escalatorRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",1*c],["connectionPoint",100],["straightLadder",this.lift_priority*c],["staircase",3e4*c]]));let p=new ro.default(s);return this.getRoutePath(t,e,p)}getStraightLadderPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.straightLadderRoute);let s=(0,jo.cloneDeep)(this.straightLadderRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",3*c],["connectionPoint",100],["straightLadder",1*c],["staircase",3e4*c]]));let p=new ro.default(s);return this.getRoutePath(t,e,p)}getForwardPath(t,e,o,s){let c=new Map,p=x=>{let b=this.forwardRoute.graph.get(g);x.forEach(T=>{let I=b.get(T);(0,jo.isNil)(I)||(c.set(T,I),b.delete(T))})},h=()=>{let x=this.forwardRoute.graph.get(g);c.forEach((b,T)=>{x.set(T,b)})},g=""+t.floor+Xn+t.id;if(!(0,jo.isNil)(s)){let x=this.forwardLineMap.get(g),b=this.pointMap.get(g);if(b&&(x!=null&&x.size)&&x.size>1){let T=new ze(b.cds[0],b.cds[1]),I=new Map;x.forEach((E,R)=>{let C=this.pointMap.get(R);if(C){let F=new ze(C.cds[0],C.cds[1]),X=360-(new ze().subVectors(F,T).angle()/Math.PI*180-90+360)%360;I.set(R,X)}});let S=Array.from(I).filter(E=>{let[R,C]=E;return Math.abs(C-s)<=60}).map(E=>{let[R]=E;return R});if(S.length)S.forEach(E=>I.delete(E)),p([...I.keys()]);else{let E=Array.from(I).reduce((R,C)=>{let F=Math.abs(C[1]-s);return F<R.diff?{diff:F,key:C[0]}:R},{diff:1/0,key:""});I.delete(E.key),p([...I.keys()])}}}if(!o){let x=this.getRoutePath(t,e,this.forwardRoute);return h(),x||this.getRoutePath(t,e,this.forwardRoute)}let m=(0,jo.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],m,new Map([["ramp",10]]));let _=new ro.default(m),w=this.getRoutePath(t,e,_);if(h(),w)return w;{let x=(0,jo.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],x,new Map([["ramp",10]]));let b=new ro.default(x);return this.getRoutePath(t,e,b)}}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new ro.default,this.escalatorRoute=new ro.default,this.straightLadderRoute=new ro.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.baseRoute=new ro.default,this.escalatorRoute=new ro.default,this.straightLadderRoute=new ro.default,this.forwardLineMap=new Map,this.forwardRoute=new ro.default}};var rwt=Je(Gp(),1),iwt=Je(ty(),1);var gK=Je(IN(),1);function mK(n,t,e){let o=MN(n,t,e);return yK(o)}function yK(n){return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function RN(n){if(!n.length)return[];if(n.length===1)return[{direction:"start",distance:0,points:n}];let t=[{direction:"start",distance:Fa(n[0],n[1]),points:[n[0],n[1]]}];for(let e=2;e<n.length;e++){let o=mK(n[e-2],n[e-1],n[e]);if(o==="front"){let s=t[t.length-1],c=Fa(n[e-1],n[e]);s.distance+=c,e!==2&&s.points.push(n[e-1])}else t.push({direction:o,distance:Fa(n[e-1],n[e]),points:[n[e-1],n[e]]})}return t.push({direction:"end",distance:0,points:[n[n.length-1]]}),t}var gwt=Je(i2(),1),mwt=Je(Xp(),1);function o2(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function s2(n){let t={};for(let o in n)o.startsWith("on")&&(t[o2(o.slice(2))]=n[o]);let e=o=>pp(this,null,function*(){let{data:s}=o;if(t[s.type])try{let c=yield t[s.type](s.data);if(c!=null&&c.$transfer&&Array.isArray(c.$transfer)){let p=c.$transfer;delete c.$transfer,self.postMessage({type:""+s.type+"_result",key:s.key,data:c},p)}else self.postMessage({type:""+s.type+"_result",key:s.key,data:c})}catch(c){self.postMessage({type:""+s.type+"_result",key:s.key,error:c})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var B1=new Jg;s2({onSetRoadInfo(n){let{roadData:t,facilities:e}=n;B1.initRoute(t,e)},onGetPath(n){let{start:t,end:e,type:o,permission:s,travelDirection:c,options:p}=n;return B1.getPath(t,e,o,s,c,p)},onGetDirectionPath(n){return RN(n)},onClear(){B1.clear()}});
19842
19842
  `],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var M_=class extends Sn{loaded(){return new Promise(t=>{if(this.initRoadStatus)t(!0);else{let e=n=>{let{status:i}=n;i&&(this.removeEventListener("init-road-status",e),t(!0))};this.addEventListener("init-road-status",e)}})}setRoadData(t,e){return Tt(this,null,function*(){this.initRoadStatus=!1,this.dispatchEvent({type:"init-road-status",status:!1}),yield fi(this.worker,"set_road_info",{roadData:t,facilities:e}),this.initRoadStatus=!0,this.dispatchEvent({type:"init-road-status",status:!0})})}getPath(t,e,n,i,o,a){return Tt(this,null,function*(){return n===void 0&&(n=""),new Promise((l,c)=>{let f=()=>{fi(this.worker,"get_path",{start:t,end:e,type:n,permission:i,travelDirection:o,options:a}).then(g=>{g?typeof g=="string"?c(g):l(g):c("no-path")})};if(this.initRoadStatus)f();else{let g=m=>{let{status:v}=m;v&&(this.removeEventListener("init-road-status",g),f())};this.addEventListener("init-road-status",g)}})})}getDirectionPath(t){return fi(this.worker,"get_direction_path",t)}dispose(){return Tt(this,null,function*(){fi(this.worker,"clear",""),this.worker.terminate()})}constructor(){super(),this.worker=ZR(),this.initRoadStatus=!1}};function KR(){let r=new Blob([`var rC=Object.create;var Ey=Object.defineProperty;var iC=Object.getOwnPropertyDescriptor;var oC=Object.getOwnPropertyNames;var sC=Object.getPrototypeOf,aC=Object.prototype.hasOwnProperty;var nt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var uC=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of oC(t))!aC.call(r,a)&&a!==e&&Ey(r,a,{get:()=>t[a],enumerable:!(o=iC(t,a))||o.enumerable});return r};var yn=(r,t,e)=>(e=r!=null?rC(sC(r)):{},uC(t||!r||!r.__esModule?Ey(e,"default",{value:r,enumerable:!0}):e,r));var gc=(r,t,e)=>new Promise((o,a)=>{var l=p=>{try{f(e.next(p))}catch(d){a(d)}},h=p=>{try{f(e.throw(p))}catch(d){a(d)}},f=p=>p.done?o(p.value):Promise.resolve(p.value).then(l,h);f((e=e.apply(r,t)).next())});var Zr=nt((hp,My)=>{"use strict";var hl=function(r){return r&&r.Math===Math&&r};My.exports=hl(typeof globalThis=="object"&&globalThis)||hl(typeof window=="object"&&window)||hl(typeof self=="object"&&self)||hl(typeof global=="object"&&global)||hl(typeof hp=="object"&&hp)||function(){return this}()||Function("return this")()});var Ur=nt((Sq,Sy)=>{"use strict";Sy.exports=function(r){try{return!!r()}catch(t){return!0}}});var ro=nt((wq,wy)=>{"use strict";var lC=Ur();wy.exports=!lC(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var yc=nt((bq,by)=>{"use strict";var cC=Ur();by.exports=!cC(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Zo=nt((Tq,Ty)=>{"use strict";var fC=yc(),vc=Function.prototype.call;Ty.exports=fC?vc.bind(vc):function(){return vc.apply(vc,arguments)}});var Iy=nt(Py=>{"use strict";var Ay={}.propertyIsEnumerable,Cy=Object.getOwnPropertyDescriptor,hC=Cy&&!Ay.call({1:2},1);Py.f=hC?function(t){var e=Cy(this,t);return!!e&&e.enumerable}:Ay});var _c=nt((Cq,Ry)=>{"use strict";Ry.exports=function(r,t){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:t}}});var li=nt((Pq,Oy)=>{"use strict";var Ly=yc(),Ny=Function.prototype,pp=Ny.call,pC=Ly&&Ny.bind.bind(pp,pp);Oy.exports=Ly?pC:function(r){return function(){return pp.apply(r,arguments)}}});var pl=nt((Iq,Fy)=>{"use strict";var Dy=li(),dC=Dy({}.toString),mC=Dy("".slice);Fy.exports=function(r){return mC(dC(r),8,-1)}});var By=nt((Rq,Uy)=>{"use strict";var gC=li(),yC=Ur(),vC=pl(),dp=Object,_C=gC("".split);Uy.exports=yC(function(){return!dp("z").propertyIsEnumerable(0)})?function(r){return vC(r)==="String"?_C(r,""):dp(r)}:dp});var mp=nt((Lq,zy)=>{"use strict";zy.exports=function(r){return r==null}});var Ya=nt((Nq,Gy)=>{"use strict";var xC=mp(),EC=TypeError;Gy.exports=function(r){if(xC(r))throw new EC("Can't call method on "+r);return r}});var $a=nt((Oq,ky)=>{"use strict";var MC=By(),SC=Ya();ky.exports=function(r){return MC(SC(r))}});var Br=nt((Dq,qy)=>{"use strict";var gp=typeof document=="object"&&document.all;qy.exports=typeof gp=="undefined"&&gp!==void 0?function(r){return typeof r=="function"||r===gp}:function(r){return typeof r=="function"}});var bo=nt((Fq,Vy)=>{"use strict";var wC=Br();Vy.exports=function(r){return typeof r=="object"?r!==null:wC(r)}});var xc=nt((Uq,Hy)=>{"use strict";var yp=Zr(),bC=Br(),TC=function(r){return bC(r)?r:void 0};Hy.exports=function(r,t){return arguments.length<2?TC(yp[r]):yp[r]&&yp[r][t]}});var Xy=nt((Bq,Wy)=>{"use strict";var AC=li();Wy.exports=AC({}.isPrototypeOf)});var Jy=nt((zq,Zy)=>{"use strict";var CC=Zr(),Yy=CC.navigator,$y=Yy&&Yy.userAgent;Zy.exports=$y?String($y):""});var rv=nt((Gq,nv)=>{"use strict";var ev=Zr(),vp=Jy(),Ky=ev.process,jy=ev.Deno,Qy=Ky&&Ky.versions||jy&&jy.version,tv=Qy&&Qy.v8,io,Ec;tv&&(io=tv.split("."),Ec=io[0]>0&&io[0]<4?1:+(io[0]+io[1]));!Ec&&vp&&(io=vp.match(/Edge\\/(\\d+)/),(!io||io[1]>=74)&&(io=vp.match(/Chrome\\/(\\d+)/),io&&(Ec=+io[1])));nv.exports=Ec});var _p=nt((kq,ov)=>{"use strict";var iv=rv(),PC=Ur(),IC=Zr(),RC=IC.String;ov.exports=!!Object.getOwnPropertySymbols&&!PC(function(){var r=Symbol("symbol detection");return!RC(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&iv&&iv<41})});var xp=nt((qq,sv)=>{"use strict";var LC=_p();sv.exports=LC&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ep=nt((Vq,av)=>{"use strict";var NC=xc(),OC=Br(),DC=Xy(),FC=xp(),UC=Object;av.exports=FC?function(r){return typeof r=="symbol"}:function(r){var t=NC("Symbol");return OC(t)&&DC(t.prototype,UC(r))}});var lv=nt((Hq,uv)=>{"use strict";var BC=String;uv.exports=function(r){try{return BC(r)}catch(t){return"Object"}}});var Mp=nt((Wq,cv)=>{"use strict";var zC=Br(),GC=lv(),kC=TypeError;cv.exports=function(r){if(zC(r))return r;throw new kC(GC(r)+" is not a function")}});var Sp=nt((Xq,fv)=>{"use strict";var qC=Mp(),VC=mp();fv.exports=function(r,t){var e=r[t];return VC(e)?void 0:qC(e)}});var pv=nt((Yq,hv)=>{"use strict";var wp=Zo(),bp=Br(),Tp=bo(),HC=TypeError;hv.exports=function(r,t){var e,o;if(t==="string"&&bp(e=r.toString)&&!Tp(o=wp(e,r))||bp(e=r.valueOf)&&!Tp(o=wp(e,r))||t!=="string"&&bp(e=r.toString)&&!Tp(o=wp(e,r)))return o;throw new HC("Can't convert object to primitive value")}});var dl=nt(($q,dv)=>{"use strict";dv.exports=!1});var Mc=nt((Zq,gv)=>{"use strict";var mv=Zr(),WC=Object.defineProperty;gv.exports=function(r,t){try{WC(mv,r,{value:t,configurable:!0,writable:!0})}catch(e){mv[r]=t}return t}});var Sc=nt((Jq,_v)=>{"use strict";var XC=dl(),YC=Zr(),$C=Mc(),yv="__core-js_shared__",vv=_v.exports=YC[yv]||$C(yv,{});(vv.versions||(vv.versions=[])).push({version:"3.42.0",mode:XC?"pure":"global",copyright:"\\xA9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.42.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var wc=nt((Kq,Ev)=>{"use strict";var xv=Sc();Ev.exports=function(r,t){return xv[r]||(xv[r]=t||{})}});var ml=nt((jq,Mv)=>{"use strict";var ZC=Ya(),JC=Object;Mv.exports=function(r){return JC(ZC(r))}});var To=nt((Qq,Sv)=>{"use strict";var KC=li(),jC=ml(),QC=KC({}.hasOwnProperty);Sv.exports=Object.hasOwn||function(t,e){return QC(jC(t),e)}});var Ap=nt((tV,wv)=>{"use strict";var tP=li(),eP=0,nP=Math.random(),rP=tP(1 .toString);wv.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+rP(++eP+nP,36)}});var oo=nt((eV,Tv)=>{"use strict";var iP=Zr(),oP=wc(),bv=To(),sP=Ap(),aP=_p(),uP=xp(),Za=iP.Symbol,Cp=oP("wks"),lP=uP?Za.for||Za:Za&&Za.withoutSetter||sP;Tv.exports=function(r){return bv(Cp,r)||(Cp[r]=aP&&bv(Za,r)?Za[r]:lP("Symbol."+r)),Cp[r]}});var Iv=nt((nV,Pv)=>{"use strict";var cP=Zo(),Av=bo(),Cv=Ep(),fP=Sp(),hP=pv(),pP=oo(),dP=TypeError,mP=pP("toPrimitive");Pv.exports=function(r,t){if(!Av(r)||Cv(r))return r;var e=fP(r,mP),o;if(e){if(t===void 0&&(t="default"),o=cP(e,r,t),!Av(o)||Cv(o))return o;throw new dP("Can't convert object to primitive value")}return t===void 0&&(t="number"),hP(r,t)}});var Pp=nt((rV,Rv)=>{"use strict";var gP=Iv(),yP=Ep();Rv.exports=function(r){var t=gP(r,"string");return yP(t)?t:t+""}});var bc=nt((iV,Nv)=>{"use strict";var vP=Zr(),Lv=bo(),Ip=vP.document,_P=Lv(Ip)&&Lv(Ip.createElement);Nv.exports=function(r){return _P?Ip.createElement(r):{}}});var Rp=nt((oV,Ov)=>{"use strict";var xP=ro(),EP=Ur(),MP=bc();Ov.exports=!xP&&!EP(function(){return Object.defineProperty(MP("div"),"a",{get:function(){return 7}}).a!==7})});var Lp=nt(Fv=>{"use strict";var SP=ro(),wP=Zo(),bP=Iy(),TP=_c(),AP=$a(),CP=Pp(),PP=To(),IP=Rp(),Dv=Object.getOwnPropertyDescriptor;Fv.f=SP?Dv:function(t,e){if(t=AP(t),e=CP(e),IP)try{return Dv(t,e)}catch(o){}if(PP(t,e))return TP(!wP(bP.f,t,e),t[e])}});var Np=nt((aV,Uv)=>{"use strict";var RP=ro(),LP=Ur();Uv.exports=RP&&LP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var _s=nt((uV,Bv)=>{"use strict";var NP=bo(),OP=String,DP=TypeError;Bv.exports=function(r){if(NP(r))return r;throw new DP(OP(r)+" is not an object")}});var xs=nt(Gv=>{"use strict";var FP=ro(),UP=Rp(),BP=Np(),Tc=_s(),zv=Pp(),zP=TypeError,Op=Object.defineProperty,GP=Object.getOwnPropertyDescriptor,Dp="enumerable",Fp="configurable",Up="writable";Gv.f=FP?BP?function(t,e,o){if(Tc(t),e=zv(e),Tc(o),typeof t=="function"&&e==="prototype"&&"value"in o&&Up in o&&!o[Up]){var a=GP(t,e);a&&a[Up]&&(t[e]=o.value,o={configurable:Fp in o?o[Fp]:a[Fp],enumerable:Dp in o?o[Dp]:a[Dp],writable:!1})}return Op(t,e,o)}:Op:function(t,e,o){if(Tc(t),e=zv(e),Tc(o),UP)try{return Op(t,e,o)}catch(a){}if("get"in o||"set"in o)throw new zP("Accessors not supported");return"value"in o&&(t[e]=o.value),t}});var Ja=nt((cV,kv)=>{"use strict";var kP=ro(),qP=xs(),VP=_c();kv.exports=kP?function(r,t,e){return qP.f(r,t,VP(1,e))}:function(r,t,e){return r[t]=e,r}});var Gp=nt((fV,Vv)=>{"use strict";var Bp=ro(),HP=To(),qv=Function.prototype,WP=Bp&&Object.getOwnPropertyDescriptor,zp=HP(qv,"name"),XP=zp&&function(){}.name==="something",YP=zp&&(!Bp||Bp&&WP(qv,"name").configurable);Vv.exports={EXISTS:zp,PROPER:XP,CONFIGURABLE:YP}});var Wv=nt((hV,Hv)=>{"use strict";var $P=li(),ZP=Br(),kp=Sc(),JP=$P(Function.toString);ZP(kp.inspectSource)||(kp.inspectSource=function(r){return JP(r)});Hv.exports=kp.inspectSource});var $v=nt((pV,Yv)=>{"use strict";var KP=Zr(),jP=Br(),Xv=KP.WeakMap;Yv.exports=jP(Xv)&&/native code/.test(String(Xv))});var Ac=nt((dV,Jv)=>{"use strict";var QP=wc(),tI=Ap(),Zv=QP("keys");Jv.exports=function(r){return Zv[r]||(Zv[r]=tI(r))}});var Cc=nt((mV,Kv)=>{"use strict";Kv.exports={}});var Rc=nt((gV,t_)=>{"use strict";var eI=$v(),Qv=Zr(),nI=bo(),rI=Ja(),qp=To(),Vp=Sc(),iI=Ac(),oI=Cc(),jv="Object already initialized",Hp=Qv.TypeError,sI=Qv.WeakMap,Pc,gl,Ic,aI=function(r){return Ic(r)?gl(r):Pc(r,{})},uI=function(r){return function(t){var e;if(!nI(t)||(e=gl(t)).type!==r)throw new Hp("Incompatible receiver, "+r+" required");return e}};eI||Vp.state?(so=Vp.state||(Vp.state=new sI),so.get=so.get,so.has=so.has,so.set=so.set,Pc=function(r,t){if(so.has(r))throw new Hp(jv);return t.facade=r,so.set(r,t),t},gl=function(r){return so.get(r)||{}},Ic=function(r){return so.has(r)}):(oa=iI("state"),oI[oa]=!0,Pc=function(r,t){if(qp(r,oa))throw new Hp(jv);return t.facade=r,rI(r,oa,t),t},gl=function(r){return qp(r,oa)?r[oa]:{}},Ic=function(r){return qp(r,oa)});var so,oa;t_.exports={set:Pc,get:gl,has:Ic,enforce:aI,getterFor:uI}});var i_=nt((yV,r_)=>{"use strict";var Xp=li(),lI=Ur(),cI=Br(),Lc=To(),Wp=ro(),fI=Gp().CONFIGURABLE,hI=Wv(),n_=Rc(),pI=n_.enforce,dI=n_.get,e_=String,Nc=Object.defineProperty,mI=Xp("".slice),gI=Xp("".replace),yI=Xp([].join),vI=Wp&&!lI(function(){return Nc(function(){},"length",{value:8}).length!==8}),_I=String(String).split("String"),xI=r_.exports=function(r,t,e){mI(e_(t),0,7)==="Symbol("&&(t="["+gI(e_(t),/^Symbol\\(([^)]*)\\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!Lc(r,"name")||fI&&r.name!==t)&&(Wp?Nc(r,"name",{value:t,configurable:!0}):r.name=t),vI&&e&&Lc(e,"arity")&&r.length!==e.arity&&Nc(r,"length",{value:e.arity});try{e&&Lc(e,"constructor")&&e.constructor?Wp&&Nc(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch(a){}var o=pI(r);return Lc(o,"source")||(o.source=yI(_I,typeof t=="string"?t:"")),r};Function.prototype.toString=xI(function(){return cI(this)&&dI(this).source||hI(this)},"toString")});var yl=nt((vV,o_)=>{"use strict";var EI=Br(),MI=xs(),SI=i_(),wI=Mc();o_.exports=function(r,t,e,o){o||(o={});var a=o.enumerable,l=o.name!==void 0?o.name:t;if(EI(e)&&SI(e,l,o),o.global)a?r[t]=e:wI(t,e);else{try{o.unsafe?r[t]&&(a=!0):delete r[t]}catch(h){}a?r[t]=e:MI.f(r,t,{value:e,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return r}});var a_=nt((_V,s_)=>{"use strict";var bI=Math.ceil,TI=Math.floor;s_.exports=Math.trunc||function(t){var e=+t;return(e>0?TI:bI)(e)}});var vl=nt((xV,u_)=>{"use strict";var AI=a_();u_.exports=function(r){var t=+r;return t!==t||t===0?0:AI(t)}});var c_=nt((EV,l_)=>{"use strict";var CI=vl(),PI=Math.max,II=Math.min;l_.exports=function(r,t){var e=CI(r);return e<0?PI(e+t,0):II(e,t)}});var Yp=nt((MV,f_)=>{"use strict";var RI=vl(),LI=Math.min;f_.exports=function(r){var t=RI(r);return t>0?LI(t,9007199254740991):0}});var $p=nt((SV,h_)=>{"use strict";var NI=Yp();h_.exports=function(r){return NI(r.length)}});var m_=nt((wV,d_)=>{"use strict";var OI=$a(),DI=c_(),FI=$p(),p_=function(r){return function(t,e,o){var a=OI(t),l=FI(a);if(l===0)return!r&&-1;var h=DI(o,l),f;if(r&&e!==e){for(;l>h;)if(f=a[h++],f!==f)return!0}else for(;l>h;h++)if((r||h in a)&&a[h]===e)return r||h||0;return!r&&-1}};d_.exports={includes:p_(!0),indexOf:p_(!1)}});var Jp=nt((bV,y_)=>{"use strict";var UI=li(),Zp=To(),BI=$a(),zI=m_().indexOf,GI=Cc(),g_=UI([].push);y_.exports=function(r,t){var e=BI(r),o=0,a=[],l;for(l in e)!Zp(GI,l)&&Zp(e,l)&&g_(a,l);for(;t.length>o;)Zp(e,l=t[o++])&&(~zI(a,l)||g_(a,l));return a}});var Oc=nt((TV,v_)=>{"use strict";v_.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var x_=nt(__=>{"use strict";var kI=Jp(),qI=Oc(),VI=qI.concat("length","prototype");__.f=Object.getOwnPropertyNames||function(t){return kI(t,VI)}});var M_=nt(E_=>{"use strict";E_.f=Object.getOwnPropertySymbols});var w_=nt((PV,S_)=>{"use strict";var HI=xc(),WI=li(),XI=x_(),YI=M_(),$I=_s(),ZI=WI([].concat);S_.exports=HI("Reflect","ownKeys")||function(t){var e=XI.f($I(t)),o=YI.f;return o?ZI(e,o(t)):e}});var A_=nt((IV,T_)=>{"use strict";var b_=To(),JI=w_(),KI=Lp(),jI=xs();T_.exports=function(r,t,e){for(var o=JI(t),a=jI.f,l=KI.f,h=0;h<o.length;h++){var f=o[h];!b_(r,f)&&!(e&&b_(e,f))&&a(r,f,l(t,f))}}});var P_=nt((RV,C_)=>{"use strict";var QI=Ur(),tR=Br(),eR=/#|\\.prototype\\./,_l=function(r,t){var e=rR[nR(r)];return e===oR?!0:e===iR?!1:tR(t)?QI(t):!!t},nR=_l.normalize=function(r){return String(r).replace(eR,".").toLowerCase()},rR=_l.data={},iR=_l.NATIVE="N",oR=_l.POLYFILL="P";C_.exports=_l});var Fc=nt((LV,I_)=>{"use strict";var Dc=Zr(),sR=Lp().f,aR=Ja(),uR=yl(),lR=Mc(),cR=A_(),fR=P_();I_.exports=function(r,t){var e=r.target,o=r.global,a=r.stat,l,h,f,p,d,g;if(o?h=Dc:a?h=Dc[e]||lR(e,{}):h=Dc[e]&&Dc[e].prototype,h)for(f in t){if(d=t[f],r.dontCallGetSet?(g=sR(h,f),p=g&&g.value):p=h[f],l=fR(o?f:e+(a?".":"#")+f,r.forced),!l&&p!==void 0){if(typeof d==typeof p)continue;cR(d,p)}(r.sham||p&&p.sham)&&aR(d,"sham",!0),uR(h,f,d,r)}}});var L_=nt((NV,R_)=>{"use strict";var hR=pl();R_.exports=Array.isArray||function(t){return hR(t)==="Array"}});var O_=nt((OV,N_)=>{"use strict";var pR=ro(),dR=L_(),mR=TypeError,gR=Object.getOwnPropertyDescriptor,yR=pR&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(r){return r instanceof TypeError}}();N_.exports=yR?function(r,t){if(dR(r)&&!gR(r,"length").writable)throw new mR("Cannot set read only .length");return r.length=t}:function(r,t){return r.length=t}});var F_=nt((DV,D_)=>{"use strict";var vR=TypeError,_R=9007199254740991;D_.exports=function(r){if(r>_R)throw vR("Maximum allowed index exceeded");return r}});var Kp=nt(()=>{"use strict";var xR=Fc(),ER=ml(),MR=$p(),SR=O_(),wR=F_(),bR=Ur(),TR=bR(function(){return[].push.call({length:4294967296},1)!==4294967297}),AR=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(r){return r instanceof TypeError}},CR=TR||!AR();xR({target:"Array",proto:!0,arity:1,forced:CR},{push:function(t){var e=ER(this),o=MR(e),a=arguments.length;wR(o+a);for(var l=0;l<a;l++)e[o]=arguments[l],o++;return SR(e,o),o}})});var B_=nt((BV,U_)=>{"use strict";U_.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var k_=nt((zV,G_)=>{"use strict";var PR=bc(),jp=PR("span").classList,z_=jp&&jp.constructor&&jp.constructor.prototype;G_.exports=z_===Object.prototype?void 0:z_});var V_=nt((GV,q_)=>{"use strict";var IR=Jp(),RR=Oc();q_.exports=Object.keys||function(t){return IR(t,RR)}});var W_=nt(H_=>{"use strict";var LR=ro(),NR=Np(),OR=xs(),DR=_s(),FR=$a(),UR=V_();H_.f=LR&&!NR?Object.defineProperties:function(t,e){DR(t);for(var o=FR(e),a=UR(e),l=a.length,h=0,f;l>h;)OR.f(t,f=a[h++],o[f]);return t}});var Y_=nt((qV,X_)=>{"use strict";var BR=xc();X_.exports=BR("document","documentElement")});var xl=nt((VV,tx)=>{"use strict";var zR=_s(),GR=W_(),$_=Oc(),kR=Cc(),qR=Y_(),VR=bc(),HR=Ac(),Z_=">",J_="<",td="prototype",ed="script",j_=HR("IE_PROTO"),Qp=function(){},Q_=function(r){return J_+ed+Z_+r+J_+"/"+ed+Z_},K_=function(r){r.write(Q_("")),r.close();var t=r.parentWindow.Object;return r=null,t},WR=function(){var r=VR("iframe"),t="java"+ed+":",e;return r.style.display="none",qR.appendChild(r),r.src=String(t),e=r.contentWindow.document,e.open(),e.write(Q_("document.F=Object")),e.close(),e.F},Uc,Bc=function(){try{Uc=new ActiveXObject("htmlfile")}catch(t){}Bc=typeof document!="undefined"?document.domain&&Uc?K_(Uc):WR():K_(Uc);for(var r=$_.length;r--;)delete Bc[td][$_[r]];return Bc()};kR[j_]=!0;tx.exports=Object.create||function(t,e){var o;return t!==null?(Qp[td]=zR(t),o=new Qp,Qp[td]=null,o[j_]=t):o=Bc(),e===void 0?o:GR.f(o,e)}});var nx=nt((HV,ex)=>{"use strict";var XR=oo(),YR=xl(),$R=xs().f,nd=XR("unscopables"),rd=Array.prototype;rd[nd]===void 0&&$R(rd,nd,{configurable:!0,value:YR(null)});ex.exports=function(r){rd[nd][r]=!0}});var zc=nt((WV,rx)=>{"use strict";rx.exports={}});var ox=nt((XV,ix)=>{"use strict";var ZR=Ur();ix.exports=!ZR(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var od=nt((YV,ax)=>{"use strict";var JR=To(),KR=Br(),jR=ml(),QR=Ac(),tL=ox(),sx=QR("IE_PROTO"),id=Object,eL=id.prototype;ax.exports=tL?id.getPrototypeOf:function(r){var t=jR(r);if(JR(t,sx))return t[sx];var e=t.constructor;return KR(e)&&t instanceof e?e.prototype:t instanceof id?eL:null}});var ld=nt(($V,cx)=>{"use strict";var nL=Ur(),rL=Br(),iL=bo(),oL=xl(),ux=od(),sL=yl(),aL=oo(),uL=dl(),ud=aL("iterator"),lx=!1,Jo,sd,ad;[].keys&&(ad=[].keys(),"next"in ad?(sd=ux(ux(ad)),sd!==Object.prototype&&(Jo=sd)):lx=!0);var lL=!iL(Jo)||nL(function(){var r={};return Jo[ud].call(r)!==r});lL?Jo={}:uL&&(Jo=oL(Jo));rL(Jo[ud])||sL(Jo,ud,function(){return this});cx.exports={IteratorPrototype:Jo,BUGGY_SAFARI_ITERATORS:lx}});var Gc=nt((ZV,hx)=>{"use strict";var cL=xs().f,fL=To(),hL=oo(),fx=hL("toStringTag");hx.exports=function(r,t,e){r&&!e&&(r=r.prototype),r&&!fL(r,fx)&&cL(r,fx,{configurable:!0,value:t})}});var dx=nt((JV,px)=>{"use strict";var pL=ld().IteratorPrototype,dL=xl(),mL=_c(),gL=Gc(),yL=zc(),vL=function(){return this};px.exports=function(r,t,e,o){var a=t+" Iterator";return r.prototype=dL(pL,{next:mL(+!o,e)}),gL(r,a,!1,!0),yL[a]=vL,r}});var gx=nt((KV,mx)=>{"use strict";var _L=li(),xL=Mp();mx.exports=function(r,t,e){try{return _L(xL(Object.getOwnPropertyDescriptor(r,t)[e]))}catch(o){}}});var vx=nt((jV,yx)=>{"use strict";var EL=bo();yx.exports=function(r){return EL(r)||r===null}});var xx=nt((QV,_x)=>{"use strict";var ML=vx(),SL=String,wL=TypeError;_x.exports=function(r){if(ML(r))return r;throw new wL("Can't set "+SL(r)+" as a prototype")}});var Mx=nt((tH,Ex)=>{"use strict";var bL=gx(),TL=bo(),AL=Ya(),CL=xx();Ex.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,t={},e;try{e=bL(Object.prototype,"__proto__","set"),e(t,[]),r=t instanceof Array}catch(o){}return function(a,l){return AL(a),CL(l),TL(a)&&(r?e(a,l):a.__proto__=l),a}}():void 0)});var Nx=nt((eH,Lx)=>{"use strict";var PL=Fc(),IL=Zo(),kc=dl(),Ix=Gp(),RL=Br(),LL=dx(),Sx=od(),wx=Mx(),NL=Gc(),OL=Ja(),cd=yl(),DL=oo(),bx=zc(),Rx=ld(),FL=Ix.PROPER,UL=Ix.CONFIGURABLE,Tx=Rx.IteratorPrototype,qc=Rx.BUGGY_SAFARI_ITERATORS,El=DL("iterator"),Ax="keys",Ml="values",Cx="entries",Px=function(){return this};Lx.exports=function(r,t,e,o,a,l,h){LL(e,t,o);var f=function(y){if(y===a&&v)return v;if(!qc&&y&&y in g)return g[y];switch(y){case Ax:return function(){return new e(this,y)};case Ml:return function(){return new e(this,y)};case Cx:return function(){return new e(this,y)}}return function(){return new e(this)}},p=t+" Iterator",d=!1,g=r.prototype,x=g[El]||g["@@iterator"]||a&&g[a],v=!qc&&x||f(a),M=t==="Array"&&g.entries||x,b,T,_;if(M&&(b=Sx(M.call(new r)),b!==Object.prototype&&b.next&&(!kc&&Sx(b)!==Tx&&(wx?wx(b,Tx):RL(b[El])||cd(b,El,Px)),NL(b,p,!0,!0),kc&&(bx[p]=Px))),FL&&a===Ml&&x&&x.name!==Ml&&(!kc&&UL?OL(g,"name",Ml):(d=!0,v=function(){return IL(x,this)})),a)if(T={values:f(Ml),keys:l?v:f(Ax),entries:f(Cx)},h)for(_ in T)(qc||d||!(_ in g))&&cd(g,_,T[_]);else PL({target:t,proto:!0,forced:qc||d},T);return(!kc||h)&&g[El]!==v&&cd(g,El,v,{name:a}),bx[t]=v,T}});var Dx=nt((nH,Ox)=>{"use strict";Ox.exports=function(r,t){return{value:r,done:t}}});var kx=nt((rH,Gx)=>{"use strict";var BL=$a(),fd=nx(),Fx=zc(),Bx=Rc(),zL=xs().f,GL=Nx(),Vc=Dx(),kL=dl(),qL=ro(),zx="Array Iterator",VL=Bx.set,HL=Bx.getterFor(zx);Gx.exports=GL(Array,"Array",function(r,t){VL(this,{type:zx,target:BL(r),index:0,kind:t})},function(){var r=HL(this),t=r.target,e=r.index++;if(!t||e>=t.length)return r.target=null,Vc(void 0,!0);switch(r.kind){case"keys":return Vc(e,!1);case"values":return Vc(t[e],!1)}return Vc([e,t[e]],!1)},"values");var Ux=Fx.Arguments=Fx.Array;fd("keys");fd("values");fd("entries");if(!kL&&qL&&Ux.name!=="values")try{zL(Ux,"name",{value:"values"})}catch(r){}});var Wc=nt(()=>{"use strict";var qx=Zr(),Hx=B_(),WL=k_(),Sl=kx(),Vx=Ja(),XL=Gc(),YL=oo(),hd=YL("iterator"),pd=Sl.values,Wx=function(r,t){if(r){if(r[hd]!==pd)try{Vx(r,hd,pd)}catch(o){r[hd]=pd}if(XL(r,t,!0),Hx[t]){for(var e in Sl)if(r[e]!==Sl[e])try{Vx(r,e,Sl[e])}catch(o){r[e]=Sl[e]}}}};for(Hc in Hx)Wx(qx[Hc]&&qx[Hc].prototype,Hc);var Hc;Wx(WL,"DOMTokenList")});var $x=nt((sH,Yx)=>{"use strict";var $L=oo(),ZL=$L("toStringTag"),Xx={};Xx[ZL]="z";Yx.exports=String(Xx)==="[object z]"});var Jx=nt((aH,Zx)=>{"use strict";var JL=$x(),KL=Br(),Xc=pl(),jL=oo(),QL=jL("toStringTag"),tN=Object,eN=Xc(function(){return arguments}())==="Arguments",nN=function(r,t){try{return r[t]}catch(e){}};Zx.exports=JL?Xc:function(r){var t,e,o;return r===void 0?"Undefined":r===null?"Null":typeof(e=nN(t=tN(r),QL))=="string"?e:eN?Xc(t):(o=Xc(t))==="Object"&&KL(t.callee)?"Arguments":o}});var Yc=nt((uH,Kx)=>{"use strict";var rN=Jx(),iN=String;Kx.exports=function(r){if(rN(r)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return iN(r)}});var Qx=nt((lH,jx)=>{"use strict";var oN=_s();jx.exports=function(){var r=oN(this),t="";return r.hasIndices&&(t+="d"),r.global&&(t+="g"),r.ignoreCase&&(t+="i"),r.multiline&&(t+="m"),r.dotAll&&(t+="s"),r.unicode&&(t+="u"),r.unicodeSets&&(t+="v"),r.sticky&&(t+="y"),t}});var e1=nt((cH,t1)=>{"use strict";var dd=Ur(),sN=Zr(),md=sN.RegExp,gd=dd(function(){var r=md("a","y");return r.lastIndex=2,r.exec("abcd")!==null}),aN=gd||dd(function(){return!md("a","y").sticky}),uN=gd||dd(function(){var r=md("^r","gy");return r.lastIndex=2,r.exec("str")!==null});t1.exports={BROKEN_CARET:uN,MISSED_STICKY:aN,UNSUPPORTED_Y:gd}});var r1=nt((fH,n1)=>{"use strict";var lN=Ur(),cN=Zr(),fN=cN.RegExp;n1.exports=lN(function(){var r=fN(".","s");return!(r.dotAll&&r.test(\`
19843
19843
  \`)&&r.flags==="s")})});var o1=nt((hH,i1)=>{"use strict";var hN=Ur(),pN=Zr(),dN=pN.RegExp;i1.exports=hN(function(){var r=dN("(?<a>b)","g");return r.exec("b").groups.a!=="b"||"b".replace(r,"$<a>c")!=="bc"})});var Jc=nt((pH,a1)=>{"use strict";var Ka=Zo(),Zc=li(),mN=Yc(),gN=Qx(),yN=e1(),vN=wc(),_N=xl(),xN=Rc().get,EN=r1(),MN=o1(),SN=vN("native-string-replace",String.prototype.replace),$c=RegExp.prototype.exec,vd=$c,wN=Zc("".charAt),bN=Zc("".indexOf),TN=Zc("".replace),yd=Zc("".slice),_d=function(){var r=/a/,t=/b*/g;return Ka($c,r,"a"),Ka($c,t,"a"),r.lastIndex!==0||t.lastIndex!==0}(),s1=yN.BROKEN_CARET,xd=/()??/.exec("")[1]!==void 0,AN=_d||xd||s1||EN||MN;AN&&(vd=function(t){var e=this,o=xN(e),a=mN(t),l=o.raw,h,f,p,d,g,x,v;if(l)return l.lastIndex=e.lastIndex,h=Ka(vd,l,a),e.lastIndex=l.lastIndex,h;var M=o.groups,b=s1&&e.sticky,T=Ka(gN,e),_=e.source,y=0,A=a;if(b&&(T=TN(T,"y",""),bN(T,"g")===-1&&(T+="g"),A=yd(a,e.lastIndex),e.lastIndex>0&&(!e.multiline||e.multiline&&wN(a,e.lastIndex-1)!==\`
19844
19844
  \`)&&(_="(?: "+_+")",A=" "+A,y++),f=new RegExp("^(?:"+_+")",T)),xd&&(f=new RegExp("^"+_+"$(?!\\\\s)",T)),_d&&(p=e.lastIndex),d=Ka($c,b?f:e,A),b?d?(d.input=yd(d.input,y),d[0]=yd(d[0],y),d.index=e.lastIndex,e.lastIndex+=d[0].length):e.lastIndex=0:_d&&d&&(e.lastIndex=e.global?d.index+d[0].length:p),xd&&d&&d.length>1&&Ka(SN,d[0],f,function(){for(g=1;g<arguments.length-2;g++)arguments[g]===void 0&&(d[g]=void 0)}),d&&M)for(d.groups=x=_N(null),g=0;g<M.length;g++)v=M[g],x[v[0]]=d[v[1]];return d});a1.exports=vd});var Kc=nt(()=>{"use strict";var CN=Fc(),u1=Jc();CN({target:"RegExp",proto:!0,forced:/./.exec!==u1},{exec:u1})});var c1=nt((gH,l1)=>{var Ed=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(a=>(a.key===t&&Object.assign(a,{priority:o}),a)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};l1.exports=Ed});var p1=nt((yH,h1)=>{function f1(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,f1(a,t)):o!==t&&e.set(o,a);return e}h1.exports=f1});var g1=nt((vH,m1)=>{function PN(r){let t=Number(r);return!(isNaN(t)||t<=0)}function d1(r){let t=new Map;return Object.keys(r).forEach(o=>{let a=r[o];if(a!==null&&typeof a=="object"&&!Array.isArray(a))return t.set(o,d1(a));if(!PN(a))throw new Error(\`Could not add node at key "\${o}", make sure it's a valid node\`,a);return t.set(o,Number(a))}),t}m1.exports=d1});var _1=nt((_H,v1)=>{function y1(r){if(!(r instanceof Map))throw new Error(\`Invalid graph: Expected Map instead found \${typeof r}\`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){y1(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}v1.exports=y1});var S1=nt((xH,M1)=>{var IN=c1(),RN=p1(),x1=g1(),E1=_1(),Md=class{constructor(t){t instanceof Map?(E1(t),this.graph=t):t?this.graph=x1(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(E1(e),o=e):o=x1(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=RN(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,l=new IN,h=new Map,f=[],p=0,d=[];if(o.avoid&&(d=[].concat(o.avoid)),d.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(d.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(l.set(t,0);!l.isEmpty();){let g=l.next();if(g.key===e){p=g.priority;let v=g.key;for(;h.has(v);)f.push(v),v=h.get(v);break}a.add(g.key),(this.graph.get(g.key)||new Map).forEach((v,M)=>{if(a.has(M)||d.includes(M))return null;if(!l.has(M))return h.set(M,g.key),l.set(M,g.priority+v);let b=l.get(M).priority,T=g.priority+v;return T<b?(h.set(M,g.key),l.set(M,T)):null})}return f.length?(o.trim?f.shift():f=f.concat([t]),o.reverse||(f=f.reverse()),o.cost?{path:f,cost:p}:f):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};M1.exports=Md});var Zf=nt((LH,_M)=>{"use strict";var vM=Object.getOwnPropertySymbols,VU=Object.prototype.hasOwnProperty,HU=Object.prototype.propertyIsEnumerable;function WU(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function XU(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(l){return t[l]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(l){a[l]=l}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(l){return!1}}_M.exports=XU()?Object.assign:function(r,t){for(var e,o=WU(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var h in e)VU.call(e,h)&&(o[h]=e[h]);if(vM){a=vM(e);for(var f=0;f<a.length;f++)HU.call(e,a[f])&&(o[a[f]]=e[a[f]])}}return o}});var ng=nt((tg,eg)=>{(function(r,t){typeof tg=="object"&&typeof eg!="undefined"?eg.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(tg,function(){"use strict";function r(_,y,A,S,L){(function G(z,F,I,ut,R){for(;ut>I;){if(ut-I>600){var W=ut-I+1,V=F-I+1,Mt=Math.log(W),X=.5*Math.exp(2*Mt/3),mt=.5*Math.sqrt(Mt*X*(W-X)/W)*(V-W/2<0?-1:1),dt=Math.max(I,Math.floor(F-V*X/W+mt)),_t=Math.min(ut,Math.floor(F+(W-V)*X/W+mt));G(z,F,dt,_t,R)}var it=z[F],lt=I,H=ut;for(t(z,I,F),R(z[ut],it)>0&&t(z,I,ut);lt<H;){for(t(z,lt,H),lt++,H--;R(z[lt],it)<0;)lt++;for(;R(z[H],it)>0;)H--}R(z[I],it)===0?t(z,I,H):t(z,++H,ut),H<=F&&(I=H+1),F<=H&&(ut=H-1)}})(_,y,A||0,S||_.length-1,L||e)}function t(_,y,A){var S=_[y];_[y]=_[A],_[A]=S}function e(_,y){return _<y?-1:_>y?1:0}var o=function(_){_===void 0&&(_=9),this._maxEntries=Math.max(4,_),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(_,y,A){if(!A)return y.indexOf(_);for(var S=0;S<y.length;S++)if(A(_,y[S]))return S;return-1}function l(_,y){h(_,0,_.children.length,y,_)}function h(_,y,A,S,L){L||(L=b(null)),L.minX=1/0,L.minY=1/0,L.maxX=-1/0,L.maxY=-1/0;for(var G=y;G<A;G++){var z=_.children[G];f(L,_.leaf?S(z):z)}return L}function f(_,y){return _.minX=Math.min(_.minX,y.minX),_.minY=Math.min(_.minY,y.minY),_.maxX=Math.max(_.maxX,y.maxX),_.maxY=Math.max(_.maxY,y.maxY),_}function p(_,y){return _.minX-y.minX}function d(_,y){return _.minY-y.minY}function g(_){return(_.maxX-_.minX)*(_.maxY-_.minY)}function x(_){return _.maxX-_.minX+(_.maxY-_.minY)}function v(_,y){return _.minX<=y.minX&&_.minY<=y.minY&&y.maxX<=_.maxX&&y.maxY<=_.maxY}function M(_,y){return y.minX<=_.maxX&&y.minY<=_.maxY&&y.maxX>=_.minX&&y.maxY>=_.minY}function b(_){return{children:_,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(_,y,A,S,L){for(var G=[y,A];G.length;)if(!((A=G.pop())-(y=G.pop())<=S)){var z=y+Math.ceil((A-y)/S/2)*S;r(_,z,y,A,L),G.push(y,z,z,A)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(_){var y=this.data,A=[];if(!M(_,y))return A;for(var S=this.toBBox,L=[];y;){for(var G=0;G<y.children.length;G++){var z=y.children[G],F=y.leaf?S(z):z;M(_,F)&&(y.leaf?A.push(z):v(_,F)?this._all(z,A):L.push(z))}y=L.pop()}return A},o.prototype.collides=function(_){var y=this.data;if(!M(_,y))return!1;for(var A=[];y;){for(var S=0;S<y.children.length;S++){var L=y.children[S],G=y.leaf?this.toBBox(L):L;if(M(_,G)){if(y.leaf||v(_,G))return!0;A.push(L)}}y=A.pop()}return!1},o.prototype.load=function(_){if(!_||!_.length)return this;if(_.length<this._minEntries){for(var y=0;y<_.length;y++)this.insert(_[y]);return this}var A=this._build(_.slice(),0,_.length-1,0);if(this.data.children.length)if(this.data.height===A.height)this._splitRoot(this.data,A);else{if(this.data.height<A.height){var S=this.data;this.data=A,A=S}this._insert(A,this.data.height-A.height-1,!0)}else this.data=A;return this},o.prototype.insert=function(_){return _&&this._insert(_,this.data.height-1),this},o.prototype.clear=function(){return this.data=b([]),this},o.prototype.remove=function(_,y){if(!_)return this;for(var A,S,L,G=this.data,z=this.toBBox(_),F=[],I=[];G||F.length;){if(G||(G=F.pop(),S=F[F.length-1],A=I.pop(),L=!0),G.leaf){var ut=a(_,G.children,y);if(ut!==-1)return G.children.splice(ut,1),F.push(G),this._condense(F),this}L||G.leaf||!v(G,z)?S?(A++,G=S.children[A],L=!1):G=null:(F.push(G),I.push(A),A=0,S=G,G=G.children[0])}return this},o.prototype.toBBox=function(_){return _},o.prototype.compareMinX=function(_,y){return _.minX-y.minX},o.prototype.compareMinY=function(_,y){return _.minY-y.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(_){return this.data=_,this},o.prototype._all=function(_,y){for(var A=[];_;)_.leaf?y.push.apply(y,_.children):A.push.apply(A,_.children),_=A.pop();return y},o.prototype._build=function(_,y,A,S){var L,G=A-y+1,z=this._maxEntries;if(G<=z)return l(L=b(_.slice(y,A+1)),this.toBBox),L;S||(S=Math.ceil(Math.log(G)/Math.log(z)),z=Math.ceil(G/Math.pow(z,S-1))),(L=b([])).leaf=!1,L.height=S;var F=Math.ceil(G/z),I=F*Math.ceil(Math.sqrt(z));T(_,y,A,I,this.compareMinX);for(var ut=y;ut<=A;ut+=I){var R=Math.min(ut+I-1,A);T(_,ut,R,F,this.compareMinY);for(var W=ut;W<=R;W+=F){var V=Math.min(W+F-1,R);L.children.push(this._build(_,W,V,S-1))}}return l(L,this.toBBox),L},o.prototype._chooseSubtree=function(_,y,A,S){for(;S.push(y),!y.leaf&&S.length-1!==A;){for(var L=1/0,G=1/0,z=void 0,F=0;F<y.children.length;F++){var I=y.children[F],ut=g(I),R=(W=_,V=I,(Math.max(V.maxX,W.maxX)-Math.min(V.minX,W.minX))*(Math.max(V.maxY,W.maxY)-Math.min(V.minY,W.minY))-ut);R<G?(G=R,L=ut<L?ut:L,z=I):R===G&&ut<L&&(L=ut,z=I)}y=z||y.children[0]}var W,V;return y},o.prototype._insert=function(_,y,A){var S=A?_:this.toBBox(_),L=[],G=this._chooseSubtree(S,this.data,y,L);for(G.children.push(_),f(G,S);y>=0&&L[y].children.length>this._maxEntries;)this._split(L,y),y--;this._adjustParentBBoxes(S,L,y)},o.prototype._split=function(_,y){var A=_[y],S=A.children.length,L=this._minEntries;this._chooseSplitAxis(A,L,S);var G=this._chooseSplitIndex(A,L,S),z=b(A.children.splice(G,A.children.length-G));z.height=A.height,z.leaf=A.leaf,l(A,this.toBBox),l(z,this.toBBox),y?_[y-1].children.push(z):this._splitRoot(A,z)},o.prototype._splitRoot=function(_,y){this.data=b([_,y]),this.data.height=_.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(_,y,A){for(var S,L,G,z,F,I,ut,R=1/0,W=1/0,V=y;V<=A-y;V++){var Mt=h(_,0,V,this.toBBox),X=h(_,V,A,this.toBBox),mt=(L=Mt,G=X,z=void 0,F=void 0,I=void 0,ut=void 0,z=Math.max(L.minX,G.minX),F=Math.max(L.minY,G.minY),I=Math.min(L.maxX,G.maxX),ut=Math.min(L.maxY,G.maxY),Math.max(0,I-z)*Math.max(0,ut-F)),dt=g(Mt)+g(X);mt<R?(R=mt,S=V,W=dt<W?dt:W):mt===R&&dt<W&&(W=dt,S=V)}return S||A-y},o.prototype._chooseSplitAxis=function(_,y,A){var S=_.leaf?this.compareMinX:p,L=_.leaf?this.compareMinY:d;this._allDistMargin(_,y,A,S)<this._allDistMargin(_,y,A,L)&&_.children.sort(S)},o.prototype._allDistMargin=function(_,y,A,S){_.children.sort(S);for(var L=this.toBBox,G=h(_,0,y,L),z=h(_,A-y,A,L),F=x(G)+x(z),I=y;I<A-y;I++){var ut=_.children[I];f(G,_.leaf?L(ut):ut),F+=x(G)}for(var R=A-y-1;R>=y;R--){var W=_.children[R];f(z,_.leaf?L(W):W),F+=x(z)}return F},o.prototype._adjustParentBBoxes=function(_,y,A){for(var S=A;S>=0;S--)f(y[S],_)},o.prototype._condense=function(_){for(var y=_.length-1,A=void 0;y>=0;y--)_[y].children.length===0?y>0?(A=_[y-1].children).splice(A.indexOf(_[y]),1):this.clear():l(_[y],this.toBBox)},o})});var xM=nt((rg,ig)=>{(function(r,t){typeof rg=="object"&&typeof ig!="undefined"?ig.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(rg,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var l=(this.length>>1)-1;l>=0;l--)this._down(l)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,l=a.data,h=a.compare,f=l[o];o>0;){var p=o-1>>1,d=l[p];if(h(f,d)>=0)break;l[o]=d,o=p}l[o]=f},r.prototype._down=function(o){for(var a=this,l=a.data,h=a.compare,f=this.length>>1,p=l[o];o<f;){var d=(o<<1)+1,g=l[d],x=d+1;if(x<this.length&&h(l[x],g)<0&&(d=x,g=l[x]),h(g,p)>=0)break;l[o]=g,o=d}l[o]=p};function t(e,o){return e<o?-1:e>o?1:0}return r})});var MM=nt((BH,EM)=>{EM.exports=function(t,e,o,a){var l=t[0],h=t[1],f=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=(a-o)/2,d=0,g=p-1;d<p;g=d++){var x=e[o+d*2+0],v=e[o+d*2+1],M=e[o+g*2+0],b=e[o+g*2+1],T=v>h!=b>h&&l<(M-x)*(h-v)/(b-v)+x;T&&(f=!f)}return f}});var wM=nt((zH,SM)=>{SM.exports=function(t,e,o,a){var l=t[0],h=t[1],f=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=a-o,d=0,g=p-1;d<p;g=d++){var x=e[d+o][0],v=e[d+o][1],M=e[g+o][0],b=e[g+o][1],T=v>h!=b>h&&l<(M-x)*(h-v)/(b-v)+x;T&&(f=!f)}return f}});var AM=nt((GH,jf)=>{var bM=MM(),TM=wM();jf.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?TM(t,e,o,a):bM(t,e,o,a)};jf.exports.nested=TM;jf.exports.flat=bM});var PM=nt((Qf,CM)=>{(function(r,t){typeof Qf=="object"&&typeof CM!="undefined"?t(Qf):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(Qf,function(r){"use strict";let e=33306690738754706e-32;function o(M,b,T,_,y){let A,S,L,G,z=b[0],F=_[0],I=0,ut=0;F>z==F>-z?(A=z,z=b[++I]):(A=F,F=_[++ut]);let R=0;if(I<M&&ut<T)for(F>z==F>-z?(L=A-((S=z+A)-z),z=b[++I]):(L=A-((S=F+A)-F),F=_[++ut]),A=S,L!==0&&(y[R++]=L);I<M&&ut<T;)F>z==F>-z?(L=A-((S=A+z)-(G=S-A))+(z-G),z=b[++I]):(L=A-((S=A+F)-(G=S-A))+(F-G),F=_[++ut]),A=S,L!==0&&(y[R++]=L);for(;I<M;)L=A-((S=A+z)-(G=S-A))+(z-G),z=b[++I],A=S,L!==0&&(y[R++]=L);for(;ut<T;)L=A-((S=A+F)-(G=S-A))+(F-G),F=_[++ut],A=S,L!==0&&(y[R++]=L);return A===0&&R!==0||(y[R++]=A),R}function a(M){return new Float64Array(M)}let l=33306690738754716e-32,h=22204460492503146e-32,f=11093356479670487e-47,p=a(4),d=a(8),g=a(12),x=a(16),v=a(4);r.orient2d=function(M,b,T,_,y,A){let S=(b-A)*(T-y),L=(M-y)*(_-A),G=S-L;if(S===0||L===0||S>0!=L>0)return G;let z=Math.abs(S+L);return Math.abs(G)>=l*z?G:-function(F,I,ut,R,W,V,Mt){let X,mt,dt,_t,it,lt,H,bt,Tt,Yt,tt,wt,Bt,$t,Ut,Dt,At,te,rt=F-W,an=ut-W,zt=I-V,ne=R-V;it=(Ut=(bt=rt-(H=(lt=134217729*rt)-(lt-rt)))*(Yt=ne-(Tt=(lt=134217729*ne)-(lt-ne)))-(($t=rt*ne)-H*Tt-bt*Tt-H*Yt))-(tt=Ut-(At=(bt=zt-(H=(lt=134217729*zt)-(lt-zt)))*(Yt=an-(Tt=(lt=134217729*an)-(lt-an)))-((Dt=zt*an)-H*Tt-bt*Tt-H*Yt))),p[0]=Ut-(tt+it)+(it-At),it=(Bt=$t-((wt=$t+tt)-(it=wt-$t))+(tt-it))-(tt=Bt-Dt),p[1]=Bt-(tt+it)+(it-Dt),it=(te=wt+tt)-wt,p[2]=wt-(te-it)+(tt-it),p[3]=te;let Wt=function(Y,N){let xt=N[0];for(let Et=1;Et<Y;Et++)xt+=N[Et];return xt}(4,p),ie=h*Mt;if(Wt>=ie||-Wt>=ie||(X=F-(rt+(it=F-rt))+(it-W),dt=ut-(an+(it=ut-an))+(it-W),mt=I-(zt+(it=I-zt))+(it-V),_t=R-(ne+(it=R-ne))+(it-V),X===0&&mt===0&&dt===0&&_t===0)||(ie=f*Mt+e*Math.abs(Wt),(Wt+=rt*_t+ne*X-(zt*dt+an*mt))>=ie||-Wt>=ie))return Wt;it=(Ut=(bt=X-(H=(lt=134217729*X)-(lt-X)))*(Yt=ne-(Tt=(lt=134217729*ne)-(lt-ne)))-(($t=X*ne)-H*Tt-bt*Tt-H*Yt))-(tt=Ut-(At=(bt=mt-(H=(lt=134217729*mt)-(lt-mt)))*(Yt=an-(Tt=(lt=134217729*an)-(lt-an)))-((Dt=mt*an)-H*Tt-bt*Tt-H*Yt))),v[0]=Ut-(tt+it)+(it-At),it=(Bt=$t-((wt=$t+tt)-(it=wt-$t))+(tt-it))-(tt=Bt-Dt),v[1]=Bt-(tt+it)+(it-Dt),it=(te=wt+tt)-wt,v[2]=wt-(te-it)+(tt-it),v[3]=te;let ce=o(4,p,4,v,d);it=(Ut=(bt=rt-(H=(lt=134217729*rt)-(lt-rt)))*(Yt=_t-(Tt=(lt=134217729*_t)-(lt-_t)))-(($t=rt*_t)-H*Tt-bt*Tt-H*Yt))-(tt=Ut-(At=(bt=zt-(H=(lt=134217729*zt)-(lt-zt)))*(Yt=dt-(Tt=(lt=134217729*dt)-(lt-dt)))-((Dt=zt*dt)-H*Tt-bt*Tt-H*Yt))),v[0]=Ut-(tt+it)+(it-At),it=(Bt=$t-((wt=$t+tt)-(it=wt-$t))+(tt-it))-(tt=Bt-Dt),v[1]=Bt-(tt+it)+(it-Dt),it=(te=wt+tt)-wt,v[2]=wt-(te-it)+(tt-it),v[3]=te;let Lt=o(ce,d,4,v,g);it=(Ut=(bt=X-(H=(lt=134217729*X)-(lt-X)))*(Yt=_t-(Tt=(lt=134217729*_t)-(lt-_t)))-(($t=X*_t)-H*Tt-bt*Tt-H*Yt))-(tt=Ut-(At=(bt=mt-(H=(lt=134217729*mt)-(lt-mt)))*(Yt=dt-(Tt=(lt=134217729*dt)-(lt-dt)))-((Dt=mt*dt)-H*Tt-bt*Tt-H*Yt))),v[0]=Ut-(tt+it)+(it-At),it=(Bt=$t-((wt=$t+tt)-(it=wt-$t))+(tt-it))-(tt=Bt-Dt),v[1]=Bt-(tt+it)+(it-Dt),it=(te=wt+tt)-wt,v[2]=wt-(te-it)+(tt-it),v[3]=te;let se=o(Lt,g,4,v,x);return x[se-1]}(M,b,T,_,y,A,z)},r.orient2dfast=function(M,b,T,_,y,A){return(b-A)*(T-y)-(M-y)*(_-A)},Object.defineProperty(r,"__esModule",{value:!0})})});var DM=nt((kH,ug)=>{"use strict";var IM=ng(),eh=xM(),$U=AM(),ZU=PM().orient2d;eh.default&&(eh=eh.default);ug.exports=OM;ug.exports.default=OM;function OM(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=tB(r),a=new IM(16);a.toBBox=function(A){return{minX:A[0],minY:A[1],maxX:A[0],maxY:A[1]}},a.compareMinX=function(A,S){return A[0]-S[0]},a.compareMinY=function(A,S){return A[1]-S[1]},a.load(r);for(var l=[],h=0,f;h<o.length;h++){var p=o[h];a.remove(p),f=NM(p,f),l.push(f)}var d=new IM(16);for(h=0;h<l.length;h++)d.insert(og(l[h]));for(var g=t*t,x=e*e;l.length;){var v=l.shift(),M=v.p,b=v.next.p,T=sg(M,b);if(!(T<x)){var _=T/g;p=JU(a,v.prev.p,M,b,v.next.next.p,_,d),p&&Math.min(sg(p,M),sg(p,b))<=_&&(l.push(v),l.push(NM(p,v)),a.remove(p),d.remove(v),d.insert(og(v)),d.insert(og(v.next)))}}v=f;var y=[];do y.push(v.p),v=v.next;while(v!==f);return y.push(v.p),y}function JU(r,t,e,o,a,l,h){for(var f=new eh([],KU),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],x=p.leaf?ag(g,e,o):jU(e,o,g);x>l||f.push({node:g,dist:x})}for(;f.length&&!f.peek().node.children;){var v=f.pop(),M=v.node,b=ag(M,t,e),T=ag(M,o,a);if(v.dist<b&&v.dist<T&&LM(e,M,h)&&LM(o,M,h))return M}p=f.pop(),p&&(p=p.node)}return null}function KU(r,t){return r.dist-t.dist}function jU(r,t,e){if(RM(r,e)||RM(t,e))return 0;var o=th(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=th(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=th(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var h=th(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return h===0?0:Math.min(o,a,l,h)}function RM(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function LM(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),l=Math.max(r[0],t[0]),h=Math.max(r[1],t[1]),f=e.search({minX:o,minY:a,maxX:l,maxY:h}),p=0;p<f.length;p++)if(QU(f[p].p,f[p].next.p,r,t))return!1;return!0}function Pu(r,t,e){return ZU(r[0],r[1],t[0],t[1],e[0],e[1])}function QU(r,t,e,o){return r!==o&&t!==e&&Pu(r,t,e)>0!=Pu(r,t,o)>0&&Pu(e,o,r)>0!=Pu(e,o,t)>0}function og(r){var t=r.p,e=r.next.p;return r.minX=Math.min(t[0],e[0]),r.minY=Math.min(t[1],e[1]),r.maxX=Math.max(t[0],e[0]),r.maxY=Math.max(t[1],e[1]),r}function tB(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],l=0;l<r.length;l++){var h=r[l];h[0]<t[0]&&(t=h),h[0]>o[0]&&(o=h),h[1]<e[1]&&(e=h),h[1]>a[1]&&(a=h)}var f=[t,e,o,a],p=f.slice();for(l=0;l<r.length;l++)$U(r[l],f)||p.push(r[l]);return nB(p)}function NM(r,t){var e={p:r,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function sg(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function ag(r,t,e){var o=t[0],a=t[1],l=e[0]-o,h=e[1]-a;if(l!==0||h!==0){var f=((r[0]-o)*l+(r[1]-a)*h)/(l*l+h*h);f>1?(o=e[0],a=e[1]):f>0&&(o+=l*f,a+=h*f)}return l=r[0]-o,h=r[1]-a,l*l+h*h}function th(r,t,e,o,a,l,h,f){var p=e-r,d=o-t,g=h-a,x=f-l,v=r-a,M=t-l,b=p*p+d*d,T=p*g+d*x,_=g*g+x*x,y=p*v+d*M,A=g*v+x*M,S=b*_-T*T,L,G,z,F,I=S,ut=S;S===0?(G=0,I=1,F=A,ut=_):(G=T*A-_*y,F=b*A-T*y,G<0?(G=0,F=A,ut=_):G>I&&(G=I,F=A+T,ut=_)),F<0?(F=0,-y<0?G=0:-y>b?G=I:(G=-y,I=b)):F>ut&&(F=ut,-y+T<0?G=0:-y+T>b?G=I:(G=-y+T,I=b)),L=G===0?0:G/I,z=F===0?0:F/ut;var R=(1-L)*r+L*e,W=(1-L)*t+L*o,V=(1-z)*a+z*h,Mt=(1-z)*l+z*f,X=V-R,mt=Mt-W;return X*X+mt*mt}function eB(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function nB(r){r.sort(eB);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Pu(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}for(var o=[],a=r.length-1;a>=0;a--){for(;o.length>=2&&Pu(o[o.length-2],o[o.length-1],r[a])<=0;)o.pop();o.push(r[a])}return o.pop(),t.pop(),t.concat(o)}});var kM=nt((cg,fg)=>{(function(r,t){typeof cg=="object"&&typeof fg!="undefined"?fg.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(cg,function(){"use strict";function r(a,l,h,f,p){t(a,l,h||0,f||a.length-1,p||o)}function t(a,l,h,f,p){for(;f>h;){if(f-h>600){var d=f-h+1,g=l-h+1,x=Math.log(d),v=.5*Math.exp(2*x/3),M=.5*Math.sqrt(x*v*(d-v)/d)*(g-d/2<0?-1:1),b=Math.max(h,Math.floor(l-g*v/d+M)),T=Math.min(f,Math.floor(l+(d-g)*v/d+M));t(a,l,b,T,p)}var _=a[l],y=h,A=f;for(e(a,h,l),p(a[f],_)>0&&e(a,h,f);y<A;){for(e(a,y,A),y++,A--;p(a[y],_)<0;)y++;for(;p(a[A],_)>0;)A--}p(a[h],_)===0?e(a,h,A):(A++,e(a,A,f)),A<=l&&(h=A+1),l<=A&&(f=A-1)}}function e(a,l,h){var f=a[l];a[l]=a[h],a[h]=f}function o(a,l){return a<l?-1:a>l?1:0}return r})});var mg=nt((pW,dg)=>{"use strict";dg.exports=zl;dg.exports.default=zl;var mB=kM();function zl(r,t){if(!(this instanceof zl))return new zl(r,t);this._maxEntries=Math.max(4,r||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}zl.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!rh(r,t))return e;for(var a=[],l,h,f,p;t;){for(l=0,h=t.children.length;l<h;l++)f=t.children[l],p=t.leaf?o(f):f,rh(r,p)&&(t.leaf?e.push(f):pg(r,p)?this._all(f,e):a.push(f));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!rh(r,t))return!1;for(var o=[],a,l,h,f;t;){for(a=0,l=t.children.length;a<l;a++)if(h=t.children[a],f=t.leaf?e(h):h,rh(r,f)){if(t.leaf||pg(r,f))return!0;o.push(h)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=Lu([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],l=[],h,f,p,d;e||a.length;){if(e||(e=a.pop(),f=a[a.length-1],h=l.pop(),d=!0),e.leaf&&(p=gB(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&pg(e,o)?(a.push(e),l.push(h),h=0,f=e,e=e.children[0]):f?(h++,e=f.children[h],d=!1):e=null}return this},toBBox:function(r){return r},compareMinX:qM,compareMinY:VM,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,l=this._maxEntries,h;if(a<=l)return h=Lu(r.slice(t,e+1)),Ru(h,this.toBBox),h;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),h=Lu([]),h.leaf=!1,h.height=o;var f=Math.ceil(a/l),p=f*Math.ceil(Math.sqrt(l)),d,g,x,v;for(HM(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(x=Math.min(d+p-1,e),HM(r,d,x,f,this.compareMinY),g=d;g<=x;g+=f)v=Math.min(g+f-1,x),h.children.push(this._build(r,g,v,o-1));return Ru(h,this.toBBox),h},_chooseSubtree:function(r,t,e,o){for(var a,l,h,f,p,d,g,x;o.push(t),!(t.leaf||o.length-1===e);){for(g=x=1/0,a=0,l=t.children.length;a<l;a++)h=t.children[a],p=hg(h),d=yB(r,h)-p,d<x?(x=d,g=p<g?p:g,f=h):d===x&&p<g&&(g=p,f=h);t=f||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),l=[],h=this._chooseSubtree(a,this.data,t,l);for(h.children.push(r),Bl(h,a);t>=0&&l[t].children.length>this._maxEntries;)this._split(l,t),t--;this._adjustParentBBoxes(a,l,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var l=this._chooseSplitIndex(e,a,o),h=Lu(e.children.splice(l,e.children.length-l));h.height=e.height,h.leaf=e.leaf,Ru(e,this.toBBox),Ru(h,this.toBBox),t?r[t-1].children.push(h):this._splitRoot(e,h)},_splitRoot:function(r,t){this.data=Lu([r,t]),this.data.height=r.height+1,this.data.leaf=!1,Ru(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,l,h,f,p,d,g;for(p=d=1/0,o=t;o<=e-t;o++)a=Ul(r,0,o,this.toBBox),l=Ul(r,o,e,this.toBBox),h=vB(a,l),f=hg(a)+hg(l),h<p?(p=h,g=o,d=f<d?f:d):h===p&&f<d&&(d=f,g=o);return g},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:qM,a=r.leaf?this.compareMinY:VM,l=this._allDistMargin(r,t,e,o),h=this._allDistMargin(r,t,e,a);l<h&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,l=Ul(r,0,t,a),h=Ul(r,e-t,e,a),f=nh(l)+nh(h),p,d;for(p=t;p<e-t;p++)d=r.children[p],Bl(l,r.leaf?a(d):d),f+=nh(l);for(p=e-t-1;p>=t;p--)d=r.children[p],Bl(h,r.leaf?a(d):d),f+=nh(h);return f},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)Bl(t[o],r)},_condense:function(r){for(var t=r.length-1,e;t>=0;t--)r[t].children.length===0?t>0?(e=r[t-1].children,e.splice(e.indexOf(r[t]),1)):this.clear():Ru(r[t],this.toBBox)},_initFormat:function(r){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(r[0])),this.compareMinY=new Function("a","b",t.join(r[1])),this.toBBox=new Function("a","return {minX: a"+r[0]+", minY: a"+r[1]+", maxX: a"+r[2]+", maxY: a"+r[3]+"};")}};function gB(r,t,e){if(!e)return t.indexOf(r);for(var o=0;o<t.length;o++)if(e(r,t[o]))return o;return-1}function Ru(r,t){Ul(r,0,r.children.length,t,r)}function Ul(r,t,e,o,a){a||(a=Lu(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var l=t,h;l<e;l++)h=r.children[l],Bl(a,r.leaf?o(h):h);return a}function Bl(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function qM(r,t){return r.minX-t.minX}function VM(r,t){return r.minY-t.minY}function hg(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function nh(r){return r.maxX-r.minX+(r.maxY-r.minY)}function yB(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function vB(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),l=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,l-o)}function pg(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function rh(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function Lu(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function HM(r,t,e,o,a){for(var l=[t,e],h;l.length;)e=l.pop(),t=l.pop(),!(e-t<=o)&&(h=t+Math.ceil((e-t)/o/2)*o,mB(r,h,t,e,a),l.push(t,h,h,e))}});var JM=nt((TX,Eg)=>{"use strict";Eg.exports=ah;Eg.exports.default=ah;function ah(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=YM(r,0,a,e,!0),h=[];if(!l||l.next===l.prev)return h;var f,p,d,g,x,v,M;if(o&&(l=CB(r,t,l,e)),r.length>80*e){f=d=r[0],p=g=r[1];for(var b=e;b<a;b+=e)x=r[b],v=r[b+1],x<f&&(f=x),v<p&&(p=v),x>d&&(d=x),v>g&&(g=v);M=Math.max(d-f,g-p),M=M!==0?32767/M:0}return ql(l,h,e,f,p,M,0),h}function YM(r,t,e,o,a){var l,h;if(a===xg(r,t,e,o)>0)for(l=t;l<e;l+=o)h=XM(l,r[l],r[l+1],h);else for(l=e-o;l>=t;l-=o)h=XM(l,r[l],r[l+1],h);return h&&uh(h,h.next)&&(Hl(h),h=h.next),h}function wa(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(uh(e,e.next)||$n(e.prev,e,e.next)===0)){if(Hl(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function ql(r,t,e,o,a,l,h){if(r){!h&&l&&NB(r,o,a,l);for(var f=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?bB(r,o,a,l):wB(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),Hl(r),r=d.next,f=d.next;continue}if(r=d,r===f){h?h===1?(r=TB(wa(r),t,e),ql(r,t,e,o,a,l,2)):h===2&&AB(r,t,e,o,a,l):ql(wa(r),t,e,o,a,l,1);break}}}}function wB(r){var t=r.prev,e=r,o=r.next;if($n(t,e,o)>=0)return!1;for(var a=t.x,l=e.x,h=o.x,f=t.y,p=e.y,d=o.y,g=a<l?a<h?a:h:l<h?l:h,x=f<p?f<d?f:d:p<d?p:d,v=a>l?a>h?a:h:l>h?l:h,M=f>p?f>d?f:d:p>d?p:d,b=o.next;b!==t;){if(b.x>=g&&b.x<=v&&b.y>=x&&b.y<=M&&Du(a,f,l,p,h,d,b.x,b.y)&&$n(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function bB(r,t,e,o){var a=r.prev,l=r,h=r.next;if($n(a,l,h)>=0)return!1;for(var f=a.x,p=l.x,d=h.x,g=a.y,x=l.y,v=h.y,M=f<p?f<d?f:d:p<d?p:d,b=g<x?g<v?g:v:x<v?x:v,T=f>p?f>d?f:d:p>d?p:d,_=g>x?g>v?g:v:x>v?x:v,y=vg(M,b,t,e,o),A=vg(T,_,t,e,o),S=r.prevZ,L=r.nextZ;S&&S.z>=y&&L&&L.z<=A;){if(S.x>=M&&S.x<=T&&S.y>=b&&S.y<=_&&S!==a&&S!==h&&Du(f,g,p,x,d,v,S.x,S.y)&&$n(S.prev,S,S.next)>=0||(S=S.prevZ,L.x>=M&&L.x<=T&&L.y>=b&&L.y<=_&&L!==a&&L!==h&&Du(f,g,p,x,d,v,L.x,L.y)&&$n(L.prev,L,L.next)>=0))return!1;L=L.nextZ}for(;S&&S.z>=y;){if(S.x>=M&&S.x<=T&&S.y>=b&&S.y<=_&&S!==a&&S!==h&&Du(f,g,p,x,d,v,S.x,S.y)&&$n(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;L&&L.z<=A;){if(L.x>=M&&L.x<=T&&L.y>=b&&L.y<=_&&L!==a&&L!==h&&Du(f,g,p,x,d,v,L.x,L.y)&&$n(L.prev,L,L.next)>=0)return!1;L=L.nextZ}return!0}function TB(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!uh(a,l)&&$M(a,o,o.next,l)&&Vl(a,l)&&Vl(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),Hl(o),Hl(o.next),o=r=l),o=o.next}while(o!==r);return wa(o)}function AB(r,t,e,o,a,l){var h=r;do{for(var f=h.next.next;f!==h.prev;){if(h.i!==f.i&&FB(h,f)){var p=ZM(h,f);h=wa(h,h.next),p=wa(p,p.next),ql(h,t,e,o,a,l,0),ql(p,t,e,o,a,l,0);return}f=f.next}h=h.next}while(h!==r)}function CB(r,t,e,o){var a=[],l,h,f,p,d;for(l=0,h=t.length;l<h;l++)f=t[l]*o,p=l<h-1?t[l+1]*o:r.length,d=YM(r,f,p,o,!1),d===d.next&&(d.steiner=!0),a.push(DB(d));for(a.sort(PB),l=0;l<a.length;l++)e=IB(a[l],e);return e}function PB(r,t){return r.x-t.x}function IB(r,t){var e=RB(r,t);if(!e)return t;var o=ZM(e,r);return wa(o,o.next),wa(e,e.next)}function RB(r,t){var e=t,o=r.x,a=r.y,l=-1/0,h;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var f=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(f<=o&&f>l&&(l=f,h=e.x<e.next.x?e:e.next,f===o))return h}e=e.next}while(e!==t);if(!h)return null;var p=h,d=h.x,g=h.y,x=1/0,v;e=h;do o>=e.x&&e.x>=d&&o!==e.x&&Du(a<g?o:l,a,d,g,a<g?l:o,a,e.x,e.y)&&(v=Math.abs(a-e.y)/(o-e.x),Vl(e,r)&&(v<x||v===x&&(e.x>h.x||e.x===h.x&&LB(h,e)))&&(h=e,x=v)),e=e.next;while(e!==p);return h}function LB(r,t){return $n(r.prev,r,t.prev)<0&&$n(t.next,r,r.next)<0}function NB(r,t,e,o){var a=r;do a.z===0&&(a.z=vg(a.x,a.y,t,e,o)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==r);a.prevZ.nextZ=null,a.prevZ=null,OB(a)}function OB(r){var t,e,o,a,l,h,f,p,d=1;do{for(e=r,r=null,l=null,h=0;e;){for(h++,o=e,f=0,t=0;t<d&&(f++,o=o.nextZ,!!o);t++);for(p=d;f>0||p>0&&o;)f!==0&&(p===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,f--):(a=o,o=o.nextZ,p--),l?l.nextZ=a:r=a,a.prevZ=l,l=a;e=o}l.nextZ=null,d*=2}while(h>1);return r}function vg(r,t,e,o,a){return r=(r-e)*a|0,t=(t-o)*a|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function DB(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Du(r,t,e,o,a,l,h,f){return(a-h)*(t-f)>=(r-h)*(l-f)&&(r-h)*(o-f)>=(e-h)*(t-f)&&(e-h)*(l-f)>=(a-h)*(o-f)}function FB(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!UB(r,t)&&(Vl(r,t)&&Vl(t,r)&&BB(r,t)&&($n(r.prev,r,t.prev)||$n(r,t.prev,t))||uh(r,t)&&$n(r.prev,r,r.next)>0&&$n(t.prev,t,t.next)>0)}function $n(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function uh(r,t){return r.x===t.x&&r.y===t.y}function $M(r,t,e,o){var a=sh($n(r,t,e)),l=sh($n(r,t,o)),h=sh($n(e,o,r)),f=sh($n(e,o,t));return!!(a!==l&&h!==f||a===0&&oh(r,e,t)||l===0&&oh(r,o,t)||h===0&&oh(e,r,o)||f===0&&oh(e,t,o))}function oh(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function sh(r){return r>0?1:r<0?-1:0}function UB(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&$M(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Vl(r,t){return $n(r.prev,r,r.next)<0?$n(r,t,r.next)>=0&&$n(r,r.prev,t)>=0:$n(r,t,r.prev)<0||$n(r,r.next,t)<0}function BB(r,t){var e=r,o=!1,a=(r.x+t.x)/2,l=(r.y+t.y)/2;do e.y>l!=e.next.y>l&&e.next.y!==e.y&&a<(e.next.x-e.x)*(l-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function ZM(r,t){var e=new _g(r.i,r.x,r.y),o=new _g(t.i,t.x,t.y),a=r.next,l=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,l.next=o,o.prev=l,o}function XM(r,t,e,o){var a=new _g(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function Hl(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _g(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}ah.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,h=Math.abs(xg(r,0,l,e));if(a)for(var f=0,p=t.length;f<p;f++){var d=t[f]*e,g=f<p-1?t[f+1]*e:r.length;h-=Math.abs(xg(r,d,g,e))}var x=0;for(f=0;f<o.length;f+=3){var v=o[f]*e,M=o[f+1]*e,b=o[f+2]*e;x+=Math.abs((r[v]-r[b])*(r[M+1]-r[v+1])-(r[v]-r[M])*(r[b+1]-r[v+1]))}return h===0&&x===0?0:Math.abs((x-h)/h)};function xg(r,t,e,o){for(var a=0,l=t,h=e-o;l<e;l+=o)a+=(r[h]-r[l])*(r[l+1]+r[h+1]),h=l;return a}ah.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var l=0;l<r[a].length;l++)for(var h=0;h<t;h++)e.vertices.push(r[a][l][h]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var Tg=nt(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.earthRadius=63710088e-1;he.factors={centimeters:he.earthRadius*100,centimetres:he.earthRadius*100,degrees:he.earthRadius/111325,feet:he.earthRadius*3.28084,inches:he.earthRadius*39.37,kilometers:he.earthRadius/1e3,kilometres:he.earthRadius/1e3,meters:he.earthRadius,metres:he.earthRadius,miles:he.earthRadius/1609.344,millimeters:he.earthRadius*1e3,millimetres:he.earthRadius*1e3,nauticalmiles:he.earthRadius/1852,radians:1,yards:he.earthRadius*1.0936};he.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/he.earthRadius,yards:1.0936133};he.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Gs(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}he.feature=Gs;function GB(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Mg(t).geometry;case"LineString":return wg(t).geometry;case"Polygon":return Sg(t).geometry;case"MultiPoint":return jM(t).geometry;case"MultiLineString":return KM(t).geometry;case"MultiPolygon":return QM(t).geometry;default:throw new Error(r+" is invalid")}}he.geometry=GB;function Mg(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!lh(r[0])||!lh(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Gs(o,t,e)}he.point=Mg;function kB(r,t,e){return e===void 0&&(e={}),ch(r.map(function(o){return Mg(o,t)}),e)}he.points=kB;function Sg(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<l[l.length-1].length;h++)if(l[l.length-1][h]!==l[0][h])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:r};return Gs(f,t,e)}he.polygon=Sg;function qB(r,t,e){return e===void 0&&(e={}),ch(r.map(function(o){return Sg(o,t)}),e)}he.polygons=qB;function wg(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return Gs(o,t,e)}he.lineString=wg;function VB(r,t,e){return e===void 0&&(e={}),ch(r.map(function(o){return wg(o,t)}),e)}he.lineStrings=VB;function ch(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}he.featureCollection=ch;function KM(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Gs(o,t,e)}he.multiLineString=KM;function jM(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Gs(o,t,e)}he.multiPoint=jM;function QM(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Gs(o,t,e)}he.multiPolygon=QM;function HB(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Gs(o,t,e)}he.geometryCollection=HB;function WB(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}he.round=WB;function tS(r,t){t===void 0&&(t="kilometers");var e=he.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}he.radiansToLength=tS;function bg(r,t){t===void 0&&(t="kilometers");var e=he.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}he.lengthToRadians=bg;function XB(r,t){return eS(bg(r,t))}he.lengthToDegrees=XB;function YB(r){var t=r%360;return t<0&&(t+=360),t}he.bearingToAzimuth=YB;function eS(r){var t=r%(2*Math.PI);return t*180/Math.PI}he.radiansToDegrees=eS;function $B(r){var t=r%360;return t*Math.PI/180}he.degreesToRadians=$B;function ZB(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return tS(bg(r,t),e)}he.convertLength=ZB;function JB(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=he.areaFactors[t];if(!o)throw new Error("invalid original units");var a=he.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}he.convertArea=JB;function lh(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}he.isNumber=lh;function KB(r){return!!r&&r.constructor===Object}he.isObject=KB;function jB(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!lh(t))throw new Error("bbox must only contain numbers")})}he.validateBBox=jB;function QB(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}he.validateId=QB});var Cg=nt(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});var Qr=Tg();function Wl(r,t,e){if(r!==null)for(var o,a,l,h,f,p,d,g=0,x=0,v,M=r.type,b=M==="FeatureCollection",T=M==="Feature",_=b?r.features.length:1,y=0;y<_;y++){d=b?r.features[y].geometry:T?r.geometry:r,v=d?d.type==="GeometryCollection":!1,f=v?d.geometries.length:1;for(var A=0;A<f;A++){var S=0,L=0;if(h=v?d.geometries[A]:d,h!==null){p=h.coordinates;var G=h.type;switch(g=e&&(G==="Polygon"||G==="MultiPolygon")?1:0,G){case null:break;case"Point":if(t(p,x,y,S,L)===!1)return!1;x++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],x,y,S,L)===!1)return!1;x++,G==="MultiPoint"&&S++}G==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],x,y,S,L)===!1)return!1;x++}G==="MultiLineString"&&S++,G==="Polygon"&&L++}G==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(L=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],x,y,S,L)===!1)return!1;x++}L++}S++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(Wl(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function tz(r,t,e,o){var a=e;return Wl(r,function(l,h,f,p,d){h===0&&e===void 0?a=l:a=t(a,l,h,f,p,d)},o),a}function nS(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}function ez(r,t,e){var o=e;return nS(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function rS(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function nz(r,t,e){var o=e;return rS(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function rz(r){var t=[];return Wl(r,function(e){t.push(e)}),t}function Ag(r,t){var e,o,a,l,h,f,p,d,g,x,v=0,M=r.type==="FeatureCollection",b=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(f=M?r.features[e].geometry:b?r.geometry:r,d=M?r.features[e].properties:b?r.properties:{},g=M?r.features[e].bbox:b?r.bbox:void 0,x=M?r.features[e].id:b?r.id:void 0,p=f?f.type==="GeometryCollection":!1,h=p?f.geometries.length:1,a=0;a<h;a++){if(l=p?f.geometries[a]:f,l===null){if(t(null,v,d,g,x)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,v,d,g,x)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],v,d,g,x)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function iz(r,t,e){var o=e;return Ag(r,function(a,l,h,f,p){l===0&&e===void 0?o=a:o=t(o,a,l,h,f,p)}),o}function fh(r,t){Ag(r,function(e,o,a,l,h){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(Qr.feature(e,a,{bbox:l,id:h}),o,0)===!1?!1:void 0}var p;switch(f){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],x={type:p,coordinates:g};if(t(Qr.feature(x,a),o,d)===!1)return!1}})}function oz(r,t,e){var o=e;return fh(r,function(a,l,h){l===0&&h===0&&e===void 0?o=a:o=t(o,a,l,h)}),o}function iS(r,t){fh(r,function(e,o,a){var l=0;if(e.geometry){var h=e.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var f,p=0,d=0,g=0;if(Wl(e,function(x,v,M,b,T){if(f===void 0||o>p||b>d||T>g){f=x,p=o,d=b,g=T,l=0;return}var _=Qr.lineString([f,x],e.properties);if(t(_,o,a,T,l)===!1)return!1;l++,f=x})===!1)return!1}}})}function sz(r,t,e){var o=e,a=!1;return iS(r,function(l,h,f,p,d){a===!1&&e===void 0?o=l:o=t(o,l,h,f,p,d),a=!0}),o}function oS(r,t){if(!r)throw new Error("geojson is required");fh(r,function(e,o,a){if(e.geometry!==null){var l=e.geometry.type,h=e.geometry.coordinates;switch(l){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var f=0;f<h.length;f++)if(t(Qr.lineString(h[f],e.properties),o,a,f)===!1)return!1;break}}})}function az(r,t,e){var o=e;return oS(r,function(a,l,h,f){l===0&&e===void 0?o=a:o=t(o,a,l,h,f)}),o}function uz(r,t){if(t=t||{},!Qr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.segmentIndex||0,h=t.properties,f;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),h=h||r.features[e].properties,f=r.features[e].geometry;break;case"Feature":h=h||r.properties,f=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=r;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":case"MultiPoint":return null;case"LineString":return l<0&&(l=p.length+l-1),Qr.lineString([p[l],p[l+1]],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l-1),Qr.lineString([p[a][l],p[a][l+1]],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l-1),Qr.lineString([p[o][l],p[o][l+1]],h,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l-1),Qr.lineString([p[o][a][l],p[o][a][l+1]],h,t)}throw new Error("geojson is invalid")}function lz(r,t){if(t=t||{},!Qr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.coordIndex||0,h=t.properties,f;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),h=h||r.features[e].properties,f=r.features[e].geometry;break;case"Feature":h=h||r.properties,f=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=r;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":return Qr.point(p,h,t);case"MultiPoint":return o<0&&(o=p.length+o),Qr.point(p[o],h,t);case"LineString":return l<0&&(l=p.length+l),Qr.point(p[l],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Qr.point(p[a][l],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Qr.point(p[o][l],h,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l),Qr.point(p[o][a][l],h,t)}throw new Error("geojson is invalid")}mr.coordAll=rz;mr.coordEach=Wl;mr.coordReduce=tz;mr.featureEach=rS;mr.featureReduce=nz;mr.findPoint=lz;mr.findSegment=uz;mr.flattenEach=fh;mr.flattenReduce=oz;mr.geomEach=Ag;mr.geomReduce=iz;mr.lineEach=oS;mr.lineReduce=az;mr.propEach=nS;mr.propReduce=ez;mr.segmentEach=iS;mr.segmentReduce=sz});var sS=nt(Ig=>{"use strict";Object.defineProperty(Ig,"__esModule",{value:!0});var cz=Cg();function Pg(r){var t=[1/0,1/0,-1/0,-1/0];return cz.coordEach(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Pg.default=Pg;Ig.default=Pg});var hh=nt((qX,Rg)=>{var Lo=ng(),uS=Tg(),lS=Cg(),Fu=sS().default,fz=lS.featureEach,GX=lS.coordEach,kX=uS.polygon,aS=uS.featureCollection;function cS(r){var t=new Lo(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Fu(e),Lo.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:Fu(a),o.push(a)}):fz(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:Fu(a),o.push(a)}),Lo.prototype.load.call(this,o)},t.remove=function(e,o){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Fu(e),Lo.prototype.remove.call(this,e,o)},t.clear=function(){return Lo.prototype.clear.call(this)},t.search=function(e){var o=Lo.prototype.search.call(this,this.toBBox(e));return aS(o)},t.collides=function(e){return Lo.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=Lo.prototype.all.call(this);return aS(e)},t.toJSON=function(){return Lo.prototype.toJSON.call(this)},t.fromJSON=function(e){return Lo.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var o;if(e.bbox)o=e.bbox;else if(Array.isArray(e)&&e.length===4)o=e;else if(Array.isArray(e)&&e.length===6)o=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")o=Fu(e);else if(e.type==="FeatureCollection")o=Fu(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Rg.exports=cS;Rg.exports.default=cS});var Ug=nt((K7,xS)=>{"use strict";var _S=Object.prototype.toString;xS.exports=function(t){var e=_S.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&_S.call(t.callee)==="[object Function]"),o}});var PS=nt((j7,CS)=>{"use strict";var AS;Object.keys||($l=Object.prototype.hasOwnProperty,Bg=Object.prototype.toString,ES=Ug(),zg=Object.prototype.propertyIsEnumerable,MS=!zg.call({toString:null},"toString"),SS=zg.call(function(){},"prototype"),Zl=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],yh=function(r){var t=r.constructor;return t&&t.prototype===r},wS={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},bS=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!wS["$"+r]&&$l.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{yh(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),TS=function(r){if(typeof window=="undefined"||!bS)return yh(r);try{return yh(r)}catch(t){return!1}},AS=function(t){var e=t!==null&&typeof t=="object",o=Bg.call(t)==="[object Function]",a=ES(t),l=e&&Bg.call(t)==="[object String]",h=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var f=SS&&o;if(l&&t.length>0&&!$l.call(t,0))for(var p=0;p<t.length;++p)h.push(String(p));if(a&&t.length>0)for(var d=0;d<t.length;++d)h.push(String(d));else for(var g in t)!(f&&g==="prototype")&&$l.call(t,g)&&h.push(String(g));if(MS)for(var x=TS(t),v=0;v<Zl.length;++v)!(x&&Zl[v]==="constructor")&&$l.call(t,Zl[v])&&h.push(Zl[v]);return h});var $l,Bg,ES,zg,MS,SS,Zl,yh,wS,bS,TS;CS.exports=AS});var Gg=nt((Q7,LS)=>{"use strict";var Ez=Array.prototype.slice,Mz=Ug(),IS=Object.keys,vh=IS?function(t){return IS(t)}:PS(),RS=Object.keys;vh.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(o){return Mz(o)?RS(Ez.call(o)):RS(o)})}else Object.keys=vh;return Object.keys||vh};LS.exports=vh});var kg=nt((tY,NS)=>{"use strict";NS.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(var l in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var h=Object.getOwnPropertySymbols(t);if(h.length!==1||h[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(t,e);if(f.value!==a||f.enumerable!==!0)return!1}return!0}});var _h=nt((eY,OS)=>{"use strict";var Sz=kg();OS.exports=function(){return Sz()&&!!Symbol.toStringTag}});var qg=nt((nY,DS)=>{"use strict";DS.exports=Object});var Vg=nt((rY,FS)=>{"use strict";FS.exports=Error});var BS=nt((iY,US)=>{"use strict";US.exports=EvalError});var GS=nt((oY,zS)=>{"use strict";zS.exports=RangeError});var qS=nt((sY,kS)=>{"use strict";kS.exports=ReferenceError});var Hg=nt((aY,VS)=>{"use strict";VS.exports=SyntaxError});var ba=nt((uY,HS)=>{"use strict";HS.exports=TypeError});var XS=nt((lY,WS)=>{"use strict";WS.exports=URIError});var $S=nt((cY,YS)=>{"use strict";YS.exports=Math.abs});var JS=nt((fY,ZS)=>{"use strict";ZS.exports=Math.floor});var jS=nt((hY,KS)=>{"use strict";KS.exports=Math.max});var tw=nt((pY,QS)=>{"use strict";QS.exports=Math.min});var nw=nt((dY,ew)=>{"use strict";ew.exports=Math.pow});var iw=nt((mY,rw)=>{"use strict";rw.exports=Math.round});var sw=nt((gY,ow)=>{"use strict";ow.exports=Number.isNaN||function(t){return t!==t}});var uw=nt((yY,aw)=>{"use strict";var wz=sw();aw.exports=function(t){return wz(t)||t===0?t:t<0?-1:1}});var cw=nt((vY,lw)=>{"use strict";lw.exports=Object.getOwnPropertyDescriptor});var Ta=nt((_Y,fw)=>{"use strict";var xh=cw();if(xh)try{xh([],"length")}catch(r){xh=null}fw.exports=xh});var Jl=nt((xY,hw)=>{"use strict";var Eh=Object.defineProperty||!1;if(Eh)try{Eh({},"a",{value:1})}catch(r){Eh=!1}hw.exports=Eh});var mw=nt((EY,dw)=>{"use strict";var pw=typeof Symbol!="undefined"&&Symbol,bz=kg();dw.exports=function(){return typeof pw!="function"||typeof Symbol!="function"||typeof pw("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:bz()}});var Wg=nt((MY,gw)=>{"use strict";gw.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var Xg=nt((SY,yw)=>{"use strict";var Tz=qg();yw.exports=Tz.getPrototypeOf||null});var xw=nt((wY,_w)=>{"use strict";var Az="Function.prototype.bind called on incompatible ",Cz=Object.prototype.toString,Pz=Math.max,Iz="[object Function]",vw=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var l=0;l<e.length;l+=1)o[l+t.length]=e[l];return o},Rz=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},Lz=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};_w.exports=function(t){var e=this;if(typeof e!="function"||Cz.apply(e)!==Iz)throw new TypeError(Az+e);for(var o=Rz(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,vw(o,arguments));return Object(g)===g?g:this}return e.apply(t,vw(o,arguments))},h=Pz(0,e.length-o.length),f=[],p=0;p<h;p++)f[p]="$"+p;if(a=Function("binder","return function ("+Lz(f,",")+"){ return binder.apply(this,arguments); }")(l),e.prototype){var d=function(){};d.prototype=e.prototype,a.prototype=new d,d.prototype=null}return a}});var Uu=nt((bY,Ew)=>{"use strict";var Nz=xw();Ew.exports=Function.prototype.bind||Nz});var Mh=nt((TY,Mw)=>{"use strict";Mw.exports=Function.prototype.call});var Sh=nt((AY,Sw)=>{"use strict";Sw.exports=Function.prototype.apply});var bw=nt((CY,ww)=>{"use strict";ww.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var Yg=nt((PY,Tw)=>{"use strict";var Oz=Uu(),Dz=Sh(),Fz=Mh(),Uz=bw();Tw.exports=Uz||Oz.call(Fz,Dz)});var wh=nt((IY,Aw)=>{"use strict";var Bz=Uu(),zz=ba(),Gz=Mh(),kz=Yg();Aw.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new zz("a function is required");return kz(Bz,Gz,t)}});var Nw=nt((RY,Lw)=>{"use strict";var qz=wh(),Cw=Ta(),Iw;try{Iw=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var $g=!!Iw&&Cw&&Cw(Object.prototype,"__proto__"),Rw=Object,Pw=Rw.getPrototypeOf;Lw.exports=$g&&typeof $g.get=="function"?qz([$g.get]):typeof Pw=="function"?function(t){return Pw(t==null?t:Rw(t))}:!1});var Zg=nt((LY,Uw)=>{"use strict";var Ow=Wg(),Dw=Xg(),Fw=Nw();Uw.exports=Ow?function(t){return Ow(t)}:Dw?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Dw(t)}:Fw?function(t){return Fw(t)}:null});var Jg=nt((NY,Bw)=>{"use strict";var Vz=Function.prototype.call,Hz=Object.prototype.hasOwnProperty,Wz=Uu();Bw.exports=Wz.call(Vz,Hz)});var Qg=nt((OY,Hw)=>{"use strict";var Ke,Xz=qg(),Yz=Vg(),$z=BS(),Zz=GS(),Jz=qS(),ku=Hg(),Gu=ba(),Kz=XS(),jz=$S(),Qz=JS(),tG=jS(),eG=tw(),nG=nw(),rG=iw(),iG=uw(),qw=Function,Kg=function(r){try{return qw('"use strict"; return ('+r+").constructor;")()}catch(t){}},Kl=Ta(),oG=Jl(),jg=function(){throw new Gu},sG=Kl?function(){try{return arguments.callee,jg}catch(r){try{return Kl(arguments,"callee").get}catch(t){return jg}}}():jg,Bu=mw()(),Rr=Zg(),aG=Xg(),uG=Wg(),Vw=Sh(),jl=Mh(),zu={},lG=typeof Uint8Array=="undefined"||!Rr?Ke:Rr(Uint8Array),Aa={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?Ke:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Ke:ArrayBuffer,"%ArrayIteratorPrototype%":Bu&&Rr?Rr([][Symbol.iterator]()):Ke,"%AsyncFromSyncIteratorPrototype%":Ke,"%AsyncFunction%":zu,"%AsyncGenerator%":zu,"%AsyncGeneratorFunction%":zu,"%AsyncIteratorPrototype%":zu,"%Atomics%":typeof Atomics=="undefined"?Ke:Atomics,"%BigInt%":typeof BigInt=="undefined"?Ke:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Ke:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Ke:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Ke:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Yz,"%eval%":eval,"%EvalError%":$z,"%Float16Array%":typeof Float16Array=="undefined"?Ke:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?Ke:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Ke:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Ke:FinalizationRegistry,"%Function%":qw,"%GeneratorFunction%":zu,"%Int8Array%":typeof Int8Array=="undefined"?Ke:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Ke:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Ke:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Bu&&Rr?Rr(Rr([][Symbol.iterator]())):Ke,"%JSON%":typeof JSON=="object"?JSON:Ke,"%Map%":typeof Map=="undefined"?Ke:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Bu||!Rr?Ke:Rr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Xz,"%Object.getOwnPropertyDescriptor%":Kl,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Ke:Promise,"%Proxy%":typeof Proxy=="undefined"?Ke:Proxy,"%RangeError%":Zz,"%ReferenceError%":Jz,"%Reflect%":typeof Reflect=="undefined"?Ke:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Ke:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Bu||!Rr?Ke:Rr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Ke:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Bu&&Rr?Rr(""[Symbol.iterator]()):Ke,"%Symbol%":Bu?Symbol:Ke,"%SyntaxError%":ku,"%ThrowTypeError%":sG,"%TypedArray%":lG,"%TypeError%":Gu,"%Uint8Array%":typeof Uint8Array=="undefined"?Ke:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Ke:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Ke:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Ke:Uint32Array,"%URIError%":Kz,"%WeakMap%":typeof WeakMap=="undefined"?Ke:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Ke:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Ke:WeakSet,"%Function.prototype.call%":jl,"%Function.prototype.apply%":Vw,"%Object.defineProperty%":oG,"%Object.getPrototypeOf%":aG,"%Math.abs%":jz,"%Math.floor%":Qz,"%Math.max%":tG,"%Math.min%":eG,"%Math.pow%":nG,"%Math.round%":rG,"%Math.sign%":iG,"%Reflect.getPrototypeOf%":uG};if(Rr)try{null.error}catch(r){zw=Rr(Rr(r)),Aa["%Error.prototype%"]=zw}var zw,cG=function r(t){var e;if(t==="%AsyncFunction%")e=Kg("async function () {}");else if(t==="%GeneratorFunction%")e=Kg("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Kg("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&Rr&&(e=Rr(a.prototype))}return Aa[t]=e,e},Gw={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Ql=Uu(),bh=Jg(),fG=Ql.call(jl,Array.prototype.concat),hG=Ql.call(Vw,Array.prototype.splice),kw=Ql.call(jl,String.prototype.replace),Th=Ql.call(jl,String.prototype.slice),pG=Ql.call(jl,RegExp.prototype.exec),dG=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,mG=/\\\\(\\\\)?/g,gG=function(t){var e=Th(t,0,1),o=Th(t,-1);if(e==="%"&&o!=="%")throw new ku("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new ku("invalid intrinsic syntax, expected opening \`%\`");var a=[];return kw(t,dG,function(l,h,f,p){a[a.length]=f?kw(p,mG,"$1"):h||l}),a},yG=function(t,e){var o=t,a;if(bh(Gw,o)&&(a=Gw[o],o="%"+a[0]+"%"),bh(Aa,o)){var l=Aa[o];if(l===zu&&(l=cG(o)),typeof l=="undefined"&&!e)throw new Gu("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new ku("intrinsic "+t+" does not exist!")};Hw.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Gu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Gu('"allowMissing" argument must be a boolean');if(pG(/^%?[^%]*%?$/,t)===null)throw new ku("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=gG(t),a=o.length>0?o[0]:"",l=yG("%"+a+"%",e),h=l.name,f=l.value,p=!1,d=l.alias;d&&(a=d[0],hG(o,fG([0,1],d)));for(var g=1,x=!0;g<o.length;g+=1){var v=o[g],M=Th(v,0,1),b=Th(v,-1);if((M==='"'||M==="'"||M==="\`"||b==='"'||b==="'"||b==="\`")&&M!==b)throw new ku("property names with quotes must have matching quotes");if((v==="constructor"||!x)&&(p=!0),a+="."+v,h="%"+a+"%",bh(Aa,h))f=Aa[h];else if(f!=null){if(!(v in f)){if(!e)throw new Gu("base intrinsic for "+t+" exists, but the property is not available.");return}if(Kl&&g+1>=o.length){var T=Kl(f,v);x=!!T,x&&"get"in T&&!("originalValue"in T.get)?f=T.get:f=f[v]}else x=bh(f,v),f=f[v];x&&!p&&(Aa[h]=f)}}return f}});var Ah=nt((DY,Yw)=>{"use strict";var Ww=Qg(),Xw=wh(),vG=Xw([Ww("%String.prototype.indexOf%")]);Yw.exports=function(t,e){var o=Ww(t,!!e);return typeof o=="function"&&vG(t,".prototype.")>-1?Xw([o]):o}});var Jw=nt((FY,Zw)=>{"use strict";var _G=_h()(),xG=Ah(),t0=xG("Object.prototype.toString"),Ch=function(t){return _G&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:t0(t)==="[object Arguments]"},$w=function(t){return Ch(t)?!0:t!==null&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>=0&&t0(t)!=="[object Array]"&&"callee"in t&&t0(t.callee)==="[object Function]"},EG=function(){return Ch(arguments)}();Ch.isLegacyArguments=$w;Zw.exports=EG?Ch:$w});var Ph=nt((UY,Qw)=>{"use strict";var Kw=Jl(),MG=Hg(),qu=ba(),jw=Ta();Qw.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new qu("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new qu("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new qu("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new qu("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new qu("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new qu("\`loose\`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,p=!!jw&&jw(t,e);if(Kw)Kw(t,e,{configurable:h===null&&p?p.configurable:!h,enumerable:a===null&&p?p.enumerable:!a,value:o,writable:l===null&&p?p.writable:!l});else if(f||!a&&!l&&!h)t[e]=o;else throw new MG("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Ih=nt((BY,eb)=>{"use strict";var e0=Jl(),tb=function(){return!!e0};tb.hasArrayLengthDefineBug=function(){if(!e0)return null;try{return e0([],"length",{value:1}).length!==1}catch(t){return!0}};eb.exports=tb});var Vu=nt((zY,ob)=>{"use strict";var SG=Gg(),wG=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",bG=Object.prototype.toString,TG=Array.prototype.concat,nb=Ph(),AG=function(r){return typeof r=="function"&&bG.call(r)==="[object Function]"},rb=Ih()(),CG=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!AG(o)||!o())return}rb?nb(r,t,e,!0):nb(r,t,e)},ib=function(r,t){var e=arguments.length>2?arguments[2]:{},o=SG(t);wG&&(o=TG.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)CG(r,o[a],t[o[a]],e[o[a]])};ib.supportsDescriptors=!!rb;ob.exports=ib});var cb=nt((GY,lb)=>{"use strict";var PG=Qg(),sb=Ph(),IG=Ih()(),ab=Ta(),ub=ba(),RG=PG("%Math.floor%");lb.exports=function(t,e){if(typeof t!="function")throw new ub("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||RG(e)!==e)throw new ub("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&ab){var h=ab(t,"length");h&&!h.configurable&&(a=!1),h&&!h.writable&&(l=!1)}return(a||l||!o)&&(IG?sb(t,"length",e,!0,!0):sb(t,"length",e)),t}});var hb=nt((kY,fb)=>{"use strict";var LG=Uu(),NG=Sh(),OG=Yg();fb.exports=function(){return OG(LG,NG,arguments)}});var n0=nt((qY,Rh)=>{"use strict";var DG=cb(),pb=Jl(),FG=wh(),db=hb();Rh.exports=function(t){var e=FG(arguments),o=t.length-(arguments.length-1);return DG(e,1+(o>0?o:0),!0)};pb?pb(Rh.exports,"apply",{value:db}):Rh.exports.apply=db});var r0=nt((VY,gb)=>{"use strict";var mb=function(r){return r!==r};gb.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||mb(t)&&mb(e))}});var i0=nt((HY,yb)=>{"use strict";var UG=r0();yb.exports=function(){return typeof Object.is=="function"?Object.is:UG}});var _b=nt((WY,vb)=>{"use strict";var BG=i0(),zG=Vu();vb.exports=function(){var t=BG();return zG(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Sb=nt((XY,Mb)=>{"use strict";var GG=Vu(),kG=n0(),qG=r0(),xb=i0(),VG=_b(),Eb=kG(xb(),Object);GG(Eb,{getPolyfill:xb,implementation:qG,shim:VG});Mb.exports=Eb});var Pb=nt((YY,Cb)=>{"use strict";var wb=Ah(),HG=_h()(),WG=Jg(),XG=Ta(),a0;HG?(bb=wb("RegExp.prototype.exec"),o0={},Lh=function(){throw o0},s0={toString:Lh,valueOf:Lh},typeof Symbol.toPrimitive=="symbol"&&(s0[Symbol.toPrimitive]=Lh),a0=function(t){if(!t||typeof t!="object")return!1;var e=XG(t,"lastIndex"),o=e&&WG(e,"value");if(!o)return!1;try{bb(t,s0)}catch(a){return a===o0}}):(Tb=wb("Object.prototype.toString"),Ab="[object RegExp]",a0=function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:Tb(t)===Ab});var bb,o0,Lh,s0,Tb,Ab;Cb.exports=a0});var Rb=nt(($Y,Ib)=>{"use strict";var ec=function(){return typeof function(){}.name=="string"},tc=Object.getOwnPropertyDescriptor;if(tc)try{tc([],"length")}catch(r){tc=null}ec.functionsHaveConfigurableNames=function(){if(!ec()||!tc)return!1;var t=tc(function(){},"name");return!!t&&!!t.configurable};var YG=Function.prototype.bind;ec.boundFunctionsHaveNames=function(){return ec()&&typeof YG=="function"&&function(){}.bind().name!==""};Ib.exports=ec});var Ob=nt((ZY,Nb)=>{"use strict";var Lb=Ph(),$G=Ih()(),ZG=Rb().functionsHaveConfigurableNames(),JG=ba();Nb.exports=function(t,e){if(typeof t!="function")throw new JG("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||ZG)&&($G?Lb(t,"name",e,!0,!0):Lb(t,"name",e)),t}});var u0=nt((JY,Db)=>{"use strict";var KG=Ob(),jG=ba(),QG=Object;Db.exports=KG(function(){if(this==null||this!==QG(this))throw new jG("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0)});var l0=nt((KY,Fb)=>{"use strict";var tk=u0(),ek=Vu().supportsDescriptors,nk=Object.getOwnPropertyDescriptor;Fb.exports=function(){if(ek&&/a/mig.flags==="gim"){var t=nk(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),t.get.call(o),e==="dy")return t.get}}return tk}});var zb=nt((jY,Bb)=>{"use strict";var rk=Vu().supportsDescriptors,ik=l0(),ok=Ta(),sk=Object.defineProperty,ak=Vg(),Ub=Zg(),uk=/a/;Bb.exports=function(){if(!rk||!Ub)throw new ak("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=ik(),e=Ub(uk),o=ok(e,"flags");return(!o||o.get!==t)&&sk(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Vb=nt((QY,qb)=>{"use strict";var lk=Vu(),ck=n0(),fk=u0(),Gb=l0(),hk=zb(),kb=ck(Gb());lk(kb,{getPolyfill:Gb,implementation:fk,shim:hk});qb.exports=kb});var Xb=nt((t$,Wb)=>{"use strict";var Hb=Ah(),pk=Hb("Date.prototype.getDay"),dk=function(t){try{return pk(t),!0}catch(e){return!1}},mk=Hb("Object.prototype.toString"),gk="[object Date]",yk=_h()();Wb.exports=function(t){return typeof t!="object"||t===null?!1:yk?dk(t):mk(t)===gk}});var c0=nt((e$,rT)=>{var Yb=Gg(),$b=Jw(),Zb=Sb(),Jb=Pb(),Kb=Vb(),jb=Xb(),Qb=Date.prototype.getTime;function nT(r,t,e){var o=e||{};return(o.strict?Zb(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?Zb(r,t):r==t:vk(r,t,o)}function tT(r){return r==null}function eT(r){return!(!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number")}function vk(r,t,e){var o,a;if(typeof r!=typeof t||tT(r)||tT(t)||r.prototype!==t.prototype||$b(r)!==$b(t))return!1;var l=Jb(r),h=Jb(t);if(l!==h)return!1;if(l||h)return r.source===t.source&&Kb(r)===Kb(t);if(jb(r)&&jb(t))return Qb.call(r)===Qb.call(t);var f=eT(r),p=eT(t);if(f!==p)return!1;if(f||p){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var d=Yb(r),g=Yb(t)}catch(x){return!1}if(d.length!==g.length)return!1;for(d.sort(),g.sort(),o=d.length-1;o>=0;o--)if(d[o]!=g[o])return!1;for(o=d.length-1;o>=0;o--)if(a=d[o],!nT(r[a],t[a],e))return!1;return!0}rT.exports=nT});var M0=nt((aJ,cT)=>{var u4=c0(),No=function(r){this.precision=r&&r.precision?r.precision:17,this.direction=r&&r.direction?r.direction:!1,this.pseudoNode=r&&r.pseudoNode?r.pseudoNode:!1,this.objectComparator=r&&r.objectComparator?r.objectComparator:l4};No.prototype.compare=function(r,t){if(r.type!==t.type||!lT(r,t))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,t.coordinates);case"LineString":return this.compareLine(r.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(r,t);case"Feature":return this.compareFeature(r,t);default:if(r.type.indexOf("Multi")===0){var e=this,o=uT(r),a=uT(t);return o.every(function(l){return this.some(function(h){return e.compare(l,h)})},a)}}return!1};function uT(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function lT(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}No.prototype.compareCoord=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e++)if(r[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};No.prototype.compareLine=function(r,t,e,o){if(!lT(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),l=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],l[0])&&(l=this.fixStartIndex(l,a),!l))){var h=this.compareCoord(a[e],l[e]);return this.direction||h?this.comparePath(a,l):this.compareCoord(a[e],l[l.length-(1+e)])?this.comparePath(a.slice().reverse(),l):!1}};No.prototype.fixStartIndex=function(r,t){for(var e,o=-1,a=0;a<r.length;a++)if(this.compareCoord(r[a],t[0])){o=a;break}return o>=0&&(e=[].concat(r.slice(o,r.length),r.slice(1,o+1))),e};No.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};No.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(l){return this.some(function(h){return a.compareLine(l,h,1,!0)})},o)}else return!1};No.prototype.compareFeature=function(r,t){return r.id!==t.id||!this.objectComparator(r.properties,t.properties)||!this.compareBBox(r,t)?!1:this.compare(r.geometry,t.geometry)};No.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};No.prototype.removePseudo=function(r){return r};function l4(r,t){return u4(r,t,{strict:!0})}cT.exports=No});var fT=nt((_J,Dh)=>{function qs(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}qs.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var l=this._regionQuery(a);if(l.length<this.minPts)this.noise.push(a);else{var h=this.clusters.length;this.clusters.push([]),this._addToCluster(a,h),this._expandCluster(h,l)}}return this.clusters};qs.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};qs.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};qs.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};qs.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};qs.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};qs.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof Dh!="undefined"&&Dh.exports&&(Dh.exports=qs)});var hT=nt((xJ,Fh)=>{function Vs(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}Vs.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};Vs.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var l=0;l<this.k;l++){for(var h=new Array(g),f=0,p=0;p<g;p++)h[p]=0;for(var d=0;d<e;d++){var g=this.dataset[d].length;if(l===this.assignments[d]){for(var p=0;p<g;p++)h[p]+=this.dataset[d][p];f++}}if(f>0){for(var p=0;p<g;p++)h[p]/=f;this.centroids[l]=h}else this.centroids[l]=this.randomCentroid(),a=!0}}return this.getClusters()};Vs.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};Vs.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};Vs.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};Vs.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,l=t.length,h,f=0;f<l;f++)h=e(r,t[f]),h<o&&(o=h,a=f);return a};Vs.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof Fh!="undefined"&&Fh.exports&&(Fh.exports=Vs)});var S0=nt((EJ,Uh)=>{function Oo(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}Oo.prototype.insert=function(r,t){for(var e=this._queue.length,o=e;o--;){var a=this._priorities[o];this._sorting==="desc"?t>a&&(e=o):t<a&&(e=o)}this._insertAt(r,t,e)};Oo.prototype.remove=function(r){for(var t=this._queue.length;t--;){var e=this._queue[t];if(r===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};Oo.prototype.forEach=function(r){this._queue.forEach(r)};Oo.prototype.getElements=function(){return this._queue};Oo.prototype.getElementPriority=function(r){return this._priorities[r]};Oo.prototype.getPriorities=function(){return this._priorities};Oo.prototype.getElementsWithPriorities=function(){for(var r=[],t=0,e=this._queue.length;t<e;t++)r.push([this._queue[t],this._priorities[t]]);return r};Oo.prototype._init=function(r,t,e){if(r&&t){if(this._queue=[],this._priorities=[],r.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<r.length;o++)this.insert(r[o],t[o])}e&&(this._sorting=e)};Oo.prototype._insertAt=function(r,t,e){this._queue.length===e?(this._queue.push(r),this._priorities.push(t)):(this._queue.splice(e,0,r),this._priorities.splice(e,0,t))};typeof Uh!="undefined"&&Uh.exports&&(Uh.exports=Oo)});var dT=nt((MJ,Wu)=>{typeof Wu!="undefined"&&Wu.exports&&(pT=S0());var pT;function ls(r,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,t,e,o)}ls.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,l=this.dataset.length;a<l;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var h=this.clusters.length-1;this._orderedList.push(a);var f=new pT(null,null,"asc"),p=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,p,f),this._expandCluster(h,f))}return this.clusters};ls.prototype.getReachabilityPlot=function(){for(var r=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],a=this._reachability[o];r.push([o,a])}return r};ls.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};ls.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var l=o.distance(o.dataset[r],o.dataset[a]),h=Math.max(o._coreDistance,l);o._reachability[a]===void 0?(o._reachability[a]=h,e.insert(a,h)):h<o._reachability[a]&&(o._reachability[a]=h,e.remove(a),e.insert(a,h))}})};ls.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var l=e[o];if(this._processed[l]===void 0){var h=this._regionQuery(l);this._processed[l]=1,this.clusters[r].push(l),this._orderedList.push(l),this._distanceToCore(l)!==void 0&&(this._updateQueue(l,h,t),this._expandCluster(r,t))}}};ls.prototype._distanceToCore=function(r){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(r,e);if(o.length>=this.minPts)return e}};ls.prototype._regionQuery=function(r,t){t=t||this.epsilon;for(var e=[],o=0,a=this.dataset.length;o<a;o++)this.distance(this.dataset[r],this.dataset[o])<t&&e.push(o);return e};ls.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof Wu!="undefined"&&Wu.exports&&(Wu.exports=ls)});var mT=nt((SJ,Bh)=>{typeof Bh!="undefined"&&Bh.exports&&(Bh.exports={DBSCAN:fT(),KMEANS:hT(),OPTICS:dT(),PriorityQueue:S0()})});var w0=nt((PJ,yT)=>{"use strict";yT.exports={eudist:function(t,e,o){for(var a=t.length,l=0,h=0;h<a;h++){var f=(t[h]||0)-(e[h]||0);l+=f*f}return o?Math.sqrt(l):l},mandist:function(t,e,o){for(var a=t.length,l=0,h=0;h<a;h++)l+=Math.abs((t[h]||0)-(e[h]||0));return o?Math.sqrt(l):l},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var xT=nt((IJ,_T)=>{"use strict";var vT=w0(),m4=vT.eudist,g4=vT.dist;_T.exports={kmrand:function(t,e){for(var o={},a=[],l=e<<2,h=t.length,f=t[0].length>0;a.length<e&&l-- >0;){var p=t[Math.floor(Math.random()*h)],d=f?p.join("_"):""+p;o[d]||(o[d]=!0,a.push(p))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?m4:g4,a=[],l=t.length,h=t[0].length>0,f={},p=t[Math.floor(Math.random()*l)],d=h?p.join("_"):""+p;for(a.push(p),f[d]=!0;a.length<e;){for(var g=[],x=a.length,v=0,M=[],b=0;b<l;b++){for(var T=1/0,_=0;_<x;_++){var y=o(t[b],a[_]);y<=T&&(T=y)}g[b]=T}for(var A=0;A<l;A++)v+=g[A];for(var S=0;S<l;S++)M[S]={i:S,v:t[S],pr:g[S]/v,cs:0};M.sort(function(F,I){return F.pr-I.pr}),M[0].cs=M[0].pr;for(var L=1;L<l;L++)M[L].cs=M[L-1].cs+M[L].pr;for(var G=Math.random(),z=0;z<l-1&&M[z++].cs<G;);a.push(M[z-1].v)}return a}}});var bT=nt((NJ,wT)=>{"use strict";var b0=w0(),ST=xT(),y4=b0.eudist,RJ=b0.mandist,LJ=b0.dist,v4=ST.kmrand,_4=ST.kmpp,ET=1e4;function MT(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function x4(r,t,e,o){var a=[],l=[],h=[],f=[],p=!1,d=o||ET,g=r.length,x=r[0].length,v=x>0,M=[];if(e)e=="kmrand"?a=v4(r,t):e=="kmpp"?a=_4(r,t):a=e;else for(var b={};a.length<t;){var T=Math.floor(Math.random()*g);b[T]||(b[T]=!0,a.push(r[T]))}do{MT(t,0,M);for(var _=0;_<g;_++){for(var y=1/0,A=0,S=0;S<t;S++){var f=v?y4(r[_],a[S]):Math.abs(r[_]-a[S]);f<=y&&(y=f,A=S)}h[_]=A,M[A]++}for(var L=[],l=[],G=0,z=0;z<t;z++)L[z]=v?MT(x,0,L[z]):0,l[z]=a[z];if(v){for(var F=0;F<t;F++)a[F]=[];for(var I=0;I<g;I++)for(var ut=h[I],R=L[ut],W=r[I],V=0;V<x;V++)R[V]+=W[V];p=!0;for(var Mt=0;Mt<t;Mt++){for(var X=a[Mt],mt=L[Mt],dt=l[Mt],_t=M[Mt],it=0;it<x;it++)X[it]=mt[it]/_t||0;if(p){for(var lt=0;lt<x;lt++)if(dt[lt]!=X[lt]){p=!1;break}}}}else{for(var H=0;H<g;H++){var bt=h[H];L[bt]+=r[H]}for(var Tt=0;Tt<t;Tt++)a[Tt]=L[Tt]/M[Tt]||0;p=!0;for(var Yt=0;Yt<t;Yt++)if(l[Yt]!=a[Yt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:ET-d,k:t,idxs:h,centroids:a}}wT.exports=x4});var Ju=nt((R0,L0)=>{(function(r,t){typeof R0=="object"&&typeof L0!="undefined"?L0.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(R0,function(){"use strict";function r(J,w){var P={label:0,sent:function(){if(B[0]&1)throw B[1];return B[1]},trys:[],ops:[]},D,k,B,et;return et={next:j(0),throw:j(1),return:j(2)},typeof Symbol=="function"&&(et[Symbol.iterator]=function(){return this}),et;function j(ct){return function(O){return ft([ct,O])}}function ft(ct){if(D)throw new TypeError("Generator is already executing.");for(;P;)try{if(D=1,k&&(B=ct[0]&2?k.return:ct[0]?k.throw||((B=k.return)&&B.call(k),0):k.next)&&!(B=B.call(k,ct[1])).done)return B;switch(k=0,B&&(ct=[ct[0]&2,B.value]),ct[0]){case 0:case 1:B=ct;break;case 4:return P.label++,{value:ct[1],done:!1};case 5:P.label++,k=ct[1],ct=[0];continue;case 7:ct=P.ops.pop(),P.trys.pop();continue;default:if(B=P.trys,!(B=B.length>0&&B[B.length-1])&&(ct[0]===6||ct[0]===2)){P=0;continue}if(ct[0]===3&&(!B||ct[1]>B[0]&&ct[1]<B[3])){P.label=ct[1];break}if(ct[0]===6&&P.label<B[1]){P.label=B[1],B=ct;break}if(B&&P.label<B[2]){P.label=B[2],P.ops.push(ct);break}B[2]&&P.ops.pop(),P.trys.pop();continue}ct=w.call(J,P)}catch(O){ct=[6,O],k=0}finally{D=B=0}if(ct[0]&5)throw ct[1];return{value:ct[0]?ct[1]:void 0,done:!0}}}var t=function(){function J(w,P){this.next=null,this.key=w,this.data=P,this.left=null,this.right=null}return J}();function e(J,w){return J>w?1:J<w?-1:0}function o(J,w,P){for(var D=new t(null,null),k=D,B=D;;){var et=P(J,w.key);if(et<0){if(w.left===null)break;if(P(J,w.left.key)<0){var j=w.left;if(w.left=j.right,j.right=w,w=j,w.left===null)break}B.left=w,B=w,w=w.left}else if(et>0){if(w.right===null)break;if(P(J,w.right.key)>0){var j=w.right;if(w.right=j.left,j.left=w,w=j,w.right===null)break}k.right=w,k=w,w=w.right}else break}return k.right=w.left,B.left=w.right,w.left=D.right,w.right=D.left,w}function a(J,w,P,D){var k=new t(J,w);if(P===null)return k.left=k.right=null,k;P=o(J,P,D);var B=D(J,P.key);return B<0?(k.left=P.left,k.right=P,P.left=null):B>=0&&(k.right=P.right,k.left=P,P.right=null),k}function l(J,w,P){var D=null,k=null;if(w){w=o(J,w,P);var B=P(w.key,J);B===0?(D=w.left,k=w.right):B<0?(k=w.right,w.right=null,D=w):(D=w.left,w.left=null,k=w)}return{left:D,right:k}}function h(J,w,P){return w===null?J:(J===null||(w=o(J.key,w,P),w.left=J),w)}function f(J,w,P,D,k){if(J){D(""+w+(P?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+k(J)+\`
@@ -27662,5 +27662,5 @@ void main() {
27662
27662
  }
27663
27663
 
27664
27664
  }\`,dv=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,o){if(this.texture===null){let s=new Us,l=t.properties.get(s);l.__webglTexture=e.texture,(e.depthNear!=o.depthNear||e.depthFar!=o.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}render(t,e){if(this.texture!==null){if(this.mesh===null){let o=e.cameras[0].viewport,s=new Ia({extensions:{fragDepth:!0},vertexShader:sX,fragmentShader:aX,uniforms:{depthColor:{value:this.texture},depthWidth:{value:o.z},depthHeight:{value:o.w}}});this.mesh=new ra(new zd(20,20),s)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},gv=class extends Ku{constructor(t,e){super();let o=this,s=null,l=1,p=null,h="local-floor",g=1,m=null,v=null,x=null,E=null,b=null,T=null,I=new dv,S=e.getContextAttributes(),w=null,R=null,C=[],F=[],W=new Ye,X=null,q=new gs;q.layers.enable(1),q.viewport=new ji;let D=new gs;D.layers.enable(2),D.viewport=new ji;let xt=[q,D],B=new pv;B.layers.enable(1),B.layers.enable(2);let j=null,J=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ut){let Ut=C[ut];return Ut===void 0&&(Ut=new sh,C[ut]=Ut),Ut.getTargetRaySpace()},this.getControllerGrip=function(ut){let Ut=C[ut];return Ut===void 0&&(Ut=new sh,C[ut]=Ut),Ut.getGripSpace()},this.getHand=function(ut){let Ut=C[ut];return Ut===void 0&&(Ut=new sh,C[ut]=Ut),Ut.getHandSpace()};function Dt(ut){let Ut=F.indexOf(ut.inputSource);if(Ut===-1)return;let jt=C[Ut];jt!==void 0&&(jt.update(ut.inputSource,ut.frame,m||p),jt.dispatchEvent({type:ut.type,data:ut.inputSource}))}function Q(){s.removeEventListener("select",Dt),s.removeEventListener("selectstart",Dt),s.removeEventListener("selectend",Dt),s.removeEventListener("squeeze",Dt),s.removeEventListener("squeezestart",Dt),s.removeEventListener("squeezeend",Dt),s.removeEventListener("end",Q),s.removeEventListener("inputsourceschange",At);for(let ut=0;ut<C.length;ut++){let Ut=F[ut];Ut!==null&&(F[ut]=null,C[ut].disconnect(Ut))}j=null,J=null,I.reset(),t.setRenderTarget(w),b=null,E=null,x=null,s=null,R=null,ae.stop(),o.isPresenting=!1,t.setPixelRatio(X),t.setSize(W.width,W.height,!1),o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ut){l=ut,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ut){h=ut,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return m||p},this.setReferenceSpace=function(ut){m=ut},this.getBaseLayer=function(){return E!==null?E:b},this.getBinding=function(){return x},this.getFrame=function(){return T},this.getSession=function(){return s},this.setSession=function(ut){return ac(this,null,function*(){if(s=ut,s!==null){if(w=t.getRenderTarget(),s.addEventListener("select",Dt),s.addEventListener("selectstart",Dt),s.addEventListener("selectend",Dt),s.addEventListener("squeeze",Dt),s.addEventListener("squeezestart",Dt),s.addEventListener("squeezeend",Dt),s.addEventListener("end",Q),s.addEventListener("inputsourceschange",At),S.xrCompatible!==!0&&(yield e.makeXRCompatible()),X=t.getPixelRatio(),t.getSize(W),s.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let Ut={antialias:s.renderState.layers===void 0?S.antialias:!0,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:l};b=new XRWebGLLayer(s,e,Ut),s.updateRenderState({baseLayer:b}),t.setPixelRatio(1),t.setSize(b.framebufferWidth,b.framebufferHeight,!1),R=new du(b.framebufferWidth,b.framebufferHeight,{format:na,type:$u,colorSpace:t.outputColorSpace,stencilBuffer:S.stencil})}else{let Ut=null,jt=null,ce=null;S.depth&&(ce=S.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,Ut=S.stencil?Wc:Dl,jt=S.stencil?Ol:Wu);let te={colorFormat:e.RGBA8,depthFormat:ce,scaleFactor:l};x=new XRWebGLBinding(s,e),E=x.createProjectionLayer(te),s.updateRenderState({layers:[E]}),t.setPixelRatio(1),t.setSize(E.textureWidth,E.textureHeight,!1),R=new du(E.textureWidth,E.textureHeight,{format:na,type:$u,depthTexture:new kd(E.textureWidth,E.textureHeight,jt,void 0,void 0,void 0,void 0,void 0,void 0,Ut),stencilBuffer:S.stencil,colorSpace:t.outputColorSpace,samples:S.antialias?4:0});let $t=t.properties.get(R);$t.__ignoreDepthValues=E.ignoreDepthValues}R.isXRRenderTarget=!0,this.setFoveation(g),m=null,p=yield s.requestReferenceSpace(h),ae.setContext(s),ae.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode};function At(ut){for(let Ut=0;Ut<ut.removed.length;Ut++){let jt=ut.removed[Ut],ce=F.indexOf(jt);ce>=0&&(F[ce]=null,C[ce].disconnect(jt))}for(let Ut=0;Ut<ut.added.length;Ut++){let jt=ut.added[Ut],ce=F.indexOf(jt);if(ce===-1){for(let $t=0;$t<C.length;$t++)if($t>=F.length){F.push(jt),ce=$t;break}else if(F[$t]===null){F[$t]=jt,ce=$t;break}if(ce===-1)break}let te=C[ce];te&&te.connect(jt)}}let Mt=new Rt,Lt=new Rt;function pt(ut,Ut,jt){Mt.setFromMatrixPosition(Ut.matrixWorld),Lt.setFromMatrixPosition(jt.matrixWorld);let ce=Mt.distanceTo(Lt),te=Ut.projectionMatrix.elements,$t=jt.projectionMatrix.elements,qt=te[14]/(te[10]-1),xe=te[14]/(te[10]+1),ft=(te[9]+1)/te[5],We=(te[9]-1)/te[5],ee=(te[8]-1)/te[0],ge=($t[8]+1)/$t[0],fe=qt*ee,Te=qt*ge,be=ce/(-ee+ge),Wt=be*-ee;Ut.matrixWorld.decompose(ut.position,ut.quaternion,ut.scale),ut.translateX(Wt),ut.translateZ(be),ut.matrixWorld.compose(ut.position,ut.quaternion,ut.scale),ut.matrixWorldInverse.copy(ut.matrixWorld).invert();let Me=qt+be,tt=xe+be,z=fe-Wt,Pt=Te+(ce-Wt),Ot=ft*xe/tt*Me,dt=We*xe/tt*Me;ut.projectionMatrix.makePerspective(z,Pt,Ot,dt,Me,tt),ut.projectionMatrixInverse.copy(ut.projectionMatrix).invert()}function yt(ut,Ut){Ut===null?ut.matrixWorld.copy(ut.matrix):ut.matrixWorld.multiplyMatrices(Ut.matrixWorld,ut.matrix),ut.matrixWorldInverse.copy(ut.matrixWorld).invert()}this.updateCamera=function(ut){if(s===null)return;I.texture!==null&&(ut.near=I.depthNear,ut.far=I.depthFar),B.near=D.near=q.near=ut.near,B.far=D.far=q.far=ut.far,(j!==B.near||J!==B.far)&&(s.updateRenderState({depthNear:B.near,depthFar:B.far}),j=B.near,J=B.far,q.near=j,q.far=J,D.near=j,D.far=J,q.updateProjectionMatrix(),D.updateProjectionMatrix(),ut.updateProjectionMatrix());let Ut=ut.parent,jt=B.cameras;yt(B,Ut);for(let ce=0;ce<jt.length;ce++)yt(jt[ce],Ut);jt.length===2?pt(B,q,D):B.projectionMatrix.copy(q.projectionMatrix),K(ut,B,Ut)};function K(ut,Ut,jt){jt===null?ut.matrix.copy(Ut.matrixWorld):(ut.matrix.copy(jt.matrixWorld),ut.matrix.invert(),ut.matrix.multiply(Ut.matrixWorld)),ut.matrix.decompose(ut.position,ut.quaternion,ut.scale),ut.updateMatrixWorld(!0),ut.projectionMatrix.copy(Ut.projectionMatrix),ut.projectionMatrixInverse.copy(Ut.projectionMatrixInverse),ut.isPerspectiveCamera&&(ut.fov=Ky*2*Math.atan(1/ut.projectionMatrix.elements[5]),ut.zoom=1)}this.getCamera=function(){return B},this.getFoveation=function(){if(!(E===null&&b===null))return g},this.setFoveation=function(ut){g=ut,E!==null&&(E.fixedFoveation=ut),b!==null&&b.fixedFoveation!==void 0&&(b.fixedFoveation=ut)},this.hasDepthSensing=function(){return I.texture!==null};let Bt=null;function Gt(ut,Ut){if(v=Ut.getViewerPose(m||p),T=Ut,v!==null){let jt=v.views;b!==null&&(t.setRenderTargetFramebuffer(R,b.framebuffer),t.setRenderTarget(R));let ce=!1;jt.length!==B.cameras.length&&(B.cameras.length=0,ce=!0);for(let $t=0;$t<jt.length;$t++){let qt=jt[$t],xe=null;if(b!==null)xe=b.getViewport(qt);else{let We=x.getViewSubImage(E,qt);xe=We.viewport,$t===0&&(t.setRenderTargetTextures(R,We.colorTexture,E.ignoreDepthValues?void 0:We.depthStencilTexture),t.setRenderTarget(R))}let ft=xt[$t];ft===void 0&&(ft=new gs,ft.layers.enable($t),ft.viewport=new ji,xt[$t]=ft),ft.matrix.fromArray(qt.transform.matrix),ft.matrix.decompose(ft.position,ft.quaternion,ft.scale),ft.projectionMatrix.fromArray(qt.projectionMatrix),ft.projectionMatrixInverse.copy(ft.projectionMatrix).invert(),ft.viewport.set(xe.x,xe.y,xe.width,xe.height),$t===0&&(B.matrix.copy(ft.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),ce===!0&&B.cameras.push(ft)}let te=s.enabledFeatures;if(te&&te.includes("depth-sensing")){let $t=x.getDepthInformation(jt[0]);$t&&$t.isValid&&$t.texture&&I.init(t,$t,s.renderState)}}for(let jt=0;jt<C.length;jt++){let ce=F[jt],te=C[jt];ce!==null&&te!==void 0&&te.update(ce,Ut,m||p)}I.render(t,B),Bt&&Bt(ut,Ut),Ut.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:Ut}),T=null}let ae=new xC;ae.setAnimationLoop(Gt),this.setAnimationLoop=function(ut){Bt=ut},this.dispose=function(){}}},Cl=new Ul,uX=new vi;function lX(n,t){function e(S,w){S.matrixAutoUpdate===!0&&S.updateMatrix(),w.value.copy(S.matrix)}function o(S,w){w.color.getRGB(S.fogColor.value,_C(n)),w.isFog?(S.fogNear.value=w.near,S.fogFar.value=w.far):w.isFogExp2&&(S.fogDensity.value=w.density)}function s(S,w,R,C,F){w.isMeshBasicMaterial||w.isMeshLambertMaterial?l(S,w):w.isMeshToonMaterial?(l(S,w),x(S,w)):w.isMeshPhongMaterial?(l(S,w),v(S,w)):w.isMeshStandardMaterial?(l(S,w),E(S,w),w.isMeshPhysicalMaterial&&b(S,w,F)):w.isMeshMatcapMaterial?(l(S,w),T(S,w)):w.isMeshDepthMaterial?l(S,w):w.isMeshDistanceMaterial?(l(S,w),I(S,w)):w.isMeshNormalMaterial?l(S,w):w.isLineBasicMaterial?(p(S,w),w.isLineDashedMaterial&&h(S,w)):w.isPointsMaterial?g(S,w,R,C):w.isSpriteMaterial?m(S,w):w.isShadowMaterial?(S.color.value.copy(w.color),S.opacity.value=w.opacity):w.isShaderMaterial&&(w.uniformsNeedUpdate=!1)}function l(S,w){S.opacity.value=w.opacity,w.color&&S.diffuse.value.copy(w.color),w.emissive&&S.emissive.value.copy(w.emissive).multiplyScalar(w.emissiveIntensity),w.map&&(S.map.value=w.map,e(w.map,S.mapTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,e(w.alphaMap,S.alphaMapTransform)),w.bumpMap&&(S.bumpMap.value=w.bumpMap,e(w.bumpMap,S.bumpMapTransform),S.bumpScale.value=w.bumpScale,w.side===$o&&(S.bumpScale.value*=-1)),w.normalMap&&(S.normalMap.value=w.normalMap,e(w.normalMap,S.normalMapTransform),S.normalScale.value.copy(w.normalScale),w.side===$o&&S.normalScale.value.negate()),w.displacementMap&&(S.displacementMap.value=w.displacementMap,e(w.displacementMap,S.displacementMapTransform),S.displacementScale.value=w.displacementScale,S.displacementBias.value=w.displacementBias),w.emissiveMap&&(S.emissiveMap.value=w.emissiveMap,e(w.emissiveMap,S.emissiveMapTransform)),w.specularMap&&(S.specularMap.value=w.specularMap,e(w.specularMap,S.specularMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest);let R=t.get(w),C=R.envMap,F=R.envMapRotation;if(C&&(S.envMap.value=C,Cl.copy(F),Cl.x*=-1,Cl.y*=-1,Cl.z*=-1,C.isCubeTexture&&C.isRenderTargetTexture===!1&&(Cl.y*=-1,Cl.z*=-1),S.envMapRotation.value.setFromMatrix4(uX.makeRotationFromEuler(Cl)),S.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=w.reflectivity,S.ior.value=w.ior,S.refractionRatio.value=w.refractionRatio),w.lightMap){S.lightMap.value=w.lightMap;let W=n._useLegacyLights===!0?Math.PI:1;S.lightMapIntensity.value=w.lightMapIntensity*W,e(w.lightMap,S.lightMapTransform)}w.aoMap&&(S.aoMap.value=w.aoMap,S.aoMapIntensity.value=w.aoMapIntensity,e(w.aoMap,S.aoMapTransform))}function p(S,w){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,w.map&&(S.map.value=w.map,e(w.map,S.mapTransform))}function h(S,w){S.dashSize.value=w.dashSize,S.totalSize.value=w.dashSize+w.gapSize,S.scale.value=w.scale}function g(S,w,R,C){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,S.size.value=w.size*R,S.scale.value=C*.5,w.map&&(S.map.value=w.map,e(w.map,S.uvTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,e(w.alphaMap,S.alphaMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest)}function m(S,w){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,S.rotation.value=w.rotation,w.map&&(S.map.value=w.map,e(w.map,S.mapTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,e(w.alphaMap,S.alphaMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest)}function v(S,w){S.specular.value.copy(w.specular),S.shininess.value=Math.max(w.shininess,1e-4)}function x(S,w){w.gradientMap&&(S.gradientMap.value=w.gradientMap)}function E(S,w){S.metalness.value=w.metalness,w.metalnessMap&&(S.metalnessMap.value=w.metalnessMap,e(w.metalnessMap,S.metalnessMapTransform)),S.roughness.value=w.roughness,w.roughnessMap&&(S.roughnessMap.value=w.roughnessMap,e(w.roughnessMap,S.roughnessMapTransform)),t.get(w).envMap&&(S.envMapIntensity.value=w.envMapIntensity)}function b(S,w,R){S.ior.value=w.ior,w.sheen>0&&(S.sheenColor.value.copy(w.sheenColor).multiplyScalar(w.sheen),S.sheenRoughness.value=w.sheenRoughness,w.sheenColorMap&&(S.sheenColorMap.value=w.sheenColorMap,e(w.sheenColorMap,S.sheenColorMapTransform)),w.sheenRoughnessMap&&(S.sheenRoughnessMap.value=w.sheenRoughnessMap,e(w.sheenRoughnessMap,S.sheenRoughnessMapTransform))),w.clearcoat>0&&(S.clearcoat.value=w.clearcoat,S.clearcoatRoughness.value=w.clearcoatRoughness,w.clearcoatMap&&(S.clearcoatMap.value=w.clearcoatMap,e(w.clearcoatMap,S.clearcoatMapTransform)),w.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=w.clearcoatRoughnessMap,e(w.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),w.clearcoatNormalMap&&(S.clearcoatNormalMap.value=w.clearcoatNormalMap,e(w.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(w.clearcoatNormalScale),w.side===$o&&S.clearcoatNormalScale.value.negate())),w.iridescence>0&&(S.iridescence.value=w.iridescence,S.iridescenceIOR.value=w.iridescenceIOR,S.iridescenceThicknessMinimum.value=w.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=w.iridescenceThicknessRange[1],w.iridescenceMap&&(S.iridescenceMap.value=w.iridescenceMap,e(w.iridescenceMap,S.iridescenceMapTransform)),w.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=w.iridescenceThicknessMap,e(w.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),w.transmission>0&&(S.transmission.value=w.transmission,S.transmissionSamplerMap.value=R.texture,S.transmissionSamplerSize.value.set(R.width,R.height),w.transmissionMap&&(S.transmissionMap.value=w.transmissionMap,e(w.transmissionMap,S.transmissionMapTransform)),S.thickness.value=w.thickness,w.thicknessMap&&(S.thicknessMap.value=w.thicknessMap,e(w.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=w.attenuationDistance,S.attenuationColor.value.copy(w.attenuationColor)),w.anisotropy>0&&(S.anisotropyVector.value.set(w.anisotropy*Math.cos(w.anisotropyRotation),w.anisotropy*Math.sin(w.anisotropyRotation)),w.anisotropyMap&&(S.anisotropyMap.value=w.anisotropyMap,e(w.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=w.specularIntensity,S.specularColor.value.copy(w.specularColor),w.specularColorMap&&(S.specularColorMap.value=w.specularColorMap,e(w.specularColorMap,S.specularColorMapTransform)),w.specularIntensityMap&&(S.specularIntensityMap.value=w.specularIntensityMap,e(w.specularIntensityMap,S.specularIntensityMapTransform))}function T(S,w){w.matcap&&(S.matcap.value=w.matcap)}function I(S,w){let R=t.get(w).light;S.referencePosition.value.setFromMatrixPosition(R.matrixWorld),S.nearDistance.value=R.shadow.camera.near,S.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:s}}function cX(n,t,e,o){let s={},l={},p=[],h=e.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function g(R,C){let F=C.program;o.uniformBlockBinding(R,F)}function m(R,C){let F=s[R.id];F===void 0&&(T(R),F=v(R),s[R.id]=F,R.addEventListener("dispose",S));let W=C.program;o.updateUBOMapping(R,W);let X=t.render.frame;l[R.id]!==X&&(E(R),l[R.id]=X)}function v(R){let C=x();R.__bindingPointIndex=C;let F=n.createBuffer(),W=R.__size,X=R.usage;return n.bindBuffer(n.UNIFORM_BUFFER,F),n.bufferData(n.UNIFORM_BUFFER,W,X),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,C,F),F}function x(){for(let R=0;R<h;R++)if(p.indexOf(R)===-1)return p.push(R),R;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function E(R){let C=s[R.id],F=R.uniforms,W=R.__cache;n.bindBuffer(n.UNIFORM_BUFFER,C);for(let X=0,q=F.length;X<q;X++){let D=Array.isArray(F[X])?F[X]:[F[X]];for(let xt=0,B=D.length;xt<B;xt++){let j=D[xt];if(b(j,X,xt,W)===!0){let J=j.__offset,Dt=Array.isArray(j.value)?j.value:[j.value],Q=0;for(let At=0;At<Dt.length;At++){let Mt=Dt[At],Lt=I(Mt);typeof Mt=="number"||typeof Mt=="boolean"?(j.__data[0]=Mt,n.bufferSubData(n.UNIFORM_BUFFER,J+Q,j.__data)):Mt.isMatrix3?(j.__data[0]=Mt.elements[0],j.__data[1]=Mt.elements[1],j.__data[2]=Mt.elements[2],j.__data[3]=0,j.__data[4]=Mt.elements[3],j.__data[5]=Mt.elements[4],j.__data[6]=Mt.elements[5],j.__data[7]=0,j.__data[8]=Mt.elements[6],j.__data[9]=Mt.elements[7],j.__data[10]=Mt.elements[8],j.__data[11]=0):(Mt.toArray(j.__data,Q),Q+=Lt.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,J,j.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function b(R,C,F,W){let X=R.value,q=C+"_"+F;if(W[q]===void 0)return typeof X=="number"||typeof X=="boolean"?W[q]=X:W[q]=X.clone(),!0;{let D=W[q];if(typeof X=="number"||typeof X=="boolean"){if(D!==X)return W[q]=X,!0}else if(D.equals(X)===!1)return D.copy(X),!0}return!1}function T(R){let C=R.uniforms,F=0,W=16;for(let q=0,D=C.length;q<D;q++){let xt=Array.isArray(C[q])?C[q]:[C[q]];for(let B=0,j=xt.length;B<j;B++){let J=xt[B],Dt=Array.isArray(J.value)?J.value:[J.value];for(let Q=0,At=Dt.length;Q<At;Q++){let Mt=Dt[Q],Lt=I(Mt),pt=F%W;pt!==0&&W-pt<Lt.boundary&&(F+=W-pt),J.__data=new Float32Array(Lt.storage/Float32Array.BYTES_PER_ELEMENT),J.__offset=F,F+=Lt.storage}}}let X=F%W;return X>0&&(F+=W-X),R.__size=F,R.__cache={},this}function I(R){let C={boundary:0,storage:0};return typeof R=="number"||typeof R=="boolean"?(C.boundary=4,C.storage=4):R.isVector2?(C.boundary=8,C.storage=8):R.isVector3||R.isColor?(C.boundary=16,C.storage=12):R.isVector4?(C.boundary=16,C.storage=16):R.isMatrix3?(C.boundary=48,C.storage=48):R.isMatrix4?(C.boundary=64,C.storage=64):R.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",R),C}function S(R){let C=R.target;C.removeEventListener("dispose",S);let F=p.indexOf(C.__bindingPointIndex);p.splice(F,1),n.deleteBuffer(s[C.id]),delete s[C.id],delete l[C.id]}function w(){for(let R in s)n.deleteBuffer(s[R]);p=[],s={},l={}}return{bind:g,update:m,dispose:w}}var mv=class{constructor(t={}){let{canvas:e=d6(),context:o=null,depth:s=!0,stencil:l=!0,alpha:p=!1,antialias:h=!1,premultipliedAlpha:g=!0,preserveDrawingBuffer:m=!1,powerPreference:v="default",failIfMajorPerformanceCaveat:x=!1}=t;this.isWebGLRenderer=!0;let E;o!==null?E=o.getContextAttributes().alpha:E=p;let b=new Uint32Array(4),T=new Int32Array(4),I=null,S=null,w=[],R=[];this.domElement=e,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=Ta,this._useLegacyLights=!1,this.toneMapping=Yu,this.toneMappingExposure=1;let C=this,F=!1,W=0,X=0,q=null,D=-1,xt=null,B=new ji,j=new ji,J=null,Dt=new ar(0),Q=0,At=e.width,Mt=e.height,Lt=1,pt=null,yt=null,K=new ji(0,0,At,Mt),Bt=new ji(0,0,At,Mt),Gt=!1,ae=new Bd,ut=!1,Ut=!1,jt=null,ce=new vi,te=new Ye,$t=new Rt,qt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function xe(){return q===null?Lt:1}let ft=o;function We(Z,mt){for(let It=0;It<Z.length;It++){let St=Z[It],vt=e.getContext(St,mt);if(vt!==null)return vt}return null}try{let Z={alpha:!0,depth:s,stencil:l,antialias:h,premultipliedAlpha:g,preserveDrawingBuffer:m,powerPreference:v,failIfMajorPerformanceCaveat:x};if("setAttribute"in e&&e.setAttribute("data-engine",\`three.js r\${Rv}\`),e.addEventListener("webglcontextlost",Et,!1),e.addEventListener("webglcontextrestored",G,!1),e.addEventListener("webglcontextcreationerror",ot,!1),ft===null){let mt=["webgl2","webgl","experimental-webgl"];if(C.isWebGL1Renderer===!0&&mt.shift(),ft=We(mt,Z),ft===null)throw We(mt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&ft instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),ft.getShaderPrecisionFormat===void 0&&(ft.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Z){throw console.error("THREE.WebGLRenderer: "+Z.message),Z}let ee,ge,fe,Te,be,Wt,Me,tt,z,Pt,Ot,dt,Ht,Ce,Vt,Zt,ne,rt,P,N,k,$,V,ht;function at(){ee=new AW(ft),ge=new xW(ft,ee,t),ee.init(ge),$=new iX(ft,ee,ge),fe=new nX(ft,ee,ge),Te=new PW(ft),be=new V9,Wt=new rX(ft,ee,fe,be,ge,$,Te),Me=new wW(C),tt=new bW(C),z=new D6(ft,ge),V=new vW(ft,ee,z,ge),Pt=new TW(ft,z,Te,V),Ot=new NW(ft,Pt,z,Te),P=new LW(ft,ge,Wt),Zt=new EW(be),dt=new H9(C,Me,tt,ee,ge,V,Zt),Ht=new lX(C,be),Ce=new X9,Vt=new j9(ee,ge),rt=new yW(C,Me,tt,fe,Ot,E,g),ne=new eX(C,Ot,ge),ht=new cX(ft,Te,ge,fe),N=new _W(ft,ee,Te,ge),k=new CW(ft,ee,Te,ge),Te.programs=dt.programs,C.capabilities=ge,C.extensions=ee,C.properties=be,C.renderLists=Ce,C.shadowMap=ne,C.state=fe,C.info=Te}at();let wt=new gv(C,ft);this.xr=wt,this.getContext=function(){return ft},this.getContextAttributes=function(){return ft.getContextAttributes()},this.forceContextLoss=function(){let Z=ee.get("WEBGL_lose_context");Z&&Z.loseContext()},this.forceContextRestore=function(){let Z=ee.get("WEBGL_lose_context");Z&&Z.restoreContext()},this.getPixelRatio=function(){return Lt},this.setPixelRatio=function(Z){Z!==void 0&&(Lt=Z,this.setSize(At,Mt,!1))},this.getSize=function(Z){return Z.set(At,Mt)},this.setSize=function(Z,mt,It=!0){if(wt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}At=Z,Mt=mt,e.width=Math.floor(Z*Lt),e.height=Math.floor(mt*Lt),It===!0&&(e.style.width=Z+"px",e.style.height=mt+"px"),this.setViewport(0,0,Z,mt)},this.getDrawingBufferSize=function(Z){return Z.set(At*Lt,Mt*Lt).floor()},this.setDrawingBufferSize=function(Z,mt,It){At=Z,Mt=mt,Lt=It,e.width=Math.floor(Z*It),e.height=Math.floor(mt*It),this.setViewport(0,0,Z,mt)},this.getCurrentViewport=function(Z){return Z.copy(B)},this.getViewport=function(Z){return Z.copy(K)},this.setViewport=function(Z,mt,It,St){Z.isVector4?K.set(Z.x,Z.y,Z.z,Z.w):K.set(Z,mt,It,St),fe.viewport(B.copy(K).multiplyScalar(Lt).round())},this.getScissor=function(Z){return Z.copy(Bt)},this.setScissor=function(Z,mt,It,St){Z.isVector4?Bt.set(Z.x,Z.y,Z.z,Z.w):Bt.set(Z,mt,It,St),fe.scissor(j.copy(Bt).multiplyScalar(Lt).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(Z){fe.setScissorTest(Gt=Z)},this.setOpaqueSort=function(Z){pt=Z},this.setTransparentSort=function(Z){yt=Z},this.getClearColor=function(Z){return Z.copy(rt.getClearColor())},this.setClearColor=function(){rt.setClearColor.apply(rt,arguments)},this.getClearAlpha=function(){return rt.getClearAlpha()},this.setClearAlpha=function(){rt.setClearAlpha.apply(rt,arguments)},this.clear=function(Z=!0,mt=!0,It=!0){let St=0;if(Z){let vt=!1;if(q!==null){let he=q.texture.format;vt=he===pC||he===hC||he===fC}if(vt){let he=q.texture.type,ue=he===$u||he===Wu||he===Lv||he===Ol||he===lC||he===cC,we=rt.getClearColor(),de=rt.getClearAlpha(),Be=we.r,Ae=we.g,Pe=we.b;ue?(b[0]=Be,b[1]=Ae,b[2]=Pe,b[3]=de,ft.clearBufferuiv(ft.COLOR,0,b)):(T[0]=Be,T[1]=Ae,T[2]=Pe,T[3]=de,ft.clearBufferiv(ft.COLOR,0,T))}else St|=ft.COLOR_BUFFER_BIT}mt&&(St|=ft.DEPTH_BUFFER_BIT),It&&(St|=ft.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ft.clear(St)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Et,!1),e.removeEventListener("webglcontextrestored",G,!1),e.removeEventListener("webglcontextcreationerror",ot,!1),Ce.dispose(),Vt.dispose(),be.dispose(),Me.dispose(),tt.dispose(),Ot.dispose(),V.dispose(),ht.dispose(),dt.dispose(),ne.dispose(),wt.dispose(),wt.removeEventListener("sessionstart",qe),wt.removeEventListener("sessionend",Ue),jt&&(jt.dispose(),jt=null),Xe.stop()};function Et(Z){Z.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),F=!0}function G(){console.log("THREE.WebGLRenderer: Context Restored."),F=!1;let Z=Te.autoReset,mt=ne.enabled,It=ne.autoUpdate,St=ne.needsUpdate,vt=ne.type;at(),Te.autoReset=Z,ne.enabled=mt,ne.autoUpdate=It,ne.needsUpdate=St,ne.type=vt}function ot(Z){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",Z.statusMessage)}function et(Z){let mt=Z.target;mt.removeEventListener("dispose",et),lt(mt)}function lt(Z){Ft(Z),be.remove(Z)}function Ft(Z){let mt=be.get(Z).programs;mt!==void 0&&(mt.forEach(function(It){dt.releaseProgram(It)}),Z.isShaderMaterial&&dt.releaseShaderCache(Z))}this.renderBufferDirect=function(Z,mt,It,St,vt,he){mt===null&&(mt=qt);let ue=vt.isMesh&&vt.matrixWorld.determinant()<0,we=Qn(Z,mt,It,St,vt);fe.setMaterial(St,ue);let de=It.index,Be=1;if(St.wireframe===!0){if(de=Pt.getWireframeAttribute(It),de===void 0)return;Be=2}let Ae=It.drawRange,Pe=It.attributes.position,en=Ae.start*Be,si=(Ae.start+Ae.count)*Be;he!==null&&(en=Math.max(en,he.start*Be),si=Math.min(si,(he.start+he.count)*Be)),de!==null?(en=Math.max(en,0),si=Math.min(si,de.count)):Pe!=null&&(en=Math.max(en,0),si=Math.min(si,Pe.count));let br=si-en;if(br<0||br===1/0)return;V.setup(vt,St,we,It,de);let Vi,sr=N;if(de!==null&&(Vi=z.get(de),sr=k,sr.setIndex(Vi)),vt.isMesh)St.wireframe===!0?(fe.setLineWidth(St.wireframeLinewidth*xe()),sr.setMode(ft.LINES)):sr.setMode(ft.TRIANGLES);else if(vt.isLine){let ye=St.linewidth;ye===void 0&&(ye=1),fe.setLineWidth(ye*xe()),vt.isLineSegments?sr.setMode(ft.LINES):vt.isLineLoop?sr.setMode(ft.LINE_LOOP):sr.setMode(ft.LINE_STRIP)}else vt.isPoints?sr.setMode(ft.POINTS):vt.isSprite&&sr.setMode(ft.TRIANGLES);if(vt.isBatchedMesh)sr.renderMultiDraw(vt._multiDrawStarts,vt._multiDrawCounts,vt._multiDrawCount);else if(vt.isInstancedMesh)sr.renderInstances(en,br,vt.count);else if(It.isInstancedBufferGeometry){let ye=It._maxInstanceCount!==void 0?It._maxInstanceCount:1/0,Ua=Math.min(It.instanceCount,ye);sr.renderInstances(en,br,Ua)}else sr.render(en,br)};function Kt(Z,mt,It){Z.transparent===!0&&Z.side===cu&&Z.forceSinglePass===!1?(Z.side=$o,Z.needsUpdate=!0,rr(Z,mt,It),Z.side=Ju,Z.needsUpdate=!0,rr(Z,mt,It),Z.side=cu):rr(Z,mt,It)}this.compile=function(Z,mt,It=null){It===null&&(It=Z),S=Vt.get(It),S.init(),R.push(S),It.traverseVisible(function(vt){vt.isLight&&vt.layers.test(mt.layers)&&(S.pushLight(vt),vt.castShadow&&S.pushShadow(vt))}),Z!==It&&Z.traverseVisible(function(vt){vt.isLight&&vt.layers.test(mt.layers)&&(S.pushLight(vt),vt.castShadow&&S.pushShadow(vt))}),S.setupLights(C._useLegacyLights);let St=new Set;return Z.traverse(function(vt){let he=vt.material;if(he)if(Array.isArray(he))for(let ue=0;ue<he.length;ue++){let we=he[ue];Kt(we,It,vt),St.add(we)}else Kt(he,It,vt),St.add(he)}),R.pop(),S=null,St},this.compileAsync=function(Z,mt,It=null){let St=this.compile(Z,mt,It);return new Promise(vt=>{function he(){if(St.forEach(function(ue){be.get(ue).currentProgram.isReady()&&St.delete(ue)}),St.size===0){vt(Z);return}setTimeout(he,10)}ee.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let me=null;function ve(Z){me&&me(Z)}function qe(){Xe.stop()}function Ue(){Xe.start()}let Xe=new xC;Xe.setAnimationLoop(ve),typeof self!="undefined"&&Xe.setContext(self),this.setAnimationLoop=function(Z){me=Z,wt.setAnimationLoop(Z),Z===null?Xe.stop():Xe.start()},wt.addEventListener("sessionstart",qe),wt.addEventListener("sessionend",Ue),this.render=function(Z,mt){if(mt!==void 0&&mt.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(F===!0)return;Z.matrixWorldAutoUpdate===!0&&Z.updateMatrixWorld(),mt.parent===null&&mt.matrixWorldAutoUpdate===!0&&mt.updateMatrixWorld(),wt.enabled===!0&&wt.isPresenting===!0&&(wt.cameraAutoUpdate===!0&&wt.updateCamera(mt),mt=wt.getCamera()),Z.isScene===!0&&Z.onBeforeRender(C,Z,mt,q),S=Vt.get(Z,R.length),S.init(),R.push(S),ce.multiplyMatrices(mt.projectionMatrix,mt.matrixWorldInverse),ae.setFromProjectionMatrix(ce),Ut=this.localClippingEnabled,ut=Zt.init(this.clippingPlanes,Ut),I=Ce.get(Z,w.length),I.init(),w.push(I),Je(Z,mt,0,C.sortObjects),I.finish(),C.sortObjects===!0&&I.sort(pt,yt),this.info.render.frame++,ut===!0&&Zt.beginShadows();let It=S.state.shadowsArray;if(ne.render(It,Z,mt),ut===!0&&Zt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(wt.enabled===!1||wt.isPresenting===!1||wt.hasDepthSensing()===!1)&&rt.render(I,Z),S.setupLights(C._useLegacyLights),mt.isArrayCamera){let St=mt.cameras;for(let vt=0,he=St.length;vt<he;vt++){let ue=St[vt];wr(I,Z,ue,ue.viewport)}}else wr(I,Z,mt);q!==null&&(Wt.updateMultisampleRenderTarget(q),Wt.updateRenderTargetMipmap(q)),Z.isScene===!0&&Z.onAfterRender(C,Z,mt),V.resetDefaultState(),D=-1,xt=null,R.pop(),R.length>0?S=R[R.length-1]:S=null,w.pop(),w.length>0?I=w[w.length-1]:I=null};function Je(Z,mt,It,St){if(Z.visible===!1)return;if(Z.layers.test(mt.layers)){if(Z.isGroup)It=Z.renderOrder;else if(Z.isLOD)Z.autoUpdate===!0&&Z.update(mt);else if(Z.isLight)S.pushLight(Z),Z.castShadow&&S.pushShadow(Z);else if(Z.isSprite){if(!Z.frustumCulled||ae.intersectsSprite(Z)){St&&$t.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(ce);let ue=Ot.update(Z),we=Z.material;we.visible&&I.push(Z,ue,we,It,$t.z,null)}}else if((Z.isMesh||Z.isLine||Z.isPoints)&&(!Z.frustumCulled||ae.intersectsObject(Z))){let ue=Ot.update(Z),we=Z.material;if(St&&(Z.boundingSphere!==void 0?(Z.boundingSphere===null&&Z.computeBoundingSphere(),$t.copy(Z.boundingSphere.center)):(ue.boundingSphere===null&&ue.computeBoundingSphere(),$t.copy(ue.boundingSphere.center)),$t.applyMatrix4(Z.matrixWorld).applyMatrix4(ce)),Array.isArray(we)){let de=ue.groups;for(let Be=0,Ae=de.length;Be<Ae;Be++){let Pe=de[Be],en=we[Pe.materialIndex];en&&en.visible&&I.push(Z,ue,en,It,$t.z,Pe)}}else we.visible&&I.push(Z,ue,we,It,$t.z,null)}}let he=Z.children;for(let ue=0,we=he.length;ue<we;ue++)Je(he[ue],mt,It,St)}function wr(Z,mt,It,St){let vt=Z.opaque,he=Z.transmissive,ue=Z.transparent;S.setupLightsView(It),ut===!0&&Zt.setGlobalState(C.clippingPlanes,It),he.length>0&&Jr(vt,he,mt,It),St&&fe.viewport(B.copy(St)),vt.length>0&&nr(vt,mt,It),he.length>0&&nr(he,mt,It),ue.length>0&&nr(ue,mt,It),fe.buffers.depth.setTest(!0),fe.buffers.depth.setMask(!0),fe.buffers.color.setMask(!0),fe.setPolygonOffset(!1)}function Jr(Z,mt,It,St){if((It.isScene===!0?It.overrideMaterial:null)!==null)return;let he=ge.isWebGL2;jt===null&&(jt=new du(1,1,{generateMipmaps:!0,type:ee.has("EXT_color_buffer_half_float")?ah:$u,minFilter:Ll,samples:he?4:0})),C.getDrawingBufferSize(te),he?jt.setSize(te.x,te.y):jt.setSize(jy(te.x),jy(te.y));let ue=C.getRenderTarget();C.setRenderTarget(jt),C.getClearColor(Dt),Q=C.getClearAlpha(),Q<1&&C.setClearColor(16777215,.5),C.clear();let we=C.toneMapping;C.toneMapping=Yu,nr(Z,It,St),Wt.updateMultisampleRenderTarget(jt),Wt.updateRenderTargetMipmap(jt);let de=!1;for(let Be=0,Ae=mt.length;Be<Ae;Be++){let Pe=mt[Be],en=Pe.object,si=Pe.geometry,br=Pe.material,Vi=Pe.group;if(br.side===cu&&en.layers.test(St.layers)){let sr=br.side;br.side=$o,br.needsUpdate=!0,Ie(en,It,St,si,br,Vi),br.side=sr,br.needsUpdate=!0,de=!0}}de===!0&&(Wt.updateMultisampleRenderTarget(jt),Wt.updateRenderTargetMipmap(jt)),C.setRenderTarget(ue),C.setClearColor(Dt,Q),C.toneMapping=we}function nr(Z,mt,It){let St=mt.isScene===!0?mt.overrideMaterial:null;for(let vt=0,he=Z.length;vt<he;vt++){let ue=Z[vt],we=ue.object,de=ue.geometry,Be=St===null?ue.material:St,Ae=ue.group;we.layers.test(It.layers)&&Ie(we,mt,It,de,Be,Ae)}}function Ie(Z,mt,It,St,vt,he){Z.onBeforeRender(C,mt,It,St,vt,he),Z.modelViewMatrix.multiplyMatrices(It.matrixWorldInverse,Z.matrixWorld),Z.normalMatrix.getNormalMatrix(Z.modelViewMatrix),vt.onBeforeRender(C,mt,It,St,Z,he),vt.transparent===!0&&vt.side===cu&&vt.forceSinglePass===!1?(vt.side=$o,vt.needsUpdate=!0,C.renderBufferDirect(It,mt,St,vt,Z,he),vt.side=Ju,vt.needsUpdate=!0,C.renderBufferDirect(It,mt,St,vt,Z,he),vt.side=cu):C.renderBufferDirect(It,mt,St,vt,Z,he),Z.onAfterRender(C,mt,It,St,vt,he)}function rr(Z,mt,It){mt.isScene!==!0&&(mt=qt);let St=be.get(Z),vt=S.state.lights,he=S.state.shadowsArray,ue=vt.state.version,we=dt.getParameters(Z,vt.state,he,mt,It),de=dt.getProgramCacheKey(we),Be=St.programs;St.environment=Z.isMeshStandardMaterial?mt.environment:null,St.fog=mt.fog,St.envMap=(Z.isMeshStandardMaterial?tt:Me).get(Z.envMap||St.environment),St.envMapRotation=St.environment!==null&&Z.envMap===null?mt.environmentRotation:Z.envMapRotation,Be===void 0&&(Z.addEventListener("dispose",et),Be=new Map,St.programs=Be);let Ae=Be.get(de);if(Ae!==void 0){if(St.currentProgram===Ae&&St.lightsStateVersion===ue)return ur(Z,we),Ae}else we.uniforms=dt.getUniforms(Z),Z.onBuild(It,we,C),Z.onBeforeCompile(we,C),Ae=dt.acquireProgram(we,de),Be.set(de,Ae),St.uniforms=we.uniforms;let Pe=St.uniforms;return(!Z.isShaderMaterial&&!Z.isRawShaderMaterial||Z.clipping===!0)&&(Pe.clippingPlanes=Zt.uniform),ur(Z,we),St.needsLights=oi(Z),St.lightsStateVersion=ue,St.needsLights&&(Pe.ambientLightColor.value=vt.state.ambient,Pe.lightProbe.value=vt.state.probe,Pe.directionalLights.value=vt.state.directional,Pe.directionalLightShadows.value=vt.state.directionalShadow,Pe.spotLights.value=vt.state.spot,Pe.spotLightShadows.value=vt.state.spotShadow,Pe.rectAreaLights.value=vt.state.rectArea,Pe.ltc_1.value=vt.state.rectAreaLTC1,Pe.ltc_2.value=vt.state.rectAreaLTC2,Pe.pointLights.value=vt.state.point,Pe.pointLightShadows.value=vt.state.pointShadow,Pe.hemisphereLights.value=vt.state.hemi,Pe.directionalShadowMap.value=vt.state.directionalShadowMap,Pe.directionalShadowMatrix.value=vt.state.directionalShadowMatrix,Pe.spotShadowMap.value=vt.state.spotShadowMap,Pe.spotLightMatrix.value=vt.state.spotLightMatrix,Pe.spotLightMap.value=vt.state.spotLightMap,Pe.pointShadowMap.value=vt.state.pointShadowMap,Pe.pointShadowMatrix.value=vt.state.pointShadowMatrix),St.currentProgram=Ae,St.uniformsList=null,Ae}function pr(Z){if(Z.uniformsList===null){let mt=Z.currentProgram.getUniforms();Z.uniformsList=qc.seqWithValue(mt.seq,Z.uniforms)}return Z.uniformsList}function ur(Z,mt){let It=be.get(Z);It.outputColorSpace=mt.outputColorSpace,It.batching=mt.batching,It.instancing=mt.instancing,It.instancingColor=mt.instancingColor,It.instancingMorph=mt.instancingMorph,It.skinning=mt.skinning,It.morphTargets=mt.morphTargets,It.morphNormals=mt.morphNormals,It.morphColors=mt.morphColors,It.morphTargetsCount=mt.morphTargetsCount,It.numClippingPlanes=mt.numClippingPlanes,It.numIntersection=mt.numClipIntersection,It.vertexAlphas=mt.vertexAlphas,It.vertexTangents=mt.vertexTangents,It.toneMapping=mt.toneMapping}function Qn(Z,mt,It,St,vt){mt.isScene!==!0&&(mt=qt),Wt.resetTextureUnits();let he=mt.fog,ue=St.isMeshStandardMaterial?mt.environment:null,we=q===null?C.outputColorSpace:q.isXRRenderTarget===!0?q.texture.colorSpace:tl,de=(St.isMeshStandardMaterial?tt:Me).get(St.envMap||ue),Be=St.vertexColors===!0&&!!It.attributes.color&&It.attributes.color.itemSize===4,Ae=!!It.attributes.tangent&&(!!St.normalMap||St.anisotropy>0),Pe=!!It.morphAttributes.position,en=!!It.morphAttributes.normal,si=!!It.morphAttributes.color,br=Yu;St.toneMapped&&(q===null||q.isXRRenderTarget===!0)&&(br=C.toneMapping);let Vi=It.morphAttributes.position||It.morphAttributes.normal||It.morphAttributes.color,sr=Vi!==void 0?Vi.length:0,ye=be.get(St),Ua=S.state.lights;if(ut===!0&&(Ut===!0||Z!==xt)){let Ai=Z===xt&&St.id===D;Zt.setState(St,Z,Ai)}let nn=!1;St.version===ye.__version?(ye.needsLights&&ye.lightsStateVersion!==Ua.state.version||ye.outputColorSpace!==we||vt.isBatchedMesh&&ye.batching===!1||!vt.isBatchedMesh&&ye.batching===!0||vt.isInstancedMesh&&ye.instancing===!1||!vt.isInstancedMesh&&ye.instancing===!0||vt.isSkinnedMesh&&ye.skinning===!1||!vt.isSkinnedMesh&&ye.skinning===!0||vt.isInstancedMesh&&ye.instancingColor===!0&&vt.instanceColor===null||vt.isInstancedMesh&&ye.instancingColor===!1&&vt.instanceColor!==null||vt.isInstancedMesh&&ye.instancingMorph===!0&&vt.morphTexture===null||vt.isInstancedMesh&&ye.instancingMorph===!1&&vt.morphTexture!==null||ye.envMap!==de||St.fog===!0&&ye.fog!==he||ye.numClippingPlanes!==void 0&&(ye.numClippingPlanes!==Zt.numPlanes||ye.numIntersection!==Zt.numIntersection)||ye.vertexAlphas!==Be||ye.vertexTangents!==Ae||ye.morphTargets!==Pe||ye.morphNormals!==en||ye.morphColors!==si||ye.toneMapping!==br||ge.isWebGL2===!0&&ye.morphTargetsCount!==sr)&&(nn=!0):(nn=!0,ye.__version=St.version);let fo=ye.currentProgram;nn===!0&&(fo=rr(St,mt,vt));let ul=!1,ze=!1,vs=!1,ir=fo.getUniforms(),Qo=ye.uniforms;if(fe.useProgram(fo.program)&&(ul=!0,ze=!0,vs=!0),St.id!==D&&(D=St.id,ze=!0),ul||xt!==Z){ir.setValue(ft,"projectionMatrix",Z.projectionMatrix),ir.setValue(ft,"viewMatrix",Z.matrixWorldInverse);let Ai=ir.map.cameraPosition;Ai!==void 0&&Ai.setValue(ft,$t.setFromMatrixPosition(Z.matrixWorld)),ge.logarithmicDepthBuffer&&ir.setValue(ft,"logDepthBufFC",2/(Math.log(Z.far+1)/Math.LN2)),(St.isMeshPhongMaterial||St.isMeshToonMaterial||St.isMeshLambertMaterial||St.isMeshBasicMaterial||St.isMeshStandardMaterial||St.isShaderMaterial)&&ir.setValue(ft,"isOrthographic",Z.isOrthographicCamera===!0),xt!==Z&&(xt=Z,ze=!0,vs=!0)}if(vt.isSkinnedMesh){ir.setOptional(ft,vt,"bindMatrix"),ir.setOptional(ft,vt,"bindMatrixInverse");let Ai=vt.skeleton;Ai&&(ge.floatVertexTextures?(Ai.boneTexture===null&&Ai.computeBoneTexture(),ir.setValue(ft,"boneTexture",Ai.boneTexture,Wt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}vt.isBatchedMesh&&(ir.setOptional(ft,vt,"batchingTexture"),ir.setValue(ft,"batchingTexture",vt._matricesTexture,Wt));let Le=It.morphAttributes;if((Le.position!==void 0||Le.normal!==void 0||Le.color!==void 0&&ge.isWebGL2===!0)&&P.update(vt,It,fo),(ze||ye.receiveShadow!==vt.receiveShadow)&&(ye.receiveShadow=vt.receiveShadow,ir.setValue(ft,"receiveShadow",vt.receiveShadow)),St.isMeshGouraudMaterial&&St.envMap!==null&&(Qo.envMap.value=de,Qo.flipEnvMap.value=de.isCubeTexture&&de.isRenderTargetTexture===!1?-1:1),ze&&(ir.setValue(ft,"toneMappingExposure",C.toneMappingExposure),ye.needsLights&&bi(Qo,vs),he&&St.fog===!0&&Ht.refreshFogUniforms(Qo,he),Ht.refreshMaterialUniforms(Qo,St,Lt,Mt,jt),qc.upload(ft,pr(ye),Qo,Wt)),St.isShaderMaterial&&St.uniformsNeedUpdate===!0&&(qc.upload(ft,pr(ye),Qo,Wt),St.uniformsNeedUpdate=!1),St.isSpriteMaterial&&ir.setValue(ft,"center",vt.center),ir.setValue(ft,"modelViewMatrix",vt.modelViewMatrix),ir.setValue(ft,"normalMatrix",vt.normalMatrix),ir.setValue(ft,"modelMatrix",vt.matrixWorld),St.isShaderMaterial||St.isRawShaderMaterial){let Ai=St.uniformsGroups;for(let Ba=0,mu=Ai.length;Ba<mu;Ba++)if(ge.isWebGL2){let Ti=Ai[Ba];ht.update(Ti,fo),ht.bind(Ti,fo)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return fo}function bi(Z,mt){Z.ambientLightColor.needsUpdate=mt,Z.lightProbe.needsUpdate=mt,Z.directionalLights.needsUpdate=mt,Z.directionalLightShadows.needsUpdate=mt,Z.pointLights.needsUpdate=mt,Z.pointLightShadows.needsUpdate=mt,Z.spotLights.needsUpdate=mt,Z.spotLightShadows.needsUpdate=mt,Z.rectAreaLights.needsUpdate=mt,Z.hemisphereLights.needsUpdate=mt}function oi(Z){return Z.isMeshLambertMaterial||Z.isMeshToonMaterial||Z.isMeshPhongMaterial||Z.isMeshStandardMaterial||Z.isShadowMaterial||Z.isShaderMaterial&&Z.lights===!0}this.getActiveCubeFace=function(){return W},this.getActiveMipmapLevel=function(){return X},this.getRenderTarget=function(){return q},this.setRenderTargetTextures=function(Z,mt,It){be.get(Z.texture).__webglTexture=mt,be.get(Z.depthTexture).__webglTexture=It;let St=be.get(Z);St.__hasExternalTextures=!0,St.__autoAllocateDepthBuffer=It===void 0,St.__autoAllocateDepthBuffer||ee.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),St.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(Z,mt){let It=be.get(Z);It.__webglFramebuffer=mt,It.__useDefaultFramebuffer=mt===void 0},this.setRenderTarget=function(Z,mt=0,It=0){q=Z,W=mt,X=It;let St=!0,vt=null,he=!1,ue=!1;if(Z){let de=be.get(Z);de.__useDefaultFramebuffer!==void 0?(fe.bindFramebuffer(ft.FRAMEBUFFER,null),St=!1):de.__webglFramebuffer===void 0?Wt.setupRenderTarget(Z):de.__hasExternalTextures&&Wt.rebindTextures(Z,be.get(Z.texture).__webglTexture,be.get(Z.depthTexture).__webglTexture);let Be=Z.texture;(Be.isData3DTexture||Be.isDataArrayTexture||Be.isCompressedArrayTexture)&&(ue=!0);let Ae=be.get(Z).__webglFramebuffer;Z.isWebGLCubeRenderTarget?(Array.isArray(Ae[mt])?vt=Ae[mt][It]:vt=Ae[mt],he=!0):ge.isWebGL2&&Z.samples>0&&Wt.useMultisampledRTT(Z)===!1?vt=be.get(Z).__webglMultisampledFramebuffer:Array.isArray(Ae)?vt=Ae[It]:vt=Ae,B.copy(Z.viewport),j.copy(Z.scissor),J=Z.scissorTest}else B.copy(K).multiplyScalar(Lt).floor(),j.copy(Bt).multiplyScalar(Lt).floor(),J=Gt;if(fe.bindFramebuffer(ft.FRAMEBUFFER,vt)&&ge.drawBuffers&&St&&fe.drawBuffers(Z,vt),fe.viewport(B),fe.scissor(j),fe.setScissorTest(J),he){let de=be.get(Z.texture);ft.framebufferTexture2D(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,ft.TEXTURE_CUBE_MAP_POSITIVE_X+mt,de.__webglTexture,It)}else if(ue){let de=be.get(Z.texture),Be=mt||0;ft.framebufferTextureLayer(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,de.__webglTexture,It||0,Be)}D=-1},this.readRenderTargetPixels=function(Z,mt,It,St,vt,he,ue){if(!(Z&&Z.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=be.get(Z).__webglFramebuffer;if(Z.isWebGLCubeRenderTarget&&ue!==void 0&&(we=we[ue]),we){fe.bindFramebuffer(ft.FRAMEBUFFER,we);try{let de=Z.texture,Be=de.format,Ae=de.type;if(Be!==na&&$.convert(Be)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Pe=Ae===ah&&(ee.has("EXT_color_buffer_half_float")||ge.isWebGL2&&ee.has("EXT_color_buffer_float"));if(Ae!==$u&&$.convert(Ae)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ae===fu&&(ge.isWebGL2||ee.has("OES_texture_float")||ee.has("WEBGL_color_buffer_float")))&&!Pe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}mt>=0&&mt<=Z.width-St&&It>=0&&It<=Z.height-vt&&ft.readPixels(mt,It,St,vt,$.convert(Be),$.convert(Ae),he)}finally{let de=q!==null?be.get(q).__webglFramebuffer:null;fe.bindFramebuffer(ft.FRAMEBUFFER,de)}}},this.copyFramebufferToTexture=function(Z,mt,It=0){let St=Math.pow(2,-It),vt=Math.floor(mt.image.width*St),he=Math.floor(mt.image.height*St);Wt.setTexture2D(mt,0),ft.copyTexSubImage2D(ft.TEXTURE_2D,It,0,0,Z.x,Z.y,vt,he),fe.unbindTexture()},this.copyTextureToTexture=function(Z,mt,It,St=0){let vt=mt.image.width,he=mt.image.height,ue=$.convert(It.format),we=$.convert(It.type);Wt.setTexture2D(It,0),ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,It.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,It.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,It.unpackAlignment),mt.isDataTexture?ft.texSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,vt,he,ue,we,mt.image.data):mt.isCompressedTexture?ft.compressedTexSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,mt.mipmaps[0].width,mt.mipmaps[0].height,ue,mt.mipmaps[0].data):ft.texSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,ue,we,mt.image),St===0&&It.generateMipmaps&&ft.generateMipmap(ft.TEXTURE_2D),fe.unbindTexture()},this.copyTextureToTexture3D=function(Z,mt,It,St,vt=0){if(C.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let he=Math.round(Z.max.x-Z.min.x),ue=Math.round(Z.max.y-Z.min.y),we=Z.max.z-Z.min.z+1,de=$.convert(St.format),Be=$.convert(St.type),Ae;if(St.isData3DTexture)Wt.setTexture3D(St,0),Ae=ft.TEXTURE_3D;else if(St.isDataArrayTexture||St.isCompressedArrayTexture)Wt.setTexture2DArray(St,0),Ae=ft.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,St.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,St.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,St.unpackAlignment);let Pe=ft.getParameter(ft.UNPACK_ROW_LENGTH),en=ft.getParameter(ft.UNPACK_IMAGE_HEIGHT),si=ft.getParameter(ft.UNPACK_SKIP_PIXELS),br=ft.getParameter(ft.UNPACK_SKIP_ROWS),Vi=ft.getParameter(ft.UNPACK_SKIP_IMAGES),sr=It.isCompressedTexture?It.mipmaps[vt]:It.image;ft.pixelStorei(ft.UNPACK_ROW_LENGTH,sr.width),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,sr.height),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,Z.min.x),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,Z.min.y),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,Z.min.z),It.isDataTexture||It.isData3DTexture?ft.texSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,Be,sr.data):St.isCompressedArrayTexture?ft.compressedTexSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,sr.data):ft.texSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,Be,sr),ft.pixelStorei(ft.UNPACK_ROW_LENGTH,Pe),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,en),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,si),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,br),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,Vi),vt===0&&St.generateMipmaps&&ft.generateMipmap(Ae),fe.unbindTexture()},this.initTexture=function(Z){Z.isCubeTexture?Wt.setTextureCube(Z,0):Z.isData3DTexture?Wt.setTexture3D(Z,0):Z.isDataArrayTexture||Z.isCompressedArrayTexture?Wt.setTexture2DArray(Z,0):Wt.setTexture2D(Z,0),fe.unbindTexture()},this.resetState=function(){W=0,X=0,q=null,fe.reset(),V.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return hu}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Nv?"display-p3":"srgb",e.unpackColorSpace=xr.workingColorSpace===Vd?"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(t){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=t}},yv=class extends mv{};yv.prototype.isWebGL1Renderer=!0;var vv=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=Zy,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Zu()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return yC("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,o){t*=this.stride,o*=e.stride;for(let s=0,l=this.stride;s<l;s++)this.array[t+s]=e.array[o+s];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Zu()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),o=new this.constructor(e,this.stride);return o.setUsage(this.usage),o}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Zu()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.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}}},wo=new Rt,qd=class n{constructor(t,e,o,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=o,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,o=this.data.count;e<o;e++)wo.fromBufferAttribute(this,e),wo.applyMatrix4(t),this.setXYZ(e,wo.x,wo.y,wo.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)wo.fromBufferAttribute(this,e),wo.applyNormalMatrix(t),this.setXYZ(e,wo.x,wo.y,wo.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)wo.fromBufferAttribute(this,e),wo.transformDirection(t),this.setXYZ(e,wo.x,wo.y,wo.z);return this}getComponent(t,e){let o=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(o=Pa(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=_r(o,this.array)),this.data.array[t*this.data.stride+this.offset+e]=o,this}setX(t,e){return this.normalized&&(e=_r(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=_r(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=_r(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=_r(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Pa(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Pa(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Pa(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Pa(e,this.array)),e}setXY(t,e,o){return t=t*this.data.stride+this.offset,this.normalized&&(e=_r(e,this.array),o=_r(o,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this}setXYZ(t,e,o,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=_r(e,this.array),o=_r(o,this.array),s=_r(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this.data.array[t+2]=s,this}setXYZW(t,e,o,s,l){return t=t*this.data.stride+this.offset,this.normalized&&(e=_r(e,this.array),o=_r(o,this.array),s=_r(s,this.array),l=_r(l,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this.data.array[t+2]=s,this.data.array[t+3]=l,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let o=0;o<this.count;o++){let s=o*this.data.stride+this.offset;for(let l=0;l<this.itemSize;l++)e.push(this.data.array[s+l])}return new ms(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new n(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let o=0;o<this.count;o++){let s=o*this.data.stride+this.offset;for(let l=0;l<this.itemSize;l++)e.push(this.data.array[s+l])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},_v=class extends Bl{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ar(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},Hu,rh=new Rt,Oc=new Rt,Dc=new Rt,Fc=new Ye,ih=new Ye,AC=new vi,yd=new Rt,oh=new Rt,vd=new Rt,rC=new Ye,qy=new Ye,iC=new Ye,xv=class extends ia{constructor(t=new _v){if(super(),this.isSprite=!0,this.type="Sprite",Hu===void 0){Hu=new Qu;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),o=new vv(e,5);Hu.setIndex([0,1,2,0,2,3]),Hu.setAttribute("position",new qd(o,3,0,!1)),Hu.setAttribute("uv",new qd(o,2,3,!1))}this.geometry=Hu,this.material=t,this.center=new Ye(.5,.5)}raycast(t,e){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Oc.setFromMatrixScale(this.matrixWorld),AC.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Dc.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Oc.multiplyScalar(-Dc.z);let o=this.material.rotation,s,l;o!==0&&(l=Math.cos(o),s=Math.sin(o));let p=this.center;_d(yd.set(-.5,-.5,0),Dc,p,Oc,s,l),_d(oh.set(.5,-.5,0),Dc,p,Oc,s,l),_d(vd.set(.5,.5,0),Dc,p,Oc,s,l),rC.set(0,0),qy.set(1,0),iC.set(1,1);let h=t.ray.intersectTriangle(yd,oh,vd,!1,rh);if(h===null&&(_d(oh.set(-.5,.5,0),Dc,p,Oc,s,l),qy.set(0,1),h=t.ray.intersectTriangle(yd,vd,oh,!1,rh),h===null))return;let g=t.ray.origin.distanceTo(rh);g<t.near||g>t.far||e.push({distance:g,point:rh.clone(),uv:Nl.getInterpolation(rh,yd,oh,vd,rC,qy,iC,new Ye),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}};xv.Dispose=function(){Hu.dispose(),Hu=void 0};function _d(n,t,e,o,s,l){Fc.subVectors(n,e).addScalar(.5).multiply(o),s!==void 0?(ih.x=l*Fc.x-s*Fc.y,ih.y=s*Fc.x+l*Fc.y):ih.copy(Fc),n.copy(t),n.x+=ih.x,n.y+=ih.y,n.applyMatrix4(AC)}function xd(n,t,e){return!n||!e&&n.constructor===t?n:typeof t.BYTES_PER_ELEMENT=="number"?new t(n):Array.prototype.slice.call(n)}function fX(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var Yc=class{constructor(t,e,o,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,s=e[o],l=e[o-1];t:{e:{let p;n:{r:if(!(t<s)){for(let h=o+2;;){if(s===void 0){if(t<l)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===h)break;if(l=s,s=e[++o],t<s)break e}p=e.length;break n}if(!(t>=l)){let h=e[1];t<h&&(o=2,l=h);for(let g=o-2;;){if(l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===g)break;if(s=l,l=e[--o-1],t>=l)break e}p=o,o=0;break n}break t}for(;o<p;){let h=o+p>>>1;t<e[h]?p=h:o=h+1}if(s=e[o],l=e[o-1],l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,l,s)}return this.interpolate_(o,l,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,s=this.valueSize,l=t*s;for(let p=0;p!==s;++p)e[p]=o[l+p];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Ev=class extends Yc{constructor(t,e,o,s){super(t,e,o,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:hT,endingEnd:hT}}intervalChanged_(t,e,o){let s=this.parameterPositions,l=t-2,p=t+1,h=s[l],g=s[p];if(h===void 0)switch(this.getSettings_().endingStart){case pT:l=t,h=2*e-o;break;case dT:l=s.length-2,h=e+s[l]-s[l+1];break;default:l=t,h=o}if(g===void 0)switch(this.getSettings_().endingEnd){case pT:p=t,g=2*o-e;break;case dT:p=1,g=o+s[1]-s[0];break;default:p=t-1,g=e}let m=(o-e)*.5,v=this.valueSize;this._weightPrev=m/(e-h),this._weightNext=m/(g-o),this._offsetPrev=l*v,this._offsetNext=p*v}interpolate_(t,e,o,s){let l=this.resultBuffer,p=this.sampleValues,h=this.valueSize,g=t*h,m=g-h,v=this._offsetPrev,x=this._offsetNext,E=this._weightPrev,b=this._weightNext,T=(o-e)/(s-e),I=T*T,S=I*T,w=-E*S+2*E*I-E*T,R=(1+E)*S+(-1.5-2*E)*I+(-.5+E)*T+1,C=(-1-b)*S+(1.5+b)*I+.5*T,F=b*S-b*I;for(let W=0;W!==h;++W)l[W]=w*p[v+W]+R*p[m+W]+C*p[g+W]+F*p[x+W];return l}},wv=class extends Yc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let l=this.resultBuffer,p=this.sampleValues,h=this.valueSize,g=t*h,m=g-h,v=(o-e)/(s-e),x=1-v;for(let E=0;E!==h;++E)l[E]=p[m+E]*x+p[g+E]*v;return l}},Sv=class extends Yc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t){return this.copySampleValue_(t-1)}},oa=class{constructor(t,e,o,s){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=xd(e,this.TimeBufferType),this.values=xd(o,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,o;if(e.toJSON!==this.toJSON)o=e.toJSON(t);else{o={name:t.name,times:xd(t.times,Array),values:xd(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(o.interpolation=s)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new Sv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new wv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Ev(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case wd:e=this.InterpolantFactoryMethodDiscrete;break;case Sd:e=this.InterpolantFactoryMethodLinear;break;case gy:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let o="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(o);return console.warn("THREE.KeyframeTrack:",o),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return wd;case this.InterpolantFactoryMethodLinear:return Sd;case this.InterpolantFactoryMethodSmooth:return gy}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]*=t}return this}trim(t,e){let o=this.times,s=o.length,l=0,p=s-1;for(;l!==s&&o[l]<t;)++l;for(;p!==-1&&o[p]>e;)--p;if(++p,l!==0||p!==s){l>=p&&(p=Math.max(p,1),l=p-1);let h=this.getValueSize();this.times=o.slice(l,p),this.values=this.values.slice(l*h,p*h)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let o=this.times,s=this.values,l=o.length;l===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let p=null;for(let h=0;h!==l;h++){let g=o[h];if(typeof g=="number"&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,h,g),t=!1;break}if(p!==null&&p>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,h,g,p),t=!1;break}p=g}if(s!==void 0&&fX(s))for(let h=0,g=s.length;h!==g;++h){let m=s[h];if(isNaN(m)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,h,m),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),s=this.getInterpolation()===gy,l=t.length-1,p=1;for(let h=1;h<l;++h){let g=!1,m=t[h],v=t[h+1];if(m!==v&&(h!==1||m!==t[0]))if(s)g=!0;else{let x=h*o,E=x-o,b=x+o;for(let T=0;T!==o;++T){let I=e[x+T];if(I!==e[E+T]||I!==e[b+T]){g=!0;break}}}if(g){if(h!==p){t[p]=t[h];let x=h*o,E=p*o;for(let b=0;b!==o;++b)e[E+b]=e[x+b]}++p}}if(l>0){t[p]=t[l];for(let h=l*o,g=p*o,m=0;m!==o;++m)e[g+m]=e[h+m];++p}return p!==t.length?(this.times=t.slice(0,p),this.values=e.slice(0,p*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,s=new o(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};oa.prototype.TimeBufferType=Float32Array;oa.prototype.ValueBufferType=Float32Array;oa.prototype.DefaultInterpolation=Sd;var zl=class extends oa{};zl.prototype.ValueTypeName="bool";zl.prototype.ValueBufferType=Array;zl.prototype.DefaultInterpolation=wd;zl.prototype.InterpolantFactoryMethodLinear=void 0;zl.prototype.InterpolantFactoryMethodSmooth=void 0;var Mv=class extends oa{};Mv.prototype.ValueTypeName="color";var bv=class extends oa{};bv.prototype.ValueTypeName="number";var Av=class extends Yc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let l=this.resultBuffer,p=this.sampleValues,h=this.valueSize,g=(o-e)/(s-e),m=t*h;for(let v=m+h;m!==v;m+=4)ju.slerpFlat(l,0,p,m-h,p,m,g);return l}},ch=class extends oa{InterpolantFactoryMethodLinear(t){return new Av(this.times,this.values,this.getValueSize(),t)}};ch.prototype.ValueTypeName="quaternion";ch.prototype.DefaultInterpolation=Sd;ch.prototype.InterpolantFactoryMethodSmooth=void 0;var Gl=class extends oa{};Gl.prototype.ValueTypeName="string";Gl.prototype.ValueBufferType=Array;Gl.prototype.DefaultInterpolation=wd;Gl.prototype.InterpolantFactoryMethodLinear=void 0;Gl.prototype.InterpolantFactoryMethodSmooth=void 0;var Tv=class extends oa{};Tv.prototype.ValueTypeName="vector";var Cv=class{constructor(t,e,o){let s=this,l=!1,p=0,h=0,g,m=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(v){h++,l===!1&&s.onStart!==void 0&&s.onStart(v,p,h),l=!0},this.itemEnd=function(v){p++,s.onProgress!==void 0&&s.onProgress(v,p,h),p===h&&(l=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(v){s.onError!==void 0&&s.onError(v)},this.resolveURL=function(v){return g?g(v):v},this.setURLModifier=function(v){return g=v,this},this.addHandler=function(v,x){return m.push(v,x),this},this.removeHandler=function(v){let x=m.indexOf(v);return x!==-1&&m.splice(x,2),this},this.getHandler=function(v){for(let x=0,E=m.length;x<E;x+=2){let b=m[x],T=m[x+1];if(b.global&&(b.lastIndex=0),b.test(v))return T}return null}}},hX=new Cv,Pv=class{constructor(t){this.manager=t!==void 0?t:hX,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(s,l){o.load(t,s,e,l)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};Pv.DEFAULT_MATERIAL_NAME="__DEFAULT";var Dv="\\\\[\\\\]\\\\.:\\\\/",pX=new RegExp("["+Dv+"]","g"),Fv="[^"+Dv+"]",dX="[^"+Dv.replace("\\\\.","")+"]",gX=/((?:WC+[\\/:])*)/.source.replace("WC",Fv),mX=/(WCOD+)?/.source.replace("WCOD",dX),yX=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Fv),vX=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Fv),_X=new RegExp("^"+gX+mX+yX+vX+"$"),xX=["material","materials","bones","map"],Iv=class{constructor(t,e,o){let s=o||Or.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,s=this._bindings[o];s!==void 0&&s.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let s=this._targetGroup.nCachedObjects_,l=o.length;s!==l;++s)o[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].unbind()}},Or=class n{constructor(t,e,o){this.path=e,this.parsedPath=o||n.parseTrackName(e),this.node=n.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,o){return t&&t.isAnimationObjectGroup?new n.Composite(t,e,o):new n(t,e,o)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(pX,"")}static parseTrackName(t){let e=_X.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let o={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=o.nodeName&&o.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let l=o.nodeName.substring(s+1);xX.indexOf(l)!==-1&&(o.nodeName=o.nodeName.substring(0,s),o.objectName=l)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return o}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let o=t.skeleton.getBoneByName(e);if(o!==void 0)return o}if(t.children){let o=function(l){for(let p=0;p<l.length;p++){let h=l[p];if(h.name===e||h.uuid===e)return h;let g=o(h.children);if(g)return g}return null},s=o(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let o=this.resolvedProperty;for(let s=0,l=o.length;s!==l;++s)t[e++]=o[s]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let o=this.resolvedProperty;for(let s=0,l=o.length;s!==l;++s)o[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,l=o.length;s!==l;++s)o[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,l=o.length;s!==l;++s)o[s]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,o=e.objectName,s=e.propertyName,l=e.propertyIndex;if(t||(t=n.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(o){let m=e.objectIndex;switch(o){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let v=0;v<t.length;v++)if(t[v].name===m){m=v;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[o]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[o]}if(m!==void 0){if(t[m]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[m]}}let p=t[s];if(p===void 0){let m=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+m+"."+s+" but it wasn't found.",t);return}let h=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?h=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(h=this.Versioning.MatrixWorldNeedsUpdate);let g=this.BindingType.Direct;if(l!==void 0){if(s==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[l]!==void 0&&(l=t.morphTargetDictionary[l])}g=this.BindingType.ArrayElement,this.resolvedProperty=p,this.propertyIndex=l}else p.fromArray!==void 0&&p.toArray!==void 0?(g=this.BindingType.HasFromToArray,this.resolvedProperty=p):Array.isArray(p)?(g=this.BindingType.EntireArray,this.resolvedProperty=p):this.propertyName=s;this.getValue=this.GetterByBindingType[g],this.setValue=this.SetterByBindingTypeAndVersioning[g][h]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Or.Composite=Iv;Or.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Or.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Or.prototype.GetterByBindingType=[Or.prototype._getValue_direct,Or.prototype._getValue_array,Or.prototype._getValue_arrayElement,Or.prototype._getValue_toArray];Or.prototype.SetterByBindingTypeAndVersioning=[[Or.prototype._setValue_direct,Or.prototype._setValue_direct_setNeedsUpdate,Or.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Or.prototype._setValue_array,Or.prototype._setValue_array_setNeedsUpdate,Or.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Or.prototype._setValue_arrayElement,Or.prototype._setValue_arrayElement_setNeedsUpdate,Or.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Or.prototype._setValue_fromArray,Or.prototype._setValue_fromArray_setNeedsUpdate,Or.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Ytt=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Rv}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Rv);var zi=63710088e-1,Jtt={centimeters:zi*100,centimetres:zi*100,degrees:zi/111325,feet:zi*3.28084,inches:zi*39.37,kilometers:zi/1e3,kilometres:zi/1e3,meters:zi,metres:zi,miles:zi/1609.344,millimeters:zi*1e3,millimetres:zi*1e3,nauticalmiles:zi/1852,radians:1,yards:zi*1.0936},Ktt={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/zi,yards:1.0936133};function bo(n,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=n,o}function Pr(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ra(n[0])||!Ra(n[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:n};return bo(o,t,e)}function Dr(n,t,e){e===void 0&&(e={});for(var o=0,s=n;o<s.length;o++){var l=s[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var p=0;p<l[l.length-1].length;p++)if(l[l.length-1][p]!==l[0][p])throw new Error("First and last Position are not equivalent.")}var h={type:"Polygon",coordinates:n};return bo(h,t,e)}function Gi(n,t,e){if(e===void 0&&(e={}),n.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:n};return bo(o,t,e)}function Uv(n,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:n};return bo(o,t,e)}function Ra(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function Ei(n,t,e){if(n!==null)for(var o,s,l,p,h,g,m,v=0,x=0,E,b=n.type,T=b==="FeatureCollection",I=b==="Feature",S=T?n.features.length:1,w=0;w<S;w++){m=T?n.features[w].geometry:I?n.geometry:n,E=m?m.type==="GeometryCollection":!1,h=E?m.geometries.length:1;for(var R=0;R<h;R++){var C=0,F=0;if(p=E?m.geometries[R]:m,p!==null){g=p.coordinates;var W=p.type;switch(v=e&&(W==="Polygon"||W==="MultiPolygon")?1:0,W){case null:break;case"Point":if(t(g,x,w,C,F)===!1)return!1;x++,C++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],x,w,C,F)===!1)return!1;x++,W==="MultiPoint"&&C++}W==="LineString"&&C++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(s=0;s<g[o].length-v;s++){if(t(g[o][s],x,w,C,F)===!1)return!1;x++}W==="MultiLineString"&&C++,W==="Polygon"&&F++}W==="Polygon"&&C++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(F=0,s=0;s<g[o].length;s++){for(l=0;l<g[o][s].length-v;l++){if(t(g[o][s][l],x,w,C,F)===!1)return!1;x++}F++}C++}break;case"GeometryCollection":for(o=0;o<p.geometries.length;o++)if(Ei(p.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function TC(n,t,e,o){var s=e;return Ei(n,function(l,p,h,g,m){p===0&&e===void 0?s=l:s=t(s,l,p,h,g,m)},o),s}function el(n,t){var e,o,s,l,p,h,g,m,v,x,E=0,b=n.type==="FeatureCollection",T=n.type==="Feature",I=b?n.features.length:1;for(e=0;e<I;e++){for(h=b?n.features[e].geometry:T?n.geometry:n,m=b?n.features[e].properties:T?n.properties:{},v=b?n.features[e].bbox:T?n.bbox:void 0,x=b?n.features[e].id:T?n.id:void 0,g=h?h.type==="GeometryCollection":!1,p=g?h.geometries.length:1,s=0;s<p;s++){if(l=g?h.geometries[s]:h,l===null){if(t(null,E,m,v,x)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,E,m,v,x)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],E,m,v,x)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}E++}}function ys(n,t){el(n,function(e,o,s,l,p){var h=e===null?null:e.type;switch(h){case null:case"Point":case"LineString":case"Polygon":return t(bo(e,s,{bbox:l,id:p}),o,0)===!1?!1:void 0}var g;switch(h){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var m=0;m<e.coordinates.length;m++){var v=e.coordinates[m],x={type:g,coordinates:v};if(t(bo(x,s),o,m)===!1)return!1}})}function Bv(n){var t=[1/0,1/0,-1/0,-1/0];return Ei(n,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Bv.default=Bv;var Ao=Bv;function Qi(n){if(!n)throw new Error("coord is required");if(!Array.isArray(n)){if(n.type==="Feature"&&n.geometry!==null&&n.geometry.type==="Point")return n.geometry.coordinates;if(n.type==="Point")return n.coordinates}if(Array.isArray(n)&&n.length>=2&&!Array.isArray(n[0])&&!Array.isArray(n[1]))return n;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function zv(n,t,e){if(!n)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!n||n.type!=="Feature"||!n.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!n.geometry||n.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+n.geometry.type)}function to(n){return n.type==="Feature"?n.geometry:n}var CX=sn(Xd(),1);var BX=sn(WC(),1);function ki(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=Qi(n),s=to(t),l=s.type,p=t.bbox,h=s.coordinates;if(p&&zX(o,p)===!1)return!1;l==="Polygon"&&(h=[h]);for(var g=!1,m=0;m<h.length&&!g;m++)if(XC(o,h[m][0],e.ignoreBoundary)){for(var v=!1,x=1;x<h[m].length&&!v;)XC(o,h[m][x],!e.ignoreBoundary)&&(v=!0),x++;v||(g=!0)}return g}function XC(n,t,e){var o=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var s=0,l=t.length-1;s<t.length;l=s++){var p=t[s][0],h=t[s][1],g=t[l][0],m=t[l][1],v=n[1]*(p-g)+h*(g-n[0])+m*(n[0]-p)===0&&(p-n[0])*(g-n[0])<=0&&(h-n[1])*(m-n[1])<=0;if(v)return!e;var x=h>n[1]!=m>n[1]&&n[0]<(g-p)*(n[1]-h)/(m-h)+p;x&&(o=!o)}return o}function zX(n,t){return t[0]<=n[0]&&t[1]<=n[1]&&t[2]>=n[0]&&t[3]>=n[1]}var ZC=new ArrayBuffer(16),Cnt=new Float64Array(ZC),Pnt=new Uint32Array(ZC);var t7=sn(e_(),1);var eit=function(){function n(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(var e=0;e<this.length-1;e++){var o=this.points[e],s=this.points[e+1];this.centers.push({x:(o.x+s.x)/2,y:(o.y+s.y)/2,z:(o.z+s.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var l=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,p=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,h=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+p),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+h)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+p),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+h)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return n.prototype.cacheSteps=function(t){var e=[],o=this.pos(0);e.push(0);for(var s=0;s<this.duration;s+=10){var l=this.pos(s),p=Math.sqrt((l.x-o.x)*(l.x-o.x)+(l.y-o.y)*(l.y-o.y)+(l.z-o.z)*(l.z-o.z));p>t&&(e.push(s),o=l)}return e},n.prototype.vector=function(t){var e=this.pos(t+10),o=this.pos(t-10);return{angle:180*Math.atan2(e.y-o.y,e.x-o.x)/3.14,speed:Math.sqrt((o.x-e.x)*(o.x-e.x)+(o.y-e.y)*(o.y-e.y)+(o.z-e.z)*(o.z-e.z))}},n.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var o=e/this.duration;if(o>=1)return this.points[this.length-1];var s=Math.floor((this.points.length-1)*o),l=(this.length-1)*o-s;return e7(l,this.points[s],this.controls[s][1],this.controls[s+1][0],this.points[s+1])},n}();function e7(n,t,e,o,s){var l=n7(n),p={x:s.x*l[0]+o.x*l[1]+e.x*l[2]+t.x*l[3],y:s.y*l[0]+o.y*l[1]+e.y*l[2]+t.y*l[3],z:s.z*l[0]+o.z*l[1]+e.z*l[2]+t.z*l[3]};return p}function n7(n){var t=n*n,e=t*n;return[e,3*t*(1-n),3*n*(1-n)*(1-n),(1-n)*(1-n)*(1-n)]}function dh(n,t){t===void 0&&(t={});var e=Number(n[0]),o=Number(n[1]),s=Number(n[2]),l=Number(n[3]);if(n.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var p=[e,o],h=[e,l],g=[s,l],m=[s,o];return Dr([[p,m,g,h,p]],t.properties,{bbox:n,id:t.id})}function r7(n){return dh(Ao(n))}var n_=r7;var x7=sn(sP(),1);var Y7=sn(lg(),1);var Z7=sn(Xd(),1);var j7=sn(e_(),1);var MP=Math.PI/180,bP=180/Math.PI,Eh=function(n,t){this.lon=n,this.lat=t,this.x=MP*n,this.y=MP*t};Eh.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};Eh.prototype.antipode=function(){var n=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new Eh(t,n)};var AP=function(){this.coords=[],this.length=0};AP.prototype.move_to=function(n){this.length++,this.coords.push(n)};var w_=function(n){this.properties=n||{},this.geometries=[]};w_.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var n=[],t=0;t<this.geometries.length;t++)n.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:n},type:"Feature",properties:this.properties}};w_.prototype.wkt=function(){for(var n="",t="LINESTRING(",e=function(l){t+=l[0]+" "+l[1]+","},o=0;o<this.geometries.length;o++){if(this.geometries[o].coords.length===0)return"LINESTRING(empty)";var s=this.geometries[o].coords;s.forEach(e),n+=t.substring(0,t.length-1)+")"}return n};var TP=function(n,t,e){if(!n||n.x===void 0||n.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new Eh(n.x,n.y),this.end=new Eh(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,s=this.start.y-this.end.y,l=Math.pow(Math.sin(s/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(o/2),2);if(this.g=2*Math.asin(Math.sqrt(l)),this.g===Math.PI)throw new Error("it appears "+n.view()+" and "+t.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+n+" and "+t)};TP.prototype.interpolate=function(n){var t=Math.sin((1-n)*this.g)/Math.sin(this.g),e=Math.sin(n*this.g)/Math.sin(this.g),o=t*Math.cos(this.start.y)*Math.cos(this.start.x)+e*Math.cos(this.end.y)*Math.cos(this.end.x),s=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),l=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),p=bP*Math.atan2(l,Math.sqrt(Math.pow(o,2)+Math.pow(s,2))),h=bP*Math.atan2(s,o);return[h,p]};TP.prototype.Arc=function(n,t){var e=[];if(!n||n<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var o=1/(n-1),s=0;s<n;++s){var l=o*s,p=this.interpolate(l);e.push(p)}for(var h=!1,g=0,m=t&&t.offset?t.offset:10,v=180-m,x=-180+m,E=360-m,b=1;b<e.length;++b){var T=e[b-1][0],I=e[b][0],S=Math.abs(I-T);S>E&&(I>v&&T<x||T>v&&I<x)?h=!0:S>g&&(g=S)}var w=[];if(h&&g<m){var R=[];w.push(R);for(var C=0;C<e.length;++C){var F=parseFloat(e[C][0]);if(C>0&&Math.abs(F-e[C-1][0])>E){var W=parseFloat(e[C-1][0]),X=parseFloat(e[C-1][1]),q=parseFloat(e[C][0]),D=parseFloat(e[C][1]);if(W>-180&&W<x&&q===180&&C+1<e.length&&e[C-1][0]>-180&&e[C-1][0]<x){R.push([-180,e[C][1]]),C++,R.push([e[C][0],e[C][1]]);continue}else if(W>v&&W<180&&q===-180&&C+1<e.length&&e[C-1][0]>v&&e[C-1][0]<180){R.push([180,e[C][1]]),C++,R.push([e[C][0],e[C][1]]);continue}if(W<x&&q>v){var xt=W;W=q,q=xt;var B=X;X=D,D=B}if(W>v&&q<x&&(q+=360),W<=180&&q>=180&&W<q){var j=(180-W)/(q-W),J=j*D+(1-j)*X;R.push([e[C-1][0]>v?180:-180,J]),R=[],R.push([e[C-1][0]>v?-180:180,J]),w.push(R)}else R=[],w.push(R);R.push([F,e[C][1]])}else R.push([e[C][0],e[C][1]])}}else{var Dt=[];w.push(Dt);for(var Q=0;Q<e.length;++Q)Dt.push([e[Q][0],e[Q][1]])}for(var At=new w_(this.properties),Mt=0;Mt<w.length;++Mt){var Lt=new AP;At.geometries.push(Lt);for(var pt=w[Mt],yt=0;yt<pt.length;++yt)Lt.move_to(pt[yt])}return At};var eY=sn(lg(),1);var tZ=sn(lg(),1);var eZ=sn(J_(),1);var iZ=sn(Xd(),1);var ln=[],cn=[],fn=[],hn=[],pn=[],dn=[],gn=[],mn=[],yn=[],vn=[],_n=[],xn=[],En=[],wn=[],Sn=[],Mn=[],bn=[],An=[],Tn=[],Cn=[],Pn=[],In=[],Rn=[],Ln=[];gn[85]=vn[85]=-1;mn[85]=_n[85]=0;yn[85]=xn[85]=1;Tn[85]=In[85]=1;Cn[85]=Rn[85]=0;Pn[85]=Ln[85]=1;ln[85]=hn[85]=0;cn[85]=pn[85]=-1;fn[85]=Sn[85]=0;Mn[85]=En[85]=0;bn[85]=wn[85]=1;dn[85]=An[85]=1;In[1]=In[169]=0;Rn[1]=Rn[169]=-1;Ln[1]=Ln[169]=0;En[1]=En[169]=-1;wn[1]=wn[169]=0;Sn[1]=Sn[169]=0;vn[4]=vn[166]=0;_n[4]=_n[166]=-1;xn[4]=xn[166]=1;Mn[4]=Mn[166]=1;bn[4]=bn[166]=0;An[4]=An[166]=0;gn[16]=gn[154]=0;mn[16]=mn[154]=1;yn[16]=yn[154]=1;hn[16]=hn[154]=1;pn[16]=pn[154]=0;dn[16]=dn[154]=1;Tn[64]=Tn[106]=0;Cn[64]=Cn[106]=1;Pn[64]=Pn[106]=0;ln[64]=ln[106]=-1;cn[64]=cn[106]=0;fn[64]=fn[106]=1;Tn[2]=Tn[168]=0;Cn[2]=Cn[168]=-1;Pn[2]=Pn[168]=1;In[2]=In[168]=0;Rn[2]=Rn[168]=-1;Ln[2]=Ln[168]=0;En[2]=En[168]=-1;wn[2]=wn[168]=0;Sn[2]=Sn[168]=0;Mn[2]=Mn[168]=-1;bn[2]=bn[168]=0;An[2]=An[168]=1;gn[8]=gn[162]=0;mn[8]=mn[162]=-1;yn[8]=yn[162]=0;vn[8]=vn[162]=0;_n[8]=_n[162]=-1;xn[8]=xn[162]=1;En[8]=En[162]=1;wn[8]=wn[162]=0;Sn[8]=Sn[162]=1;Mn[8]=Mn[162]=1;bn[8]=bn[162]=0;An[8]=An[162]=0;gn[32]=gn[138]=0;mn[32]=mn[138]=1;yn[32]=yn[138]=1;vn[32]=vn[138]=0;_n[32]=_n[138]=1;xn[32]=xn[138]=0;ln[32]=ln[138]=1;cn[32]=cn[138]=0;fn[32]=fn[138]=0;hn[32]=hn[138]=1;pn[32]=pn[138]=0;dn[32]=dn[138]=1;In[128]=In[42]=0;Rn[128]=Rn[42]=1;Ln[128]=Ln[42]=1;Tn[128]=Tn[42]=0;Cn[128]=Cn[42]=1;Pn[128]=Pn[42]=0;ln[128]=ln[42]=-1;cn[128]=cn[42]=0;fn[128]=fn[42]=1;hn[128]=hn[42]=-1;pn[128]=pn[42]=0;dn[128]=dn[42]=0;vn[5]=vn[165]=-1;_n[5]=_n[165]=0;xn[5]=xn[165]=0;In[5]=In[165]=1;Rn[5]=Rn[165]=0;Ln[5]=Ln[165]=0;Mn[20]=Mn[150]=0;bn[20]=bn[150]=1;An[20]=An[150]=1;hn[20]=hn[150]=0;pn[20]=pn[150]=-1;dn[20]=dn[150]=1;gn[80]=gn[90]=-1;mn[80]=mn[90]=0;yn[80]=yn[90]=1;Tn[80]=Tn[90]=1;Cn[80]=Cn[90]=0;Pn[80]=Pn[90]=1;En[65]=En[105]=0;wn[65]=wn[105]=1;Sn[65]=Sn[105]=0;ln[65]=ln[105]=0;cn[65]=cn[105]=-1;fn[65]=fn[105]=0;gn[160]=gn[10]=-1;mn[160]=mn[10]=0;yn[160]=yn[10]=1;vn[160]=vn[10]=-1;_n[160]=_n[10]=0;xn[160]=xn[10]=0;In[160]=In[10]=1;Rn[160]=Rn[10]=0;Ln[160]=Ln[10]=0;Tn[160]=Tn[10]=1;Cn[160]=Cn[10]=0;Pn[160]=Pn[10]=1;Mn[130]=Mn[40]=0;bn[130]=bn[40]=1;An[130]=An[40]=1;En[130]=En[40]=0;wn[130]=wn[40]=1;Sn[130]=Sn[40]=0;ln[130]=ln[40]=0;cn[130]=cn[40]=-1;fn[130]=fn[40]=0;hn[130]=hn[40]=0;pn[130]=pn[40]=-1;dn[130]=dn[40]=1;vn[37]=vn[133]=0;_n[37]=_n[133]=1;xn[37]=xn[133]=1;In[37]=In[133]=0;Rn[37]=Rn[133]=1;Ln[37]=Ln[133]=0;ln[37]=ln[133]=-1;cn[37]=cn[133]=0;fn[37]=fn[133]=0;hn[37]=hn[133]=1;pn[37]=pn[133]=0;dn[37]=dn[133]=0;Mn[148]=Mn[22]=-1;bn[148]=bn[22]=0;An[148]=An[22]=0;In[148]=In[22]=0;Rn[148]=Rn[22]=-1;Ln[148]=Ln[22]=1;Tn[148]=Tn[22]=0;Cn[148]=Cn[22]=1;Pn[148]=Pn[22]=1;hn[148]=hn[22]=-1;pn[148]=pn[22]=0;dn[148]=dn[22]=1;gn[82]=gn[88]=0;mn[82]=mn[88]=-1;yn[82]=yn[88]=1;Mn[82]=Mn[88]=1;bn[82]=bn[88]=0;An[82]=An[88]=1;En[82]=En[88]=-1;wn[82]=wn[88]=0;Sn[82]=Sn[88]=1;Tn[82]=Tn[88]=0;Cn[82]=Cn[88]=-1;Pn[82]=Pn[88]=0;gn[73]=gn[97]=0;mn[73]=mn[97]=1;yn[73]=yn[97]=0;vn[73]=vn[97]=0;_n[73]=_n[97]=-1;xn[73]=xn[97]=0;En[73]=En[97]=1;wn[73]=wn[97]=0;Sn[73]=Sn[97]=0;ln[73]=ln[97]=1;cn[73]=cn[97]=0;fn[73]=fn[97]=1;gn[145]=gn[25]=0;mn[145]=mn[25]=-1;yn[145]=yn[25]=0;En[145]=En[25]=1;wn[145]=wn[25]=0;Sn[145]=Sn[25]=1;In[145]=In[25]=0;Rn[145]=Rn[25]=1;Ln[145]=Ln[25]=1;hn[145]=hn[25]=-1;pn[145]=pn[25]=0;dn[145]=dn[25]=0;vn[70]=vn[100]=0;_n[70]=_n[100]=1;xn[70]=xn[100]=0;Mn[70]=Mn[100]=-1;bn[70]=bn[100]=0;An[70]=An[100]=1;Tn[70]=Tn[100]=0;Cn[70]=Cn[100]=-1;Pn[70]=Pn[100]=1;ln[70]=ln[100]=1;cn[70]=cn[100]=0;fn[70]=fn[100]=0;vn[101]=vn[69]=0;_n[101]=_n[69]=1;xn[101]=xn[69]=0;ln[101]=ln[69]=1;cn[101]=cn[69]=0;fn[101]=fn[69]=0;In[149]=In[21]=0;Rn[149]=Rn[21]=1;Ln[149]=Ln[21]=1;hn[149]=hn[21]=-1;pn[149]=pn[21]=0;dn[149]=dn[21]=0;Mn[86]=Mn[84]=-1;bn[86]=bn[84]=0;An[86]=An[84]=1;Tn[86]=Tn[84]=0;Cn[86]=Cn[84]=-1;Pn[86]=Pn[84]=1;gn[89]=gn[81]=0;mn[89]=mn[81]=-1;yn[89]=yn[81]=0;En[89]=En[81]=1;wn[89]=wn[81]=0;Sn[89]=Sn[81]=1;gn[96]=gn[74]=0;mn[96]=mn[74]=1;yn[96]=yn[74]=0;vn[96]=vn[74]=-1;_n[96]=_n[74]=0;xn[96]=xn[74]=1;Tn[96]=Tn[74]=1;Cn[96]=Cn[74]=0;Pn[96]=Pn[74]=0;ln[96]=ln[74]=1;cn[96]=cn[74]=0;fn[96]=fn[74]=1;gn[24]=gn[146]=0;mn[24]=mn[146]=-1;yn[24]=yn[146]=1;Mn[24]=Mn[146]=1;bn[24]=bn[146]=0;An[24]=An[146]=1;En[24]=En[146]=0;wn[24]=wn[146]=1;Sn[24]=Sn[146]=1;hn[24]=hn[146]=0;pn[24]=pn[146]=-1;dn[24]=dn[146]=0;vn[6]=vn[164]=-1;_n[6]=_n[164]=0;xn[6]=xn[164]=1;Mn[6]=Mn[164]=-1;bn[6]=bn[164]=0;An[6]=An[164]=0;In[6]=In[164]=0;Rn[6]=Rn[164]=-1;Ln[6]=Ln[164]=1;Tn[6]=Tn[164]=1;Cn[6]=Cn[164]=0;Pn[6]=Pn[164]=0;En[129]=En[41]=0;wn[129]=wn[41]=1;Sn[129]=Sn[41]=1;In[129]=In[41]=0;Rn[129]=Rn[41]=1;Ln[129]=Ln[41]=0;ln[129]=ln[41]=-1;cn[129]=cn[41]=0;fn[129]=fn[41]=0;hn[129]=hn[41]=0;pn[129]=pn[41]=-1;dn[129]=dn[41]=0;Mn[66]=Mn[104]=0;bn[66]=bn[104]=1;An[66]=An[104]=0;En[66]=En[104]=-1;wn[66]=wn[104]=0;Sn[66]=Sn[104]=1;Tn[66]=Tn[104]=0;Cn[66]=Cn[104]=-1;Pn[66]=Pn[104]=0;ln[66]=ln[104]=0;cn[66]=cn[104]=-1;fn[66]=fn[104]=1;gn[144]=gn[26]=-1;mn[144]=mn[26]=0;yn[144]=yn[26]=0;In[144]=In[26]=1;Rn[144]=Rn[26]=0;Ln[144]=Ln[26]=1;Tn[144]=Tn[26]=0;Cn[144]=Cn[26]=1;Pn[144]=Pn[26]=1;hn[144]=hn[26]=-1;pn[144]=pn[26]=0;dn[144]=dn[26]=1;vn[36]=vn[134]=0;_n[36]=_n[134]=1;xn[36]=xn[134]=1;Mn[36]=Mn[134]=0;bn[36]=bn[134]=1;An[36]=An[134]=0;ln[36]=ln[134]=0;cn[36]=cn[134]=-1;fn[36]=fn[134]=1;hn[36]=hn[134]=1;pn[36]=pn[134]=0;dn[36]=dn[134]=0;gn[9]=gn[161]=-1;mn[9]=mn[161]=0;yn[9]=yn[161]=0;vn[9]=vn[161]=0;_n[9]=_n[161]=-1;xn[9]=xn[161]=0;En[9]=En[161]=1;wn[9]=wn[161]=0;Sn[9]=Sn[161]=0;In[9]=In[161]=1;Rn[9]=Rn[161]=0;Ln[9]=Ln[161]=1;gn[136]=0;mn[136]=1;yn[136]=1;vn[136]=0;_n[136]=1;xn[136]=0;Mn[136]=-1;bn[136]=0;An[136]=1;En[136]=-1;wn[136]=0;Sn[136]=0;In[136]=0;Rn[136]=-1;Ln[136]=0;Tn[136]=0;Cn[136]=-1;Pn[136]=1;ln[136]=1;cn[136]=0;fn[136]=0;hn[136]=1;pn[136]=0;dn[136]=1;gn[34]=0;mn[34]=-1;yn[34]=0;vn[34]=0;_n[34]=-1;xn[34]=1;Mn[34]=1;bn[34]=0;An[34]=0;En[34]=1;wn[34]=0;Sn[34]=1;In[34]=0;Rn[34]=1;Ln[34]=1;Tn[34]=0;Cn[34]=1;Pn[34]=0;ln[34]=-1;cn[34]=0;fn[34]=1;hn[34]=-1;pn[34]=0;dn[34]=0;gn[35]=0;mn[35]=1;yn[35]=1;vn[35]=0;_n[35]=-1;xn[35]=1;Mn[35]=1;bn[35]=0;An[35]=0;En[35]=-1;wn[35]=0;Sn[35]=0;In[35]=0;Rn[35]=-1;Ln[35]=0;Tn[35]=0;Cn[35]=1;Pn[35]=0;ln[35]=-1;cn[35]=0;fn[35]=1;hn[35]=1;pn[35]=0;dn[35]=1;gn[153]=0;mn[153]=1;yn[153]=1;En[153]=-1;wn[153]=0;Sn[153]=0;In[153]=0;Rn[153]=-1;Ln[153]=0;hn[153]=1;pn[153]=0;dn[153]=1;vn[102]=0;_n[102]=-1;xn[102]=1;Mn[102]=1;bn[102]=0;An[102]=0;Tn[102]=0;Cn[102]=1;Pn[102]=0;ln[102]=-1;cn[102]=0;fn[102]=1;gn[155]=0;mn[155]=-1;yn[155]=0;En[155]=1;wn[155]=0;Sn[155]=1;In[155]=0;Rn[155]=1;Ln[155]=1;hn[155]=-1;pn[155]=0;dn[155]=0;vn[103]=0;_n[103]=1;xn[103]=0;Mn[103]=-1;bn[103]=0;An[103]=1;Tn[103]=0;Cn[103]=-1;Pn[103]=1;ln[103]=1;cn[103]=0;fn[103]=0;gn[152]=0;mn[152]=1;yn[152]=1;Mn[152]=-1;bn[152]=0;An[152]=1;En[152]=-1;wn[152]=0;Sn[152]=0;In[152]=0;Rn[152]=-1;Ln[152]=0;Tn[152]=0;Cn[152]=-1;Pn[152]=1;hn[152]=1;pn[152]=0;dn[152]=1;gn[156]=0;mn[156]=-1;yn[156]=1;Mn[156]=1;bn[156]=0;An[156]=1;En[156]=-1;wn[156]=0;Sn[156]=0;In[156]=0;Rn[156]=-1;Ln[156]=0;Tn[156]=0;Cn[156]=1;Pn[156]=1;hn[156]=-1;pn[156]=0;dn[156]=1;gn[137]=0;mn[137]=1;yn[137]=1;vn[137]=0;_n[137]=1;xn[137]=0;En[137]=-1;wn[137]=0;Sn[137]=0;In[137]=0;Rn[137]=-1;Ln[137]=0;ln[137]=1;cn[137]=0;fn[137]=0;hn[137]=1;pn[137]=0;dn[137]=1;gn[139]=0;mn[139]=1;yn[139]=1;vn[139]=0;_n[139]=-1;xn[139]=0;En[139]=1;wn[139]=0;Sn[139]=0;In[139]=0;Rn[139]=1;Ln[139]=0;ln[139]=-1;cn[139]=0;fn[139]=0;hn[139]=1;pn[139]=0;dn[139]=1;gn[98]=0;mn[98]=-1;yn[98]=0;vn[98]=0;_n[98]=-1;xn[98]=1;Mn[98]=1;bn[98]=0;An[98]=0;En[98]=1;wn[98]=0;Sn[98]=1;Tn[98]=0;Cn[98]=1;Pn[98]=0;ln[98]=-1;cn[98]=0;fn[98]=1;gn[99]=0;mn[99]=1;yn[99]=0;vn[99]=0;_n[99]=-1;xn[99]=1;Mn[99]=1;bn[99]=0;An[99]=0;En[99]=-1;wn[99]=0;Sn[99]=1;Tn[99]=0;Cn[99]=-1;Pn[99]=0;ln[99]=1;cn[99]=0;fn[99]=1;vn[38]=0;_n[38]=-1;xn[38]=1;Mn[38]=1;bn[38]=0;An[38]=0;In[38]=0;Rn[38]=1;Ln[38]=1;Tn[38]=0;Cn[38]=1;Pn[38]=0;ln[38]=-1;cn[38]=0;fn[38]=1;hn[38]=-1;pn[38]=0;dn[38]=0;vn[39]=0;_n[39]=1;xn[39]=1;Mn[39]=-1;bn[39]=0;An[39]=0;In[39]=0;Rn[39]=-1;Ln[39]=1;Tn[39]=0;Cn[39]=1;Pn[39]=0;ln[39]=-1;cn[39]=0;fn[39]=1;hn[39]=1;pn[39]=0;dn[39]=0;var K_=function(n){return[[n.bottomleft,0],[0,0],[0,n.leftbottom]]},j_=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0]]},Q_=function(n){return[[n.topright,1],[1,1],[1,n.righttop]]},t1=function(n){return[[0,n.lefttop],[0,1],[n.topleft,1]]},e1=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop]]},n1=function(n){return[[n.bottomright,0],[n.bottomleft,0],[1,n.righttop],[1,n.rightbottom]]},r1=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.topleft,1],[n.topright,1]]},i1=function(n){return[[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},oZ=function(n){return[[0,0],[0,n.leftbottom],[1,n.rightbottom],[1,0]]},sZ=function(n){return[[1,0],[n.bottomright,0],[n.topright,1],[1,1]]},aZ=function(n){return[[1,1],[1,n.righttop],[0,n.lefttop],[0,1]]},uZ=function(n){return[[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},lZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.leftbottom],[0,n.lefttop]]},cZ=function(n){return[[n.topleft,1],[n.topright,1],[n.bottomright,0],[n.bottomleft,0]]},fZ=function(){return[[0,0],[0,1],[1,1],[1,0]]},hZ=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,1],[n.topleft,1]]},pZ=function(n){return[[n.topright,1],[1,1],[1,0],[0,0],[0,n.leftbottom]]},dZ=function(n){return[[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[1,1]]},gZ=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,1]]},mZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.lefttop],[0,1],[n.topleft,1]]},yZ=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[n.topright,1]]},vZ=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop]]},_Z=function(n){return[[n.topright,1],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1]]},xZ=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},EZ=function(n){return[[1,1],[1,n.righttop],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},wZ=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[n.topleft,1],[n.topright,1]]},SZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom]]},MZ=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},bZ=function(n){return[[1,1],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},AZ=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1]]},TZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},CZ=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},PZ=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},IZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},RZ=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},LZ=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},NZ=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},OZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},DZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},FZ=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},Un=[],Bn=[],zn=[],Gn=[],kn=[],qn=[],Hn=[],Vn=[];Gn[1]=kn[1]=18;Gn[169]=kn[169]=18;zn[4]=Bn[4]=12;zn[166]=Bn[166]=12;Un[16]=Vn[16]=4;Un[154]=Vn[154]=4;qn[64]=Hn[64]=22;qn[106]=Hn[106]=22;zn[2]=qn[2]=17;Gn[2]=kn[2]=18;zn[168]=qn[168]=17;Gn[168]=kn[168]=18;Un[8]=Gn[8]=9;Bn[8]=zn[8]=12;Un[162]=Gn[162]=9;Bn[162]=zn[162]=12;Un[32]=Vn[32]=4;Bn[32]=Hn[32]=1;Un[138]=Vn[138]=4;Bn[138]=Hn[138]=1;kn[128]=Vn[128]=21;qn[128]=Hn[128]=22;kn[42]=Vn[42]=21;qn[42]=Hn[42]=22;Bn[5]=kn[5]=14;Bn[165]=kn[165]=14;zn[20]=Vn[20]=6;zn[150]=Vn[150]=6;Un[80]=qn[80]=11;Un[90]=qn[90]=11;Gn[65]=Hn[65]=3;Gn[105]=Hn[105]=3;Un[160]=qn[160]=11;Bn[160]=kn[160]=14;Un[10]=qn[10]=11;Bn[10]=kn[10]=14;zn[130]=Vn[130]=6;Gn[130]=Hn[130]=3;zn[40]=Vn[40]=6;Gn[40]=Hn[40]=3;Bn[101]=Hn[101]=1;Bn[69]=Hn[69]=1;kn[149]=Vn[149]=21;kn[21]=Vn[21]=21;zn[86]=qn[86]=17;zn[84]=qn[84]=17;Un[89]=Gn[89]=9;Un[81]=Gn[81]=9;Un[96]=Hn[96]=0;Bn[96]=qn[96]=15;Un[74]=Hn[74]=0;Bn[74]=qn[74]=15;Un[24]=zn[24]=8;Gn[24]=Vn[24]=7;Un[146]=zn[146]=8;Gn[146]=Vn[146]=7;Bn[6]=qn[6]=15;zn[6]=kn[6]=16;Bn[164]=qn[164]=15;zn[164]=kn[164]=16;Gn[129]=Vn[129]=7;kn[129]=Hn[129]=20;Gn[41]=Vn[41]=7;kn[41]=Hn[41]=20;zn[66]=Hn[66]=2;Gn[66]=qn[66]=19;zn[104]=Hn[104]=2;Gn[104]=qn[104]=19;Un[144]=kn[144]=10;qn[144]=Vn[144]=23;Un[26]=kn[26]=10;qn[26]=Vn[26]=23;Bn[36]=Vn[36]=5;zn[36]=Hn[36]=2;Bn[134]=Vn[134]=5;zn[134]=Hn[134]=2;Un[9]=kn[9]=10;Bn[9]=Gn[9]=13;Un[161]=kn[161]=10;Bn[161]=Gn[161]=13;Bn[37]=Vn[37]=5;kn[37]=Hn[37]=20;Bn[133]=Vn[133]=5;kn[133]=Hn[133]=20;zn[148]=kn[148]=16;qn[148]=Vn[148]=23;zn[22]=kn[22]=16;qn[22]=Vn[22]=23;Un[82]=zn[82]=8;Gn[82]=qn[82]=19;Un[88]=zn[88]=8;Gn[88]=qn[88]=19;Un[73]=Hn[73]=0;Bn[73]=Gn[73]=13;Un[97]=Hn[97]=0;Bn[97]=Gn[97]=13;Un[145]=Gn[145]=9;kn[145]=Vn[145]=21;Un[25]=Gn[25]=9;kn[25]=Vn[25]=21;Bn[70]=Hn[70]=1;zn[70]=qn[70]=17;Bn[100]=Hn[100]=1;zn[100]=qn[100]=17;Un[34]=Gn[34]=9;Bn[34]=zn[34]=12;kn[34]=Vn[34]=21;qn[34]=Hn[34]=22;Un[136]=Vn[136]=4;Bn[136]=Hn[136]=1;zn[136]=qn[136]=17;Gn[136]=kn[136]=18;Un[35]=Vn[35]=4;Bn[35]=zn[35]=12;Gn[35]=kn[35]=18;qn[35]=Hn[35]=22;Un[153]=Vn[153]=4;Gn[153]=kn[153]=18;Bn[102]=zn[102]=12;qn[102]=Hn[102]=22;Un[155]=Gn[155]=9;kn[155]=Vn[155]=23;Bn[103]=Hn[103]=1;zn[103]=qn[103]=17;Un[152]=Vn[152]=4;zn[152]=qn[152]=17;Gn[152]=kn[152]=18;Un[156]=zn[156]=8;Gn[156]=kn[156]=18;qn[156]=Vn[156]=23;Un[137]=Vn[137]=4;Bn[137]=Hn[137]=1;Gn[137]=kn[137]=18;Un[139]=Vn[139]=4;Bn[139]=Gn[139]=13;kn[139]=Hn[139]=20;Un[98]=Gn[98]=9;Bn[98]=zn[98]=12;qn[98]=Hn[98]=22;Un[99]=Hn[99]=0;Bn[99]=zn[99]=12;Gn[99]=qn[99]=19;Bn[38]=zn[38]=12;kn[38]=Vn[38]=21;qn[38]=Hn[38]=22;Bn[39]=Vn[39]=5;zn[39]=kn[39]=16;qn[39]=Hn[39]=22;var re=[];re[1]=re[169]=K_;re[4]=re[166]=j_;re[16]=re[154]=Q_;re[64]=re[106]=t1;re[168]=re[2]=e1;re[162]=re[8]=n1;re[138]=re[32]=r1;re[42]=re[128]=i1;re[5]=re[165]=oZ;re[20]=re[150]=sZ;re[80]=re[90]=aZ;re[65]=re[105]=uZ;re[160]=re[10]=lZ;re[130]=re[40]=cZ;re[85]=fZ;re[101]=re[69]=hZ;re[149]=re[21]=pZ;re[86]=re[84]=dZ;re[89]=re[81]=gZ;re[96]=re[74]=mZ;re[24]=re[146]=yZ;re[6]=re[164]=vZ;re[129]=re[41]=_Z;re[66]=re[104]=xZ;re[144]=re[26]=EZ;re[36]=re[134]=wZ;re[9]=re[161]=SZ;re[37]=re[133]=MZ;re[148]=re[22]=bZ;re[82]=re[88]=AZ;re[73]=re[97]=TZ;re[145]=re[25]=CZ;re[70]=re[100]=PZ;re[34]=function(n){return[i1(n),n1(n)]};re[35]=IZ;re[136]=function(n){return[r1(n),e1(n)]};re[153]=function(n){return[Q_(n),K_(n)]};re[102]=function(n){return[j_(n),t1(n)]};re[155]=RZ;re[103]=LZ;re[152]=function(n){return[Q_(n),e1(n)]};re[156]=NZ;re[137]=function(n){return[r1(n),K_(n)]};re[139]=OZ;re[98]=function(n){return[n1(n),t1(n)]};re[99]=DZ;re[38]=function(n){return[j_(n),i1(n)]};re[39]=FZ;function BZ(n){return(n>0)-(n<0)||+n}function ff(n,t,e){var o=t[0]-n[0],s=t[1]-n[1],l=e[0]-t[0],p=e[1]-t[1];return BZ(o*p-l*s)}function dL(n,t){var e=n.geometry.coordinates[0].map(function(p){return p[0]}),o=n.geometry.coordinates[0].map(function(p){return p[1]}),s=t.geometry.coordinates[0].map(function(p){return p[0]}),l=t.geometry.coordinates[0].map(function(p){return p[1]});return Math.max.apply(null,e)===Math.max.apply(null,s)&&Math.max.apply(null,o)===Math.max.apply(null,l)&&Math.min.apply(null,e)===Math.min.apply(null,s)&&Math.min.apply(null,o)===Math.min.apply(null,l)}function o1(n,t){return t.geometry.coordinates[0].every(function(e){return ki(Pr(e),n)})}function gL(n,t){return n[0]===t[0]&&n[1]===t[1]}var zZ=function(){function n(t){this.id=n.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return n.buildId=function(t){return t.join(",")},n.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},n.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},n.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},n.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,o){var s=e.to,l=o.to;if(s.coordinates[0]-t.coordinates[0]>=0&&l.coordinates[0]-t.coordinates[0]<0)return 1;if(s.coordinates[0]-t.coordinates[0]<0&&l.coordinates[0]-t.coordinates[0]>=0)return-1;if(s.coordinates[0]-t.coordinates[0]===0&&l.coordinates[0]-t.coordinates[0]===0)return s.coordinates[1]-t.coordinates[1]>=0||l.coordinates[1]-t.coordinates[1]>=0?s.coordinates[1]-l.coordinates[1]:l.coordinates[1]-s.coordinates[1];var p=ff(t.coordinates,s.coordinates,l.coordinates);if(p<0)return 1;if(p>0)return-1;var h=Math.pow(s.coordinates[0]-t.coordinates[0],2)+Math.pow(s.coordinates[1]-t.coordinates[1],2),g=Math.pow(l.coordinates[0]-t.coordinates[0],2)+Math.pow(l.coordinates[1]-t.coordinates[1],2);return h-g}),this.outerEdgesSorted=!0)},n.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},n.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},n.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},n}(),s1=zZ;var GZ=function(){function n(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return n.prototype.getSymetric=function(){return this.symetric||(this.symetric=new n(this.to,this.from),this.symetric.symetric=this),this.symetric},n.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},n.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},n.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},n.prototype.toLineString=function(){return Gi([this.from.coordinates,this.to.coordinates])},n.prototype.compareTo=function(t){return ff(t.from.coordinates,t.to.coordinates,this.to.coordinates)},n}(),mL=GZ;var kZ=function(){function n(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return n.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},n.prototype.get=function(t){return this.edges[t]},Object.defineProperty(n.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),n.prototype.forEach=function(t){this.edges.forEach(t)},n.prototype.map=function(t){return this.edges.map(t)},n.prototype.some=function(t){return this.edges.some(t)},n.prototype.isValid=function(){return!0},n.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(p,h,g){return h.from.coordinates[1]>t.edges[p].from.coordinates[1]&&(p=g),p},0),o=(e===0?this.length:e)-1,s=(e+1)%this.length,l=ff(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[s].from.coordinates);return l===0?this.edges[o].from.coordinates[0]>this.edges[s].from.coordinates[0]:l>0},n.prototype.toMultiPoint=function(){return Uv(this.edges.map(function(t){return t.from.coordinates}))},n.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map(function(e){return e.from.coordinates});return t.push(this.edges[0].from.coordinates),this.polygon=Dr([t])},n.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=n_(this.toPolygon())},n.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),s,l;return e.forEach(function(p){var h=p.getEnvelope();if(l&&(s=l.getEnvelope()),!dL(h,o)&&o1(h,o)){for(var g=t.map(function(T){return T.from.coordinates}),m=void 0,v=function(T){p.some(function(I){return gL(T,I.from.coordinates)})||(m=T)},x=0,E=g;x<E.length;x++){var b=E[x];v(b)}m&&p.inside(Pr(m))&&(!l||o1(s,h))&&(l=p)}}),l},n.prototype.inside=function(t){return ki(t,this.toPolygon())},n}(),a1=kZ;function qZ(n){if(!n)throw new Error("No geojson passed");if(n.type!=="FeatureCollection"&&n.type!=="GeometryCollection"&&n.type!=="MultiLineString"&&n.type!=="LineString"&&n.type!=="Feature")throw new Error("Invalid input type '"+n.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var lct=function(){function n(){this.edges=[],this.nodes={}}return n.fromGeoJson=function(t){qZ(t);var e=new n;return ys(t,function(o){zv(o,"LineString","Graph::fromGeoJson"),TC(o,function(s,l){if(s){var p=e.getNode(s),h=e.getNode(l);e.addEdge(p,h)}return l})}),e},n.prototype.getNode=function(t){var e=s1.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new s1(t)),o},n.prototype.addEdge=function(t,e){var o=new mL(t,e),s=o.getSymetric();this.edges.push(o),this.edges.push(s)},n.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},n.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var o=t.getOuterEdges().map(function(s){return s.to});this.removeNode(t),o.forEach(function(s){return e._removeIfDangle(s)})}},n.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))})},n.prototype._computeNextCWEdges=function(t){var e=this;typeof t=="undefined"?Object.keys(this.nodes).forEach(function(o){return e._computeNextCWEdges(e.nodes[o])}):t.getOuterEdges().forEach(function(o,s){t.getOuterEdge((s===0?t.getOuterEdges().length:s)-1).symetric.next=o})},n.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),s,l,p=o.length-1;p>=0;--p){var h=o[p],g=h.symetric,m=void 0,v=void 0;h.label===e&&(m=h),g.label===e&&(v=g),!(!m||!v)&&(v&&(l=v),m&&(l&&(l.next=m,l=void 0),s||(s=m)))}l&&(l.next=s)},n.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var s=o;do s.label=e,s=s.next;while(!o.isEqual(s));e++}}),t},n.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(o){o.label=void 0}),this._findLabeledEdgeRings().forEach(function(o){t._findIntersectionNodes(o).forEach(function(s){t._computeNextCCWEdges(s,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},n.prototype._findIntersectionNodes=function(t){var e=[],o=t,s=function(){var l=0;o.from.getOuterEdges().forEach(function(p){p.label===t.label&&++l}),l>1&&e.push(o.from),o=o.next};do s();while(!t.isEqual(o));return e},n.prototype._findEdgeRing=function(t){var e=t,o=new a1;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},n.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(o){return e.removeEdge(o)}),t.innerEdges.forEach(function(o){return e.removeEdge(o)}),delete this.nodes[t.id]},n.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},n}();var XZ=sn(u1(),1);var YZ=sn(u1(),1);var ZZ=sn(bL(),1);var nJ=sn(DL(),1);function UL(n){for(var t=n,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function iJ(){return new BL(function(n){return n.f})}var h1={search:function(n,t,e,o){n.cleanDirty(),o=o||{};var s=o.heuristic||h1.heuristics.manhattan,l=o.closest||!1,p=iJ(),h=t;for(t.h=s(t,e),p.push(t);p.size()>0;){var g=p.pop();if(g===e)return UL(g);g.closed=!0;for(var m=n.neighbors(g),v=0,x=m.length;v<x;++v){var E=m[v];if(!(E.closed||E.isWall())){var b=g.g+E.getCost(g),T=E.visited;(!T||b<E.g)&&(E.visited=!0,E.parent=g,E.h=E.h||s(E,e),E.g=b,E.f=E.g+E.h,n.markDirty(E),l&&(E.h<h.h||E.h===h.h&&E.g<h.g)&&(h=E),T?p.rescoreElement(E):p.push(E))}}}return l?UL(h):[]},heuristics:{manhattan:function(n,t){var e=Math.abs(t.x-n.x),o=Math.abs(t.y-n.y);return e+o},diagonal:function(n,t){var e=1,o=Math.sqrt(2),s=Math.abs(t.x-n.x),l=Math.abs(t.y-n.y);return e*(s+l)+(o-2*e)*Math.min(s,l)}},cleanNode:function(n){n.f=0,n.g=0,n.h=0,n.visited=!1,n.closed=!1,n.parent=null}};function Ih(n,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<n.length;e++){this.grid[e]=[];for(var o=0,s=n[e];o<s.length;o++){var l=new Fg(e,o,s[o]);this.grid[e][o]=l,this.nodes.push(l)}}this.init()}Ih.prototype.init=function(){this.dirtyNodes=[];for(var n=0;n<this.nodes.length;n++)h1.cleanNode(this.nodes[n])};Ih.prototype.cleanDirty=function(){for(var n=0;n<this.dirtyNodes.length;n++)h1.cleanNode(this.dirtyNodes[n]);this.dirtyNodes=[]};Ih.prototype.markDirty=function(n){this.dirtyNodes.push(n)};Ih.prototype.neighbors=function(n){var t=[],e=n.x,o=n.y,s=this.grid;return s[e-1]&&s[e-1][o]&&t.push(s[e-1][o]),s[e+1]&&s[e+1][o]&&t.push(s[e+1][o]),s[e]&&s[e][o-1]&&t.push(s[e][o-1]),s[e]&&s[e][o+1]&&t.push(s[e][o+1]),this.diagonal&&(s[e-1]&&s[e-1][o-1]&&t.push(s[e-1][o-1]),s[e+1]&&s[e+1][o-1]&&t.push(s[e+1][o-1]),s[e-1]&&s[e-1][o+1]&&t.push(s[e-1][o+1]),s[e+1]&&s[e+1][o+1]&&t.push(s[e+1][o+1])),t};Ih.prototype.toString=function(){for(var n=[],t=this.grid,e,o,s,l,p=0,h=t.length;p<h;p++){for(e=[],o=t[p],s=0,l=o.length;s<l;s++)e.push(o[s].weight);n.push(e.join(" "))}return n.join(\`
27665
- \`)};function Fg(n,t,e){this.x=n,this.y=t,this.weight=e}Fg.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Fg.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};Fg.prototype.isWall=function(){return this.weight===0};function BL(n){this.content=[],this.scoreFunction=n}BL.prototype={push:function(n){this.content.push(n),this.sinkDown(this.content.length-1)},pop:function(){var n=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),n},remove:function(n){var t=this.content.indexOf(n),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(n)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(n){this.sinkDown(this.content.indexOf(n))},sinkDown:function(n){for(var t=this.content[n];n>0;){var e=(n+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[n]=o,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],o=this.scoreFunction(e);;){var s=n+1<<1,l=s-1,p=null,h;if(l<t){var g=this.content[l];h=this.scoreFunction(g),h<o&&(p=l)}if(s<t){var m=this.content[s],v=this.scoreFunction(m);v<(p===null?o:h)&&(p=s)}if(p!==null)this.content[n]=this.content[p],this.content[p]=e,n=p;else break}}};function p1(){this._=null}function pf(n){n.U=n.C=n.L=n.R=n.P=n.N=null}p1.prototype={constructor:p1,insert:function(n,t){var e,o,s;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=zL(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)o=e.U,e===o.L?(s=o.R,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.R&&(Rh(this,e),n=e,e=n.U),e.C=!1,o.C=!0,Lh(this,o))):(s=o.L,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.L&&(Lh(this,e),n=e,e=n.U),e.C=!1,o.C=!0,Rh(this,o))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t=n.U,e,o=n.L,s=n.R,l,p;if(o?s?l=zL(s):l=o:l=s,t?t.L===n?t.L=l:t.R=l:this._=l,o&&s?(p=l.C,l.C=n.C,l.L=o,o.U=l,l!==s?(t=l.U,l.U=n.U,n=l.R,t.L=n,l.R=s,s.U=l):(l.U=t,t=l,n=l.R)):(p=n.C,n=l),n&&(n.U=t),!p){if(n&&n.C){n.C=!1;return}do{if(n===this._)break;if(n===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,Rh(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,Lh(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Rh(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,Lh(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,Rh(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,Lh(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function Rh(n,t){var e=t,o=t.R,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function Lh(n,t){var e=t,o=t.L,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function zL(n){for(;n.L;)n=n.L;return n}var d1=p1;function df(n,t,e,o){var s=[null,null],l=Hi.push(s)-1;return s.left=n,s.right=t,e&&Nh(s,n,t,e),o&&Nh(s,t,n,o),To[n.index].halfedges.push(l),To[t.index].halfedges.push(l),s}function gf(n,t,e){var o=[t,e];return o.left=n,o}function Nh(n,t,e,o){!n[0]&&!n[1]?(n[0]=o,n.left=t,n.right=e):n.left===e?n[1]=o:n[0]=o}function oJ(n,t,e,o,s){var l=n[0],p=n[1],h=l[0],g=l[1],m=p[0],v=p[1],x=0,E=1,b=m-h,T=v-g,I;if(I=t-h,!(!b&&I>0)){if(I/=b,b<0){if(I<x)return;I<E&&(E=I)}else if(b>0){if(I>E)return;I>x&&(x=I)}if(I=o-h,!(!b&&I<0)){if(I/=b,b<0){if(I>E)return;I>x&&(x=I)}else if(b>0){if(I<x)return;I<E&&(E=I)}if(I=e-g,!(!T&&I>0)){if(I/=T,T<0){if(I<x)return;I<E&&(E=I)}else if(T>0){if(I>E)return;I>x&&(x=I)}if(I=s-g,!(!T&&I<0)){if(I/=T,T<0){if(I>E)return;I>x&&(x=I)}else if(T>0){if(I<x)return;I<E&&(E=I)}return!(x>0)&&!(E<1)||(x>0&&(n[0]=[h+x*b,g+x*T]),E<1&&(n[1]=[h+E*b,g+E*T])),!0}}}}}function sJ(n,t,e,o,s){var l=n[1];if(l)return!0;var p=n[0],h=n.left,g=n.right,m=h[0],v=h[1],x=g[0],E=g[1],b=(m+x)/2,T=(v+E)/2,I,S;if(E===v){if(b<t||b>=o)return;if(m>x){if(!p)p=[b,e];else if(p[1]>=s)return;l=[b,s]}else{if(!p)p=[b,s];else if(p[1]<e)return;l=[b,e]}}else if(I=(m-x)/(E-v),S=T-I*b,I<-1||I>1)if(m>x){if(!p)p=[(e-S)/I,e];else if(p[1]>=s)return;l=[(s-S)/I,s]}else{if(!p)p=[(s-S)/I,s];else if(p[1]<e)return;l=[(e-S)/I,e]}else if(v<E){if(!p)p=[t,I*t+S];else if(p[0]>=o)return;l=[o,I*o+S]}else{if(!p)p=[o,I*o+S];else if(p[0]<t)return;l=[t,I*t+S]}return n[0]=p,n[1]=l,!0}function GL(n,t,e,o){for(var s=Hi.length,l;s--;)(!sJ(l=Hi[s],n,t,e,o)||!oJ(l,n,t,e,o)||!(Math.abs(l[0][0]-l[1][0])>Er||Math.abs(l[0][1]-l[1][1])>Er))&&delete Hi[s]}function kL(n){return To[n.index]={site:n,halfedges:[]}}function aJ(n,t){var e=n.site,o=t.left,s=t.right;return e===s&&(s=o,o=e),s?Math.atan2(s[1]-o[1],s[0]-o[0]):(e===o?(o=t[1],s=t[0]):(o=t[0],s=t[1]),Math.atan2(o[0]-s[0],s[1]-o[1]))}function g1(n,t){return t[+(t.left!==n.site)]}function uJ(n,t){return t[+(t.left===n.site)]}function qL(){for(var n=0,t=To.length,e,o,s,l;n<t;++n)if((e=To[n])&&(l=(o=e.halfedges).length)){var p=new Array(l),h=new Array(l);for(s=0;s<l;++s)p[s]=s,h[s]=aJ(e,Hi[o[s]]);for(p.sort(function(g,m){return h[m]-h[g]}),s=0;s<l;++s)h[s]=o[p[s]];for(s=0;s<l;++s)o[s]=h[s]}}function HL(n,t,e,o){var s=To.length,l,p,h,g,m,v,x,E,b,T,I,S,w=!0;for(l=0;l<s;++l)if(p=To[l]){for(h=p.site,m=p.halfedges,g=m.length;g--;)Hi[m[g]]||m.splice(g,1);for(g=0,v=m.length;g<v;)T=uJ(p,Hi[m[g]]),I=T[0],S=T[1],x=g1(p,Hi[m[++g%v]]),E=x[0],b=x[1],(Math.abs(I-E)>Er||Math.abs(S-b)>Er)&&(m.splice(g,0,Hi.push(gf(h,T,Math.abs(I-n)<Er&&o-S>Er?[n,Math.abs(E-n)<Er?b:o]:Math.abs(S-o)<Er&&e-I>Er?[Math.abs(b-o)<Er?E:e,o]:Math.abs(I-e)<Er&&S-t>Er?[e,Math.abs(E-e)<Er?b:t]:Math.abs(S-t)<Er&&I-n>Er?[Math.abs(b-t)<Er?E:n,t]:null))-1),++v);v&&(w=!1)}if(w){var R,C,F,W=1/0;for(l=0,w=null;l<s;++l)(p=To[l])&&(h=p.site,R=h[0]-n,C=h[1]-t,F=R*R+C*C,F<W&&(W=F,w=p));if(w){var X=[n,t],q=[n,o],D=[e,o],xt=[e,t];w.halfedges.push(Hi.push(gf(h=w.site,X,q))-1,Hi.push(gf(h,q,D))-1,Hi.push(gf(h,D,xt))-1,Hi.push(gf(h,xt,X))-1)}}for(l=0;l<s;++l)(p=To[l])&&(p.halfedges.length||delete To[l])}var VL=[],Ug;function lJ(){pf(this),this.x=this.y=this.arc=this.site=this.cy=null}function Wl(n){var t=n.P,e=n.N;if(!(!t||!e)){var o=t.site,s=n.site,l=e.site;if(o!==l){var p=s[0],h=s[1],g=o[0]-p,m=o[1]-h,v=l[0]-p,x=l[1]-h,E=2*(g*x-m*v);if(!(E>=-WL)){var b=g*g+m*m,T=v*v+x*x,I=(x*b-m*T)/E,S=(g*T-v*b)/E,w=VL.pop()||new lJ;w.arc=n,w.site=s,w.x=I+p,w.y=(w.cy=S+h)+Math.sqrt(I*I+S*S),n.circle=w;for(var R=null,C=mf._;C;)if(w.y<C.y||w.y===C.y&&w.x<=C.x)if(C.L)C=C.L;else{R=C.P;break}else if(C.R)C=C.R;else{R=C;break}mf.insert(R,w),R||(Ug=w)}}}}function Xl(n){var t=n.circle;t&&(t.P||(Ug=t.N),mf.remove(t),VL.push(t),pf(t),n.circle=null)}var YL=[];function cJ(){pf(this),this.edge=this.site=this.circle=null}function XL(n){var t=YL.pop()||new cJ;return t.site=n,t}function m1(n){Xl(n),Yl.remove(n),YL.push(n),pf(n)}function $L(n){var t=n.circle,e=t.x,o=t.cy,s=[e,o],l=n.P,p=n.N,h=[n];m1(n);for(var g=l;g.circle&&Math.abs(e-g.circle.x)<Er&&Math.abs(o-g.circle.cy)<Er;)l=g.P,h.unshift(g),m1(g),g=l;h.unshift(g),Xl(g);for(var m=p;m.circle&&Math.abs(e-m.circle.x)<Er&&Math.abs(o-m.circle.cy)<Er;)p=m.N,h.push(m),m1(m),m=p;h.push(m),Xl(m);var v=h.length,x;for(x=1;x<v;++x)m=h[x],g=h[x-1],Nh(m.edge,g.site,m.site,s);g=h[0],m=h[v-1],m.edge=df(g.site,m.site,null,s),Wl(g),Wl(m)}function ZL(n){for(var t=n[0],e=n[1],o,s,l,p,h=Yl._;h;)if(l=JL(h,e)-t,l>Er)h=h.L;else if(p=t-fJ(h,e),p>Er){if(!h.R){o=h;break}h=h.R}else{l>-Er?(o=h.P,s=h):p>-Er?(o=h,s=h.N):o=s=h;break}kL(n);var g=XL(n);if(Yl.insert(o,g),!(!o&&!s)){if(o===s){Xl(o),s=XL(o.site),Yl.insert(g,s),g.edge=s.edge=df(o.site,g.site),Wl(o),Wl(s);return}if(!s){g.edge=df(o.site,g.site);return}Xl(o),Xl(s);var m=o.site,v=m[0],x=m[1],E=n[0]-v,b=n[1]-x,T=s.site,I=T[0]-v,S=T[1]-x,w=2*(E*S-b*I),R=E*E+b*b,C=I*I+S*S,F=[(S*R-b*C)/w+v,(E*C-I*R)/w+x];Nh(s.edge,m,T,F),g.edge=df(m,n,null,F),s.edge=df(n,T,null,F),Wl(o),Wl(s)}}function JL(n,t){var e=n.site,o=e[0],s=e[1],l=s-t;if(!l)return o;var p=n.P;if(!p)return-1/0;e=p.site;var h=e[0],g=e[1],m=g-t;if(!m)return h;var v=h-o,x=1/l-1/m,E=v/m;return x?(-E+Math.sqrt(E*E-2*x*(v*v/(-2*m)-g+m/2+s-l/2)))/x+o:(o+h)/2}function fJ(n,t){var e=n.N;if(e)return JL(e,t);var o=n.site;return o[1]===t?o[0]:1/0}var Er=1e-6,WL=1e-12,Yl,To,mf,Hi;function hJ(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function pJ(n,t){return t[1]-n[1]||t[0]-n[0]}function Bg(n,t){var e=n.sort(pJ).pop(),o,s,l;for(Hi=[],To=new Array(n.length),Yl=new d1,mf=new d1;;)if(l=Ug,e&&(!l||e[1]<l.y||e[1]===l.y&&e[0]<l.x))(e[0]!==o||e[1]!==s)&&(ZL(e),o=e[0],s=e[1]),e=n.pop();else if(l)$L(l.arc);else break;if(qL(),t){var p=+t[0][0],h=+t[0][1],g=+t[1][0],m=+t[1][1];GL(p,h,g,m),HL(p,h,g,m)}this.edges=Hi,this.cells=To,Yl=mf=Hi=To=null}Bg.prototype={constructor:Bg,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return g1(t,n[o])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,o){if(h=(l=e.halfedges).length)for(var s=e.site,l,p=-1,h,g,m=t[l[h-1]],v=m.left===s?m.right:m.left;++p<h;)g=v,m=t[l[p]],v=m.left===s?m.right:m.left,g&&v&&o<g.index&&o<v.index&&hJ(s,g,v)<0&&n.push([s.data,g.data,v.data])}),n},links:function(){return this.edges.filter(function(n){return n.right}).map(function(n){return{source:n.left.data,target:n.right.data}})},find:function(n,t,e){for(var o=this,s,l=o._found||0,p=o.cells.length,h;!(h=o.cells[l]);)if(++l>=p)return null;var g=n-h.site[0],m=t-h.site[1],v=g*g+m*m;do h=o.cells[s=l],l=null,h.halfedges.forEach(function(x){var E=o.edges[x],b=E.left;if(!((b===h.site||!b)&&!(b=E.right))){var T=n-b[0],I=t-b[1],S=T*T+I*I;S<v&&(v=S,l=b.index)}});while(l!==null);return o._found=s,e==null||v<=e*e?h.site:null}};var EJ=sn(yf(),1);var R1=sn(tN(),1);function Zo(){return new kg}function kg(){this.reset()}kg.prototype={constructor:kg,reset:function(){this.s=this.t=0},add:function(n){eN(Gg,n,this.t),eN(this,Gg.s,this.s),this.s?this.t+=Gg.t:this.s=Gg.t},valueOf:function(){return this.s}};var Gg=new kg;function eN(n,t,e){var o=n.s=t+e,s=o-t,l=o-s;n.t=t-l+(e-s)}var er=1e-6;var gr=Math.PI,Mi=gr/2,qg=gr/4,Da=gr*2,$l=180/gr,Jo=gr/180,Zr=Math.abs,aa=Math.atan,Ko=Math.atan2,Wn=Math.cos;var Hg=Math.exp;var Oh=Math.log;var an=Math.sin;var no=Math.sqrt,Dh=Math.tan;function _1(n){return n>1?0:n<-1?gr:Math.acos(n)}function Co(n){return n>1?Mi:n<-1?-Mi:Math.asin(n)}function ua(){}var wJ=Zo(),rpt=Zo();function Zl(n){var t=n[0],e=n[1],o=Wn(e);return[o*Wn(t),o*an(t),an(e)]}function Fh(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function Uh(n){var t=no(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var ppt=Zo();function rN(n,t){return[n>gr?n-Da:n<-gr?n+Da:n,t]}rN.invert=rN;function x1(){var n=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){n.push(t=[])},lineEnd:ua,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function E1(n,t){return Zr(n[0]-t[0])<er&&Zr(n[1]-t[1])<er}function Vg(n,t,e,o){this.x=n,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function w1(n,t,e,o,s){var l=[],p=[],h,g;if(n.forEach(function(T){if(!((I=T.length-1)<=0)){var I,S=T[0],w=T[I],R;if(E1(S,w)){for(s.lineStart(),h=0;h<I;++h)s.point((S=T[h])[0],S[1]);s.lineEnd();return}l.push(R=new Vg(S,T,null,!0)),p.push(R.o=new Vg(S,null,R,!1)),l.push(R=new Vg(w,T,null,!1)),p.push(R.o=new Vg(w,null,R,!0))}}),!!l.length){for(p.sort(t),iN(l),iN(p),h=0,g=p.length;h<g;++h)p[h].e=e=!e;for(var m=l[0],v,x;;){for(var E=m,b=!0;E.v;)if((E=E.n)===m)return;v=E.z,s.lineStart();do{if(E.v=E.o.v=!0,E.e){if(b)for(h=0,g=v.length;h<g;++h)s.point((x=v[h])[0],x[1]);else o(E.x,E.n.x,1,s);E=E.n}else{if(b)for(v=E.p.z,h=v.length-1;h>=0;--h)s.point((x=v[h])[0],x[1]);else o(E.x,E.p.x,-1,s);E=E.p}E=E.o,v=E.z,b=!b}while(!E.v);s.lineEnd()}}}function iN(n){if(t=n.length){for(var t,e=0,o=n[0],s;++e<t;)o.n=s=n[e],s.p=o,o=s;o.n=s=n[0],s.p=o}}function sl(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function S1(n){return n.length===1&&(n=bJ(n)),{left:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var l=o+s>>>1;n(t[l],e)<0?o=l+1:s=l}return o},right:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var l=o+s>>>1;n(t[l],e)>0?s=l:o=l+1}return o}}}function bJ(n){return function(t,e){return sl(n(t),e)}}var oN=S1(sl),AJ=oN.right,TJ=oN.left;var sN=Array.prototype,PJ=sN.slice,IJ=sN.map;var odt=Math.sqrt(50),sdt=Math.sqrt(10),adt=Math.sqrt(2);function Xg(n){for(var t=n.length,e,o=-1,s=0,l,p;++o<t;)s+=n[o].length;for(l=new Array(s);--t>=0;)for(p=n[t],e=p.length;--e>=0;)l[--s]=p[e];return l}var BJ=1e9,Vgt=-BJ;var M1=Zo();function b1(n,t){var e=t[0],o=t[1],s=[an(e),-Wn(e),0],l=0,p=0;M1.reset();for(var h=0,g=n.length;h<g;++h)if(v=(m=n[h]).length)for(var m,v,x=m[v-1],E=x[0],b=x[1]/2+qg,T=an(b),I=Wn(b),S=0;S<v;++S,E=R,T=F,I=W,x=w){var w=m[S],R=w[0],C=w[1]/2+qg,F=an(C),W=Wn(C),X=R-E,q=X>=0?1:-1,D=q*X,xt=D>gr,B=T*F;if(M1.add(Ko(B*q*an(D),I*W+B*Wn(D))),l+=xt?X+q*Da:X,xt^E>=e^R>=e){var j=Fh(Zl(x),Zl(w));Uh(j);var J=Fh(s,j);Uh(J);var Dt=(xt^X>=0?-1:1)*Co(J[2]);(o>Dt||o===Dt&&(j[0]||j[1]))&&(p+=xt^X>=0?1:-1)}}return(l<-er||l<er&&M1<-er)^p&1}var tmt=Zo();var _mt=Zo(),xmt=Zo();var kJ=1/0;var Smt=-kJ;function A1(n){this._context=n}A1.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._context.moveTo(n,t),this._point=1;break}case 1:{this._context.lineTo(n,t);break}default:{this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,Da);break}}},result:ua};var Nmt=Zo();function T1(){this._string=[]}T1.prototype={_radius:4.5,_circle:lN(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._string.push("M",n,",",t),this._point=1;break}case 1:{this._string.push("L",n,",",t);break}default:{this._circle==null&&(this._circle=lN(this._radius)),this._string.push("M",n,",",t,this._circle);break}}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}else return null}};function lN(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function C1(n,t,e,o){return function(s,l){var p=t(l),h=s.invert(o[0],o[1]),g=x1(),m=t(g),v=!1,x,E,b,T={point:I,lineStart:w,lineEnd:R,polygonStart:function(){T.point=C,T.lineStart=F,T.lineEnd=W,E=[],x=[]},polygonEnd:function(){T.point=I,T.lineStart=w,T.lineEnd=R,E=Xg(E);var X=b1(x,h);E.length?(v||(l.polygonStart(),v=!0),w1(E,VJ,X,e,l)):X&&(v||(l.polygonStart(),v=!0),l.lineStart(),e(null,null,1,l),l.lineEnd()),v&&(l.polygonEnd(),v=!1),E=x=null},sphere:function(){l.polygonStart(),l.lineStart(),e(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function I(X,q){var D=s(X,q);n(X=D[0],q=D[1])&&l.point(X,q)}function S(X,q){var D=s(X,q);p.point(D[0],D[1])}function w(){T.point=S,p.lineStart()}function R(){T.point=I,p.lineEnd()}function C(X,q){b.push([X,q]);var D=s(X,q);m.point(D[0],D[1])}function F(){m.lineStart(),b=[]}function W(){C(b[0][0],b[0][1]),m.lineEnd();var X=m.clean(),q=g.result(),D,xt=q.length,B,j,J;if(b.pop(),x.push(b),b=null,!!xt){if(X&1){if(j=q[0],(B=j.length-1)>0){for(v||(l.polygonStart(),v=!0),l.lineStart(),D=0;D<B;++D)l.point((J=j[D])[0],J[1]);l.lineEnd()}return}xt>1&&X&2&&q.push(q.pop().concat(q.shift())),E.push(q.filter(HJ))}}return T}}function HJ(n){return n.length>1}function VJ(n,t){return((n=n.x)[0]<0?n[1]-Mi-er:Mi-n[1])-((t=t.x)[0]<0?t[1]-Mi-er:Mi-t[1])}var WJ=C1(function(){return!0},XJ,$J,[-gr,-Mi]);function XJ(n){var t=NaN,e=NaN,o=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(l,p){var h=l>0?gr:-gr,g=Zr(l-t);Zr(g-gr)<er?(n.point(t,e=(e+p)/2>0?Mi:-Mi),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(h,e),n.point(l,e),s=0):o!==h&&g>=gr&&(Zr(t-o)<er&&(t-=o*er),Zr(l-h)<er&&(l-=h*er),e=YJ(t,e,l,p),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(h,e),s=0),n.point(t=l,e=p),o=h},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function YJ(n,t,e,o){var s,l,p=an(n-e);return Zr(p)>er?aa((an(t)*(l=Wn(o))*an(e)-an(o)*(s=Wn(t))*an(n))/(s*l*p)):(t+o)/2}function $J(n,t,e,o){var s;if(n==null)s=e*Mi,o.point(-gr,s),o.point(0,s),o.point(gr,s),o.point(gr,0),o.point(gr,-s),o.point(0,-s),o.point(-gr,-s),o.point(-gr,0),o.point(-gr,s);else if(Zr(n[0]-t[0])>er){var l=n[0]<t[0]?gr:-gr;s=e*l/2,o.point(-l,s),o.point(0,s),o.point(l,s)}else o.point(t[0],t[1])}function Yg(n){return function(t){var e=new P1;for(var o in n)e[o]=n[o];return e.stream=t,e}}function P1(){}P1.prototype={constructor:P1,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var x0t=Wn(30*Jo);var O0t=Yg({point:function(n,t){this.stream.point(n*Jo,t*Jo)}});function $g(n){return function(t,e){var o=Wn(t),s=Wn(e),l=n(o*s);return[l*s*an(t),l*an(e)]}}function Fa(n){return function(t,e){var o=no(t*t+e*e),s=n(o),l=an(s),p=Wn(s);return[Ko(t*l,o*p),Co(o&&e*l/o)]}}var mN=$g(function(n){return no(2/(1+n))});mN.invert=Fa(function(n){return 2*Co(n/2)});var yN=$g(function(n){return(n=_1(n))&&n/an(n)});yN.invert=Fa(function(n){return n});function I1(n,t){return[n,Oh(Dh((Mi+t)/2))]}I1.invert=function(n,t){return[n,2*aa(Hg(t))-Mi]};function Zg(n,t){return[n,t]}Zg.invert=Zg;function vN(n,t){var e=Wn(t),o=Wn(n)*e;return[e*an(n)/o,an(t)/o]}vN.invert=Fa(aa);function _N(n,t){var e=t*t,o=e*e;return[n*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}_N.invert=function(n,t){var e=t,o=25,s;do{var l=e*e,p=l*l;e-=s=(e*(1.007226+l*(.015085+p*(-.044475+.028874*l-.005916*p)))-t)/(1.007226+l*(.015085*3+p*(-.044475*7+.028874*9*l-.005916*11*p)))}while(Zr(s)>er&&--o>0);return[n/(.8707+(l=e*e)*(-.131979+l*(-.013791+l*l*l*(.003971-.001529*l)))),e]};function xN(n,t){return[Wn(t)*an(n),an(t)]}xN.invert=Fa(Co);function EN(n,t){var e=Wn(t),o=1+Wn(n)*e;return[e*an(n)/o,an(t)/o]}EN.invert=Fa(function(n){return 2*aa(n)});function wN(n,t){return[Oh(Dh((Mi+t)/2)),-n]}wN.invert=function(n,t){return[-t,2*aa(Hg(n))-Mi]};var tK=sn(yf(),1);var eK=sn(yf(),1);var rK=sn(yf(),1);var iK=sn(yf(),1);function _f(n,t){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}function MN(n){let t=0;for(let e=0;e<n.length-1;e++)t+=_f(n[e],n[e+1]);return t}var jo=sn(bN(),1);var Xn="___",Jg=class{isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let o=[];try{o=JSON.parse(e.entry_end_floor)}catch(l){o=[]}let s=[];try{s=JSON.parse(e.entry_start_floor)}catch(l){s=[]}return Lu({},e,{entry_start_floor:s,entry_end_floor:o})})}getParkingSpaceInfo(t,e){let o=""+t+Xn+e;var s;return(s=this.parkingMap.get(o))!=null?s:null}getNodeInfo(t,e){let o=""+t+Xn+e,s=this.nodeMap.get(o);if(!(s!=null&&s.length))return null;let l=this.pointMap.get(s[0]);return l!=null?l:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let o=new Date,s=o.getHours()*60+o.getMinutes();t.length&&(t.forEach(l=>{let p=(l.points||[]).filter(h=>!(0,jo.isNil)(h.passWeight)&&h.passWeight!==1&&!(0,jo.isNil)(h.coverageArea)&&h.coverageArea!==0);(l.points||[]).filter(h=>h.openStatus!==!1).filter(h=>{if(!h.startTime||!h.endTime)return!0;let[g,m]=h.startTime.split(":").map(T=>+T),[v,x]=h.endTime.split(":").map(T=>+T),E=g*60+m,b=v*60+x;return s>=E&&s<=b}).forEach(h=>{h.floor=l.floor;let g=""+l.floor+Xn+h.id,m=""+l.floor+Xn+h.nodeId,v=this.nodeMap.get(m)||[];if(v.push(""+l.floor+Xn+(h.relatedId||h.id)),this.nodeMap.set(""+l.floor+Xn+h.nodeId,v),this.pointMap.set(g,h),this.isFacilityByType(h.type)){let x=this.facilities.find(E=>E.id===+h.targetId);if(x){switch(x.entry_infra_type){case"straightLadder":if(x.entry_end_floor.find(I=>I.floor===l.floor)&&x.entry_start_floor.find(I=>I.floor===l.floor)){let I=this.straightLadderMap.get(h.targetId)||[];I.push(Lu({},h)),this.straightLadderMap.set(h.targetId,I)}break;case"staircase":if(x.entry_end_floor.find(I=>I.floor===l.floor)&&x.entry_start_floor.find(I=>I.floor===l.floor)){let I=this.staircaseMap.get(h.targetId)||[];I.push(Lu({},h)),this.staircaseMap.set(h.targetId,I)}break;case"escalator":let b=this.escalatorMap.get(h.targetId)||[];if(x.entry_start_floor.find(I=>I.floor===l.floor)){let I=b.find(S=>{var w;return((w=S.end)==null?void 0:w.floor)!==l.floor&&!S.start});I?I.start=h:b.push({start:h})}if(x.entry_end_floor.find(I=>I.floor===l.floor)){let I=b.find(S=>{var w;return((w=S.start)==null?void 0:w.floor)!==l.floor&&!S.end});I?I.end=h:b.push({end:h})}this.escalatorMap.set(h.targetId,b);break;case"ramp":let T=this.rampMap.get(h.targetId)||[];if(x.entry_start_floor.find(I=>I.floor===l.floor)){let I=T.find(S=>{var w;return((w=S.end)==null?void 0:w.floor)!==l.floor&&!S.start});I?I.start=h:T.push({start:h})}if(x.entry_end_floor.find(I=>I.floor===l.floor)){let I=T.find(S=>{var w;return((w=S.start)==null?void 0:w.floor)!==l.floor&&!S.end});I?I.end=h:T.push({end:h})}this.rampMap.set(h.targetId,T);break;case"connectionPoint":if(x.entry_end_floor.find(I=>I.floor===l.floor)&&x.entry_start_floor.find(I=>I.floor===l.floor)){let I=this.connectionPointMap.get(h.targetId)||[];I.push(Lu({},h)),this.connectionPointMap.set(h.targetId,I)}break}let E=this.facilityMap.get(h.targetId)||[];E.push(Lu({},h)),this.facilityMap.set(h.targetId,E)}}h.type==="parkingSpace"&&h.name.split(/[,\uFF0C]/).forEach(E=>{this.parkingMap.set(""+l.floor+Xn+E,h)})}),(l.lines||[]).filter(h=>h.to!==h.from).forEach(h=>{let g=""+l.floor+Xn+h.from,m=""+l.floor+Xn+h.to,v=this.pointMap.get(g),x=this.pointMap.get(m);if(!v||!x)return;let E=v.cds,b=x.cds,T=_f(E,b);if(p.forEach(I=>{(I.id===h.from||I.id===h.to)&&(T=T/I.passWeight);let S=_f(E,I.cds)<=I.coverageArea,w=_f(b,I.cds)<=I.coverageArea;(S||w)&&(T=T/I.passWeight)}),!v.permission&&!x.permission){switch(this.addLineItem(g,m,T),this.addLineItem(m,g,T),h.direction){case"double":this.addLineItem(g,m,T,this.forwardLineMap),this.addLineItem(m,g,T,this.forwardLineMap);break;case"single":this.addLineItem(g,m,T,this.forwardLineMap);break;case"back":this.addLineItem(m,g,T,this.forwardLineMap);break}(v.type==="parkingSpace"||x.type==="parkingSpace")&&h.direction==="noDir"&&(this.addLineItem(g,m,T,this.forwardLineMap),this.addLineItem(m,g,T,this.forwardLineMap))}else v.permission&&(this.setPermissionLine(g,m,v.permission,T,""),this.setPermissionLine(m,g,v.permission,T,"")),x.permission&&x.permission!==v.permission&&(this.setPermissionLine(g,m,x.permission,T,""),this.setPermissionLine(m,g,x.permission,T,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,o,s,l){this.getPermissionMap(o).add({fromKey:t,toKey:e,distance:s,type:l})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,l=this.pointMap.get(s);if(l){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g)continue;l.permission&&this.setPermissionLine(s,h,l.permission,1,"straightLadder"),g.permission&&g.permission!==l.permission&&this.setPermissionLine(s,h,g.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,l=this.pointMap.get(s);if(l){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g)continue;l.permission&&this.setPermissionLine(s,h,l.permission,1,"staircase"),g.permission&&g.permission!==l.permission&&this.setPermissionLine(s,h,g.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Xn+o.start.id,l=""+o.end.floor+Xn+o.end.id,p=this.pointMap.get(s),h=this.pointMap.get(l);p&&h&&(p.permission&&this.setPermissionLine(s,l,p.permission,1,"escalator"),h.permission&&h.permission!==p.permission&&this.setPermissionLine(s,l,h.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Xn+o.start.id,l=""+o.end.floor+Xn+o.end.id,p=this.pointMap.get(s),h=this.pointMap.get(l);p&&h&&(p.permission&&this.setPermissionLine(s,l,p.permission,10,"ramp"),h.permission&&h.permission!==p.permission&&this.setPermissionLine(s,l,h.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{if(t.length<2){this.connectionPointMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,l=this.pointMap.get(s);if(l){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g)continue;l.permission&&this.setPermissionLine(s,h,l.permission,1,"connectionPoint"),g.permission&&g.permission!==l.permission&&this.setPermissionLine(s,h,g.permission,1,"connectionPoint")}}}})}addPermissionLineToMap(t,e,o,s){this.getPermissionMap(t).forEach(p=>{e.includes(p.type)&&(p.type===""?this.addLineItem(p.fromKey,p.toKey,p.distance,o):this.addLineItem(p.fromKey,p.toKey,s.get(p.type),o))})}addLineItem(t,e,o,s){s===void 0&&(s=this.lineMap);let l=s.get(t)||new Map;l.set(e,o),s.set(t,l)}addFacilityToLineMap(t,e,o,s){[...this.straightLadderMap,...this.staircaseMap].forEach(l=>{let[p,h]=l;if(!(h.length<2))for(let g=0;g<h.length;g++){let m=""+h[g].floor+Xn+h[g].id,v=this.pointMap.get(m);if(!(!v||v.permission)){for(let x=0;x<h.length;x++)if(g!==x){let E=""+h[x].floor+Xn+h[x].id,b=this.pointMap.get(E);if(!b||b.permission)continue;if(h[g].type==="straightLadder"){let T=e;this.addLineItem(m,E,T,s)}else{let T=o;this.addLineItem(m,E,T,s)}}}}}),this.escalatorMap.forEach((l,p)=>{l.forEach(h=>{if(h.start&&h.end){let g=""+h.start.floor+Xn+h.start.id,m=""+h.end.floor+Xn+h.end.id,v=this.pointMap.get(g),x=this.pointMap.get(m);if(v&&x&&!v.permission&&!x.permission){let E=t;this.addLineItem(g,m,E,s)}}})}),this.connectionPointMap.forEach((l,p)=>{if(!(l.length<2))for(let h=0;h<l.length;h++){let g=""+l[h].floor+Xn+l[h].id,m=this.pointMap.get(g);if(!(!m||m.permission)){for(let v=0;v<l.length;v++)if(h!==v){let x=""+l[v].floor+Xn+l[v].id,E=this.pointMap.get(x);if(!E||E.permission)continue;this.addLineItem(g,x,100,s)}}}})}initBaseRoute(){let t=new Map((0,jo.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,t),this.baseRoute=new ro.default(t)}initEscalatorRoute(){let t=new Map((0,jo.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new ro.default(t)}initStraightLadderRoute(){let t=new Map((0,jo.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new ro.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Xn+o.start.id,l=""+o.end.floor+Xn+o.end.id,p=this.pointMap.get(s),h=this.pointMap.get(l);p&&h&&!p.permission&&!h.permission&&this.addLineItem(s,l,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{if(!(t.length<2))for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,l=this.pointMap.get(s);if(!(!l||l.permission)){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g||g.permission)continue;this.addLineItem(s,h,100,this.forwardLineMap)}}}}),this.forwardRoute=new ro.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t,e,o){o===void 0&&(o={});var s;if(t.nodeId){let l=this.nodeMap.get(""+t.floor+Xn+t.nodeId);if(l!=null&&l.length)return l.map(p=>{let[h,g]=p.split(Xn);return{floor:h,id:g}})}if((s=t.coord)!=null&&s.length){let l=this.roadInfo.find(m=>m.floor===t.floor);if(!l)return null;let p=l.points.filter(m=>m.isStarted),h=l.points.filter(m=>{let v=""+m.floor+Xn+m.id;if(e==="forward"){if(!this.forwardLineMap.has(v)||o.adsorptionIntersection&&p.length&&!m.isStarted)return!1}else if(!this.lineMap.has(v))return!1;return!0});if(!h.length)return null;let g=h.reduce((m,v)=>{if(v.relatedId)return m;let x=_f(t.coord,v.cds);return x<m.min&&(m.min=x,m.point=v),m},{min:1/0,point:h[0]});return[{floor:l.floor,id:g.point.id}]}return null}transformEnd(t,e){if(t.floor){if(t.parkingSpace){let s=this.parkingMap.get(""+t.floor+Xn+t.parkingSpace);if(s)return[{floor:t.floor,id:s.id}]}let o=this.transformStart(t,e);if(o)return o}if(t.facility){let s=this.facilities.filter(l=>+l.type_id==+t.facility).map(l=>l.id).map(l=>this.facilityMap.get(""+l)).flat(2);if(s!=null&&s.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o,s,l,p){if(o===void 0&&(o=""),p===void 0&&(p={}),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let h=this.transformStart(t,o,p);if(!h)return"no-start";let g=this.transformEnd(e,o);if(!g)return"no-end";let m=[];if(Array.isArray(g))for(let E=0;E<h.length;E++){let b=h[E];for(let T=0;T<g.length;T++){let I=g[T];if(b.floor===I.floor&&b.id===I.id)return"near"}}else{m=this.facilities.filter(b=>+b.type_id==+e.facility).map(b=>b.id).map(b=>this.facilityMap.get(""+b)).flat(2).filter(b=>b).filter(b=>g.floor?b.floor===g.floor:!0);for(let b=0;b<h.length;b++){let T=h[b];for(let I=0;I<m.length;I++){let S=m[I];if(T.floor===S.floor&&T.id===S.id)return"near"}}}let v;switch(o){case"escalator":v=this.getEscalatorPath.bind(this);break;case"straightLadder":v=this.getStraightLadderPath.bind(this);break;case"forward":v=this.getForwardPath.bind(this);break;default:v=this.getBasePath.bind(this);break}let x=null;return h.forEach(E=>{if(Array.isArray(g))g.forEach(b=>{let T=v(E,b,s,l);T&&T&&(!x||T[0].consume<x[0].consume)&&(x=T)});else{if(!m.length)return null;let b=m.map(T=>v(E,{floor:T.floor,id:T.id},s,l)).filter(T=>!!T);x=b.reduce((T,I)=>{let S=I[0].consume;return S<T.distance&&(T.distance=S,T.path=I),T},{distance:1/0,path:b[0]}).path}}),x}getRoutePath(t,e,o){let s=""+t.floor+Xn+t.id,l=""+e.floor+Xn+e.id,p=o.path(s,l);if(!p)return null;let h=[],g=p.reduce((m,v,x,E)=>{if(x===0)return 0;let b=E[x-1],T=o.graph.get(b).get(v);return m+T},0);return p.map(m=>{let v=this.pointMap.get(m);if(v){var x;let{floor:E}=v,b=v.type;if(this.isFacilityByType(v.type)){let T=this.facilities.find(I=>I.id===+v.targetId);T&&(b=T.entry_infra_type)}if(((x=h[h.length-1])==null?void 0:x.floor)===E){let T=h[h.length-1];T.points.push(v.cds),T.pointInfos.push(v),T.endType=b,T.destId=v.nodeId,T.distance=MN(T.points)}else h.push({floor:E,points:[v.cds],pointInfos:[v],endType:b,destId:v.nodeId,distance:0,consume:g})}}),h}getBasePath(t,e,o){if(!o)return this.getRoutePath(t,e,this.baseRoute);let s=(0,jo.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let l=new ro.default(s);return this.getRoutePath(t,e,l)}getEscalatorPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.escalatorRoute);let s=(0,jo.cloneDeep)(this.escalatorRoute.graph),l=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",1*l],["connectionPoint",100],["straightLadder",this.lift_priority*l],["staircase",3e4*l]]));let p=new ro.default(s);return this.getRoutePath(t,e,p)}getStraightLadderPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.straightLadderRoute);let s=(0,jo.cloneDeep)(this.straightLadderRoute.graph),l=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",3*l],["connectionPoint",100],["straightLadder",1*l],["staircase",3e4*l]]));let p=new ro.default(s);return this.getRoutePath(t,e,p)}getForwardPath(t,e,o,s){let l=new Map,p=E=>{let b=this.forwardRoute.graph.get(g);E.forEach(T=>{let I=b.get(T);(0,jo.isNil)(I)||(l.set(T,I),b.delete(T))})},h=()=>{let E=this.forwardRoute.graph.get(g);l.forEach((b,T)=>{E.set(T,b)})},g=""+t.floor+Xn+t.id;if(!(0,jo.isNil)(s)){let E=this.forwardLineMap.get(g),b=this.pointMap.get(g);if(b&&(E!=null&&E.size)&&E.size>1){let T=new Ye(b.cds[0],b.cds[1]),I=new Map;E.forEach((w,R)=>{let C=this.pointMap.get(R);if(C){let F=new Ye(C.cds[0],C.cds[1]),X=360-(new Ye().subVectors(F,T).angle()/Math.PI*180-90+360)%360;I.set(R,X)}});let S=Array.from(I).filter(w=>{let[R,C]=w;return Math.abs(C-s)<=60}).map(w=>{let[R]=w;return R});if(S.length)S.forEach(w=>I.delete(w)),p([...I.keys()]);else{let w=Array.from(I).reduce((R,C)=>{let F=Math.abs(C[1]-s);return F<R.diff?{diff:F,key:C[0]}:R},{diff:1/0,key:""});I.delete(w.key),p([...I.keys()])}}}if(!o){let E=this.getRoutePath(t,e,this.forwardRoute);return h(),E||this.getRoutePath(t,e,this.forwardRoute)}let m=(0,jo.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],m,new Map([["ramp",10]]));let v=new ro.default(m),x=this.getRoutePath(t,e,v);if(h(),x)return x;{let E=(0,jo.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],E,new Map([["ramp",10]]));let b=new ro.default(E);return this.getRoutePath(t,e,b)}}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new ro.default,this.escalatorRoute=new ro.default,this.straightLadderRoute=new ro.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.baseRoute=new ro.default,this.escalatorRoute=new ro.default,this.straightLadderRoute=new ro.default,this.forwardLineMap=new Map,this.forwardRoute=new ro.default}};var uwt=sn(jN(),1),lwt=sn(Yp(),1);function QN(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function t2(n){let t={};for(let o in n)o.startsWith("on")&&(t[QN(o.slice(2))]=n[o]);let e=o=>ac(this,null,function*(){let{data:s}=o;if(t[s.type])try{let l=yield t[s.type](s.data);if(l!=null&&l.$transfer&&Array.isArray(l.$transfer)){let p=l.$transfer;delete l.$transfer,self.postMessage({type:""+s.type+"_result",key:s.key,data:l},p)}else self.postMessage({type:""+s.type+"_result",key:s.key,data:l})}catch(l){self.postMessage({type:""+s.type+"_result",key:s.key,error:l})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var la=new Jg,r2,QK=new Promise(n=>{r2=n});function i2(n,t,e){let{floor:o,coord:s}=n,l=null;return(t||[]).forEach(p=>{let h=la.getPath({floor:o,coord:s},{floor:p.floor,parkingSpace:p.lot_id},"forward",0,e);if(h==="near"){l={floor:p.floor,spaceNo:p.lot_id,distance:0};return}if(!h||typeof h=="string")return;let g={floor:p.floor,spaceNo:p.lot_id,distance:h[0].consume};l||(l=g),l.distance>g.distance&&(l=g)}),l}function e2(n,t,e,o,s){let l=i2({floor:n,coord:t},e[n],s);return l||tj(n,t,e,o,s)}function tj(n,t,e,o,s){let l=o.indexOf(n);l===-1&&(l=o.length);let p=1,h=null;for(;p<=o.length;){if(o.filter((m,v)=>v===l-1||v===l+1).forEach(m=>{let v=i2({floor:n,coord:t},e[m],s);h?v&&h.distance>v.distance&&(h=v):h=v}),h)return h;p++}return h}function n2(n,t,e,o,s){let l=z1(n,t,t.floor,e,s);if(l)return l;let p=z1(n,t,n.floor,e,s);return p||ej(n,t,n.floor,e,o,s)}function z1(n,t,e,o,s){let l=o[e]||[];if(!l.length)return null;let p=null;return l.forEach(h=>{let g={floor:h.floor,parkingSpace:h.lot_id},m=la.getPath(n,g,"forward",0,s);if(!m||typeof m=="string"&&m!=="near")return;let v=la.getParkingSpaceInfo(h.floor,h.lot_id);if(!v)return;let x=la.getPath({floor:h.floor,coord:v.cds},t,"",0);if(x==="near"){p={floor:h.floor,spaceNo:h.lot_id,distance:0};return}if(!x||typeof x=="string")return;let E={floor:h.floor,spaceNo:h.lot_id,distance:x[0].consume};p?p.distance>E.distance&&(p=E):p=E}),p}function ej(n,t,e,o,s,l){let p=s.indexOf(e);p===-1&&(p=s.length);let h=1,g=null;for(;h<=s.length;){if(s.filter((v,x)=>x===p-1||x===p+1).forEach(v=>{let x=z1(n,t,v,o,l);g?x&&g.distance>x.distance&&(g=x):g=x}),g)return g;h++}return g}function nj(n){if(n.coord)return{floor:n.floor,coord:n.coord};if(n.nodeId){let t=la.getNodeInfo(n.floor,n.nodeId);if(t)return{floor:t.floor,coord:t.cds}}return null}function rj(n){if(n.coord)return{floor:n.floor,coord:n.coord};if(n.nodeId){let t=la.getNodeInfo(n.floor,n.nodeId);if(t)return{floor:t.floor,coord:t.cds}}if(n.parkingSpace){let t=la.getParkingSpaceInfo(n.floor,n.parkingSpace);if(t)return{floor:t.floor,coord:t.cds}}return null}t2({onSetRoadInfo(n){let{roadData:t,facilities:e}=n;la.initRoute(t,e),r2(!0)},onRecommend(n){return ac(this,null,function*(){let{start:t,end:e,travelDirection:o,carLotStatus:s,parkingType:l}=n;yield QK;let p=s.reduce((v,x)=>(v[x.floor]?v[x.floor].push(x):v[x.floor]=[x],v),{}),h=la.roadInfo.map(v=>v.floor),g=nj(t);if(!g)return null;let m=e?rj(e):null;if(l){let v=s.filter(x=>{let E=la.getParkingSpaceInfo(x.floor,x.lot_id);return E?E.parkingType===l:!1});if(v){let x=v.reduce((E,b)=>(E[b.floor]?E[b.floor].push(b):E[b.floor]=[b],E),{});if(m){let E=n2(g,m,x,h,o);if(E)return E}else{let E=e2(g.floor,g.coord,x,h,o);if(E)return E}}}return m?n2(g,m,p,h,o):e2(g.floor,g.coord,p,h,o)})},onClear(){la.clear()}});
27665
+ \`)};function Fg(n,t,e){this.x=n,this.y=t,this.weight=e}Fg.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Fg.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};Fg.prototype.isWall=function(){return this.weight===0};function BL(n){this.content=[],this.scoreFunction=n}BL.prototype={push:function(n){this.content.push(n),this.sinkDown(this.content.length-1)},pop:function(){var n=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),n},remove:function(n){var t=this.content.indexOf(n),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(n)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(n){this.sinkDown(this.content.indexOf(n))},sinkDown:function(n){for(var t=this.content[n];n>0;){var e=(n+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[n]=o,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],o=this.scoreFunction(e);;){var s=n+1<<1,l=s-1,p=null,h;if(l<t){var g=this.content[l];h=this.scoreFunction(g),h<o&&(p=l)}if(s<t){var m=this.content[s],v=this.scoreFunction(m);v<(p===null?o:h)&&(p=s)}if(p!==null)this.content[n]=this.content[p],this.content[p]=e,n=p;else break}}};function p1(){this._=null}function pf(n){n.U=n.C=n.L=n.R=n.P=n.N=null}p1.prototype={constructor:p1,insert:function(n,t){var e,o,s;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=zL(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)o=e.U,e===o.L?(s=o.R,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.R&&(Rh(this,e),n=e,e=n.U),e.C=!1,o.C=!0,Lh(this,o))):(s=o.L,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.L&&(Lh(this,e),n=e,e=n.U),e.C=!1,o.C=!0,Rh(this,o))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t=n.U,e,o=n.L,s=n.R,l,p;if(o?s?l=zL(s):l=o:l=s,t?t.L===n?t.L=l:t.R=l:this._=l,o&&s?(p=l.C,l.C=n.C,l.L=o,o.U=l,l!==s?(t=l.U,l.U=n.U,n=l.R,t.L=n,l.R=s,s.U=l):(l.U=t,t=l,n=l.R)):(p=n.C,n=l),n&&(n.U=t),!p){if(n&&n.C){n.C=!1;return}do{if(n===this._)break;if(n===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,Rh(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,Lh(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Rh(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,Lh(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,Rh(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,Lh(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function Rh(n,t){var e=t,o=t.R,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function Lh(n,t){var e=t,o=t.L,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function zL(n){for(;n.L;)n=n.L;return n}var d1=p1;function df(n,t,e,o){var s=[null,null],l=Hi.push(s)-1;return s.left=n,s.right=t,e&&Nh(s,n,t,e),o&&Nh(s,t,n,o),To[n.index].halfedges.push(l),To[t.index].halfedges.push(l),s}function gf(n,t,e){var o=[t,e];return o.left=n,o}function Nh(n,t,e,o){!n[0]&&!n[1]?(n[0]=o,n.left=t,n.right=e):n.left===e?n[1]=o:n[0]=o}function oJ(n,t,e,o,s){var l=n[0],p=n[1],h=l[0],g=l[1],m=p[0],v=p[1],x=0,E=1,b=m-h,T=v-g,I;if(I=t-h,!(!b&&I>0)){if(I/=b,b<0){if(I<x)return;I<E&&(E=I)}else if(b>0){if(I>E)return;I>x&&(x=I)}if(I=o-h,!(!b&&I<0)){if(I/=b,b<0){if(I>E)return;I>x&&(x=I)}else if(b>0){if(I<x)return;I<E&&(E=I)}if(I=e-g,!(!T&&I>0)){if(I/=T,T<0){if(I<x)return;I<E&&(E=I)}else if(T>0){if(I>E)return;I>x&&(x=I)}if(I=s-g,!(!T&&I<0)){if(I/=T,T<0){if(I>E)return;I>x&&(x=I)}else if(T>0){if(I<x)return;I<E&&(E=I)}return!(x>0)&&!(E<1)||(x>0&&(n[0]=[h+x*b,g+x*T]),E<1&&(n[1]=[h+E*b,g+E*T])),!0}}}}}function sJ(n,t,e,o,s){var l=n[1];if(l)return!0;var p=n[0],h=n.left,g=n.right,m=h[0],v=h[1],x=g[0],E=g[1],b=(m+x)/2,T=(v+E)/2,I,S;if(E===v){if(b<t||b>=o)return;if(m>x){if(!p)p=[b,e];else if(p[1]>=s)return;l=[b,s]}else{if(!p)p=[b,s];else if(p[1]<e)return;l=[b,e]}}else if(I=(m-x)/(E-v),S=T-I*b,I<-1||I>1)if(m>x){if(!p)p=[(e-S)/I,e];else if(p[1]>=s)return;l=[(s-S)/I,s]}else{if(!p)p=[(s-S)/I,s];else if(p[1]<e)return;l=[(e-S)/I,e]}else if(v<E){if(!p)p=[t,I*t+S];else if(p[0]>=o)return;l=[o,I*o+S]}else{if(!p)p=[o,I*o+S];else if(p[0]<t)return;l=[t,I*t+S]}return n[0]=p,n[1]=l,!0}function GL(n,t,e,o){for(var s=Hi.length,l;s--;)(!sJ(l=Hi[s],n,t,e,o)||!oJ(l,n,t,e,o)||!(Math.abs(l[0][0]-l[1][0])>Er||Math.abs(l[0][1]-l[1][1])>Er))&&delete Hi[s]}function kL(n){return To[n.index]={site:n,halfedges:[]}}function aJ(n,t){var e=n.site,o=t.left,s=t.right;return e===s&&(s=o,o=e),s?Math.atan2(s[1]-o[1],s[0]-o[0]):(e===o?(o=t[1],s=t[0]):(o=t[0],s=t[1]),Math.atan2(o[0]-s[0],s[1]-o[1]))}function g1(n,t){return t[+(t.left!==n.site)]}function uJ(n,t){return t[+(t.left===n.site)]}function qL(){for(var n=0,t=To.length,e,o,s,l;n<t;++n)if((e=To[n])&&(l=(o=e.halfedges).length)){var p=new Array(l),h=new Array(l);for(s=0;s<l;++s)p[s]=s,h[s]=aJ(e,Hi[o[s]]);for(p.sort(function(g,m){return h[m]-h[g]}),s=0;s<l;++s)h[s]=o[p[s]];for(s=0;s<l;++s)o[s]=h[s]}}function HL(n,t,e,o){var s=To.length,l,p,h,g,m,v,x,E,b,T,I,S,w=!0;for(l=0;l<s;++l)if(p=To[l]){for(h=p.site,m=p.halfedges,g=m.length;g--;)Hi[m[g]]||m.splice(g,1);for(g=0,v=m.length;g<v;)T=uJ(p,Hi[m[g]]),I=T[0],S=T[1],x=g1(p,Hi[m[++g%v]]),E=x[0],b=x[1],(Math.abs(I-E)>Er||Math.abs(S-b)>Er)&&(m.splice(g,0,Hi.push(gf(h,T,Math.abs(I-n)<Er&&o-S>Er?[n,Math.abs(E-n)<Er?b:o]:Math.abs(S-o)<Er&&e-I>Er?[Math.abs(b-o)<Er?E:e,o]:Math.abs(I-e)<Er&&S-t>Er?[e,Math.abs(E-e)<Er?b:t]:Math.abs(S-t)<Er&&I-n>Er?[Math.abs(b-t)<Er?E:n,t]:null))-1),++v);v&&(w=!1)}if(w){var R,C,F,W=1/0;for(l=0,w=null;l<s;++l)(p=To[l])&&(h=p.site,R=h[0]-n,C=h[1]-t,F=R*R+C*C,F<W&&(W=F,w=p));if(w){var X=[n,t],q=[n,o],D=[e,o],xt=[e,t];w.halfedges.push(Hi.push(gf(h=w.site,X,q))-1,Hi.push(gf(h,q,D))-1,Hi.push(gf(h,D,xt))-1,Hi.push(gf(h,xt,X))-1)}}for(l=0;l<s;++l)(p=To[l])&&(p.halfedges.length||delete To[l])}var VL=[],Ug;function lJ(){pf(this),this.x=this.y=this.arc=this.site=this.cy=null}function Wl(n){var t=n.P,e=n.N;if(!(!t||!e)){var o=t.site,s=n.site,l=e.site;if(o!==l){var p=s[0],h=s[1],g=o[0]-p,m=o[1]-h,v=l[0]-p,x=l[1]-h,E=2*(g*x-m*v);if(!(E>=-WL)){var b=g*g+m*m,T=v*v+x*x,I=(x*b-m*T)/E,S=(g*T-v*b)/E,w=VL.pop()||new lJ;w.arc=n,w.site=s,w.x=I+p,w.y=(w.cy=S+h)+Math.sqrt(I*I+S*S),n.circle=w;for(var R=null,C=mf._;C;)if(w.y<C.y||w.y===C.y&&w.x<=C.x)if(C.L)C=C.L;else{R=C.P;break}else if(C.R)C=C.R;else{R=C;break}mf.insert(R,w),R||(Ug=w)}}}}function Xl(n){var t=n.circle;t&&(t.P||(Ug=t.N),mf.remove(t),VL.push(t),pf(t),n.circle=null)}var YL=[];function cJ(){pf(this),this.edge=this.site=this.circle=null}function XL(n){var t=YL.pop()||new cJ;return t.site=n,t}function m1(n){Xl(n),Yl.remove(n),YL.push(n),pf(n)}function $L(n){var t=n.circle,e=t.x,o=t.cy,s=[e,o],l=n.P,p=n.N,h=[n];m1(n);for(var g=l;g.circle&&Math.abs(e-g.circle.x)<Er&&Math.abs(o-g.circle.cy)<Er;)l=g.P,h.unshift(g),m1(g),g=l;h.unshift(g),Xl(g);for(var m=p;m.circle&&Math.abs(e-m.circle.x)<Er&&Math.abs(o-m.circle.cy)<Er;)p=m.N,h.push(m),m1(m),m=p;h.push(m),Xl(m);var v=h.length,x;for(x=1;x<v;++x)m=h[x],g=h[x-1],Nh(m.edge,g.site,m.site,s);g=h[0],m=h[v-1],m.edge=df(g.site,m.site,null,s),Wl(g),Wl(m)}function ZL(n){for(var t=n[0],e=n[1],o,s,l,p,h=Yl._;h;)if(l=JL(h,e)-t,l>Er)h=h.L;else if(p=t-fJ(h,e),p>Er){if(!h.R){o=h;break}h=h.R}else{l>-Er?(o=h.P,s=h):p>-Er?(o=h,s=h.N):o=s=h;break}kL(n);var g=XL(n);if(Yl.insert(o,g),!(!o&&!s)){if(o===s){Xl(o),s=XL(o.site),Yl.insert(g,s),g.edge=s.edge=df(o.site,g.site),Wl(o),Wl(s);return}if(!s){g.edge=df(o.site,g.site);return}Xl(o),Xl(s);var m=o.site,v=m[0],x=m[1],E=n[0]-v,b=n[1]-x,T=s.site,I=T[0]-v,S=T[1]-x,w=2*(E*S-b*I),R=E*E+b*b,C=I*I+S*S,F=[(S*R-b*C)/w+v,(E*C-I*R)/w+x];Nh(s.edge,m,T,F),g.edge=df(m,n,null,F),s.edge=df(n,T,null,F),Wl(o),Wl(s)}}function JL(n,t){var e=n.site,o=e[0],s=e[1],l=s-t;if(!l)return o;var p=n.P;if(!p)return-1/0;e=p.site;var h=e[0],g=e[1],m=g-t;if(!m)return h;var v=h-o,x=1/l-1/m,E=v/m;return x?(-E+Math.sqrt(E*E-2*x*(v*v/(-2*m)-g+m/2+s-l/2)))/x+o:(o+h)/2}function fJ(n,t){var e=n.N;if(e)return JL(e,t);var o=n.site;return o[1]===t?o[0]:1/0}var Er=1e-6,WL=1e-12,Yl,To,mf,Hi;function hJ(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function pJ(n,t){return t[1]-n[1]||t[0]-n[0]}function Bg(n,t){var e=n.sort(pJ).pop(),o,s,l;for(Hi=[],To=new Array(n.length),Yl=new d1,mf=new d1;;)if(l=Ug,e&&(!l||e[1]<l.y||e[1]===l.y&&e[0]<l.x))(e[0]!==o||e[1]!==s)&&(ZL(e),o=e[0],s=e[1]),e=n.pop();else if(l)$L(l.arc);else break;if(qL(),t){var p=+t[0][0],h=+t[0][1],g=+t[1][0],m=+t[1][1];GL(p,h,g,m),HL(p,h,g,m)}this.edges=Hi,this.cells=To,Yl=mf=Hi=To=null}Bg.prototype={constructor:Bg,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return g1(t,n[o])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,o){if(h=(l=e.halfedges).length)for(var s=e.site,l,p=-1,h,g,m=t[l[h-1]],v=m.left===s?m.right:m.left;++p<h;)g=v,m=t[l[p]],v=m.left===s?m.right:m.left,g&&v&&o<g.index&&o<v.index&&hJ(s,g,v)<0&&n.push([s.data,g.data,v.data])}),n},links:function(){return this.edges.filter(function(n){return n.right}).map(function(n){return{source:n.left.data,target:n.right.data}})},find:function(n,t,e){for(var o=this,s,l=o._found||0,p=o.cells.length,h;!(h=o.cells[l]);)if(++l>=p)return null;var g=n-h.site[0],m=t-h.site[1],v=g*g+m*m;do h=o.cells[s=l],l=null,h.halfedges.forEach(function(x){var E=o.edges[x],b=E.left;if(!((b===h.site||!b)&&!(b=E.right))){var T=n-b[0],I=t-b[1],S=T*T+I*I;S<v&&(v=S,l=b.index)}});while(l!==null);return o._found=s,e==null||v<=e*e?h.site:null}};var EJ=sn(yf(),1);var R1=sn(tN(),1);function Zo(){return new kg}function kg(){this.reset()}kg.prototype={constructor:kg,reset:function(){this.s=this.t=0},add:function(n){eN(Gg,n,this.t),eN(this,Gg.s,this.s),this.s?this.t+=Gg.t:this.s=Gg.t},valueOf:function(){return this.s}};var Gg=new kg;function eN(n,t,e){var o=n.s=t+e,s=o-t,l=o-s;n.t=t-l+(e-s)}var er=1e-6;var gr=Math.PI,Mi=gr/2,qg=gr/4,Da=gr*2,$l=180/gr,Jo=gr/180,Zr=Math.abs,aa=Math.atan,Ko=Math.atan2,Wn=Math.cos;var Hg=Math.exp;var Oh=Math.log;var an=Math.sin;var no=Math.sqrt,Dh=Math.tan;function _1(n){return n>1?0:n<-1?gr:Math.acos(n)}function Co(n){return n>1?Mi:n<-1?-Mi:Math.asin(n)}function ua(){}var wJ=Zo(),rpt=Zo();function Zl(n){var t=n[0],e=n[1],o=Wn(e);return[o*Wn(t),o*an(t),an(e)]}function Fh(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function Uh(n){var t=no(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var ppt=Zo();function rN(n,t){return[n>gr?n-Da:n<-gr?n+Da:n,t]}rN.invert=rN;function x1(){var n=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){n.push(t=[])},lineEnd:ua,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function E1(n,t){return Zr(n[0]-t[0])<er&&Zr(n[1]-t[1])<er}function Vg(n,t,e,o){this.x=n,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function w1(n,t,e,o,s){var l=[],p=[],h,g;if(n.forEach(function(T){if(!((I=T.length-1)<=0)){var I,S=T[0],w=T[I],R;if(E1(S,w)){for(s.lineStart(),h=0;h<I;++h)s.point((S=T[h])[0],S[1]);s.lineEnd();return}l.push(R=new Vg(S,T,null,!0)),p.push(R.o=new Vg(S,null,R,!1)),l.push(R=new Vg(w,T,null,!1)),p.push(R.o=new Vg(w,null,R,!0))}}),!!l.length){for(p.sort(t),iN(l),iN(p),h=0,g=p.length;h<g;++h)p[h].e=e=!e;for(var m=l[0],v,x;;){for(var E=m,b=!0;E.v;)if((E=E.n)===m)return;v=E.z,s.lineStart();do{if(E.v=E.o.v=!0,E.e){if(b)for(h=0,g=v.length;h<g;++h)s.point((x=v[h])[0],x[1]);else o(E.x,E.n.x,1,s);E=E.n}else{if(b)for(v=E.p.z,h=v.length-1;h>=0;--h)s.point((x=v[h])[0],x[1]);else o(E.x,E.p.x,-1,s);E=E.p}E=E.o,v=E.z,b=!b}while(!E.v);s.lineEnd()}}}function iN(n){if(t=n.length){for(var t,e=0,o=n[0],s;++e<t;)o.n=s=n[e],s.p=o,o=s;o.n=s=n[0],s.p=o}}function sl(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function S1(n){return n.length===1&&(n=bJ(n)),{left:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var l=o+s>>>1;n(t[l],e)<0?o=l+1:s=l}return o},right:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var l=o+s>>>1;n(t[l],e)>0?s=l:o=l+1}return o}}}function bJ(n){return function(t,e){return sl(n(t),e)}}var oN=S1(sl),AJ=oN.right,TJ=oN.left;var sN=Array.prototype,PJ=sN.slice,IJ=sN.map;var odt=Math.sqrt(50),sdt=Math.sqrt(10),adt=Math.sqrt(2);function Xg(n){for(var t=n.length,e,o=-1,s=0,l,p;++o<t;)s+=n[o].length;for(l=new Array(s);--t>=0;)for(p=n[t],e=p.length;--e>=0;)l[--s]=p[e];return l}var BJ=1e9,Vgt=-BJ;var M1=Zo();function b1(n,t){var e=t[0],o=t[1],s=[an(e),-Wn(e),0],l=0,p=0;M1.reset();for(var h=0,g=n.length;h<g;++h)if(v=(m=n[h]).length)for(var m,v,x=m[v-1],E=x[0],b=x[1]/2+qg,T=an(b),I=Wn(b),S=0;S<v;++S,E=R,T=F,I=W,x=w){var w=m[S],R=w[0],C=w[1]/2+qg,F=an(C),W=Wn(C),X=R-E,q=X>=0?1:-1,D=q*X,xt=D>gr,B=T*F;if(M1.add(Ko(B*q*an(D),I*W+B*Wn(D))),l+=xt?X+q*Da:X,xt^E>=e^R>=e){var j=Fh(Zl(x),Zl(w));Uh(j);var J=Fh(s,j);Uh(J);var Dt=(xt^X>=0?-1:1)*Co(J[2]);(o>Dt||o===Dt&&(j[0]||j[1]))&&(p+=xt^X>=0?1:-1)}}return(l<-er||l<er&&M1<-er)^p&1}var tmt=Zo();var _mt=Zo(),xmt=Zo();var kJ=1/0;var Smt=-kJ;function A1(n){this._context=n}A1.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._context.moveTo(n,t),this._point=1;break}case 1:{this._context.lineTo(n,t);break}default:{this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,Da);break}}},result:ua};var Nmt=Zo();function T1(){this._string=[]}T1.prototype={_radius:4.5,_circle:lN(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._string.push("M",n,",",t),this._point=1;break}case 1:{this._string.push("L",n,",",t);break}default:{this._circle==null&&(this._circle=lN(this._radius)),this._string.push("M",n,",",t,this._circle);break}}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}else return null}};function lN(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function C1(n,t,e,o){return function(s,l){var p=t(l),h=s.invert(o[0],o[1]),g=x1(),m=t(g),v=!1,x,E,b,T={point:I,lineStart:w,lineEnd:R,polygonStart:function(){T.point=C,T.lineStart=F,T.lineEnd=W,E=[],x=[]},polygonEnd:function(){T.point=I,T.lineStart=w,T.lineEnd=R,E=Xg(E);var X=b1(x,h);E.length?(v||(l.polygonStart(),v=!0),w1(E,VJ,X,e,l)):X&&(v||(l.polygonStart(),v=!0),l.lineStart(),e(null,null,1,l),l.lineEnd()),v&&(l.polygonEnd(),v=!1),E=x=null},sphere:function(){l.polygonStart(),l.lineStart(),e(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function I(X,q){var D=s(X,q);n(X=D[0],q=D[1])&&l.point(X,q)}function S(X,q){var D=s(X,q);p.point(D[0],D[1])}function w(){T.point=S,p.lineStart()}function R(){T.point=I,p.lineEnd()}function C(X,q){b.push([X,q]);var D=s(X,q);m.point(D[0],D[1])}function F(){m.lineStart(),b=[]}function W(){C(b[0][0],b[0][1]),m.lineEnd();var X=m.clean(),q=g.result(),D,xt=q.length,B,j,J;if(b.pop(),x.push(b),b=null,!!xt){if(X&1){if(j=q[0],(B=j.length-1)>0){for(v||(l.polygonStart(),v=!0),l.lineStart(),D=0;D<B;++D)l.point((J=j[D])[0],J[1]);l.lineEnd()}return}xt>1&&X&2&&q.push(q.pop().concat(q.shift())),E.push(q.filter(HJ))}}return T}}function HJ(n){return n.length>1}function VJ(n,t){return((n=n.x)[0]<0?n[1]-Mi-er:Mi-n[1])-((t=t.x)[0]<0?t[1]-Mi-er:Mi-t[1])}var WJ=C1(function(){return!0},XJ,$J,[-gr,-Mi]);function XJ(n){var t=NaN,e=NaN,o=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(l,p){var h=l>0?gr:-gr,g=Zr(l-t);Zr(g-gr)<er?(n.point(t,e=(e+p)/2>0?Mi:-Mi),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(h,e),n.point(l,e),s=0):o!==h&&g>=gr&&(Zr(t-o)<er&&(t-=o*er),Zr(l-h)<er&&(l-=h*er),e=YJ(t,e,l,p),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(h,e),s=0),n.point(t=l,e=p),o=h},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function YJ(n,t,e,o){var s,l,p=an(n-e);return Zr(p)>er?aa((an(t)*(l=Wn(o))*an(e)-an(o)*(s=Wn(t))*an(n))/(s*l*p)):(t+o)/2}function $J(n,t,e,o){var s;if(n==null)s=e*Mi,o.point(-gr,s),o.point(0,s),o.point(gr,s),o.point(gr,0),o.point(gr,-s),o.point(0,-s),o.point(-gr,-s),o.point(-gr,0),o.point(-gr,s);else if(Zr(n[0]-t[0])>er){var l=n[0]<t[0]?gr:-gr;s=e*l/2,o.point(-l,s),o.point(0,s),o.point(l,s)}else o.point(t[0],t[1])}function Yg(n){return function(t){var e=new P1;for(var o in n)e[o]=n[o];return e.stream=t,e}}function P1(){}P1.prototype={constructor:P1,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var x0t=Wn(30*Jo);var O0t=Yg({point:function(n,t){this.stream.point(n*Jo,t*Jo)}});function $g(n){return function(t,e){var o=Wn(t),s=Wn(e),l=n(o*s);return[l*s*an(t),l*an(e)]}}function Fa(n){return function(t,e){var o=no(t*t+e*e),s=n(o),l=an(s),p=Wn(s);return[Ko(t*l,o*p),Co(o&&e*l/o)]}}var mN=$g(function(n){return no(2/(1+n))});mN.invert=Fa(function(n){return 2*Co(n/2)});var yN=$g(function(n){return(n=_1(n))&&n/an(n)});yN.invert=Fa(function(n){return n});function I1(n,t){return[n,Oh(Dh((Mi+t)/2))]}I1.invert=function(n,t){return[n,2*aa(Hg(t))-Mi]};function Zg(n,t){return[n,t]}Zg.invert=Zg;function vN(n,t){var e=Wn(t),o=Wn(n)*e;return[e*an(n)/o,an(t)/o]}vN.invert=Fa(aa);function _N(n,t){var e=t*t,o=e*e;return[n*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}_N.invert=function(n,t){var e=t,o=25,s;do{var l=e*e,p=l*l;e-=s=(e*(1.007226+l*(.015085+p*(-.044475+.028874*l-.005916*p)))-t)/(1.007226+l*(.015085*3+p*(-.044475*7+.028874*9*l-.005916*11*p)))}while(Zr(s)>er&&--o>0);return[n/(.8707+(l=e*e)*(-.131979+l*(-.013791+l*l*l*(.003971-.001529*l)))),e]};function xN(n,t){return[Wn(t)*an(n),an(t)]}xN.invert=Fa(Co);function EN(n,t){var e=Wn(t),o=1+Wn(n)*e;return[e*an(n)/o,an(t)/o]}EN.invert=Fa(function(n){return 2*aa(n)});function wN(n,t){return[Oh(Dh((Mi+t)/2)),-n]}wN.invert=function(n,t){return[-t,2*aa(Hg(n))-Mi]};var tK=sn(yf(),1);var eK=sn(yf(),1);var rK=sn(yf(),1);var iK=sn(yf(),1);function _f(n,t){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}function MN(n){let t=0;for(let e=0;e<n.length-1;e++)t+=_f(n[e],n[e+1]);return t}var jo=sn(bN(),1);var Xn="___",Jg=class{isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let o=[];try{o=JSON.parse(e.entry_end_floor)}catch(l){o=[]}let s=[];try{s=JSON.parse(e.entry_start_floor)}catch(l){s=[]}return Lu({},e,{entry_start_floor:s,entry_end_floor:o})})}getParkingSpaceInfo(t,e){let o=""+t+Xn+e;var s;return(s=this.parkingMap.get(o))!=null?s:null}getNodeInfo(t,e){let o=""+t+Xn+e,s=this.nodeMap.get(o);if(!(s!=null&&s.length))return null;let l=this.pointMap.get(s[0]);return l!=null?l:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let o=new Date,s=o.getHours()*60+o.getMinutes();t.length&&(t.forEach(l=>{let p=(l.points||[]).filter(h=>!(0,jo.isNil)(h.passWeight)&&h.passWeight!==1&&!(0,jo.isNil)(h.coverageArea)&&h.coverageArea!==0);(l.points||[]).filter(h=>h.openStatus!==!1).filter(h=>{if(!h.startTime||!h.endTime)return!0;let[g,m]=h.startTime.split(":").map(T=>+T),[v,x]=h.endTime.split(":").map(T=>+T),E=g*60+m,b=v*60+x;return s>=E&&s<=b}).forEach(h=>{h.floor=l.floor;let g=""+l.floor+Xn+h.id,m=""+l.floor+Xn+h.nodeId,v=this.nodeMap.get(m)||[];if(v.push(""+l.floor+Xn+(h.relatedId||h.id)),this.nodeMap.set(""+l.floor+Xn+h.nodeId,v),this.pointMap.set(g,h),this.isFacilityByType(h.type)){let x=this.facilities.find(E=>E.id===+h.targetId);if(x){switch(x.entry_infra_type){case"straightLadder":if(x.entry_end_floor.find(I=>I.floor===l.floor)&&x.entry_start_floor.find(I=>I.floor===l.floor)){let I=this.straightLadderMap.get(h.targetId)||[];I.push(Lu({},h)),this.straightLadderMap.set(h.targetId,I)}break;case"staircase":if(x.entry_end_floor.find(I=>I.floor===l.floor)&&x.entry_start_floor.find(I=>I.floor===l.floor)){let I=this.staircaseMap.get(h.targetId)||[];I.push(Lu({},h)),this.staircaseMap.set(h.targetId,I)}break;case"escalator":let b=this.escalatorMap.get(h.targetId)||[];if(x.entry_start_floor.find(I=>I.floor===l.floor)){let I=b.find(S=>{var w;return((w=S.end)==null?void 0:w.floor)!==l.floor&&!S.start});I?I.start=h:b.push({start:h})}if(x.entry_end_floor.find(I=>I.floor===l.floor)){let I=b.find(S=>{var w;return((w=S.start)==null?void 0:w.floor)!==l.floor&&!S.end});I?I.end=h:b.push({end:h})}this.escalatorMap.set(h.targetId,b);break;case"ramp":let T=this.rampMap.get(h.targetId)||[];if(x.entry_start_floor.find(I=>I.floor===l.floor)){let I=T.find(S=>{var w;return((w=S.end)==null?void 0:w.floor)!==l.floor&&!S.start});I?I.start=h:T.push({start:h})}if(x.entry_end_floor.find(I=>I.floor===l.floor)){let I=T.find(S=>{var w;return((w=S.start)==null?void 0:w.floor)!==l.floor&&!S.end});I?I.end=h:T.push({end:h})}this.rampMap.set(h.targetId,T);break;case"connectionPoint":if(x.entry_end_floor.find(I=>I.floor===l.floor)&&x.entry_start_floor.find(I=>I.floor===l.floor)){let I=this.connectionPointMap.get(h.targetId)||[];I.push(Lu({},h)),this.connectionPointMap.set(h.targetId,I)}break}let E=this.facilityMap.get(h.targetId)||[];E.push(Lu({},h)),this.facilityMap.set(h.targetId,E)}}h.type==="parkingSpace"&&h.name.split(/[,\uFF0C]/).forEach(E=>{this.parkingMap.set(""+l.floor+Xn+E,h)})}),(l.lines||[]).filter(h=>h.to!==h.from).forEach(h=>{let g=""+l.floor+Xn+h.from,m=""+l.floor+Xn+h.to,v=this.pointMap.get(g),x=this.pointMap.get(m);if(!v||!x)return;let E=v.cds,b=x.cds,T=_f(E,b);if(p.forEach(I=>{(I.id===h.from||I.id===h.to)&&(T=T/I.passWeight);let S=_f(E,I.cds)<=I.coverageArea,w=_f(b,I.cds)<=I.coverageArea;(S||w)&&(T=T/I.passWeight)}),!v.permission&&!x.permission){switch(this.addLineItem(g,m,T),this.addLineItem(m,g,T),h.direction){case"double":this.addLineItem(g,m,T,this.forwardLineMap),this.addLineItem(m,g,T,this.forwardLineMap);break;case"single":this.addLineItem(g,m,T,this.forwardLineMap);break;case"back":this.addLineItem(m,g,T,this.forwardLineMap);break}(v.type==="parkingSpace"||x.type==="parkingSpace")&&h.direction==="noDir"&&(this.addLineItem(g,m,T,this.forwardLineMap),this.addLineItem(m,g,T,this.forwardLineMap))}else v.permission&&(this.setPermissionLine(g,m,v.permission,T,""),this.setPermissionLine(m,g,v.permission,T,"")),x.permission&&x.permission!==v.permission&&(this.setPermissionLine(g,m,x.permission,T,""),this.setPermissionLine(m,g,x.permission,T,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,o,s,l){this.getPermissionMap(o).add({fromKey:t,toKey:e,distance:s,type:l})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,l=this.pointMap.get(s);if(l){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g)continue;l.permission&&this.setPermissionLine(s,h,l.permission,1,"straightLadder"),g.permission&&g.permission!==l.permission&&this.setPermissionLine(s,h,g.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,l=this.pointMap.get(s);if(l){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g)continue;l.permission&&this.setPermissionLine(s,h,l.permission,1,"staircase"),g.permission&&g.permission!==l.permission&&this.setPermissionLine(s,h,g.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Xn+o.start.id,l=""+o.end.floor+Xn+o.end.id,p=this.pointMap.get(s),h=this.pointMap.get(l);p&&h&&(p.permission&&this.setPermissionLine(s,l,p.permission,1,"escalator"),h.permission&&h.permission!==p.permission&&this.setPermissionLine(s,l,h.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Xn+o.start.id,l=""+o.end.floor+Xn+o.end.id,p=this.pointMap.get(s),h=this.pointMap.get(l);p&&h&&(p.permission&&this.setPermissionLine(s,l,p.permission,10,"ramp"),h.permission&&h.permission!==p.permission&&this.setPermissionLine(s,l,h.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{if(t.length<2){this.connectionPointMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,l=this.pointMap.get(s);if(l){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g)continue;l.permission&&this.setPermissionLine(s,h,l.permission,1,"connectionPoint"),g.permission&&g.permission!==l.permission&&this.setPermissionLine(s,h,g.permission,1,"connectionPoint")}}}})}addPermissionLineToMap(t,e,o,s){this.getPermissionMap(t).forEach(p=>{e.includes(p.type)&&(p.type===""?this.addLineItem(p.fromKey,p.toKey,p.distance,o):this.addLineItem(p.fromKey,p.toKey,s.get(p.type),o))})}addLineItem(t,e,o,s){s===void 0&&(s=this.lineMap);let l=s.get(t)||new Map;l.set(e,o),s.set(t,l)}addFacilityToLineMap(t,e,o,s){[...this.straightLadderMap,...this.staircaseMap].forEach(l=>{let[p,h]=l;if(!(h.length<2))for(let g=0;g<h.length;g++){let m=""+h[g].floor+Xn+h[g].id,v=this.pointMap.get(m);if(!(!v||v.permission)){for(let x=0;x<h.length;x++)if(g!==x){let E=""+h[x].floor+Xn+h[x].id,b=this.pointMap.get(E);if(!b||b.permission)continue;if(h[g].type==="straightLadder"){let T=e;this.addLineItem(m,E,T,s)}else{let T=o;this.addLineItem(m,E,T,s)}}}}}),this.escalatorMap.forEach((l,p)=>{l.forEach(h=>{if(h.start&&h.end){let g=""+h.start.floor+Xn+h.start.id,m=""+h.end.floor+Xn+h.end.id,v=this.pointMap.get(g),x=this.pointMap.get(m);if(v&&x&&!v.permission&&!x.permission){let E=t;this.addLineItem(g,m,E,s)}}})}),this.connectionPointMap.forEach((l,p)=>{if(!(l.length<2))for(let h=0;h<l.length;h++){let g=""+l[h].floor+Xn+l[h].id,m=this.pointMap.get(g);if(!(!m||m.permission)){for(let v=0;v<l.length;v++)if(h!==v){let x=""+l[v].floor+Xn+l[v].id,E=this.pointMap.get(x);if(!E||E.permission)continue;this.addLineItem(g,x,100,s)}}}})}initBaseRoute(){let t=new Map((0,jo.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100*this.lift_priority,3e4,t),this.baseRoute=new ro.default(t)}initEscalatorRoute(){let t=new Map((0,jo.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new ro.default(t)}initStraightLadderRoute(){let t=new Map((0,jo.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new ro.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Xn+o.start.id,l=""+o.end.floor+Xn+o.end.id,p=this.pointMap.get(s),h=this.pointMap.get(l);p&&h&&!p.permission&&!h.permission&&this.addLineItem(s,l,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{if(!(t.length<2))for(let o=0;o<t.length;o++){let s=""+t[o].floor+Xn+t[o].id,l=this.pointMap.get(s);if(!(!l||l.permission)){for(let p=0;p<t.length;p++)if(o!==p){let h=""+t[p].floor+Xn+t[p].id,g=this.pointMap.get(h);if(!g||g.permission)continue;this.addLineItem(s,h,100,this.forwardLineMap)}}}}),this.forwardRoute=new ro.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t,e,o){o===void 0&&(o={});var s;if(t.nodeId){let l=this.nodeMap.get(""+t.floor+Xn+t.nodeId);if(l!=null&&l.length)return l.map(p=>{let[h,g]=p.split(Xn);return{floor:h,id:g}})}if((s=t.coord)!=null&&s.length){let l=this.roadInfo.find(m=>m.floor===t.floor);if(!l)return null;let p=l.points.filter(m=>m.isStarted),h=l.points.filter(m=>{let v=""+m.floor+Xn+m.id;if(e==="forward"){if(!this.forwardLineMap.has(v)||o.adsorptionIntersection&&p.length&&!m.isStarted)return!1}else if(!this.lineMap.has(v))return!1;return!0});if(!h.length)return null;let g=h.reduce((m,v)=>{if(v.relatedId)return m;let x=_f(t.coord,v.cds);return x<m.min&&(m.min=x,m.point=v),m},{min:1/0,point:h[0]});return[{floor:l.floor,id:g.point.id}]}return null}transformEnd(t,e){if(t.floor){if(t.parkingSpace){let s=this.parkingMap.get(""+t.floor+Xn+t.parkingSpace);if(s)return[{floor:t.floor,id:s.id}]}let o=this.transformStart(t,e);if(o)return o}if(t.facility){let s=this.facilities.filter(l=>+l.type_id==+t.facility).map(l=>l.id).map(l=>this.facilityMap.get(""+l)).flat(2);if(s!=null&&s.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o,s,l,p){if(o===void 0&&(o=""),p===void 0&&(p={}),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let h=this.transformStart(t,o,p);if(!h)return"no-start";let g=this.transformEnd(e,o);if(!g)return"no-end";let m=[];if(Array.isArray(g))for(let E=0;E<h.length;E++){let b=h[E];for(let T=0;T<g.length;T++){let I=g[T];if(b.floor===I.floor&&b.id===I.id)return"near"}}else{m=this.facilities.filter(b=>+b.type_id==+e.facility).map(b=>b.id).map(b=>this.facilityMap.get(""+b)).flat(2).filter(b=>b).filter(b=>g.floor?b.floor===g.floor:!0);for(let b=0;b<h.length;b++){let T=h[b];for(let I=0;I<m.length;I++){let S=m[I];if(T.floor===S.floor&&T.id===S.id)return"near"}}}let v;switch(o){case"escalator":v=this.getEscalatorPath.bind(this);break;case"straightLadder":v=this.getStraightLadderPath.bind(this);break;case"forward":v=this.getForwardPath.bind(this);break;default:v=this.getBasePath.bind(this);break}let x=null;return h.forEach(E=>{if(Array.isArray(g))g.forEach(b=>{let T=v(E,b,s,l);T&&T&&(!x||T[0].consume<x[0].consume)&&(x=T)});else{if(!m.length)return null;let b=m.map(T=>v(E,{floor:T.floor,id:T.id},s,l)).filter(T=>!!T);x=b.reduce((T,I)=>{let S=I[0].consume;return S<T.distance&&(T.distance=S,T.path=I),T},{distance:1/0,path:b[0]}).path}}),x}getRoutePath(t,e,o){let s=""+t.floor+Xn+t.id,l=""+e.floor+Xn+e.id,p=o.path(s,l);if(!p)return null;let h=[],g=p.reduce((m,v,x,E)=>{if(x===0)return 0;let b=E[x-1],T=o.graph.get(b).get(v);return m+T},0);return p.map(m=>{let v=this.pointMap.get(m);if(v){var x;let{floor:E}=v,b=v.type;if(this.isFacilityByType(v.type)){let T=this.facilities.find(I=>I.id===+v.targetId);T&&(b=T.entry_infra_type)}if(((x=h[h.length-1])==null?void 0:x.floor)===E){let T=h[h.length-1];T.points.push(v.cds),T.pointInfos.push(v),T.endType=b,T.destId=v.nodeId,T.distance=MN(T.points)}else h.push({floor:E,points:[v.cds],pointInfos:[v],endType:b,destId:v.nodeId,distance:0,consume:g})}}),h}getBasePath(t,e,o){if(!o)return this.getRoutePath(t,e,this.baseRoute);let s=(0,jo.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100*this.lift_priority],["staircase",3e4]]));let l=new ro.default(s);return this.getRoutePath(t,e,l)}getEscalatorPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.escalatorRoute);let s=(0,jo.cloneDeep)(this.escalatorRoute.graph),l=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",1*l],["connectionPoint",100],["straightLadder",this.lift_priority*l],["staircase",3e4*l]]));let p=new ro.default(s);return this.getRoutePath(t,e,p)}getStraightLadderPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.straightLadderRoute);let s=(0,jo.cloneDeep)(this.straightLadderRoute.graph),l=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",3*l],["connectionPoint",100],["straightLadder",1*l],["staircase",3e4*l]]));let p=new ro.default(s);return this.getRoutePath(t,e,p)}getForwardPath(t,e,o,s){let l=new Map,p=E=>{let b=this.forwardRoute.graph.get(g);E.forEach(T=>{let I=b.get(T);(0,jo.isNil)(I)||(l.set(T,I),b.delete(T))})},h=()=>{let E=this.forwardRoute.graph.get(g);l.forEach((b,T)=>{E.set(T,b)})},g=""+t.floor+Xn+t.id;if(!(0,jo.isNil)(s)){let E=this.forwardLineMap.get(g),b=this.pointMap.get(g);if(b&&(E!=null&&E.size)&&E.size>1){let T=new Ye(b.cds[0],b.cds[1]),I=new Map;E.forEach((w,R)=>{let C=this.pointMap.get(R);if(C){let F=new Ye(C.cds[0],C.cds[1]),X=360-(new Ye().subVectors(F,T).angle()/Math.PI*180-90+360)%360;I.set(R,X)}});let S=Array.from(I).filter(w=>{let[R,C]=w;return Math.abs(C-s)<=60}).map(w=>{let[R]=w;return R});if(S.length)S.forEach(w=>I.delete(w)),p([...I.keys()]);else{let w=Array.from(I).reduce((R,C)=>{let F=Math.abs(C[1]-s);return F<R.diff?{diff:F,key:C[0]}:R},{diff:1/0,key:""});I.delete(w.key),p([...I.keys()])}}}if(!o){let E=this.getRoutePath(t,e,this.forwardRoute);return h(),E||this.getRoutePath(t,e,this.forwardRoute)}let m=(0,jo.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],m,new Map([["ramp",10]]));let v=new ro.default(m),x=this.getRoutePath(t,e,v);if(h(),x)return x;{let E=(0,jo.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],E,new Map([["ramp",10]]));let b=new ro.default(E);return this.getRoutePath(t,e,b)}}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new ro.default,this.escalatorRoute=new ro.default,this.straightLadderRoute=new ro.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.baseRoute=new ro.default,this.escalatorRoute=new ro.default,this.straightLadderRoute=new ro.default,this.forwardLineMap=new Map,this.forwardRoute=new ro.default}};var uwt=sn(jN(),1),lwt=sn(Yp(),1);function QN(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function t2(n){let t={};for(let o in n)o.startsWith("on")&&(t[QN(o.slice(2))]=n[o]);let e=o=>ac(this,null,function*(){let{data:s}=o;if(t[s.type])try{let l=yield t[s.type](s.data);if(l!=null&&l.$transfer&&Array.isArray(l.$transfer)){let p=l.$transfer;delete l.$transfer,self.postMessage({type:""+s.type+"_result",key:s.key,data:l},p)}else self.postMessage({type:""+s.type+"_result",key:s.key,data:l})}catch(l){self.postMessage({type:""+s.type+"_result",key:s.key,error:l})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var la=new Jg,r2,QK=new Promise(n=>{r2=n});function i2(n,t,e){let{floor:o,coord:s}=n,l=null;return(t||[]).forEach(p=>{let h=la.getPath({floor:o,coord:s},{floor:p.floor,parkingSpace:p.lot_id},"forward",0,e);if(h==="near"){l={floor:p.floor,spaceNo:p.lot_id,distance:0};return}if(!h||typeof h=="string")return;let g={floor:p.floor,spaceNo:p.lot_id,distance:h[0].consume};l||(l=g),l.distance>g.distance&&(l=g)}),l}function e2(n,t,e,o,s){let l=i2({floor:n,coord:t},e[n],s);return l||tj(n,t,e,o,s)}function tj(n,t,e,o,s){let l=o.indexOf(n);l===-1&&(l=o.length);let p=1,h=null;for(;p<=o.length;){if(o.filter((m,v)=>v===l-1||v===l+1).forEach(m=>{let v=i2({floor:n,coord:t},e[m],s);h?v&&h.distance>v.distance&&(h=v):h=v}),h)return h;p++}return h}function n2(n,t,e,o,s){let l=z1(n,t,t.floor,e,s);if(l)return l;let p=z1(n,t,n.floor,e,s);return p||ej(n,t,n.floor,e,o,s)}function z1(n,t,e,o,s){let l=o[e]||[];if(!l.length)return null;let p=null;return l.forEach(h=>{let g={floor:h.floor,parkingSpace:h.lot_id},m=la.getPath(n,g,"forward",0,s);if(!m||typeof m=="string"&&m!=="near")return;let v=la.getParkingSpaceInfo(h.floor,h.lot_id);if(!v)return;let x=la.getPath({floor:h.floor,coord:v.cds},t,"",0);if(x==="near"){p={floor:h.floor,spaceNo:h.lot_id,distance:0};return}if(!x||typeof x=="string")return;let E={floor:h.floor,spaceNo:h.lot_id,distance:x[0].consume};p?p.distance>E.distance&&(p=E):p=E}),p}function ej(n,t,e,o,s,l){let p=s.indexOf(e);p===-1&&(p=s.length);let h=1,g=null;for(;h<=s.length;){if(s.filter((v,x)=>x===p-1||x===p+1).forEach(v=>{let x=z1(n,t,v,o,l);g?x&&g.distance>x.distance&&(g=x):g=x}),g)return g;h++}return g}function nj(n){if(n.coord)return{floor:n.floor,coord:n.coord};if(n.nodeId){let t=la.getNodeInfo(n.floor,n.nodeId);if(t)return{floor:t.floor,coord:t.cds}}return null}function rj(n){if(n.coord)return{floor:n.floor,coord:n.coord};if(n.nodeId){let t=la.getNodeInfo(n.floor,n.nodeId);if(t)return{floor:t.floor,coord:t.cds}}if(n.parkingSpace){let t=la.getParkingSpaceInfo(n.floor,n.parkingSpace);if(t)return{floor:t.floor,coord:t.cds}}return null}t2({onSetRoadInfo(n){let{roadData:t,facilities:e}=n;la.initRoute(t,e),r2(!0)},onRecommend(n){return ac(this,null,function*(){let{start:t,end:e,travelDirection:o,carLotStatus:s,parkingType:l}=n;yield QK;let p=s.reduce((v,x)=>(v[x.floor]?v[x.floor].push(x):v[x.floor]=[x],v),{}),h=la.roadInfo.map(v=>v.floor),g=nj(t);if(!g)return null;let m=e?rj(e):null;if(l){let v=s.filter(x=>{let E=la.getParkingSpaceInfo(x.floor,x.lot_id);return E?E.parkingType===l:!1});if(v){let x=v.reduce((E,b)=>(E[b.floor]?E[b.floor].push(b):E[b.floor]=[b],E),{});if(m){let E=n2(g,m,x,h,o);if(E)return E}else{let E=e2(g.floor,g.coord,x,h,o);if(E)return E}}}return m?n2(g,m,p,h,o):e2(g.floor,g.coord,p,h,o)})},onClear(){la.clear()}});
27666
27666
  `],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var SMt={placeId:0,catLotStatusApi:"https://vrapi.aibee.cn/parking/cat-lot-status"},nP=class{setRoadData(t,e){return fi(this.worker,"set_road_info",{roadData:t,facilities:e})}recommend(t){return Tt(this,null,function*(){let e=yield fetch(this.options.catLotStatusApi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({place_id:+this.options.placeId})}).then(n=>n.json()).then(n=>n.data.filter(i=>i.status===0));return fi(this.worker,"recommend",ee({},t,{carLotStatus:e}))})}dispose(){this.worker.terminate()}constructor(t={}){this.worker=eP(),this.options=ee({},SMt,t)}};var lle=H(sf(),1),cle=H(ze(),1),hle=H(Kf(),1),fle=H(En(),1),ple=H(vR(),1),dle=H(yR(),1),gle=H(ER(),1),mle=H(bR(),1),vle=H(Xa(),1);var ile=H(sf(),1);var bMt={url:"",reconnect:!0,heartBeat:2e3,heartMsg:"PING",reconnectTime:3e3,reconnectMaxCount:1e6,noMessageTime:6e3},Eg=class extends Zi{initWebsocket(){this.ws=new WebSocket(this.options.url),this.ws.onopen=()=>{this.alive=!0,this.startHeart(),this.startOnMessageTimer(),this.stopReconnect(),this.dispatchEvent({type:"open"})},this.ws.onerror=()=>{this.alive=!1,this.ws=null,this.stopHeart(),this.stopOnMessageTimer(),this.startReconnect(),this.registryEvent()},this.ws.onclose=()=>{this.alive=!1,this.ws=null,this.stopHeart(),this.stopOnMessageTimer(),this.startReconnect()},this.ws.onmessage=t=>{this.startOnMessageTimer(),this.dispatchEvent({type:"message",message:t})}}startHeart(){this.stopHeart(),this.heartTimer=this.timer.setInterval(()=>{this.send(this.options.heartMsg)&&this.dispatchEvent({type:"send-heart"})},this.options.heartBeat)}stopHeart(){this.heartTimer&&(this.timer.clearInterval(this.heartTimer),this.heartTimer=null)}startReconnect(t){t===void 0&&(t=this.options.reconnectTime),this.stopReconnect(),this.options.reconnect&&(this.options.reconnectMaxCount--,this.options.reconnectMaxCount>=0&&(this.reconnectTimer=this.timer.setTimeout(()=>{this.initWebsocket()},t)))}stopReconnect(){this.reconnectTimer&&(this.timer.clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}startOnMessageTimer(){this.stopOnMessageTimer(),this.noMessageTimer=this.timer.setTimeout(()=>{var t;(t=this.ws)==null||t.close(),this.dispatchEvent({type:"no-message-timeout"})},this.options.noMessageTime)}stopOnMessageTimer(){this.noMessageTimer&&(this.timer.clearTimeout(this.noMessageTimer),this.noMessageTimer=null)}send(t){var e;let n=typeof t=="string"?t:JSON.stringify(t);return this.alive&&((e=this.ws)==null?void 0:e.readyState)===1?(this.ws.send(t),this.dispatchEvent({type:"send-success",msg:n}),!0):(this.dispatchEvent({type:"send-fail",msg:n}),!1)}registryEvent(){window.addEventListener("online",this.onOnline)}unRegistryEvent(){window.removeEventListener("online",this.onOnline)}close(){var t;this.unRegistryEvent(),this.options.reconnect=!1,this.alive=!1,this.stopHeart(),this.stopReconnect(),this.stopOnMessageTimer(),(t=this.ws)==null||t.close(),this.ws=null,this.dispatchEvent({type:"close"})}dispose(){this.close(),this.timer.dispose(),super.dispose()}constructor(t){super(),this.ws=null,this.alive=!1,this.timer=new ui,this.heartTimer=null,this.reconnectTimer=null,this.noMessageTimer=null,this.onOnline=()=>{this.startReconnect()},this.options=ee({},bMt,t||{}),this.options.url&&this.initWebsocket()}};var iP=H(qs(),1);var rP=r=>{let t=r.toString(2),e=""+Array(16-t.length+1).join("0")+t,n=parseInt(e.slice(0,4),2)*10,i=parseInt(e.slice(4,16),2);return[n,i]};var oP=class extends Zi{initPositionWebSocket(){let t=ee({},this.options.ext_position_params,{place_id:this.options.place_id,token:this.options.access_token}),e=Object.keys(t).filter(n=>!(0,iP.isNil)(t[n])).map(n=>n+"="+t[n]).join("&");this.positionWebSocket=new Eg({url:this.options.wss_position_url+"?"+e}),this.positionWebSocket.addEventListener("message",n=>{let{message:i}=n,o=(()=>{try{return JSON.parse(i.data)}catch(L){return i.data}})();if(o.command==="POSITION_RESULT"&&o.data.success)if(["POSITION","FLOOR","PARK_POSITION"].includes(o.data.success_type)&&this.useGpsFloorTimer&&(this.positionFloor=o.data.floor,this.timer.clearTimeout(this.useGpsFloorTimer),this.useGpsFloorTimer=null),o.data.success_type==="POSITION"){let{x:L,y:tt,time:O,floor:V,ts:W}=o.data,St=this.positionFloor!==V;if(this.positionFloor=V,this.dispatchEvent({type:"ws-position",floor:V,x:L,y:tt,time:O}),console.log("positionFloor",V,St),this.options.upload_position){var a;(a=this.positionWebSocket)==null||a.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:L,y:tt,floor:V,type:"originBeacon"}),serverData:JSON.stringify(o)})}if(!this.options.use_pdr){this.dispatchEvent({type:"position",floor:V,x:L,y:tt,time:new Date(W).getTime()-o.lag-o.duration});return}if(this.options.type!==1){var l;if(St){var c,f,g;(g=this.pdrPosition)==null||(f=g.pdr)==null||(c=f.particleFilter)==null||c.setPosInitFlag(!1)}(l=this.pdrPosition)==null||l.setBeaconPosition({x:L,y:tt},new Date(W).getTime()-o.lag-o.duration)}else if(St){var m;if(this.resetPdr(),(m=this.carInertialPosition)==null||m.stopPositionTimer(),this.path){let j=this.path.findIndex(mt=>mt.floor===V),pt=this.path[j];if(pt){var v;this.resetPdr(),(v=this.carInertialPosition)==null||v.setBeaconPosition(pt.points[0],new Date(O).getTime()-o.lag-o.duration,o.lag+o.duration)}else{var x;(x=this.carInertialPosition)==null||x.setBeaconPosition([L,tt],new Date(O).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var S;(S=this.carInertialPosition)==null||S.setBeaconPosition([L,tt],new Date(O).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var w;(w=this.carInertialPosition)==null||w.setBeaconPosition([L,tt],new Date(O).getTime()-o.lag-o.duration,o.lag+o.duration)}}else if(o.data.success_type==="PARK_POSITION"&&o.data.success){if(this.options.type===1){let{x:L,y:tt,time:O,floor:V}=o.data,W=this.positionFloor!==V;if(this.positionFloor=o.data.floor,this.dispatchEvent({type:"ws-position",floor:V,x:L,y:tt,time:O}),!this.options.use_pdr){this.dispatchEvent({type:"position",floor:V,x:L,y:tt,time:new Date(O).getTime()});return}if(W){var E;if(this.resetPdr(),(E=this.carInertialPosition)==null||E.stopPositionTimer(),this.path){let St=this.path.findIndex(pt=>pt.floor===V),j=this.path[St];if(j){var b;this.resetPdr(),(b=this.carInertialPosition)==null||b.setPosition(j.points[0],new Date(O).getTime(),o.duration)}else{var C;(C=this.carInertialPosition)==null||C.setPosition([L,tt],new Date(O).getTime(),o.duration)}}else{var A;(A=this.carInertialPosition)==null||A.setPosition([L,tt],new Date(O).getTime(),o.duration)}}else{var P,F;if((P=this.carInertialPosition)==null||P.setPosition([L,tt],new Date(O).getTime(),o.duration),!((F=this.carInertialPosition)!=null&&F.positionTimer)){var U;(U=this.carInertialPosition)==null||U.startPositionTimer()}}if(this.options.upload_position){var D;(D=this.positionWebSocket)==null||D.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:L,y:tt,floor:V,type:"vision"}),serverData:JSON.stringify(o)})}}}else this.dispatchEvent({type:"floor",floor:o.data.floor,time:o.data.time})})}initSensorWebSocket(){let t=ee({},this.options.ext_sensor_params,{token:this.options.access_token,place_id:this.options.place_id,record_sensor:1}),e=Object.keys(t).filter(n=>!(0,iP.isNil)(t[n])).map(n=>n+"="+t[n]).join("&");this.sensorWebSocket=new Eg({url:this.options.wss_sensor_url+"?"+e})}initPdr(){this.options.type===1?(this.carInertialPosition=new P_,this.carInertialPosition.addEventListener("change-pos",t=>{let{value:e}=t,{pos:n,success:i,speed:o}=e;if(i&&(this.dispatchEvent({type:"position",floor:this.positionFloor,x:n[0],y:n[1],time:Date.now(),speed:o}),this.options.upload_position)){var a;(a=this.positionWebSocket)==null||a.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:n[0],y:n[1],floor:this.positionFloor,type:"vision_pdr"})})}}),this.carInertialPosition.addEventListener("change-compass",t=>{let{value:e}=t;this.dispatchEvent({type:"compass",value:e})})):(this.pdrPosition=new A_(this.bmap,{pdr:{using_gps:this.options.use_gps},sensor:{elements:[Gr.COMPASS,Gr.ACCELERATION,Gr.DEVICE_MOTION].concat(this.options.use_gps?[Gr.GPS]:[])}}),this.requestDeviceOrientationPermission(),this.options.upload_position&&this.pdrPosition.sensor.addEventListener("sensor-data",t=>{let{data:e}=t;var n;(n=this.positionWebSocket)==null||n.send({command:"UPLOAD_SENSOR",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify(e)})}),this.pdrPosition.sensor.addEventListener("add-data-item",t=>{t.item.type==="compass"&&this.dispatchEvent({type:"compass",value:t.item.res})}),this.pdrPosition.addEventListener("position",t=>{let{x:e,y:n,_type:i}=t;if(console.log("_type",i,e,n,this.positionFloor,this.gpsFloor),i==="gps"&&!this.useGpsFloorTimer){let a=()=>{this.useGpsFloorTimer=this.timer.setTimeout(()=>{this.gpsFloor?this.positionFloor=this.gpsFloor:a()},5e3)};a()}if(this.positionFloor&&(this.dispatchEvent({type:"position",floor:this.positionFloor,x:e,y:n,time:Date.now()}),this.options.upload_position)){var o;(o=this.positionWebSocket)==null||o.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:e,y:n,floor:this.positionFloor,type:i})})}}))}setSensor(t){this.pdrPosition&&this.pdrPosition.setSensor(t)}requestDeviceOrientationPermission(){return Tt(this,null,function*(){if(this.pdrPosition){let t=yield this.pdrPosition.checkSensor();return t.deviceOrientation?this.pdrPosition.start():(this.dispatchEvent(ee({type:"check-sensor"},t)),!t.deviceOrientation&&this.options.use_default_permission),t}else return null})}getGpsFloor(){return Tt(this,null,function*(){if(this.options.use_gps&&this.options.get_gps_floor_url){let t=yield fetch(this.options.get_gps_floor_url+"/"+this.options.place_id).then(e=>e.json());t.code===200&&(this.gpsFloor=t.data.gps_floor)}})}pausePdr(){if(this.options.type===1){var t;(t=this.carInertialPosition)==null||t.stopPositionTimer()}else{var e;(e=this.pdrPosition)==null||e.pause()}}continuePdr(){if(this.options.type===1)this.carInertialPosition&&(this.carInertialPosition.positionTimer||this.carInertialPosition.startPositionTimer());else{var t;(t=this.pdrPosition)==null||t.continue()}}setPathAngle(t){if(this.options.type===1){var e;(e=this.carInertialPosition)==null||e.setPathAngle(t)}}getForwardAngle(){if(this.options.type===1){var t,e;return(e=(t=this.carInertialPosition)==null?void 0:t.angle)!=null?e:null}else return null}resetPdr(){this.carInertialPosition&&(this.carInertialPosition.history=[],this.carInertialPosition.setPathAngle(0),this.carInertialPosition.speed=0),this.pdrPosition&&this.pdrPosition.pdr.particleFilter.setPosInitFlag(!1)}setPath(t){this.path=t}sendBeacon(t){var e;let n=[];if(yh)n=t.map(o=>{let[a,l]=rP(o.major);return[o.uuid,l,o.minor,o.rssi,o.accuracy,a]}).filter(o=>o[3]!==0).sort((o,a)=>a[3]-o[3]);else{let o=t.reduce((a,l)=>{var c,f;let[g,m]=rP(l.major),v=""+m+l.minor;return(c=a)[f=v]||(c[f]=[]),a[v].push(ee({},l,{battery:g})),a},{});Object.entries(o).forEach(a=>{let[l,c]=a,{uuid:f,major:g,minor:m,accuracy:v,battery:x}=c[0];if(c.length>1){let S=c.filter(E=>E.rssi<0),w=S.reduce((E,b)=>E+b.rssi,0);n.push([f,g,m,w/S.length,v,x])}else n.push([f,g,m,c[0].rssi,v,x])})}let i={command:"POSITION",index:this.uploadIndex++,ts:Date.now(),beacons:JSON.stringify(n),ext_sensors:JSON.stringify({})};(e=this.sensorWebSocket)==null||e.send(i)}dispose(){var t,e,n,i;this.timer.dispose(),(t=this.positionWebSocket)==null||t.dispose(),this.positionWebSocket=null,(e=this.sensorWebSocket)==null||e.dispose(),this.sensorWebSocket=null,(n=this.pdrPosition)==null||n.dispose(),this.pdrPosition=null,(i=this.carInertialPosition)==null||i.dispose(),this.carInertialPosition=null,super.dispose()}constructor(t,e){super(),this.bmap=t,this.positionWebSocket=null,this.sensorWebSocket=null,this.pdrPosition=null,this.carInertialPosition=null,this.gpsFloor="",this.positionFloor="",this.useGpsFloorTimer=null,this.uploadIndex=0,this.path=null,this.timer=new ui;let n=new URLSearchParams(location.search),i=n.get("server_env")||"prod",o={test:"nav-test.aibee.cn",prod:"nav.aibee.cn"},a="wss://"+o[i]+"/aether-walker/indoor/position",l="wss://"+o[i]+"/aether-walker/indoor/sensor";this.options=ee({place_id:n.get("place_id"),access_token:n.get("access_token"),env:i,wss_position_url:a,wss_sensor_url:l,get_gps_floor_url:"https://"+o[i]+"/aether-walker/indoor/conf",use_sensor:!1,type:-1,use_gps:!0,use_pdr:!0,upload_position:!0,use_default_permission:!0,ext_position_params:{},ext_sensor_params:{}},e),this.initPositionWebSocket(),this.options.use_sensor&&this.initSensorWebSocket(),this.options.use_pdr&&this.initPdr(),this.options.use_gps&&this.getGpsFloor()}};var Tle=H(ze(),1);var sP=class extends lo{showMyPosition(t,e){var n;let i=(n=this.bmap.context.currentFloor)==null?void 0:n.getGraphicPosition(t);if(i){let o=new lp(this.bmap.context,{autoUpdate:!0,appendToBody:!1});o.div.appendChild(e),o.position.copy(this.bmap.mercatorToWorld(i)),this.myPositionOverlay=o,console.log("graphicPos",i,this)}else console.warn("[showMyPosition] \u6CA1\u6709\u627E\u5230\u56FE\u5143\u6240\u5728\u7684\u4F4D\u7F6E")}hideMyPosition(){this.myPositionOverlay&&(this.myPositionOverlay.dispose(),this.myPositionOverlay=null)}dispose(){this.hideMyPosition()}constructor(...t){super(...t),this.myPositionOverlay=null}};var aP=class extends lo{highlightPoi(t,e){e===void 0&&(e={icon_size:[40,40],collision_enable:!1}),t.map(i=>this.bmap.getPoiById(i)).filter(i=>!!i).forEach(i=>{var o;(o=i.userData).restore||(o.restore={});for(let c in e)if(c in i.options){var a,l;(a=i.userData.restore)[l=c]||(a[l]=i.options[c]),i.options[c]=e[c]}})}restorePoi(t){t.map(n=>this.bmap.getPoiById(n)).filter(n=>!!n).forEach(n=>{console.log("poi.userData.restore",n.userData.restore);for(let i in n.userData.restore)i in n.options&&(n.options[i]=n.userData.restore[i]);n.userData.restore={}})}};var Lle=H(ze(),1),Nle=H(Kf(),1);var uP=class extends lo{sortByDistance(t,e,n){return Tt(this,null,function*(){n===void 0&&(n=!1);let i=[...e];if(n||e.length<20)return yield Promise.all(i.map(o=>Tt(this,null,function*(){o.distance=yield this._getDistance(t,{floor:o.floor,x:o.center_x,y:o.center_y})}))),i.sort((o,a)=>o.distance-a.distance);{let o=i.sort((l,c)=>{let f=Math.sqrt((l.center_x-t.x)**2+(l.center_y-t.y)**2)+(t.floor===l.floor?0:100),g=Math.sqrt((c.center_x-t.x)**2+(c.center_y-t.y)**2)+(t.floor===c.floor?0:100);return f-g});return[...(yield Promise.all(o.slice(0,20).map(l=>Tt(this,null,function*(){return l.distance=yield this._getDistance(t,{floor:l.floor,x:l.center_x,y:l.center_y}),l})))).sort((l,c)=>l.distance-c.distance),...o.slice(20)]}})}_getDistance(t,e){return Tt(this,null,function*(){return this.navPath.getPath({floor:t.floor,coord:[t.x,t.y]},{floor:e.floor,coord:[e.x,e.y]},"",0).then(n=>n.reduce((i,o,a)=>{if(i+=o.distance,a!==n.length-1)switch(o.endType){case"escalator":case"straightLadder":case"staircase":case"ramp":i+=100;break}return i},0)).catch(n=>n==="near"?0:1/0)})}dispose(){super.dispose(),this.needDisposeNavPath&&this.navPath.dispose()}constructor(t,e){if(super(t),this.needDisposeNavPath=!1,e)this.navPath=e;else{this.navPath=new M_;let n=new fp(t);this.needDisposeNavPath=!0,n.load(t.config.apiPath.loadPlaceInfo+"?place_id="+t.config.placeId+"&env=prod").then(i=>Tt(this,null,function*(){let[o,a]=yield Promise.all([n.getRoadNetworkData(),n.getFacilitiesData()]);this.navPath.setRoadData(o,a.infrastructures)}))}}};return q$(MMt);})();