@aibee/crc-bmap 0.8.93 → 0.8.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/platform/wrapper.js
CHANGED
|
@@ -11546,7 +11546,7 @@ void main() {
|
|
|
11546
11546
|
|
|
11547
11547
|
}\`,dm=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,o){if(this.texture===null){let a=new Vi,l=t.properties.get(a);l.__webglTexture=e.texture,(e.depthNear!=o.depthNear||e.depthFar!=o.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=a}}render(t,e){if(this.texture!==null){if(this.mesh===null){let o=e.cameras[0].viewport,a=new Ao({extensions:{fragDepth:!0},vertexShader:sU,fragmentShader:aU,uniforms:{depthColor:{value:this.texture},depthWidth:{value:o.z},depthHeight:{value:o.w}}});this.mesh=new fo(new Lf(20,20),a)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},mm=class extends Rs{constructor(t,e){super();let o=this,a=null,l=1,h=null,f="local-floor",p=1,d=null,g=null,x=null,v=null,M=null,b=null,T=new dm,_=e.getContextAttributes(),y=null,A=null,S=[],L=[],G=new un,z=null,F=new Ri;F.layers.enable(1),F.viewport=new Br;let I=new Ri;I.layers.enable(2),I.viewport=new Br;let ut=[F,I],R=new pm;R.layers.enable(1),R.layers.enable(2);let W=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(tt){let wt=S[tt];return wt===void 0&&(wt=new Sl,S[tt]=wt),wt.getTargetRaySpace()},this.getControllerGrip=function(tt){let wt=S[tt];return wt===void 0&&(wt=new Sl,S[tt]=wt),wt.getGripSpace()},this.getHand=function(tt){let wt=S[tt];return wt===void 0&&(wt=new Sl,S[tt]=wt),wt.getHandSpace()};function Mt(tt){let wt=L.indexOf(tt.inputSource);if(wt===-1)return;let Bt=S[wt];Bt!==void 0&&(Bt.update(tt.inputSource,tt.frame,d||h),Bt.dispatchEvent({type:tt.type,data:tt.inputSource}))}function X(){a.removeEventListener("select",Mt),a.removeEventListener("selectstart",Mt),a.removeEventListener("selectend",Mt),a.removeEventListener("squeeze",Mt),a.removeEventListener("squeezestart",Mt),a.removeEventListener("squeezeend",Mt),a.removeEventListener("end",X),a.removeEventListener("inputsourceschange",mt);for(let tt=0;tt<S.length;tt++){let wt=L[tt];wt!==null&&(L[tt]=null,S[tt].disconnect(wt))}W=null,V=null,T.reset(),t.setRenderTarget(y),M=null,v=null,x=null,a=null,A=null,Yt.stop(),o.isPresenting=!1,t.setPixelRatio(z),t.setSize(G.width,G.height,!1),o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(tt){l=tt,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(tt){f=tt,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||h},this.setReferenceSpace=function(tt){d=tt},this.getBaseLayer=function(){return v!==null?v:M},this.getBinding=function(){return x},this.getFrame=function(){return b},this.getSession=function(){return a},this.setSession=function(tt){return uc(this,null,function*(){if(a=tt,a!==null){if(y=t.getRenderTarget(),a.addEventListener("select",Mt),a.addEventListener("selectstart",Mt),a.addEventListener("selectend",Mt),a.addEventListener("squeeze",Mt),a.addEventListener("squeezestart",Mt),a.addEventListener("squeezeend",Mt),a.addEventListener("end",X),a.addEventListener("inputsourceschange",mt),_.xrCompatible!==!0&&(yield e.makeXRCompatible()),z=t.getPixelRatio(),t.getSize(G),a.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let wt={antialias:a.renderState.layers===void 0?_.antialias:!0,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:l};M=new XRWebGLLayer(a,e,wt),a.updateRenderState({baseLayer:M}),t.setPixelRatio(1),t.setSize(M.framebufferWidth,M.framebufferHeight,!1),A=new ss(M.framebufferWidth,M.framebufferHeight,{format:co,type:Ps,colorSpace:t.outputColorSpace,stencilBuffer:_.stencil})}else{let wt=null,Bt=null,$t=null;_.depth&&($t=_.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,wt=_.stencil?yu:ha,Bt=_.stencil?fa:Ts);let Ut={colorFormat:e.RGBA8,depthFormat:$t,scaleFactor:l};x=new XRWebGLBinding(a,e),v=x.createProjectionLayer(Ut),a.updateRenderState({layers:[v]}),t.setPixelRatio(1),t.setSize(v.textureWidth,v.textureHeight,!1),A=new ss(v.textureWidth,v.textureHeight,{format:co,type:Ps,depthTexture:new Of(v.textureWidth,v.textureHeight,Bt,void 0,void 0,void 0,void 0,void 0,void 0,wt),stencilBuffer:_.stencil,colorSpace:t.outputColorSpace,samples:_.antialias?4:0});let Dt=t.properties.get(A);Dt.__ignoreDepthValues=v.ignoreDepthValues}A.isXRRenderTarget=!0,this.setFoveation(p),d=null,h=yield a.requestReferenceSpace(f),Yt.setContext(a),Yt.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(a!==null)return a.environmentBlendMode};function mt(tt){for(let wt=0;wt<tt.removed.length;wt++){let Bt=tt.removed[wt],$t=L.indexOf(Bt);$t>=0&&(L[$t]=null,S[$t].disconnect(Bt))}for(let wt=0;wt<tt.added.length;wt++){let Bt=tt.added[wt],$t=L.indexOf(Bt);if($t===-1){for(let Dt=0;Dt<S.length;Dt++)if(Dt>=L.length){L.push(Bt),$t=Dt;break}else if(L[Dt]===null){L[Dt]=Bt,$t=Dt;break}if($t===-1)break}let Ut=S[$t];Ut&&Ut.connect(Bt)}}let dt=new xt,vt=new xt;function it(tt,wt,Bt){dt.setFromMatrixPosition(wt.matrixWorld),vt.setFromMatrixPosition(Bt.matrixWorld);let $t=dt.distanceTo(vt),Ut=wt.projectionMatrix.elements,Dt=Bt.projectionMatrix.elements,At=Ut[14]/(Ut[10]-1),te=Ut[14]/(Ut[10]+1),rt=(Ut[9]+1)/Ut[5],on=(Ut[9]-1)/Ut[5],zt=(Ut[8]-1)/Ut[0],ne=(Dt[8]+1)/Dt[0],Wt=At*zt,ie=At*ne,ce=$t/(-zt+ne),Lt=ce*-zt;wt.matrixWorld.decompose(tt.position,tt.quaternion,tt.scale),tt.translateX(Lt),tt.translateZ(ce),tt.matrixWorld.compose(tt.position,tt.quaternion,tt.scale),tt.matrixWorldInverse.copy(tt.matrixWorld).invert();let se=At+ce,Y=te+ce,N=Wt-Lt,_t=ie+($t-Lt),Et=rt*te/Y*se,ot=on*te/Y*se;tt.projectionMatrix.makePerspective(N,_t,Et,ot,se,Y),tt.projectionMatrixInverse.copy(tt.projectionMatrix).invert()}function lt(tt,wt){wt===null?tt.matrixWorld.copy(tt.matrix):tt.matrixWorld.multiplyMatrices(wt.matrixWorld,tt.matrix),tt.matrixWorldInverse.copy(tt.matrixWorld).invert()}this.updateCamera=function(tt){if(a===null)return;T.texture!==null&&(tt.near=T.depthNear,tt.far=T.depthFar),R.near=I.near=F.near=tt.near,R.far=I.far=F.far=tt.far,(W!==R.near||V!==R.far)&&(a.updateRenderState({depthNear:R.near,depthFar:R.far}),W=R.near,V=R.far,F.near=W,F.far=V,I.near=W,I.far=V,F.updateProjectionMatrix(),I.updateProjectionMatrix(),tt.updateProjectionMatrix());let wt=tt.parent,Bt=R.cameras;lt(R,wt);for(let $t=0;$t<Bt.length;$t++)lt(Bt[$t],wt);Bt.length===2?it(R,F,I):R.projectionMatrix.copy(F.projectionMatrix),H(tt,R,wt)};function H(tt,wt,Bt){Bt===null?tt.matrix.copy(wt.matrixWorld):(tt.matrix.copy(Bt.matrixWorld),tt.matrix.invert(),tt.matrix.multiply(wt.matrixWorld)),tt.matrix.decompose(tt.position,tt.quaternion,tt.scale),tt.updateMatrixWorld(!0),tt.projectionMatrix.copy(wt.projectionMatrix),tt.projectionMatrixInverse.copy(wt.projectionMatrixInverse),tt.isPerspectiveCamera&&(tt.fov=Kd*2*Math.atan(1/tt.projectionMatrix.elements[5]),tt.zoom=1)}this.getCamera=function(){return R},this.getFoveation=function(){if(!(v===null&&M===null))return p},this.setFoveation=function(tt){p=tt,v!==null&&(v.fixedFoveation=tt),M!==null&&M.fixedFoveation!==void 0&&(M.fixedFoveation=tt)},this.hasDepthSensing=function(){return T.texture!==null};let bt=null;function Tt(tt,wt){if(g=wt.getViewerPose(d||h),b=wt,g!==null){let Bt=g.views;M!==null&&(t.setRenderTargetFramebuffer(A,M.framebuffer),t.setRenderTarget(A));let $t=!1;Bt.length!==R.cameras.length&&(R.cameras.length=0,$t=!0);for(let Dt=0;Dt<Bt.length;Dt++){let At=Bt[Dt],te=null;if(M!==null)te=M.getViewport(At);else{let on=x.getViewSubImage(v,At);te=on.viewport,Dt===0&&(t.setRenderTargetTextures(A,on.colorTexture,v.ignoreDepthValues?void 0:on.depthStencilTexture),t.setRenderTarget(A))}let rt=ut[Dt];rt===void 0&&(rt=new Ri,rt.layers.enable(Dt),rt.viewport=new Br,ut[Dt]=rt),rt.matrix.fromArray(At.transform.matrix),rt.matrix.decompose(rt.position,rt.quaternion,rt.scale),rt.projectionMatrix.fromArray(At.projectionMatrix),rt.projectionMatrixInverse.copy(rt.projectionMatrix).invert(),rt.viewport.set(te.x,te.y,te.width,te.height),Dt===0&&(R.matrix.copy(rt.matrix),R.matrix.decompose(R.position,R.quaternion,R.scale)),$t===!0&&R.cameras.push(rt)}let Ut=a.enabledFeatures;if(Ut&&Ut.includes("depth-sensing")){let Dt=x.getDepthInformation(Bt[0]);Dt&&Dt.isValid&&Dt.texture&&T.init(t,Dt,a.renderState)}}for(let Bt=0;Bt<S.length;Bt++){let $t=L[Bt],Ut=S[Bt];$t!==null&&Ut!==void 0&&Ut.update($t,wt,d||h)}T.render(t,R),bt&&bt(tt,wt),wt.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:wt}),b=null}let Yt=new WE;Yt.setAnimationLoop(Tt),this.setAnimationLoop=function(tt){bt=tt},this.dispose=function(){}}},sa=new da,uU=new Tr;function lU(r,t){function e(_,y){_.matrixAutoUpdate===!0&&_.updateMatrix(),y.value.copy(_.matrix)}function o(_,y){y.color.getRGB(_.fogColor.value,HE(r)),y.isFog?(_.fogNear.value=y.near,_.fogFar.value=y.far):y.isFogExp2&&(_.fogDensity.value=y.density)}function a(_,y,A,S,L){y.isMeshBasicMaterial||y.isMeshLambertMaterial?l(_,y):y.isMeshToonMaterial?(l(_,y),x(_,y)):y.isMeshPhongMaterial?(l(_,y),g(_,y)):y.isMeshStandardMaterial?(l(_,y),v(_,y),y.isMeshPhysicalMaterial&&M(_,y,L)):y.isMeshMatcapMaterial?(l(_,y),b(_,y)):y.isMeshDepthMaterial?l(_,y):y.isMeshDistanceMaterial?(l(_,y),T(_,y)):y.isMeshNormalMaterial?l(_,y):y.isLineBasicMaterial?(h(_,y),y.isLineDashedMaterial&&f(_,y)):y.isPointsMaterial?p(_,y,A,S):y.isSpriteMaterial?d(_,y):y.isShadowMaterial?(_.color.value.copy(y.color),_.opacity.value=y.opacity):y.isShaderMaterial&&(y.uniformsNeedUpdate=!1)}function l(_,y){_.opacity.value=y.opacity,y.color&&_.diffuse.value.copy(y.color),y.emissive&&_.emissive.value.copy(y.emissive).multiplyScalar(y.emissiveIntensity),y.map&&(_.map.value=y.map,e(y.map,_.mapTransform)),y.alphaMap&&(_.alphaMap.value=y.alphaMap,e(y.alphaMap,_.alphaMapTransform)),y.bumpMap&&(_.bumpMap.value=y.bumpMap,e(y.bumpMap,_.bumpMapTransform),_.bumpScale.value=y.bumpScale,y.side===xi&&(_.bumpScale.value*=-1)),y.normalMap&&(_.normalMap.value=y.normalMap,e(y.normalMap,_.normalMapTransform),_.normalScale.value.copy(y.normalScale),y.side===xi&&_.normalScale.value.negate()),y.displacementMap&&(_.displacementMap.value=y.displacementMap,e(y.displacementMap,_.displacementMapTransform),_.displacementScale.value=y.displacementScale,_.displacementBias.value=y.displacementBias),y.emissiveMap&&(_.emissiveMap.value=y.emissiveMap,e(y.emissiveMap,_.emissiveMapTransform)),y.specularMap&&(_.specularMap.value=y.specularMap,e(y.specularMap,_.specularMapTransform)),y.alphaTest>0&&(_.alphaTest.value=y.alphaTest);let A=t.get(y),S=A.envMap,L=A.envMapRotation;if(S&&(_.envMap.value=S,sa.copy(L),sa.x*=-1,sa.y*=-1,sa.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(sa.y*=-1,sa.z*=-1),_.envMapRotation.value.setFromMatrix4(uU.makeRotationFromEuler(sa)),_.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=y.reflectivity,_.ior.value=y.ior,_.refractionRatio.value=y.refractionRatio),y.lightMap){_.lightMap.value=y.lightMap;let G=r._useLegacyLights===!0?Math.PI:1;_.lightMapIntensity.value=y.lightMapIntensity*G,e(y.lightMap,_.lightMapTransform)}y.aoMap&&(_.aoMap.value=y.aoMap,_.aoMapIntensity.value=y.aoMapIntensity,e(y.aoMap,_.aoMapTransform))}function h(_,y){_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,y.map&&(_.map.value=y.map,e(y.map,_.mapTransform))}function f(_,y){_.dashSize.value=y.dashSize,_.totalSize.value=y.dashSize+y.gapSize,_.scale.value=y.scale}function p(_,y,A,S){_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,_.size.value=y.size*A,_.scale.value=S*.5,y.map&&(_.map.value=y.map,e(y.map,_.uvTransform)),y.alphaMap&&(_.alphaMap.value=y.alphaMap,e(y.alphaMap,_.alphaMapTransform)),y.alphaTest>0&&(_.alphaTest.value=y.alphaTest)}function d(_,y){_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,_.rotation.value=y.rotation,y.map&&(_.map.value=y.map,e(y.map,_.mapTransform)),y.alphaMap&&(_.alphaMap.value=y.alphaMap,e(y.alphaMap,_.alphaMapTransform)),y.alphaTest>0&&(_.alphaTest.value=y.alphaTest)}function g(_,y){_.specular.value.copy(y.specular),_.shininess.value=Math.max(y.shininess,1e-4)}function x(_,y){y.gradientMap&&(_.gradientMap.value=y.gradientMap)}function v(_,y){_.metalness.value=y.metalness,y.metalnessMap&&(_.metalnessMap.value=y.metalnessMap,e(y.metalnessMap,_.metalnessMapTransform)),_.roughness.value=y.roughness,y.roughnessMap&&(_.roughnessMap.value=y.roughnessMap,e(y.roughnessMap,_.roughnessMapTransform)),t.get(y).envMap&&(_.envMapIntensity.value=y.envMapIntensity)}function M(_,y,A){_.ior.value=y.ior,y.sheen>0&&(_.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),_.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(_.sheenColorMap.value=y.sheenColorMap,e(y.sheenColorMap,_.sheenColorMapTransform)),y.sheenRoughnessMap&&(_.sheenRoughnessMap.value=y.sheenRoughnessMap,e(y.sheenRoughnessMap,_.sheenRoughnessMapTransform))),y.clearcoat>0&&(_.clearcoat.value=y.clearcoat,_.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(_.clearcoatMap.value=y.clearcoatMap,e(y.clearcoatMap,_.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,e(y.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(_.clearcoatNormalMap.value=y.clearcoatNormalMap,e(y.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===xi&&_.clearcoatNormalScale.value.negate())),y.iridescence>0&&(_.iridescence.value=y.iridescence,_.iridescenceIOR.value=y.iridescenceIOR,_.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(_.iridescenceMap.value=y.iridescenceMap,e(y.iridescenceMap,_.iridescenceMapTransform)),y.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=y.iridescenceThicknessMap,e(y.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),y.transmission>0&&(_.transmission.value=y.transmission,_.transmissionSamplerMap.value=A.texture,_.transmissionSamplerSize.value.set(A.width,A.height),y.transmissionMap&&(_.transmissionMap.value=y.transmissionMap,e(y.transmissionMap,_.transmissionMapTransform)),_.thickness.value=y.thickness,y.thicknessMap&&(_.thicknessMap.value=y.thicknessMap,e(y.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=y.attenuationDistance,_.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(_.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(_.anisotropyMap.value=y.anisotropyMap,e(y.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=y.specularIntensity,_.specularColor.value.copy(y.specularColor),y.specularColorMap&&(_.specularColorMap.value=y.specularColorMap,e(y.specularColorMap,_.specularColorMapTransform)),y.specularIntensityMap&&(_.specularIntensityMap.value=y.specularIntensityMap,e(y.specularIntensityMap,_.specularIntensityMapTransform))}function b(_,y){y.matcap&&(_.matcap.value=y.matcap)}function T(_,y){let A=t.get(y).light;_.referencePosition.value.setFromMatrixPosition(A.matrixWorld),_.nearDistance.value=A.shadow.camera.near,_.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:a}}function cU(r,t,e,o){let a={},l={},h=[],f=e.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function p(A,S){let L=S.program;o.uniformBlockBinding(A,L)}function d(A,S){let L=a[A.id];L===void 0&&(b(A),L=g(A),a[A.id]=L,A.addEventListener("dispose",_));let G=S.program;o.updateUBOMapping(A,G);let z=t.render.frame;l[A.id]!==z&&(v(A),l[A.id]=z)}function g(A){let S=x();A.__bindingPointIndex=S;let L=r.createBuffer(),G=A.__size,z=A.usage;return r.bindBuffer(r.UNIFORM_BUFFER,L),r.bufferData(r.UNIFORM_BUFFER,G,z),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,S,L),L}function x(){for(let A=0;A<f;A++)if(h.indexOf(A)===-1)return h.push(A),A;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function v(A){let S=a[A.id],L=A.uniforms,G=A.__cache;r.bindBuffer(r.UNIFORM_BUFFER,S);for(let z=0,F=L.length;z<F;z++){let I=Array.isArray(L[z])?L[z]:[L[z]];for(let ut=0,R=I.length;ut<R;ut++){let W=I[ut];if(M(W,z,ut,G)===!0){let V=W.__offset,Mt=Array.isArray(W.value)?W.value:[W.value],X=0;for(let mt=0;mt<Mt.length;mt++){let dt=Mt[mt],vt=T(dt);typeof dt=="number"||typeof dt=="boolean"?(W.__data[0]=dt,r.bufferSubData(r.UNIFORM_BUFFER,V+X,W.__data)):dt.isMatrix3?(W.__data[0]=dt.elements[0],W.__data[1]=dt.elements[1],W.__data[2]=dt.elements[2],W.__data[3]=0,W.__data[4]=dt.elements[3],W.__data[5]=dt.elements[4],W.__data[6]=dt.elements[5],W.__data[7]=0,W.__data[8]=dt.elements[6],W.__data[9]=dt.elements[7],W.__data[10]=dt.elements[8],W.__data[11]=0):(dt.toArray(W.__data,X),X+=vt.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,V,W.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function M(A,S,L,G){let z=A.value,F=S+"_"+L;if(G[F]===void 0)return typeof z=="number"||typeof z=="boolean"?G[F]=z:G[F]=z.clone(),!0;{let I=G[F];if(typeof z=="number"||typeof z=="boolean"){if(I!==z)return G[F]=z,!0}else if(I.equals(z)===!1)return I.copy(z),!0}return!1}function b(A){let S=A.uniforms,L=0,G=16;for(let F=0,I=S.length;F<I;F++){let ut=Array.isArray(S[F])?S[F]:[S[F]];for(let R=0,W=ut.length;R<W;R++){let V=ut[R],Mt=Array.isArray(V.value)?V.value:[V.value];for(let X=0,mt=Mt.length;X<mt;X++){let dt=Mt[X],vt=T(dt),it=L%G;it!==0&&G-it<vt.boundary&&(L+=G-it),V.__data=new Float32Array(vt.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=L,L+=vt.storage}}}let z=L%G;return z>0&&(L+=G-z),A.__size=L,A.__cache={},this}function T(A){let S={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(S.boundary=4,S.storage=4):A.isVector2?(S.boundary=8,S.storage=8):A.isVector3||A.isColor?(S.boundary=16,S.storage=12):A.isVector4?(S.boundary=16,S.storage=16):A.isMatrix3?(S.boundary=48,S.storage=48):A.isMatrix4?(S.boundary=64,S.storage=64):A.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",A),S}function _(A){let S=A.target;S.removeEventListener("dispose",_);let L=h.indexOf(S.__bindingPointIndex);h.splice(L,1),r.deleteBuffer(a[S.id]),delete a[S.id],delete l[S.id]}function y(){for(let A in a)r.deleteBuffer(a[A]);h=[],a={},l={}}return{bind:p,update:d,dispose:y}}var gm=class{constructor(t={}){let{canvas:e=p2(),context:o=null,depth:a=!0,stencil:l=!0,alpha:h=!1,antialias:f=!1,premultipliedAlpha:p=!0,preserveDrawingBuffer:d=!1,powerPreference:g="default",failIfMajorPerformanceCaveat:x=!1}=t;this.isWebGLRenderer=!0;let v;o!==null?v=o.getContextAttributes().alpha:v=h;let M=new Uint32Array(4),b=new Int32Array(4),T=null,_=null,y=[],A=[];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=wo,this._useLegacyLights=!1,this.toneMapping=Cs,this.toneMappingExposure=1;let S=this,L=!1,G=0,z=0,F=null,I=-1,ut=null,R=new Br,W=new Br,V=null,Mt=new En(0),X=0,mt=e.width,dt=e.height,vt=1,it=null,lt=null,H=new Br(0,0,mt,dt),bt=new Br(0,0,mt,dt),Tt=!1,Yt=new Rf,tt=!1,wt=!1,Bt=null,$t=new Tr,Ut=new un,Dt=new xt,At={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function te(){return F===null?vt:1}let rt=o;function on(q,st){for(let yt=0;yt<q.length;yt++){let ht=q[yt],at=e.getContext(ht,st);if(at!==null)return at}return null}try{let q={alpha:!0,depth:a,stencil:l,antialias:f,premultipliedAlpha:p,preserveDrawingBuffer:d,powerPreference:g,failIfMajorPerformanceCaveat:x};if("setAttribute"in e&&e.setAttribute("data-engine",\`three.js r\${Cm}\`),e.addEventListener("webglcontextlost",ct,!1),e.addEventListener("webglcontextrestored",O,!1),e.addEventListener("webglcontextcreationerror",K,!1),rt===null){let st=["webgl2","webgl","experimental-webgl"];if(S.isWebGL1Renderer===!0&&st.shift(),rt=on(st,q),rt===null)throw on(st)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&rt instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),rt.getShaderPrecisionFormat===void 0&&(rt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(q){throw console.error("THREE.WebGLRenderer: "+q.message),q}let zt,ne,Wt,ie,ce,Lt,se,Y,N,_t,Et,ot,Pt,ue,Ct,Ot,qt,J,w,P,D,k,B,et;function j(){zt=new T3(rt),ne=new x3(rt,zt,t),zt.init(ne),k=new iU(rt,zt,ne),Wt=new nU(rt,zt,ne),ie=new P3(rt),ce=new HF,Lt=new rU(rt,zt,Wt,ce,ne,k,ie),se=new M3(S),Y=new b3(S),N=new D2(rt,ne),B=new v3(rt,zt,N,ne),_t=new A3(rt,N,ie,B),Et=new N3(rt,_t,N,ie),w=new L3(rt,ne,Lt),Ot=new E3(ce),ot=new VF(S,se,Y,zt,ne,B,Ot),Pt=new lU(S,ce),ue=new XF,Ct=new jF(zt,ne),J=new y3(S,se,Y,Wt,Et,v,p),qt=new eU(S,Et,ne),et=new cU(rt,ie,ne,Wt),P=new _3(rt,zt,ie,ne),D=new C3(rt,zt,ie,ne),ie.programs=ot.programs,S.capabilities=ne,S.extensions=zt,S.properties=ce,S.renderLists=ue,S.shadowMap=qt,S.state=Wt,S.info=ie}j();let ft=new mm(S,rt);this.xr=ft,this.getContext=function(){return rt},this.getContextAttributes=function(){return rt.getContextAttributes()},this.forceContextLoss=function(){let q=zt.get("WEBGL_lose_context");q&&q.loseContext()},this.forceContextRestore=function(){let q=zt.get("WEBGL_lose_context");q&&q.restoreContext()},this.getPixelRatio=function(){return vt},this.setPixelRatio=function(q){q!==void 0&&(vt=q,this.setSize(mt,dt,!1))},this.getSize=function(q){return q.set(mt,dt)},this.setSize=function(q,st,yt=!0){if(ft.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}mt=q,dt=st,e.width=Math.floor(q*vt),e.height=Math.floor(st*vt),yt===!0&&(e.style.width=q+"px",e.style.height=st+"px"),this.setViewport(0,0,q,st)},this.getDrawingBufferSize=function(q){return q.set(mt*vt,dt*vt).floor()},this.setDrawingBufferSize=function(q,st,yt){mt=q,dt=st,vt=yt,e.width=Math.floor(q*yt),e.height=Math.floor(st*yt),this.setViewport(0,0,q,st)},this.getCurrentViewport=function(q){return q.copy(R)},this.getViewport=function(q){return q.copy(H)},this.setViewport=function(q,st,yt,ht){q.isVector4?H.set(q.x,q.y,q.z,q.w):H.set(q,st,yt,ht),Wt.viewport(R.copy(H).multiplyScalar(vt).round())},this.getScissor=function(q){return q.copy(bt)},this.setScissor=function(q,st,yt,ht){q.isVector4?bt.set(q.x,q.y,q.z,q.w):bt.set(q,st,yt,ht),Wt.scissor(W.copy(bt).multiplyScalar(vt).round())},this.getScissorTest=function(){return Tt},this.setScissorTest=function(q){Wt.setScissorTest(Tt=q)},this.setOpaqueSort=function(q){it=q},this.setTransparentSort=function(q){lt=q},this.getClearColor=function(q){return q.copy(J.getClearColor())},this.setClearColor=function(){J.setClearColor.apply(J,arguments)},this.getClearAlpha=function(){return J.getClearAlpha()},this.setClearAlpha=function(){J.setClearAlpha.apply(J,arguments)},this.clear=function(q=!0,st=!0,yt=!0){let ht=0;if(q){let at=!1;if(F!==null){let Ht=F.texture.format;at=Ht===zE||Ht===BE||Ht===UE}if(at){let Ht=F.texture.type,Xt=Ht===Ps||Ht===Ts||Ht===Pm||Ht===fa||Ht===DE||Ht===FE,re=J.getClearColor(),Zt=J.getClearAlpha(),me=re.r,oe=re.g,ae=re.b;Xt?(M[0]=me,M[1]=oe,M[2]=ae,M[3]=Zt,rt.clearBufferuiv(rt.COLOR,0,M)):(b[0]=me,b[1]=oe,b[2]=ae,b[3]=Zt,rt.clearBufferiv(rt.COLOR,0,b))}else ht|=rt.COLOR_BUFFER_BIT}st&&(ht|=rt.DEPTH_BUFFER_BIT),yt&&(ht|=rt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),rt.clear(ht)},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",ct,!1),e.removeEventListener("webglcontextrestored",O,!1),e.removeEventListener("webglcontextcreationerror",K,!1),ue.dispose(),Ct.dispose(),ce.dispose(),se.dispose(),Y.dispose(),Et.dispose(),B.dispose(),et.dispose(),ot.dispose(),ft.dispose(),ft.removeEventListener("sessionstart",xe),ft.removeEventListener("sessionend",de),Bt&&(Bt.dispose(),Bt=null),Me.stop()};function ct(q){q.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),L=!0}function O(){console.log("THREE.WebGLRenderer: Context Restored."),L=!1;let q=ie.autoReset,st=qt.enabled,yt=qt.autoUpdate,ht=qt.needsUpdate,at=qt.type;j(),ie.autoReset=q,qt.enabled=st,qt.autoUpdate=yt,qt.needsUpdate=ht,qt.type=at}function K(q){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",q.statusMessage)}function $(q){let st=q.target;st.removeEventListener("dispose",$),Q(st)}function Q(q){St(q),ce.remove(q)}function St(q){let st=ce.get(q).programs;st!==void 0&&(st.forEach(function(yt){ot.releaseProgram(yt)}),q.isShaderMaterial&&ot.releaseShaderCache(q))}this.renderBufferDirect=function(q,st,yt,ht,at,Ht){st===null&&(st=At);let Xt=at.isMesh&&at.matrixWorld.determinant()<0,re=xn(q,st,yt,ht,at);Wt.setMaterial(ht,Xt);let Zt=yt.index,me=1;if(ht.wireframe===!0){if(Zt=_t.getWireframeAttribute(yt),Zt===void 0)return;me=2}let oe=yt.drawRange,ae=yt.attributes.position,sn=oe.start*me,gr=(oe.start+oe.count)*me;Ht!==null&&(sn=Math.max(sn,Ht.start*me),gr=Math.min(gr,(Ht.start+Ht.count)*me)),Zt!==null?(sn=Math.max(sn,0),gr=Math.min(gr,Zt.count)):ae!=null&&(sn=Math.max(sn,0),gr=Math.min(gr,ae.count));let Un=gr-sn;if(Un<0||Un===1/0)return;B.setup(at,ht,re,yt,Zt);let Qr,Mn=P;if(Zt!==null&&(Qr=N.get(Zt),Mn=D,Mn.setIndex(Qr)),at.isMesh)ht.wireframe===!0?(Wt.setLineWidth(ht.wireframeLinewidth*te()),Mn.setMode(rt.LINES)):Mn.setMode(rt.TRIANGLES);else if(at.isLine){let jt=ht.linewidth;jt===void 0&&(jt=1),Wt.setLineWidth(jt*te()),at.isLineSegments?Mn.setMode(rt.LINES):at.isLineLoop?Mn.setMode(rt.LINE_LOOP):Mn.setMode(rt.LINE_STRIP)}else at.isPoints?Mn.setMode(rt.POINTS):at.isSprite&&Mn.setMode(rt.TRIANGLES);if(at.isBatchedMesh)Mn.renderMultiDraw(at._multiDrawStarts,at._multiDrawCounts,at._multiDrawCount);else if(at.isInstancedMesh)Mn.renderInstances(sn,Un,at.count);else if(yt.isInstancedBufferGeometry){let jt=yt._maxInstanceCount!==void 0?yt._maxInstanceCount:1/0,Aa=Math.min(yt.instanceCount,jt);Mn.renderInstances(sn,Un,Aa)}else Mn.render(sn,Un)};function Nt(q,st,yt){q.transparent===!0&&q.side===ns&&q.forceSinglePass===!1?(q.side=xi,q.needsUpdate=!0,_n(q,st,yt),q.side=Is,q.needsUpdate=!0,_n(q,st,yt),q.side=ns):_n(q,st,yt)}this.compile=function(q,st,yt=null){yt===null&&(yt=q),_=Ct.get(yt),_.init(),A.push(_),yt.traverseVisible(function(at){at.isLight&&at.layers.test(st.layers)&&(_.pushLight(at),at.castShadow&&_.pushShadow(at))}),q!==yt&&q.traverseVisible(function(at){at.isLight&&at.layers.test(st.layers)&&(_.pushLight(at),at.castShadow&&_.pushShadow(at))}),_.setupLights(S._useLegacyLights);let ht=new Set;return q.traverse(function(at){let Ht=at.material;if(Ht)if(Array.isArray(Ht))for(let Xt=0;Xt<Ht.length;Xt++){let re=Ht[Xt];Nt(re,yt,at),ht.add(re)}else Nt(Ht,yt,at),ht.add(Ht)}),A.pop(),_=null,ht},this.compileAsync=function(q,st,yt=null){let ht=this.compile(q,st,yt);return new Promise(at=>{function Ht(){if(ht.forEach(function(Xt){ce.get(Xt).currentProgram.isReady()&&ht.delete(Xt)}),ht.size===0){at(q);return}setTimeout(Ht,10)}zt.get("KHR_parallel_shader_compile")!==null?Ht():setTimeout(Ht,10)})};let Jt=null;function Kt(q){Jt&&Jt(q)}function xe(){Me.stop()}function de(){Me.start()}let Me=new WE;Me.setAnimationLoop(Kt),typeof self!="undefined"&&Me.setContext(self),this.setAnimationLoop=function(q){Jt=q,ft.setAnimationLoop(q),q===null?Me.stop():Me.start()},ft.addEventListener("sessionstart",xe),ft.addEventListener("sessionend",de),this.render=function(q,st){if(st!==void 0&&st.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),st.parent===null&&st.matrixWorldAutoUpdate===!0&&st.updateMatrixWorld(),ft.enabled===!0&&ft.isPresenting===!0&&(ft.cameraAutoUpdate===!0&&ft.updateCamera(st),st=ft.getCamera()),q.isScene===!0&&q.onBeforeRender(S,q,st,F),_=Ct.get(q,A.length),_.init(),A.push(_),$t.multiplyMatrices(st.projectionMatrix,st.matrixWorldInverse),Yt.setFromProjectionMatrix($t),wt=this.localClippingEnabled,tt=Ot.init(this.clippingPlanes,wt),T=ue.get(q,y.length),T.init(),y.push(T),Se(q,st,0,S.sortObjects),T.finish(),S.sortObjects===!0&&T.sort(it,lt),this.info.render.frame++,tt===!0&&Ot.beginShadows();let yt=_.state.shadowsArray;if(qt.render(yt,q,st),tt===!0&&Ot.endShadows(),this.info.autoReset===!0&&this.info.reset(),(ft.enabled===!1||ft.isPresenting===!1||ft.hasDepthSensing()===!1)&&J.render(T,q),_.setupLights(S._useLegacyLights),st.isArrayCamera){let ht=st.cameras;for(let at=0,Ht=ht.length;at<Ht;at++){let Xt=ht[at];Nn(T,q,Xt,Xt.viewport)}}else Nn(T,q,st);F!==null&&(Lt.updateMultisampleRenderTarget(F),Lt.updateRenderTargetMipmap(F)),q.isScene===!0&&q.onAfterRender(S,q,st),B.resetDefaultState(),I=-1,ut=null,A.pop(),A.length>0?_=A[A.length-1]:_=null,y.pop(),y.length>0?T=y[y.length-1]:T=null};function Se(q,st,yt,ht){if(q.visible===!1)return;if(q.layers.test(st.layers)){if(q.isGroup)yt=q.renderOrder;else if(q.isLOD)q.autoUpdate===!0&&q.update(st);else if(q.isLight)_.pushLight(q),q.castShadow&&_.pushShadow(q);else if(q.isSprite){if(!q.frustumCulled||Yt.intersectsSprite(q)){ht&&Dt.setFromMatrixPosition(q.matrixWorld).applyMatrix4($t);let Xt=Et.update(q),re=q.material;re.visible&&T.push(q,Xt,re,yt,Dt.z,null)}}else if((q.isMesh||q.isLine||q.isPoints)&&(!q.frustumCulled||Yt.intersectsObject(q))){let Xt=Et.update(q),re=q.material;if(ht&&(q.boundingSphere!==void 0?(q.boundingSphere===null&&q.computeBoundingSphere(),Dt.copy(q.boundingSphere.center)):(Xt.boundingSphere===null&&Xt.computeBoundingSphere(),Dt.copy(Xt.boundingSphere.center)),Dt.applyMatrix4(q.matrixWorld).applyMatrix4($t)),Array.isArray(re)){let Zt=Xt.groups;for(let me=0,oe=Zt.length;me<oe;me++){let ae=Zt[me],sn=re[ae.materialIndex];sn&&sn.visible&&T.push(q,Xt,sn,yt,Dt.z,ae)}}else re.visible&&T.push(q,Xt,re,yt,Dt.z,null)}}let Ht=q.children;for(let Xt=0,re=Ht.length;Xt<re;Xt++)Se(Ht[Xt],st,yt,ht)}function Nn(q,st,yt,ht){let at=q.opaque,Ht=q.transmissive,Xt=q.transparent;_.setupLightsView(yt),tt===!0&&Ot.setGlobalState(S.clippingPlanes,yt),Ht.length>0&&or(at,Ht,st,yt),ht&&Wt.viewport(R.copy(ht)),at.length>0&&vn(at,st,yt),Ht.length>0&&vn(Ht,st,yt),Xt.length>0&&vn(Xt,st,yt),Wt.buffers.depth.setTest(!0),Wt.buffers.depth.setMask(!0),Wt.buffers.color.setMask(!0),Wt.setPolygonOffset(!1)}function or(q,st,yt,ht){if((yt.isScene===!0?yt.overrideMaterial:null)!==null)return;let Ht=ne.isWebGL2;Bt===null&&(Bt=new ss(1,1,{generateMipmaps:!0,type:zt.has("EXT_color_buffer_half_float")?wl:Ps,minFilter:ca,samples:Ht?4:0})),S.getDrawingBufferSize(Ut),Ht?Bt.setSize(Ut.x,Ut.y):Bt.setSize(jd(Ut.x),jd(Ut.y));let Xt=S.getRenderTarget();S.setRenderTarget(Bt),S.getClearColor(Mt),X=S.getClearAlpha(),X<1&&S.setClearColor(16777215,.5),S.clear();let re=S.toneMapping;S.toneMapping=Cs,vn(q,yt,ht),Lt.updateMultisampleRenderTarget(Bt),Lt.updateRenderTargetMipmap(Bt);let Zt=!1;for(let me=0,oe=st.length;me<oe;me++){let ae=st[me],sn=ae.object,gr=ae.geometry,Un=ae.material,Qr=ae.group;if(Un.side===ns&&sn.layers.test(ht.layers)){let Mn=Un.side;Un.side=xi,Un.needsUpdate=!0,le(sn,yt,ht,gr,Un,Qr),Un.side=Mn,Un.needsUpdate=!0,Zt=!0}}Zt===!0&&(Lt.updateMultisampleRenderTarget(Bt),Lt.updateRenderTargetMipmap(Bt)),S.setRenderTarget(Xt),S.setClearColor(Mt,X),S.toneMapping=re}function vn(q,st,yt){let ht=st.isScene===!0?st.overrideMaterial:null;for(let at=0,Ht=q.length;at<Ht;at++){let Xt=q[at],re=Xt.object,Zt=Xt.geometry,me=ht===null?Xt.material:ht,oe=Xt.group;re.layers.test(yt.layers)&&le(re,st,yt,Zt,me,oe)}}function le(q,st,yt,ht,at,Ht){q.onBeforeRender(S,st,yt,ht,at,Ht),q.modelViewMatrix.multiplyMatrices(yt.matrixWorldInverse,q.matrixWorld),q.normalMatrix.getNormalMatrix(q.modelViewMatrix),at.onBeforeRender(S,st,yt,ht,q,Ht),at.transparent===!0&&at.side===ns&&at.forceSinglePass===!1?(at.side=xi,at.needsUpdate=!0,S.renderBufferDirect(yt,st,ht,at,q,Ht),at.side=Is,at.needsUpdate=!0,S.renderBufferDirect(yt,st,ht,at,q,Ht),at.side=ns):S.renderBufferDirect(yt,st,ht,at,q,Ht),q.onAfterRender(S,st,yt,ht,at,Ht)}function _n(q,st,yt){st.isScene!==!0&&(st=At);let ht=ce.get(q),at=_.state.lights,Ht=_.state.shadowsArray,Xt=at.state.version,re=ot.getParameters(q,at.state,Ht,st,yt),Zt=ot.getProgramCacheKey(re),me=ht.programs;ht.environment=q.isMeshStandardMaterial?st.environment:null,ht.fog=st.fog,ht.envMap=(q.isMeshStandardMaterial?Y:se).get(q.envMap||ht.environment),ht.envMapRotation=ht.environment!==null&&q.envMap===null?st.environmentRotation:q.envMapRotation,me===void 0&&(q.addEventListener("dispose",$),me=new Map,ht.programs=me);let oe=me.get(Zt);if(oe!==void 0){if(ht.currentProgram===oe&&ht.lightsStateVersion===Xt)return Tn(q,re),oe}else re.uniforms=ot.getUniforms(q),q.onBuild(yt,re,S),q.onBeforeCompile(re,S),oe=ot.acquireProgram(re,Zt),me.set(Zt,oe),ht.uniforms=re.uniforms;let ae=ht.uniforms;return(!q.isShaderMaterial&&!q.isRawShaderMaterial||q.clipping===!0)&&(ae.clippingPlanes=Ot.uniform),Tn(q,re),ht.needsLights=mr(q),ht.lightsStateVersion=Xt,ht.needsLights&&(ae.ambientLightColor.value=at.state.ambient,ae.lightProbe.value=at.state.probe,ae.directionalLights.value=at.state.directional,ae.directionalLightShadows.value=at.state.directionalShadow,ae.spotLights.value=at.state.spot,ae.spotLightShadows.value=at.state.spotShadow,ae.rectAreaLights.value=at.state.rectArea,ae.ltc_1.value=at.state.rectAreaLTC1,ae.ltc_2.value=at.state.rectAreaLTC2,ae.pointLights.value=at.state.point,ae.pointLightShadows.value=at.state.pointShadow,ae.hemisphereLights.value=at.state.hemi,ae.directionalShadowMap.value=at.state.directionalShadowMap,ae.directionalShadowMatrix.value=at.state.directionalShadowMatrix,ae.spotShadowMap.value=at.state.spotShadowMap,ae.spotLightMatrix.value=at.state.spotLightMatrix,ae.spotLightMap.value=at.state.spotLightMap,ae.pointShadowMap.value=at.state.pointShadowMap,ae.pointShadowMatrix.value=at.state.pointShadowMatrix),ht.currentProgram=oe,ht.uniformsList=null,oe}function Pn(q){if(q.uniformsList===null){let st=q.currentProgram.getUniforms();q.uniformsList=du.seqWithValue(st.seq,q.uniforms)}return q.uniformsList}function Tn(q,st){let yt=ce.get(q);yt.outputColorSpace=st.outputColorSpace,yt.batching=st.batching,yt.instancing=st.instancing,yt.instancingColor=st.instancingColor,yt.instancingMorph=st.instancingMorph,yt.skinning=st.skinning,yt.morphTargets=st.morphTargets,yt.morphNormals=st.morphNormals,yt.morphColors=st.morphColors,yt.morphTargetsCount=st.morphTargetsCount,yt.numClippingPlanes=st.numClippingPlanes,yt.numIntersection=st.numClipIntersection,yt.vertexAlphas=st.vertexAlphas,yt.vertexTangents=st.vertexTangents,yt.toneMapping=st.toneMapping}function xn(q,st,yt,ht,at){st.isScene!==!0&&(st=At),Lt.resetTextureUnits();let Ht=st.fog,Xt=ht.isMeshStandardMaterial?st.environment:null,re=F===null?S.outputColorSpace:F.isXRRenderTarget===!0?F.texture.colorSpace:Ns,Zt=(ht.isMeshStandardMaterial?Y:se).get(ht.envMap||Xt),me=ht.vertexColors===!0&&!!yt.attributes.color&&yt.attributes.color.itemSize===4,oe=!!yt.attributes.tangent&&(!!ht.normalMap||ht.anisotropy>0),ae=!!yt.morphAttributes.position,sn=!!yt.morphAttributes.normal,gr=!!yt.morphAttributes.color,Un=Cs;ht.toneMapped&&(F===null||F.isXRRenderTarget===!0)&&(Un=S.toneMapping);let Qr=yt.morphAttributes.position||yt.morphAttributes.normal||yt.morphAttributes.color,Mn=Qr!==void 0?Qr.length:0,jt=ce.get(ht),Aa=_.state.lights;if(tt===!0&&(wt===!0||q!==ut)){let ti=q===ut&&ht.id===I;Ot.setState(ht,q,ti)}let an=!1;ht.version===jt.__version?(jt.needsLights&&jt.lightsStateVersion!==Aa.state.version||jt.outputColorSpace!==re||at.isBatchedMesh&&jt.batching===!1||!at.isBatchedMesh&&jt.batching===!0||at.isInstancedMesh&&jt.instancing===!1||!at.isInstancedMesh&&jt.instancing===!0||at.isSkinnedMesh&&jt.skinning===!1||!at.isSkinnedMesh&&jt.skinning===!0||at.isInstancedMesh&&jt.instancingColor===!0&&at.instanceColor===null||at.isInstancedMesh&&jt.instancingColor===!1&&at.instanceColor!==null||at.isInstancedMesh&&jt.instancingMorph===!0&&at.morphTexture===null||at.isInstancedMesh&&jt.instancingMorph===!1&&at.morphTexture!==null||jt.envMap!==Zt||ht.fog===!0&&jt.fog!==Ht||jt.numClippingPlanes!==void 0&&(jt.numClippingPlanes!==Ot.numPlanes||jt.numIntersection!==Ot.numIntersection)||jt.vertexAlphas!==me||jt.vertexTangents!==oe||jt.morphTargets!==ae||jt.morphNormals!==sn||jt.morphColors!==gr||jt.toneMapping!==Un||ne.isWebGL2===!0&&jt.morphTargetsCount!==Mn)&&(an=!0):(an=!0,jt.__version=ht.version);let Wi=jt.currentProgram;an===!0&&(Wi=_n(ht,st,at));let Xu=!1,ge=!1,qs=!1,Sn=Wi.getUniforms(),Xi=jt.uniforms;if(Wt.useProgram(Wi.program)&&(Xu=!0,ge=!0,qs=!0),ht.id!==I&&(I=ht.id,ge=!0),Xu||ut!==q){Sn.setValue(rt,"projectionMatrix",q.projectionMatrix),Sn.setValue(rt,"viewMatrix",q.matrixWorldInverse);let ti=Sn.map.cameraPosition;ti!==void 0&&ti.setValue(rt,Dt.setFromMatrixPosition(q.matrixWorld)),ne.logarithmicDepthBuffer&&Sn.setValue(rt,"logDepthBufFC",2/(Math.log(q.far+1)/Math.LN2)),(ht.isMeshPhongMaterial||ht.isMeshToonMaterial||ht.isMeshLambertMaterial||ht.isMeshBasicMaterial||ht.isMeshStandardMaterial||ht.isShaderMaterial)&&Sn.setValue(rt,"isOrthographic",q.isOrthographicCamera===!0),ut!==q&&(ut=q,ge=!0,qs=!0)}if(at.isSkinnedMesh){Sn.setOptional(rt,at,"bindMatrix"),Sn.setOptional(rt,at,"bindMatrixInverse");let ti=at.skeleton;ti&&(ne.floatVertexTextures?(ti.boneTexture===null&&ti.computeBoneTexture(),Sn.setValue(rt,"boneTexture",ti.boneTexture,Lt)):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&&(Sn.setOptional(rt,at,"batchingTexture"),Sn.setValue(rt,"batchingTexture",at._matricesTexture,Lt));let pe=yt.morphAttributes;if((pe.position!==void 0||pe.normal!==void 0||pe.color!==void 0&&ne.isWebGL2===!0)&&w.update(at,yt,Wi),(ge||jt.receiveShadow!==at.receiveShadow)&&(jt.receiveShadow=at.receiveShadow,Sn.setValue(rt,"receiveShadow",at.receiveShadow)),ht.isMeshGouraudMaterial&&ht.envMap!==null&&(Xi.envMap.value=Zt,Xi.flipEnvMap.value=Zt.isCubeTexture&&Zt.isRenderTargetTexture===!1?-1:1),ge&&(Sn.setValue(rt,"toneMappingExposure",S.toneMappingExposure),jt.needsLights&&Vr(Xi,qs),Ht&&ht.fog===!0&&Pt.refreshFogUniforms(Xi,Ht),Pt.refreshMaterialUniforms(Xi,ht,vt,dt,Bt),du.upload(rt,Pn(jt),Xi,Lt)),ht.isShaderMaterial&&ht.uniformsNeedUpdate===!0&&(du.upload(rt,Pn(jt),Xi,Lt),ht.uniformsNeedUpdate=!1),ht.isSpriteMaterial&&Sn.setValue(rt,"center",at.center),Sn.setValue(rt,"modelViewMatrix",at.modelViewMatrix),Sn.setValue(rt,"normalMatrix",at.normalMatrix),Sn.setValue(rt,"modelMatrix",at.matrixWorld),ht.isShaderMaterial||ht.isRawShaderMaterial){let ti=ht.uniformsGroups;for(let Yu=0,Ca=ti.length;Yu<Ca;Yu++)if(ne.isWebGL2){let ei=ti[Yu];et.update(ei,Wi),et.bind(ei,Wi)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Wi}function Vr(q,st){q.ambientLightColor.needsUpdate=st,q.lightProbe.needsUpdate=st,q.directionalLights.needsUpdate=st,q.directionalLightShadows.needsUpdate=st,q.pointLights.needsUpdate=st,q.pointLightShadows.needsUpdate=st,q.spotLights.needsUpdate=st,q.spotLightShadows.needsUpdate=st,q.rectAreaLights.needsUpdate=st,q.hemisphereLights.needsUpdate=st}function mr(q){return q.isMeshLambertMaterial||q.isMeshToonMaterial||q.isMeshPhongMaterial||q.isMeshStandardMaterial||q.isShadowMaterial||q.isShaderMaterial&&q.lights===!0}this.getActiveCubeFace=function(){return G},this.getActiveMipmapLevel=function(){return z},this.getRenderTarget=function(){return F},this.setRenderTargetTextures=function(q,st,yt){ce.get(q.texture).__webglTexture=st,ce.get(q.depthTexture).__webglTexture=yt;let ht=ce.get(q);ht.__hasExternalTextures=!0,ht.__autoAllocateDepthBuffer=yt===void 0,ht.__autoAllocateDepthBuffer||zt.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ht.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(q,st){let yt=ce.get(q);yt.__webglFramebuffer=st,yt.__useDefaultFramebuffer=st===void 0},this.setRenderTarget=function(q,st=0,yt=0){F=q,G=st,z=yt;let ht=!0,at=null,Ht=!1,Xt=!1;if(q){let Zt=ce.get(q);Zt.__useDefaultFramebuffer!==void 0?(Wt.bindFramebuffer(rt.FRAMEBUFFER,null),ht=!1):Zt.__webglFramebuffer===void 0?Lt.setupRenderTarget(q):Zt.__hasExternalTextures&&Lt.rebindTextures(q,ce.get(q.texture).__webglTexture,ce.get(q.depthTexture).__webglTexture);let me=q.texture;(me.isData3DTexture||me.isDataArrayTexture||me.isCompressedArrayTexture)&&(Xt=!0);let oe=ce.get(q).__webglFramebuffer;q.isWebGLCubeRenderTarget?(Array.isArray(oe[st])?at=oe[st][yt]:at=oe[st],Ht=!0):ne.isWebGL2&&q.samples>0&&Lt.useMultisampledRTT(q)===!1?at=ce.get(q).__webglMultisampledFramebuffer:Array.isArray(oe)?at=oe[yt]:at=oe,R.copy(q.viewport),W.copy(q.scissor),V=q.scissorTest}else R.copy(H).multiplyScalar(vt).floor(),W.copy(bt).multiplyScalar(vt).floor(),V=Tt;if(Wt.bindFramebuffer(rt.FRAMEBUFFER,at)&&ne.drawBuffers&&ht&&Wt.drawBuffers(q,at),Wt.viewport(R),Wt.scissor(W),Wt.setScissorTest(V),Ht){let Zt=ce.get(q.texture);rt.framebufferTexture2D(rt.FRAMEBUFFER,rt.COLOR_ATTACHMENT0,rt.TEXTURE_CUBE_MAP_POSITIVE_X+st,Zt.__webglTexture,yt)}else if(Xt){let Zt=ce.get(q.texture),me=st||0;rt.framebufferTextureLayer(rt.FRAMEBUFFER,rt.COLOR_ATTACHMENT0,Zt.__webglTexture,yt||0,me)}I=-1},this.readRenderTargetPixels=function(q,st,yt,ht,at,Ht,Xt){if(!(q&&q.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let re=ce.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&Xt!==void 0&&(re=re[Xt]),re){Wt.bindFramebuffer(rt.FRAMEBUFFER,re);try{let Zt=q.texture,me=Zt.format,oe=Zt.type;if(me!==co&&k.convert(me)!==rt.getParameter(rt.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let ae=oe===wl&&(zt.has("EXT_color_buffer_half_float")||ne.isWebGL2&&zt.has("EXT_color_buffer_float"));if(oe!==Ps&&k.convert(oe)!==rt.getParameter(rt.IMPLEMENTATION_COLOR_READ_TYPE)&&!(oe===rs&&(ne.isWebGL2||zt.has("OES_texture_float")||zt.has("WEBGL_color_buffer_float")))&&!ae){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}st>=0&&st<=q.width-ht&&yt>=0&&yt<=q.height-at&&rt.readPixels(st,yt,ht,at,k.convert(me),k.convert(oe),Ht)}finally{let Zt=F!==null?ce.get(F).__webglFramebuffer:null;Wt.bindFramebuffer(rt.FRAMEBUFFER,Zt)}}},this.copyFramebufferToTexture=function(q,st,yt=0){let ht=Math.pow(2,-yt),at=Math.floor(st.image.width*ht),Ht=Math.floor(st.image.height*ht);Lt.setTexture2D(st,0),rt.copyTexSubImage2D(rt.TEXTURE_2D,yt,0,0,q.x,q.y,at,Ht),Wt.unbindTexture()},this.copyTextureToTexture=function(q,st,yt,ht=0){let at=st.image.width,Ht=st.image.height,Xt=k.convert(yt.format),re=k.convert(yt.type);Lt.setTexture2D(yt,0),rt.pixelStorei(rt.UNPACK_FLIP_Y_WEBGL,yt.flipY),rt.pixelStorei(rt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,yt.premultiplyAlpha),rt.pixelStorei(rt.UNPACK_ALIGNMENT,yt.unpackAlignment),st.isDataTexture?rt.texSubImage2D(rt.TEXTURE_2D,ht,q.x,q.y,at,Ht,Xt,re,st.image.data):st.isCompressedTexture?rt.compressedTexSubImage2D(rt.TEXTURE_2D,ht,q.x,q.y,st.mipmaps[0].width,st.mipmaps[0].height,Xt,st.mipmaps[0].data):rt.texSubImage2D(rt.TEXTURE_2D,ht,q.x,q.y,Xt,re,st.image),ht===0&&yt.generateMipmaps&&rt.generateMipmap(rt.TEXTURE_2D),Wt.unbindTexture()},this.copyTextureToTexture3D=function(q,st,yt,ht,at=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Ht=Math.round(q.max.x-q.min.x),Xt=Math.round(q.max.y-q.min.y),re=q.max.z-q.min.z+1,Zt=k.convert(ht.format),me=k.convert(ht.type),oe;if(ht.isData3DTexture)Lt.setTexture3D(ht,0),oe=rt.TEXTURE_3D;else if(ht.isDataArrayTexture||ht.isCompressedArrayTexture)Lt.setTexture2DArray(ht,0),oe=rt.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}rt.pixelStorei(rt.UNPACK_FLIP_Y_WEBGL,ht.flipY),rt.pixelStorei(rt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ht.premultiplyAlpha),rt.pixelStorei(rt.UNPACK_ALIGNMENT,ht.unpackAlignment);let ae=rt.getParameter(rt.UNPACK_ROW_LENGTH),sn=rt.getParameter(rt.UNPACK_IMAGE_HEIGHT),gr=rt.getParameter(rt.UNPACK_SKIP_PIXELS),Un=rt.getParameter(rt.UNPACK_SKIP_ROWS),Qr=rt.getParameter(rt.UNPACK_SKIP_IMAGES),Mn=yt.isCompressedTexture?yt.mipmaps[at]:yt.image;rt.pixelStorei(rt.UNPACK_ROW_LENGTH,Mn.width),rt.pixelStorei(rt.UNPACK_IMAGE_HEIGHT,Mn.height),rt.pixelStorei(rt.UNPACK_SKIP_PIXELS,q.min.x),rt.pixelStorei(rt.UNPACK_SKIP_ROWS,q.min.y),rt.pixelStorei(rt.UNPACK_SKIP_IMAGES,q.min.z),yt.isDataTexture||yt.isData3DTexture?rt.texSubImage3D(oe,at,st.x,st.y,st.z,Ht,Xt,re,Zt,me,Mn.data):ht.isCompressedArrayTexture?rt.compressedTexSubImage3D(oe,at,st.x,st.y,st.z,Ht,Xt,re,Zt,Mn.data):rt.texSubImage3D(oe,at,st.x,st.y,st.z,Ht,Xt,re,Zt,me,Mn),rt.pixelStorei(rt.UNPACK_ROW_LENGTH,ae),rt.pixelStorei(rt.UNPACK_IMAGE_HEIGHT,sn),rt.pixelStorei(rt.UNPACK_SKIP_PIXELS,gr),rt.pixelStorei(rt.UNPACK_SKIP_ROWS,Un),rt.pixelStorei(rt.UNPACK_SKIP_IMAGES,Qr),at===0&&ht.generateMipmaps&&rt.generateMipmap(oe),Wt.unbindTexture()},this.initTexture=function(q){q.isCubeTexture?Lt.setTextureCube(q,0):q.isData3DTexture?Lt.setTexture3D(q,0):q.isDataArrayTexture||q.isCompressedArrayTexture?Lt.setTexture2DArray(q,0):Lt.setTexture2D(q,0),Wt.unbindTexture()},this.resetState=function(){G=0,z=0,F=null,Wt.reset(),B.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return is}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Im?"display-p3":"srgb",e.unpackColorSpace=An.workingColorSpace===Ff?"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}},ym=class extends gm{};ym.prototype.isWebGL1Renderer=!0;function pf(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 fU(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}var xu=class{constructor(t,e,o,a){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=a!==void 0?a:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,a=e[o],l=e[o-1];n:{t:{let h;e:{r:if(!(t<a)){for(let f=o+2;;){if(a===void 0){if(t<l)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===f)break;if(l=a,a=e[++o],t<a)break t}h=e.length;break e}if(!(t>=l)){let f=e[1];t<f&&(o=2,l=f);for(let p=o-2;;){if(l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===p)break;if(a=l,l=e[--o-1],t>=l)break t}h=o,o=0;break e}break n}for(;o<h;){let f=o+h>>>1;t<e[f]?h=f:o=f+1}if(a=e[o],l=e[o-1],l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(a===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,l,a)}return this.interpolate_(o,l,t,a)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=t*a;for(let h=0;h!==a;++h)e[h]=o[l+h];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},vm=class extends xu{constructor(t,e,o,a){super(t,e,o,a),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:z1,endingEnd:z1}}intervalChanged_(t,e,o){let a=this.parameterPositions,l=t-2,h=t+1,f=a[l],p=a[h];if(f===void 0)switch(this.getSettings_().endingStart){case G1:l=t,f=2*e-o;break;case k1:l=a.length-2,f=e+a[l]-a[l+1];break;default:l=t,f=o}if(p===void 0)switch(this.getSettings_().endingEnd){case G1:h=t,p=2*o-e;break;case k1:h=1,p=o+a[1]-a[0];break;default:h=t-1,p=e}let d=(o-e)*.5,g=this.valueSize;this._weightPrev=d/(e-f),this._weightNext=d/(p-o),this._offsetPrev=l*g,this._offsetNext=h*g}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=this._offsetPrev,x=this._offsetNext,v=this._weightPrev,M=this._weightNext,b=(o-e)/(a-e),T=b*b,_=T*b,y=-v*_+2*v*T-v*b,A=(1+v)*_+(-1.5-2*v)*T+(-.5+v)*b+1,S=(-1-M)*_+(1.5+M)*T+.5*b,L=M*_-M*T;for(let G=0;G!==f;++G)l[G]=y*h[g+G]+A*h[d+G]+S*h[p+G]+L*h[x+G];return l}},_m=class extends xu{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=(o-e)/(a-e),x=1-g;for(let v=0;v!==f;++v)l[v]=h[d+v]*x+h[p+v]*g;return l}},xm=class extends xu{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t){return this.copySampleValue_(t-1)}},ho=class{constructor(t,e,o,a){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=pf(e,this.TimeBufferType),this.values=pf(o,this.ValueBufferType),this.setInterpolation(a||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:pf(t.times,Array),values:pf(t.values,Array)};let a=t.getInterpolation();a!==t.DefaultInterpolation&&(o.interpolation=a)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new xm(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new _m(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new vm(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case mf:e=this.InterpolantFactoryMethodDiscrete;break;case gf:e=this.InterpolantFactoryMethodLinear;break;case yd: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 mf;case this.InterpolantFactoryMethodLinear:return gf;case this.InterpolantFactoryMethodSmooth:return yd}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]*=t}return this}trim(t,e){let o=this.times,a=o.length,l=0,h=a-1;for(;l!==a&&o[l]<t;)++l;for(;h!==-1&&o[h]>e;)--h;if(++h,l!==0||h!==a){l>=h&&(h=Math.max(h,1),l=h-1);let f=this.getValueSize();this.times=o.slice(l,h),this.values=this.values.slice(l*f,h*f)}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,a=this.values,l=o.length;l===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let h=null;for(let f=0;f!==l;f++){let p=o[f];if(typeof p=="number"&&isNaN(p)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,p),t=!1;break}if(h!==null&&h>p){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,p,h),t=!1;break}h=p}if(a!==void 0&&fU(a))for(let f=0,p=a.length;f!==p;++f){let d=a[f];if(isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,f,d),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),a=this.getInterpolation()===yd,l=t.length-1,h=1;for(let f=1;f<l;++f){let p=!1,d=t[f],g=t[f+1];if(d!==g&&(f!==1||d!==t[0]))if(a)p=!0;else{let x=f*o,v=x-o,M=x+o;for(let b=0;b!==o;++b){let T=e[x+b];if(T!==e[v+b]||T!==e[M+b]){p=!0;break}}}if(p){if(f!==h){t[h]=t[f];let x=f*o,v=h*o;for(let M=0;M!==o;++M)e[v+M]=e[x+M]}++h}}if(l>0){t[h]=t[l];for(let f=l*o,p=h*o,d=0;d!==o;++d)e[p+d]=e[f+d];++h}return h!==t.length?(this.times=t.slice(0,h),this.values=e.slice(0,h*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,a=new o(this.name,t,e);return a.createInterpolant=this.createInterpolant,a}};ho.prototype.TimeBufferType=Float32Array;ho.prototype.ValueBufferType=Float32Array;ho.prototype.DefaultInterpolation=gf;var ga=class extends ho{};ga.prototype.ValueTypeName="bool";ga.prototype.ValueBufferType=Array;ga.prototype.DefaultInterpolation=mf;ga.prototype.InterpolantFactoryMethodLinear=void 0;ga.prototype.InterpolantFactoryMethodSmooth=void 0;var Em=class extends ho{};Em.prototype.ValueTypeName="color";var Mm=class extends ho{};Mm.prototype.ValueTypeName="number";var Sm=class extends xu{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=(o-e)/(a-e),d=t*f;for(let g=d+f;d!==g;d+=4)Ls.slerpFlat(l,0,h,d-f,h,d,p);return l}},Al=class extends ho{InterpolantFactoryMethodLinear(t){return new Sm(this.times,this.values,this.getValueSize(),t)}};Al.prototype.ValueTypeName="quaternion";Al.prototype.DefaultInterpolation=gf;Al.prototype.InterpolantFactoryMethodSmooth=void 0;var ya=class extends ho{};ya.prototype.ValueTypeName="string";ya.prototype.ValueBufferType=Array;ya.prototype.DefaultInterpolation=mf;ya.prototype.InterpolantFactoryMethodLinear=void 0;ya.prototype.InterpolantFactoryMethodSmooth=void 0;var wm=class extends ho{};wm.prototype.ValueTypeName="vector";var bm=class{constructor(t,e,o){let a=this,l=!1,h=0,f=0,p,d=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(g){f++,l===!1&&a.onStart!==void 0&&a.onStart(g,h,f),l=!0},this.itemEnd=function(g){h++,a.onProgress!==void 0&&a.onProgress(g,h,f),h===f&&(l=!1,a.onLoad!==void 0&&a.onLoad())},this.itemError=function(g){a.onError!==void 0&&a.onError(g)},this.resolveURL=function(g){return p?p(g):g},this.setURLModifier=function(g){return p=g,this},this.addHandler=function(g,x){return d.push(g,x),this},this.removeHandler=function(g){let x=d.indexOf(g);return x!==-1&&d.splice(x,2),this},this.getHandler=function(g){for(let x=0,v=d.length;x<v;x+=2){let M=d[x],b=d[x+1];if(M.global&&(M.lastIndex=0),M.test(g))return b}return null}}},hU=new bm,Tm=class{constructor(t){this.manager=t!==void 0?t:hU,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(a,l){o.load(t,a,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}};Tm.DEFAULT_MATERIAL_NAME="__DEFAULT";var Lm="\\\\[\\\\]\\\\.:\\\\/",pU=new RegExp("["+Lm+"]","g"),Nm="[^"+Lm+"]",dU="[^"+Lm.replace("\\\\.","")+"]",mU=/((?:WC+[\\/:])*)/.source.replace("WC",Nm),gU=/(WCOD+)?/.source.replace("WCOD",dU),yU=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Nm),vU=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Nm),_U=new RegExp("^"+mU+gU+yU+vU+"$"),xU=["material","materials","bones","map"],Am=class{constructor(t,e,o){let a=o||qn.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,a)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,a=this._bindings[o];a!==void 0&&a.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let a=this._targetGroup.nCachedObjects_,l=o.length;a!==l;++a)o[a].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()}},qn=class r{constructor(t,e,o){this.path=e,this.parsedPath=o||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,o){return t&&t.isAnimationObjectGroup?new r.Composite(t,e,o):new r(t,e,o)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(pU,"")}static parseTrackName(t){let e=_U.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]},a=o.nodeName&&o.nodeName.lastIndexOf(".");if(a!==void 0&&a!==-1){let l=o.nodeName.substring(a+1);xU.indexOf(l)!==-1&&(o.nodeName=o.nodeName.substring(0,a),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 h=0;h<l.length;h++){let f=l[h];if(f.name===e||f.uuid===e)return f;let p=o(f.children);if(p)return p}return null},a=o(t.children);if(a)return a}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 a=0,l=o.length;a!==l;++a)t[e++]=o[a]}_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 a=0,l=o.length;a!==l;++a)o[a]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=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,a=e.propertyName,l=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(o){let d=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 g=0;g<t.length;g++)if(t[g].name===d){d=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[o]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[o]}if(d!==void 0){if(t[d]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[d]}}let h=t[a];if(h===void 0){let d=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+d+"."+a+" but it wasn't found.",t);return}let f=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?f=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(f=this.Versioning.MatrixWorldNeedsUpdate);let p=this.BindingType.Direct;if(l!==void 0){if(a==="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])}p=this.BindingType.ArrayElement,this.resolvedProperty=h,this.propertyIndex=l}else h.fromArray!==void 0&&h.toArray!==void 0?(p=this.BindingType.HasFromToArray,this.resolvedProperty=h):Array.isArray(h)?(p=this.BindingType.EntireArray,this.resolvedProperty=h):this.propertyName=a;this.getValue=this.GetterByBindingType[p],this.setValue=this.SetterByBindingTypeAndVersioning[p][f]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};qn.Composite=Am;qn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};qn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};qn.prototype.GetterByBindingType=[qn.prototype._getValue_direct,qn.prototype._getValue_array,qn.prototype._getValue_arrayElement,qn.prototype._getValue_toArray];qn.prototype.SetterByBindingTypeAndVersioning=[[qn.prototype._setValue_direct,qn.prototype._setValue_direct_setNeedsUpdate,qn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[qn.prototype._setValue_array,qn.prototype._setValue_array_setNeedsUpdate,qn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[qn.prototype._setValue_arrayElement,qn.prototype._setValue_arrayElement_setNeedsUpdate,qn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[qn.prototype._setValue_fromArray,qn.prototype._setValue_fromArray_setNeedsUpdate,qn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var rH=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Cm}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Cm);var Ar=63710088e-1,sH={centimeters:Ar*100,centimetres:Ar*100,degrees:Ar/111325,feet:Ar*3.28084,inches:Ar*39.37,kilometers:Ar/1e3,kilometres:Ar/1e3,meters:Ar,metres:Ar,miles:Ar/1609.344,millimeters:Ar*1e3,millimetres:Ar*1e3,nauticalmiles:Ar/1852,radians:1,yards:Ar*1.0936},aH={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/Ar,yards:1.0936133};function fi(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}function Ln(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(!Co(r[0])||!Co(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return fi(o,t,e)}function Vn(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 fi(f,t,e)}function Cr(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 fi(o,t,e)}function Om(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return fi(o,t,e)}function Co(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function fr(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(fr(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function KE(r,t,e,o){var a=e;return fr(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 Os(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 Li(r,t){Os(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(fi(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(fi(x,a),o,d)===!1)return!1}})}function Dm(r){var t=[1/0,1/0,-1/0,-1/0];return fr(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}Dm.default=Dm;var hi=Dm;function zr(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 Fm(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 Gr(r){return r.type==="Feature"?r.geometry:r}var CU=yn(Bf(),1);var BU=yn(mM(),1);function Pr(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=zr(r),a=Gr(t),l=a.type,h=t.bbox,f=a.coordinates;if(h&&zU(o,h)===!1)return!1;l==="Polygon"&&(f=[f]);for(var p=!1,d=0;d<f.length&&!p;d++)if(gM(o,f[d][0],e.ignoreBoundary)){for(var g=!1,x=1;x<f[d].length&&!g;)gM(o,f[d][x],!e.ignoreBoundary)&&(g=!0),x++;g||(p=!0)}return p}function gM(r,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 a=0,l=t.length-1;a<t.length;l=a++){var h=t[a][0],f=t[a][1],p=t[l][0],d=t[l][1],g=r[1]*(h-p)+f*(p-r[0])+d*(r[0]-h)===0&&(h-r[0])*(p-r[0])<=0&&(f-r[1])*(d-r[1])<=0;if(g)return!e;var x=f>r[1]!=d>r[1]&&r[0]<(p-h)*(r[1]-f)/(d-f)+h;x&&(o=!o)}return o}function zU(r,t){return t[0]<=r[0]&&t[1]<=r[1]&&t[2]>=r[0]&&t[3]>=r[1]}var _M=new ArrayBuffer(16),F6=new Float64Array(_M),U6=new Uint32Array(_M);var tB=yn(jm(),1);var lW=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 o=this.points[e],a=this.points[e+1];this.centers.push({x:(o.x+a.x)/2,y:(o.y+a.y)/2,z:(o.z+a.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,h=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,f=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+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+f)},{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+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+f)}])}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=[],o=this.pos(0);e.push(0);for(var a=0;a<this.duration;a+=10){var l=this.pos(a),h=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));h>t&&(e.push(a),o=l)}return e},r.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))}},r.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 a=Math.floor((this.points.length-1)*o),l=(this.length-1)*o-a;return eB(l,this.points[a],this.controls[a][1],this.controls[a+1][0],this.points[a+1])},r}();function eB(r,t,e,o,a){var l=nB(r),h={x:a.x*l[0]+o.x*l[1]+e.x*l[2]+t.x*l[3],y:a.y*l[0]+o.y*l[1]+e.y*l[2]+t.y*l[3],z:a.z*l[0]+o.z*l[1]+e.z*l[2]+t.z*l[3]};return h}function nB(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 Ll(r,t){t===void 0&&(t={});var e=Number(r[0]),o=Number(r[1]),a=Number(r[2]),l=Number(r[3]);if(r.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var h=[e,o],f=[e,l],p=[a,l],d=[a,o];return Vn([[h,d,p,f,h]],t.properties,{bbox:r,id:t.id})}function rB(r){return Ll(hi(r))}var Qm=rB;var xB=yn(IM(),1);var YB=yn(eh(),1);var ZB=yn(Bf(),1);var jB=yn(jm(),1);var $M=Math.PI/180,ZM=180/Math.PI,zl=function(r,t){this.lon=r,this.lat=t,this.x=$M*r,this.y=$M*t};zl.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};zl.prototype.antipode=function(){var r=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new zl(t,r)};var JM=function(){this.coords=[],this.length=0};JM.prototype.move_to=function(r){this.length++,this.coords.push(r)};var _g=function(r){this.properties=r||{},this.geometries=[]};_g.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}};_g.prototype.wkt=function(){for(var r="",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 a=this.geometries[o].coords;a.forEach(e),r+=t.substring(0,t.length-1)+")"}return r};var KM=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 zl(r.x,r.y),this.end=new zl(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,a=this.start.y-this.end.y,l=Math.pow(Math.sin(a/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 "+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)};KM.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),o=t*Math.cos(this.start.y)*Math.cos(this.start.x)+e*Math.cos(this.end.y)*Math.cos(this.end.x),a=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),h=ZM*Math.atan2(l,Math.sqrt(Math.pow(o,2)+Math.pow(a,2))),f=ZM*Math.atan2(a,o);return[f,h]};KM.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 o=1/(r-1),a=0;a<r;++a){var l=o*a,h=this.interpolate(l);e.push(h)}for(var f=!1,p=0,d=t&&t.offset?t.offset:10,g=180-d,x=-180+d,v=360-d,M=1;M<e.length;++M){var b=e[M-1][0],T=e[M][0],_=Math.abs(T-b);_>v&&(T>g&&b<x||b>g&&T<x)?f=!0:_>p&&(p=_)}var y=[];if(f&&p<d){var A=[];y.push(A);for(var S=0;S<e.length;++S){var L=parseFloat(e[S][0]);if(S>0&&Math.abs(L-e[S-1][0])>v){var G=parseFloat(e[S-1][0]),z=parseFloat(e[S-1][1]),F=parseFloat(e[S][0]),I=parseFloat(e[S][1]);if(G>-180&&G<x&&F===180&&S+1<e.length&&e[S-1][0]>-180&&e[S-1][0]<x){A.push([-180,e[S][1]]),S++,A.push([e[S][0],e[S][1]]);continue}else if(G>g&&G<180&&F===-180&&S+1<e.length&&e[S-1][0]>g&&e[S-1][0]<180){A.push([180,e[S][1]]),S++,A.push([e[S][0],e[S][1]]);continue}if(G<x&&F>g){var ut=G;G=F,F=ut;var R=z;z=I,I=R}if(G>g&&F<x&&(F+=360),G<=180&&F>=180&&G<F){var W=(180-G)/(F-G),V=W*I+(1-W)*z;A.push([e[S-1][0]>g?180:-180,V]),A=[],A.push([e[S-1][0]>g?-180:180,V]),y.push(A)}else A=[],y.push(A);A.push([L,e[S][1]])}else A.push([e[S][0],e[S][1]])}}else{var Mt=[];y.push(Mt);for(var X=0;X<e.length;++X)Mt.push([e[X][0],e[X][1]])}for(var mt=new _g(this.properties),dt=0;dt<y.length;++dt){var vt=new JM;mt.geometries.push(vt);for(var it=y[dt],lt=0;lt<it.length;++lt)vt.move_to(it[lt])}return mt};var ez=yn(eh(),1);var tk=yn(eh(),1);var ek=yn(Yg(),1);var ik=yn(Bf(),1);var we=[],be=[],Te=[],Ae=[],Ce=[],Pe=[],Ie=[],Re=[],Le=[],Ne=[],Oe=[],De=[],Fe=[],Ue=[],Be=[],ze=[],Ge=[],ke=[],qe=[],Ve=[],He=[],We=[],Xe=[],Ye=[];Ie[85]=Ne[85]=-1;Re[85]=Oe[85]=0;Le[85]=De[85]=1;qe[85]=We[85]=1;Ve[85]=Xe[85]=0;He[85]=Ye[85]=1;we[85]=Ae[85]=0;be[85]=Ce[85]=-1;Te[85]=Be[85]=0;ze[85]=Fe[85]=0;Ge[85]=Ue[85]=1;Pe[85]=ke[85]=1;We[1]=We[169]=0;Xe[1]=Xe[169]=-1;Ye[1]=Ye[169]=0;Fe[1]=Fe[169]=-1;Ue[1]=Ue[169]=0;Be[1]=Be[169]=0;Ne[4]=Ne[166]=0;Oe[4]=Oe[166]=-1;De[4]=De[166]=1;ze[4]=ze[166]=1;Ge[4]=Ge[166]=0;ke[4]=ke[166]=0;Ie[16]=Ie[154]=0;Re[16]=Re[154]=1;Le[16]=Le[154]=1;Ae[16]=Ae[154]=1;Ce[16]=Ce[154]=0;Pe[16]=Pe[154]=1;qe[64]=qe[106]=0;Ve[64]=Ve[106]=1;He[64]=He[106]=0;we[64]=we[106]=-1;be[64]=be[106]=0;Te[64]=Te[106]=1;qe[2]=qe[168]=0;Ve[2]=Ve[168]=-1;He[2]=He[168]=1;We[2]=We[168]=0;Xe[2]=Xe[168]=-1;Ye[2]=Ye[168]=0;Fe[2]=Fe[168]=-1;Ue[2]=Ue[168]=0;Be[2]=Be[168]=0;ze[2]=ze[168]=-1;Ge[2]=Ge[168]=0;ke[2]=ke[168]=1;Ie[8]=Ie[162]=0;Re[8]=Re[162]=-1;Le[8]=Le[162]=0;Ne[8]=Ne[162]=0;Oe[8]=Oe[162]=-1;De[8]=De[162]=1;Fe[8]=Fe[162]=1;Ue[8]=Ue[162]=0;Be[8]=Be[162]=1;ze[8]=ze[162]=1;Ge[8]=Ge[162]=0;ke[8]=ke[162]=0;Ie[32]=Ie[138]=0;Re[32]=Re[138]=1;Le[32]=Le[138]=1;Ne[32]=Ne[138]=0;Oe[32]=Oe[138]=1;De[32]=De[138]=0;we[32]=we[138]=1;be[32]=be[138]=0;Te[32]=Te[138]=0;Ae[32]=Ae[138]=1;Ce[32]=Ce[138]=0;Pe[32]=Pe[138]=1;We[128]=We[42]=0;Xe[128]=Xe[42]=1;Ye[128]=Ye[42]=1;qe[128]=qe[42]=0;Ve[128]=Ve[42]=1;He[128]=He[42]=0;we[128]=we[42]=-1;be[128]=be[42]=0;Te[128]=Te[42]=1;Ae[128]=Ae[42]=-1;Ce[128]=Ce[42]=0;Pe[128]=Pe[42]=0;Ne[5]=Ne[165]=-1;Oe[5]=Oe[165]=0;De[5]=De[165]=0;We[5]=We[165]=1;Xe[5]=Xe[165]=0;Ye[5]=Ye[165]=0;ze[20]=ze[150]=0;Ge[20]=Ge[150]=1;ke[20]=ke[150]=1;Ae[20]=Ae[150]=0;Ce[20]=Ce[150]=-1;Pe[20]=Pe[150]=1;Ie[80]=Ie[90]=-1;Re[80]=Re[90]=0;Le[80]=Le[90]=1;qe[80]=qe[90]=1;Ve[80]=Ve[90]=0;He[80]=He[90]=1;Fe[65]=Fe[105]=0;Ue[65]=Ue[105]=1;Be[65]=Be[105]=0;we[65]=we[105]=0;be[65]=be[105]=-1;Te[65]=Te[105]=0;Ie[160]=Ie[10]=-1;Re[160]=Re[10]=0;Le[160]=Le[10]=1;Ne[160]=Ne[10]=-1;Oe[160]=Oe[10]=0;De[160]=De[10]=0;We[160]=We[10]=1;Xe[160]=Xe[10]=0;Ye[160]=Ye[10]=0;qe[160]=qe[10]=1;Ve[160]=Ve[10]=0;He[160]=He[10]=1;ze[130]=ze[40]=0;Ge[130]=Ge[40]=1;ke[130]=ke[40]=1;Fe[130]=Fe[40]=0;Ue[130]=Ue[40]=1;Be[130]=Be[40]=0;we[130]=we[40]=0;be[130]=be[40]=-1;Te[130]=Te[40]=0;Ae[130]=Ae[40]=0;Ce[130]=Ce[40]=-1;Pe[130]=Pe[40]=1;Ne[37]=Ne[133]=0;Oe[37]=Oe[133]=1;De[37]=De[133]=1;We[37]=We[133]=0;Xe[37]=Xe[133]=1;Ye[37]=Ye[133]=0;we[37]=we[133]=-1;be[37]=be[133]=0;Te[37]=Te[133]=0;Ae[37]=Ae[133]=1;Ce[37]=Ce[133]=0;Pe[37]=Pe[133]=0;ze[148]=ze[22]=-1;Ge[148]=Ge[22]=0;ke[148]=ke[22]=0;We[148]=We[22]=0;Xe[148]=Xe[22]=-1;Ye[148]=Ye[22]=1;qe[148]=qe[22]=0;Ve[148]=Ve[22]=1;He[148]=He[22]=1;Ae[148]=Ae[22]=-1;Ce[148]=Ce[22]=0;Pe[148]=Pe[22]=1;Ie[82]=Ie[88]=0;Re[82]=Re[88]=-1;Le[82]=Le[88]=1;ze[82]=ze[88]=1;Ge[82]=Ge[88]=0;ke[82]=ke[88]=1;Fe[82]=Fe[88]=-1;Ue[82]=Ue[88]=0;Be[82]=Be[88]=1;qe[82]=qe[88]=0;Ve[82]=Ve[88]=-1;He[82]=He[88]=0;Ie[73]=Ie[97]=0;Re[73]=Re[97]=1;Le[73]=Le[97]=0;Ne[73]=Ne[97]=0;Oe[73]=Oe[97]=-1;De[73]=De[97]=0;Fe[73]=Fe[97]=1;Ue[73]=Ue[97]=0;Be[73]=Be[97]=0;we[73]=we[97]=1;be[73]=be[97]=0;Te[73]=Te[97]=1;Ie[145]=Ie[25]=0;Re[145]=Re[25]=-1;Le[145]=Le[25]=0;Fe[145]=Fe[25]=1;Ue[145]=Ue[25]=0;Be[145]=Be[25]=1;We[145]=We[25]=0;Xe[145]=Xe[25]=1;Ye[145]=Ye[25]=1;Ae[145]=Ae[25]=-1;Ce[145]=Ce[25]=0;Pe[145]=Pe[25]=0;Ne[70]=Ne[100]=0;Oe[70]=Oe[100]=1;De[70]=De[100]=0;ze[70]=ze[100]=-1;Ge[70]=Ge[100]=0;ke[70]=ke[100]=1;qe[70]=qe[100]=0;Ve[70]=Ve[100]=-1;He[70]=He[100]=1;we[70]=we[100]=1;be[70]=be[100]=0;Te[70]=Te[100]=0;Ne[101]=Ne[69]=0;Oe[101]=Oe[69]=1;De[101]=De[69]=0;we[101]=we[69]=1;be[101]=be[69]=0;Te[101]=Te[69]=0;We[149]=We[21]=0;Xe[149]=Xe[21]=1;Ye[149]=Ye[21]=1;Ae[149]=Ae[21]=-1;Ce[149]=Ce[21]=0;Pe[149]=Pe[21]=0;ze[86]=ze[84]=-1;Ge[86]=Ge[84]=0;ke[86]=ke[84]=1;qe[86]=qe[84]=0;Ve[86]=Ve[84]=-1;He[86]=He[84]=1;Ie[89]=Ie[81]=0;Re[89]=Re[81]=-1;Le[89]=Le[81]=0;Fe[89]=Fe[81]=1;Ue[89]=Ue[81]=0;Be[89]=Be[81]=1;Ie[96]=Ie[74]=0;Re[96]=Re[74]=1;Le[96]=Le[74]=0;Ne[96]=Ne[74]=-1;Oe[96]=Oe[74]=0;De[96]=De[74]=1;qe[96]=qe[74]=1;Ve[96]=Ve[74]=0;He[96]=He[74]=0;we[96]=we[74]=1;be[96]=be[74]=0;Te[96]=Te[74]=1;Ie[24]=Ie[146]=0;Re[24]=Re[146]=-1;Le[24]=Le[146]=1;ze[24]=ze[146]=1;Ge[24]=Ge[146]=0;ke[24]=ke[146]=1;Fe[24]=Fe[146]=0;Ue[24]=Ue[146]=1;Be[24]=Be[146]=1;Ae[24]=Ae[146]=0;Ce[24]=Ce[146]=-1;Pe[24]=Pe[146]=0;Ne[6]=Ne[164]=-1;Oe[6]=Oe[164]=0;De[6]=De[164]=1;ze[6]=ze[164]=-1;Ge[6]=Ge[164]=0;ke[6]=ke[164]=0;We[6]=We[164]=0;Xe[6]=Xe[164]=-1;Ye[6]=Ye[164]=1;qe[6]=qe[164]=1;Ve[6]=Ve[164]=0;He[6]=He[164]=0;Fe[129]=Fe[41]=0;Ue[129]=Ue[41]=1;Be[129]=Be[41]=1;We[129]=We[41]=0;Xe[129]=Xe[41]=1;Ye[129]=Ye[41]=0;we[129]=we[41]=-1;be[129]=be[41]=0;Te[129]=Te[41]=0;Ae[129]=Ae[41]=0;Ce[129]=Ce[41]=-1;Pe[129]=Pe[41]=0;ze[66]=ze[104]=0;Ge[66]=Ge[104]=1;ke[66]=ke[104]=0;Fe[66]=Fe[104]=-1;Ue[66]=Ue[104]=0;Be[66]=Be[104]=1;qe[66]=qe[104]=0;Ve[66]=Ve[104]=-1;He[66]=He[104]=0;we[66]=we[104]=0;be[66]=be[104]=-1;Te[66]=Te[104]=1;Ie[144]=Ie[26]=-1;Re[144]=Re[26]=0;Le[144]=Le[26]=0;We[144]=We[26]=1;Xe[144]=Xe[26]=0;Ye[144]=Ye[26]=1;qe[144]=qe[26]=0;Ve[144]=Ve[26]=1;He[144]=He[26]=1;Ae[144]=Ae[26]=-1;Ce[144]=Ce[26]=0;Pe[144]=Pe[26]=1;Ne[36]=Ne[134]=0;Oe[36]=Oe[134]=1;De[36]=De[134]=1;ze[36]=ze[134]=0;Ge[36]=Ge[134]=1;ke[36]=ke[134]=0;we[36]=we[134]=0;be[36]=be[134]=-1;Te[36]=Te[134]=1;Ae[36]=Ae[134]=1;Ce[36]=Ce[134]=0;Pe[36]=Pe[134]=0;Ie[9]=Ie[161]=-1;Re[9]=Re[161]=0;Le[9]=Le[161]=0;Ne[9]=Ne[161]=0;Oe[9]=Oe[161]=-1;De[9]=De[161]=0;Fe[9]=Fe[161]=1;Ue[9]=Ue[161]=0;Be[9]=Be[161]=0;We[9]=We[161]=1;Xe[9]=Xe[161]=0;Ye[9]=Ye[161]=1;Ie[136]=0;Re[136]=1;Le[136]=1;Ne[136]=0;Oe[136]=1;De[136]=0;ze[136]=-1;Ge[136]=0;ke[136]=1;Fe[136]=-1;Ue[136]=0;Be[136]=0;We[136]=0;Xe[136]=-1;Ye[136]=0;qe[136]=0;Ve[136]=-1;He[136]=1;we[136]=1;be[136]=0;Te[136]=0;Ae[136]=1;Ce[136]=0;Pe[136]=1;Ie[34]=0;Re[34]=-1;Le[34]=0;Ne[34]=0;Oe[34]=-1;De[34]=1;ze[34]=1;Ge[34]=0;ke[34]=0;Fe[34]=1;Ue[34]=0;Be[34]=1;We[34]=0;Xe[34]=1;Ye[34]=1;qe[34]=0;Ve[34]=1;He[34]=0;we[34]=-1;be[34]=0;Te[34]=1;Ae[34]=-1;Ce[34]=0;Pe[34]=0;Ie[35]=0;Re[35]=1;Le[35]=1;Ne[35]=0;Oe[35]=-1;De[35]=1;ze[35]=1;Ge[35]=0;ke[35]=0;Fe[35]=-1;Ue[35]=0;Be[35]=0;We[35]=0;Xe[35]=-1;Ye[35]=0;qe[35]=0;Ve[35]=1;He[35]=0;we[35]=-1;be[35]=0;Te[35]=1;Ae[35]=1;Ce[35]=0;Pe[35]=1;Ie[153]=0;Re[153]=1;Le[153]=1;Fe[153]=-1;Ue[153]=0;Be[153]=0;We[153]=0;Xe[153]=-1;Ye[153]=0;Ae[153]=1;Ce[153]=0;Pe[153]=1;Ne[102]=0;Oe[102]=-1;De[102]=1;ze[102]=1;Ge[102]=0;ke[102]=0;qe[102]=0;Ve[102]=1;He[102]=0;we[102]=-1;be[102]=0;Te[102]=1;Ie[155]=0;Re[155]=-1;Le[155]=0;Fe[155]=1;Ue[155]=0;Be[155]=1;We[155]=0;Xe[155]=1;Ye[155]=1;Ae[155]=-1;Ce[155]=0;Pe[155]=0;Ne[103]=0;Oe[103]=1;De[103]=0;ze[103]=-1;Ge[103]=0;ke[103]=1;qe[103]=0;Ve[103]=-1;He[103]=1;we[103]=1;be[103]=0;Te[103]=0;Ie[152]=0;Re[152]=1;Le[152]=1;ze[152]=-1;Ge[152]=0;ke[152]=1;Fe[152]=-1;Ue[152]=0;Be[152]=0;We[152]=0;Xe[152]=-1;Ye[152]=0;qe[152]=0;Ve[152]=-1;He[152]=1;Ae[152]=1;Ce[152]=0;Pe[152]=1;Ie[156]=0;Re[156]=-1;Le[156]=1;ze[156]=1;Ge[156]=0;ke[156]=1;Fe[156]=-1;Ue[156]=0;Be[156]=0;We[156]=0;Xe[156]=-1;Ye[156]=0;qe[156]=0;Ve[156]=1;He[156]=1;Ae[156]=-1;Ce[156]=0;Pe[156]=1;Ie[137]=0;Re[137]=1;Le[137]=1;Ne[137]=0;Oe[137]=1;De[137]=0;Fe[137]=-1;Ue[137]=0;Be[137]=0;We[137]=0;Xe[137]=-1;Ye[137]=0;we[137]=1;be[137]=0;Te[137]=0;Ae[137]=1;Ce[137]=0;Pe[137]=1;Ie[139]=0;Re[139]=1;Le[139]=1;Ne[139]=0;Oe[139]=-1;De[139]=0;Fe[139]=1;Ue[139]=0;Be[139]=0;We[139]=0;Xe[139]=1;Ye[139]=0;we[139]=-1;be[139]=0;Te[139]=0;Ae[139]=1;Ce[139]=0;Pe[139]=1;Ie[98]=0;Re[98]=-1;Le[98]=0;Ne[98]=0;Oe[98]=-1;De[98]=1;ze[98]=1;Ge[98]=0;ke[98]=0;Fe[98]=1;Ue[98]=0;Be[98]=1;qe[98]=0;Ve[98]=1;He[98]=0;we[98]=-1;be[98]=0;Te[98]=1;Ie[99]=0;Re[99]=1;Le[99]=0;Ne[99]=0;Oe[99]=-1;De[99]=1;ze[99]=1;Ge[99]=0;ke[99]=0;Fe[99]=-1;Ue[99]=0;Be[99]=1;qe[99]=0;Ve[99]=-1;He[99]=0;we[99]=1;be[99]=0;Te[99]=1;Ne[38]=0;Oe[38]=-1;De[38]=1;ze[38]=1;Ge[38]=0;ke[38]=0;We[38]=0;Xe[38]=1;Ye[38]=1;qe[38]=0;Ve[38]=1;He[38]=0;we[38]=-1;be[38]=0;Te[38]=1;Ae[38]=-1;Ce[38]=0;Pe[38]=0;Ne[39]=0;Oe[39]=1;De[39]=1;ze[39]=-1;Ge[39]=0;ke[39]=0;We[39]=0;Xe[39]=-1;Ye[39]=1;qe[39]=0;Ve[39]=1;He[39]=0;we[39]=-1;be[39]=0;Te[39]=1;Ae[39]=1;Ce[39]=0;Pe[39]=0;var $g=function(r){return[[r.bottomleft,0],[0,0],[0,r.leftbottom]]},Zg=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0]]},Jg=function(r){return[[r.topright,1],[1,1],[1,r.righttop]]},Kg=function(r){return[[0,r.lefttop],[0,1],[r.topleft,1]]},jg=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop]]},Qg=function(r){return[[r.bottomright,0],[r.bottomleft,0],[1,r.righttop],[1,r.rightbottom]]},t0=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.topleft,1],[r.topright,1]]},e0=function(r){return[[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},ok=function(r){return[[0,0],[0,r.leftbottom],[1,r.rightbottom],[1,0]]},sk=function(r){return[[1,0],[r.bottomright,0],[r.topright,1],[1,1]]},ak=function(r){return[[1,1],[1,r.righttop],[0,r.lefttop],[0,1]]},uk=function(r){return[[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},lk=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.leftbottom],[0,r.lefttop]]},ck=function(r){return[[r.topleft,1],[r.topright,1],[r.bottomright,0],[r.bottomleft,0]]},fk=function(){return[[0,0],[0,1],[1,1],[1,0]]},hk=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,1],[r.topleft,1]]},pk=function(r){return[[r.topright,1],[1,1],[1,0],[0,0],[0,r.leftbottom]]},dk=function(r){return[[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[1,1]]},mk=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,1]]},gk=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.lefttop],[0,1],[r.topleft,1]]},yk=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[r.topright,1]]},vk=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop]]},_k=function(r){return[[r.topright,1],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1]]},xk=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},Ek=function(r){return[[1,1],[1,r.righttop],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},Mk=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[r.topleft,1],[r.topright,1]]},Sk=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom]]},wk=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},bk=function(r){return[[1,1],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},Tk=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1]]},Ak=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},Ck=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},Pk=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},Ik=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]]},Rk=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},Lk=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},Nk=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},Ok=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},Dk=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},Fk=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},Je=[],Ke=[],je=[],Qe=[],tn=[],en=[],nn=[],rn=[];Qe[1]=tn[1]=18;Qe[169]=tn[169]=18;je[4]=Ke[4]=12;je[166]=Ke[166]=12;Je[16]=rn[16]=4;Je[154]=rn[154]=4;en[64]=nn[64]=22;en[106]=nn[106]=22;je[2]=en[2]=17;Qe[2]=tn[2]=18;je[168]=en[168]=17;Qe[168]=tn[168]=18;Je[8]=Qe[8]=9;Ke[8]=je[8]=12;Je[162]=Qe[162]=9;Ke[162]=je[162]=12;Je[32]=rn[32]=4;Ke[32]=nn[32]=1;Je[138]=rn[138]=4;Ke[138]=nn[138]=1;tn[128]=rn[128]=21;en[128]=nn[128]=22;tn[42]=rn[42]=21;en[42]=nn[42]=22;Ke[5]=tn[5]=14;Ke[165]=tn[165]=14;je[20]=rn[20]=6;je[150]=rn[150]=6;Je[80]=en[80]=11;Je[90]=en[90]=11;Qe[65]=nn[65]=3;Qe[105]=nn[105]=3;Je[160]=en[160]=11;Ke[160]=tn[160]=14;Je[10]=en[10]=11;Ke[10]=tn[10]=14;je[130]=rn[130]=6;Qe[130]=nn[130]=3;je[40]=rn[40]=6;Qe[40]=nn[40]=3;Ke[101]=nn[101]=1;Ke[69]=nn[69]=1;tn[149]=rn[149]=21;tn[21]=rn[21]=21;je[86]=en[86]=17;je[84]=en[84]=17;Je[89]=Qe[89]=9;Je[81]=Qe[81]=9;Je[96]=nn[96]=0;Ke[96]=en[96]=15;Je[74]=nn[74]=0;Ke[74]=en[74]=15;Je[24]=je[24]=8;Qe[24]=rn[24]=7;Je[146]=je[146]=8;Qe[146]=rn[146]=7;Ke[6]=en[6]=15;je[6]=tn[6]=16;Ke[164]=en[164]=15;je[164]=tn[164]=16;Qe[129]=rn[129]=7;tn[129]=nn[129]=20;Qe[41]=rn[41]=7;tn[41]=nn[41]=20;je[66]=nn[66]=2;Qe[66]=en[66]=19;je[104]=nn[104]=2;Qe[104]=en[104]=19;Je[144]=tn[144]=10;en[144]=rn[144]=23;Je[26]=tn[26]=10;en[26]=rn[26]=23;Ke[36]=rn[36]=5;je[36]=nn[36]=2;Ke[134]=rn[134]=5;je[134]=nn[134]=2;Je[9]=tn[9]=10;Ke[9]=Qe[9]=13;Je[161]=tn[161]=10;Ke[161]=Qe[161]=13;Ke[37]=rn[37]=5;tn[37]=nn[37]=20;Ke[133]=rn[133]=5;tn[133]=nn[133]=20;je[148]=tn[148]=16;en[148]=rn[148]=23;je[22]=tn[22]=16;en[22]=rn[22]=23;Je[82]=je[82]=8;Qe[82]=en[82]=19;Je[88]=je[88]=8;Qe[88]=en[88]=19;Je[73]=nn[73]=0;Ke[73]=Qe[73]=13;Je[97]=nn[97]=0;Ke[97]=Qe[97]=13;Je[145]=Qe[145]=9;tn[145]=rn[145]=21;Je[25]=Qe[25]=9;tn[25]=rn[25]=21;Ke[70]=nn[70]=1;je[70]=en[70]=17;Ke[100]=nn[100]=1;je[100]=en[100]=17;Je[34]=Qe[34]=9;Ke[34]=je[34]=12;tn[34]=rn[34]=21;en[34]=nn[34]=22;Je[136]=rn[136]=4;Ke[136]=nn[136]=1;je[136]=en[136]=17;Qe[136]=tn[136]=18;Je[35]=rn[35]=4;Ke[35]=je[35]=12;Qe[35]=tn[35]=18;en[35]=nn[35]=22;Je[153]=rn[153]=4;Qe[153]=tn[153]=18;Ke[102]=je[102]=12;en[102]=nn[102]=22;Je[155]=Qe[155]=9;tn[155]=rn[155]=23;Ke[103]=nn[103]=1;je[103]=en[103]=17;Je[152]=rn[152]=4;je[152]=en[152]=17;Qe[152]=tn[152]=18;Je[156]=je[156]=8;Qe[156]=tn[156]=18;en[156]=rn[156]=23;Je[137]=rn[137]=4;Ke[137]=nn[137]=1;Qe[137]=tn[137]=18;Je[139]=rn[139]=4;Ke[139]=Qe[139]=13;tn[139]=nn[139]=20;Je[98]=Qe[98]=9;Ke[98]=je[98]=12;en[98]=nn[98]=22;Je[99]=nn[99]=0;Ke[99]=je[99]=12;Qe[99]=en[99]=19;Ke[38]=je[38]=12;tn[38]=rn[38]=21;en[38]=nn[38]=22;Ke[39]=rn[39]=5;je[39]=tn[39]=16;en[39]=nn[39]=22;var Gt=[];Gt[1]=Gt[169]=$g;Gt[4]=Gt[166]=Zg;Gt[16]=Gt[154]=Jg;Gt[64]=Gt[106]=Kg;Gt[168]=Gt[2]=jg;Gt[162]=Gt[8]=Qg;Gt[138]=Gt[32]=t0;Gt[42]=Gt[128]=e0;Gt[5]=Gt[165]=ok;Gt[20]=Gt[150]=sk;Gt[80]=Gt[90]=ak;Gt[65]=Gt[105]=uk;Gt[160]=Gt[10]=lk;Gt[130]=Gt[40]=ck;Gt[85]=fk;Gt[101]=Gt[69]=hk;Gt[149]=Gt[21]=pk;Gt[86]=Gt[84]=dk;Gt[89]=Gt[81]=mk;Gt[96]=Gt[74]=gk;Gt[24]=Gt[146]=yk;Gt[6]=Gt[164]=vk;Gt[129]=Gt[41]=_k;Gt[66]=Gt[104]=xk;Gt[144]=Gt[26]=Ek;Gt[36]=Gt[134]=Mk;Gt[9]=Gt[161]=Sk;Gt[37]=Gt[133]=wk;Gt[148]=Gt[22]=bk;Gt[82]=Gt[88]=Tk;Gt[73]=Gt[97]=Ak;Gt[145]=Gt[25]=Ck;Gt[70]=Gt[100]=Pk;Gt[34]=function(r){return[e0(r),Qg(r)]};Gt[35]=Ik;Gt[136]=function(r){return[t0(r),jg(r)]};Gt[153]=function(r){return[Jg(r),$g(r)]};Gt[102]=function(r){return[Zg(r),Kg(r)]};Gt[155]=Rk;Gt[103]=Lk;Gt[152]=function(r){return[Jg(r),jg(r)]};Gt[156]=Nk;Gt[137]=function(r){return[t0(r),$g(r)]};Gt[139]=Ok;Gt[98]=function(r){return[Qg(r),Kg(r)]};Gt[99]=Dk;Gt[38]=function(r){return[Zg(r),e0(r)]};Gt[39]=Fk;function Bk(r){return(r>0)-(r<0)||+r}function Uu(r,t,e){var o=t[0]-r[0],a=t[1]-r[1],l=e[0]-t[0],h=e[1]-t[1];return Bk(o*h-l*a)}function Bb(r,t){var e=r.geometry.coordinates[0].map(function(h){return h[0]}),o=r.geometry.coordinates[0].map(function(h){return h[1]}),a=t.geometry.coordinates[0].map(function(h){return h[0]}),l=t.geometry.coordinates[0].map(function(h){return h[1]});return Math.max.apply(null,e)===Math.max.apply(null,a)&&Math.max.apply(null,o)===Math.max.apply(null,l)&&Math.min.apply(null,e)===Math.min.apply(null,a)&&Math.min.apply(null,o)===Math.min.apply(null,l)}function n0(r,t){return t.geometry.coordinates[0].every(function(e){return Pr(Ln(e),r)})}function zb(r,t){return r[0]===t[0]&&r[1]===t[1]}var zk=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,o){var a=e.to,l=o.to;if(a.coordinates[0]-t.coordinates[0]>=0&&l.coordinates[0]-t.coordinates[0]<0)return 1;if(a.coordinates[0]-t.coordinates[0]<0&&l.coordinates[0]-t.coordinates[0]>=0)return-1;if(a.coordinates[0]-t.coordinates[0]===0&&l.coordinates[0]-t.coordinates[0]===0)return a.coordinates[1]-t.coordinates[1]>=0||l.coordinates[1]-t.coordinates[1]>=0?a.coordinates[1]-l.coordinates[1]:l.coordinates[1]-a.coordinates[1];var h=Uu(t.coordinates,a.coordinates,l.coordinates);if(h<0)return 1;if(h>0)return-1;var f=Math.pow(a.coordinates[0]-t.coordinates[0],2)+Math.pow(a.coordinates[1]-t.coordinates[1],2),p=Math.pow(l.coordinates[0]-t.coordinates[0],2)+Math.pow(l.coordinates[1]-t.coordinates[1],2);return f-p}),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}(),r0=zk;var Gk=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 Cr([this.from.coordinates,this.to.coordinates])},r.prototype.compareTo=function(t){return Uu(t.from.coordinates,t.to.coordinates,this.to.coordinates)},r}(),Gb=Gk;var kk=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(h,f,p){return f.from.coordinates[1]>t.edges[h].from.coordinates[1]&&(h=p),h},0),o=(e===0?this.length:e)-1,a=(e+1)%this.length,l=Uu(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[a].from.coordinates);return l===0?this.edges[o].from.coordinates[0]>this.edges[a].from.coordinates[0]:l>0},r.prototype.toMultiPoint=function(){return Om(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=Vn([t])},r.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Qm(this.toPolygon())},r.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),a,l;return e.forEach(function(h){var f=h.getEnvelope();if(l&&(a=l.getEnvelope()),!Bb(f,o)&&n0(f,o)){for(var p=t.map(function(b){return b.from.coordinates}),d=void 0,g=function(b){h.some(function(T){return zb(b,T.from.coordinates)})||(d=b)},x=0,v=p;x<v.length;x++){var M=v[x];g(M)}d&&h.inside(Ln(d))&&(!l||n0(a,f))&&(l=h)}}),l},r.prototype.inside=function(t){return Pr(t,this.toPolygon())},r}(),i0=kk;function qk(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 yZ=function(){function r(){this.edges=[],this.nodes={}}return r.fromGeoJson=function(t){qk(t);var e=new r;return Li(t,function(o){Fm(o,"LineString","Graph::fromGeoJson"),KE(o,function(a,l){if(a){var h=e.getNode(a),f=e.getNode(l);e.addEdge(h,f)}return l})}),e},r.prototype.getNode=function(t){var e=r0.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new r0(t)),o},r.prototype.addEdge=function(t,e){var o=new Gb(t,e),a=o.getSymetric();this.edges.push(o),this.edges.push(a)},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 o=t.getOuterEdges().map(function(a){return a.to});this.removeNode(t),o.forEach(function(a){return e._removeIfDangle(a)})}},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(o){return e._computeNextCWEdges(e.nodes[o])}):t.getOuterEdges().forEach(function(o,a){t.getOuterEdge((a===0?t.getOuterEdges().length:a)-1).symetric.next=o})},r.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),a,l,h=o.length-1;h>=0;--h){var f=o[h],p=f.symetric,d=void 0,g=void 0;f.label===e&&(d=f),p.label===e&&(g=p),!(!d||!g)&&(g&&(l=g),d&&(l&&(l.next=d,l=void 0),a||(a=d)))}l&&(l.next=a)},r.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var a=o;do a.label=e,a=a.next;while(!o.isEqual(a));e++}}),t},r.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(a){t._computeNextCCWEdges(a,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},r.prototype._findIntersectionNodes=function(t){var e=[],o=t,a=function(){var l=0;o.from.getOuterEdges().forEach(function(h){h.label===t.label&&++l}),l>1&&e.push(o.from),o=o.next};do a();while(!t.isEqual(o));return e},r.prototype._findEdgeRing=function(t){var e=t,o=new i0;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},r.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]},r.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},r}();var Xk=yn(o0(),1);var Yk=yn(o0(),1);var Zk=yn(Zb(),1);var n4=yn(oT(),1);function aT(r){for(var t=r,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function i4(){return new uT(function(r){return r.f})}var l0={search:function(r,t,e,o){r.cleanDirty(),o=o||{};var a=o.heuristic||l0.heuristics.manhattan,l=o.closest||!1,h=i4(),f=t;for(t.h=a(t,e),h.push(t);h.size()>0;){var p=h.pop();if(p===e)return aT(p);p.closed=!0;for(var d=r.neighbors(p),g=0,x=d.length;g<x;++g){var v=d[g];if(!(v.closed||v.isWall())){var M=p.g+v.getCost(p),b=v.visited;(!b||M<v.g)&&(v.visited=!0,v.parent=p,v.h=v.h||a(v,e),v.g=M,v.f=v.g+v.h,r.markDirty(v),l&&(v.h<f.h||v.h===f.h&&v.g<f.g)&&(f=v),b?h.rescoreElement(v):h.push(v))}}}return l?aT(f):[]},heuristics:{manhattan:function(r,t){var e=Math.abs(t.x-r.x),o=Math.abs(t.y-r.y);return e+o},diagonal:function(r,t){var e=1,o=Math.sqrt(2),a=Math.abs(t.x-r.x),l=Math.abs(t.y-r.y);return e*(a+l)+(o-2*e)*Math.min(a,l)}},cleanNode:function(r){r.f=0,r.g=0,r.h=0,r.visited=!1,r.closed=!1,r.parent=null}};function $l(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 o=0,a=r[e];o<a.length;o++){var l=new Ch(e,o,a[o]);this.grid[e][o]=l,this.nodes.push(l)}}this.init()}$l.prototype.init=function(){this.dirtyNodes=[];for(var r=0;r<this.nodes.length;r++)l0.cleanNode(this.nodes[r])};$l.prototype.cleanDirty=function(){for(var r=0;r<this.dirtyNodes.length;r++)l0.cleanNode(this.dirtyNodes[r]);this.dirtyNodes=[]};$l.prototype.markDirty=function(r){this.dirtyNodes.push(r)};$l.prototype.neighbors=function(r){var t=[],e=r.x,o=r.y,a=this.grid;return a[e-1]&&a[e-1][o]&&t.push(a[e-1][o]),a[e+1]&&a[e+1][o]&&t.push(a[e+1][o]),a[e]&&a[e][o-1]&&t.push(a[e][o-1]),a[e]&&a[e][o+1]&&t.push(a[e][o+1]),this.diagonal&&(a[e-1]&&a[e-1][o-1]&&t.push(a[e-1][o-1]),a[e+1]&&a[e+1][o-1]&&t.push(a[e+1][o-1]),a[e-1]&&a[e-1][o+1]&&t.push(a[e-1][o+1]),a[e+1]&&a[e+1][o+1]&&t.push(a[e+1][o+1])),t};$l.prototype.toString=function(){for(var r=[],t=this.grid,e,o,a,l,h=0,f=t.length;h<f;h++){for(e=[],o=t[h],a=0,l=o.length;a<l;a++)e.push(o[a].weight);r.push(e.join(" "))}return r.join(\`
|
|
11548
11548
|
\`)};function Ch(r,t,e){this.x=r,this.y=t,this.weight=e}Ch.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Ch.prototype.getCost=function(r){return r&&r.x!==this.x&&r.y!==this.y?this.weight*1.41421:this.weight};Ch.prototype.isWall=function(){return this.weight===0};function uT(r){this.content=[],this.scoreFunction=r}uT.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,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[r]=o,r=e;else break}},bubbleUp:function(r){for(var t=this.content.length,e=this.content[r],o=this.scoreFunction(e);;){var a=r+1<<1,l=a-1,h=null,f;if(l<t){var p=this.content[l];f=this.scoreFunction(p),f<o&&(h=l)}if(a<t){var d=this.content[a],g=this.scoreFunction(d);g<(h===null?o:f)&&(h=a)}if(h!==null)this.content[r]=this.content[h],this.content[h]=e,r=h;else break}}};function c0(){this._=null}function zu(r){r.U=r.C=r.L=r.R=r.P=r.N=null}c0.prototype={constructor:c0,insert:function(r,t){var e,o,a;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=lT(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;)o=e.U,e===o.L?(a=o.R,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.R&&(Zl(this,e),r=e,e=r.U),e.C=!1,o.C=!0,Jl(this,o))):(a=o.L,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.L&&(Jl(this,e),r=e,e=r.U),e.C=!1,o.C=!0,Zl(this,o))),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,o=r.L,a=r.R,l,h;if(o?a?l=lT(a):l=o:l=a,t?t.L===r?t.L=l:t.R=l:this._=l,o&&a?(h=l.C,l.C=r.C,l.L=o,o.U=l,l!==a?(t=l.U,l.U=r.U,r=l.R,t.L=r,l.R=a,a.U=l):(l.U=t,t=l,r=l.R)):(h=r.C,r=l),r&&(r.U=t),!h){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,Zl(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,Jl(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Zl(this,t),r=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,Jl(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,Zl(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,Jl(this,t),r=this._;break}e.C=!0,r=t,t=t.U}while(!r.C);r&&(r.C=!1)}}};function Zl(r,t){var e=t,o=t.R,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function Jl(r,t){var e=t,o=t.L,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function lT(r){for(;r.L;)r=r.L;return r}var f0=c0;function Gu(r,t,e,o){var a=[null,null],l=Rr.push(a)-1;return a.left=r,a.right=t,e&&Kl(a,r,t,e),o&&Kl(a,t,r,o),pi[r.index].halfedges.push(l),pi[t.index].halfedges.push(l),a}function ku(r,t,e){var o=[t,e];return o.left=r,o}function Kl(r,t,e,o){!r[0]&&!r[1]?(r[0]=o,r.left=t,r.right=e):r.left===e?r[1]=o:r[0]=o}function o4(r,t,e,o,a){var l=r[0],h=r[1],f=l[0],p=l[1],d=h[0],g=h[1],x=0,v=1,M=d-f,b=g-p,T;if(T=t-f,!(!M&&T>0)){if(T/=M,M<0){if(T<x)return;T<v&&(v=T)}else if(M>0){if(T>v)return;T>x&&(x=T)}if(T=o-f,!(!M&&T<0)){if(T/=M,M<0){if(T>v)return;T>x&&(x=T)}else if(M>0){if(T<x)return;T<v&&(v=T)}if(T=e-p,!(!b&&T>0)){if(T/=b,b<0){if(T<x)return;T<v&&(v=T)}else if(b>0){if(T>v)return;T>x&&(x=T)}if(T=a-p,!(!b&&T<0)){if(T/=b,b<0){if(T>v)return;T>x&&(x=T)}else if(b>0){if(T<x)return;T<v&&(v=T)}return!(x>0)&&!(v<1)||(x>0&&(r[0]=[f+x*M,p+x*b]),v<1&&(r[1]=[f+v*M,p+v*b])),!0}}}}}function s4(r,t,e,o,a){var l=r[1];if(l)return!0;var h=r[0],f=r.left,p=r.right,d=f[0],g=f[1],x=p[0],v=p[1],M=(d+x)/2,b=(g+v)/2,T,_;if(v===g){if(M<t||M>=o)return;if(d>x){if(!h)h=[M,e];else if(h[1]>=a)return;l=[M,a]}else{if(!h)h=[M,a];else if(h[1]<e)return;l=[M,e]}}else if(T=(d-x)/(v-g),_=b-T*M,T<-1||T>1)if(d>x){if(!h)h=[(e-_)/T,e];else if(h[1]>=a)return;l=[(a-_)/T,a]}else{if(!h)h=[(a-_)/T,a];else if(h[1]<e)return;l=[(e-_)/T,e]}else if(g<v){if(!h)h=[t,T*t+_];else if(h[0]>=o)return;l=[o,T*o+_]}else{if(!h)h=[o,T*o+_];else if(h[0]<t)return;l=[t,T*t+_]}return r[0]=h,r[1]=l,!0}function cT(r,t,e,o){for(var a=Rr.length,l;a--;)(!s4(l=Rr[a],r,t,e,o)||!o4(l,r,t,e,o)||!(Math.abs(l[0][0]-l[1][0])>Cn||Math.abs(l[0][1]-l[1][1])>Cn))&&delete Rr[a]}function fT(r){return pi[r.index]={site:r,halfedges:[]}}function a4(r,t){var e=r.site,o=t.left,a=t.right;return e===a&&(a=o,o=e),a?Math.atan2(a[1]-o[1],a[0]-o[0]):(e===o?(o=t[1],a=t[0]):(o=t[0],a=t[1]),Math.atan2(o[0]-a[0],a[1]-o[1]))}function h0(r,t){return t[+(t.left!==r.site)]}function u4(r,t){return t[+(t.left===r.site)]}function hT(){for(var r=0,t=pi.length,e,o,a,l;r<t;++r)if((e=pi[r])&&(l=(o=e.halfedges).length)){var h=new Array(l),f=new Array(l);for(a=0;a<l;++a)h[a]=a,f[a]=a4(e,Rr[o[a]]);for(h.sort(function(p,d){return f[d]-f[p]}),a=0;a<l;++a)f[a]=o[h[a]];for(a=0;a<l;++a)o[a]=f[a]}}function pT(r,t,e,o){var a=pi.length,l,h,f,p,d,g,x,v,M,b,T,_,y=!0;for(l=0;l<a;++l)if(h=pi[l]){for(f=h.site,d=h.halfedges,p=d.length;p--;)Rr[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)b=u4(h,Rr[d[p]]),T=b[0],_=b[1],x=h0(h,Rr[d[++p%g]]),v=x[0],M=x[1],(Math.abs(T-v)>Cn||Math.abs(_-M)>Cn)&&(d.splice(p,0,Rr.push(ku(f,b,Math.abs(T-r)<Cn&&o-_>Cn?[r,Math.abs(v-r)<Cn?M:o]:Math.abs(_-o)<Cn&&e-T>Cn?[Math.abs(M-o)<Cn?v:e,o]:Math.abs(T-e)<Cn&&_-t>Cn?[e,Math.abs(v-e)<Cn?M:t]:Math.abs(_-t)<Cn&&T-r>Cn?[Math.abs(M-t)<Cn?v:r,t]:null))-1),++g);g&&(y=!1)}if(y){var A,S,L,G=1/0;for(l=0,y=null;l<a;++l)(h=pi[l])&&(f=h.site,A=f[0]-r,S=f[1]-t,L=A*A+S*S,L<G&&(G=L,y=h));if(y){var z=[r,t],F=[r,o],I=[e,o],ut=[e,t];y.halfedges.push(Rr.push(ku(f=y.site,z,F))-1,Rr.push(ku(f,F,I))-1,Rr.push(ku(f,I,ut))-1,Rr.push(ku(f,ut,z))-1)}}for(l=0;l<a;++l)(h=pi[l])&&(h.halfedges.length||delete pi[l])}var dT=[],Ph;function l4(){zu(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ma(r){var t=r.P,e=r.N;if(!(!t||!e)){var o=t.site,a=r.site,l=e.site;if(o!==l){var h=a[0],f=a[1],p=o[0]-h,d=o[1]-f,g=l[0]-h,x=l[1]-f,v=2*(p*x-d*g);if(!(v>=-mT)){var M=p*p+d*d,b=g*g+x*x,T=(x*M-d*b)/v,_=(p*b-g*M)/v,y=dT.pop()||new l4;y.arc=r,y.site=a,y.x=T+h,y.y=(y.cy=_+f)+Math.sqrt(T*T+_*_),r.circle=y;for(var A=null,S=qu._;S;)if(y.y<S.y||y.y===S.y&&y.x<=S.x)if(S.L)S=S.L;else{A=S.P;break}else if(S.R)S=S.R;else{A=S;break}qu.insert(A,y),A||(Ph=y)}}}}function Sa(r){var t=r.circle;t&&(t.P||(Ph=t.N),qu.remove(t),dT.push(t),zu(t),r.circle=null)}var yT=[];function c4(){zu(this),this.edge=this.site=this.circle=null}function gT(r){var t=yT.pop()||new c4;return t.site=r,t}function p0(r){Sa(r),wa.remove(r),yT.push(r),zu(r)}function vT(r){var t=r.circle,e=t.x,o=t.cy,a=[e,o],l=r.P,h=r.N,f=[r];p0(r);for(var p=l;p.circle&&Math.abs(e-p.circle.x)<Cn&&Math.abs(o-p.circle.cy)<Cn;)l=p.P,f.unshift(p),p0(p),p=l;f.unshift(p),Sa(p);for(var d=h;d.circle&&Math.abs(e-d.circle.x)<Cn&&Math.abs(o-d.circle.cy)<Cn;)h=d.N,f.push(d),p0(d),d=h;f.push(d),Sa(d);var g=f.length,x;for(x=1;x<g;++x)d=f[x],p=f[x-1],Kl(d.edge,p.site,d.site,a);p=f[0],d=f[g-1],d.edge=Gu(p.site,d.site,null,a),Ma(p),Ma(d)}function _T(r){for(var t=r[0],e=r[1],o,a,l,h,f=wa._;f;)if(l=xT(f,e)-t,l>Cn)f=f.L;else if(h=t-f4(f,e),h>Cn){if(!f.R){o=f;break}f=f.R}else{l>-Cn?(o=f.P,a=f):h>-Cn?(o=f,a=f.N):o=a=f;break}fT(r);var p=gT(r);if(wa.insert(o,p),!(!o&&!a)){if(o===a){Sa(o),a=gT(o.site),wa.insert(p,a),p.edge=a.edge=Gu(o.site,p.site),Ma(o),Ma(a);return}if(!a){p.edge=Gu(o.site,p.site);return}Sa(o),Sa(a);var d=o.site,g=d[0],x=d[1],v=r[0]-g,M=r[1]-x,b=a.site,T=b[0]-g,_=b[1]-x,y=2*(v*_-M*T),A=v*v+M*M,S=T*T+_*_,L=[(_*A-M*S)/y+g,(v*S-T*A)/y+x];Kl(a.edge,d,b,L),p.edge=Gu(d,r,null,L),a.edge=Gu(r,b,null,L),Ma(o),Ma(a)}}function xT(r,t){var e=r.site,o=e[0],a=e[1],l=a-t;if(!l)return o;var h=r.P;if(!h)return-1/0;e=h.site;var f=e[0],p=e[1],d=p-t;if(!d)return f;var g=f-o,x=1/l-1/d,v=g/d;return x?(-v+Math.sqrt(v*v-2*x*(g*g/(-2*d)-p+d/2+a-l/2)))/x+o:(o+f)/2}function f4(r,t){var e=r.N;if(e)return xT(e,t);var o=r.site;return o[1]===t?o[0]:1/0}var Cn=1e-6,mT=1e-12,wa,pi,qu,Rr;function h4(r,t,e){return(r[0]-e[0])*(t[1]-r[1])-(r[0]-t[0])*(e[1]-r[1])}function p4(r,t){return t[1]-r[1]||t[0]-r[0]}function Ih(r,t){var e=r.sort(p4).pop(),o,a,l;for(Rr=[],pi=new Array(r.length),wa=new f0,qu=new f0;;)if(l=Ph,e&&(!l||e[1]<l.y||e[1]===l.y&&e[0]<l.x))(e[0]!==o||e[1]!==a)&&(_T(e),o=e[0],a=e[1]),e=r.pop();else if(l)vT(l.arc);else break;if(hT(),t){var h=+t[0][0],f=+t[0][1],p=+t[1][0],d=+t[1][1];cT(h,f,p,d),pT(h,f,p,d)}this.edges=Rr,this.cells=pi,wa=qu=Rr=pi=null}Ih.prototype={constructor:Ih,polygons:function(){var r=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return h0(t,r[o])});return e.data=t.site.data,e})},triangles:function(){var r=[],t=this.edges;return this.cells.forEach(function(e,o){if(f=(l=e.halfedges).length)for(var a=e.site,l,h=-1,f,p,d=t[l[f-1]],g=d.left===a?d.right:d.left;++h<f;)p=g,d=t[l[h]],g=d.left===a?d.right:d.left,p&&g&&o<p.index&&o<g.index&&h4(a,p,g)<0&&r.push([a.data,p.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 o=this,a,l=o._found||0,h=o.cells.length,f;!(f=o.cells[l]);)if(++l>=h)return null;var p=r-f.site[0],d=t-f.site[1],g=p*p+d*d;do f=o.cells[a=l],l=null,f.halfedges.forEach(function(x){var v=o.edges[x],M=v.left;if(!((M===f.site||!M)&&!(M=v.right))){var b=r-M[0],T=t-M[1],_=b*b+T*T;_<g&&(g=_,l=M.index)}});while(l!==null);return o._found=a,e==null||g<=e*e?f.site:null}};var E4=yn(Vu(),1);var C0=yn(wT(),1);function Ei(){return new Nh}function Nh(){this.reset()}Nh.prototype={constructor:Nh,reset:function(){this.s=this.t=0},add:function(r){bT(Lh,r,this.t),bT(this,Lh.s,this.s),this.s?this.t+=Lh.t:this.s=Lh.t},valueOf:function(){return this.s}};var Lh=new Nh;function bT(r,t,e){var o=r.s=t+e,a=o-t,l=o-a;r.t=t-l+(e-a)}var mn=1e-6;var bn=Math.PI,dr=bn/2,Oh=bn/4,Lo=bn*2,ba=180/bn,Mi=bn/180,$n=Math.abs,mo=Math.atan,Si=Math.atan2,cn=Math.cos;var Dh=Math.exp;var jl=Math.log;var Ee=Math.sin;var qr=Math.sqrt,Ql=Math.tan;function g0(r){return r>1?0:r<-1?bn:Math.acos(r)}function di(r){return r>1?dr:r<-1?-dr:Math.asin(r)}function go(){}var M4=Ei(),fj=Ei();function Ta(r){var t=r[0],e=r[1],o=cn(e);return[o*cn(t),o*Ee(t),Ee(e)]}function tc(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 ec(r){var t=qr(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}var Ej=Ei();function AT(r,t){return[r>bn?r-Lo:r<-bn?r+Lo:r,t]}AT.invert=AT;function y0(){var r=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){r.push(t=[])},lineEnd:go,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function v0(r,t){return $n(r[0]-t[0])<mn&&$n(r[1]-t[1])<mn}function Fh(r,t,e,o){this.x=r,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function _0(r,t,e,o,a){var l=[],h=[],f,p;if(r.forEach(function(b){if(!((T=b.length-1)<=0)){var T,_=b[0],y=b[T],A;if(v0(_,y)){for(a.lineStart(),f=0;f<T;++f)a.point((_=b[f])[0],_[1]);a.lineEnd();return}l.push(A=new Fh(_,b,null,!0)),h.push(A.o=new Fh(_,null,A,!1)),l.push(A=new Fh(y,b,null,!1)),h.push(A.o=new Fh(y,null,A,!0))}}),!!l.length){for(h.sort(t),CT(l),CT(h),f=0,p=h.length;f<p;++f)h[f].e=e=!e;for(var d=l[0],g,x;;){for(var v=d,M=!0;v.v;)if((v=v.n)===d)return;g=v.z,a.lineStart();do{if(v.v=v.o.v=!0,v.e){if(M)for(f=0,p=g.length;f<p;++f)a.point((x=g[f])[0],x[1]);else o(v.x,v.n.x,1,a);v=v.n}else{if(M)for(g=v.p.z,f=g.length-1;f>=0;--f)a.point((x=g[f])[0],x[1]);else o(v.x,v.p.x,-1,a);v=v.p}v=v.o,g=v.z,M=!M}while(!v.v);a.lineEnd()}}}function CT(r){if(t=r.length){for(var t,e=0,o=r[0],a;++e<t;)o.n=a=r[e],a.p=o,o=a;o.n=a=r[0],a.p=o}}function zs(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function x0(r){return r.length===1&&(r=b4(r)),{left:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)<0?o=l+1:a=l}return o},right:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)>0?a=l:o=l+1}return o}}}function b4(r){return function(t,e){return zs(r(t),e)}}var PT=x0(zs),T4=PT.right,A4=PT.left;var IT=Array.prototype,P4=IT.slice,I4=IT.map;var pQ=Math.sqrt(50),dQ=Math.sqrt(10),mQ=Math.sqrt(2);function Bh(r){for(var t=r.length,e,o=-1,a=0,l,h;++o<t;)a+=r[o].length;for(l=new Array(a);--t>=0;)for(h=r[t],e=h.length;--e>=0;)l[--a]=h[e];return l}var B4=1e9,jtt=-B4;var E0=Ei();function M0(r,t){var e=t[0],o=t[1],a=[Ee(e),-cn(e),0],l=0,h=0;E0.reset();for(var f=0,p=r.length;f<p;++f)if(g=(d=r[f]).length)for(var d,g,x=d[g-1],v=x[0],M=x[1]/2+Oh,b=Ee(M),T=cn(M),_=0;_<g;++_,v=A,b=L,T=G,x=y){var y=d[_],A=y[0],S=y[1]/2+Oh,L=Ee(S),G=cn(S),z=A-v,F=z>=0?1:-1,I=F*z,ut=I>bn,R=b*L;if(E0.add(Si(R*F*Ee(I),T*G+R*cn(I))),l+=ut?z+F*Lo:z,ut^v>=e^A>=e){var W=tc(Ta(x),Ta(y));ec(W);var V=tc(a,W);ec(V);var Mt=(ut^z>=0?-1:1)*di(V[2]);(o>Mt||o===Mt&&(W[0]||W[1]))&&(h+=ut^z>=0?1:-1)}}return(l<-mn||l<mn&&E0<-mn)^h&1}var uet=Ei();var Pet=Ei(),Iet=Ei();var k4=1/0;var Net=-k4;function S0(r){this._context=r}S0.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,Lo);break}}},result:go};var Vet=Ei();function w0(){this._string=[]}w0.prototype={_radius:4.5,_circle:NT(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=NT(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 NT(r){return"m0,"+r+"a"+r+","+r+" 0 1,1 0,"+-2*r+"a"+r+","+r+" 0 1,1 0,"+2*r+"z"}function b0(r,t,e,o){return function(a,l){var h=t(l),f=a.invert(o[0],o[1]),p=y0(),d=t(p),g=!1,x,v,M,b={point:T,lineStart:y,lineEnd:A,polygonStart:function(){b.point=S,b.lineStart=L,b.lineEnd=G,v=[],x=[]},polygonEnd:function(){b.point=T,b.lineStart=y,b.lineEnd=A,v=Bh(v);var z=M0(x,f);v.length?(g||(l.polygonStart(),g=!0),_0(v,H4,z,e,l)):z&&(g||(l.polygonStart(),g=!0),l.lineStart(),e(null,null,1,l),l.lineEnd()),g&&(l.polygonEnd(),g=!1),v=x=null},sphere:function(){l.polygonStart(),l.lineStart(),e(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function T(z,F){var I=a(z,F);r(z=I[0],F=I[1])&&l.point(z,F)}function _(z,F){var I=a(z,F);h.point(I[0],I[1])}function y(){b.point=_,h.lineStart()}function A(){b.point=T,h.lineEnd()}function S(z,F){M.push([z,F]);var I=a(z,F);d.point(I[0],I[1])}function L(){d.lineStart(),M=[]}function G(){S(M[0][0],M[0][1]),d.lineEnd();var z=d.clean(),F=p.result(),I,ut=F.length,R,W,V;if(M.pop(),x.push(M),M=null,!!ut){if(z&1){if(W=F[0],(R=W.length-1)>0){for(g||(l.polygonStart(),g=!0),l.lineStart(),I=0;I<R;++I)l.point((V=W[I])[0],V[1]);l.lineEnd()}return}ut>1&&z&2&&F.push(F.pop().concat(F.shift())),v.push(F.filter(V4))}}return b}}function V4(r){return r.length>1}function H4(r,t){return((r=r.x)[0]<0?r[1]-dr-mn:dr-r[1])-((t=t.x)[0]<0?t[1]-dr-mn:dr-t[1])}var W4=b0(function(){return!0},X4,$4,[-bn,-dr]);function X4(r){var t=NaN,e=NaN,o=NaN,a;return{lineStart:function(){r.lineStart(),a=1},point:function(l,h){var f=l>0?bn:-bn,p=$n(l-t);$n(p-bn)<mn?(r.point(t,e=(e+h)/2>0?dr:-dr),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(f,e),r.point(l,e),a=0):o!==f&&p>=bn&&($n(t-o)<mn&&(t-=o*mn),$n(l-f)<mn&&(l-=f*mn),e=Y4(t,e,l,h),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(f,e),a=0),r.point(t=l,e=h),o=f},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-a}}}function Y4(r,t,e,o){var a,l,h=Ee(r-e);return $n(h)>mn?mo((Ee(t)*(l=cn(o))*Ee(e)-Ee(o)*(a=cn(t))*Ee(r))/(a*l*h)):(t+o)/2}function $4(r,t,e,o){var a;if(r==null)a=e*dr,o.point(-bn,a),o.point(0,a),o.point(bn,a),o.point(bn,0),o.point(bn,-a),o.point(0,-a),o.point(-bn,-a),o.point(-bn,0),o.point(-bn,a);else if($n(r[0]-t[0])>mn){var l=r[0]<t[0]?bn:-bn;a=e*l/2,o.point(-l,a),o.point(0,a),o.point(l,a)}else o.point(t[0],t[1])}function zh(r){return function(t){var e=new T0;for(var o in r)e[o]=r[o];return e.stream=t,e}}function T0(){}T0.prototype={constructor:T0,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 Int=cn(30*Mi);var Hnt=zh({point:function(r,t){this.stream.point(r*Mi,t*Mi)}});function Gh(r){return function(t,e){var o=cn(t),a=cn(e),l=r(o*a);return[l*a*Ee(t),l*Ee(e)]}}function No(r){return function(t,e){var o=qr(t*t+e*e),a=r(o),l=Ee(a),h=cn(a);return[Si(t*l,o*h),di(o&&e*l/o)]}}var GT=Gh(function(r){return qr(2/(1+r))});GT.invert=No(function(r){return 2*di(r/2)});var kT=Gh(function(r){return(r=g0(r))&&r/Ee(r)});kT.invert=No(function(r){return r});function A0(r,t){return[r,jl(Ql((dr+t)/2))]}A0.invert=function(r,t){return[r,2*mo(Dh(t))-dr]};function kh(r,t){return[r,t]}kh.invert=kh;function qT(r,t){var e=cn(t),o=cn(r)*e;return[e*Ee(r)/o,Ee(t)/o]}qT.invert=No(mo);function VT(r,t){var e=t*t,o=e*e;return[r*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}VT.invert=function(r,t){var e=t,o=25,a;do{var l=e*e,h=l*l;e-=a=(e*(1.007226+l*(.015085+h*(-.044475+.028874*l-.005916*h)))-t)/(1.007226+l*(.015085*3+h*(-.044475*7+.028874*9*l-.005916*11*h)))}while($n(a)>mn&&--o>0);return[r/(.8707+(l=e*e)*(-.131979+l*(-.013791+l*l*l*(.003971-.001529*l)))),e]};function HT(r,t){return[cn(t)*Ee(r),Ee(t)]}HT.invert=No(di);function WT(r,t){var e=cn(t),o=1+cn(r)*e;return[e*Ee(r)/o,Ee(t)/o]}WT.invert=No(function(r){return 2*mo(r)});function XT(r,t){return[jl(Ql((dr+t)/2)),-r]}XT.invert=function(r,t){return[-t,2*mo(Dh(r))-dr]};var t5=yn(Vu(),1);var e5=yn(Vu(),1);var r5=yn(Vu(),1);var i5=yn(Vu(),1);function ks(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}function P0(r){let t=0;for(let e=0;e<r.length-1;e++)t+=ks(r[e],r[e+1]);return t}function $T(r,t,e){let o=new un(t[0]-r[0],t[1]-r[1]),a=new un(t[0]-e[0],t[1]-e[1]),h=o.angleTo(a)*180/Math.PI,f=new un(t[0]-r[0],t[1]-r[1]);return new un(e[0]-r[0],e[1]-r[1]).cross(f)>0?h:-h}var Hi="___",qh=class{initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(o=>{let a=""+e.floor+Hi+o.id;if(this.pointMap.set(a,o),this.nodeMap.set(""+o.floor+Hi+o.nodeId,a),o.type==="straightLadder"){let l=this.straightLadderMap.get(o.name)||[];l.push(Ga({},o)),this.straightLadderMap.set(o.name,l)}if(o.type==="staircase"){let l=this.staircaseMap.get(o.name)||[];l.push(Ga({},o)),this.staircaseMap.set(o.name,l)}if(o.type==="escalator"){let l=this.escalatorMap.get(o.name)||{};o.escalatorDirection==="exit"?l.end={floor:o.floor,id:o.id}:l.start={floor:o.floor,id:o.id},this.escalatorMap.set(o.name,l)}if(o.type==="facility"){let l=this.facilityMap.get(o.targetId)||[];l.push(Ga({},o)),this.facilityMap.set(o.targetId,l)}}),e.lines.filter(o=>o.direction!=="no").forEach(o=>{var a,l;let h=""+e.floor+Hi+o.from,f=""+e.floor+Hi+o.to,p=(a=this.pointMap.get(h))==null?void 0:a.cds,d=(l=this.pointMap.get(f))==null?void 0:l.cds;if(p!=null&&p.length&&(d!=null&&d.length)){let g=ks(p,d);this.addLineItem(h,f,g),o.direction==="double"&&this.addLineItem(f,h,g)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(t,e,o,a){a===void 0&&(a=this.lineMap);let l=a.get(t)||new Map;l.set(e,o),a.set(t,l)}addFacilityToLineMap(t,e,o,a){[...this.straightLadderMap,...this.staircaseMap].forEach(l=>{let[h,f]=l;if(!(f.length<2))for(let g=0;g<f.length;g++){let x=""+f[g].floor+Hi+f[g].id;for(let v=0;v<f.length;v++)if(g!==v){var p,d;let M=""+f[v].floor+Hi+f[v].id,b=(p=this.pointMap.get(x))==null?void 0:p.cds,T=(d=this.pointMap.get(M))==null?void 0:d.cds;if(b!=null&&b.length&&(T!=null&&T.length))if(f[g].type==="straightLadder"){let _=e;this.addLineItem(x,M,_,a)}else{let _=o;this.addLineItem(x,M,_,a)}}}}),this.escalatorMap.forEach((l,h)=>{if(l.start&&l.end){var f,p;let d=""+l.start.floor+Hi+l.start.id,g=""+l.end.floor+Hi+l.end.id,x=(f=this.pointMap.get(d))==null?void 0:f.cds,v=(p=this.pointMap.get(g))==null?void 0:p.cds;if(x!=null&&x.length&&(v!=null&&v.length)){let M=t;this.addLineItem(d,g,M,a)}}})}initBaseRoute(){let t=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,t),this.baseRoute=new Oo.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 Oo.default(t)}initStraightLadderRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new Oo.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 o=this.nodeMap.get(""+t.floor+Hi+t.nodeId);if(o){let[a,l]=o.split(Hi);return{floor:a,id:l}}}if((e=t.coord)!=null&&e.length){let o=this.roadInfo.find(l=>l.floor===t.floor);if(!o)return null;let a=o.points.reduce((l,h)=>{let f=ks(t.coord,h.cds);return f<l.min&&(l.min=f,l.point=h),l},{min:1/0,point:o.points[0]});return{floor:a.point.floor,id:a.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,o){if(o===void 0&&(o=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let a=this.transformStart(t);if(!a)return"no-start";let l=this.transformEnd(e);if(!l)return"no-end";let h=this.getBasePath.bind(this);switch(o){case"escalator":h=this.getEscalatorPath.bind(this);break;case"straightLadder":h=this.getStraightLadderPath.bind(this);break;default:h=this.getBasePath.bind(this);break}if(l.id)return h(a,l);if(l.facility){let f=this.facilityMap.get(l.facility).filter(d=>l.floor?d.floor===l.floor:!0);if(!f.length)return null;let p=f.map(d=>h(a,{floor:d.floor,id:d.id})).filter(d=>!!d);return p.reduce((d,g)=>{let x=g.reduce((v,M)=>v+P0(M.points),0);return x<d.distance&&(d.distance=x,d.path=g),d},{distance:1/0,path:p[0]}).path}}getRoutePath(t,e,o){let a=""+t.floor+Hi+t.id,l=""+e.floor+Hi+e.id,h=o.path(a,l);if(!h)return null;let f=[];return h.map(p=>{let d=this.pointMap.get(p);if(d){var g;let{floor:x}=d;if(((g=f[f.length-1])==null?void 0:g.floor)===x){let v=f[f.length-1];v.points.push(d.cds),v.endType=d.type,v.destId=d.nodeId,v.distance=P0(v.points)}else f.push({floor:x,points:[d.cds],endType:d.type,destId:d.nodeId,distance:0})}}),f}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 Oo.default,this.escalatorRoute=new Oo.default,this.straightLadderRoute=new Oo.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 Oo.default,this.escalatorRoute=new Oo.default,this.straightLadderRoute=new Oo.default}};var rlt=yn(Bc(),1),ilt=yn(zp(),1);var p5=yn(QT(),1);function d5(r,t,e){let o=$T(r,t,e);return 180-Math.abs(o)<15?"front":o>135?"right_front":o<-135?"left_front":o<=135&&o>=60?"right":o>=-135&&o<=-60?"left":o<60&&o>0?"right_back":o>-60&&o<0?"left_back":"front"}function tA(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let t=[{direction:"start",distance:ks(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let o=d5(r[e-2],r[e-1],r[e]);if(o==="front"){let a=t[t.length-1],l=ks(r[e-1],r[e]);a.distance+=l,e!==2&&a.points.push(r[e-1])}else t.push({direction:o,distance:ks(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}var mlt=yn(AA(),1),glt=yn(Hc(),1);function CA(r){return r.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function PA(r){let t={};for(let o in r)o.startsWith("on")&&(t[CA(o.slice(2))]=r[o]);let e=o=>uc(this,null,function*(){let{data:a}=o;if(t[a.type])try{let l=yield t[a.type](a.data);if(l!=null&&l.$transfer&&Array.isArray(l.$transfer)){let h=l.$transfer;delete l.$transfer,self.postMessage({type:""+a.type+"_result",key:a.key,data:l},h)}else self.postMessage({type:""+a.type+"_result",key:a.key,data:l})}catch(l){self.postMessage({type:""+a.type+"_result",key:a.key,error:l})}else self.postMessage({type:""+a.type+"_result",key:a.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var U0=new qh;PA({onSetRoadInfo(r){let{roadData:t}=r;U0.initRoute(t)},onGetPath(r){let{start:t,end:e,type:o}=r;return U0.getPath(t,e,o)},onGetDirectionPath(r){return tA(r)},onClear(){U0.clear()}});
|
|
11549
|
-
`],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var Oh=class extends wT.EventDispatcher{setRoadData(t){return A(this,null,function*(){this.initRoadStatus=!1,this.dispatchEvent({type:"init-road-status",status:!1}),yield ct(this.worker,"set_road_info",{roadData:t}),this.initRoadStatus=!0,this.dispatchEvent({type:"init-road-status",status:!0})})}getPath(t,e,n){return A(this,null,function*(){return n===void 0&&(n=""),new Promise((i,o)=>{let s=()=>{ct(this.worker,"get_path",{start:t,end:e,type:n}).then(a=>{a?typeof a=="string"?o(a):i(a):o("no-path")})};if(this.initRoadStatus)s();else{let a=u=>{let{status:l}=u;l&&(this.removeEventListener("init-road-status",a),s())};this.addEventListener("init-road-status",a)}})})}getDirectionPath(t){return ct(this.worker,"get_direction_path",t)}dispose(){return A(this,null,function*(){ct(this.worker,"clear",""),this.worker.terminate()})}constructor(){super(),this.worker=Zh(),this.initRoadStatus=!1}};var DH=d(I(),1),CH=d(Ze(),1),XH=d(Oe(),1),ZH=d(Re(),1),OH=d(Fe(),1),RH=d(Ke(),1),FH=d(Ne(),1),KH=d(ze(),1),NH=d(F(),1);var _T=T("three"),eu=class extends qt{setEnable(t){super.setEnable(t),St(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:n,clientHeight:i}}}=this,o=E(this.startPoint,e,n,i),s=E(this.endPoint,e,n,i),a={x:Math.min(o.x,s.x),y:Math.min(o.y,s.y)},u={x:Math.max(o.x,s.x),y:Math.max(o.y,s.y)},l=this.searchMapInFrustum(a,u);this.dispatchEvent({type:"selected",list:l})}}searchMapInFrustum(t,e){var n;let{context:i}=this;return((n=i.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof at&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:i,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let f=E(p,i,o,s);return rn(f,e,n)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let a=t.mesh.geometry.boundingBox;if(!a)return!1;let{min:u,max:l}=a,c=E(u,i,o,s),h=E(l,i,o,s);return!(!rn(c,e,n)||!rn(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new _T.Frustum,this.onPointerDown=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=i=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o)},this.onPointerUp=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let i=this.getSvgCoordinate(this.startPoint),o=v({},i);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(i.x,o.x),y:Math.min(i.y,o.y)},a=Math.abs(o.x-i.x),u=Math.abs(o.y-i.y);St(this.rect,s.x,s.y,a,u)}else St(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=on(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var $O={boxSelection:!1,elements:["graphic","poi"]},Rh=class extends Kt{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.options.boxSelection||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.bmap.context.control.enablePan,this.prevRotateStatus=this.bmap.context.control.enableRotate,this.bmap.context.control.enablePan=!1,this.bmap.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.bmap.context.control.enablePan=!!this.prevPanStatus,this.bmap.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],pois:[...this._poiList],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.bmap.context.container.addEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.addEventListener("pointerup",this.onPointerUp),this.bmap.context.container.addEventListener("pointerout",this.onPointerOut),this.bmap.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.bmap.context.container.removeEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.removeEventListener("pointerup",this.onPointerUp),this.bmap.context.container.removeEventListener("pointerout",this.onPointerOut),this.bmap.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent(),super.dispose()}constructor(t,e={}){super(t),this._list=new Set,this._poiList=new Set,this.downPoint=null,this.isMultipleSelect=!1,this.onPointerDown=n=>{this.downPoint={x:n.offsetX,y:n.offsetY}},this.onPointerUp=n=>{if(!this.downPoint)return;let{offsetX:i,offsetY:o}=n,{x:s,y:a}=this.downPoint;if(Math.sqrt((s-i)**2+(a-o)**2)>3)return;let u=new Set,l=[],c=[];if(this.options.elements.includes("graphic")){let{graphics:h}=this.bmap.context.getGraphicsByDeviceXy(i,o);h.map(p=>u.add(p.options.id)),l.push(...h)}if(this.options.elements.includes("poi")){let h=this.bmap.context.getPoisByDeviceXy(i,o);c.push(...h),h.forEach(p=>{if(!u.has(p.options.id)){var f;let g=((f=this.bmap.context.currentFloor)==null?void 0:f.graphicLayer.graphicMap.get(p.options.id))||null;g&&(u.add(p.options.id),l.push(g))}})}(!this.options.boxSelection||!(Bn?n.metaKey:n.ctrlKey))&&(this._list.clear(),this._poiList.clear()),l.forEach(h=>this._list.add(h)),c.forEach(h=>this._poiList.add(h)),this.selectEnd(),this.downPoint=null},this.onPointerOut=n=>{this.disableBoxSelection()},this.onKeyDown=n=>{Hn(n.key)&&this.enableBoxSelection()},this.onKeyUp=n=>{Hn(n.key)&&this.disableBoxSelection()},this.onBoxSelected=n=>{let{list:i}=n;this._list.clear(),this._poiList.clear(),i.forEach(o=>{if(this.options.elements.includes("graphic")&&this._list.add(o),this.options.elements.includes("poi")){let s=this.bmap.getPoiById(o.options.id);s&&this._poiList.add(s)}}),this.selectEnd()},this.options=v({},$O,e),this.boxSelection=new eu(this.bmap.context),this.boxSelection.setEnable(!1),this.registryEvent()}};var JH=d(F(),1),zt=T("lodash");var Q=function(r){return r.COMPASS="compass",r.DEVICE_MOTION="deviceMotion",r.ACCELERATION="acceleration",r.GPS="gps",r}({});var tR={time:1e3,elements:[Q.COMPASS,Q.DEVICE_MOTION,Q.ACCELERATION,Q.GPS]},Ko=class extends Bt{start(){this.options.elements.some(t=>[Q.DEVICE_MOTION,Q.COMPASS].includes(t))&&this.listenDeviceOrientation(),this.options.elements.includes(Q.ACCELERATION)&&this.listenAcceleration(),this.options.elements.includes(Q.GPS)&&this.listenGps(),this.dispatchEvent({type:"start"}),this.dispatchTimer=this.timer.setInterval(()=>{this.dispatchEvent({type:"sensor-data",data:(0,zt.cloneDeep)(this.data)}),this.data=[]},this.options.time)}addDataItem(t){this.data.push(t),this.dispatchEvent({type:"add-data-item",item:t})}listenDeviceOrientation(){Sn?window.addEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.addEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0})}listenAcceleration(){window.addEventListener("devicemotion",this.handleAcceleration,!1)}listenGps(){this.gpsTimer=navigator.geolocation.watchPosition(t=>{console.log("watch gps",t.coords),this.addDataItem({type:Q.GPS,timestamp:Date.now(),res:[t.coords.longitude,t.coords.latitude,t.coords.accuracy]})},t=>{console.log("\u83B7\u53D6gps\u5931\u8D25",t)},{enableHighAccuracy:!0})}checkSensor(){return A(this,null,function*(){return{deviceOrientation:yield this.checkDeviceOrientation()}})}checkDeviceOrientation(){return A(this,null,function*(){var t;if(!Sn)return!0;if(typeof window.DeviceOrientationEvent!="undefined"&&typeof((t=window.DeviceOrientationEvent)==null?void 0:t.requestPermission)=="function")try{var e;return(yield(e=window.DeviceOrientationEvent)==null?void 0:e.requestPermission())==="granted"}catch(n){return!1}return!1})}stop(){window.removeEventListener("devicemotion",this.handleAcceleration,!1),Sn?window.removeEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.removeEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0}),(0,zt.isNil)(this.gpsTimer)||navigator.geolocation.clearWatch(this.gpsTimer),this.dispatchTimer&&this.timer.clearInterval(this.dispatchTimer),this.data=[],this.dispatchEvent({type:"stop"})}constructor(t={}){super(),this.gpsTimer=null,this.data=[],this.timer=new J,this.dispatchTimer=null,this.addAcceleration=(0,zt.throttle)(e=>{this.addDataItem(e)},20),this.deviceOrientationAbsHandler=(0,zt.throttle)(e=>{let n=Date.now(),{alpha:i,beta:o,gamma:s}=e;if((0,zt.isNil)(i)||(0,zt.isNil)(o)||(0,zt.isNil)(s))return;let a;Sn?a=e.webkitCompassHeading:a=360-i,this.options.elements.includes(Q.DEVICE_MOTION)&&this.addDataItem({type:Q.DEVICE_MOTION,timestamp:n,res:[i,o,s]}),this.options.elements.includes(Q.COMPASS)&&this.addDataItem({type:Q.COMPASS,timestamp:n,res:a})},200),this.handleAcceleration=e=>{let n=e.accelerationIncludingGravity;(0,zt.isNil)(n)||(0,zt.isNil)(n.x)||(0,zt.isNil)(n.y)||(0,zt.isNil)(n.z)||this.addAcceleration({type:Q.ACCELERATION,timestamp:Date.now(),res:[n.x,n.y,n.z]})},this.options=v({},tR,t)}};var d5=d(I(),1);var u5=d(F(),1);var t5=d(F(),1),e5=d(I(),1);function nu(r,t){return 1/Math.sqrt(2*Math.PI*Math.pow(t,2))*Math.exp(-Math.pow(r,2)/(2*Math.pow(t,2)))}function No(r){return(r+360)%360}function xT(r,t){let n=6378137*r*Math.PI/180,i=6378137*Math.log(Math.tan(Math.PI/4+t*Math.PI/180/2));return{x:n,y:i}}function ri(r,t,e,n){return Math.sqrt(Math.pow(Math.abs(r-e),2)+Math.pow(Math.abs(t-n),2))}var iu=T("mathjs"),ru=class{motionModelRotYaw(t){if(!(Math.abs(t)<.001)){this.last_yaw_compass=No(this.last_yaw_compass+t);for(let e=0;e<this.NumParticle;e++){let n=Math.random()*this.yaw_noise_sigma;this.particleX[2][e]=this.particleX[2][e]+t+n,this.particleX[2][e]=No(this.particleX[2][e])}}}motionModelStepLength(t,e){if(t===0)return;for(let i=0;i<this.NumParticle;i++){let o=Math.random()*this.step_noise_sigma;this.particleX[0][i]+=(.65+o)*Math.sin(-this.particleX[2][i]/180*Math.PI),this.particleX[1][i]+=(.65+o)*Math.cos(this.particleX[2][i]/180*Math.PI),e(this.particleX[0][i],this.particleX[1][i])||(this.particleWeight[0][i]*=this.unaccess_weight)}let n=this.particleWeight[0].reduce((i,o)=>i+o,0);this.particleWeight[0]=this.particleWeight[0].map(i=>i/n)}motionModelCompassYaw(t,e){if(e-this.last_compass_time>this.compass_update_interval){let n=360-t;n+=this.delta_yaw,n=No(n),Math.abs(n-this.last_yaw_compass)>60?this.compass_consecutive_offset_count++:this.compass_consecutive_offset_count=0;for(let o=0;o<this.NumParticle;o++){let s=Math.abs(this.particleX[2][o]-n);s>180&&(s=360-s),this.particleWeight[0][o]*=nu(s,this.sigmaCompass)}let i=this.particleWeight[0].reduce((o,s)=>o+s,0);this.particleWeight[0]=this.particleWeight[0].map(o=>o/i),this.setLastCompassTime(e)}}resampling(){if(1/this.particleWeight[0].reduce((e,n)=>e+n*n,0)<this.reSampNumParticle){let e=this.particleWeight[0].reduce((a,u,l)=>a.concat(a[l]+u),[0]),i=this.particleWeight[0].map(()=>1/this.NumParticle).map((a,u)=>a+Math.random()/this.NumParticle),o=[],s=0;for(let a=0;a<this.NumParticle;a++){for(;i[a]>e[s];)s++;o.push(s)}this.particleX=this.particleX.map((a,u)=>o.map(l=>a[l])),this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle)}}update(t,e){for(let i=0;i<this.NumParticle;i++){let o=ri(this.particleX[0][i],this.particleX[1][i],t.x,t.y);this.particleWeight[0][i]=Math.max(1e-7,this.particleWeight[0][i]*nu(o,e))}let n=this.particleWeight[0].reduce((i,o)=>i+o,0);this.particleWeight[0]=this.particleWeight[0].map(i=>i/n)}updateCar(t,e){let n=t.x-this.xEst[0][0],i=t.y-this.xEst[1][0];for(let s=0;s<this.NumParticle;s++){let a=ri(this.particleX[0][s],this.particleX[1][s],t.x,t.y);this.particleWeight[0][s]=Math.max(1e-7,this.particleWeight[0][s]*nu(a,e)),this.particleX[0][s]+=n,this.particleX[1][s]+=i}let o=this.particleWeight[0].reduce((s,a)=>s+a,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/o)}getPosInitFlag(){return this.particle_PosInitFlag}getYawInitFlag(){return this.particle_yawInitFlag}setPosInitFlag(t){this.particle_PosInitFlag=t}setYawInitFlag(t){this.particle_yawInitFlag=t}getResultX(){let t=(0,iu.reshape)(this.particleWeight,[this.NumParticle,1]),e=(0,iu.multiply)(this.particleX,t);return this.xEst=e,this.xEst[0][0]}getResultY(){return this.xEst[1][0]}getResultYaw(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0]));return this.particleX[2][t]}getEstConfidence(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0])),e=this.particleWeight[0].indexOf(Math.min(...this.particleWeight[0])),n=[this.particleX[0][t],this.particleX[1][t]],i=[this.particleX[0][e],this.particleX[1][e]],o=ri(n[0],n[1],i[0],i[1]),s=o*.67;return console.log(o,s),s}getParticleNum(){return this.NumParticle}getParticleX(){return this.particleX}setLastCompassTime(t){this.last_compass_time=t}getLastCompassTime(){return this.last_compass_time}initParticlesByPos(t,e,n){if(!this.particle_PosInitFlag){this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle);let i=0;for(;i<this.NumParticle;){let s=(2*Math.random()-1)*this.initial_xy_uncertainty,a=(2*Math.random()-1)*this.initial_xy_uncertainty;n(t+s,e+a)||(this.particleWeight[0][i]*=this.unaccess_weight),this.particleX[0][i]=t+s,this.particleX[1][i]=e+a,i++}let o=this.particleWeight[0].reduce((s,a)=>s+a,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/o),this.particle_PosInitFlag=!0,this.xEst[0][0]=t,this.xEst[1][0]=e,this.xEst[2][0]=0}}initParticlesByCompass(t){console.log("Init compass: "+t);let e=360-t;e+=this.delta_yaw,e=No(e),console.log("Init Yaw: "+e);for(let n=0;n<this.NumParticle;n++){let i=(2*Math.random()-1)*this.initial_yaw_uncertainty;this.particleX[2][n]=e+i}this.particle_yawInitFlag=!0,this.xEst[2][0]=e,this.last_yaw_compass=e,this.compass_consecutive_offset_count=0}constructor(t){this.last_yaw_compass=0,this.compass_consecutive_offset_count=0,this.NumParticle=t.NumParticle,this.reSampNumParticle=t.reSampNumParticle,this.initial_xy_uncertainty=t.initial_xy_uncertainty,this.initial_yaw_uncertainty=t.initial_yaw_uncertainty,this.step_noise_sigma=t.step_noise_sigma,this.yaw_noise_sigma=t.yaw_noise_sigma,this.compass_update_interval=t.compass_update_interval,this.sigmaCompass=t.sigmaCompass,this.delta_yaw=t.delta_yaw,this.sigmaBeacon=t.sigmaBeacon,this.unaccess_weight=t.unaccess_weight,this.particle_PosInitFlag=!1,this.particle_yawInitFlag=!1,this.xEst=[[0],[0],[0]],this.particleX=Array.from({length:3},()=>Array(this.NumParticle).fill(0)),this.particleWeight=Array.from({length:1},()=>Array(this.NumParticle).fill(1/this.NumParticle)),this.last_compass_time=0}};var i5=d(F(),1),o5=d(I(),1),ou=class{init(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10+.5,this.max_valley=10-.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.65,this.last_rot=[0,0,0],this.delta_rot=[0,0,0],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0}reset(){this.init()}setInitPose(t){t===void 0&&(t=[0,0]),this.last_px=t[0],this.last_py=t[1],console.info("pdr init pos: "+this.last_px+", "+this.last_py)}setInitYaw(t){t===void 0&&(t=0),this.last_yaw=t}getPos(t,e,n){let i=0;return n.length===3&&(this.delta_yaw=this.getDeltaYawFromRot(t,n)),e.length===3&&(i=this.getStepLength(t,e)),i!==0&&(this.last_px+=this.delta_px,this.last_py+=this.delta_py),[this.last_px,this.last_py]}getDeltaPose(){return[this.delta_px,this.delta_py]}getStepLength(t,e){if(e.length<3)return console.warn("acc data less than 3"),0;let n=!1,i=Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2));if(this.accH_fifo.push(i),this.accH_time_fifo.push(t),this.imuFreUpdate(),this.accH_fifo.length<this.accH_fifo_len+1)n=!1;else{for(;this.accH_fifo.length>=this.accH_fifo_len+1;)this.accH_fifo.shift(),this.accH_time_fifo.shift();let o=this.PVStepDetec(),s=this.FFTStepDetec(),a=this.recheckState(),u=this.accH_time_fifo[Math.floor(this.accH_time_fifo.length*3/4)];Math.abs(this.abnor_start_time)<.001&&this.abnor_fft_detected?this.abnor_start_time=u:this.abnor_fft_detected||(this.abnor_start_time=0),o&&s&&a?(this.step_count+=1,this.last_step_time=u,n=!0):Math.abs(this.abnor_start_time)>.001&&this.abnor_peak_time-this.abnor_start_time>this.abnor_time_threshold&&this.step_count>1&&this.abnor_peak_time-this.last_step_time>1?(this.step_count+=1,this.last_step_time=u,n=!0):(u-this.last_step_time>2&&(this.state_count=0),n=!1)}if(n){let o=this.last_yaw/180*Math.PI;return this.delta_px=this.const_step_length*Math.cos(o),this.delta_py=this.const_step_length*Math.sin(o),this.const_step_length}else return 0}imuFreUpdate(){if(this.accH_time_fifo.length>2&&(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]<0||this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]>10||this.accH_time_fifo[this.accH_time_fifo.length-1]===this.accH_time_fifo[0])&&(console.warn("pdr reset last one time "+this.accH_time_fifo[this.accH_time_fifo.length-1]+" last two time "+this.accH_time_fifo[this.accH_time_fifo.length-2]),this.reset()),this.accH_fifo.length>9||this.fre<15){let t=(this.accH_fifo.length-1)/(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[0]);Math.abs(this.fre-t)>8&&(this.fre=Math.round((t-3)/10)*10,(this.fre<=10||this.fre>=100)&&(console.warn("Frequency Error "+this.fre),this.fre=100),console.debug("Frequency change to "+this.fre),this.accH_fifo_len=Math.floor(1*this.fre)+1)}}recheckState(){return!0}PVStepDetec(){let t=!1,e=this.accH_fifo.slice(Math.floor(this.accH_fifo_len/2)),n=this.accH_time_fifo.slice(Math.floor(this.accH_fifo_len/2)),i=e[Math.floor(e.length/2)],o=n[Math.floor(n.length/2)],s=Math.max(...e),a=Math.min(...e),u=!1,l=!1;return Math.abs(i-a)<.01&&i<this.max_valley&&this.valley_num<=this.peak_num&&(this.last_valley_time===0?l=!0:l=o-this.last_valley_time>this.min_step_time,l&&(this.last_valley_time=o,this.valley_num+=1)),Math.abs(i-s)<.01&&i>this.min_peak&&this.peak_num<=this.valley_num&&(this.last_peak_time===0?u=!0:u=o-this.last_peak_time>this.min_step_time,u&&(this.last_peak_time=o,this.peak_num+=1)),i===s&&i>this.min_peak&&(this.abnor_peak_time=o,this.abnor_peak_accH=i),this.peak_num===this.valley_num&&(u||l)&&(t=!0),t}FFTStepDetec(){return!0}getDeltaYawFromRot(t,e){if(e.length<3)return console.warn("rot data less than 3"),0;let n=[0,0,0];this.last_rot.length===3&&(n=e.map((a,u)=>a-this.last_rot[u]));for(let a=0;a<e.length;a++)n[a]<-180?n[a]+=360:n[a]>180&&(n[a]-=360);let i=.2;this.delta_rot.length===3?this.delta_rot=this.delta_rot.map((a,u)=>i*a+(1-i)*n[u]):this.delta_rot=n,this.last_rot=e,this.delta_yaw=this.delta_rot[0],this.last_yaw+=this.delta_yaw,this.last_yaw=this.limitYaw(this.last_yaw);let o=this.delta_rot.reduce((a,u)=>a+Math.abs(u),0);this.delta_rot_sum_fifo.push(o),this.delta_rot_sum_time_fifo.push(t),Math.abs(this.delta_rot_sum_time_fifo[this.delta_rot_sum_time_fifo.length-1]-this.delta_rot_sum_time_fifo[0])>1&&(this.delta_rot_sum_fifo.shift(),this.delta_rot_sum_time_fifo.shift()),this.delta_yaw_accum+=this.delta_yaw;let s=0;return Math.abs(this.delta_yaw_accum_timestamp-t)>this.delta_yaw_time_threshold?(s=this.delta_yaw_accum,this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=t,s):null}limitYaw(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}constructor(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10.5,this.max_valley=9.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_time_threshold=4,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.85,this.last_rot=[],this.delta_rot=[],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0}};var eR={using_gps:!0,gps_max_horizontalAccuracy:20},su=class{pfFusionPDRiBeacon(t){let{type:e,timestamp:n,res:i}=t,o=!1;if(this.cacheSensorData.push(t),this.particleFilter.getPosInitFlag()&&this.particleFilter.getYawInitFlag()){if(e===Q.ACCELERATION){let s=i,a=this.pdr.getStepLength(n/1e3,s);a!==0&&(this.particleFilter.motionModelStepLength(a,()=>!0),this.particleFilter.resampling(),this.position_count+=1,o=!0)}if(this.using_gps&&e===Q.GPS&&(this.last_beacon_time===null||n-this.last_beacon_time>5e3)){let s=this.getGpsPosition(i);o=s!==null,s&&(this.particleFilter.update(s,this.gps_horizontalAccuracy),this.resetParticleFilterDist(s,"gps",i[2]),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0)}if(e===Q.DEVICE_MOTION){let s=this.pdr.getDeltaYawFromRot(n/1e3,i);s!==null&&this.particleFilter.motionModelRotYaw(s)}e===Q.COMPASS&&this.particleFilter.motionModelCompassYaw(i,n),this.last_pos_time&&n-this.last_pos_time>500&&(this.position_count+=1,o=!0)}else if(!this.particleFilter.getPosInitFlag()&&this.using_gps&&e===Q.GPS){if(this.startTime&&Date.now()-this.startTime>3e3){let s=this.getGpsPosition(i);o=s!==null,console.log("gps_pos",s,i),s?(this.particleFilter.initParticlesByPos(s.x,s.y,()=>!0),this.last_pos_time=n,console.log("init Pos by gps success time "+n),this.cacheSensorData.length=0):console.log("init Pos by gps fail time "+n)}}else if(!this.particleFilter.getYawInitFlag()&&e===Q.COMPASS){let s=i;this.particleFilter.initParticlesByCompass(s),this.particleFilter.setLastCompassTime(n),console.log("init yaw by compass success time "+n)}return o&&(this.last_pos_time=n),[o,this.particleFilter.getResultX(),this.particleFilter.getResultY()]}setBeaconPosition(t,e){if(this.last_beacon_time=e,this.particleFilter.getPosInitFlag())this.particleFilter.update(t,this.sigmaBeacon);else{this.particleFilter.initParticlesByPos(t.x,t.y,()=>!0);let n=this.cacheSensorData.filter(i=>i.timestamp>e);console.log("\u521D\u59CBsensorData",n),n.map(i=>this.pfFusionPDRiBeacon(i))}return this.resetParticleFilterDist(t),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0,[this.particleFilter.getResultX(),this.particleFilter.getResultY()]}getGpsPosition(t){return t[2]>this.gps_max_horizontalAccuracy?null:xT(t[0],t[1])}resetParticleFilterDist(t,e,n){let i=this.particleFilter.getResultX(),o=this.particleFilter.getResultY(),s=ri(i,o,t.x,t.y);(e==="gps"?n&&s>n||s>this.GpsMaxEstimateErr:s>this.MaxEstimateErr)?(this.outTrustRegionNum+=1,this.outTrustRegionNum>=this.TrustNum&&(console.info("\u8D85\u51FA\u53EF\u4FE1\u533A\u57DF\uFF0C\u91CD\u7F6E\u7C92\u5B50\u8FC7\u6EE4\u5668\u5230: "+t.x+", "+t.y),this.particleFilter.setPosInitFlag(!1),this.particleFilter.setYawInitFlag(!1),this.outTrustRegionNum=0)):this.outTrustRegionNum=0}constructor(t){this.sigmaBeacon=5,this.gps_horizontalAccuracy=10,this.using_gps=!0,this.last_beacon_time=Date.now(),this.position_count=0,this.gps_max_horizontalAccuracy=20,this.MaxEstimateErr=5,this.GpsMaxEstimateErr=30,this.outTrustRegionNum=0,this.TrustNum=4,this.cacheSensorData=[],this.startTime=null;let e=v({},eR,t);this.using_gps=e.using_gps,this.gps_max_horizontalAccuracy=e.gps_max_horizontalAccuracy,this.particleFilter=new ru({NumParticle:200,reSampNumParticle:.65,initial_xy_uncertainty:12,initial_yaw_uncertainty:100,step_noise_sigma:.5,yaw_noise_sigma:2,compass_update_interval:3e3,sigmaCompass:80,delta_yaw:2,sigmaBeacon:5,unaccess_weight:.7}),this.pdr=new ou}};var zo=class extends Bt{checkSensor(){return this.sensor.checkSensor()}setSensor(t){this.sensor=t}start(){this.sensor.start(),this.pdr.startTime=Date.now(),this.sensor.addEventListener("add-data-item",t=>{let{item:e}=t;this.getPositionBySensorItem(e,!this._pause)})}pause(){this._pause=!0}continue(){this._pause=!1}getPositionBySensorItem(t,e){e===void 0&&(e=!0);let[n,i,o]=this.pdr.pfFusionPDRiBeacon(t);return n&&e&&this.dispatchEvent({type:"position",x:i,y:o,_type:t.type===Q.GPS?"gps":"pdr"}),[n,i,o]}setBeaconPosition(t,e){let[n,i]=this.pdr.setBeaconPosition(t,e);this.dispatchEvent({type:"position",x:n,y:i,_type:"beacon"})}dispose(){this.sensor.stop()}constructor(t={}){super(),this._pause=!1,this.sensor=new Ko(t.sensor),this.pdr=new su(t.pdr||{})}};var E5=d(I(),1),Y5=d(F(),1);var A5=d(I(),1),j5=d(F(),1),dt=T("three");var WT={texture_url:Wa,lineWidth:8,color:16777215},au=class extends dt.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:i}}}}}=this,o=t.map(a=>{let[u,l,c]=a;return E(new dt.Vector3(u,l,c),e,n,i)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return Xt(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new dt.Vector2(t,1)}loadTexture(t){return new Promise((e,n)=>{new dt.TextureLoader().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n]);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return A(this,null,function*(){let e=this.geometry=new Dt;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=dt.RepeatWrapping}let n=this.material=new yr({useMap:!0,color:new dt.Color(this.config.color),transparent:!0,resolution:new dt.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!0,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:dt.NormalBlending,repeat:new dt.Vector2(this.getRepeat(),1)}),i=this.mesh=new dt.Mesh(e,n);return i.renderOrder=9,this.add(i),i})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=WT,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:i}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,i)}},this.config=Object.assign({},WT,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var IT=T("@tweenjs/tween.js");var lt=T("three"),uu=class extends lt.Object3D{getBaseScale(t){let{clientSize:{width:e,height:n},camera:i}=this.bmap.context,o=new lt.Box3().setFromObject(t),{max:s,min:a}=o,u=new lt.Vector3(a.x,s.y,s.z),l=new lt.Vector3(s.x,s.y,s.z),c=new lt.Vector3(s.x,a.y,a.z),h=new lt.Vector3(a.x,a.y,a.z),p=E(u,i,e,n),f=E(l,i,e,n),g=E(h,i,e,n),y=E(c,i,e,n),j=new lt.Box2().setFromPoints([new lt.Vector2(p.x,p.y),new lt.Vector2(f.x,f.y),new lt.Vector2(g.x,g.y),new lt.Vector2(y.x,y.y)]).getSize(new lt.Vector2),b=40/j.x,w=40/j.y,C=Math.min(b,w),D=i.zoom;return C*D}registryEvent(){this.bmap.context.addEventListener("update",this._update),this.bmap.context.addEventListener("control-zoom-change",this._onChangeZoom)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this._update),this.bmap.context.removeEventListener("control-zoom-change",this._onChangeZoom)}printGraph(t){console.group(" <"+t.type+"> "+t.name),t.children.forEach(e=>this.printGraph(e)),console.groupEnd()}setClips(t){this.clearClips(),t.length&&(this.mixer=new lt.AnimationMixer(this.model.scene),t.forEach(e=>this.mixer.clipAction(e).play()))}startClips(){var t;this.setClips(((t=this.model)==null?void 0:t.animations)||[])}clearClips(){this.mixer&&(this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.mixer.getRoot()),this.mixer=null)}dispose(){this.unRegistryEvent(),this.clearClips(),this.clear(),this.model&&it(this.model.scene),this.bmap=null}constructor(t,e){super(),this.bmap=t,this.group=new lt.Object3D,this.mixer=null,this.previewTime=0,this.basicScale=1,this._update=()=>{let n=Date.now();if(!this.previewTime)this.previewTime=n;else{var i;let o=n-this.previewTime;this.previewTime=n,(i=this.mixer)==null||i.update(o/1e3)}},this._onChangeZoom=n=>{let{zoom:i}=n;var o;let s=this.basicScale/i;(o=this.model)==null||o.scene.scale.set(s,s,s)},this.add(this.group),Rt.loadModel(e,!1).then(n=>{this.model=n;let i=this.getBaseScale(n.scene);this.basicScale=i;let o=this.bmap.context.camera.zoom;n.scene.scale.set(i/o,i/o,i/o),this.group.add(n.scene),this.setClips(n.animations),this.group.rotation.set(Math.PI/2,Math.PI,0),this.dispatchEvent({type:"loaded"})}),this.registryEvent()}};var Uo=T("three"),ET=T("lodash");var Fh=class extends Kt{registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate)}pauseAnimation(){this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue()}clearTween(){this.tweenUtil.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate)}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.movedDistance=0,this.clearTween()),this.startModel&&(this.startModel.visible=!1),this.translatePath=null}addPath(t){this.paths=t;let e=t.map(n=>v({},n,{points:this.translatePoints(n.points)}));if(this.clearTween(),this.movedDistance=0,this.bmap.currentBuildGround)this.renderPath(e);else{let n=()=>{this.bmap.removeEventListener("center-change",n),this.renderPath(e)};this.bmap.addEventListener("center-change",n)}this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,n]=this.bmap.buildingCenter;return t.map(i=>[i[0]-e,i[1]-n])}renderPath(t){if(!t.length)return this.clearPath();let e=[];t.forEach((n,i,o)=>{let s=this.catmullRomCurve3(n.points),a=this.mulFloor.floors.find(u=>u.name===n.floor);if(e.push(...s.map(u=>{let[l,c]=u;return[l,c,a.position.z+a.groundMaxHeight]})),i!==o.length-1){let u=this.mulFloor.floors.find(l=>l.name===o[i+1].floor);e.push([...o[i+1].points[0],u.position.z])}}),this.cPath=e,this.animationPathOptions={cPathIndex:0},this.path?this.path.updatePoints(e):(this.path=new au(this),this.path.create(e),this.path.position.z=.5,this.bmap.context.scene.add(this.path)),this.startModel&&(this.startModel.position.set(e[0][0],e[0][1],e[0][2]),this.startModel.visible=!0),this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(t){return Ri(t,!1,!0,.1,170,2.5)}getPathDirection(t,e){if(t.length<2)return null;let n=Ue(t,e),i=t[n],o=t[n+1],s=new Uo.Vector3(o[0]-i[0],o[1]-i[1],0).normalize(),a=new Uo.Vector3(0,1,0).normalize(),u=s.angleTo(a),l=new Uo.Vector3().crossVectors(a,s);return(Object.is(l.y,0)?-1:1)*u}startSimulation(t){return A(this,null,function*(){t===void 0&&(t=1);let{paths:e,movedDistance:n}=this;if(!e.length)return;let i=e.reduce((s,a)=>s+a.distance,0);if(!i||n>=i)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let o=i/t;return this.startModel.startClips(),new Promise(s=>{let a=this.simulationTween=new IT.Tween({distance:this.movedDistance},this.tweenUtil.group).to({distance:i},o*1e3).onUpdate(u=>{var l;this.movedDistance=u.distance;let c=u.distance,h=0;for(let j=0;j<e.length;j++)if(e[j].distance>=c){h=j;break}else c-=e[j].distance;let p=qn(e[h].points,c);if(p===null)return;this.currentPathPosition=p;let f=this.translatePoints([p])[0],g=this.mulFloor.floors.find(j=>j.name===e[h].floor),y=g?g.position.z+g.groundMaxHeight:(l=this.startModel)==null?void 0:l.position.z;this.startModel&&this.startModel.position.set(f[0],f[1],y);let P=this.getPathDirection(e[h].points,p);(0,ET.isNil)(P)||this.startModel.setRotationFromAxisAngle(new Uo.Vector3(0,0,1),P)}).onComplete(()=>{this.tweenUtil.remove(a),this.startModel.clearClips(),s(!0)}).start()})})}setStartPoiRotate(t){if(this.startPoi){let n=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(360-t-n)%360}}dispose(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.startModel&&(this.bmap.context.scene.remove(this.startModel),this.startModel.dispose()),this.tweenUtil.dispose(),this.unRegistryEvent(),super.dispose()}constructor(t,e){super(t),this.mulFloor=e,this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.pathTween=null,this.startPoi=null,this.movedDistance=0,this.tweenUtil=new sn,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onUpdate=()=>{this.tweenUtil.update()},this.startModel=new uu(t,S1),this.startModel.visible=!1,this.bmap.context.scene.add(this.startModel),this.registryEvent()}};var lu=T("three");var Kh=class extends Kt{registryEvent(){this.clickHelper.addEventListener("click",this._click)}unRegistryEvent(){this.clickHelper.removeEventListener("click",this._click)}dispose(){this.unRegistryEvent(),this.clickHelper.dispose(),this.mulFloors=null,super.dispose()}constructor(t,e){super(t),this.mulFloors=e,this._click=n=>{let{e:i}=n;if(!this.mulFloors.showStatus)return;let o=new lu.Vector2,{offsetX:s,offsetY:a}=i,{clientSize:u}=this.bmap.context;o.x=s/u.width*2-1,o.y=a/u.height*-2+1;let l=new lu.Raycaster;l.setFromCamera(o,this.bmap.context.camera),l.ray.origin.sub(l.ray.direction.clone().multiplyScalar(1e4));let h=this.mulFloors.poiLayer.pois.map(f=>{if(!f.canSelect)return null;let g=l.intersectObjects(f.children,!0);return g.length?g[0]:null}).reduce((f,g)=>g&&(!f||g.distance<f.distance)?g:f,null),p=h==null?void 0:h.object;h&&h.object.isSprite&&(p=h.object.parent),p&&p instanceof ut&&this.dispatchEvent({type:"select",pois:[p]})},this.clickHelper=new Ni(this.bmap.context.container),this.registryEvent()}};var nQ=d(YT(),1),rQ=d(DT(),1),iQ=d(F(),1);var B5=d(I(),1),H5=d(F(),1),Q5=d(wr(),1),ii=T("three");function uR(r){let t=r.length,e=0,n=0,i=0,o=0;r.forEach(u=>{e+=u[0],n+=u[1],i+=u[0]*u[1],o+=u[0]*u[0]});let s=(t*i-e*n)/(t*o-e*e),a=(n-s*e)/t;return{m:s,b:a}}function lR(r,t,e){let n=e[0][0],i=e.slice(-1)[0][0],o=r*n+t,s=r*i+t;return{start:[n,o],end:[i,s]}}function Go(r){if(r.length<2)return null;let t=r.filter((u,l)=>{let c=[...r];return c.splice(l,1),c.every(h=>h[0]!==u[0]&&h[1]!==u[1])});if(t.length<2)return null;let{m:e,b:n}=uR(t),{start:i,end:o}=lR(e,n,t),a=360-(new ii.Vector2().subVectors(new ii.Vector2(o[0],o[1]),new ii.Vector2(i[0],i[1])).angle()/Math.PI*180-90+360)%360;return Number.isNaN(a)?null:a}function cR(r){let t=[];for(let e=1;e<r.length;e++){let n=r[e-1],i=r[e],o=i.position[0]-n.position[0],s=i.position[1]-n.position[1],a=Math.sqrt(o**2+s**2),u=i.time-n.time;if(u>0){let l=a/u;console.log("speedDelta",n.type,i.type,cu(l),a,u),t.push(l)}else t.push(0)}return t}function hR(r,t){let e=r[0],n=r.slice(-1)[0],i=G(n.position,e.position),o=n.time-e.time;return o<100||i<3?null:i/o}function cu(r){return r*60*60}function oi(r,t,e,n){let i=(e+90)%360*(Math.PI/180),o=t*n,s=new ii.Vector2(r[0],r[1]),a=Math.cos(i),u=Math.sin(i),l=new ii.Vector2(a,u);return s.add(l.normalize().multiplyScalar(o)),[s.x,s.y]}function pR(r){let t=[...r].sort((l,c)=>l-c),e=CT(t,25),n=CT(t,75),i=n-e,o=e-1.5*i,s=n+1.5*i,a=t.filter(l=>l>=o&&l<=s);return r.filter(l=>a.includes(l))}function CT(r,t){let e=t/100*(r.length-1),n=Math.floor(e),i=Math.ceil(e);if(n===i)return r[n];let o=e-n;return r[n]*(1-o)+r[i]*o}var hu=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 ko=T("lodash"),Vo=class extends Bt{setPathAngle(t){this.pathAngle=t,this.dispatchEvent({type:"change-compass",value:this.pathAngle}),(0,ko.isNil)(this.angle)&&(this.angle=t)}changeSpeed(){let t=this.history.filter(u=>["vision"].includes(u.type));if(t.length<2){this.speedFilter.filter(0),this.speed=0;return}let e=t[0],n=t.slice(-1)[0],i=G(n.position,e.position),o=n.time-e.time,s=o>0?i/o:0,a=this.speedFilter.filter(s);this.speed=a}changeAngle(t){t===void 0&&(t=this.visionHistory),t.length<2&&(this.angle=null);let e=Go(t.map(n=>n.position));e!==null&&this.setAngle(e)}setAngle(t,e){e===void 0&&(e=!0),this.angle=t,e&&this.dispatchEvent({type:"change-position-compass",value:t})}setPosition(t,e,n){let i={position:t,time:e,clientTime:Date.now()-n,type:"vision"};if(this._setVisionHistoryForAngle(i),(0,ko.isNil)(this.angle)||!this.speed){this.addHistory(i);return}let o=this.history.findLastIndex(a=>a.type==="vision"),s=this.history[o];if(s){if(s.time>e)return;let a=Go([this.history.slice(-1)[0].position,t]);if(a&&Math.abs(a-this.angle)<60){this.addHistory(i);return}let u=oi(t,this.speed,360-this.pathAngle,n);G(u,this.history.slice(-1)[0].position)>5?this.visionExcessesCount++:this.visionExcessesCount=0,this.visionExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21\u89C6\u89C9\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528\u89C6\u89C9\u6821\u51C6"),this.addHistory(i),this.visionExcessesCount=0)}}resetPdrPosition(){let t=this.history.findLast(e=>e.type==="vision");if(t&&this.speed){let e=oi(t.position,this.speed,360-this.pathAngle,Date.now()-t.clientTime);e&&this.history.push({position:e,time:Date.now(),clientTime:Date.now(),type:"pdr"})}}getLastVisionPdrPos(){let t=this.history.findLastIndex(n=>n.type==="vision");if(t!==-1){var e;return(e=this.history[t+1])!=null?e:this.history[t]}return null}_setVisionHistoryForAngle(t){if(!this.visionHistory.length){this.visionHistory.push(t);return}let e=Go([this.visionHistory.slice(-1)[0].position,t.position]);if(e!==null&&(this.angle&&Math.abs(this.angle-e)>60?this.angleExcessesCount++:(this.angleExcessesCount=0,this.visionHistory.push(t))),this.angleExcessesCount>3)console.warn("\u8FDE\u7EED\u4E09\u6B21\u89D2\u5EA6\u6BD4\u8F83\u6B6A\uFF0C\u91CD\u65B0\u77EB\u6B63"),this.visionHistory=[t],this.angleExcessesCount=0;else{let n=G(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position);for(;n>5&&this.visionHistory.length>15;)this.visionHistory.shift(),n=G(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position)}this.changeAngle()}addHistory(t){this.history.push(t);let e=this.history.filter(a=>a.type==="vision"),n=e.length?Date.now()-e.slice(-1)[0].clientTime:0,i=G(this.history[0].position,this.history.slice(-1)[0].position),o=n>5e3?10:3,s=n>5e3?0:5;for(n>5e3&&console.warn("\u89C6\u89C9\u7ED3\u679C\u8D85\u51FA5s\u4E0D\u53EF\u7528\uFF0C\u5168\u90E8\u6E05\u7A7A");e.length>s&&i>o;)this.history.shift(),e=this.history.filter(a=>a.type==="vision"),i=G(this.history[0].position,this.history.slice(-1)[0].position);s===0?this.changeSpeed():t.type==="vision"&&this.changeSpeed(),this.changePosition(t.type)}setBeaconPosition(t,e,n){let i=Date.now()-n,o={position:t,time:e,clientTime:i,type:"beacon"},s=this.history.findLastIndex(c=>c.type!=="pdr"),a=this.history[s];if(!a){this.addHistory(o);return}if((0,ko.isNil)(this.pathAngle)||!this.speed){this.addHistory(o);return}if(a&&a.time>e)return;let u=oi(t,this.speed,360-this.pathAngle,n);G(u,this.history.slice(-1)[0].position)>5?this.beaconExcessesCount++:this.beaconExcessesCount=0,this.beaconExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21beacon\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528beacon\u6821\u51C6"),this.addHistory(o),this.beaconExcessesCount=0)}startPositionTimer(){this.positionTimer&&this.timer.clearInterval(this.positionTimer),this.positionTimer=this.timer.setInterval(()=>{this.changePosition()},20)}stopPositionTimer(){this.positionTimer&&(this.timer.clearInterval(this.positionTimer),this.positionTimer=null)}changePosition(t){t===void 0&&(t="pdr");let e=this.getPosition(t);e.success&&(this.history.push({position:e.pos,time:Date.now(),clientTime:Date.now(),type:"pdr"}),this.speed?this.dispatchEvent({type:"change-pos",value:v({},e)}):this.dispatchEvent({type:"change-pos",value:e}))}getPosition(t){if(this.history.length===0)return{success:!1,pos:[0,0],compass:null,speed:0};let e=this.history.slice(-1)[0];if(this.history.length<2)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};if((0,ko.isNil)(this.pathAngle)||!this.speed)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};let n=e.clientTime,i=Date.now()-n;return{success:!0,pos:this.pathAngle?oi(e.position,this.speed,360-this.pathAngle,i):e.position,compass:this.pathAngle,speed:cu(this.speed)}}dispose(){this.timer.dispose()}constructor(){super(),this.history=[],this.visionHistory=[],this.speed=0,this.angle=null,this.timer=new J,this.positionTimer=null,this.speedFilter=new hu,this.visionExcessesCount=0,this.beaconExcessesCount=0,this.angleExcessesCount=0,this.pathAngle=0,this.startPositionTimer()}};var hQ=d(Vn(),1);function Nh(){let r=new Blob([`var aU=Object.create;var iE=Object.defineProperty;var uU=Object.getOwnPropertyDescriptor;var lU=Object.getOwnPropertyNames;var cU=Object.getPrototypeOf,fU=Object.prototype.hasOwnProperty;var st=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var hU=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of lU(t))!fU.call(n,s)&&s!==e&&iE(n,s,{get:()=>t[s],enumerable:!(o=uU(t,s))||o.enumerable});return n};var on=(n,t,e)=>(e=n!=null?aU(cU(n)):{},hU(t||!n||!n.__esModule?iE(e,"default",{value:n,enumerable:!0}):e,n));var ec=(n,t,e)=>new Promise((o,s)=>{var c=g=>{try{p(e.next(g))}catch(m){s(m)}},h=g=>{try{p(e.throw(g))}catch(m){s(m)}},p=g=>g.done?o(g.value):Promise.resolve(g.value).then(c,h);p((e=e.apply(n,t)).next())});var oo=st((Nm,oE)=>{"use strict";var Rf=function(n){return n&&n.Math===Math&&n};oE.exports=Rf(typeof globalThis=="object"&&globalThis)||Rf(typeof window=="object"&&window)||Rf(typeof self=="object"&&self)||Rf(typeof global=="object"&&global)||Rf(typeof Nm=="object"&&Nm)||function(){return this}()||Function("return this")()});var gi=st((GK,sE)=>{"use strict";sE.exports=function(n){try{return!!n()}catch(t){return!0}}});var Xs=st((kK,aE)=>{"use strict";var pU=gi();aE.exports=!pU(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Lf=st((qK,uE)=>{"use strict";var dU=gi();uE.exports=!dU(function(){var n=function(){}.bind();return typeof n!="function"||n.hasOwnProperty("prototype")})});var Is=st((HK,lE)=>{"use strict";var gU=Lf(),sp=Function.prototype.call;lE.exports=gU?sp.bind(sp):function(){return sp.apply(sp,arguments)}});var pE=st(hE=>{"use strict";var cE={}.propertyIsEnumerable,fE=Object.getOwnPropertyDescriptor,mU=fE&&!cE.call({1:2},1);hE.f=mU?function(t){var e=fE(this,t);return!!e&&e.enumerable}:cE});var ap=st((WK,dE)=>{"use strict";dE.exports=function(n,t){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:t}}});var mi=st((XK,yE)=>{"use strict";var gE=Lf(),mE=Function.prototype,Om=mE.call,yU=gE&&mE.bind.bind(Om,Om);yE.exports=gE?yU:function(n){return function(){return Om.apply(n,arguments)}}});var nc=st((YK,_E)=>{"use strict";var vE=mi(),vU=vE({}.toString),_U=vE("".slice);_E.exports=function(n){return _U(vU(n),8,-1)}});var EE=st(($K,xE)=>{"use strict";var xU=mi(),EU=gi(),wU=nc(),Dm=Object,SU=xU("".split);xE.exports=EU(function(){return!Dm("z").propertyIsEnumerable(0)})?function(n){return wU(n)==="String"?SU(n,""):Dm(n)}:Dm});var up=st((ZK,wE)=>{"use strict";wE.exports=function(n){return n==null}});var rc=st((JK,SE)=>{"use strict";var MU=up(),bU=TypeError;SE.exports=function(n){if(MU(n))throw new bU("Can't call method on "+n);return n}});var ic=st((KK,ME)=>{"use strict";var AU=EE(),TU=rc();ME.exports=function(n){return AU(TU(n))}});var Di=st((jK,bE)=>{"use strict";var Fm=typeof document=="object"&&document.all;bE.exports=typeof Fm=="undefined"&&Fm!==void 0?function(n){return typeof n=="function"||n===Fm}:function(n){return typeof n=="function"}});var wa=st((QK,AE)=>{"use strict";var CU=Di();AE.exports=function(n){return typeof n=="object"?n!==null:CU(n)}});var oc=st((tj,TE)=>{"use strict";var Um=oo(),PU=Di(),IU=function(n){return PU(n)?n:void 0};TE.exports=function(n,t){return arguments.length<2?IU(Um[n]):Um[n]&&Um[n][t]}});var PE=st((ej,CE)=>{"use strict";var RU=mi();CE.exports=RU({}.isPrototypeOf)});var NE=st((nj,LE)=>{"use strict";var LU=oo(),IE=LU.navigator,RE=IE&&IE.userAgent;LE.exports=RE?String(RE):""});var GE=st((rj,zE)=>{"use strict";var BE=oo(),Bm=NE(),OE=BE.process,DE=BE.Deno,FE=OE&&OE.versions||DE&&DE.version,UE=FE&&FE.v8,Ys,lp;UE&&(Ys=UE.split("."),lp=Ys[0]>0&&Ys[0]<4?1:+(Ys[0]+Ys[1]));!lp&&Bm&&(Ys=Bm.match(/Edge\\/(\\d+)/),(!Ys||Ys[1]>=74)&&(Ys=Bm.match(/Chrome\\/(\\d+)/),Ys&&(lp=+Ys[1])));zE.exports=lp});var zm=st((ij,qE)=>{"use strict";var kE=GE(),NU=gi(),OU=oo(),DU=OU.String;qE.exports=!!Object.getOwnPropertySymbols&&!NU(function(){var n=Symbol("symbol detection");return!DU(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&kE&&kE<41})});var Gm=st((oj,HE)=>{"use strict";var FU=zm();HE.exports=FU&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var km=st((sj,VE)=>{"use strict";var UU=oc(),BU=Di(),zU=PE(),GU=Gm(),kU=Object;VE.exports=GU?function(n){return typeof n=="symbol"}:function(n){var t=UU("Symbol");return BU(t)&&zU(t.prototype,kU(n))}});var XE=st((aj,WE)=>{"use strict";var qU=String;WE.exports=function(n){try{return qU(n)}catch(t){return"Object"}}});var Nf=st((uj,YE)=>{"use strict";var HU=Di(),VU=XE(),WU=TypeError;YE.exports=function(n){if(HU(n))return n;throw new WU(VU(n)+" is not a function")}});var cp=st((lj,$E)=>{"use strict";var XU=Nf(),YU=up();$E.exports=function(n,t){var e=n[t];return YU(e)?void 0:XU(e)}});var JE=st((cj,ZE)=>{"use strict";var qm=Is(),Hm=Di(),Vm=wa(),$U=TypeError;ZE.exports=function(n,t){var e,o;if(t==="string"&&Hm(e=n.toString)&&!Vm(o=qm(e,n))||Hm(e=n.valueOf)&&!Vm(o=qm(e,n))||t!=="string"&&Hm(e=n.toString)&&!Vm(o=qm(e,n)))return o;throw new $U("Can't convert object to primitive value")}});var Of=st((fj,KE)=>{"use strict";KE.exports=!1});var fp=st((hj,QE)=>{"use strict";var jE=oo(),ZU=Object.defineProperty;QE.exports=function(n,t){try{ZU(jE,n,{value:t,configurable:!0,writable:!0})}catch(e){jE[n]=t}return t}});var hp=st((pj,nw)=>{"use strict";var JU=Of(),KU=oo(),jU=fp(),tw="__core-js_shared__",ew=nw.exports=KU[tw]||jU(tw,{});(ew.versions||(ew.versions=[])).push({version:"3.40.0",mode:JU?"pure":"global",copyright:"\\xA9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.40.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var pp=st((dj,iw)=>{"use strict";var rw=hp();iw.exports=function(n,t){return rw[n]||(rw[n]=t||{})}});var sc=st((gj,ow)=>{"use strict";var QU=rc(),tB=Object;ow.exports=function(n){return tB(QU(n))}});var Sa=st((mj,sw)=>{"use strict";var eB=mi(),nB=sc(),rB=eB({}.hasOwnProperty);sw.exports=Object.hasOwn||function(t,e){return rB(nB(t),e)}});var Wm=st((yj,aw)=>{"use strict";var iB=mi(),oB=0,sB=Math.random(),aB=iB(1 .toString);aw.exports=function(n){return"Symbol("+(n===void 0?"":n)+")_"+aB(++oB+sB,36)}});var Rs=st((vj,lw)=>{"use strict";var uB=oo(),lB=pp(),uw=Sa(),cB=Wm(),fB=zm(),hB=Gm(),ac=uB.Symbol,Xm=lB("wks"),pB=hB?ac.for||ac:ac&&ac.withoutSetter||cB;lw.exports=function(n){return uw(Xm,n)||(Xm[n]=fB&&uw(ac,n)?ac[n]:pB("Symbol."+n)),Xm[n]}});var pw=st((_j,hw)=>{"use strict";var dB=Is(),cw=wa(),fw=km(),gB=cp(),mB=JE(),yB=Rs(),vB=TypeError,_B=yB("toPrimitive");hw.exports=function(n,t){if(!cw(n)||fw(n))return n;var e=gB(n,_B),o;if(e){if(t===void 0&&(t="default"),o=dB(e,n,t),!cw(o)||fw(o))return o;throw new vB("Can't convert object to primitive value")}return t===void 0&&(t="number"),mB(n,t)}});var Ym=st((xj,dw)=>{"use strict";var xB=pw(),EB=km();dw.exports=function(n){var t=xB(n,"string");return EB(t)?t:t+""}});var dp=st((Ej,mw)=>{"use strict";var wB=oo(),gw=wa(),$m=wB.document,SB=gw($m)&&gw($m.createElement);mw.exports=function(n){return SB?$m.createElement(n):{}}});var Zm=st((wj,yw)=>{"use strict";var MB=Xs(),bB=gi(),AB=dp();yw.exports=!MB&&!bB(function(){return Object.defineProperty(AB("div"),"a",{get:function(){return 7}}).a!==7})});var Jm=st(_w=>{"use strict";var TB=Xs(),CB=Is(),PB=pE(),IB=ap(),RB=ic(),LB=Ym(),NB=Sa(),OB=Zm(),vw=Object.getOwnPropertyDescriptor;_w.f=TB?vw:function(t,e){if(t=RB(t),e=LB(e),OB)try{return vw(t,e)}catch(o){}if(NB(t,e))return IB(!CB(PB.f,t,e),t[e])}});var Km=st((Mj,xw)=>{"use strict";var DB=Xs(),FB=gi();xw.exports=DB&&FB(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Ma=st((bj,Ew)=>{"use strict";var UB=wa(),BB=String,zB=TypeError;Ew.exports=function(n){if(UB(n))return n;throw new zB(BB(n)+" is not an object")}});var Pu=st(Sw=>{"use strict";var GB=Xs(),kB=Zm(),qB=Km(),gp=Ma(),ww=Ym(),HB=TypeError,jm=Object.defineProperty,VB=Object.getOwnPropertyDescriptor,Qm="enumerable",t0="configurable",e0="writable";Sw.f=GB?qB?function(t,e,o){if(gp(t),e=ww(e),gp(o),typeof t=="function"&&e==="prototype"&&"value"in o&&e0 in o&&!o[e0]){var s=VB(t,e);s&&s[e0]&&(t[e]=o.value,o={configurable:t0 in o?o[t0]:s[t0],enumerable:Qm in o?o[Qm]:s[Qm],writable:!1})}return jm(t,e,o)}:jm:function(t,e,o){if(gp(t),e=ww(e),gp(o),kB)try{return jm(t,e,o)}catch(s){}if("get"in o||"set"in o)throw new HB("Accessors not supported");return"value"in o&&(t[e]=o.value),t}});var uc=st((Tj,Mw)=>{"use strict";var WB=Xs(),XB=Pu(),YB=ap();Mw.exports=WB?function(n,t,e){return XB.f(n,t,YB(1,e))}:function(n,t,e){return n[t]=e,n}});var i0=st((Cj,Aw)=>{"use strict";var n0=Xs(),$B=Sa(),bw=Function.prototype,ZB=n0&&Object.getOwnPropertyDescriptor,r0=$B(bw,"name"),JB=r0&&function(){}.name==="something",KB=r0&&(!n0||n0&&ZB(bw,"name").configurable);Aw.exports={EXISTS:r0,PROPER:JB,CONFIGURABLE:KB}});var s0=st((Pj,Tw)=>{"use strict";var jB=mi(),QB=Di(),o0=hp(),tz=jB(Function.toString);QB(o0.inspectSource)||(o0.inspectSource=function(n){return tz(n)});Tw.exports=o0.inspectSource});var Iw=st((Ij,Pw)=>{"use strict";var ez=oo(),nz=Di(),Cw=ez.WeakMap;Pw.exports=nz(Cw)&&/native code/.test(String(Cw))});var mp=st((Rj,Lw)=>{"use strict";var rz=pp(),iz=Wm(),Rw=rz("keys");Lw.exports=function(n){return Rw[n]||(Rw[n]=iz(n))}});var yp=st((Lj,Nw)=>{"use strict";Nw.exports={}});var xp=st((Nj,Fw)=>{"use strict";var oz=Iw(),Dw=oo(),sz=wa(),az=uc(),a0=Sa(),u0=hp(),uz=mp(),lz=yp(),Ow="Object already initialized",l0=Dw.TypeError,cz=Dw.WeakMap,vp,Df,_p,fz=function(n){return _p(n)?Df(n):vp(n,{})},hz=function(n){return function(t){var e;if(!sz(t)||(e=Df(t)).type!==n)throw new l0("Incompatible receiver, "+n+" required");return e}};oz||u0.state?($s=u0.state||(u0.state=new cz),$s.get=$s.get,$s.has=$s.has,$s.set=$s.set,vp=function(n,t){if($s.has(n))throw new l0(Ow);return t.facade=n,$s.set(n,t),t},Df=function(n){return $s.get(n)||{}},_p=function(n){return $s.has(n)}):(ml=uz("state"),lz[ml]=!0,vp=function(n,t){if(a0(n,ml))throw new l0(Ow);return t.facade=n,az(n,ml,t),t},Df=function(n){return a0(n,ml)?n[ml]:{}},_p=function(n){return a0(n,ml)});var $s,ml;Fw.exports={set:vp,get:Df,has:_p,enforce:fz,getterFor:hz}});var Gw=st((Oj,zw)=>{"use strict";var f0=mi(),pz=gi(),dz=Di(),Ep=Sa(),c0=Xs(),gz=i0().CONFIGURABLE,mz=s0(),Bw=xp(),yz=Bw.enforce,vz=Bw.get,Uw=String,wp=Object.defineProperty,_z=f0("".slice),xz=f0("".replace),Ez=f0([].join),wz=c0&&!pz(function(){return wp(function(){},"length",{value:8}).length!==8}),Sz=String(String).split("String"),Mz=zw.exports=function(n,t,e){_z(Uw(t),0,7)==="Symbol("&&(t="["+xz(Uw(t),/^Symbol\\(([^)]*)\\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!Ep(n,"name")||gz&&n.name!==t)&&(c0?wp(n,"name",{value:t,configurable:!0}):n.name=t),wz&&e&&Ep(e,"arity")&&n.length!==e.arity&&wp(n,"length",{value:e.arity});try{e&&Ep(e,"constructor")&&e.constructor?c0&&wp(n,"prototype",{writable:!1}):n.prototype&&(n.prototype=void 0)}catch(s){}var o=yz(n);return Ep(o,"source")||(o.source=Ez(Sz,typeof t=="string"?t:"")),n};Function.prototype.toString=Mz(function(){return dz(this)&&vz(this).source||mz(this)},"toString")});var Ff=st((Dj,kw)=>{"use strict";var bz=Di(),Az=Pu(),Tz=Gw(),Cz=fp();kw.exports=function(n,t,e,o){o||(o={});var s=o.enumerable,c=o.name!==void 0?o.name:t;if(bz(e)&&Tz(e,c,o),o.global)s?n[t]=e:Cz(t,e);else{try{o.unsafe?n[t]&&(s=!0):delete n[t]}catch(h){}s?n[t]=e:Az.f(n,t,{value:e,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return n}});var Hw=st((Fj,qw)=>{"use strict";var Pz=Math.ceil,Iz=Math.floor;qw.exports=Math.trunc||function(t){var e=+t;return(e>0?Iz:Pz)(e)}});var yl=st((Uj,Vw)=>{"use strict";var Rz=Hw();Vw.exports=function(n){var t=+n;return t!==t||t===0?0:Rz(t)}});var Xw=st((Bj,Ww)=>{"use strict";var Lz=yl(),Nz=Math.max,Oz=Math.min;Ww.exports=function(n,t){var e=Lz(n);return e<0?Nz(e+t,0):Oz(e,t)}});var h0=st((zj,Yw)=>{"use strict";var Dz=yl(),Fz=Math.min;Yw.exports=function(n){var t=Dz(n);return t>0?Fz(t,9007199254740991):0}});var Uf=st((Gj,$w)=>{"use strict";var Uz=h0();$w.exports=function(n){return Uz(n.length)}});var Kw=st((kj,Jw)=>{"use strict";var Bz=ic(),zz=Xw(),Gz=Uf(),Zw=function(n){return function(t,e,o){var s=Bz(t),c=Gz(s);if(c===0)return!n&&-1;var h=zz(o,c),p;if(n&&e!==e){for(;c>h;)if(p=s[h++],p!==p)return!0}else for(;c>h;h++)if((n||h in s)&&s[h]===e)return n||h||0;return!n&&-1}};Jw.exports={includes:Zw(!0),indexOf:Zw(!1)}});var d0=st((qj,Qw)=>{"use strict";var kz=mi(),p0=Sa(),qz=ic(),Hz=Kw().indexOf,Vz=yp(),jw=kz([].push);Qw.exports=function(n,t){var e=qz(n),o=0,s=[],c;for(c in e)!p0(Vz,c)&&p0(e,c)&&jw(s,c);for(;t.length>o;)p0(e,c=t[o++])&&(~Hz(s,c)||jw(s,c));return s}});var Sp=st((Hj,tS)=>{"use strict";tS.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var nS=st(eS=>{"use strict";var Wz=d0(),Xz=Sp(),Yz=Xz.concat("length","prototype");eS.f=Object.getOwnPropertyNames||function(t){return Wz(t,Yz)}});var iS=st(rS=>{"use strict";rS.f=Object.getOwnPropertySymbols});var sS=st((Xj,oS)=>{"use strict";var $z=oc(),Zz=mi(),Jz=nS(),Kz=iS(),jz=Ma(),Qz=Zz([].concat);oS.exports=$z("Reflect","ownKeys")||function(t){var e=Jz.f(jz(t)),o=Kz.f;return o?Qz(e,o(t)):e}});var lS=st((Yj,uS)=>{"use strict";var aS=Sa(),tG=sS(),eG=Jm(),nG=Pu();uS.exports=function(n,t,e){for(var o=tG(t),s=nG.f,c=eG.f,h=0;h<o.length;h++){var p=o[h];!aS(n,p)&&!(e&&aS(e,p))&&s(n,p,c(t,p))}}});var fS=st(($j,cS)=>{"use strict";var rG=gi(),iG=Di(),oG=/#|\\.prototype\\./,Bf=function(n,t){var e=aG[sG(n)];return e===lG?!0:e===uG?!1:iG(t)?rG(t):!!t},sG=Bf.normalize=function(n){return String(n).replace(oG,".").toLowerCase()},aG=Bf.data={},uG=Bf.NATIVE="N",lG=Bf.POLYFILL="P";cS.exports=Bf});var Ls=st((Zj,hS)=>{"use strict";var Mp=oo(),cG=Jm().f,fG=uc(),hG=Ff(),pG=fp(),dG=lS(),gG=fS();hS.exports=function(n,t){var e=n.target,o=n.global,s=n.stat,c,h,p,g,m,v;if(o?h=Mp:s?h=Mp[e]||pG(e,{}):h=Mp[e]&&Mp[e].prototype,h)for(p in t){if(m=t[p],n.dontCallGetSet?(v=cG(h,p),g=v&&v.value):g=h[p],c=gG(o?p:e+(s?".":"#")+p,n.forced),!c&&g!==void 0){if(typeof m==typeof g)continue;dG(m,g)}(n.sham||g&&g.sham)&&fG(m,"sham",!0),hG(h,p,m,n)}}});var bp=st((Jj,pS)=>{"use strict";var mG=nc();pS.exports=Array.isArray||function(t){return mG(t)==="Array"}});var gS=st((Kj,dS)=>{"use strict";var yG=Xs(),vG=bp(),_G=TypeError,xG=Object.getOwnPropertyDescriptor,EG=yG&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(n){return n instanceof TypeError}}();dS.exports=EG?function(n,t){if(vG(n)&&!xG(n,"length").writable)throw new _G("Cannot set read only .length");return n.length=t}:function(n,t){return n.length=t}});var g0=st((jj,mS)=>{"use strict";var wG=TypeError,SG=9007199254740991;mS.exports=function(n){if(n>SG)throw wG("Maximum allowed index exceeded");return n}});var m0=st(()=>{"use strict";var MG=Ls(),bG=sc(),AG=Uf(),TG=gS(),CG=g0(),PG=gi(),IG=PG(function(){return[].push.call({length:4294967296},1)!==4294967297}),RG=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(n){return n instanceof TypeError}},LG=IG||!RG();MG({target:"Array",proto:!0,arity:1,forced:LG},{push:function(t){var e=bG(this),o=AG(e),s=arguments.length;CG(o+s);for(var c=0;c<s;c++)e[o]=arguments[c],o++;return TG(e,o),o}})});var vS=st((nQ,yS)=>{"use strict";yS.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 ES=st((rQ,xS)=>{"use strict";var NG=dp(),y0=NG("span").classList,_S=y0&&y0.constructor&&y0.constructor.prototype;xS.exports=_S===Object.prototype?void 0:_S});var SS=st((iQ,wS)=>{"use strict";var OG=d0(),DG=Sp();wS.exports=Object.keys||function(t){return OG(t,DG)}});var bS=st(MS=>{"use strict";var FG=Xs(),UG=Km(),BG=Pu(),zG=Ma(),GG=ic(),kG=SS();MS.f=FG&&!UG?Object.defineProperties:function(t,e){zG(t);for(var o=GG(e),s=kG(e),c=s.length,h=0,p;c>h;)BG.f(t,p=s[h++],o[p]);return t}});var TS=st((sQ,AS)=>{"use strict";var qG=oc();AS.exports=qG("document","documentElement")});var zf=st((aQ,OS)=>{"use strict";var HG=Ma(),VG=bS(),CS=Sp(),WG=yp(),XG=TS(),YG=dp(),$G=mp(),PS=">",IS="<",_0="prototype",x0="script",LS=$G("IE_PROTO"),v0=function(){},NS=function(n){return IS+x0+PS+n+IS+"/"+x0+PS},RS=function(n){n.write(NS("")),n.close();var t=n.parentWindow.Object;return n=null,t},ZG=function(){var n=YG("iframe"),t="java"+x0+":",e;return n.style.display="none",XG.appendChild(n),n.src=String(t),e=n.contentWindow.document,e.open(),e.write(NS("document.F=Object")),e.close(),e.F},Ap,Tp=function(){try{Ap=new ActiveXObject("htmlfile")}catch(t){}Tp=typeof document!="undefined"?document.domain&&Ap?RS(Ap):ZG():RS(Ap);for(var n=CS.length;n--;)delete Tp[_0][CS[n]];return Tp()};WG[LS]=!0;OS.exports=Object.create||function(t,e){var o;return t!==null?(v0[_0]=HG(t),o=new v0,v0[_0]=null,o[LS]=t):o=Tp(),e===void 0?o:VG.f(o,e)}});var S0=st((uQ,DS)=>{"use strict";var JG=Rs(),KG=zf(),jG=Pu().f,E0=JG("unscopables"),w0=Array.prototype;w0[E0]===void 0&&jG(w0,E0,{configurable:!0,value:KG(null)});DS.exports=function(n){w0[E0][n]=!0}});var Cp=st((lQ,FS)=>{"use strict";FS.exports={}});var BS=st((cQ,US)=>{"use strict";var QG=gi();US.exports=!QG(function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype})});var b0=st((fQ,GS)=>{"use strict";var t4=Sa(),e4=Di(),n4=sc(),r4=mp(),i4=BS(),zS=r4("IE_PROTO"),M0=Object,o4=M0.prototype;GS.exports=i4?M0.getPrototypeOf:function(n){var t=n4(n);if(t4(t,zS))return t[zS];var e=t.constructor;return e4(e)&&t instanceof e?e.prototype:t instanceof M0?o4:null}});var P0=st((hQ,HS)=>{"use strict";var s4=gi(),a4=Di(),u4=wa(),l4=zf(),kS=b0(),c4=Ff(),f4=Rs(),h4=Of(),C0=f4("iterator"),qS=!1,tu,A0,T0;[].keys&&(T0=[].keys(),"next"in T0?(A0=kS(kS(T0)),A0!==Object.prototype&&(tu=A0)):qS=!0);var p4=!u4(tu)||s4(function(){var n={};return tu[C0].call(n)!==n});p4?tu={}:h4&&(tu=l4(tu));a4(tu[C0])||c4(tu,C0,function(){return this});HS.exports={IteratorPrototype:tu,BUGGY_SAFARI_ITERATORS:qS}});var Pp=st((pQ,WS)=>{"use strict";var d4=Pu().f,g4=Sa(),m4=Rs(),VS=m4("toStringTag");WS.exports=function(n,t,e){n&&!e&&(n=n.prototype),n&&!g4(n,VS)&&d4(n,VS,{configurable:!0,value:t})}});var YS=st((dQ,XS)=>{"use strict";var y4=P0().IteratorPrototype,v4=zf(),_4=ap(),x4=Pp(),E4=Cp(),w4=function(){return this};XS.exports=function(n,t,e,o){var s=t+" Iterator";return n.prototype=v4(y4,{next:_4(+!o,e)}),x4(n,s,!1,!0),E4[s]=w4,n}});var I0=st((gQ,$S)=>{"use strict";var S4=mi(),M4=Nf();$S.exports=function(n,t,e){try{return S4(M4(Object.getOwnPropertyDescriptor(n,t)[e]))}catch(o){}}});var JS=st((mQ,ZS)=>{"use strict";var b4=wa();ZS.exports=function(n){return b4(n)||n===null}});var jS=st((yQ,KS)=>{"use strict";var A4=JS(),T4=String,C4=TypeError;KS.exports=function(n){if(A4(n))return n;throw new C4("Can't set "+T4(n)+" as a prototype")}});var tM=st((vQ,QS)=>{"use strict";var P4=I0(),I4=wa(),R4=rc(),L4=jS();QS.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n=!1,t={},e;try{e=P4(Object.prototype,"__proto__","set"),e(t,[]),n=t instanceof Array}catch(o){}return function(s,c){return R4(s),L4(c),I4(s)&&(n?e(s,c):s.__proto__=c),s}}():void 0)});var fM=st((_Q,cM)=>{"use strict";var N4=Ls(),O4=Is(),Ip=Of(),uM=i0(),D4=Di(),F4=YS(),eM=b0(),nM=tM(),U4=Pp(),B4=uc(),R0=Ff(),z4=Rs(),rM=Cp(),lM=P0(),G4=uM.PROPER,k4=uM.CONFIGURABLE,iM=lM.IteratorPrototype,Rp=lM.BUGGY_SAFARI_ITERATORS,Gf=z4("iterator"),oM="keys",kf="values",sM="entries",aM=function(){return this};cM.exports=function(n,t,e,o,s,c,h){F4(e,t,o);var p=function(w){if(w===s&&x)return x;if(!Rp&&w&&w in v)return v[w];switch(w){case oM:return function(){return new e(this,w)};case kf:return function(){return new e(this,w)};case sM:return function(){return new e(this,w)}}return function(){return new e(this)}},g=t+" Iterator",m=!1,v=n.prototype,E=v[Gf]||v["@@iterator"]||s&&v[s],x=!Rp&&E||p(s),M=t==="Array"&&v.entries||E,A,I,S;if(M&&(A=eM(M.call(new n)),A!==Object.prototype&&A.next&&(!Ip&&eM(A)!==iM&&(nM?nM(A,iM):D4(A[Gf])||R0(A,Gf,aM)),U4(A,g,!0,!0),Ip&&(rM[g]=aM))),G4&&s===kf&&E&&E.name!==kf&&(!Ip&&k4?B4(v,"name",kf):(m=!0,x=function(){return O4(E,this)})),s)if(I={values:p(kf),keys:c?x:p(oM),entries:p(sM)},h)for(S in I)(Rp||m||!(S in v))&&R0(v,S,I[S]);else N4({target:t,proto:!0,forced:Rp||m},I);return(!Ip||h)&&v[Gf]!==x&&R0(v,Gf,x,{name:s}),rM[t]=x,I}});var pM=st((xQ,hM)=>{"use strict";hM.exports=function(n,t){return{value:n,done:t}}});var _M=st((EQ,vM)=>{"use strict";var q4=ic(),L0=S0(),dM=Cp(),mM=xp(),H4=Pu().f,V4=fM(),Lp=pM(),W4=Of(),X4=Xs(),yM="Array Iterator",Y4=mM.set,$4=mM.getterFor(yM);vM.exports=V4(Array,"Array",function(n,t){Y4(this,{type:yM,target:q4(n),index:0,kind:t})},function(){var n=$4(this),t=n.target,e=n.index++;if(!t||e>=t.length)return n.target=null,Lp(void 0,!0);switch(n.kind){case"keys":return Lp(e,!1);case"values":return Lp(t[e],!1)}return Lp([e,t[e]],!1)},"values");var gM=dM.Arguments=dM.Array;L0("keys");L0("values");L0("entries");if(!W4&&X4&&gM.name!=="values")try{H4(gM,"name",{value:"values"})}catch(n){}});var D0=st(()=>{"use strict";var xM=oo(),wM=vS(),Z4=ES(),qf=_M(),EM=uc(),J4=Pp(),K4=Rs(),N0=K4("iterator"),O0=qf.values,SM=function(n,t){if(n){if(n[N0]!==O0)try{EM(n,N0,O0)}catch(o){n[N0]=O0}if(J4(n,t,!0),wM[t]){for(var e in qf)if(n[e]!==qf[e])try{EM(n,e,qf[e])}catch(o){n[e]=qf[e]}}}};for(Np in wM)SM(xM[Np]&&xM[Np].prototype,Np);var Np;SM(Z4,"DOMTokenList")});var AM=st((MQ,bM)=>{"use strict";var j4=Rs(),Q4=j4("toStringTag"),MM={};MM[Q4]="z";bM.exports=String(MM)==="[object z]"});var F0=st((bQ,TM)=>{"use strict";var tk=AM(),ek=Di(),Op=nc(),nk=Rs(),rk=nk("toStringTag"),ik=Object,ok=Op(function(){return arguments}())==="Arguments",sk=function(n,t){try{return n[t]}catch(e){}};TM.exports=tk?Op:function(n){var t,e,o;return n===void 0?"Undefined":n===null?"Null":typeof(e=sk(t=ik(n),rk))=="string"?e:ok?Op(t):(o=Op(t))==="Object"&&ek(t.callee)?"Arguments":o}});var Dp=st((AQ,CM)=>{"use strict";var ak=F0(),uk=String;CM.exports=function(n){if(ak(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return uk(n)}});var IM=st((TQ,PM)=>{"use strict";var lk=Ma();PM.exports=function(){var n=lk(this),t="";return n.hasIndices&&(t+="d"),n.global&&(t+="g"),n.ignoreCase&&(t+="i"),n.multiline&&(t+="m"),n.dotAll&&(t+="s"),n.unicode&&(t+="u"),n.unicodeSets&&(t+="v"),n.sticky&&(t+="y"),t}});var LM=st((CQ,RM)=>{"use strict";var U0=gi(),ck=oo(),B0=ck.RegExp,z0=U0(function(){var n=B0("a","y");return n.lastIndex=2,n.exec("abcd")!==null}),fk=z0||U0(function(){return!B0("a","y").sticky}),hk=z0||U0(function(){var n=B0("^r","gy");return n.lastIndex=2,n.exec("str")!==null});RM.exports={BROKEN_CARET:hk,MISSED_STICKY:fk,UNSUPPORTED_Y:z0}});var OM=st((PQ,NM)=>{"use strict";var pk=gi(),dk=oo(),gk=dk.RegExp;NM.exports=pk(function(){var n=gk(".","s");return!(n.dotAll&&n.test(\`
|
|
11549
|
+
`],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var Oh=class extends wT.EventDispatcher{setRoadData(t){return A(this,null,function*(){this.initRoadStatus=!1,this.dispatchEvent({type:"init-road-status",status:!1}),yield ct(this.worker,"set_road_info",{roadData:t}),this.initRoadStatus=!0,this.dispatchEvent({type:"init-road-status",status:!0})})}getPath(t,e,n){return A(this,null,function*(){return n===void 0&&(n=""),new Promise((i,o)=>{let s=()=>{ct(this.worker,"get_path",{start:t,end:e,type:n}).then(a=>{a?typeof a=="string"?o(a):i(a):o("no-path")})};if(this.initRoadStatus)s();else{let a=u=>{let{status:l}=u;l&&(this.removeEventListener("init-road-status",a),s())};this.addEventListener("init-road-status",a)}})})}getDirectionPath(t){return ct(this.worker,"get_direction_path",t)}dispose(){return A(this,null,function*(){ct(this.worker,"clear",""),this.worker.terminate()})}constructor(){super(),this.worker=Zh(),this.initRoadStatus=!1}};var DH=d(I(),1),CH=d(Ze(),1),XH=d(Oe(),1),ZH=d(Re(),1),OH=d(Fe(),1),RH=d(Ke(),1),FH=d(Ne(),1),KH=d(ze(),1),NH=d(F(),1);var _T=T("three"),eu=class extends qt{setEnable(t){super.setEnable(t),St(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:n,clientHeight:i}}}=this,o=E(this.startPoint,e,n,i),s=E(this.endPoint,e,n,i),a={x:Math.min(o.x,s.x),y:Math.min(o.y,s.y)},u={x:Math.max(o.x,s.x),y:Math.max(o.y,s.y)},l=this.searchMapInFrustum(a,u);this.dispatchEvent({type:"selected",list:l})}}searchMapInFrustum(t,e){var n;let{context:i}=this;return((n=i.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof at&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:i,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let f=E(p,i,o,s);return rn(f,e,n)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let a=t.mesh.geometry.boundingBox;if(!a)return!1;let{min:u,max:l}=a,c=E(u,i,o,s),h=E(l,i,o,s);return!(!rn(c,e,n)||!rn(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new _T.Frustum,this.onPointerDown=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=i=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o)},this.onPointerUp=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let i=this.getSvgCoordinate(this.startPoint),o=v({},i);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(i.x,o.x),y:Math.min(i.y,o.y)},a=Math.abs(o.x-i.x),u=Math.abs(o.y-i.y);St(this.rect,s.x,s.y,a,u)}else St(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=on(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var $O={boxSelection:!1,elements:["graphic","poi"]},Rh=class extends Kt{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.options.boxSelection||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.bmap.context.control.enablePan,this.prevRotateStatus=this.bmap.context.control.enableRotate,this.bmap.context.control.enablePan=!1,this.bmap.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.bmap.context.control.enablePan=!!this.prevPanStatus,this.bmap.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],pois:[...this._poiList],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.bmap.context.container.addEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.addEventListener("pointerup",this.onPointerUp),this.bmap.context.container.addEventListener("pointerout",this.onPointerOut),this.bmap.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.bmap.context.container.removeEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.removeEventListener("pointerup",this.onPointerUp),this.bmap.context.container.removeEventListener("pointerout",this.onPointerOut),this.bmap.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent(),super.dispose()}constructor(t,e={}){super(t),this._list=new Set,this._poiList=new Set,this.downPoint=null,this.isMultipleSelect=!1,this.onPointerDown=n=>{this.downPoint={x:n.offsetX,y:n.offsetY}},this.onPointerUp=n=>{if(!this.downPoint)return;let{offsetX:i,offsetY:o}=n,{x:s,y:a}=this.downPoint;if(Math.sqrt((s-i)**2+(a-o)**2)>3)return;let u=new Set,l=[],c=[];if(this.options.elements.includes("graphic")){let{graphics:h}=this.bmap.context.getGraphicsByDeviceXy(i,o);h.map(p=>u.add(p.options.id)),l.push(...h)}if(this.options.elements.includes("poi")){let h=this.bmap.context.getPoisByDeviceXy(i,o);c.push(...h),h.forEach(p=>{if(!u.has(p.options.id)){var f;let g=((f=this.bmap.context.currentFloor)==null?void 0:f.graphicLayer.graphicMap.get(p.options.id))||null;g&&(u.add(p.options.id),l.push(g))}})}(!this.options.boxSelection||!(Bn?n.metaKey:n.ctrlKey))&&(this._list.clear(),this._poiList.clear()),l.forEach(h=>this._list.add(h)),c.forEach(h=>this._poiList.add(h)),this.selectEnd(),this.downPoint=null},this.onPointerOut=n=>{this.disableBoxSelection()},this.onKeyDown=n=>{Hn(n.key)&&this.enableBoxSelection()},this.onKeyUp=n=>{Hn(n.key)&&this.disableBoxSelection()},this.onBoxSelected=n=>{let{list:i}=n;this._list.clear(),this._poiList.clear(),i.forEach(o=>{if(this.options.elements.includes("graphic")&&this._list.add(o),this.options.elements.includes("poi")){let s=this.bmap.getPoiById(o.options.id);s&&this._poiList.add(s)}}),this.selectEnd()},this.options=v({},$O,e),this.boxSelection=new eu(this.bmap.context),this.boxSelection.setEnable(!1),this.registryEvent()}};var JH=d(F(),1),zt=T("lodash");var Q=function(r){return r.COMPASS="compass",r.DEVICE_MOTION="deviceMotion",r.ACCELERATION="acceleration",r.GPS="gps",r}({});var tR={time:1e3,elements:[Q.COMPASS,Q.DEVICE_MOTION,Q.ACCELERATION,Q.GPS]},Ko=class extends Bt{start(){this.options.elements.some(t=>[Q.DEVICE_MOTION,Q.COMPASS].includes(t))&&this.listenDeviceOrientation(),this.options.elements.includes(Q.ACCELERATION)&&this.listenAcceleration(),this.options.elements.includes(Q.GPS)&&this.listenGps(),this.dispatchEvent({type:"start"}),this.dispatchTimer=this.timer.setInterval(()=>{this.dispatchEvent({type:"sensor-data",data:(0,zt.cloneDeep)(this.data)}),this.data=[]},this.options.time)}addDataItem(t){this.data.push(t),this.dispatchEvent({type:"add-data-item",item:t})}listenDeviceOrientation(){Sn?window.addEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.addEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0})}listenAcceleration(){window.addEventListener("devicemotion",this.handleAcceleration,!1)}listenGps(){this.gpsTimer=navigator.geolocation.watchPosition(t=>{console.log("watch gps",t.coords),this.addDataItem({type:Q.GPS,timestamp:Date.now(),res:[t.coords.longitude,t.coords.latitude,t.coords.accuracy]})},t=>{console.log("\u83B7\u53D6gps\u5931\u8D25",t)},{enableHighAccuracy:!0})}checkSensor(){return A(this,null,function*(){return{deviceOrientation:yield this.checkDeviceOrientation()}})}checkDeviceOrientation(){return A(this,null,function*(){var t;if(!Sn)return!0;if(typeof window.DeviceOrientationEvent!="undefined"&&typeof((t=window.DeviceOrientationEvent)==null?void 0:t.requestPermission)=="function")try{var e;return(yield(e=window.DeviceOrientationEvent)==null?void 0:e.requestPermission())==="granted"}catch(n){return!1}return!1})}stop(){window.removeEventListener("devicemotion",this.handleAcceleration,!1),Sn?window.removeEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.removeEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0}),(0,zt.isNil)(this.gpsTimer)||navigator.geolocation.clearWatch(this.gpsTimer),this.dispatchTimer&&this.timer.clearInterval(this.dispatchTimer),this.data=[],this.dispatchEvent({type:"stop"})}constructor(t={}){super(),this.gpsTimer=null,this.data=[],this.timer=new J,this.dispatchTimer=null,this.addAcceleration=(0,zt.throttle)(e=>{this.addDataItem(e)},20),this.deviceOrientationAbsHandler=(0,zt.throttle)(e=>{let n=Date.now(),{alpha:i,beta:o,gamma:s}=e;if((0,zt.isNil)(i)||(0,zt.isNil)(o)||(0,zt.isNil)(s))return;let a;Sn?a=e.webkitCompassHeading:a=360-i,this.options.elements.includes(Q.DEVICE_MOTION)&&this.addDataItem({type:Q.DEVICE_MOTION,timestamp:n,res:[i,o,s]}),this.options.elements.includes(Q.COMPASS)&&this.addDataItem({type:Q.COMPASS,timestamp:n,res:a})},200),this.handleAcceleration=e=>{let n=e.accelerationIncludingGravity;(0,zt.isNil)(n)||(0,zt.isNil)(n.x)||(0,zt.isNil)(n.y)||(0,zt.isNil)(n.z)||this.addAcceleration({type:Q.ACCELERATION,timestamp:Date.now(),res:[n.x,n.y,n.z]})},this.options=v({},tR,t)}};var d5=d(I(),1);var u5=d(F(),1);var t5=d(F(),1),e5=d(I(),1);function nu(r,t){return 1/Math.sqrt(2*Math.PI*Math.pow(t,2))*Math.exp(-Math.pow(r,2)/(2*Math.pow(t,2)))}function No(r){return(r+360)%360}function xT(r,t){let n=6378137*r*Math.PI/180,i=6378137*Math.log(Math.tan(Math.PI/4+t*Math.PI/180/2));return{x:n,y:i}}function ri(r,t,e,n){return Math.sqrt(Math.pow(Math.abs(r-e),2)+Math.pow(Math.abs(t-n),2))}var iu=T("mathjs"),ru=class{motionModelRotYaw(t){if(!(Math.abs(t)<.001)){this.last_yaw_compass=No(this.last_yaw_compass+t);for(let e=0;e<this.NumParticle;e++){let n=Math.random()*this.yaw_noise_sigma;this.particleX[2][e]=this.particleX[2][e]+t+n,this.particleX[2][e]=No(this.particleX[2][e])}}}motionModelStepLength(t,e){if(t===0)return;for(let i=0;i<this.NumParticle;i++){let o=Math.random()*this.step_noise_sigma;this.particleX[0][i]+=(.65+o)*Math.sin(-this.particleX[2][i]/180*Math.PI),this.particleX[1][i]+=(.65+o)*Math.cos(this.particleX[2][i]/180*Math.PI),e(this.particleX[0][i],this.particleX[1][i])||(this.particleWeight[0][i]*=this.unaccess_weight)}let n=this.particleWeight[0].reduce((i,o)=>i+o,0);this.particleWeight[0]=this.particleWeight[0].map(i=>i/n)}motionModelCompassYaw(t,e){if(e-this.last_compass_time>this.compass_update_interval){let n=360-t;n+=this.delta_yaw,n=No(n),Math.abs(n-this.last_yaw_compass)>60?this.compass_consecutive_offset_count++:this.compass_consecutive_offset_count=0;for(let o=0;o<this.NumParticle;o++){let s=Math.abs(this.particleX[2][o]-n);s>180&&(s=360-s),this.particleWeight[0][o]*=nu(s,this.sigmaCompass)}let i=this.particleWeight[0].reduce((o,s)=>o+s,0);this.particleWeight[0]=this.particleWeight[0].map(o=>o/i),this.setLastCompassTime(e)}}resampling(){if(1/this.particleWeight[0].reduce((e,n)=>e+n*n,0)<this.reSampNumParticle){let e=this.particleWeight[0].reduce((a,u,l)=>a.concat(a[l]+u),[0]),i=this.particleWeight[0].map(()=>1/this.NumParticle).map((a,u)=>a+Math.random()/this.NumParticle),o=[],s=0;for(let a=0;a<this.NumParticle;a++){for(;i[a]>e[s];)s++;o.push(s)}this.particleX=this.particleX.map((a,u)=>o.map(l=>a[l])),this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle)}}update(t,e){for(let i=0;i<this.NumParticle;i++){let o=ri(this.particleX[0][i],this.particleX[1][i],t.x,t.y);this.particleWeight[0][i]=Math.max(1e-7,this.particleWeight[0][i]*nu(o,e))}let n=this.particleWeight[0].reduce((i,o)=>i+o,0);this.particleWeight[0]=this.particleWeight[0].map(i=>i/n)}updateCar(t,e){let n=t.x-this.xEst[0][0],i=t.y-this.xEst[1][0];for(let s=0;s<this.NumParticle;s++){let a=ri(this.particleX[0][s],this.particleX[1][s],t.x,t.y);this.particleWeight[0][s]=Math.max(1e-7,this.particleWeight[0][s]*nu(a,e)),this.particleX[0][s]+=n,this.particleX[1][s]+=i}let o=this.particleWeight[0].reduce((s,a)=>s+a,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/o)}getPosInitFlag(){return this.particle_PosInitFlag}getYawInitFlag(){return this.particle_yawInitFlag}setPosInitFlag(t){this.particle_PosInitFlag=t}setYawInitFlag(t){this.particle_yawInitFlag=t}getResultX(){let t=(0,iu.reshape)(this.particleWeight,[this.NumParticle,1]),e=(0,iu.multiply)(this.particleX,t);return this.xEst=e,this.xEst[0][0]}getResultY(){return this.xEst[1][0]}getResultYaw(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0]));return this.particleX[2][t]}getEstConfidence(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0])),e=this.particleWeight[0].indexOf(Math.min(...this.particleWeight[0])),n=[this.particleX[0][t],this.particleX[1][t]],i=[this.particleX[0][e],this.particleX[1][e]],o=ri(n[0],n[1],i[0],i[1]),s=o*.67;return console.log(o,s),s}getParticleNum(){return this.NumParticle}getParticleX(){return this.particleX}setLastCompassTime(t){this.last_compass_time=t}getLastCompassTime(){return this.last_compass_time}initParticlesByPos(t,e,n){if(!this.particle_PosInitFlag){this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle);let i=0;for(;i<this.NumParticle;){let s=(2*Math.random()-1)*this.initial_xy_uncertainty,a=(2*Math.random()-1)*this.initial_xy_uncertainty;n(t+s,e+a)||(this.particleWeight[0][i]*=this.unaccess_weight),this.particleX[0][i]=t+s,this.particleX[1][i]=e+a,i++}let o=this.particleWeight[0].reduce((s,a)=>s+a,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/o),this.particle_PosInitFlag=!0,this.xEst[0][0]=t,this.xEst[1][0]=e,this.xEst[2][0]=0}}initParticlesByCompass(t){console.log("Init compass: "+t);let e=360-t;e+=this.delta_yaw,e=No(e),console.log("Init Yaw: "+e);for(let n=0;n<this.NumParticle;n++){let i=(2*Math.random()-1)*this.initial_yaw_uncertainty;this.particleX[2][n]=e+i}this.particle_yawInitFlag=!0,this.xEst[2][0]=e,this.last_yaw_compass=e,this.compass_consecutive_offset_count=0}constructor(t){this.last_yaw_compass=0,this.compass_consecutive_offset_count=0,this.NumParticle=t.NumParticle,this.reSampNumParticle=t.reSampNumParticle,this.initial_xy_uncertainty=t.initial_xy_uncertainty,this.initial_yaw_uncertainty=t.initial_yaw_uncertainty,this.step_noise_sigma=t.step_noise_sigma,this.yaw_noise_sigma=t.yaw_noise_sigma,this.compass_update_interval=t.compass_update_interval,this.sigmaCompass=t.sigmaCompass,this.delta_yaw=t.delta_yaw,this.sigmaBeacon=t.sigmaBeacon,this.unaccess_weight=t.unaccess_weight,this.particle_PosInitFlag=!1,this.particle_yawInitFlag=!1,this.xEst=[[0],[0],[0]],this.particleX=Array.from({length:3},()=>Array(this.NumParticle).fill(0)),this.particleWeight=Array.from({length:1},()=>Array(this.NumParticle).fill(1/this.NumParticle)),this.last_compass_time=0}};var i5=d(F(),1),o5=d(I(),1),ou=class{init(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10+.5,this.max_valley=10-.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.65,this.last_rot=[0,0,0],this.delta_rot=[0,0,0],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0}reset(){this.init()}setInitPose(t){t===void 0&&(t=[0,0]),this.last_px=t[0],this.last_py=t[1],console.info("pdr init pos: "+this.last_px+", "+this.last_py)}setInitYaw(t){t===void 0&&(t=0),this.last_yaw=t}getPos(t,e,n){let i=0;return n.length===3&&(this.delta_yaw=this.getDeltaYawFromRot(t,n)),e.length===3&&(i=this.getStepLength(t,e)),i!==0&&(this.last_px+=this.delta_px,this.last_py+=this.delta_py),[this.last_px,this.last_py]}getDeltaPose(){return[this.delta_px,this.delta_py]}getStepLength(t,e){if(e.length<3)return console.warn("acc data less than 3"),0;let n=!1,i=Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2));if(this.accH_fifo.push(i),this.accH_time_fifo.push(t),this.imuFreUpdate(),this.accH_fifo.length<this.accH_fifo_len+1)n=!1;else{for(;this.accH_fifo.length>=this.accH_fifo_len+1;)this.accH_fifo.shift(),this.accH_time_fifo.shift();let o=this.PVStepDetec(),s=this.FFTStepDetec(),a=this.recheckState(),u=this.accH_time_fifo[Math.floor(this.accH_time_fifo.length*3/4)];Math.abs(this.abnor_start_time)<.001&&this.abnor_fft_detected?this.abnor_start_time=u:this.abnor_fft_detected||(this.abnor_start_time=0),o&&s&&a?(this.step_count+=1,this.last_step_time=u,n=!0):Math.abs(this.abnor_start_time)>.001&&this.abnor_peak_time-this.abnor_start_time>this.abnor_time_threshold&&this.step_count>1&&this.abnor_peak_time-this.last_step_time>1?(this.step_count+=1,this.last_step_time=u,n=!0):(u-this.last_step_time>2&&(this.state_count=0),n=!1)}if(n){let o=this.last_yaw/180*Math.PI;return this.delta_px=this.const_step_length*Math.cos(o),this.delta_py=this.const_step_length*Math.sin(o),this.const_step_length}else return 0}imuFreUpdate(){if(this.accH_time_fifo.length>2&&(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]<0||this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]>10||this.accH_time_fifo[this.accH_time_fifo.length-1]===this.accH_time_fifo[0])&&(console.warn("pdr reset last one time "+this.accH_time_fifo[this.accH_time_fifo.length-1]+" last two time "+this.accH_time_fifo[this.accH_time_fifo.length-2]),this.reset()),this.accH_fifo.length>9||this.fre<15){let t=(this.accH_fifo.length-1)/(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[0]);Math.abs(this.fre-t)>8&&(this.fre=Math.round((t-3)/10)*10,(this.fre<=10||this.fre>=100)&&(console.warn("Frequency Error "+this.fre),this.fre=100),console.debug("Frequency change to "+this.fre),this.accH_fifo_len=Math.floor(1*this.fre)+1)}}recheckState(){return!0}PVStepDetec(){let t=!1,e=this.accH_fifo.slice(Math.floor(this.accH_fifo_len/2)),n=this.accH_time_fifo.slice(Math.floor(this.accH_fifo_len/2)),i=e[Math.floor(e.length/2)],o=n[Math.floor(n.length/2)],s=Math.max(...e),a=Math.min(...e),u=!1,l=!1;return Math.abs(i-a)<.01&&i<this.max_valley&&this.valley_num<=this.peak_num&&(this.last_valley_time===0?l=!0:l=o-this.last_valley_time>this.min_step_time,l&&(this.last_valley_time=o,this.valley_num+=1)),Math.abs(i-s)<.01&&i>this.min_peak&&this.peak_num<=this.valley_num&&(this.last_peak_time===0?u=!0:u=o-this.last_peak_time>this.min_step_time,u&&(this.last_peak_time=o,this.peak_num+=1)),i===s&&i>this.min_peak&&(this.abnor_peak_time=o,this.abnor_peak_accH=i),this.peak_num===this.valley_num&&(u||l)&&(t=!0),t}FFTStepDetec(){return!0}getDeltaYawFromRot(t,e){if(e.length<3)return console.warn("rot data less than 3"),0;let n=[0,0,0];this.last_rot.length===3&&(n=e.map((a,u)=>a-this.last_rot[u]));for(let a=0;a<e.length;a++)n[a]<-180?n[a]+=360:n[a]>180&&(n[a]-=360);let i=.2;this.delta_rot.length===3?this.delta_rot=this.delta_rot.map((a,u)=>i*a+(1-i)*n[u]):this.delta_rot=n,this.last_rot=e,this.delta_yaw=this.delta_rot[0],this.last_yaw+=this.delta_yaw,this.last_yaw=this.limitYaw(this.last_yaw);let o=this.delta_rot.reduce((a,u)=>a+Math.abs(u),0);this.delta_rot_sum_fifo.push(o),this.delta_rot_sum_time_fifo.push(t),Math.abs(this.delta_rot_sum_time_fifo[this.delta_rot_sum_time_fifo.length-1]-this.delta_rot_sum_time_fifo[0])>1&&(this.delta_rot_sum_fifo.shift(),this.delta_rot_sum_time_fifo.shift()),this.delta_yaw_accum+=this.delta_yaw;let s=0;return Math.abs(this.delta_yaw_accum_timestamp-t)>this.delta_yaw_time_threshold?(s=this.delta_yaw_accum,this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=t,s):null}limitYaw(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}constructor(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10.5,this.max_valley=9.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_time_threshold=4,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.85,this.last_rot=[],this.delta_rot=[],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0}};var eR={using_gps:!0,gps_max_horizontalAccuracy:20},su=class{pfFusionPDRiBeacon(t){let{type:e,timestamp:n,res:i}=t,o=!1;if(this.cacheSensorData.push(t),this.particleFilter.getPosInitFlag()&&this.particleFilter.getYawInitFlag()){if(e===Q.ACCELERATION){let s=i,a=this.pdr.getStepLength(n/1e3,s);a!==0&&(this.particleFilter.motionModelStepLength(a,()=>!0),this.particleFilter.resampling(),this.position_count+=1,o=!0)}if(this.using_gps&&e===Q.GPS)if(this.last_beacon_time===null||n-this.last_beacon_time>5e3){let s=this.getGpsPosition(i);o=s!==null,s&&(this.particleFilter.update(s,this.gps_horizontalAccuracy),this.resetParticleFilterDist(s,"gps",i[2]),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0)}else return[!1,0,0];if(e===Q.DEVICE_MOTION){let s=this.pdr.getDeltaYawFromRot(n/1e3,i);s!==null&&this.particleFilter.motionModelRotYaw(s)}e===Q.COMPASS&&this.particleFilter.motionModelCompassYaw(i,n),this.last_pos_time&&n-this.last_pos_time>500&&(this.position_count+=1,o=!0)}else if(!this.particleFilter.getPosInitFlag()&&this.using_gps&&e===Q.GPS){if(this.startTime&&Date.now()-this.startTime>3e3){let s=this.getGpsPosition(i);o=s!==null,console.log("gps_pos",s,i),s?(this.particleFilter.initParticlesByPos(s.x,s.y,()=>!0),this.last_pos_time=n,console.log("init Pos by gps success time "+n),this.cacheSensorData.length=0):console.log("init Pos by gps fail time "+n)}}else if(!this.particleFilter.getYawInitFlag()&&e===Q.COMPASS){let s=i;this.particleFilter.initParticlesByCompass(s),this.particleFilter.setLastCompassTime(n),console.log("init yaw by compass success time "+n)}return o&&(this.last_pos_time=n),[o,this.particleFilter.getResultX(),this.particleFilter.getResultY()]}setBeaconPosition(t,e){if(this.last_beacon_time=e,this.particleFilter.getPosInitFlag())this.particleFilter.update(t,this.sigmaBeacon);else{this.particleFilter.initParticlesByPos(t.x,t.y,()=>!0);let n=this.cacheSensorData.filter(i=>i.timestamp>e);console.log("\u521D\u59CBsensorData",n),n.map(i=>this.pfFusionPDRiBeacon(i))}return this.resetParticleFilterDist(t),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0,[this.particleFilter.getResultX(),this.particleFilter.getResultY()]}getGpsPosition(t){return t[2]>this.gps_max_horizontalAccuracy?null:xT(t[0],t[1])}resetParticleFilterDist(t,e,n){let i=this.particleFilter.getResultX(),o=this.particleFilter.getResultY(),s=ri(i,o,t.x,t.y);(e==="gps"?n&&s>n||s>this.GpsMaxEstimateErr:s>this.MaxEstimateErr)?(this.outTrustRegionNum+=1,this.outTrustRegionNum>=this.TrustNum&&(console.info("\u8D85\u51FA\u53EF\u4FE1\u533A\u57DF\uFF0C\u91CD\u7F6E\u7C92\u5B50\u8FC7\u6EE4\u5668\u5230: "+t.x+", "+t.y),this.particleFilter.setPosInitFlag(!1),this.particleFilter.setYawInitFlag(!1),this.outTrustRegionNum=0,this.startTime=Date.now())):this.outTrustRegionNum=0}constructor(t){this.sigmaBeacon=5,this.gps_horizontalAccuracy=10,this.using_gps=!0,this.last_beacon_time=Date.now(),this.position_count=0,this.gps_max_horizontalAccuracy=20,this.MaxEstimateErr=5,this.GpsMaxEstimateErr=30,this.outTrustRegionNum=0,this.TrustNum=4,this.cacheSensorData=[],this.startTime=null;let e=v({},eR,t);this.using_gps=e.using_gps,this.gps_max_horizontalAccuracy=e.gps_max_horizontalAccuracy,this.particleFilter=new ru({NumParticle:200,reSampNumParticle:.65,initial_xy_uncertainty:12,initial_yaw_uncertainty:100,step_noise_sigma:.5,yaw_noise_sigma:2,compass_update_interval:3e3,sigmaCompass:80,delta_yaw:2,sigmaBeacon:5,unaccess_weight:.7}),this.pdr=new ou}};var zo=class extends Bt{checkSensor(){return this.sensor.checkSensor()}setSensor(t){this.sensor=t}start(){this.sensor.start(),this.pdr.startTime=Date.now(),this.sensor.addEventListener("add-data-item",t=>{let{item:e}=t;this.getPositionBySensorItem(e,!this._pause)})}pause(){this._pause=!0}continue(){this._pause=!1}getPositionBySensorItem(t,e){e===void 0&&(e=!0);let[n,i,o]=this.pdr.pfFusionPDRiBeacon(t);return n&&e&&this.dispatchEvent({type:"position",x:i,y:o,_type:t.type===Q.GPS?"gps":"pdr"}),[n,i,o]}setBeaconPosition(t,e){let[n,i]=this.pdr.setBeaconPosition(t,e);this.dispatchEvent({type:"position",x:n,y:i,_type:"beacon"})}dispose(){this.sensor.stop()}constructor(t={}){super(),this._pause=!1,this.sensor=new Ko(t.sensor),this.pdr=new su(t.pdr||{})}};var E5=d(I(),1),Y5=d(F(),1);var A5=d(I(),1),j5=d(F(),1),dt=T("three");var WT={texture_url:Wa,lineWidth:8,color:16777215},au=class extends dt.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:i}}}}}=this,o=t.map(a=>{let[u,l,c]=a;return E(new dt.Vector3(u,l,c),e,n,i)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return Xt(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new dt.Vector2(t,1)}loadTexture(t){return new Promise((e,n)=>{new dt.TextureLoader().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n]);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return A(this,null,function*(){let e=this.geometry=new Dt;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=dt.RepeatWrapping}let n=this.material=new yr({useMap:!0,color:new dt.Color(this.config.color),transparent:!0,resolution:new dt.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!0,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:dt.NormalBlending,repeat:new dt.Vector2(this.getRepeat(),1)}),i=this.mesh=new dt.Mesh(e,n);return i.renderOrder=9,this.add(i),i})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=WT,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:i}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,i)}},this.config=Object.assign({},WT,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var IT=T("@tweenjs/tween.js");var lt=T("three"),uu=class extends lt.Object3D{getBaseScale(t){let{clientSize:{width:e,height:n},camera:i}=this.bmap.context,o=new lt.Box3().setFromObject(t),{max:s,min:a}=o,u=new lt.Vector3(a.x,s.y,s.z),l=new lt.Vector3(s.x,s.y,s.z),c=new lt.Vector3(s.x,a.y,a.z),h=new lt.Vector3(a.x,a.y,a.z),p=E(u,i,e,n),f=E(l,i,e,n),g=E(h,i,e,n),y=E(c,i,e,n),j=new lt.Box2().setFromPoints([new lt.Vector2(p.x,p.y),new lt.Vector2(f.x,f.y),new lt.Vector2(g.x,g.y),new lt.Vector2(y.x,y.y)]).getSize(new lt.Vector2),b=40/j.x,w=40/j.y,C=Math.min(b,w),D=i.zoom;return C*D}registryEvent(){this.bmap.context.addEventListener("update",this._update),this.bmap.context.addEventListener("control-zoom-change",this._onChangeZoom)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this._update),this.bmap.context.removeEventListener("control-zoom-change",this._onChangeZoom)}printGraph(t){console.group(" <"+t.type+"> "+t.name),t.children.forEach(e=>this.printGraph(e)),console.groupEnd()}setClips(t){this.clearClips(),t.length&&(this.mixer=new lt.AnimationMixer(this.model.scene),t.forEach(e=>this.mixer.clipAction(e).play()))}startClips(){var t;this.setClips(((t=this.model)==null?void 0:t.animations)||[])}clearClips(){this.mixer&&(this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.mixer.getRoot()),this.mixer=null)}dispose(){this.unRegistryEvent(),this.clearClips(),this.clear(),this.model&&it(this.model.scene),this.bmap=null}constructor(t,e){super(),this.bmap=t,this.group=new lt.Object3D,this.mixer=null,this.previewTime=0,this.basicScale=1,this._update=()=>{let n=Date.now();if(!this.previewTime)this.previewTime=n;else{var i;let o=n-this.previewTime;this.previewTime=n,(i=this.mixer)==null||i.update(o/1e3)}},this._onChangeZoom=n=>{let{zoom:i}=n;var o;let s=this.basicScale/i;(o=this.model)==null||o.scene.scale.set(s,s,s)},this.add(this.group),Rt.loadModel(e,!1).then(n=>{this.model=n;let i=this.getBaseScale(n.scene);this.basicScale=i;let o=this.bmap.context.camera.zoom;n.scene.scale.set(i/o,i/o,i/o),this.group.add(n.scene),this.setClips(n.animations),this.group.rotation.set(Math.PI/2,Math.PI,0),this.dispatchEvent({type:"loaded"})}),this.registryEvent()}};var Uo=T("three"),ET=T("lodash");var Fh=class extends Kt{registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate)}pauseAnimation(){this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue()}clearTween(){this.tweenUtil.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate)}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.movedDistance=0,this.clearTween()),this.startModel&&(this.startModel.visible=!1),this.translatePath=null}addPath(t){this.paths=t;let e=t.map(n=>v({},n,{points:this.translatePoints(n.points)}));if(this.clearTween(),this.movedDistance=0,this.bmap.currentBuildGround)this.renderPath(e);else{let n=()=>{this.bmap.removeEventListener("center-change",n),this.renderPath(e)};this.bmap.addEventListener("center-change",n)}this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,n]=this.bmap.buildingCenter;return t.map(i=>[i[0]-e,i[1]-n])}renderPath(t){if(!t.length)return this.clearPath();let e=[];t.forEach((n,i,o)=>{let s=this.catmullRomCurve3(n.points),a=this.mulFloor.floors.find(u=>u.name===n.floor);if(e.push(...s.map(u=>{let[l,c]=u;return[l,c,a.position.z+a.groundMaxHeight]})),i!==o.length-1){let u=this.mulFloor.floors.find(l=>l.name===o[i+1].floor);e.push([...o[i+1].points[0],u.position.z])}}),this.cPath=e,this.animationPathOptions={cPathIndex:0},this.path?this.path.updatePoints(e):(this.path=new au(this),this.path.create(e),this.path.position.z=.5,this.bmap.context.scene.add(this.path)),this.startModel&&(this.startModel.position.set(e[0][0],e[0][1],e[0][2]),this.startModel.visible=!0),this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(t){return Ri(t,!1,!0,.1,170,2.5)}getPathDirection(t,e){if(t.length<2)return null;let n=Ue(t,e),i=t[n],o=t[n+1],s=new Uo.Vector3(o[0]-i[0],o[1]-i[1],0).normalize(),a=new Uo.Vector3(0,1,0).normalize(),u=s.angleTo(a),l=new Uo.Vector3().crossVectors(a,s);return(Object.is(l.y,0)?-1:1)*u}startSimulation(t){return A(this,null,function*(){t===void 0&&(t=1);let{paths:e,movedDistance:n}=this;if(!e.length)return;let i=e.reduce((s,a)=>s+a.distance,0);if(!i||n>=i)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let o=i/t;return this.startModel.startClips(),new Promise(s=>{let a=this.simulationTween=new IT.Tween({distance:this.movedDistance},this.tweenUtil.group).to({distance:i},o*1e3).onUpdate(u=>{var l;this.movedDistance=u.distance;let c=u.distance,h=0;for(let j=0;j<e.length;j++)if(e[j].distance>=c){h=j;break}else c-=e[j].distance;let p=qn(e[h].points,c);if(p===null)return;this.currentPathPosition=p;let f=this.translatePoints([p])[0],g=this.mulFloor.floors.find(j=>j.name===e[h].floor),y=g?g.position.z+g.groundMaxHeight:(l=this.startModel)==null?void 0:l.position.z;this.startModel&&this.startModel.position.set(f[0],f[1],y);let P=this.getPathDirection(e[h].points,p);(0,ET.isNil)(P)||this.startModel.setRotationFromAxisAngle(new Uo.Vector3(0,0,1),P)}).onComplete(()=>{this.tweenUtil.remove(a),this.startModel.clearClips(),s(!0)}).start()})})}setStartPoiRotate(t){if(this.startPoi){let n=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(360-t-n)%360}}dispose(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.startModel&&(this.bmap.context.scene.remove(this.startModel),this.startModel.dispose()),this.tweenUtil.dispose(),this.unRegistryEvent(),super.dispose()}constructor(t,e){super(t),this.mulFloor=e,this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.pathTween=null,this.startPoi=null,this.movedDistance=0,this.tweenUtil=new sn,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onUpdate=()=>{this.tweenUtil.update()},this.startModel=new uu(t,S1),this.startModel.visible=!1,this.bmap.context.scene.add(this.startModel),this.registryEvent()}};var lu=T("three");var Kh=class extends Kt{registryEvent(){this.clickHelper.addEventListener("click",this._click)}unRegistryEvent(){this.clickHelper.removeEventListener("click",this._click)}dispose(){this.unRegistryEvent(),this.clickHelper.dispose(),this.mulFloors=null,super.dispose()}constructor(t,e){super(t),this.mulFloors=e,this._click=n=>{let{e:i}=n;if(!this.mulFloors.showStatus)return;let o=new lu.Vector2,{offsetX:s,offsetY:a}=i,{clientSize:u}=this.bmap.context;o.x=s/u.width*2-1,o.y=a/u.height*-2+1;let l=new lu.Raycaster;l.setFromCamera(o,this.bmap.context.camera),l.ray.origin.sub(l.ray.direction.clone().multiplyScalar(1e4));let h=this.mulFloors.poiLayer.pois.map(f=>{if(!f.canSelect)return null;let g=l.intersectObjects(f.children,!0);return g.length?g[0]:null}).reduce((f,g)=>g&&(!f||g.distance<f.distance)?g:f,null),p=h==null?void 0:h.object;h&&h.object.isSprite&&(p=h.object.parent),p&&p instanceof ut&&this.dispatchEvent({type:"select",pois:[p]})},this.clickHelper=new Ni(this.bmap.context.container),this.registryEvent()}};var nQ=d(YT(),1),rQ=d(DT(),1),iQ=d(F(),1);var B5=d(I(),1),H5=d(F(),1),Q5=d(wr(),1),ii=T("three");function uR(r){let t=r.length,e=0,n=0,i=0,o=0;r.forEach(u=>{e+=u[0],n+=u[1],i+=u[0]*u[1],o+=u[0]*u[0]});let s=(t*i-e*n)/(t*o-e*e),a=(n-s*e)/t;return{m:s,b:a}}function lR(r,t,e){let n=e[0][0],i=e.slice(-1)[0][0],o=r*n+t,s=r*i+t;return{start:[n,o],end:[i,s]}}function Go(r){if(r.length<2)return null;let t=r.filter((u,l)=>{let c=[...r];return c.splice(l,1),c.every(h=>h[0]!==u[0]&&h[1]!==u[1])});if(t.length<2)return null;let{m:e,b:n}=uR(t),{start:i,end:o}=lR(e,n,t),a=360-(new ii.Vector2().subVectors(new ii.Vector2(o[0],o[1]),new ii.Vector2(i[0],i[1])).angle()/Math.PI*180-90+360)%360;return Number.isNaN(a)?null:a}function cR(r){let t=[];for(let e=1;e<r.length;e++){let n=r[e-1],i=r[e],o=i.position[0]-n.position[0],s=i.position[1]-n.position[1],a=Math.sqrt(o**2+s**2),u=i.time-n.time;if(u>0){let l=a/u;console.log("speedDelta",n.type,i.type,cu(l),a,u),t.push(l)}else t.push(0)}return t}function hR(r,t){let e=r[0],n=r.slice(-1)[0],i=G(n.position,e.position),o=n.time-e.time;return o<100||i<3?null:i/o}function cu(r){return r*60*60}function oi(r,t,e,n){let i=(e+90)%360*(Math.PI/180),o=t*n,s=new ii.Vector2(r[0],r[1]),a=Math.cos(i),u=Math.sin(i),l=new ii.Vector2(a,u);return s.add(l.normalize().multiplyScalar(o)),[s.x,s.y]}function pR(r){let t=[...r].sort((l,c)=>l-c),e=CT(t,25),n=CT(t,75),i=n-e,o=e-1.5*i,s=n+1.5*i,a=t.filter(l=>l>=o&&l<=s);return r.filter(l=>a.includes(l))}function CT(r,t){let e=t/100*(r.length-1),n=Math.floor(e),i=Math.ceil(e);if(n===i)return r[n];let o=e-n;return r[n]*(1-o)+r[i]*o}var hu=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 ko=T("lodash"),Vo=class extends Bt{setPathAngle(t){this.pathAngle=t,this.dispatchEvent({type:"change-compass",value:this.pathAngle}),(0,ko.isNil)(this.angle)&&(this.angle=t)}changeSpeed(){let t=this.history.filter(u=>["vision"].includes(u.type));if(t.length<2){this.speedFilter.filter(0),this.speed=0;return}let e=t[0],n=t.slice(-1)[0],i=G(n.position,e.position),o=n.time-e.time,s=o>0?i/o:0,a=this.speedFilter.filter(s);this.speed=a}changeAngle(t){t===void 0&&(t=this.visionHistory),t.length<2&&(this.angle=null);let e=Go(t.map(n=>n.position));e!==null&&this.setAngle(e)}setAngle(t,e){e===void 0&&(e=!0),this.angle=t,e&&this.dispatchEvent({type:"change-position-compass",value:t})}setPosition(t,e,n){let i={position:t,time:e,clientTime:Date.now()-n,type:"vision"};if(this._setVisionHistoryForAngle(i),(0,ko.isNil)(this.angle)||!this.speed){this.addHistory(i);return}let o=this.history.findLastIndex(a=>a.type==="vision"),s=this.history[o];if(s){if(s.time>e)return;let a=Go([this.history.slice(-1)[0].position,t]);if(a&&Math.abs(a-this.angle)<60){this.addHistory(i);return}let u=oi(t,this.speed,360-this.pathAngle,n);G(u,this.history.slice(-1)[0].position)>5?this.visionExcessesCount++:this.visionExcessesCount=0,this.visionExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21\u89C6\u89C9\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528\u89C6\u89C9\u6821\u51C6"),this.addHistory(i),this.visionExcessesCount=0)}}resetPdrPosition(){let t=this.history.findLast(e=>e.type==="vision");if(t&&this.speed){let e=oi(t.position,this.speed,360-this.pathAngle,Date.now()-t.clientTime);e&&this.history.push({position:e,time:Date.now(),clientTime:Date.now(),type:"pdr"})}}getLastVisionPdrPos(){let t=this.history.findLastIndex(n=>n.type==="vision");if(t!==-1){var e;return(e=this.history[t+1])!=null?e:this.history[t]}return null}_setVisionHistoryForAngle(t){if(!this.visionHistory.length){this.visionHistory.push(t);return}let e=Go([this.visionHistory.slice(-1)[0].position,t.position]);if(e!==null&&(this.angle&&Math.abs(this.angle-e)>60?this.angleExcessesCount++:(this.angleExcessesCount=0,this.visionHistory.push(t))),this.angleExcessesCount>3)console.warn("\u8FDE\u7EED\u4E09\u6B21\u89D2\u5EA6\u6BD4\u8F83\u6B6A\uFF0C\u91CD\u65B0\u77EB\u6B63"),this.visionHistory=[t],this.angleExcessesCount=0;else{let n=G(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position);for(;n>5&&this.visionHistory.length>15;)this.visionHistory.shift(),n=G(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position)}this.changeAngle()}addHistory(t){this.history.push(t);let e=this.history.filter(a=>a.type==="vision"),n=e.length?Date.now()-e.slice(-1)[0].clientTime:0,i=G(this.history[0].position,this.history.slice(-1)[0].position),o=n>5e3?10:3,s=n>5e3?0:5;for(n>5e3&&console.warn("\u89C6\u89C9\u7ED3\u679C\u8D85\u51FA5s\u4E0D\u53EF\u7528\uFF0C\u5168\u90E8\u6E05\u7A7A");e.length>s&&i>o;)this.history.shift(),e=this.history.filter(a=>a.type==="vision"),i=G(this.history[0].position,this.history.slice(-1)[0].position);s===0?this.changeSpeed():t.type==="vision"&&this.changeSpeed(),this.changePosition(t.type)}setBeaconPosition(t,e,n){let i=Date.now()-n,o={position:t,time:e,clientTime:i,type:"beacon"},s=this.history.findLastIndex(c=>c.type!=="pdr"),a=this.history[s];if(!a){this.addHistory(o);return}if((0,ko.isNil)(this.pathAngle)||!this.speed){this.addHistory(o);return}if(a&&a.time>e)return;let u=oi(t,this.speed,360-this.pathAngle,n);G(u,this.history.slice(-1)[0].position)>5?this.beaconExcessesCount++:this.beaconExcessesCount=0,this.beaconExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21beacon\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528beacon\u6821\u51C6"),this.addHistory(o),this.beaconExcessesCount=0)}startPositionTimer(){this.positionTimer&&this.timer.clearInterval(this.positionTimer),this.positionTimer=this.timer.setInterval(()=>{this.changePosition()},20)}stopPositionTimer(){this.positionTimer&&(this.timer.clearInterval(this.positionTimer),this.positionTimer=null)}changePosition(t){t===void 0&&(t="pdr");let e=this.getPosition(t);e.success&&(this.history.push({position:e.pos,time:Date.now(),clientTime:Date.now(),type:"pdr"}),this.speed?this.dispatchEvent({type:"change-pos",value:v({},e)}):this.dispatchEvent({type:"change-pos",value:e}))}getPosition(t){if(this.history.length===0)return{success:!1,pos:[0,0],compass:null,speed:0};let e=this.history.slice(-1)[0];if(this.history.length<2)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};if((0,ko.isNil)(this.pathAngle)||!this.speed)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};let n=e.clientTime,i=Date.now()-n;return{success:!0,pos:this.pathAngle?oi(e.position,this.speed,360-this.pathAngle,i):e.position,compass:this.pathAngle,speed:cu(this.speed)}}dispose(){this.timer.dispose()}constructor(){super(),this.history=[],this.visionHistory=[],this.speed=0,this.angle=null,this.timer=new J,this.positionTimer=null,this.speedFilter=new hu,this.visionExcessesCount=0,this.beaconExcessesCount=0,this.angleExcessesCount=0,this.pathAngle=0,this.startPositionTimer()}};var hQ=d(Vn(),1);function Nh(){let r=new Blob([`var aU=Object.create;var iE=Object.defineProperty;var uU=Object.getOwnPropertyDescriptor;var lU=Object.getOwnPropertyNames;var cU=Object.getPrototypeOf,fU=Object.prototype.hasOwnProperty;var st=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var hU=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of lU(t))!fU.call(n,s)&&s!==e&&iE(n,s,{get:()=>t[s],enumerable:!(o=uU(t,s))||o.enumerable});return n};var on=(n,t,e)=>(e=n!=null?aU(cU(n)):{},hU(t||!n||!n.__esModule?iE(e,"default",{value:n,enumerable:!0}):e,n));var ec=(n,t,e)=>new Promise((o,s)=>{var c=g=>{try{p(e.next(g))}catch(m){s(m)}},h=g=>{try{p(e.throw(g))}catch(m){s(m)}},p=g=>g.done?o(g.value):Promise.resolve(g.value).then(c,h);p((e=e.apply(n,t)).next())});var oo=st((Nm,oE)=>{"use strict";var Rf=function(n){return n&&n.Math===Math&&n};oE.exports=Rf(typeof globalThis=="object"&&globalThis)||Rf(typeof window=="object"&&window)||Rf(typeof self=="object"&&self)||Rf(typeof global=="object"&&global)||Rf(typeof Nm=="object"&&Nm)||function(){return this}()||Function("return this")()});var gi=st((GK,sE)=>{"use strict";sE.exports=function(n){try{return!!n()}catch(t){return!0}}});var Xs=st((kK,aE)=>{"use strict";var pU=gi();aE.exports=!pU(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Lf=st((qK,uE)=>{"use strict";var dU=gi();uE.exports=!dU(function(){var n=function(){}.bind();return typeof n!="function"||n.hasOwnProperty("prototype")})});var Is=st((HK,lE)=>{"use strict";var gU=Lf(),sp=Function.prototype.call;lE.exports=gU?sp.bind(sp):function(){return sp.apply(sp,arguments)}});var pE=st(hE=>{"use strict";var cE={}.propertyIsEnumerable,fE=Object.getOwnPropertyDescriptor,mU=fE&&!cE.call({1:2},1);hE.f=mU?function(t){var e=fE(this,t);return!!e&&e.enumerable}:cE});var ap=st((WK,dE)=>{"use strict";dE.exports=function(n,t){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:t}}});var mi=st((XK,yE)=>{"use strict";var gE=Lf(),mE=Function.prototype,Om=mE.call,yU=gE&&mE.bind.bind(Om,Om);yE.exports=gE?yU:function(n){return function(){return Om.apply(n,arguments)}}});var nc=st((YK,_E)=>{"use strict";var vE=mi(),vU=vE({}.toString),_U=vE("".slice);_E.exports=function(n){return _U(vU(n),8,-1)}});var EE=st(($K,xE)=>{"use strict";var xU=mi(),EU=gi(),wU=nc(),Dm=Object,SU=xU("".split);xE.exports=EU(function(){return!Dm("z").propertyIsEnumerable(0)})?function(n){return wU(n)==="String"?SU(n,""):Dm(n)}:Dm});var up=st((ZK,wE)=>{"use strict";wE.exports=function(n){return n==null}});var rc=st((JK,SE)=>{"use strict";var MU=up(),bU=TypeError;SE.exports=function(n){if(MU(n))throw new bU("Can't call method on "+n);return n}});var ic=st((KK,ME)=>{"use strict";var AU=EE(),TU=rc();ME.exports=function(n){return AU(TU(n))}});var Di=st((jK,bE)=>{"use strict";var Fm=typeof document=="object"&&document.all;bE.exports=typeof Fm=="undefined"&&Fm!==void 0?function(n){return typeof n=="function"||n===Fm}:function(n){return typeof n=="function"}});var wa=st((QK,AE)=>{"use strict";var CU=Di();AE.exports=function(n){return typeof n=="object"?n!==null:CU(n)}});var oc=st((tj,TE)=>{"use strict";var Um=oo(),PU=Di(),IU=function(n){return PU(n)?n:void 0};TE.exports=function(n,t){return arguments.length<2?IU(Um[n]):Um[n]&&Um[n][t]}});var PE=st((ej,CE)=>{"use strict";var RU=mi();CE.exports=RU({}.isPrototypeOf)});var NE=st((nj,LE)=>{"use strict";var LU=oo(),IE=LU.navigator,RE=IE&&IE.userAgent;LE.exports=RE?String(RE):""});var GE=st((rj,zE)=>{"use strict";var BE=oo(),Bm=NE(),OE=BE.process,DE=BE.Deno,FE=OE&&OE.versions||DE&&DE.version,UE=FE&&FE.v8,Ys,lp;UE&&(Ys=UE.split("."),lp=Ys[0]>0&&Ys[0]<4?1:+(Ys[0]+Ys[1]));!lp&&Bm&&(Ys=Bm.match(/Edge\\/(\\d+)/),(!Ys||Ys[1]>=74)&&(Ys=Bm.match(/Chrome\\/(\\d+)/),Ys&&(lp=+Ys[1])));zE.exports=lp});var zm=st((ij,qE)=>{"use strict";var kE=GE(),NU=gi(),OU=oo(),DU=OU.String;qE.exports=!!Object.getOwnPropertySymbols&&!NU(function(){var n=Symbol("symbol detection");return!DU(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&kE&&kE<41})});var Gm=st((oj,HE)=>{"use strict";var FU=zm();HE.exports=FU&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var km=st((sj,VE)=>{"use strict";var UU=oc(),BU=Di(),zU=PE(),GU=Gm(),kU=Object;VE.exports=GU?function(n){return typeof n=="symbol"}:function(n){var t=UU("Symbol");return BU(t)&&zU(t.prototype,kU(n))}});var XE=st((aj,WE)=>{"use strict";var qU=String;WE.exports=function(n){try{return qU(n)}catch(t){return"Object"}}});var Nf=st((uj,YE)=>{"use strict";var HU=Di(),VU=XE(),WU=TypeError;YE.exports=function(n){if(HU(n))return n;throw new WU(VU(n)+" is not a function")}});var cp=st((lj,$E)=>{"use strict";var XU=Nf(),YU=up();$E.exports=function(n,t){var e=n[t];return YU(e)?void 0:XU(e)}});var JE=st((cj,ZE)=>{"use strict";var qm=Is(),Hm=Di(),Vm=wa(),$U=TypeError;ZE.exports=function(n,t){var e,o;if(t==="string"&&Hm(e=n.toString)&&!Vm(o=qm(e,n))||Hm(e=n.valueOf)&&!Vm(o=qm(e,n))||t!=="string"&&Hm(e=n.toString)&&!Vm(o=qm(e,n)))return o;throw new $U("Can't convert object to primitive value")}});var Of=st((fj,KE)=>{"use strict";KE.exports=!1});var fp=st((hj,QE)=>{"use strict";var jE=oo(),ZU=Object.defineProperty;QE.exports=function(n,t){try{ZU(jE,n,{value:t,configurable:!0,writable:!0})}catch(e){jE[n]=t}return t}});var hp=st((pj,nw)=>{"use strict";var JU=Of(),KU=oo(),jU=fp(),tw="__core-js_shared__",ew=nw.exports=KU[tw]||jU(tw,{});(ew.versions||(ew.versions=[])).push({version:"3.40.0",mode:JU?"pure":"global",copyright:"\\xA9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.40.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var pp=st((dj,iw)=>{"use strict";var rw=hp();iw.exports=function(n,t){return rw[n]||(rw[n]=t||{})}});var sc=st((gj,ow)=>{"use strict";var QU=rc(),tB=Object;ow.exports=function(n){return tB(QU(n))}});var Sa=st((mj,sw)=>{"use strict";var eB=mi(),nB=sc(),rB=eB({}.hasOwnProperty);sw.exports=Object.hasOwn||function(t,e){return rB(nB(t),e)}});var Wm=st((yj,aw)=>{"use strict";var iB=mi(),oB=0,sB=Math.random(),aB=iB(1 .toString);aw.exports=function(n){return"Symbol("+(n===void 0?"":n)+")_"+aB(++oB+sB,36)}});var Rs=st((vj,lw)=>{"use strict";var uB=oo(),lB=pp(),uw=Sa(),cB=Wm(),fB=zm(),hB=Gm(),ac=uB.Symbol,Xm=lB("wks"),pB=hB?ac.for||ac:ac&&ac.withoutSetter||cB;lw.exports=function(n){return uw(Xm,n)||(Xm[n]=fB&&uw(ac,n)?ac[n]:pB("Symbol."+n)),Xm[n]}});var pw=st((_j,hw)=>{"use strict";var dB=Is(),cw=wa(),fw=km(),gB=cp(),mB=JE(),yB=Rs(),vB=TypeError,_B=yB("toPrimitive");hw.exports=function(n,t){if(!cw(n)||fw(n))return n;var e=gB(n,_B),o;if(e){if(t===void 0&&(t="default"),o=dB(e,n,t),!cw(o)||fw(o))return o;throw new vB("Can't convert object to primitive value")}return t===void 0&&(t="number"),mB(n,t)}});var Ym=st((xj,dw)=>{"use strict";var xB=pw(),EB=km();dw.exports=function(n){var t=xB(n,"string");return EB(t)?t:t+""}});var dp=st((Ej,mw)=>{"use strict";var wB=oo(),gw=wa(),$m=wB.document,SB=gw($m)&&gw($m.createElement);mw.exports=function(n){return SB?$m.createElement(n):{}}});var Zm=st((wj,yw)=>{"use strict";var MB=Xs(),bB=gi(),AB=dp();yw.exports=!MB&&!bB(function(){return Object.defineProperty(AB("div"),"a",{get:function(){return 7}}).a!==7})});var Jm=st(_w=>{"use strict";var TB=Xs(),CB=Is(),PB=pE(),IB=ap(),RB=ic(),LB=Ym(),NB=Sa(),OB=Zm(),vw=Object.getOwnPropertyDescriptor;_w.f=TB?vw:function(t,e){if(t=RB(t),e=LB(e),OB)try{return vw(t,e)}catch(o){}if(NB(t,e))return IB(!CB(PB.f,t,e),t[e])}});var Km=st((Mj,xw)=>{"use strict";var DB=Xs(),FB=gi();xw.exports=DB&&FB(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Ma=st((bj,Ew)=>{"use strict";var UB=wa(),BB=String,zB=TypeError;Ew.exports=function(n){if(UB(n))return n;throw new zB(BB(n)+" is not an object")}});var Pu=st(Sw=>{"use strict";var GB=Xs(),kB=Zm(),qB=Km(),gp=Ma(),ww=Ym(),HB=TypeError,jm=Object.defineProperty,VB=Object.getOwnPropertyDescriptor,Qm="enumerable",t0="configurable",e0="writable";Sw.f=GB?qB?function(t,e,o){if(gp(t),e=ww(e),gp(o),typeof t=="function"&&e==="prototype"&&"value"in o&&e0 in o&&!o[e0]){var s=VB(t,e);s&&s[e0]&&(t[e]=o.value,o={configurable:t0 in o?o[t0]:s[t0],enumerable:Qm in o?o[Qm]:s[Qm],writable:!1})}return jm(t,e,o)}:jm:function(t,e,o){if(gp(t),e=ww(e),gp(o),kB)try{return jm(t,e,o)}catch(s){}if("get"in o||"set"in o)throw new HB("Accessors not supported");return"value"in o&&(t[e]=o.value),t}});var uc=st((Tj,Mw)=>{"use strict";var WB=Xs(),XB=Pu(),YB=ap();Mw.exports=WB?function(n,t,e){return XB.f(n,t,YB(1,e))}:function(n,t,e){return n[t]=e,n}});var i0=st((Cj,Aw)=>{"use strict";var n0=Xs(),$B=Sa(),bw=Function.prototype,ZB=n0&&Object.getOwnPropertyDescriptor,r0=$B(bw,"name"),JB=r0&&function(){}.name==="something",KB=r0&&(!n0||n0&&ZB(bw,"name").configurable);Aw.exports={EXISTS:r0,PROPER:JB,CONFIGURABLE:KB}});var s0=st((Pj,Tw)=>{"use strict";var jB=mi(),QB=Di(),o0=hp(),tz=jB(Function.toString);QB(o0.inspectSource)||(o0.inspectSource=function(n){return tz(n)});Tw.exports=o0.inspectSource});var Iw=st((Ij,Pw)=>{"use strict";var ez=oo(),nz=Di(),Cw=ez.WeakMap;Pw.exports=nz(Cw)&&/native code/.test(String(Cw))});var mp=st((Rj,Lw)=>{"use strict";var rz=pp(),iz=Wm(),Rw=rz("keys");Lw.exports=function(n){return Rw[n]||(Rw[n]=iz(n))}});var yp=st((Lj,Nw)=>{"use strict";Nw.exports={}});var xp=st((Nj,Fw)=>{"use strict";var oz=Iw(),Dw=oo(),sz=wa(),az=uc(),a0=Sa(),u0=hp(),uz=mp(),lz=yp(),Ow="Object already initialized",l0=Dw.TypeError,cz=Dw.WeakMap,vp,Df,_p,fz=function(n){return _p(n)?Df(n):vp(n,{})},hz=function(n){return function(t){var e;if(!sz(t)||(e=Df(t)).type!==n)throw new l0("Incompatible receiver, "+n+" required");return e}};oz||u0.state?($s=u0.state||(u0.state=new cz),$s.get=$s.get,$s.has=$s.has,$s.set=$s.set,vp=function(n,t){if($s.has(n))throw new l0(Ow);return t.facade=n,$s.set(n,t),t},Df=function(n){return $s.get(n)||{}},_p=function(n){return $s.has(n)}):(ml=uz("state"),lz[ml]=!0,vp=function(n,t){if(a0(n,ml))throw new l0(Ow);return t.facade=n,az(n,ml,t),t},Df=function(n){return a0(n,ml)?n[ml]:{}},_p=function(n){return a0(n,ml)});var $s,ml;Fw.exports={set:vp,get:Df,has:_p,enforce:fz,getterFor:hz}});var Gw=st((Oj,zw)=>{"use strict";var f0=mi(),pz=gi(),dz=Di(),Ep=Sa(),c0=Xs(),gz=i0().CONFIGURABLE,mz=s0(),Bw=xp(),yz=Bw.enforce,vz=Bw.get,Uw=String,wp=Object.defineProperty,_z=f0("".slice),xz=f0("".replace),Ez=f0([].join),wz=c0&&!pz(function(){return wp(function(){},"length",{value:8}).length!==8}),Sz=String(String).split("String"),Mz=zw.exports=function(n,t,e){_z(Uw(t),0,7)==="Symbol("&&(t="["+xz(Uw(t),/^Symbol\\(([^)]*)\\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!Ep(n,"name")||gz&&n.name!==t)&&(c0?wp(n,"name",{value:t,configurable:!0}):n.name=t),wz&&e&&Ep(e,"arity")&&n.length!==e.arity&&wp(n,"length",{value:e.arity});try{e&&Ep(e,"constructor")&&e.constructor?c0&&wp(n,"prototype",{writable:!1}):n.prototype&&(n.prototype=void 0)}catch(s){}var o=yz(n);return Ep(o,"source")||(o.source=Ez(Sz,typeof t=="string"?t:"")),n};Function.prototype.toString=Mz(function(){return dz(this)&&vz(this).source||mz(this)},"toString")});var Ff=st((Dj,kw)=>{"use strict";var bz=Di(),Az=Pu(),Tz=Gw(),Cz=fp();kw.exports=function(n,t,e,o){o||(o={});var s=o.enumerable,c=o.name!==void 0?o.name:t;if(bz(e)&&Tz(e,c,o),o.global)s?n[t]=e:Cz(t,e);else{try{o.unsafe?n[t]&&(s=!0):delete n[t]}catch(h){}s?n[t]=e:Az.f(n,t,{value:e,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return n}});var Hw=st((Fj,qw)=>{"use strict";var Pz=Math.ceil,Iz=Math.floor;qw.exports=Math.trunc||function(t){var e=+t;return(e>0?Iz:Pz)(e)}});var yl=st((Uj,Vw)=>{"use strict";var Rz=Hw();Vw.exports=function(n){var t=+n;return t!==t||t===0?0:Rz(t)}});var Xw=st((Bj,Ww)=>{"use strict";var Lz=yl(),Nz=Math.max,Oz=Math.min;Ww.exports=function(n,t){var e=Lz(n);return e<0?Nz(e+t,0):Oz(e,t)}});var h0=st((zj,Yw)=>{"use strict";var Dz=yl(),Fz=Math.min;Yw.exports=function(n){var t=Dz(n);return t>0?Fz(t,9007199254740991):0}});var Uf=st((Gj,$w)=>{"use strict";var Uz=h0();$w.exports=function(n){return Uz(n.length)}});var Kw=st((kj,Jw)=>{"use strict";var Bz=ic(),zz=Xw(),Gz=Uf(),Zw=function(n){return function(t,e,o){var s=Bz(t),c=Gz(s);if(c===0)return!n&&-1;var h=zz(o,c),p;if(n&&e!==e){for(;c>h;)if(p=s[h++],p!==p)return!0}else for(;c>h;h++)if((n||h in s)&&s[h]===e)return n||h||0;return!n&&-1}};Jw.exports={includes:Zw(!0),indexOf:Zw(!1)}});var d0=st((qj,Qw)=>{"use strict";var kz=mi(),p0=Sa(),qz=ic(),Hz=Kw().indexOf,Vz=yp(),jw=kz([].push);Qw.exports=function(n,t){var e=qz(n),o=0,s=[],c;for(c in e)!p0(Vz,c)&&p0(e,c)&&jw(s,c);for(;t.length>o;)p0(e,c=t[o++])&&(~Hz(s,c)||jw(s,c));return s}});var Sp=st((Hj,tS)=>{"use strict";tS.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var nS=st(eS=>{"use strict";var Wz=d0(),Xz=Sp(),Yz=Xz.concat("length","prototype");eS.f=Object.getOwnPropertyNames||function(t){return Wz(t,Yz)}});var iS=st(rS=>{"use strict";rS.f=Object.getOwnPropertySymbols});var sS=st((Xj,oS)=>{"use strict";var $z=oc(),Zz=mi(),Jz=nS(),Kz=iS(),jz=Ma(),Qz=Zz([].concat);oS.exports=$z("Reflect","ownKeys")||function(t){var e=Jz.f(jz(t)),o=Kz.f;return o?Qz(e,o(t)):e}});var lS=st((Yj,uS)=>{"use strict";var aS=Sa(),tG=sS(),eG=Jm(),nG=Pu();uS.exports=function(n,t,e){for(var o=tG(t),s=nG.f,c=eG.f,h=0;h<o.length;h++){var p=o[h];!aS(n,p)&&!(e&&aS(e,p))&&s(n,p,c(t,p))}}});var fS=st(($j,cS)=>{"use strict";var rG=gi(),iG=Di(),oG=/#|\\.prototype\\./,Bf=function(n,t){var e=aG[sG(n)];return e===lG?!0:e===uG?!1:iG(t)?rG(t):!!t},sG=Bf.normalize=function(n){return String(n).replace(oG,".").toLowerCase()},aG=Bf.data={},uG=Bf.NATIVE="N",lG=Bf.POLYFILL="P";cS.exports=Bf});var Ls=st((Zj,hS)=>{"use strict";var Mp=oo(),cG=Jm().f,fG=uc(),hG=Ff(),pG=fp(),dG=lS(),gG=fS();hS.exports=function(n,t){var e=n.target,o=n.global,s=n.stat,c,h,p,g,m,v;if(o?h=Mp:s?h=Mp[e]||pG(e,{}):h=Mp[e]&&Mp[e].prototype,h)for(p in t){if(m=t[p],n.dontCallGetSet?(v=cG(h,p),g=v&&v.value):g=h[p],c=gG(o?p:e+(s?".":"#")+p,n.forced),!c&&g!==void 0){if(typeof m==typeof g)continue;dG(m,g)}(n.sham||g&&g.sham)&&fG(m,"sham",!0),hG(h,p,m,n)}}});var bp=st((Jj,pS)=>{"use strict";var mG=nc();pS.exports=Array.isArray||function(t){return mG(t)==="Array"}});var gS=st((Kj,dS)=>{"use strict";var yG=Xs(),vG=bp(),_G=TypeError,xG=Object.getOwnPropertyDescriptor,EG=yG&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(n){return n instanceof TypeError}}();dS.exports=EG?function(n,t){if(vG(n)&&!xG(n,"length").writable)throw new _G("Cannot set read only .length");return n.length=t}:function(n,t){return n.length=t}});var g0=st((jj,mS)=>{"use strict";var wG=TypeError,SG=9007199254740991;mS.exports=function(n){if(n>SG)throw wG("Maximum allowed index exceeded");return n}});var m0=st(()=>{"use strict";var MG=Ls(),bG=sc(),AG=Uf(),TG=gS(),CG=g0(),PG=gi(),IG=PG(function(){return[].push.call({length:4294967296},1)!==4294967297}),RG=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(n){return n instanceof TypeError}},LG=IG||!RG();MG({target:"Array",proto:!0,arity:1,forced:LG},{push:function(t){var e=bG(this),o=AG(e),s=arguments.length;CG(o+s);for(var c=0;c<s;c++)e[o]=arguments[c],o++;return TG(e,o),o}})});var vS=st((nQ,yS)=>{"use strict";yS.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 ES=st((rQ,xS)=>{"use strict";var NG=dp(),y0=NG("span").classList,_S=y0&&y0.constructor&&y0.constructor.prototype;xS.exports=_S===Object.prototype?void 0:_S});var SS=st((iQ,wS)=>{"use strict";var OG=d0(),DG=Sp();wS.exports=Object.keys||function(t){return OG(t,DG)}});var bS=st(MS=>{"use strict";var FG=Xs(),UG=Km(),BG=Pu(),zG=Ma(),GG=ic(),kG=SS();MS.f=FG&&!UG?Object.defineProperties:function(t,e){zG(t);for(var o=GG(e),s=kG(e),c=s.length,h=0,p;c>h;)BG.f(t,p=s[h++],o[p]);return t}});var TS=st((sQ,AS)=>{"use strict";var qG=oc();AS.exports=qG("document","documentElement")});var zf=st((aQ,OS)=>{"use strict";var HG=Ma(),VG=bS(),CS=Sp(),WG=yp(),XG=TS(),YG=dp(),$G=mp(),PS=">",IS="<",_0="prototype",x0="script",LS=$G("IE_PROTO"),v0=function(){},NS=function(n){return IS+x0+PS+n+IS+"/"+x0+PS},RS=function(n){n.write(NS("")),n.close();var t=n.parentWindow.Object;return n=null,t},ZG=function(){var n=YG("iframe"),t="java"+x0+":",e;return n.style.display="none",XG.appendChild(n),n.src=String(t),e=n.contentWindow.document,e.open(),e.write(NS("document.F=Object")),e.close(),e.F},Ap,Tp=function(){try{Ap=new ActiveXObject("htmlfile")}catch(t){}Tp=typeof document!="undefined"?document.domain&&Ap?RS(Ap):ZG():RS(Ap);for(var n=CS.length;n--;)delete Tp[_0][CS[n]];return Tp()};WG[LS]=!0;OS.exports=Object.create||function(t,e){var o;return t!==null?(v0[_0]=HG(t),o=new v0,v0[_0]=null,o[LS]=t):o=Tp(),e===void 0?o:VG.f(o,e)}});var S0=st((uQ,DS)=>{"use strict";var JG=Rs(),KG=zf(),jG=Pu().f,E0=JG("unscopables"),w0=Array.prototype;w0[E0]===void 0&&jG(w0,E0,{configurable:!0,value:KG(null)});DS.exports=function(n){w0[E0][n]=!0}});var Cp=st((lQ,FS)=>{"use strict";FS.exports={}});var BS=st((cQ,US)=>{"use strict";var QG=gi();US.exports=!QG(function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype})});var b0=st((fQ,GS)=>{"use strict";var t4=Sa(),e4=Di(),n4=sc(),r4=mp(),i4=BS(),zS=r4("IE_PROTO"),M0=Object,o4=M0.prototype;GS.exports=i4?M0.getPrototypeOf:function(n){var t=n4(n);if(t4(t,zS))return t[zS];var e=t.constructor;return e4(e)&&t instanceof e?e.prototype:t instanceof M0?o4:null}});var P0=st((hQ,HS)=>{"use strict";var s4=gi(),a4=Di(),u4=wa(),l4=zf(),kS=b0(),c4=Ff(),f4=Rs(),h4=Of(),C0=f4("iterator"),qS=!1,tu,A0,T0;[].keys&&(T0=[].keys(),"next"in T0?(A0=kS(kS(T0)),A0!==Object.prototype&&(tu=A0)):qS=!0);var p4=!u4(tu)||s4(function(){var n={};return tu[C0].call(n)!==n});p4?tu={}:h4&&(tu=l4(tu));a4(tu[C0])||c4(tu,C0,function(){return this});HS.exports={IteratorPrototype:tu,BUGGY_SAFARI_ITERATORS:qS}});var Pp=st((pQ,WS)=>{"use strict";var d4=Pu().f,g4=Sa(),m4=Rs(),VS=m4("toStringTag");WS.exports=function(n,t,e){n&&!e&&(n=n.prototype),n&&!g4(n,VS)&&d4(n,VS,{configurable:!0,value:t})}});var YS=st((dQ,XS)=>{"use strict";var y4=P0().IteratorPrototype,v4=zf(),_4=ap(),x4=Pp(),E4=Cp(),w4=function(){return this};XS.exports=function(n,t,e,o){var s=t+" Iterator";return n.prototype=v4(y4,{next:_4(+!o,e)}),x4(n,s,!1,!0),E4[s]=w4,n}});var I0=st((gQ,$S)=>{"use strict";var S4=mi(),M4=Nf();$S.exports=function(n,t,e){try{return S4(M4(Object.getOwnPropertyDescriptor(n,t)[e]))}catch(o){}}});var JS=st((mQ,ZS)=>{"use strict";var b4=wa();ZS.exports=function(n){return b4(n)||n===null}});var jS=st((yQ,KS)=>{"use strict";var A4=JS(),T4=String,C4=TypeError;KS.exports=function(n){if(A4(n))return n;throw new C4("Can't set "+T4(n)+" as a prototype")}});var tM=st((vQ,QS)=>{"use strict";var P4=I0(),I4=wa(),R4=rc(),L4=jS();QS.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n=!1,t={},e;try{e=P4(Object.prototype,"__proto__","set"),e(t,[]),n=t instanceof Array}catch(o){}return function(s,c){return R4(s),L4(c),I4(s)&&(n?e(s,c):s.__proto__=c),s}}():void 0)});var fM=st((_Q,cM)=>{"use strict";var N4=Ls(),O4=Is(),Ip=Of(),uM=i0(),D4=Di(),F4=YS(),eM=b0(),nM=tM(),U4=Pp(),B4=uc(),R0=Ff(),z4=Rs(),rM=Cp(),lM=P0(),G4=uM.PROPER,k4=uM.CONFIGURABLE,iM=lM.IteratorPrototype,Rp=lM.BUGGY_SAFARI_ITERATORS,Gf=z4("iterator"),oM="keys",kf="values",sM="entries",aM=function(){return this};cM.exports=function(n,t,e,o,s,c,h){F4(e,t,o);var p=function(w){if(w===s&&x)return x;if(!Rp&&w&&w in v)return v[w];switch(w){case oM:return function(){return new e(this,w)};case kf:return function(){return new e(this,w)};case sM:return function(){return new e(this,w)}}return function(){return new e(this)}},g=t+" Iterator",m=!1,v=n.prototype,E=v[Gf]||v["@@iterator"]||s&&v[s],x=!Rp&&E||p(s),M=t==="Array"&&v.entries||E,A,I,S;if(M&&(A=eM(M.call(new n)),A!==Object.prototype&&A.next&&(!Ip&&eM(A)!==iM&&(nM?nM(A,iM):D4(A[Gf])||R0(A,Gf,aM)),U4(A,g,!0,!0),Ip&&(rM[g]=aM))),G4&&s===kf&&E&&E.name!==kf&&(!Ip&&k4?B4(v,"name",kf):(m=!0,x=function(){return O4(E,this)})),s)if(I={values:p(kf),keys:c?x:p(oM),entries:p(sM)},h)for(S in I)(Rp||m||!(S in v))&&R0(v,S,I[S]);else N4({target:t,proto:!0,forced:Rp||m},I);return(!Ip||h)&&v[Gf]!==x&&R0(v,Gf,x,{name:s}),rM[t]=x,I}});var pM=st((xQ,hM)=>{"use strict";hM.exports=function(n,t){return{value:n,done:t}}});var _M=st((EQ,vM)=>{"use strict";var q4=ic(),L0=S0(),dM=Cp(),mM=xp(),H4=Pu().f,V4=fM(),Lp=pM(),W4=Of(),X4=Xs(),yM="Array Iterator",Y4=mM.set,$4=mM.getterFor(yM);vM.exports=V4(Array,"Array",function(n,t){Y4(this,{type:yM,target:q4(n),index:0,kind:t})},function(){var n=$4(this),t=n.target,e=n.index++;if(!t||e>=t.length)return n.target=null,Lp(void 0,!0);switch(n.kind){case"keys":return Lp(e,!1);case"values":return Lp(t[e],!1)}return Lp([e,t[e]],!1)},"values");var gM=dM.Arguments=dM.Array;L0("keys");L0("values");L0("entries");if(!W4&&X4&&gM.name!=="values")try{H4(gM,"name",{value:"values"})}catch(n){}});var D0=st(()=>{"use strict";var xM=oo(),wM=vS(),Z4=ES(),qf=_M(),EM=uc(),J4=Pp(),K4=Rs(),N0=K4("iterator"),O0=qf.values,SM=function(n,t){if(n){if(n[N0]!==O0)try{EM(n,N0,O0)}catch(o){n[N0]=O0}if(J4(n,t,!0),wM[t]){for(var e in qf)if(n[e]!==qf[e])try{EM(n,e,qf[e])}catch(o){n[e]=qf[e]}}}};for(Np in wM)SM(xM[Np]&&xM[Np].prototype,Np);var Np;SM(Z4,"DOMTokenList")});var AM=st((MQ,bM)=>{"use strict";var j4=Rs(),Q4=j4("toStringTag"),MM={};MM[Q4]="z";bM.exports=String(MM)==="[object z]"});var F0=st((bQ,TM)=>{"use strict";var tk=AM(),ek=Di(),Op=nc(),nk=Rs(),rk=nk("toStringTag"),ik=Object,ok=Op(function(){return arguments}())==="Arguments",sk=function(n,t){try{return n[t]}catch(e){}};TM.exports=tk?Op:function(n){var t,e,o;return n===void 0?"Undefined":n===null?"Null":typeof(e=sk(t=ik(n),rk))=="string"?e:ok?Op(t):(o=Op(t))==="Object"&&ek(t.callee)?"Arguments":o}});var Dp=st((AQ,CM)=>{"use strict";var ak=F0(),uk=String;CM.exports=function(n){if(ak(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return uk(n)}});var IM=st((TQ,PM)=>{"use strict";var lk=Ma();PM.exports=function(){var n=lk(this),t="";return n.hasIndices&&(t+="d"),n.global&&(t+="g"),n.ignoreCase&&(t+="i"),n.multiline&&(t+="m"),n.dotAll&&(t+="s"),n.unicode&&(t+="u"),n.unicodeSets&&(t+="v"),n.sticky&&(t+="y"),t}});var LM=st((CQ,RM)=>{"use strict";var U0=gi(),ck=oo(),B0=ck.RegExp,z0=U0(function(){var n=B0("a","y");return n.lastIndex=2,n.exec("abcd")!==null}),fk=z0||U0(function(){return!B0("a","y").sticky}),hk=z0||U0(function(){var n=B0("^r","gy");return n.lastIndex=2,n.exec("str")!==null});RM.exports={BROKEN_CARET:hk,MISSED_STICKY:fk,UNSUPPORTED_Y:z0}});var OM=st((PQ,NM)=>{"use strict";var pk=gi(),dk=oo(),gk=dk.RegExp;NM.exports=pk(function(){var n=gk(".","s");return!(n.dotAll&&n.test(\`
|
|
11550
11550
|
\`)&&n.flags==="s")})});var FM=st((IQ,DM)=>{"use strict";var mk=gi(),yk=oo(),vk=yk.RegExp;DM.exports=mk(function(){var n=vk("(?<a>b)","g");return n.exec("b").groups.a!=="b"||"b".replace(n,"$<a>c")!=="bc"})});var Bp=st((RQ,BM)=>{"use strict";var lc=Is(),Up=mi(),_k=Dp(),xk=IM(),Ek=LM(),wk=pp(),Sk=zf(),Mk=xp().get,bk=OM(),Ak=FM(),Tk=wk("native-string-replace",String.prototype.replace),Fp=RegExp.prototype.exec,k0=Fp,Ck=Up("".charAt),Pk=Up("".indexOf),Ik=Up("".replace),G0=Up("".slice),q0=function(){var n=/a/,t=/b*/g;return lc(Fp,n,"a"),lc(Fp,t,"a"),n.lastIndex!==0||t.lastIndex!==0}(),UM=Ek.BROKEN_CARET,H0=/()??/.exec("")[1]!==void 0,Rk=q0||H0||UM||bk||Ak;Rk&&(k0=function(t){var e=this,o=Mk(e),s=_k(t),c=o.raw,h,p,g,m,v,E,x;if(c)return c.lastIndex=e.lastIndex,h=lc(k0,c,s),e.lastIndex=c.lastIndex,h;var M=o.groups,A=UM&&e.sticky,I=lc(xk,e),S=e.source,w=0,R=s;if(A&&(I=Ik(I,"y",""),Pk(I,"g")===-1&&(I+="g"),R=G0(s,e.lastIndex),e.lastIndex>0&&(!e.multiline||e.multiline&&Ck(s,e.lastIndex-1)!==\`
|
|
11551
11551
|
\`)&&(S="(?: "+S+")",R=" "+R,w++),p=new RegExp("^(?:"+S+")",I)),H0&&(p=new RegExp("^"+S+"$(?!\\\\s)",I)),q0&&(g=e.lastIndex),m=lc(Fp,A?p:e,R),A?m?(m.input=G0(m.input,w),m[0]=G0(m[0],w),m.index=e.lastIndex,e.lastIndex+=m[0].length):e.lastIndex=0:q0&&m&&(e.lastIndex=e.global?m.index+m[0].length:g),H0&&m&&m.length>1&&lc(Tk,m[0],p,function(){for(v=1;v<arguments.length-2;v++)arguments[v]===void 0&&(m[v]=void 0)}),m&&M)for(m.groups=E=Sk(null),v=0;v<M.length;v++)x=M[v],E[x[0]]=m[x[1]];return m});BM.exports=k0});var zp=st(()=>{"use strict";var Lk=Ls(),zM=Bp();Lk({target:"RegExp",proto:!0,forced:/./.exec!==zM},{exec:zM})});var Zs=st((OQ,GM)=>{"use strict";var V0=mi(),Gp=Set.prototype;GM.exports={Set,add:V0(Gp.add),has:V0(Gp.has),remove:V0(Gp.delete),proto:Gp}});var Ru=st((DQ,kM)=>{"use strict";var Nk=Zs().has;kM.exports=function(n){return Nk(n),n}});var Lu=st((FQ,qM)=>{"use strict";var Ok=Is();qM.exports=function(n,t,e){for(var o=e?n:n.iterator,s=n.next,c,h;!(c=Ok(s,o)).done;)if(h=t(c.value),h!==void 0)return h}});var cc=st((UQ,YM)=>{"use strict";var HM=mi(),Dk=Lu(),VM=Zs(),Fk=VM.Set,WM=VM.proto,Uk=HM(WM.forEach),XM=HM(WM.keys),Bk=XM(new Fk).next;YM.exports=function(n,t,e){return e?Dk({iterator:XM(n),next:Bk},t):Uk(n,t)}});var kp=st((BQ,ZM)=>{"use strict";var $M=Zs(),zk=cc(),Gk=$M.Set,kk=$M.add;ZM.exports=function(n){var t=new Gk;return zk(n,function(e){kk(t,e)}),t}});var fc=st((zQ,JM)=>{"use strict";var qk=I0(),Hk=Zs();JM.exports=qk(Hk.proto,"size","get")||function(n){return n.size}});var jM=st((GQ,KM)=>{"use strict";KM.exports=function(n){return{iterator:n,next:n.next,done:!1}}});var Nu=st((kQ,ib)=>{"use strict";var QM=Nf(),nb=Ma(),tb=Is(),Vk=yl(),Wk=jM(),eb="Invalid size",Xk=RangeError,Yk=TypeError,$k=Math.max,rb=function(n,t){this.set=n,this.size=$k(t,0),this.has=QM(n.has),this.keys=QM(n.keys)};rb.prototype={getIterator:function(){return Wk(nb(tb(this.keys,this.set)))},includes:function(n){return tb(this.has,this.set,n)}};ib.exports=function(n){nb(n);var t=+n.size;if(t!==t)throw new Yk(eb);var e=Vk(t);if(e<0)throw new Xk(eb);return new rb(n,e)}});var ub=st((qQ,ab)=>{"use strict";var Zk=Ru(),sb=Zs(),Jk=kp(),Kk=fc(),jk=Nu(),Qk=cc(),tq=Lu(),eq=sb.has,ob=sb.remove;ab.exports=function(t){var e=Zk(this),o=jk(t),s=Jk(e);return Kk(e)<=o.size?Qk(e,function(c){o.includes(c)&&ob(s,c)}):tq(o.getIterator(),function(c){eq(e,c)&&ob(s,c)}),s}});var Ou=st((HQ,fb)=>{"use strict";var nq=oc(),lb=function(n){return{size:n,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},cb=function(n){return{size:n,has:function(){return!0},keys:function(){throw new Error("e")}}};fb.exports=function(n,t){var e=nq("Set");try{new e()[n](lb(0));try{return new e()[n](lb(-1)),!1}catch(s){if(!t)return!0;try{return new e()[n](cb(-1/0)),!1}catch(c){var o=new e;return o.add(1),o.add(2),t(o[n](cb(1/0)))}}}catch(s){return!1}}});var hb=st(()=>{"use strict";var rq=Ls(),iq=ub(),oq=Ou(),sq=!oq("difference",function(n){return n.size===0});rq({target:"Set",proto:!0,real:!0,forced:sq},{difference:iq})});var gb=st((XQ,db)=>{"use strict";var aq=Ru(),W0=Zs(),uq=fc(),lq=Nu(),cq=cc(),fq=Lu(),hq=W0.Set,pb=W0.add,pq=W0.has;db.exports=function(t){var e=aq(this),o=lq(t),s=new hq;return uq(e)>o.size?fq(o.getIterator(),function(c){pq(e,c)&&pb(s,c)}):cq(e,function(c){o.includes(c)&&pb(s,c)}),s}});var mb=st(()=>{"use strict";var dq=Ls(),gq=gi(),mq=gb(),yq=Ou(),vq=!yq("intersection",function(n){return n.size===2&&n.has(1)&&n.has(2)})||gq(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});dq({target:"Set",proto:!0,real:!0,forced:vq},{intersection:mq})});var X0=st((ZQ,vb)=>{"use strict";var _q=Is(),yb=Ma(),xq=cp();vb.exports=function(n,t,e){var o,s;yb(n);try{if(o=xq(n,"return"),!o){if(t==="throw")throw e;return e}o=_q(o,n)}catch(c){s=!0,o=c}if(t==="throw")throw e;if(s)throw o;return yb(o),e}});var xb=st((JQ,_b)=>{"use strict";var Eq=Ru(),wq=Zs().has,Sq=fc(),Mq=Nu(),bq=cc(),Aq=Lu(),Tq=X0();_b.exports=function(t){var e=Eq(this),o=Mq(t);if(Sq(e)<=o.size)return bq(e,function(c){if(o.includes(c))return!1},!0)!==!1;var s=o.getIterator();return Aq(s,function(c){if(wq(e,c))return Tq(s,"normal",!1)})!==!1}});var Eb=st(()=>{"use strict";var Cq=Ls(),Pq=xb(),Iq=Ou(),Rq=!Iq("isDisjointFrom",function(n){return!n});Cq({target:"Set",proto:!0,real:!0,forced:Rq},{isDisjointFrom:Pq})});var Sb=st((QQ,wb)=>{"use strict";var Lq=Ru(),Nq=fc(),Oq=cc(),Dq=Nu();wb.exports=function(t){var e=Lq(this),o=Dq(t);return Nq(e)>o.size?!1:Oq(e,function(s){if(!o.includes(s))return!1},!0)!==!1}});var Mb=st(()=>{"use strict";var Fq=Ls(),Uq=Sb(),Bq=Ou(),zq=!Bq("isSubsetOf",function(n){return n});Fq({target:"Set",proto:!0,real:!0,forced:zq},{isSubsetOf:Uq})});var Ab=st((ntt,bb)=>{"use strict";var Gq=Ru(),kq=Zs().has,qq=fc(),Hq=Nu(),Vq=Lu(),Wq=X0();bb.exports=function(t){var e=Gq(this),o=Hq(t);if(qq(e)<o.size)return!1;var s=o.getIterator();return Vq(s,function(c){if(!kq(e,c))return Wq(s,"normal",!1)})!==!1}});var Tb=st(()=>{"use strict";var Xq=Ls(),Yq=Ab(),$q=Ou(),Zq=!$q("isSupersetOf",function(n){return!n});Xq({target:"Set",proto:!0,real:!0,forced:Zq},{isSupersetOf:Yq})});var Pb=st((ott,Cb)=>{"use strict";var Jq=Ru(),Y0=Zs(),Kq=kp(),jq=Nu(),Qq=Lu(),t5=Y0.add,e5=Y0.has,n5=Y0.remove;Cb.exports=function(t){var e=Jq(this),o=jq(t).getIterator(),s=Kq(e);return Qq(o,function(c){e5(e,c)?n5(s,c):t5(s,c)}),s}});var Ib=st(()=>{"use strict";var r5=Ls(),i5=Pb(),o5=Ou();r5({target:"Set",proto:!0,real:!0,forced:!o5("symmetricDifference")},{symmetricDifference:i5})});var Lb=st((utt,Rb)=>{"use strict";var s5=Ru(),a5=Zs().add,u5=kp(),l5=Nu(),c5=Lu();Rb.exports=function(t){var e=s5(this),o=l5(t).getIterator(),s=u5(e);return c5(o,function(c){a5(s,c)}),s}});var Nb=st(()=>{"use strict";var f5=Ls(),h5=Lb(),p5=Ou();f5({target:"Set",proto:!0,real:!0,forced:!p5("union")},{union:h5})});var Db=st((ftt,Ob)=>{"use strict";var d5=nc(),g5=mi();Ob.exports=function(n){if(d5(n)==="Function")return g5(n)}});var Bb=st((htt,Ub)=>{"use strict";var Fb=Db(),m5=Nf(),y5=Lf(),v5=Fb(Fb.bind);Ub.exports=function(n,t){return m5(n),t===void 0?n:y5?v5(n,t):function(){return n.apply(t,arguments)}}});var kb=st((ptt,Gb)=>{"use strict";var _5=bp(),x5=Uf(),E5=g0(),w5=Bb(),zb=function(n,t,e,o,s,c,h,p){for(var g=s,m=0,v=h?w5(h,p):!1,E,x;m<o;)m in e&&(E=v?v(e[m],m,t):e[m],c>0&&_5(E)?(x=x5(E),g=zb(n,t,E,x,g,c-1)-1):(E5(g+1),n[g]=E),g++),m++;return g};Gb.exports=zb});var Yb=st((dtt,Xb)=>{"use strict";var S5=mi(),M5=gi(),qb=Di(),b5=F0(),A5=oc(),T5=s0(),Hb=function(){},Vb=A5("Reflect","construct"),$0=/^\\s*(?:class|function)\\b/,C5=S5($0.exec),P5=!$0.test(Hb),Hf=function(t){if(!qb(t))return!1;try{return Vb(Hb,[],t),!0}catch(e){return!1}},Wb=function(t){if(!qb(t))return!1;switch(b5(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return P5||!!C5($0,T5(t))}catch(e){return!0}};Wb.sham=!0;Xb.exports=!Vb||M5(function(){var n;return Hf(Hf.call)||!Hf(Object)||!Hf(function(){n=!0})||n})?Wb:Hf});var Kb=st((gtt,Jb)=>{"use strict";var $b=bp(),I5=Yb(),R5=wa(),L5=Rs(),N5=L5("species"),Zb=Array;Jb.exports=function(n){var t;return $b(n)&&(t=n.constructor,I5(t)&&(t===Zb||$b(t.prototype))?t=void 0:R5(t)&&(t=t[N5],t===null&&(t=void 0))),t===void 0?Zb:t}});var Qb=st((mtt,jb)=>{"use strict";var O5=Kb();jb.exports=function(n,t){return new(O5(n))(t===0?0:t)}});var tA=st(()=>{"use strict";var D5=Ls(),F5=kb(),U5=sc(),B5=Uf(),z5=yl(),G5=Qb();D5({target:"Array",proto:!0},{flat:function(){var t=arguments.length?arguments[0]:void 0,e=U5(this),o=B5(e),s=G5(e,0);return s.length=F5(s,e,e,o,0,t===void 0?1:z5(t)),s}})});var eA=st(()=>{"use strict";var k5=S0();k5("flat")});var rA=st((Ett,nA)=>{var Z0=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(s=>(s.key===t&&Object.assign(s,{priority:o}),s)):(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)}};nA.exports=Z0});var sA=st((wtt,oA)=>{function iA(n,t){let e=new Map;for(let[o,s]of n)o!==t&&s instanceof Map?e.set(o,iA(s,t)):o!==t&&e.set(o,s);return e}oA.exports=iA});var lA=st((Stt,uA)=>{function q5(n){let t=Number(n);return!(isNaN(t)||t<=0)}function aA(n){let t=new Map;return Object.keys(n).forEach(o=>{let s=n[o];if(s!==null&&typeof s=="object"&&!Array.isArray(s))return t.set(o,aA(s));if(!q5(s))throw new Error(\`Could not add node at key "\${o}", make sure it's a valid node\`,s);return t.set(o,Number(s))}),t}uA.exports=aA});var hA=st((Mtt,fA)=>{function cA(n){if(!(n instanceof Map))throw new Error(\`Invalid graph: Expected Map instead found \${typeof n}\`);n.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){cA(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}fA.exports=cA});var mA=st((btt,gA)=>{var H5=rA(),V5=sA(),pA=lA(),dA=hA(),J0=class{constructor(t){t instanceof Map?(dA(t),this.graph=t):t?this.graph=pA(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(dA(e),o=e):o=pA(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=V5(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let s=new Set,c=new H5,h=new Map,p=[],g=0,m=[];if(o.avoid&&(m=[].concat(o.avoid)),m.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(m.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(c.set(t,0);!c.isEmpty();){let v=c.next();if(v.key===e){g=v.priority;let x=v.key;for(;h.has(x);)p.push(x),x=h.get(x);break}s.add(v.key),(this.graph.get(v.key)||new Map).forEach((x,M)=>{if(s.has(M)||m.includes(M))return null;if(!c.has(M))return h.set(M,v.key),c.set(M,v.priority+x);let A=c.get(M).priority,I=v.priority+x;return I<A?(h.set(M,v.key),c.set(M,I)):null})}return p.length?(o.trim?p.shift():p=p.concat([t]),o.reverse||(p=p.reverse()),o.cost?{path:p,cost:g}:p):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};gA.exports=J0});var Od=st((Utt,lC)=>{"use strict";var uC=Object.getOwnPropertySymbols,rX=Object.prototype.hasOwnProperty,iX=Object.prototype.propertyIsEnumerable;function oX(n){if(n==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(n)}function sX(){try{if(!Object.assign)return!1;var n=new String("abc");if(n[5]="de",Object.getOwnPropertyNames(n)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(c){return t[c]});if(o.join("")!=="0123456789")return!1;var s={};return"abcdefghijklmnopqrst".split("").forEach(function(c){s[c]=c}),Object.keys(Object.assign({},s)).join("")==="abcdefghijklmnopqrst"}catch(c){return!1}}lC.exports=sX()?Object.assign:function(n,t){for(var e,o=oX(n),s,c=1;c<arguments.length;c++){e=Object(arguments[c]);for(var h in e)rX.call(e,h)&&(o[h]=e[h]);if(uC){s=uC(e);for(var p=0;p<s.length;p++)iX.call(e,s[p])&&(o[s[p]]=e[s[p]])}}return o}});var bv=st((Sv,Mv)=>{(function(n,t){typeof Sv=="object"&&typeof Mv!="undefined"?Mv.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self).RBush=t()})(Sv,function(){"use strict";function n(S,w,R,C,F){(function W(X,q,D,xt,B){for(;xt>D;){if(xt-D>600){var j=xt-D+1,J=q-D+1,Dt=Math.log(j),Q=.5*Math.exp(2*Dt/3),At=.5*Math.sqrt(Dt*Q*(j-Q)/j)*(J-j/2<0?-1:1),Mt=Math.max(D,Math.floor(q-J*Q/j+At)),Rt=Math.min(xt,Math.floor(q+(j-J)*Q/j+At));W(X,q,Mt,Rt,B)}var pt=X[q],yt=D,K=xt;for(t(X,D,q),B(X[xt],pt)>0&&t(X,D,xt);yt<K;){for(t(X,yt,K),yt++,K--;B(X[yt],pt)<0;)yt++;for(;B(X[K],pt)>0;)K--}B(X[D],pt)===0?t(X,D,K):t(X,++K,xt),K<=q&&(D=K+1),q<=K&&(xt=K-1)}})(S,w,R||0,C||S.length-1,F||e)}function t(S,w,R){var C=S[w];S[w]=S[R],S[R]=C}function e(S,w){return S<w?-1:S>w?1:0}var o=function(S){S===void 0&&(S=9),this._maxEntries=Math.max(4,S),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(S,w,R){if(!R)return w.indexOf(S);for(var C=0;C<w.length;C++)if(R(S,w[C]))return C;return-1}function c(S,w){h(S,0,S.children.length,w,S)}function h(S,w,R,C,F){F||(F=A(null)),F.minX=1/0,F.minY=1/0,F.maxX=-1/0,F.maxY=-1/0;for(var W=w;W<R;W++){var X=S.children[W];p(F,S.leaf?C(X):X)}return F}function p(S,w){return S.minX=Math.min(S.minX,w.minX),S.minY=Math.min(S.minY,w.minY),S.maxX=Math.max(S.maxX,w.maxX),S.maxY=Math.max(S.maxY,w.maxY),S}function g(S,w){return S.minX-w.minX}function m(S,w){return S.minY-w.minY}function v(S){return(S.maxX-S.minX)*(S.maxY-S.minY)}function E(S){return S.maxX-S.minX+(S.maxY-S.minY)}function x(S,w){return S.minX<=w.minX&&S.minY<=w.minY&&w.maxX<=S.maxX&&w.maxY<=S.maxY}function M(S,w){return w.minX<=S.maxX&&w.minY<=S.maxY&&w.maxX>=S.minX&&w.maxY>=S.minY}function A(S){return{children:S,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function I(S,w,R,C,F){for(var W=[w,R];W.length;)if(!((R=W.pop())-(w=W.pop())<=C)){var X=w+Math.ceil((R-w)/C/2)*C;n(S,X,w,R,F),W.push(w,X,X,R)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(S){var w=this.data,R=[];if(!M(S,w))return R;for(var C=this.toBBox,F=[];w;){for(var W=0;W<w.children.length;W++){var X=w.children[W],q=w.leaf?C(X):X;M(S,q)&&(w.leaf?R.push(X):x(S,q)?this._all(X,R):F.push(X))}w=F.pop()}return R},o.prototype.collides=function(S){var w=this.data;if(!M(S,w))return!1;for(var R=[];w;){for(var C=0;C<w.children.length;C++){var F=w.children[C],W=w.leaf?this.toBBox(F):F;if(M(S,W)){if(w.leaf||x(S,W))return!0;R.push(F)}}w=R.pop()}return!1},o.prototype.load=function(S){if(!S||!S.length)return this;if(S.length<this._minEntries){for(var w=0;w<S.length;w++)this.insert(S[w]);return this}var R=this._build(S.slice(),0,S.length-1,0);if(this.data.children.length)if(this.data.height===R.height)this._splitRoot(this.data,R);else{if(this.data.height<R.height){var C=this.data;this.data=R,R=C}this._insert(R,this.data.height-R.height-1,!0)}else this.data=R;return this},o.prototype.insert=function(S){return S&&this._insert(S,this.data.height-1),this},o.prototype.clear=function(){return this.data=A([]),this},o.prototype.remove=function(S,w){if(!S)return this;for(var R,C,F,W=this.data,X=this.toBBox(S),q=[],D=[];W||q.length;){if(W||(W=q.pop(),C=q[q.length-1],R=D.pop(),F=!0),W.leaf){var xt=s(S,W.children,w);if(xt!==-1)return W.children.splice(xt,1),q.push(W),this._condense(q),this}F||W.leaf||!x(W,X)?C?(R++,W=C.children[R],F=!1):W=null:(q.push(W),D.push(R),R=0,C=W,W=W.children[0])}return this},o.prototype.toBBox=function(S){return S},o.prototype.compareMinX=function(S,w){return S.minX-w.minX},o.prototype.compareMinY=function(S,w){return S.minY-w.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(S){return this.data=S,this},o.prototype._all=function(S,w){for(var R=[];S;)S.leaf?w.push.apply(w,S.children):R.push.apply(R,S.children),S=R.pop();return w},o.prototype._build=function(S,w,R,C){var F,W=R-w+1,X=this._maxEntries;if(W<=X)return c(F=A(S.slice(w,R+1)),this.toBBox),F;C||(C=Math.ceil(Math.log(W)/Math.log(X)),X=Math.ceil(W/Math.pow(X,C-1))),(F=A([])).leaf=!1,F.height=C;var q=Math.ceil(W/X),D=q*Math.ceil(Math.sqrt(X));I(S,w,R,D,this.compareMinX);for(var xt=w;xt<=R;xt+=D){var B=Math.min(xt+D-1,R);I(S,xt,B,q,this.compareMinY);for(var j=xt;j<=B;j+=q){var J=Math.min(j+q-1,B);F.children.push(this._build(S,j,J,C-1))}}return c(F,this.toBBox),F},o.prototype._chooseSubtree=function(S,w,R,C){for(;C.push(w),!w.leaf&&C.length-1!==R;){for(var F=1/0,W=1/0,X=void 0,q=0;q<w.children.length;q++){var D=w.children[q],xt=v(D),B=(j=S,J=D,(Math.max(J.maxX,j.maxX)-Math.min(J.minX,j.minX))*(Math.max(J.maxY,j.maxY)-Math.min(J.minY,j.minY))-xt);B<W?(W=B,F=xt<F?xt:F,X=D):B===W&&xt<F&&(F=xt,X=D)}w=X||w.children[0]}var j,J;return w},o.prototype._insert=function(S,w,R){var C=R?S:this.toBBox(S),F=[],W=this._chooseSubtree(C,this.data,w,F);for(W.children.push(S),p(W,C);w>=0&&F[w].children.length>this._maxEntries;)this._split(F,w),w--;this._adjustParentBBoxes(C,F,w)},o.prototype._split=function(S,w){var R=S[w],C=R.children.length,F=this._minEntries;this._chooseSplitAxis(R,F,C);var W=this._chooseSplitIndex(R,F,C),X=A(R.children.splice(W,R.children.length-W));X.height=R.height,X.leaf=R.leaf,c(R,this.toBBox),c(X,this.toBBox),w?S[w-1].children.push(X):this._splitRoot(R,X)},o.prototype._splitRoot=function(S,w){this.data=A([S,w]),this.data.height=S.height+1,this.data.leaf=!1,c(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(S,w,R){for(var C,F,W,X,q,D,xt,B=1/0,j=1/0,J=w;J<=R-w;J++){var Dt=h(S,0,J,this.toBBox),Q=h(S,J,R,this.toBBox),At=(F=Dt,W=Q,X=void 0,q=void 0,D=void 0,xt=void 0,X=Math.max(F.minX,W.minX),q=Math.max(F.minY,W.minY),D=Math.min(F.maxX,W.maxX),xt=Math.min(F.maxY,W.maxY),Math.max(0,D-X)*Math.max(0,xt-q)),Mt=v(Dt)+v(Q);At<B?(B=At,C=J,j=Mt<j?Mt:j):At===B&&Mt<j&&(j=Mt,C=J)}return C||R-w},o.prototype._chooseSplitAxis=function(S,w,R){var C=S.leaf?this.compareMinX:g,F=S.leaf?this.compareMinY:m;this._allDistMargin(S,w,R,C)<this._allDistMargin(S,w,R,F)&&S.children.sort(C)},o.prototype._allDistMargin=function(S,w,R,C){S.children.sort(C);for(var F=this.toBBox,W=h(S,0,w,F),X=h(S,R-w,R,F),q=E(W)+E(X),D=w;D<R-w;D++){var xt=S.children[D];p(W,S.leaf?F(xt):xt),q+=E(W)}for(var B=R-w-1;B>=w;B--){var j=S.children[B];p(X,S.leaf?F(j):j),q+=E(X)}return q},o.prototype._adjustParentBBoxes=function(S,w,R){for(var C=R;C>=0;C--)p(w[C],S)},o.prototype._condense=function(S){for(var w=S.length-1,R=void 0;w>=0;w--)S[w].children.length===0?w>0?(R=S[w-1].children).splice(R.indexOf(S[w]),1):this.clear():c(S[w],this.toBBox)},o})});var cC=st((Av,Tv)=>{(function(n,t){typeof Av=="object"&&typeof Tv!="undefined"?Tv.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self,n.TinyQueue=t())})(Av,function(){"use strict";var n=function(o,s){if(o===void 0&&(o=[]),s===void 0&&(s=t),this.data=o,this.length=this.data.length,this.compare=s,this.length>0)for(var c=(this.length>>1)-1;c>=0;c--)this._down(c)};n.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},n.prototype.pop=function(){if(this.length!==0){var o=this.data[0],s=this.data.pop();return this.length--,this.length>0&&(this.data[0]=s,this._down(0)),o}},n.prototype.peek=function(){return this.data[0]},n.prototype._up=function(o){for(var s=this,c=s.data,h=s.compare,p=c[o];o>0;){var g=o-1>>1,m=c[g];if(h(p,m)>=0)break;c[o]=m,o=g}c[o]=p},n.prototype._down=function(o){for(var s=this,c=s.data,h=s.compare,p=this.length>>1,g=c[o];o<p;){var m=(o<<1)+1,v=c[m],E=m+1;if(E<this.length&&h(c[E],v)<0&&(m=E,v=c[E]),h(v,g)>=0)break;c[o]=v,o=m}c[o]=g};function t(e,o){return e<o?-1:e>o?1:0}return n})});var hC=st((Htt,fC)=>{fC.exports=function(t,e,o,s){var c=t[0],h=t[1],p=!1;o===void 0&&(o=0),s===void 0&&(s=e.length);for(var g=(s-o)/2,m=0,v=g-1;m<g;v=m++){var E=e[o+m*2+0],x=e[o+m*2+1],M=e[o+v*2+0],A=e[o+v*2+1],I=x>h!=A>h&&c<(M-E)*(h-x)/(A-x)+E;I&&(p=!p)}return p}});var dC=st((Vtt,pC)=>{pC.exports=function(t,e,o,s){var c=t[0],h=t[1],p=!1;o===void 0&&(o=0),s===void 0&&(s=e.length);for(var g=s-o,m=0,v=g-1;m<g;v=m++){var E=e[m+o][0],x=e[m+o][1],M=e[v+o][0],A=e[v+o][1],I=x>h!=A>h&&c<(M-E)*(h-x)/(A-x)+E;I&&(p=!p)}return p}});var yC=st((Wtt,Ud)=>{var gC=hC(),mC=dC();Ud.exports=function(t,e,o,s){return e.length>0&&Array.isArray(e[0])?mC(t,e,o,s):gC(t,e,o,s)};Ud.exports.nested=mC;Ud.exports.flat=gC});var _C=st((Bd,vC)=>{(function(n,t){typeof Bd=="object"&&typeof vC!="undefined"?t(Bd):typeof define=="function"&&define.amd?define(["exports"],t):t((n=n||self).predicates={})})(Bd,function(n){"use strict";let e=33306690738754706e-32;function o(M,A,I,S,w){let R,C,F,W,X=A[0],q=S[0],D=0,xt=0;q>X==q>-X?(R=X,X=A[++D]):(R=q,q=S[++xt]);let B=0;if(D<M&&xt<I)for(q>X==q>-X?(F=R-((C=X+R)-X),X=A[++D]):(F=R-((C=q+R)-q),q=S[++xt]),R=C,F!==0&&(w[B++]=F);D<M&&xt<I;)q>X==q>-X?(F=R-((C=R+X)-(W=C-R))+(X-W),X=A[++D]):(F=R-((C=R+q)-(W=C-R))+(q-W),q=S[++xt]),R=C,F!==0&&(w[B++]=F);for(;D<M;)F=R-((C=R+X)-(W=C-R))+(X-W),X=A[++D],R=C,F!==0&&(w[B++]=F);for(;xt<I;)F=R-((C=R+q)-(W=C-R))+(q-W),q=S[++xt],R=C,F!==0&&(w[B++]=F);return R===0&&B!==0||(w[B++]=R),B}function s(M){return new Float64Array(M)}let c=33306690738754716e-32,h=22204460492503146e-32,p=11093356479670487e-47,g=s(4),m=s(8),v=s(12),E=s(16),x=s(4);n.orient2d=function(M,A,I,S,w,R){let C=(A-R)*(I-w),F=(M-w)*(S-R),W=C-F;if(C===0||F===0||C>0!=F>0)return W;let X=Math.abs(C+F);return Math.abs(W)>=c*X?W:-function(q,D,xt,B,j,J,Dt){let Q,At,Mt,Rt,pt,yt,K,Bt,Gt,ae,ut,Ut,jt,ce,te,$t,qt,xe,ft=q-j,We=xt-j,ee=D-J,ge=B-J;pt=(te=(Bt=ft-(K=(yt=134217729*ft)-(yt-ft)))*(ae=ge-(Gt=(yt=134217729*ge)-(yt-ge)))-((ce=ft*ge)-K*Gt-Bt*Gt-K*ae))-(ut=te-(qt=(Bt=ee-(K=(yt=134217729*ee)-(yt-ee)))*(ae=We-(Gt=(yt=134217729*We)-(yt-We)))-(($t=ee*We)-K*Gt-Bt*Gt-K*ae))),g[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),g[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,g[2]=Ut-(xe-pt)+(ut-pt),g[3]=xe;let fe=function(tt,z){let Pt=z[0];for(let Ot=1;Ot<tt;Ot++)Pt+=z[Ot];return Pt}(4,g),Te=h*Dt;if(fe>=Te||-fe>=Te||(Q=q-(ft+(pt=q-ft))+(pt-j),Mt=xt-(We+(pt=xt-We))+(pt-j),At=D-(ee+(pt=D-ee))+(pt-J),Rt=B-(ge+(pt=B-ge))+(pt-J),Q===0&&At===0&&Mt===0&&Rt===0)||(Te=p*Dt+e*Math.abs(fe),(fe+=ft*Rt+ge*Q-(ee*Mt+We*At))>=Te||-fe>=Te))return fe;pt=(te=(Bt=Q-(K=(yt=134217729*Q)-(yt-Q)))*(ae=ge-(Gt=(yt=134217729*ge)-(yt-ge)))-((ce=Q*ge)-K*Gt-Bt*Gt-K*ae))-(ut=te-(qt=(Bt=At-(K=(yt=134217729*At)-(yt-At)))*(ae=We-(Gt=(yt=134217729*We)-(yt-We)))-(($t=At*We)-K*Gt-Bt*Gt-K*ae))),x[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),x[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,x[2]=Ut-(xe-pt)+(ut-pt),x[3]=xe;let be=o(4,g,4,x,m);pt=(te=(Bt=ft-(K=(yt=134217729*ft)-(yt-ft)))*(ae=Rt-(Gt=(yt=134217729*Rt)-(yt-Rt)))-((ce=ft*Rt)-K*Gt-Bt*Gt-K*ae))-(ut=te-(qt=(Bt=ee-(K=(yt=134217729*ee)-(yt-ee)))*(ae=Mt-(Gt=(yt=134217729*Mt)-(yt-Mt)))-(($t=ee*Mt)-K*Gt-Bt*Gt-K*ae))),x[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),x[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,x[2]=Ut-(xe-pt)+(ut-pt),x[3]=xe;let Wt=o(be,m,4,x,v);pt=(te=(Bt=Q-(K=(yt=134217729*Q)-(yt-Q)))*(ae=Rt-(Gt=(yt=134217729*Rt)-(yt-Rt)))-((ce=Q*Rt)-K*Gt-Bt*Gt-K*ae))-(ut=te-(qt=(Bt=At-(K=(yt=134217729*At)-(yt-At)))*(ae=Mt-(Gt=(yt=134217729*Mt)-(yt-Mt)))-(($t=At*Mt)-K*Gt-Bt*Gt-K*ae))),x[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),x[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,x[2]=Ut-(xe-pt)+(ut-pt),x[3]=xe;let Me=o(Wt,v,4,x,E);return E[Me-1]}(M,A,I,S,w,R,X)},n.orient2dfast=function(M,A,I,S,w,R){return(A-R)*(I-w)-(M-w)*(S-R)},Object.defineProperty(n,"__esModule",{value:!0})})});var bC=st((Xtt,Rv)=>{"use strict";var xC=bv(),Gd=cC(),uX=yC(),lX=_C().orient2d;Gd.default&&(Gd=Gd.default);Rv.exports=MC;Rv.exports.default=MC;function MC(n,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=dX(n),s=new xC(16);s.toBBox=function(R){return{minX:R[0],minY:R[1],maxX:R[0],maxY:R[1]}},s.compareMinX=function(R,C){return R[0]-C[0]},s.compareMinY=function(R,C){return R[1]-C[1]},s.load(n);for(var c=[],h=0,p;h<o.length;h++){var g=o[h];s.remove(g),p=SC(g,p),c.push(p)}var m=new xC(16);for(h=0;h<c.length;h++)m.insert(Cv(c[h]));for(var v=t*t,E=e*e;c.length;){var x=c.shift(),M=x.p,A=x.next.p,I=Pv(M,A);if(!(I<E)){var S=I/v;g=cX(s,x.prev.p,M,A,x.next.next.p,S,m),g&&Math.min(Pv(g,M),Pv(g,A))<=S&&(c.push(x),c.push(SC(g,x)),s.remove(g),m.remove(x),m.insert(Cv(x)),m.insert(Cv(x.next)))}}x=p;var w=[];do w.push(x.p),x=x.next;while(x!==p);return w.push(x.p),w}function cX(n,t,e,o,s,c,h){for(var p=new Gd([],fX),g=n.data;g;){for(var m=0;m<g.children.length;m++){var v=g.children[m],E=g.leaf?Iv(v,e,o):hX(e,o,v);E>c||p.push({node:v,dist:E})}for(;p.length&&!p.peek().node.children;){var x=p.pop(),M=x.node,A=Iv(M,t,e),I=Iv(M,o,s);if(x.dist<A&&x.dist<I&&wC(e,M,h)&&wC(o,M,h))return M}g=p.pop(),g&&(g=g.node)}return null}function fX(n,t){return n.dist-t.dist}function hX(n,t,e){if(EC(n,e)||EC(t,e))return 0;var o=zd(n[0],n[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var s=zd(n[0],n[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(s===0)return 0;var c=zd(n[0],n[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(c===0)return 0;var h=zd(n[0],n[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return h===0?0:Math.min(o,s,c,h)}function EC(n,t){return n[0]>=t.minX&&n[0]<=t.maxX&&n[1]>=t.minY&&n[1]<=t.maxY}function wC(n,t,e){for(var o=Math.min(n[0],t[0]),s=Math.min(n[1],t[1]),c=Math.max(n[0],t[0]),h=Math.max(n[1],t[1]),p=e.search({minX:o,minY:s,maxX:c,maxY:h}),g=0;g<p.length;g++)if(pX(p[g].p,p[g].next.p,n,t))return!1;return!0}function qc(n,t,e){return lX(n[0],n[1],t[0],t[1],e[0],e[1])}function pX(n,t,e,o){return n!==o&&t!==e&&qc(n,t,e)>0!=qc(n,t,o)>0&&qc(e,o,n)>0!=qc(e,o,t)>0}function Cv(n){var t=n.p,e=n.next.p;return n.minX=Math.min(t[0],e[0]),n.minY=Math.min(t[1],e[1]),n.maxX=Math.max(t[0],e[0]),n.maxY=Math.max(t[1],e[1]),n}function dX(n){for(var t=n[0],e=n[0],o=n[0],s=n[0],c=0;c<n.length;c++){var h=n[c];h[0]<t[0]&&(t=h),h[0]>o[0]&&(o=h),h[1]<e[1]&&(e=h),h[1]>s[1]&&(s=h)}var p=[t,e,o,s],g=p.slice();for(c=0;c<n.length;c++)uX(n[c],p)||g.push(n[c]);return mX(g)}function SC(n,t){var e={p:n,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 Pv(n,t){var e=n[0]-t[0],o=n[1]-t[1];return e*e+o*o}function Iv(n,t,e){var o=t[0],s=t[1],c=e[0]-o,h=e[1]-s;if(c!==0||h!==0){var p=((n[0]-o)*c+(n[1]-s)*h)/(c*c+h*h);p>1?(o=e[0],s=e[1]):p>0&&(o+=c*p,s+=h*p)}return c=n[0]-o,h=n[1]-s,c*c+h*h}function zd(n,t,e,o,s,c,h,p){var g=e-n,m=o-t,v=h-s,E=p-c,x=n-s,M=t-c,A=g*g+m*m,I=g*v+m*E,S=v*v+E*E,w=g*x+m*M,R=v*x+E*M,C=A*S-I*I,F,W,X,q,D=C,xt=C;C===0?(W=0,D=1,q=R,xt=S):(W=I*R-S*w,q=A*R-I*w,W<0?(W=0,q=R,xt=S):W>D&&(W=D,q=R+I,xt=S)),q<0?(q=0,-w<0?W=0:-w>A?W=D:(W=-w,D=A)):q>xt&&(q=xt,-w+I<0?W=0:-w+I>A?W=D:(W=-w+I,D=A)),F=W===0?0:W/D,X=q===0?0:q/xt;var B=(1-F)*n+F*e,j=(1-F)*t+F*o,J=(1-X)*s+X*h,Dt=(1-X)*c+X*p,Q=J-B,At=Dt-j;return Q*Q+At*At}function gX(n,t){return n[0]===t[0]?n[1]-t[1]:n[0]-t[0]}function mX(n){n.sort(gX);for(var t=[],e=0;e<n.length;e++){for(;t.length>=2&&qc(t[t.length-2],t[t.length-1],n[e])<=0;)t.pop();t.push(n[e])}for(var o=[],s=n.length-1;s>=0;s--){for(;o.length>=2&&qc(o[o.length-2],o[o.length-1],n[s])<=0;)o.pop();o.push(n[s])}return o.pop(),t.pop(),t.concat(o)}});var RC=st((Nv,Ov)=>{(function(n,t){typeof Nv=="object"&&typeof Ov!="undefined"?Ov.exports=t():typeof define=="function"&&define.amd?define(t):n.quickselect=t()})(Nv,function(){"use strict";function n(s,c,h,p,g){t(s,c,h||0,p||s.length-1,g||o)}function t(s,c,h,p,g){for(;p>h;){if(p-h>600){var m=p-h+1,v=c-h+1,E=Math.log(m),x=.5*Math.exp(2*E/3),M=.5*Math.sqrt(E*x*(m-x)/m)*(v-m/2<0?-1:1),A=Math.max(h,Math.floor(c-v*x/m+M)),I=Math.min(p,Math.floor(c+(m-v)*x/m+M));t(s,c,A,I,g)}var S=s[c],w=h,R=p;for(e(s,h,c),g(s[p],S)>0&&e(s,h,p);w<R;){for(e(s,w,R),w++,R--;g(s[w],S)<0;)w++;for(;g(s[R],S)>0;)R--}g(s[h],S)===0?e(s,h,R):(R++,e(s,R,p)),R<=c&&(h=R+1),c<=R&&(p=R-1)}}function e(s,c,h){var p=s[c];s[c]=s[h],s[h]=p}function o(s,c){return s<c?-1:s>c?1:0}return n})});var Bv=st((xrt,Uv)=>{"use strict";Uv.exports=ih;Uv.exports.default=ih;var PX=RC();function ih(n,t){if(!(this instanceof ih))return new ih(n,t);this._maxEntries=Math.max(4,n||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}ih.prototype={all:function(){return this._all(this.data,[])},search:function(n){var t=this.data,e=[],o=this.toBBox;if(!qd(n,t))return e;for(var s=[],c,h,p,g;t;){for(c=0,h=t.children.length;c<h;c++)p=t.children[c],g=t.leaf?o(p):p,qd(n,g)&&(t.leaf?e.push(p):Fv(n,g)?this._all(p,e):s.push(p));t=s.pop()}return e},collides:function(n){var t=this.data,e=this.toBBox;if(!qd(n,t))return!1;for(var o=[],s,c,h,p;t;){for(s=0,c=t.children.length;s<c;s++)if(h=t.children[s],p=t.leaf?e(h):h,qd(n,p)){if(t.leaf||Fv(n,p))return!0;o.push(h)}t=o.pop()}return!1},load:function(n){if(!(n&&n.length))return this;if(n.length<this._minEntries){for(var t=0,e=n.length;t<e;t++)this.insert(n[t]);return this}var o=this._build(n.slice(),0,n.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 s=this.data;this.data=o,o=s}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(n){return n&&this._insert(n,this.data.height-1),this},clear:function(){return this.data=Wc([]),this},remove:function(n,t){if(!n)return this;for(var e=this.data,o=this.toBBox(n),s=[],c=[],h,p,g,m;e||s.length;){if(e||(e=s.pop(),p=s[s.length-1],h=c.pop(),m=!0),e.leaf&&(g=IX(n,e.children,t),g!==-1))return e.children.splice(g,1),s.push(e),this._condense(s),this;!m&&!e.leaf&&Fv(e,o)?(s.push(e),c.push(h),h=0,p=e,e=e.children[0]):p?(h++,e=p.children[h],m=!1):e=null}return this},toBBox:function(n){return n},compareMinX:LC,compareMinY:NC,toJSON:function(){return this.data},fromJSON:function(n){return this.data=n,this},_all:function(n,t){for(var e=[];n;)n.leaf?t.push.apply(t,n.children):e.push.apply(e,n.children),n=e.pop();return t},_build:function(n,t,e,o){var s=e-t+1,c=this._maxEntries,h;if(s<=c)return h=Wc(n.slice(t,e+1)),Vc(h,this.toBBox),h;o||(o=Math.ceil(Math.log(s)/Math.log(c)),c=Math.ceil(s/Math.pow(c,o-1))),h=Wc([]),h.leaf=!1,h.height=o;var p=Math.ceil(s/c),g=p*Math.ceil(Math.sqrt(c)),m,v,E,x;for(OC(n,t,e,g,this.compareMinX),m=t;m<=e;m+=g)for(E=Math.min(m+g-1,e),OC(n,m,E,p,this.compareMinY),v=m;v<=E;v+=p)x=Math.min(v+p-1,E),h.children.push(this._build(n,v,x,o-1));return Vc(h,this.toBBox),h},_chooseSubtree:function(n,t,e,o){for(var s,c,h,p,g,m,v,E;o.push(t),!(t.leaf||o.length-1===e);){for(v=E=1/0,s=0,c=t.children.length;s<c;s++)h=t.children[s],g=Dv(h),m=RX(n,h)-g,m<E?(E=m,v=g<v?g:v,p=h):m===E&&g<v&&(v=g,p=h);t=p||t.children[0]}return t},_insert:function(n,t,e){var o=this.toBBox,s=e?n:o(n),c=[],h=this._chooseSubtree(s,this.data,t,c);for(h.children.push(n),rh(h,s);t>=0&&c[t].children.length>this._maxEntries;)this._split(c,t),t--;this._adjustParentBBoxes(s,c,t)},_split:function(n,t){var e=n[t],o=e.children.length,s=this._minEntries;this._chooseSplitAxis(e,s,o);var c=this._chooseSplitIndex(e,s,o),h=Wc(e.children.splice(c,e.children.length-c));h.height=e.height,h.leaf=e.leaf,Vc(e,this.toBBox),Vc(h,this.toBBox),t?n[t-1].children.push(h):this._splitRoot(e,h)},_splitRoot:function(n,t){this.data=Wc([n,t]),this.data.height=n.height+1,this.data.leaf=!1,Vc(this.data,this.toBBox)},_chooseSplitIndex:function(n,t,e){var o,s,c,h,p,g,m,v;for(g=m=1/0,o=t;o<=e-t;o++)s=nh(n,0,o,this.toBBox),c=nh(n,o,e,this.toBBox),h=LX(s,c),p=Dv(s)+Dv(c),h<g?(g=h,v=o,m=p<m?p:m):h===g&&p<m&&(m=p,v=o);return v},_chooseSplitAxis:function(n,t,e){var o=n.leaf?this.compareMinX:LC,s=n.leaf?this.compareMinY:NC,c=this._allDistMargin(n,t,e,o),h=this._allDistMargin(n,t,e,s);c<h&&n.children.sort(o)},_allDistMargin:function(n,t,e,o){n.children.sort(o);var s=this.toBBox,c=nh(n,0,t,s),h=nh(n,e-t,e,s),p=kd(c)+kd(h),g,m;for(g=t;g<e-t;g++)m=n.children[g],rh(c,n.leaf?s(m):m),p+=kd(c);for(g=e-t-1;g>=t;g--)m=n.children[g],rh(h,n.leaf?s(m):m),p+=kd(h);return p},_adjustParentBBoxes:function(n,t,e){for(var o=e;o>=0;o--)rh(t[o],n)},_condense:function(n){for(var t=n.length-1,e;t>=0;t--)n[t].children.length===0?t>0?(e=n[t-1].children,e.splice(e.indexOf(n[t]),1)):this.clear():Vc(n[t],this.toBBox)},_initFormat:function(n){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(n[0])),this.compareMinY=new Function("a","b",t.join(n[1])),this.toBBox=new Function("a","return {minX: a"+n[0]+", minY: a"+n[1]+", maxX: a"+n[2]+", maxY: a"+n[3]+"};")}};function IX(n,t,e){if(!e)return t.indexOf(n);for(var o=0;o<t.length;o++)if(e(n,t[o]))return o;return-1}function Vc(n,t){nh(n,0,n.children.length,t,n)}function nh(n,t,e,o,s){s||(s=Wc(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(var c=t,h;c<e;c++)h=n.children[c],rh(s,n.leaf?o(h):h);return s}function rh(n,t){return n.minX=Math.min(n.minX,t.minX),n.minY=Math.min(n.minY,t.minY),n.maxX=Math.max(n.maxX,t.maxX),n.maxY=Math.max(n.maxY,t.maxY),n}function LC(n,t){return n.minX-t.minX}function NC(n,t){return n.minY-t.minY}function Dv(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function kd(n){return n.maxX-n.minX+(n.maxY-n.minY)}function RX(n,t){return(Math.max(t.maxX,n.maxX)-Math.min(t.minX,n.minX))*(Math.max(t.maxY,n.maxY)-Math.min(t.minY,n.minY))}function LX(n,t){var e=Math.max(n.minX,t.minX),o=Math.max(n.minY,t.minY),s=Math.min(n.maxX,t.maxX),c=Math.min(n.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,c-o)}function Fv(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function qd(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function Wc(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function OC(n,t,e,o,s){for(var c=[t,e],h;c.length;)e=c.pop(),t=c.pop(),!(e-t<=o)&&(h=t+Math.ceil((e-t)/o/2)*o,PX(n,h,t,e,s),c.push(t,h,h,e))}});var GC=st((Nit,Vv)=>{"use strict";Vv.exports=Xd;Vv.exports.default=Xd;function Xd(n,t,e){e=e||2;var o=t&&t.length,s=o?t[0]*e:n.length,c=UC(n,0,s,e,!0),h=[];if(!c||c.next===c.prev)return h;var p,g,m,v,E,x,M;if(o&&(c=qX(n,t,c,e)),n.length>80*e){p=m=n[0],g=v=n[1];for(var A=e;A<s;A+=e)E=n[A],x=n[A+1],E<p&&(p=E),x<g&&(g=x),E>m&&(m=E),x>v&&(v=x);M=Math.max(m-p,v-g),M=M!==0?32767/M:0}return ah(c,h,e,p,g,M,0),h}function UC(n,t,e,o,s){var c,h;if(s===Hv(n,t,e,o)>0)for(c=t;c<e;c+=o)h=FC(c,n[c],n[c+1],h);else for(c=e-o;c>=t;c-=o)h=FC(c,n[c],n[c+1],h);return h&&Yd(h,h.next)&&(lh(h),h=h.next),h}function Dl(n,t){if(!n)return n;t||(t=n);var e=n,o;do if(o=!1,!e.steiner&&(Yd(e,e.next)||qr(e.prev,e,e.next)===0)){if(lh(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function ah(n,t,e,o,s,c,h){if(n){!h&&c&&YX(n,o,s,c);for(var p=n,g,m;n.prev!==n.next;){if(g=n.prev,m=n.next,c?zX(n,o,s,c):BX(n)){t.push(g.i/e|0),t.push(n.i/e|0),t.push(m.i/e|0),lh(n),n=m.next,p=m.next;continue}if(n=m,n===p){h?h===1?(n=GX(Dl(n),t,e),ah(n,t,e,o,s,c,2)):h===2&&kX(n,t,e,o,s,c):ah(Dl(n),t,e,o,s,c,1);break}}}}function BX(n){var t=n.prev,e=n,o=n.next;if(qr(t,e,o)>=0)return!1;for(var s=t.x,c=e.x,h=o.x,p=t.y,g=e.y,m=o.y,v=s<c?s<h?s:h:c<h?c:h,E=p<g?p<m?p:m:g<m?g:m,x=s>c?s>h?s:h:c>h?c:h,M=p>g?p>m?p:m:g>m?g:m,A=o.next;A!==t;){if(A.x>=v&&A.x<=x&&A.y>=E&&A.y<=M&&$c(s,p,c,g,h,m,A.x,A.y)&&qr(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function zX(n,t,e,o){var s=n.prev,c=n,h=n.next;if(qr(s,c,h)>=0)return!1;for(var p=s.x,g=c.x,m=h.x,v=s.y,E=c.y,x=h.y,M=p<g?p<m?p:m:g<m?g:m,A=v<E?v<x?v:x:E<x?E:x,I=p>g?p>m?p:m:g>m?g:m,S=v>E?v>x?v:x:E>x?E:x,w=kv(M,A,t,e,o),R=kv(I,S,t,e,o),C=n.prevZ,F=n.nextZ;C&&C.z>=w&&F&&F.z<=R;){if(C.x>=M&&C.x<=I&&C.y>=A&&C.y<=S&&C!==s&&C!==h&&$c(p,v,g,E,m,x,C.x,C.y)&&qr(C.prev,C,C.next)>=0||(C=C.prevZ,F.x>=M&&F.x<=I&&F.y>=A&&F.y<=S&&F!==s&&F!==h&&$c(p,v,g,E,m,x,F.x,F.y)&&qr(F.prev,F,F.next)>=0))return!1;F=F.nextZ}for(;C&&C.z>=w;){if(C.x>=M&&C.x<=I&&C.y>=A&&C.y<=S&&C!==s&&C!==h&&$c(p,v,g,E,m,x,C.x,C.y)&&qr(C.prev,C,C.next)>=0)return!1;C=C.prevZ}for(;F&&F.z<=R;){if(F.x>=M&&F.x<=I&&F.y>=A&&F.y<=S&&F!==s&&F!==h&&$c(p,v,g,E,m,x,F.x,F.y)&&qr(F.prev,F,F.next)>=0)return!1;F=F.nextZ}return!0}function GX(n,t,e){var o=n;do{var s=o.prev,c=o.next.next;!Yd(s,c)&&BC(s,o,o.next,c)&&uh(s,c)&&uh(c,s)&&(t.push(s.i/e|0),t.push(o.i/e|0),t.push(c.i/e|0),lh(o),lh(o.next),o=n=c),o=o.next}while(o!==n);return Dl(o)}function kX(n,t,e,o,s,c){var h=n;do{for(var p=h.next.next;p!==h.prev;){if(h.i!==p.i&&JX(h,p)){var g=zC(h,p);h=Dl(h,h.next),g=Dl(g,g.next),ah(h,t,e,o,s,c,0),ah(g,t,e,o,s,c,0);return}p=p.next}h=h.next}while(h!==n)}function qX(n,t,e,o){var s=[],c,h,p,g,m;for(c=0,h=t.length;c<h;c++)p=t[c]*o,g=c<h-1?t[c+1]*o:n.length,m=UC(n,p,g,o,!1),m===m.next&&(m.steiner=!0),s.push(ZX(m));for(s.sort(HX),c=0;c<s.length;c++)e=VX(s[c],e);return e}function HX(n,t){return n.x-t.x}function VX(n,t){var e=WX(n,t);if(!e)return t;var o=zC(e,n);return Dl(o,o.next),Dl(e,e.next)}function WX(n,t){var e=t,o=n.x,s=n.y,c=-1/0,h;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var p=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(p<=o&&p>c&&(c=p,h=e.x<e.next.x?e:e.next,p===o))return h}e=e.next}while(e!==t);if(!h)return null;var g=h,m=h.x,v=h.y,E=1/0,x;e=h;do o>=e.x&&e.x>=m&&o!==e.x&&$c(s<v?o:c,s,m,v,s<v?c:o,s,e.x,e.y)&&(x=Math.abs(s-e.y)/(o-e.x),uh(e,n)&&(x<E||x===E&&(e.x>h.x||e.x===h.x&&XX(h,e)))&&(h=e,E=x)),e=e.next;while(e!==g);return h}function XX(n,t){return qr(n.prev,n,t.prev)<0&&qr(t.next,n,n.next)<0}function YX(n,t,e,o){var s=n;do s.z===0&&(s.z=kv(s.x,s.y,t,e,o)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,$X(s)}function $X(n){var t,e,o,s,c,h,p,g,m=1;do{for(e=n,n=null,c=null,h=0;e;){for(h++,o=e,p=0,t=0;t<m&&(p++,o=o.nextZ,!!o);t++);for(g=m;p>0||g>0&&o;)p!==0&&(g===0||!o||e.z<=o.z)?(s=e,e=e.nextZ,p--):(s=o,o=o.nextZ,g--),c?c.nextZ=s:n=s,s.prevZ=c,c=s;e=o}c.nextZ=null,m*=2}while(h>1);return n}function kv(n,t,e,o,s){return n=(n-e)*s|0,t=(t-o)*s|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,n|t<<1}function ZX(n){var t=n,e=n;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==n);return e}function $c(n,t,e,o,s,c,h,p){return(s-h)*(t-p)>=(n-h)*(c-p)&&(n-h)*(o-p)>=(e-h)*(t-p)&&(e-h)*(c-p)>=(s-h)*(o-p)}function JX(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!KX(n,t)&&(uh(n,t)&&uh(t,n)&&jX(n,t)&&(qr(n.prev,n,t.prev)||qr(n,t.prev,t))||Yd(n,t)&&qr(n.prev,n,n.next)>0&&qr(t.prev,t,t.next)>0)}function qr(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function Yd(n,t){return n.x===t.x&&n.y===t.y}function BC(n,t,e,o){var s=Wd(qr(n,t,e)),c=Wd(qr(n,t,o)),h=Wd(qr(e,o,n)),p=Wd(qr(e,o,t));return!!(s!==c&&h!==p||s===0&&Vd(n,e,t)||c===0&&Vd(n,o,t)||h===0&&Vd(e,n,o)||p===0&&Vd(e,t,o))}function Vd(n,t,e){return t.x<=Math.max(n.x,e.x)&&t.x>=Math.min(n.x,e.x)&&t.y<=Math.max(n.y,e.y)&&t.y>=Math.min(n.y,e.y)}function Wd(n){return n>0?1:n<0?-1:0}function KX(n,t){var e=n;do{if(e.i!==n.i&&e.next.i!==n.i&&e.i!==t.i&&e.next.i!==t.i&&BC(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function uh(n,t){return qr(n.prev,n,n.next)<0?qr(n,t,n.next)>=0&&qr(n,n.prev,t)>=0:qr(n,t,n.prev)<0||qr(n,n.next,t)<0}function jX(n,t){var e=n,o=!1,s=(n.x+t.x)/2,c=(n.y+t.y)/2;do e.y>c!=e.next.y>c&&e.next.y!==e.y&&s<(e.next.x-e.x)*(c-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==n);return o}function zC(n,t){var e=new qv(n.i,n.x,n.y),o=new qv(t.i,t.x,t.y),s=n.next,c=t.prev;return n.next=t,t.prev=n,e.next=s,s.prev=e,o.next=e,e.prev=o,c.next=o,o.prev=c,o}function FC(n,t,e,o){var s=new qv(n,t,e);return o?(s.next=o.next,s.prev=o,o.next.prev=s,o.next=s):(s.prev=s,s.next=s),s}function lh(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function qv(n,t,e){this.i=n,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Xd.deviation=function(n,t,e,o){var s=t&&t.length,c=s?t[0]*e:n.length,h=Math.abs(Hv(n,0,c,e));if(s)for(var p=0,g=t.length;p<g;p++){var m=t[p]*e,v=p<g-1?t[p+1]*e:n.length;h-=Math.abs(Hv(n,m,v,e))}var E=0;for(p=0;p<o.length;p+=3){var x=o[p]*e,M=o[p+1]*e,A=o[p+2]*e;E+=Math.abs((n[x]-n[A])*(n[M+1]-n[x+1])-(n[x]-n[M])*(n[A+1]-n[x+1]))}return h===0&&E===0?0:Math.abs((E-h)/h)};function Hv(n,t,e,o){for(var s=0,c=t,h=e-o;c<e;c+=o)s+=(n[h]-n[c])*(n[c+1]+n[h+1]),h=c;return s}Xd.flatten=function(n){for(var t=n[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,s=0;s<n.length;s++){for(var c=0;c<n[s].length;c++)for(var h=0;h<t;h++)e.vertices.push(n[s][c][h]);s>0&&(o+=n[s-1].length,e.holes.push(o))}return e}});var Zv=st(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.earthRadius=63710088e-1;Oe.factors={centimeters:Oe.earthRadius*100,centimetres:Oe.earthRadius*100,degrees:Oe.earthRadius/111325,feet:Oe.earthRadius*3.28084,inches:Oe.earthRadius*39.37,kilometers:Oe.earthRadius/1e3,kilometres:Oe.earthRadius/1e3,meters:Oe.earthRadius,metres:Oe.earthRadius,miles:Oe.earthRadius/1609.344,millimeters:Oe.earthRadius*1e3,millimetres:Oe.earthRadius*1e3,nauticalmiles:Oe.earthRadius/1852,radians:1,yards:Oe.earthRadius*1.0936};Oe.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/Oe.earthRadius,yards:1.0936133};Oe.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 Ku(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}Oe.feature=Ku;function t7(n,t,e){switch(e===void 0&&(e={}),n){case"Point":return Wv(t).geometry;case"LineString":return Yv(t).geometry;case"Polygon":return Xv(t).geometry;case"MultiPoint":return qC(t).geometry;case"MultiLineString":return kC(t).geometry;case"MultiPolygon":return HC(t).geometry;default:throw new Error(n+" is invalid")}}Oe.geometry=t7;function Wv(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(!$d(n[0])||!$d(n[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:n};return Ku(o,t,e)}Oe.point=Wv;function e7(n,t,e){return e===void 0&&(e={}),Zd(n.map(function(o){return Wv(o,t)}),e)}Oe.points=e7;function Xv(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 h=0;h<c[c.length-1].length;h++)if(c[c.length-1][h]!==c[0][h])throw new Error("First and last Position are not equivalent.")}var p={type:"Polygon",coordinates:n};return Ku(p,t,e)}Oe.polygon=Xv;function n7(n,t,e){return e===void 0&&(e={}),Zd(n.map(function(o){return Xv(o,t)}),e)}Oe.polygons=n7;function Yv(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 Ku(o,t,e)}Oe.lineString=Yv;function r7(n,t,e){return e===void 0&&(e={}),Zd(n.map(function(o){return Yv(o,t)}),e)}Oe.lineStrings=r7;function Zd(n,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=n,e}Oe.featureCollection=Zd;function kC(n,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:n};return Ku(o,t,e)}Oe.multiLineString=kC;function qC(n,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:n};return Ku(o,t,e)}Oe.multiPoint=qC;function HC(n,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:n};return Ku(o,t,e)}Oe.multiPolygon=HC;function i7(n,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:n};return Ku(o,t,e)}Oe.geometryCollection=i7;function o7(n,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(n*e)/e}Oe.round=o7;function VC(n,t){t===void 0&&(t="kilometers");var e=Oe.factors[t];if(!e)throw new Error(t+" units is invalid");return n*e}Oe.radiansToLength=VC;function $v(n,t){t===void 0&&(t="kilometers");var e=Oe.factors[t];if(!e)throw new Error(t+" units is invalid");return n/e}Oe.lengthToRadians=$v;function s7(n,t){return WC($v(n,t))}Oe.lengthToDegrees=s7;function a7(n){var t=n%360;return t<0&&(t+=360),t}Oe.bearingToAzimuth=a7;function WC(n){var t=n%(2*Math.PI);return t*180/Math.PI}Oe.radiansToDegrees=WC;function u7(n){var t=n%360;return t*Math.PI/180}Oe.degreesToRadians=u7;function l7(n,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("length must be a positive number");return VC($v(n,t),e)}Oe.convertLength=l7;function c7(n,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("area must be a positive number");var o=Oe.areaFactors[t];if(!o)throw new Error("invalid original units");var s=Oe.areaFactors[e];if(!s)throw new Error("invalid final units");return n/o*s}Oe.convertArea=c7;function $d(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}Oe.isNumber=$d;function f7(n){return!!n&&n.constructor===Object}Oe.isObject=f7;function h7(n){if(!n)throw new Error("bbox is required");if(!Array.isArray(n))throw new Error("bbox must be an Array");if(n.length!==4&&n.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");n.forEach(function(t){if(!$d(t))throw new Error("bbox must only contain numbers")})}Oe.validateBBox=h7;function p7(n){if(!n)throw new Error("id is required");if(["string","number"].indexOf(typeof n)===-1)throw new Error("id must be a number or a string")}Oe.validateId=p7});var Kv=st(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});var lo=Zv();function ch(n,t,e){if(n!==null)for(var o,s,c,h,p,g,m,v=0,E=0,x,M=n.type,A=M==="FeatureCollection",I=M==="Feature",S=A?n.features.length:1,w=0;w<S;w++){m=A?n.features[w].geometry:I?n.geometry:n,x=m?m.type==="GeometryCollection":!1,p=x?m.geometries.length:1;for(var R=0;R<p;R++){var C=0,F=0;if(h=x?m.geometries[R]:m,h!==null){g=h.coordinates;var W=h.type;switch(v=e&&(W==="Polygon"||W==="MultiPolygon")?1:0,W){case null:break;case"Point":if(t(g,E,w,C,F)===!1)return!1;E++,C++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],E,w,C,F)===!1)return!1;E++,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],E,w,C,F)===!1)return!1;E++}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-v;c++){if(t(g[o][s][c],E,w,C,F)===!1)return!1;E++}F++}C++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(ch(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function d7(n,t,e,o){var s=e;return ch(n,function(c,h,p,g,m){h===0&&e===void 0?s=c:s=t(s,c,h,p,g,m)},o),s}function XC(n,t){var e;switch(n.type){case"FeatureCollection":for(e=0;e<n.features.length&&t(n.features[e].properties,e)!==!1;e++);break;case"Feature":t(n.properties,0);break}}function g7(n,t,e){var o=e;return XC(n,function(s,c){c===0&&e===void 0?o=s:o=t(o,s,c)}),o}function YC(n,t){if(n.type==="Feature")t(n,0);else if(n.type==="FeatureCollection")for(var e=0;e<n.features.length&&t(n.features[e],e)!==!1;e++);}function m7(n,t,e){var o=e;return YC(n,function(s,c){c===0&&e===void 0?o=s:o=t(o,s,c)}),o}function y7(n){var t=[];return ch(n,function(e){t.push(e)}),t}function Jv(n,t){var e,o,s,c,h,p,g,m,v,E,x=0,M=n.type==="FeatureCollection",A=n.type==="Feature",I=M?n.features.length:1;for(e=0;e<I;e++){for(p=M?n.features[e].geometry:A?n.geometry:n,m=M?n.features[e].properties:A?n.properties:{},v=M?n.features[e].bbox:A?n.bbox:void 0,E=M?n.features[e].id:A?n.id:void 0,g=p?p.type==="GeometryCollection":!1,h=g?p.geometries.length:1,s=0;s<h;s++){if(c=g?p.geometries[s]:p,c===null){if(t(null,x,m,v,E)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(c,x,m,v,E)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<c.geometries.length;o++)if(t(c.geometries[o],x,m,v,E)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}x++}}function v7(n,t,e){var o=e;return Jv(n,function(s,c,h,p,g){c===0&&e===void 0?o=s:o=t(o,s,c,h,p,g)}),o}function Jd(n,t){Jv(n,function(e,o,s,c,h){var p=e===null?null:e.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return t(lo.feature(e,s,{bbox:c,id:h}),o,0)===!1?!1:void 0}var g;switch(p){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],E={type:g,coordinates:v};if(t(lo.feature(E,s),o,m)===!1)return!1}})}function _7(n,t,e){var o=e;return Jd(n,function(s,c,h){c===0&&h===0&&e===void 0?o=s:o=t(o,s,c,h)}),o}function $C(n,t){Jd(n,function(e,o,s){var c=0;if(e.geometry){var h=e.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var p,g=0,m=0,v=0;if(ch(e,function(E,x,M,A,I){if(p===void 0||o>g||A>m||I>v){p=E,g=o,m=A,v=I,c=0;return}var S=lo.lineString([p,E],e.properties);if(t(S,o,s,I,c)===!1)return!1;c++,p=E})===!1)return!1}}})}function x7(n,t,e){var o=e,s=!1;return $C(n,function(c,h,p,g,m){s===!1&&e===void 0?o=c:o=t(o,c,h,p,g,m),s=!0}),o}function ZC(n,t){if(!n)throw new Error("geojson is required");Jd(n,function(e,o,s){if(e.geometry!==null){var c=e.geometry.type,h=e.geometry.coordinates;switch(c){case"LineString":if(t(e,o,s,0,0)===!1)return!1;break;case"Polygon":for(var p=0;p<h.length;p++)if(t(lo.lineString(h[p],e.properties),o,s,p)===!1)return!1;break}}})}function E7(n,t,e){var o=e;return ZC(n,function(s,c,h,p){c===0&&e===void 0?o=s:o=t(o,s,c,h,p)}),o}function w7(n,t){if(t=t||{},!lo.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,s=t.geometryIndex||0,c=t.segmentIndex||0,h=t.properties,p;switch(n.type){case"FeatureCollection":e<0&&(e=n.features.length+e),h=h||n.features[e].properties,p=n.features[e].geometry;break;case"Feature":h=h||n.properties,p=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=n;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var g=p.coordinates;switch(p.type){case"Point":case"MultiPoint":return null;case"LineString":return c<0&&(c=g.length+c-1),lo.lineString([g[c],g[c+1]],h,t);case"Polygon":return s<0&&(s=g.length+s),c<0&&(c=g[s].length+c-1),lo.lineString([g[s][c],g[s][c+1]],h,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c-1),lo.lineString([g[o][c],g[o][c+1]],h,t);case"MultiPolygon":return o<0&&(o=g.length+o),s<0&&(s=g[o].length+s),c<0&&(c=g[o][s].length-c-1),lo.lineString([g[o][s][c],g[o][s][c+1]],h,t)}throw new Error("geojson is invalid")}function S7(n,t){if(t=t||{},!lo.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,s=t.geometryIndex||0,c=t.coordIndex||0,h=t.properties,p;switch(n.type){case"FeatureCollection":e<0&&(e=n.features.length+e),h=h||n.features[e].properties,p=n.features[e].geometry;break;case"Feature":h=h||n.properties,p=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=n;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var g=p.coordinates;switch(p.type){case"Point":return lo.point(g,h,t);case"MultiPoint":return o<0&&(o=g.length+o),lo.point(g[o],h,t);case"LineString":return c<0&&(c=g.length+c),lo.point(g[c],h,t);case"Polygon":return s<0&&(s=g.length+s),c<0&&(c=g[s].length+c),lo.point(g[s][c],h,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c),lo.point(g[o][c],h,t);case"MultiPolygon":return o<0&&(o=g.length+o),s<0&&(s=g[o].length+s),c<0&&(c=g[o][s].length-c),lo.point(g[o][s][c],h,t)}throw new Error("geojson is invalid")}Ei.coordAll=y7;Ei.coordEach=ch;Ei.coordReduce=d7;Ei.featureEach=YC;Ei.featureReduce=m7;Ei.findPoint=S7;Ei.findSegment=w7;Ei.flattenEach=Jd;Ei.flattenReduce=_7;Ei.geomEach=Jv;Ei.geomReduce=v7;Ei.lineEach=ZC;Ei.lineReduce=E7;Ei.propEach=XC;Ei.propReduce=g7;Ei.segmentEach=$C;Ei.segmentReduce=x7});var JC=st(Qv=>{"use strict";Object.defineProperty(Qv,"__esModule",{value:!0});var M7=Kv();function jv(n){var t=[1/0,1/0,-1/0,-1/0];return M7.coordEach(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}jv.default=jv;Qv.default=jv});var Kd=st((Zit,t_)=>{var Ia=bv(),jC=Zv(),QC=Kv(),Zc=JC().default,b7=QC.featureEach,Yit=QC.coordEach,$it=jC.polygon,KC=jC.featureCollection;function tP(n){var t=new Ia(n);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Zc(e),Ia.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:Zc(s),o.push(s)}):b7(e,function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:Zc(s),o.push(s)}),Ia.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:Zc(e),Ia.prototype.remove.call(this,e,o)},t.clear=function(){return Ia.prototype.clear.call(this)},t.search=function(e){var o=Ia.prototype.search.call(this,this.toBBox(e));return KC(o)},t.collides=function(e){return Ia.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=Ia.prototype.all.call(this);return KC(e)},t.toJSON=function(){return Ia.prototype.toJSON.call(this)},t.fromJSON=function(e){return Ia.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=Zc(e);else if(e.type==="FeatureCollection")o=Zc(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}t_.exports=tP;t_.exports.default=tP});var s_=st((iat,cP)=>{"use strict";var lP=Object.prototype.toString;cP.exports=function(t){var e=lP.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&lP.call(t.callee)==="[object Function]"),o}});var _P=st((oat,vP)=>{"use strict";var yP;Object.keys||(ph=Object.prototype.hasOwnProperty,a_=Object.prototype.toString,fP=s_(),u_=Object.prototype.propertyIsEnumerable,hP=!u_.call({toString:null},"toString"),pP=u_.call(function(){},"prototype"),dh=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],ng=function(n){var t=n.constructor;return t&&t.prototype===n},dP={$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},gP=function(){if(typeof window=="undefined")return!1;for(var n in window)try{if(!dP["$"+n]&&ph.call(window,n)&&window[n]!==null&&typeof window[n]=="object")try{ng(window[n])}catch(t){return!0}}catch(t){return!0}return!1}(),mP=function(n){if(typeof window=="undefined"||!gP)return ng(n);try{return ng(n)}catch(t){return!1}},yP=function(t){var e=t!==null&&typeof t=="object",o=a_.call(t)==="[object Function]",s=fP(t),c=e&&a_.call(t)==="[object String]",h=[];if(!e&&!o&&!s)throw new TypeError("Object.keys called on a non-object");var p=pP&&o;if(c&&t.length>0&&!ph.call(t,0))for(var g=0;g<t.length;++g)h.push(String(g));if(s&&t.length>0)for(var m=0;m<t.length;++m)h.push(String(m));else for(var v in t)!(p&&v==="prototype")&&ph.call(t,v)&&h.push(String(v));if(hP)for(var E=mP(t),x=0;x<dh.length;++x)!(E&&dh[x]==="constructor")&&ph.call(t,dh[x])&&h.push(dh[x]);return h});var ph,a_,fP,u_,hP,pP,dh,ng,dP,gP,mP;vP.exports=yP});var l_=st((sat,wP)=>{"use strict";var D7=Array.prototype.slice,F7=s_(),xP=Object.keys,rg=xP?function(t){return xP(t)}:_P(),EP=Object.keys;rg.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 F7(o)?EP(D7.call(o)):EP(o)})}else Object.keys=rg;return Object.keys||rg};wP.exports=rg});var c_=st((aat,SP)=>{"use strict";SP.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 s=42;t[e]=s;for(var c 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 p=Object.getOwnPropertyDescriptor(t,e);if(p.value!==s||p.enumerable!==!0)return!1}return!0}});var ig=st((uat,MP)=>{"use strict";var U7=c_();MP.exports=function(){return U7()&&!!Symbol.toStringTag}});var f_=st((lat,bP)=>{"use strict";bP.exports=Object});var h_=st((cat,AP)=>{"use strict";AP.exports=Error});var CP=st((fat,TP)=>{"use strict";TP.exports=EvalError});var IP=st((hat,PP)=>{"use strict";PP.exports=RangeError});var LP=st((pat,RP)=>{"use strict";RP.exports=ReferenceError});var p_=st((dat,NP)=>{"use strict";NP.exports=SyntaxError});var Fl=st((gat,OP)=>{"use strict";OP.exports=TypeError});var FP=st((mat,DP)=>{"use strict";DP.exports=URIError});var BP=st((yat,UP)=>{"use strict";UP.exports=Math.abs});var GP=st((vat,zP)=>{"use strict";zP.exports=Math.floor});var qP=st((_at,kP)=>{"use strict";kP.exports=Math.max});var VP=st((xat,HP)=>{"use strict";HP.exports=Math.min});var XP=st((Eat,WP)=>{"use strict";WP.exports=Math.pow});var $P=st((wat,YP)=>{"use strict";YP.exports=Math.round});var JP=st((Sat,ZP)=>{"use strict";ZP.exports=Number.isNaN||function(t){return t!==t}});var jP=st((Mat,KP)=>{"use strict";var B7=JP();KP.exports=function(t){return B7(t)||t===0?t:t<0?-1:1}});var tI=st((bat,QP)=>{"use strict";QP.exports=Object.getOwnPropertyDescriptor});var Ul=st((Aat,eI)=>{"use strict";var og=tI();if(og)try{og([],"length")}catch(n){og=null}eI.exports=og});var gh=st((Tat,nI)=>{"use strict";var sg=Object.defineProperty||!1;if(sg)try{sg({},"a",{value:1})}catch(n){sg=!1}nI.exports=sg});var oI=st((Cat,iI)=>{"use strict";var rI=typeof Symbol!="undefined"&&Symbol,z7=c_();iI.exports=function(){return typeof rI!="function"||typeof Symbol!="function"||typeof rI("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:z7()}});var d_=st((Pat,sI)=>{"use strict";sI.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var g_=st((Iat,aI)=>{"use strict";var G7=f_();aI.exports=G7.getPrototypeOf||null});var cI=st((Rat,lI)=>{"use strict";var k7="Function.prototype.bind called on incompatible ",q7=Object.prototype.toString,H7=Math.max,V7="[object Function]",uI=function(t,e){for(var o=[],s=0;s<t.length;s+=1)o[s]=t[s];for(var c=0;c<e.length;c+=1)o[c+t.length]=e[c];return o},W7=function(t,e){for(var o=[],s=e||0,c=0;s<t.length;s+=1,c+=1)o[c]=t[s];return o},X7=function(n,t){for(var e="",o=0;o<n.length;o+=1)e+=n[o],o+1<n.length&&(e+=t);return e};lI.exports=function(t){var e=this;if(typeof e!="function"||q7.apply(e)!==V7)throw new TypeError(k7+e);for(var o=W7(arguments,1),s,c=function(){if(this instanceof s){var v=e.apply(this,uI(o,arguments));return Object(v)===v?v:this}return e.apply(t,uI(o,arguments))},h=H7(0,e.length-o.length),p=[],g=0;g<h;g++)p[g]="$"+g;if(s=Function("binder","return function ("+X7(p,",")+"){ return binder.apply(this,arguments); }")(c),e.prototype){var m=function(){};m.prototype=e.prototype,s.prototype=new m,m.prototype=null}return s}});var Jc=st((Lat,fI)=>{"use strict";var Y7=cI();fI.exports=Function.prototype.bind||Y7});var ag=st((Nat,hI)=>{"use strict";hI.exports=Function.prototype.call});var ug=st((Oat,pI)=>{"use strict";pI.exports=Function.prototype.apply});var gI=st((Dat,dI)=>{"use strict";dI.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var m_=st((Fat,mI)=>{"use strict";var $7=Jc(),Z7=ug(),J7=ag(),K7=gI();mI.exports=K7||$7.call(J7,Z7)});var lg=st((Uat,yI)=>{"use strict";var j7=Jc(),Q7=Fl(),tY=ag(),eY=m_();yI.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new Q7("a function is required");return eY(j7,tY,t)}});var SI=st((Bat,wI)=>{"use strict";var nY=lg(),vI=Ul(),xI;try{xI=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var y_=!!xI&&vI&&vI(Object.prototype,"__proto__"),EI=Object,_I=EI.getPrototypeOf;wI.exports=y_&&typeof y_.get=="function"?nY([y_.get]):typeof _I=="function"?function(t){return _I(t==null?t:EI(t))}:!1});var v_=st((zat,TI)=>{"use strict";var MI=d_(),bI=g_(),AI=SI();TI.exports=MI?function(t){return MI(t)}:bI?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return bI(t)}:AI?function(t){return AI(t)}:null});var __=st((Gat,CI)=>{"use strict";var rY=Function.prototype.call,iY=Object.prototype.hasOwnProperty,oY=Jc();CI.exports=oY.call(rY,iY)});var w_=st((kat,OI)=>{"use strict";var Hn,sY=f_(),aY=h_(),uY=CP(),lY=IP(),cY=LP(),tf=p_(),Qc=Fl(),fY=FP(),hY=BP(),pY=GP(),dY=qP(),gY=VP(),mY=XP(),yY=$P(),vY=jP(),LI=Function,x_=function(n){try{return LI('"use strict"; return ('+n+").constructor;")()}catch(t){}},mh=Ul(),_Y=gh(),E_=function(){throw new Qc},xY=mh?function(){try{return arguments.callee,E_}catch(n){try{return mh(arguments,"callee").get}catch(t){return E_}}}():E_,Kc=oI()(),ki=v_(),EY=g_(),wY=d_(),NI=ug(),yh=ag(),jc={},SY=typeof Uint8Array=="undefined"||!ki?Hn:ki(Uint8Array),Bl={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?Hn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Hn:ArrayBuffer,"%ArrayIteratorPrototype%":Kc&&ki?ki([][Symbol.iterator]()):Hn,"%AsyncFromSyncIteratorPrototype%":Hn,"%AsyncFunction%":jc,"%AsyncGenerator%":jc,"%AsyncGeneratorFunction%":jc,"%AsyncIteratorPrototype%":jc,"%Atomics%":typeof Atomics=="undefined"?Hn:Atomics,"%BigInt%":typeof BigInt=="undefined"?Hn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Hn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Hn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Hn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":aY,"%eval%":eval,"%EvalError%":uY,"%Float32Array%":typeof Float32Array=="undefined"?Hn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Hn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Hn:FinalizationRegistry,"%Function%":LI,"%GeneratorFunction%":jc,"%Int8Array%":typeof Int8Array=="undefined"?Hn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Hn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Hn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Kc&&ki?ki(ki([][Symbol.iterator]())):Hn,"%JSON%":typeof JSON=="object"?JSON:Hn,"%Map%":typeof Map=="undefined"?Hn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Kc||!ki?Hn:ki(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":sY,"%Object.getOwnPropertyDescriptor%":mh,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Hn:Promise,"%Proxy%":typeof Proxy=="undefined"?Hn:Proxy,"%RangeError%":lY,"%ReferenceError%":cY,"%Reflect%":typeof Reflect=="undefined"?Hn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Hn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Kc||!ki?Hn:ki(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Hn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Kc&&ki?ki(""[Symbol.iterator]()):Hn,"%Symbol%":Kc?Symbol:Hn,"%SyntaxError%":tf,"%ThrowTypeError%":xY,"%TypedArray%":SY,"%TypeError%":Qc,"%Uint8Array%":typeof Uint8Array=="undefined"?Hn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Hn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Hn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Hn:Uint32Array,"%URIError%":fY,"%WeakMap%":typeof WeakMap=="undefined"?Hn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Hn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Hn:WeakSet,"%Function.prototype.call%":yh,"%Function.prototype.apply%":NI,"%Object.defineProperty%":_Y,"%Object.getPrototypeOf%":EY,"%Math.abs%":hY,"%Math.floor%":pY,"%Math.max%":dY,"%Math.min%":gY,"%Math.pow%":mY,"%Math.round%":yY,"%Math.sign%":vY,"%Reflect.getPrototypeOf%":wY};if(ki)try{null.error}catch(n){PI=ki(ki(n)),Bl["%Error.prototype%"]=PI}var PI,MY=function n(t){var e;if(t==="%AsyncFunction%")e=x_("async function () {}");else if(t==="%GeneratorFunction%")e=x_("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=x_("async function* () {}");else if(t==="%AsyncGenerator%"){var o=n("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=n("%AsyncGenerator%");s&&ki&&(e=ki(s.prototype))}return Bl[t]=e,e},II={__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"]},vh=Jc(),cg=__(),bY=vh.call(yh,Array.prototype.concat),AY=vh.call(NI,Array.prototype.splice),RI=vh.call(yh,String.prototype.replace),fg=vh.call(yh,String.prototype.slice),TY=vh.call(yh,RegExp.prototype.exec),CY=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,PY=/\\\\(\\\\)?/g,IY=function(t){var e=fg(t,0,1),o=fg(t,-1);if(e==="%"&&o!=="%")throw new tf("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new tf("invalid intrinsic syntax, expected opening \`%\`");var s=[];return RI(t,CY,function(c,h,p,g){s[s.length]=p?RI(g,PY,"$1"):h||c}),s},RY=function(t,e){var o=t,s;if(cg(II,o)&&(s=II[o],o="%"+s[0]+"%"),cg(Bl,o)){var c=Bl[o];if(c===jc&&(c=MY(o)),typeof c=="undefined"&&!e)throw new Qc("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:o,value:c}}throw new tf("intrinsic "+t+" does not exist!")};OI.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Qc("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Qc('"allowMissing" argument must be a boolean');if(TY(/^%?[^%]*%?$/,t)===null)throw new tf("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=IY(t),s=o.length>0?o[0]:"",c=RY("%"+s+"%",e),h=c.name,p=c.value,g=!1,m=c.alias;m&&(s=m[0],AY(o,bY([0,1],m)));for(var v=1,E=!0;v<o.length;v+=1){var x=o[v],M=fg(x,0,1),A=fg(x,-1);if((M==='"'||M==="'"||M==="\`"||A==='"'||A==="'"||A==="\`")&&M!==A)throw new tf("property names with quotes must have matching quotes");if((x==="constructor"||!E)&&(g=!0),s+="."+x,h="%"+s+"%",cg(Bl,h))p=Bl[h];else if(p!=null){if(!(x in p)){if(!e)throw new Qc("base intrinsic for "+t+" exists, but the property is not available.");return}if(mh&&v+1>=o.length){var I=mh(p,x);E=!!I,E&&"get"in I&&!("originalValue"in I.get)?p=I.get:p=p[x]}else E=cg(p,x),p=p[x];E&&!g&&(Bl[h]=p)}}return p}});var hg=st((qat,UI)=>{"use strict";var DI=w_(),FI=lg(),LY=FI([DI("%String.prototype.indexOf%")]);UI.exports=function(t,e){var o=DI(t,!!e);return typeof o=="function"&&LY(t,".prototype.")>-1?FI([o]):o}});var GI=st((Hat,zI)=>{"use strict";var NY=ig()(),OY=hg(),S_=OY("Object.prototype.toString"),pg=function(t){return NY&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:S_(t)==="[object Arguments]"},BI=function(t){return pg(t)?!0:t!==null&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>=0&&S_(t)!=="[object Array]"&&"callee"in t&&S_(t.callee)==="[object Function]"},DY=function(){return pg(arguments)}();pg.isLegacyArguments=BI;zI.exports=DY?pg:BI});var dg=st((Vat,HI)=>{"use strict";var kI=gh(),FY=p_(),ef=Fl(),qI=Ul();HI.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new ef("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new ef("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ef("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ef("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ef("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ef("\`loose\`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,g=!!qI&&qI(t,e);if(kI)kI(t,e,{configurable:h===null&&g?g.configurable:!h,enumerable:s===null&&g?g.enumerable:!s,value:o,writable:c===null&&g?g.writable:!c});else if(p||!s&&!c&&!h)t[e]=o;else throw new FY("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var gg=st((Wat,WI)=>{"use strict";var M_=gh(),VI=function(){return!!M_};VI.hasArrayLengthDefineBug=function(){if(!M_)return null;try{return M_([],"length",{value:1}).length!==1}catch(t){return!0}};WI.exports=VI});var nf=st((Xat,ZI)=>{"use strict";var UY=l_(),BY=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",zY=Object.prototype.toString,GY=Array.prototype.concat,XI=dg(),kY=function(n){return typeof n=="function"&&zY.call(n)==="[object Function]"},YI=gg()(),qY=function(n,t,e,o){if(t in n){if(o===!0){if(n[t]===e)return}else if(!kY(o)||!o())return}YI?XI(n,t,e,!0):XI(n,t,e)},$I=function(n,t){var e=arguments.length>2?arguments[2]:{},o=UY(t);BY&&(o=GY.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s<o.length;s+=1)qY(n,o[s],t[o[s]],e[o[s]])};$I.supportsDescriptors=!!YI;ZI.exports=$I});var tR=st((Yat,QI)=>{"use strict";var HY=w_(),JI=dg(),VY=gg()(),KI=Ul(),jI=Fl(),WY=HY("%Math.floor%");QI.exports=function(t,e){if(typeof t!="function")throw new jI("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||WY(e)!==e)throw new jI("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],s=!0,c=!0;if("length"in t&&KI){var h=KI(t,"length");h&&!h.configurable&&(s=!1),h&&!h.writable&&(c=!1)}return(s||c||!o)&&(VY?JI(t,"length",e,!0,!0):JI(t,"length",e)),t}});var nR=st(($at,eR)=>{"use strict";var XY=Jc(),YY=ug(),$Y=m_();eR.exports=function(){return $Y(XY,YY,arguments)}});var b_=st((Zat,mg)=>{"use strict";var ZY=tR(),rR=gh(),JY=lg(),iR=nR();mg.exports=function(t){var e=JY(arguments),o=t.length-(arguments.length-1);return ZY(e,1+(o>0?o:0),!0)};rR?rR(mg.exports,"apply",{value:iR}):mg.exports.apply=iR});var A_=st((Jat,sR)=>{"use strict";var oR=function(n){return n!==n};sR.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||oR(t)&&oR(e))}});var T_=st((Kat,aR)=>{"use strict";var KY=A_();aR.exports=function(){return typeof Object.is=="function"?Object.is:KY}});var lR=st((jat,uR)=>{"use strict";var jY=T_(),QY=nf();uR.exports=function(){var t=jY();return QY(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var pR=st((Qat,hR)=>{"use strict";var t$=nf(),e$=b_(),n$=A_(),cR=T_(),r$=lR(),fR=e$(cR(),Object);t$(fR,{getPolyfill:cR,implementation:n$,shim:r$});hR.exports=fR});var _R=st((tut,vR)=>{"use strict";var dR=hg(),i$=ig()(),o$=__(),s$=Ul(),I_;i$?(gR=dR("RegExp.prototype.exec"),C_={},yg=function(){throw C_},P_={toString:yg,valueOf:yg},typeof Symbol.toPrimitive=="symbol"&&(P_[Symbol.toPrimitive]=yg),I_=function(t){if(!t||typeof t!="object")return!1;var e=s$(t,"lastIndex"),o=e&&o$(e,"value");if(!o)return!1;try{gR(t,P_)}catch(s){return s===C_}}):(mR=dR("Object.prototype.toString"),yR="[object RegExp]",I_=function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:mR(t)===yR});var gR,C_,yg,P_,mR,yR;vR.exports=I_});var ER=st((eut,xR)=>{"use strict";var xh=function(){return typeof function(){}.name=="string"},_h=Object.getOwnPropertyDescriptor;if(_h)try{_h([],"length")}catch(n){_h=null}xh.functionsHaveConfigurableNames=function(){if(!xh()||!_h)return!1;var t=_h(function(){},"name");return!!t&&!!t.configurable};var a$=Function.prototype.bind;xh.boundFunctionsHaveNames=function(){return xh()&&typeof a$=="function"&&function(){}.bind().name!==""};xR.exports=xh});var MR=st((nut,SR)=>{"use strict";var wR=dg(),u$=gg()(),l$=ER().functionsHaveConfigurableNames(),c$=Fl();SR.exports=function(t,e){if(typeof t!="function")throw new c$("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||l$)&&(u$?wR(t,"name",e,!0,!0):wR(t,"name",e)),t}});var R_=st((rut,bR)=>{"use strict";var f$=MR(),h$=Fl(),p$=Object;bR.exports=f$(function(){if(this==null||this!==p$(this))throw new h$("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 L_=st((iut,AR)=>{"use strict";var d$=R_(),g$=nf().supportsDescriptors,m$=Object.getOwnPropertyDescriptor;AR.exports=function(){if(g$&&/a/mig.flags==="gim"){var t=m$(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 d$}});var PR=st((out,CR)=>{"use strict";var y$=nf().supportsDescriptors,v$=L_(),_$=Ul(),x$=Object.defineProperty,E$=h_(),TR=v_(),w$=/a/;CR.exports=function(){if(!y$||!TR)throw new E$("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=v$(),e=TR(w$),o=_$(e,"flags");return(!o||o.get!==t)&&x$(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var NR=st((sut,LR)=>{"use strict";var S$=nf(),M$=b_(),b$=R_(),IR=L_(),A$=PR(),RR=M$(IR());S$(RR,{getPolyfill:IR,implementation:b$,shim:A$});LR.exports=RR});var FR=st((aut,DR)=>{"use strict";var OR=hg(),T$=OR("Date.prototype.getDay"),C$=function(t){try{return T$(t),!0}catch(e){return!1}},P$=OR("Object.prototype.toString"),I$="[object Date]",R$=ig()();DR.exports=function(t){return typeof t!="object"||t===null?!1:R$?C$(t):P$(t)===I$}});var N_=st((uut,YR)=>{var UR=l_(),BR=GI(),zR=pR(),GR=_R(),kR=NR(),qR=FR(),HR=Date.prototype.getTime;function XR(n,t,e){var o=e||{};return(o.strict?zR(n,t):n===t)?!0:!n||!t||typeof n!="object"&&typeof t!="object"?o.strict?zR(n,t):n==t:L$(n,t,o)}function VR(n){return n==null}function WR(n){return!(!n||typeof n!="object"||typeof n.length!="number"||typeof n.copy!="function"||typeof n.slice!="function"||n.length>0&&typeof n[0]!="number")}function L$(n,t,e){var o,s;if(typeof n!=typeof t||VR(n)||VR(t)||n.prototype!==t.prototype||BR(n)!==BR(t))return!1;var c=GR(n),h=GR(t);if(c!==h)return!1;if(c||h)return n.source===t.source&&kR(n)===kR(t);if(qR(n)&&qR(t))return HR.call(n)===HR.call(t);var p=WR(n),g=WR(t);if(p!==g)return!1;if(p||g){if(n.length!==t.length)return!1;for(o=0;o<n.length;o++)if(n[o]!==t[o])return!1;return!0}if(typeof n!=typeof t)return!1;try{var m=UR(n),v=UR(t)}catch(E){return!1}if(m.length!==v.length)return!1;for(m.sort(),v.sort(),o=m.length-1;o>=0;o--)if(m[o]!=v[o])return!1;for(o=m.length-1;o>=0;o--)if(s=m[o],!XR(n[s],t[s],e))return!1;return!0}YR.exports=XR});var W_=st((dct,tL)=>{var wZ=N_(),Ra=function(n){this.precision=n&&n.precision?n.precision:17,this.direction=n&&n.direction?n.direction:!1,this.pseudoNode=n&&n.pseudoNode?n.pseudoNode:!1,this.objectComparator=n&&n.objectComparator?n.objectComparator:SZ};Ra.prototype.compare=function(n,t){if(n.type!==t.type||!QR(n,t))return!1;switch(n.type){case"Point":return this.compareCoord(n.coordinates,t.coordinates);case"LineString":return this.compareLine(n.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(n,t);case"Feature":return this.compareFeature(n,t);default:if(n.type.indexOf("Multi")===0){var e=this,o=jR(n),s=jR(t);return o.every(function(c){return this.some(function(h){return e.compare(c,h)})},s)}}return!1};function jR(n){return n.coordinates.map(function(t){return{type:n.type.replace("Multi",""),coordinates:t}})}function QR(n,t){return n.hasOwnProperty("coordinates")?n.coordinates.length===t.coordinates.length:n.length===t.length}Ra.prototype.compareCoord=function(n,t){if(n.length!==t.length)return!1;for(var e=0;e<n.length;e++)if(n[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};Ra.prototype.compareLine=function(n,t,e,o){if(!QR(n,t))return!1;var s=this.pseudoNode?n:this.removePseudo(n),c=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(s[0],c[0])&&(c=this.fixStartIndex(c,s),!c))){var h=this.compareCoord(s[e],c[e]);return this.direction||h?this.comparePath(s,c):this.compareCoord(s[e],c[c.length-(1+e)])?this.comparePath(s.slice().reverse(),c):!1}};Ra.prototype.fixStartIndex=function(n,t){for(var e,o=-1,s=0;s<n.length;s++)if(this.compareCoord(n[s],t[0])){o=s;break}return o>=0&&(e=[].concat(n.slice(o,n.length),n.slice(1,o+1))),e};Ra.prototype.comparePath=function(n,t){var e=this;return n.every(function(o,s){return e.compareCoord(o,this[s])},t)};Ra.prototype.comparePolygon=function(n,t){if(this.compareLine(n.coordinates[0],t.coordinates[0],1,!0)){var e=n.coordinates.slice(1,n.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),s=this;return e.every(function(c){return this.some(function(h){return s.compareLine(c,h,1,!0)})},o)}else return!1};Ra.prototype.compareFeature=function(n,t){return n.id!==t.id||!this.objectComparator(n.properties,t.properties)||!this.compareBBox(n,t)?!1:this.compare(n.geometry,t.geometry)};Ra.prototype.compareBBox=function(n,t){return!!(!n.bbox&&!t.bbox||n.bbox&&t.bbox&&this.compareCoord(n.bbox,t.bbox))};Ra.prototype.removePseudo=function(n){return n};function SZ(n,t){return wZ(n,t,{strict:!0})}tL.exports=Ra});var eL=st((Act,xg)=>{function Qu(n,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(n,t,e,o)}Qu.prototype.run=function(n,t,e,o){this._init(n,t,e,o);for(var s=0;s<this._datasetLength;s++)if(this._visited[s]!==1){this._visited[s]=1;var c=this._regionQuery(s);if(c.length<this.minPts)this.noise.push(s);else{var h=this.clusters.length;this.clusters.push([]),this._addToCluster(s,h),this._expandCluster(h,c)}}return this.clusters};Qu.prototype._init=function(n,t,e,o){if(n){if(!(n instanceof Array))throw Error("Dataset must be of type array, "+typeof n+" given");this.dataset=n,this.clusters=[],this.noise=[],this._datasetLength=n.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)};Qu.prototype._expandCluster=function(n,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var s=this._regionQuery(o);s.length>=this.minPts&&(t=this._mergeArrays(t,s))}this._assigned[o]!==1&&this._addToCluster(o,n)}};Qu.prototype._addToCluster=function(n,t){this.clusters[t].push(n),this._assigned[n]=1};Qu.prototype._regionQuery=function(n){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[n],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};Qu.prototype._mergeArrays=function(n,t){for(var e=t.length,o=0;o<e;o++){var s=t[o];n.indexOf(s)<0&&n.push(s)}return n};Qu.prototype._euclideanDistance=function(n,t){for(var e=0,o=Math.min(n.length,t.length);o--;)e+=(n[o]-t[o])*(n[o]-t[o]);return Math.sqrt(e)};typeof xg!="undefined"&&xg.exports&&(xg.exports=Qu)});var nL=st((Tct,Eg)=>{function tl(n,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(n,t,e)}tl.prototype.init=function(n,t,e){this.assignments=[],this.centroids=[],typeof n!="undefined"&&(this.dataset=n),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};tl.prototype.run=function(n,t){this.init(n,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var s=!0;s;){s=this.assign();for(var c=0;c<this.k;c++){for(var h=new Array(v),p=0,g=0;g<v;g++)h[g]=0;for(var m=0;m<e;m++){var v=this.dataset[m].length;if(c===this.assignments[m]){for(var g=0;g<v;g++)h[g]+=this.dataset[m][g];p++}}if(p>0){for(var g=0;g<v;g++)h[g]/=p;this.centroids[c]=h}else this.centroids[c]=this.randomCentroid(),s=!0}}return this.getClusters()};tl.prototype.randomCentroid=function(){var n=this.dataset.length-1,t,e;do e=Math.round(Math.random()*n),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};tl.prototype.assign=function(){for(var n=!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,n=!0);return n};tl.prototype.getClusters=function(){for(var n=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof n[t]=="undefined"&&(n[t]=[]),n[t].push(e);return n};tl.prototype.argmin=function(n,t,e){for(var o=Number.MAX_VALUE,s=0,c=t.length,h,p=0;p<c;p++)h=e(n,t[p]),h<o&&(o=h,s=p);return s};tl.prototype.distance=function(n,t){for(var e=0,o=Math.min(n.length,t.length);o--;){var s=n[o]-t[o];e+=s*s}return Math.sqrt(e)};typeof Eg!="undefined"&&Eg.exports&&(Eg.exports=tl)});var X_=st((Cct,wg)=>{function La(n,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(n,t,e)}La.prototype.insert=function(n,t){for(var e=this._queue.length,o=e;o--;){var s=this._priorities[o];this._sorting==="desc"?t>s&&(e=o):t<s&&(e=o)}this._insertAt(n,t,e)};La.prototype.remove=function(n){for(var t=this._queue.length;t--;){var e=this._queue[t];if(n===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};La.prototype.forEach=function(n){this._queue.forEach(n)};La.prototype.getElements=function(){return this._queue};La.prototype.getElementPriority=function(n){return this._priorities[n]};La.prototype.getPriorities=function(){return this._priorities};La.prototype.getElementsWithPriorities=function(){for(var n=[],t=0,e=this._queue.length;t<e;t++)n.push([this._queue[t],this._priorities[t]]);return n};La.prototype._init=function(n,t,e){if(n&&t){if(this._queue=[],this._priorities=[],n.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<n.length;o++)this.insert(n[o],t[o])}e&&(this._sorting=e)};La.prototype._insertAt=function(n,t,e){this._queue.length===e?(this._queue.push(n),this._priorities.push(t)):(this._queue.splice(e,0,n),this._priorities.splice(e,0,t))};typeof wg!="undefined"&&wg.exports&&(wg.exports=La)});var iL=st((Pct,of)=>{typeof of!="undefined"&&of.exports&&(rL=X_());var rL;function pu(n,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(n,t,e,o)}pu.prototype.run=function(n,t,e,o){this._init(n,t,e,o);for(var s=0,c=this.dataset.length;s<c;s++)if(this._processed[s]!==1){this._processed[s]=1,this.clusters.push([s]);var h=this.clusters.length-1;this._orderedList.push(s);var p=new rL(null,null,"asc"),g=this._regionQuery(s);this._distanceToCore(s)!==void 0&&(this._updateQueue(s,g,p),this._expandCluster(h,p))}return this.clusters};pu.prototype.getReachabilityPlot=function(){for(var n=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],s=this._reachability[o];n.push([o,s])}return n};pu.prototype._init=function(n,t,e,o){if(n){if(!(n instanceof Array))throw Error("Dataset must be of type array, "+typeof n+" given");this.dataset=n,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)};pu.prototype._updateQueue=function(n,t,e){var o=this;this._coreDistance=this._distanceToCore(n),t.forEach(function(s){if(o._processed[s]===void 0){var c=o.distance(o.dataset[n],o.dataset[s]),h=Math.max(o._coreDistance,c);o._reachability[s]===void 0?(o._reachability[s]=h,e.insert(s,h)):h<o._reachability[s]&&(o._reachability[s]=h,e.remove(s),e.insert(s,h))}})};pu.prototype._expandCluster=function(n,t){for(var e=t.getElements(),o=0,s=e.length;o<s;o++){var c=e[o];if(this._processed[c]===void 0){var h=this._regionQuery(c);this._processed[c]=1,this.clusters[n].push(c),this._orderedList.push(c),this._distanceToCore(c)!==void 0&&(this._updateQueue(c,h,t),this._expandCluster(n,t))}}};pu.prototype._distanceToCore=function(n){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(n,e);if(o.length>=this.minPts)return e}};pu.prototype._regionQuery=function(n,t){t=t||this.epsilon;for(var e=[],o=0,s=this.dataset.length;o<s;o++)this.distance(this.dataset[n],this.dataset[o])<t&&e.push(o);return e};pu.prototype._euclideanDistance=function(n,t){for(var e=0,o=Math.min(n.length,t.length);o--;)e+=(n[o]-t[o])*(n[o]-t[o]);return Math.sqrt(e)};typeof of!="undefined"&&of.exports&&(of.exports=pu)});var oL=st((Ict,Sg)=>{typeof Sg!="undefined"&&Sg.exports&&(Sg.exports={DBSCAN:eL(),KMEANS:nL(),OPTICS:iL(),PriorityQueue:X_()})});var Y_=st((Fct,aL)=>{"use strict";aL.exports={eudist:function(t,e,o){for(var s=t.length,c=0,h=0;h<s;h++){var p=(t[h]||0)-(e[h]||0);c+=p*p}return o?Math.sqrt(c):c},mandist:function(t,e,o){for(var s=t.length,c=0,h=0;h<s;h++)c+=Math.abs((t[h]||0)-(e[h]||0));return o?Math.sqrt(c):c},dist:function(t,e,o){var s=Math.abs(t-e);return o?s:s*s}}});var cL=st((Uct,lL)=>{"use strict";var uL=Y_(),PZ=uL.eudist,IZ=uL.dist;lL.exports={kmrand:function(t,e){for(var o={},s=[],c=e<<2,h=t.length,p=t[0].length>0;s.length<e&&c-- >0;){var g=t[Math.floor(Math.random()*h)],m=p?g.join("_"):""+g;o[m]||(o[m]=!0,s.push(g))}if(s.length<e)throw new Error("Error initializating clusters");return s},kmpp:function(t,e){var o=t[0].length?PZ:IZ,s=[],c=t.length,h=t[0].length>0,p={},g=t[Math.floor(Math.random()*c)],m=h?g.join("_"):""+g;for(s.push(g),p[m]=!0;s.length<e;){for(var v=[],E=s.length,x=0,M=[],A=0;A<c;A++){for(var I=1/0,S=0;S<E;S++){var w=o(t[A],s[S]);w<=I&&(I=w)}v[A]=I}for(var R=0;R<c;R++)x+=v[R];for(var C=0;C<c;C++)M[C]={i:C,v:t[C],pr:v[C]/x,cs:0};M.sort(function(q,D){return q.pr-D.pr}),M[0].cs=M[0].pr;for(var F=1;F<c;F++)M[F].cs=M[F-1].cs+M[F].pr;for(var W=Math.random(),X=0;X<c-1&&M[X++].cs<W;);s.push(M[X-1].v)}return s}}});var gL=st((Gct,dL)=>{"use strict";var $_=Y_(),pL=cL(),RZ=$_.eudist,Bct=$_.mandist,zct=$_.dist,LZ=pL.kmrand,NZ=pL.kmpp,fL=1e4;function hL(n,t,e){e=e||[];for(var o=0;o<n;o++)e[o]=t;return e}function OZ(n,t,e,o){var s=[],c=[],h=[],p=[],g=!1,m=o||fL,v=n.length,E=n[0].length,x=E>0,M=[];if(e)e=="kmrand"?s=LZ(n,t):e=="kmpp"?s=NZ(n,t):s=e;else for(var A={};s.length<t;){var I=Math.floor(Math.random()*v);A[I]||(A[I]=!0,s.push(n[I]))}do{hL(t,0,M);for(var S=0;S<v;S++){for(var w=1/0,R=0,C=0;C<t;C++){var p=x?RZ(n[S],s[C]):Math.abs(n[S]-s[C]);p<=w&&(w=p,R=C)}h[S]=R,M[R]++}for(var F=[],c=[],W=0,X=0;X<t;X++)F[X]=x?hL(E,0,F[X]):0,c[X]=s[X];if(x){for(var q=0;q<t;q++)s[q]=[];for(var D=0;D<v;D++)for(var xt=h[D],B=F[xt],j=n[D],J=0;J<E;J++)B[J]+=j[J];g=!0;for(var Dt=0;Dt<t;Dt++){for(var Q=s[Dt],At=F[Dt],Mt=c[Dt],Rt=M[Dt],pt=0;pt<E;pt++)Q[pt]=At[pt]/Rt||0;if(g){for(var yt=0;yt<E;yt++)if(Mt[yt]!=Q[yt]){g=!1;break}}}}else{for(var K=0;K<v;K++){var Bt=h[K];F[Bt]+=n[K]}for(var Gt=0;Gt<t;Gt++)s[Gt]=F[Gt]/M[Gt]||0;g=!0;for(var ae=0;ae<t;ae++)if(c[ae]!=s[ae]){g=!1;break}}g=g||--m<=0}while(!g);return{it:fL-m,k:t,idxs:h,centroids:s}}dL.exports=OZ});var cf=st((t1,e1)=>{(function(n,t){typeof t1=="object"&&typeof e1!="undefined"?e1.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n.polygonClipping=t())})(t1,function(){"use strict";function n(rt,P){var N={label:0,sent:function(){if(V[0]&1)throw V[1];return V[1]},trys:[],ops:[]},k,$,V,ht;return ht={next:at(0),throw:at(1),return:at(2)},typeof Symbol=="function"&&(ht[Symbol.iterator]=function(){return this}),ht;function at(Et){return function(G){return wt([Et,G])}}function wt(Et){if(k)throw new TypeError("Generator is already executing.");for(;N;)try{if(k=1,$&&(V=Et[0]&2?$.return:Et[0]?$.throw||((V=$.return)&&V.call($),0):$.next)&&!(V=V.call($,Et[1])).done)return V;switch($=0,V&&(Et=[Et[0]&2,V.value]),Et[0]){case 0:case 1:V=Et;break;case 4:return N.label++,{value:Et[1],done:!1};case 5:N.label++,$=Et[1],Et=[0];continue;case 7:Et=N.ops.pop(),N.trys.pop();continue;default:if(V=N.trys,!(V=V.length>0&&V[V.length-1])&&(Et[0]===6||Et[0]===2)){N=0;continue}if(Et[0]===3&&(!V||Et[1]>V[0]&&Et[1]<V[3])){N.label=Et[1];break}if(Et[0]===6&&N.label<V[1]){N.label=V[1],V=Et;break}if(V&&N.label<V[2]){N.label=V[2],N.ops.push(Et);break}V[2]&&N.ops.pop(),N.trys.pop();continue}Et=P.call(rt,N)}catch(G){Et=[6,G],$=0}finally{k=V=0}if(Et[0]&5)throw Et[1];return{value:Et[0]?Et[1]:void 0,done:!0}}}var t=function(){function rt(P,N){this.next=null,this.key=P,this.data=N,this.left=null,this.right=null}return rt}();function e(rt,P){return rt>P?1:rt<P?-1:0}function o(rt,P,N){for(var k=new t(null,null),$=k,V=k;;){var ht=N(rt,P.key);if(ht<0){if(P.left===null)break;if(N(rt,P.left.key)<0){var at=P.left;if(P.left=at.right,at.right=P,P=at,P.left===null)break}V.left=P,V=P,P=P.left}else if(ht>0){if(P.right===null)break;if(N(rt,P.right.key)>0){var at=P.right;if(P.right=at.left,at.left=P,P=at,P.right===null)break}$.right=P,$=P,P=P.right}else break}return $.right=P.left,V.left=P.right,P.left=k.right,P.right=k.left,P}function s(rt,P,N,k){var $=new t(rt,P);if(N===null)return $.left=$.right=null,$;N=o(rt,N,k);var V=k(rt,N.key);return V<0?($.left=N.left,$.right=N,N.left=null):V>=0&&($.right=N.right,$.left=N,N.right=null),$}function c(rt,P,N){var k=null,$=null;if(P){P=o(rt,P,N);var V=N(P.key,rt);V===0?(k=P.left,$=P.right):V<0?($=P.right,P.right=null,k=P):(k=P.left,P.left=null,$=P)}return{left:k,right:$}}function h(rt,P,N){return P===null?rt:(rt===null||(P=o(rt.key,P,N),P.left=rt),P)}function p(rt,P,N,k,$){if(rt){k(""+P+(N?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+$(rt)+\`
|
|
11552
11552
|
\`);var V=P+(N?" ":"\\u2502 ");rt.left&&p(rt.left,V,!1,k,$),rt.right&&p(rt.right,V,!0,k,$)}}var g=function(){function rt(P){P===void 0&&(P=e),this._root=null,this._size=0,this._comparator=P}return rt.prototype.insert=function(P,N){return this._size++,this._root=s(P,N,this._root,this._comparator)},rt.prototype.add=function(P,N){var k=new t(P,N);this._root===null&&(k.left=k.right=null,this._size++,this._root=k);var $=this._comparator,V=o(P,this._root,$),ht=$(P,V.key);return ht===0?this._root=V:(ht<0?(k.left=V.left,k.right=V,V.left=null):ht>0&&(k.right=V.right,k.left=V,V.right=null),this._size++,this._root=k),this._root},rt.prototype.remove=function(P){this._root=this._remove(P,this._root,this._comparator)},rt.prototype._remove=function(P,N,k){var $;if(N===null)return null;N=o(P,N,k);var V=k(P,N.key);return V===0?(N.left===null?$=N.right:($=o(P,N.left,k),$.right=N.right),this._size--,$):N},rt.prototype.pop=function(){var P=this._root;if(P){for(;P.left;)P=P.left;return this._root=o(P.key,this._root,this._comparator),this._root=this._remove(P.key,this._root,this._comparator),{key:P.key,data:P.data}}return null},rt.prototype.findStatic=function(P){for(var N=this._root,k=this._comparator;N;){var $=k(P,N.key);if($===0)return N;$<0?N=N.left:N=N.right}return null},rt.prototype.find=function(P){return this._root&&(this._root=o(P,this._root,this._comparator),this._comparator(P,this._root.key)!==0)?null:this._root},rt.prototype.contains=function(P){for(var N=this._root,k=this._comparator;N;){var $=k(P,N.key);if($===0)return!0;$<0?N=N.left:N=N.right}return!1},rt.prototype.forEach=function(P,N){for(var k=this._root,$=[],V=!1;!V;)k!==null?($.push(k),k=k.left):$.length!==0?(k=$.pop(),P.call(N,k),k=k.right):V=!0;return this},rt.prototype.range=function(P,N,k,$){for(var V=[],ht=this._comparator,at=this._root,wt;V.length!==0||at;)if(at)V.push(at),at=at.left;else{if(at=V.pop(),wt=ht(at.key,N),wt>0)break;if(ht(at.key,P)>=0&&k.call($,at))return this;at=at.right}return this},rt.prototype.keys=function(){var P=[];return this.forEach(function(N){var k=N.key;return P.push(k)}),P},rt.prototype.values=function(){var P=[];return this.forEach(function(N){var k=N.data;return P.push(k)}),P},rt.prototype.min=function(){return this._root?this.minNode(this._root).key:null},rt.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},rt.prototype.minNode=function(P){if(P===void 0&&(P=this._root),P)for(;P.left;)P=P.left;return P},rt.prototype.maxNode=function(P){if(P===void 0&&(P=this._root),P)for(;P.right;)P=P.right;return P},rt.prototype.at=function(P){for(var N=this._root,k=!1,$=0,V=[];!k;)if(N)V.push(N),N=N.left;else if(V.length>0){if(N=V.pop(),$===P)return N;$++,N=N.right}else k=!0;return null},rt.prototype.next=function(P){var N=this._root,k=null;if(P.right){for(k=P.right;k.left;)k=k.left;return k}for(var $=this._comparator;N;){var V=$(P.key,N.key);if(V===0)break;V<0?(k=N,N=N.left):N=N.right}return k},rt.prototype.prev=function(P){var N=this._root,k=null;if(P.left!==null){for(k=P.left;k.right;)k=k.right;return k}for(var $=this._comparator;N;){var V=$(P.key,N.key);if(V===0)break;V<0?N=N.left:(k=N,N=N.right)}return k},rt.prototype.clear=function(){return this._root=null,this._size=0,this},rt.prototype.toList=function(){return E(this._root)},rt.prototype.load=function(P,N,k){N===void 0&&(N=[]),k===void 0&&(k=!1);var $=P.length,V=this._comparator;if(k&&A(P,N,0,$-1,V),this._root===null)this._root=m(P,N,0,$),this._size=$;else{var ht=M(this.toList(),v(P,N),V);$=this._size+$,this._root=x({head:ht},0,$)}return this},rt.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(rt.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(rt.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),rt.prototype.toString=function(P){P===void 0&&(P=function(k){return String(k.key)});var N=[];return p(this._root,"",!0,function(k){return N.push(k)},P),N.join("")},rt.prototype.update=function(P,N,k){var $=this._comparator,V=c(P,this._root,$),ht=V.left,at=V.right;$(P,N)<0?at=s(N,k,at,$):ht=s(N,k,ht,$),this._root=h(ht,at,$)},rt.prototype.split=function(P){return c(P,this._root,this._comparator)},rt.prototype[Symbol.iterator]=function(){var P,N,k;return n(this,function($){switch($.label){case 0:P=this._root,N=[],k=!1,$.label=1;case 1:return k?[3,6]:P===null?[3,2]:(N.push(P),P=P.left,[3,5]);case 2:return N.length===0?[3,4]:(P=N.pop(),[4,P]);case 3:return $.sent(),P=P.right,[3,5];case 4:k=!0,$.label=5;case 5:return[3,1];case 6:return[2]}})},rt}();function m(rt,P,N,k){var $=k-N;if($>0){var V=N+Math.floor($/2),ht=rt[V],at=P[V],wt=new t(ht,at);return wt.left=m(rt,P,N,V),wt.right=m(rt,P,V+1,k),wt}return null}function v(rt,P){for(var N=new t(null,null),k=N,$=0;$<rt.length;$++)k=k.next=new t(rt[$],P[$]);return k.next=null,N.next}function E(rt){for(var P=rt,N=[],k=!1,$=new t(null,null),V=$;!k;)P?(N.push(P),P=P.left):N.length>0?(P=V=V.next=N.pop(),P=P.right):k=!0;return V.next=null,$.next}function x(rt,P,N){var k=N-P;if(k>0){var $=P+Math.floor(k/2),V=x(rt,P,$),ht=rt.head;return ht.left=V,rt.head=rt.head.next,ht.right=x(rt,$+1,N),ht}return null}function M(rt,P,N){for(var k=new t(null,null),$=k,V=rt,ht=P;V!==null&&ht!==null;)N(V.key,ht.key)<0?($.next=V,V=V.next):($.next=ht,ht=ht.next),$=$.next;return V!==null?$.next=V:ht!==null&&($.next=ht),k.next}function A(rt,P,N,k,$){if(!(N>=k)){for(var V=rt[N+k>>1],ht=N-1,at=k+1;;){do ht++;while($(rt[ht],V)<0);do at--;while($(rt[at],V)>0);if(ht>=at)break;var wt=rt[ht];rt[ht]=rt[at],rt[at]=wt,wt=P[ht],P[ht]=P[at],P[at]=wt}A(rt,P,N,at,$),A(rt,P,at+1,k,$)}}let I=(rt,P)=>rt.ll.x<=P.x&&P.x<=rt.ur.x&&rt.ll.y<=P.y&&P.y<=rt.ur.y,S=(rt,P)=>{if(P.ur.x<rt.ll.x||rt.ur.x<P.ll.x||P.ur.y<rt.ll.y||rt.ur.y<P.ll.y)return null;let N=rt.ll.x<P.ll.x?P.ll.x:rt.ll.x,k=rt.ur.x<P.ur.x?rt.ur.x:P.ur.x,$=rt.ll.y<P.ll.y?P.ll.y:rt.ll.y,V=rt.ur.y<P.ur.y?rt.ur.y:P.ur.y;return{ll:{x:N,y:$},ur:{x:k,y:V}}},w=Number.EPSILON;w===void 0&&(w=Math.pow(2,-52));let R=w*w,C=(rt,P)=>{if(-w<rt&&rt<w&&-w<P&&P<w)return 0;let N=rt-P;return N*N<R*rt*P?0:rt<P?-1:1};class F{constructor(){this.reset()}reset(){this.xRounder=new W,this.yRounder=new W}round(P,N){return{x:this.xRounder.round(P),y:this.yRounder.round(N)}}}class W{constructor(){this.tree=new g,this.round(0)}round(P){let N=this.tree.add(P),k=this.tree.prev(N);if(k!==null&&C(N.key,k.key)===0)return this.tree.remove(P),k.key;let $=this.tree.next(N);return $!==null&&C(N.key,$.key)===0?(this.tree.remove(P),$.key):P}}let X=new F,q=11102230246251565e-32,D=134217729,xt=(3+8*q)*q;function B(rt,P,N,k,$){let V,ht,at,wt,Et=P[0],G=k[0],ot=0,et=0;G>Et==G>-Et?(V=Et,Et=P[++ot]):(V=G,G=k[++et]);let lt=0;if(ot<rt&&et<N)for(G>Et==G>-Et?(ht=Et+V,at=V-(ht-Et),Et=P[++ot]):(ht=G+V,at=V-(ht-G),G=k[++et]),V=ht,at!==0&&($[lt++]=at);ot<rt&&et<N;)G>Et==G>-Et?(ht=V+Et,wt=ht-V,at=V-(ht-wt)+(Et-wt),Et=P[++ot]):(ht=V+G,wt=ht-V,at=V-(ht-wt)+(G-wt),G=k[++et]),V=ht,at!==0&&($[lt++]=at);for(;ot<rt;)ht=V+Et,wt=ht-V,at=V-(ht-wt)+(Et-wt),Et=P[++ot],V=ht,at!==0&&($[lt++]=at);for(;et<N;)ht=V+G,wt=ht-V,at=V-(ht-wt)+(G-wt),G=k[++et],V=ht,at!==0&&($[lt++]=at);return(V!==0||lt===0)&&($[lt++]=V),lt}function j(rt,P){let N=P[0];for(let k=1;k<rt;k++)N+=P[k];return N}function J(rt){return new Float64Array(rt)}let Dt=(3+16*q)*q,Q=(2+12*q)*q,At=(9+64*q)*q*q,Mt=J(4),Rt=J(8),pt=J(12),yt=J(16),K=J(4);function Bt(rt,P,N,k,$,V,ht){let at,wt,Et,G,ot,et,lt,Ft,Kt,me,ve,qe,Ue,Xe,Ze,Er,Zr,nr,Ie=rt-$,rr=N-$,pr=P-V,ar=k-V;Xe=Ie*ar,et=D*Ie,lt=et-(et-Ie),Ft=Ie-lt,et=D*ar,Kt=et-(et-ar),me=ar-Kt,Ze=Ft*me-(Xe-lt*Kt-Ft*Kt-lt*me),Er=pr*rr,et=D*pr,lt=et-(et-pr),Ft=pr-lt,et=D*rr,Kt=et-(et-rr),me=rr-Kt,Zr=Ft*me-(Er-lt*Kt-Ft*Kt-lt*me),ve=Ze-Zr,ot=Ze-ve,Mt[0]=Ze-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,Mt[1]=Ue-(ve+ot)+(ot-Er),nr=qe+ve,ot=nr-qe,Mt[2]=qe-(nr-ot)+(ve-ot),Mt[3]=nr;let Qn=j(4,Mt),Si=Q*ht;if(Qn>=Si||-Qn>=Si||(ot=rt-Ie,at=rt-(Ie+ot)+(ot-$),ot=N-rr,Et=N-(rr+ot)+(ot-$),ot=P-pr,wt=P-(pr+ot)+(ot-V),ot=k-ar,G=k-(ar+ot)+(ot-V),at===0&&wt===0&&Et===0&&G===0)||(Si=At*ht+xt*Math.abs(Qn),Qn+=Ie*G+ar*at-(pr*Et+rr*wt),Qn>=Si||-Qn>=Si))return Qn;Xe=at*ar,et=D*at,lt=et-(et-at),Ft=at-lt,et=D*ar,Kt=et-(et-ar),me=ar-Kt,Ze=Ft*me-(Xe-lt*Kt-Ft*Kt-lt*me),Er=wt*rr,et=D*wt,lt=et-(et-wt),Ft=wt-lt,et=D*rr,Kt=et-(et-rr),me=rr-Kt,Zr=Ft*me-(Er-lt*Kt-Ft*Kt-lt*me),ve=Ze-Zr,ot=Ze-ve,K[0]=Ze-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,K[1]=Ue-(ve+ot)+(ot-Er),nr=qe+ve,ot=nr-qe,K[2]=qe-(nr-ot)+(ve-ot),K[3]=nr;let ii=B(4,Mt,4,K,Rt);Xe=Ie*G,et=D*Ie,lt=et-(et-Ie),Ft=Ie-lt,et=D*G,Kt=et-(et-G),me=G-Kt,Ze=Ft*me-(Xe-lt*Kt-Ft*Kt-lt*me),Er=pr*Et,et=D*pr,lt=et-(et-pr),Ft=pr-lt,et=D*Et,Kt=et-(et-Et),me=Et-Kt,Zr=Ft*me-(Er-lt*Kt-Ft*Kt-lt*me),ve=Ze-Zr,ot=Ze-ve,K[0]=Ze-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,K[1]=Ue-(ve+ot)+(ot-Er),nr=qe+ve,ot=nr-qe,K[2]=qe-(nr-ot)+(ve-ot),K[3]=nr;let Z=B(ii,Rt,4,K,pt);Xe=at*G,et=D*at,lt=et-(et-at),Ft=at-lt,et=D*G,Kt=et-(et-G),me=G-Kt,Ze=Ft*me-(Xe-lt*Kt-Ft*Kt-lt*me),Er=wt*Et,et=D*wt,lt=et-(et-wt),Ft=wt-lt,et=D*Et,Kt=et-(et-Et),me=Et-Kt,Zr=Ft*me-(Er-lt*Kt-Ft*Kt-lt*me),ve=Ze-Zr,ot=Ze-ve,K[0]=Ze-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,K[1]=Ue-(ve+ot)+(ot-Er),nr=qe+ve,ot=nr-qe,K[2]=qe-(nr-ot)+(ve-ot),K[3]=nr;let mt=B(Z,pt,4,K,yt);return yt[mt-1]}function Gt(rt,P,N,k,$,V){let ht=(P-V)*(N-$),at=(rt-$)*(k-V),wt=ht-at,Et=Math.abs(ht+at);return Math.abs(wt)>=Dt*Et?wt:-Bt(rt,P,N,k,$,V,Et)}let ae=(rt,P)=>rt.x*P.y-rt.y*P.x,ut=(rt,P)=>rt.x*P.x+rt.y*P.y,Ut=(rt,P,N)=>{let k=Gt(rt.x,rt.y,P.x,P.y,N.x,N.y);return k>0?-1:k<0?1:0},jt=rt=>Math.sqrt(ut(rt,rt)),ce=(rt,P,N)=>{let k={x:P.x-rt.x,y:P.y-rt.y},$={x:N.x-rt.x,y:N.y-rt.y};return ae($,k)/jt($)/jt(k)},te=(rt,P,N)=>{let k={x:P.x-rt.x,y:P.y-rt.y},$={x:N.x-rt.x,y:N.y-rt.y};return ut($,k)/jt($)/jt(k)},$t=(rt,P,N)=>P.y===0?null:{x:rt.x+P.x/P.y*(N-rt.y),y:N},qt=(rt,P,N)=>P.x===0?null:{x:N,y:rt.y+P.y/P.x*(N-rt.x)},xe=(rt,P,N,k)=>{if(P.x===0)return qt(N,k,rt.x);if(k.x===0)return qt(rt,P,N.x);if(P.y===0)return $t(N,k,rt.y);if(k.y===0)return $t(rt,P,N.y);let $=ae(P,k);if($==0)return null;let V={x:N.x-rt.x,y:N.y-rt.y},ht=ae(V,P)/$,at=ae(V,k)/$,wt=rt.x+at*P.x,Et=N.x+ht*k.x,G=rt.y+at*P.y,ot=N.y+ht*k.y,et=(wt+Et)/2,lt=(G+ot)/2;return{x:et,y:lt}};class ft{static compare(P,N){let k=ft.comparePoints(P.point,N.point);return k!==0?k:(P.point!==N.point&&P.link(N),P.isLeft!==N.isLeft?P.isLeft?1:-1:ee.compare(P.segment,N.segment))}static comparePoints(P,N){return P.x<N.x?-1:P.x>N.x?1:P.y<N.y?-1:P.y>N.y?1:0}constructor(P,N){P.events===void 0?P.events=[this]:P.events.push(this),this.point=P,this.isLeft=N}link(P){if(P.point===this.point)throw new Error("Tried to link already linked events");let N=P.point.events;for(let k=0,$=N.length;k<$;k++){let V=N[k];this.point.events.push(V),V.point=this.point}this.checkForConsuming()}checkForConsuming(){let P=this.point.events.length;for(let N=0;N<P;N++){let k=this.point.events[N];if(k.segment.consumedBy===void 0)for(let $=N+1;$<P;$++){let V=this.point.events[$];V.consumedBy===void 0&&k.otherSE.point.events===V.otherSE.point.events&&k.segment.consume(V.segment)}}}getAvailableLinkedEvents(){let P=[];for(let N=0,k=this.point.events.length;N<k;N++){let $=this.point.events[N];$!==this&&!$.segment.ringOut&&$.segment.isInResult()&&P.push($)}return P}getLeftmostComparator(P){let N=new Map,k=$=>{let V=$.otherSE;N.set($,{sine:ce(this.point,P.point,V.point),cosine:te(this.point,P.point,V.point)})};return($,V)=>{N.has($)||k($),N.has(V)||k(V);let{sine:ht,cosine:at}=N.get($),{sine:wt,cosine:Et}=N.get(V);return ht>=0&&wt>=0?at<Et?1:at>Et?-1:0:ht<0&&wt<0?at<Et?-1:at>Et?1:0:wt<ht?-1:wt>ht?1:0}}}let We=0;class ee{static compare(P,N){let k=P.leftSE.point.x,$=N.leftSE.point.x,V=P.rightSE.point.x,ht=N.rightSE.point.x;if(ht<k)return 1;if(V<$)return-1;let at=P.leftSE.point.y,wt=N.leftSE.point.y,Et=P.rightSE.point.y,G=N.rightSE.point.y;if(k<$){if(wt<at&&wt<Et)return 1;if(wt>at&&wt>Et)return-1;let ot=P.comparePoint(N.leftSE.point);if(ot<0)return 1;if(ot>0)return-1;let et=N.comparePoint(P.rightSE.point);return et!==0?et:-1}if(k>$){if(at<wt&&at<G)return-1;if(at>wt&&at>G)return 1;let ot=N.comparePoint(P.leftSE.point);if(ot!==0)return ot;let et=P.comparePoint(N.rightSE.point);return et<0?1:et>0?-1:1}if(at<wt)return-1;if(at>wt)return 1;if(V<ht){let ot=N.comparePoint(P.rightSE.point);if(ot!==0)return ot}if(V>ht){let ot=P.comparePoint(N.rightSE.point);if(ot<0)return 1;if(ot>0)return-1}if(V!==ht){let ot=Et-at,et=V-k,lt=G-wt,Ft=ht-$;if(ot>et&<<Ft)return 1;if(ot<et&<>Ft)return-1}return V>ht?1:V<ht||Et<G?-1:Et>G?1:P.id<N.id?-1:P.id>N.id?1:0}constructor(P,N,k,$){this.id=++We,this.leftSE=P,P.segment=this,P.otherSE=N,this.rightSE=N,N.segment=this,N.otherSE=P,this.rings=k,this.windings=$}static fromRing(P,N,k){let $,V,ht,at=ft.comparePoints(P,N);if(at<0)$=P,V=N,ht=1;else if(at>0)$=N,V=P,ht=-1;else throw new Error(\`Tried to create degenerate segment at [\${P.x}, \${P.y}]\`);let wt=new ft($,!0),Et=new ft(V,!1);return new ee(wt,Et,[k],[ht])}replaceRightSE(P){this.rightSE=P,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let P=this.leftSE.point.y,N=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:P<N?P:N},ur:{x:this.rightSE.point.x,y:P>N?P:N}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(P){return P.x===this.leftSE.point.x&&P.y===this.leftSE.point.y||P.x===this.rightSE.point.x&&P.y===this.rightSE.point.y}comparePoint(P){if(this.isAnEndpoint(P))return 0;let N=this.leftSE.point,k=this.rightSE.point,$=this.vector();if(N.x===k.x)return P.x===N.x?0:P.x<N.x?1:-1;let V=(P.y-N.y)/$.y,ht=N.x+V*$.x;if(P.x===ht)return 0;let at=(P.x-N.x)/$.x,wt=N.y+at*$.y;return P.y===wt?0:P.y<wt?-1:1}getIntersection(P){let N=this.bbox(),k=P.bbox(),$=S(N,k);if($===null)return null;let V=this.leftSE.point,ht=this.rightSE.point,at=P.leftSE.point,wt=P.rightSE.point,Et=I(N,at)&&this.comparePoint(at)===0,G=I(k,V)&&P.comparePoint(V)===0,ot=I(N,wt)&&this.comparePoint(wt)===0,et=I(k,ht)&&P.comparePoint(ht)===0;if(G&&Et)return et&&!ot?ht:!et&&ot?wt:null;if(G)return ot&&V.x===wt.x&&V.y===wt.y?null:V;if(Et)return et&&ht.x===at.x&&ht.y===at.y?null:at;if(et&&ot)return null;if(et)return ht;if(ot)return wt;let lt=xe(V,this.vector(),at,P.vector());return lt===null||!I($,lt)?null:X.round(lt.x,lt.y)}split(P){let N=[],k=P.events!==void 0,$=new ft(P,!0),V=new ft(P,!1),ht=this.rightSE;this.replaceRightSE(V),N.push(V),N.push($);let at=new ee($,ht,this.rings.slice(),this.windings.slice());return ft.comparePoints(at.leftSE.point,at.rightSE.point)>0&&at.swapEvents(),ft.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),k&&($.checkForConsuming(),V.checkForConsuming()),N}swapEvents(){let P=this.rightSE;this.rightSE=this.leftSE,this.leftSE=P,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let N=0,k=this.windings.length;N<k;N++)this.windings[N]*=-1}consume(P){let N=this,k=P;for(;N.consumedBy;)N=N.consumedBy;for(;k.consumedBy;)k=k.consumedBy;let $=ee.compare(N,k);if($!==0){if($>0){let V=N;N=k,k=V}if(N.prev===k){let V=N;N=k,k=V}for(let V=0,ht=k.rings.length;V<ht;V++){let at=k.rings[V],wt=k.windings[V],Et=N.rings.indexOf(at);Et===-1?(N.rings.push(at),N.windings.push(wt)):N.windings[Et]+=wt}k.rings=null,k.windings=null,k.consumedBy=N,k.leftSE.consumedBy=N.leftSE,k.rightSE.consumedBy=N.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let P=this.prev.consumedBy||this.prev;this._beforeState=P.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let P=this.beforeState();this._afterState={rings:P.rings.slice(0),windings:P.windings.slice(0),multiPolys:[]};let N=this._afterState.rings,k=this._afterState.windings,$=this._afterState.multiPolys;for(let at=0,wt=this.rings.length;at<wt;at++){let Et=this.rings[at],G=this.windings[at],ot=N.indexOf(Et);ot===-1?(N.push(Et),k.push(G)):k[ot]+=G}let V=[],ht=[];for(let at=0,wt=N.length;at<wt;at++){if(k[at]===0)continue;let Et=N[at],G=Et.poly;if(ht.indexOf(G)===-1)if(Et.isExterior)V.push(G);else{ht.indexOf(G)===-1&&ht.push(G);let ot=V.indexOf(Et.poly);ot!==-1&&V.splice(ot,1)}}for(let at=0,wt=V.length;at<wt;at++){let Et=V[at].multiPoly;$.indexOf(Et)===-1&&$.push(Et)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let P=this.beforeState().multiPolys,N=this.afterState().multiPolys;switch(dt.type){case"union":{let k=P.length===0,$=N.length===0;this._isInResult=k!==$;break}case"intersection":{let k,$;P.length<N.length?(k=P.length,$=N.length):(k=N.length,$=P.length),this._isInResult=$===dt.numMultiPolys&&k<$;break}case"xor":{let k=Math.abs(P.length-N.length);this._isInResult=k%2===1;break}case"difference":{let k=$=>$.length===1&&$[0].isSubject;this._isInResult=k(P)!==k(N);break}default:throw new Error(\`Unrecognized operation type found \${dt.type}\`)}return this._isInResult}}class ge{constructor(P,N,k){if(!Array.isArray(P)||P.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=N,this.isExterior=k,this.segments=[],typeof P[0][0]!="number"||typeof P[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let $=X.round(P[0][0],P[0][1]);this.bbox={ll:{x:$.x,y:$.y},ur:{x:$.x,y:$.y}};let V=$;for(let ht=1,at=P.length;ht<at;ht++){if(typeof P[ht][0]!="number"||typeof P[ht][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let wt=X.round(P[ht][0],P[ht][1]);wt.x===V.x&&wt.y===V.y||(this.segments.push(ee.fromRing(V,wt,this)),wt.x<this.bbox.ll.x&&(this.bbox.ll.x=wt.x),wt.y<this.bbox.ll.y&&(this.bbox.ll.y=wt.y),wt.x>this.bbox.ur.x&&(this.bbox.ur.x=wt.x),wt.y>this.bbox.ur.y&&(this.bbox.ur.y=wt.y),V=wt)}($.x!==V.x||$.y!==V.y)&&this.segments.push(ee.fromRing(V,$,this))}getSweepEvents(){let P=[];for(let N=0,k=this.segments.length;N<k;N++){let $=this.segments[N];P.push($.leftSE),P.push($.rightSE)}return P}}class fe{constructor(P,N){if(!Array.isArray(P))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new ge(P[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let k=1,$=P.length;k<$;k++){let V=new ge(P[k],this,!1);V.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=V.bbox.ll.x),V.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=V.bbox.ll.y),V.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=V.bbox.ur.x),V.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=V.bbox.ur.y),this.interiorRings.push(V)}this.multiPoly=N}getSweepEvents(){let P=this.exteriorRing.getSweepEvents();for(let N=0,k=this.interiorRings.length;N<k;N++){let $=this.interiorRings[N].getSweepEvents();for(let V=0,ht=$.length;V<ht;V++)P.push($[V])}return P}}class Te{constructor(P,N){if(!Array.isArray(P))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof P[0][0][0]=="number"&&(P=[P])}catch(k){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let k=0,$=P.length;k<$;k++){let V=new fe(P[k],this);V.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=V.bbox.ll.x),V.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=V.bbox.ll.y),V.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=V.bbox.ur.x),V.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=V.bbox.ur.y),this.polys.push(V)}this.isSubject=N}getSweepEvents(){let P=[];for(let N=0,k=this.polys.length;N<k;N++){let $=this.polys[N].getSweepEvents();for(let V=0,ht=$.length;V<ht;V++)P.push($[V])}return P}}class be{static factory(P){let N=[];for(let k=0,$=P.length;k<$;k++){let V=P[k];if(!V.isInResult()||V.ringOut)continue;let ht=null,at=V.leftSE,wt=V.rightSE,Et=[at],G=at.point,ot=[];for(;ht=at,at=wt,Et.push(at),at.point!==G;)for(;;){let et=at.getAvailableLinkedEvents();if(et.length===0){let Kt=Et[0].point,me=Et[Et.length-1].point;throw new Error(\`Unable to complete output ring starting at [\${Kt.x}, \${Kt.y}]. Last matching segment found ends at [\${me.x}, \${me.y}].\`)}if(et.length===1){wt=et[0].otherSE;break}let lt=null;for(let Kt=0,me=ot.length;Kt<me;Kt++)if(ot[Kt].point===at.point){lt=Kt;break}if(lt!==null){let Kt=ot.splice(lt)[0],me=Et.splice(Kt.index);me.unshift(me[0].otherSE),N.push(new be(me.reverse()));continue}ot.push({index:Et.length,point:at.point});let Ft=at.getLeftmostComparator(ht);wt=et.sort(Ft)[0].otherSE;break}N.push(new be(Et))}return N}constructor(P){this.events=P;for(let N=0,k=P.length;N<k;N++)P[N].segment.ringOut=this;this.poly=null}getGeom(){let P=this.events[0].point,N=[P];for(let Et=1,G=this.events.length-1;Et<G;Et++){let ot=this.events[Et].point,et=this.events[Et+1].point;Ut(ot,P,et)!==0&&(N.push(ot),P=ot)}if(N.length===1)return null;let k=N[0],$=N[1];Ut(k,P,$)===0&&N.shift(),N.push(N[0]);let V=this.isExteriorRing()?1:-1,ht=this.isExteriorRing()?0:N.length-1,at=this.isExteriorRing()?N.length:-1,wt=[];for(let Et=ht;Et!=at;Et+=V)wt.push([N[Et].x,N[Et].y]);return wt}isExteriorRing(){if(this._isExteriorRing===void 0){let P=this.enclosingRing();this._isExteriorRing=P?!P.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let P=this.events[0];for(let $=1,V=this.events.length;$<V;$++){let ht=this.events[$];ft.compare(P,ht)>0&&(P=ht)}let N=P.segment.prevInResult(),k=N?N.prevInResult():null;for(;;){if(!N)return null;if(!k)return N.ringOut;if(k.ringOut!==N.ringOut)return k.ringOut.enclosingRing()!==N.ringOut?N.ringOut:N.ringOut.enclosingRing();N=k.prevInResult(),k=N?N.prevInResult():null}}}class Wt{constructor(P){this.exteriorRing=P,P.poly=this,this.interiorRings=[]}addInterior(P){this.interiorRings.push(P),P.poly=this}getGeom(){let P=[this.exteriorRing.getGeom()];if(P[0]===null)return null;for(let N=0,k=this.interiorRings.length;N<k;N++){let $=this.interiorRings[N].getGeom();$!==null&&P.push($)}return P}}class Me{constructor(P){this.rings=P,this.polys=this._composePolys(P)}getGeom(){let P=[];for(let N=0,k=this.polys.length;N<k;N++){let $=this.polys[N].getGeom();$!==null&&P.push($)}return P}_composePolys(P){let N=[];for(let k=0,$=P.length;k<$;k++){let V=P[k];if(!V.poly)if(V.isExteriorRing())N.push(new Wt(V));else{let ht=V.enclosingRing();ht.poly||N.push(new Wt(ht)),ht.poly.addInterior(V)}}return N}}class tt{constructor(P){let N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ee.compare;this.queue=P,this.tree=new g(N),this.segments=[]}process(P){let N=P.segment,k=[];if(P.consumedBy)return P.isLeft?this.queue.remove(P.otherSE):this.tree.remove(N),k;let $=P.isLeft?this.tree.add(N):this.tree.find(N);if(!$)throw new Error(\`Unable to find segment #\${N.id} [\${N.leftSE.point.x}, \${N.leftSE.point.y}] -> [\${N.rightSE.point.x}, \${N.rightSE.point.y}] in SweepLine tree.\`);let V=$,ht=$,at,wt;for(;at===void 0;)V=this.tree.prev(V),V===null?at=null:V.key.consumedBy===void 0&&(at=V.key);for(;wt===void 0;)ht=this.tree.next(ht),ht===null?wt=null:ht.key.consumedBy===void 0&&(wt=ht.key);if(P.isLeft){let Et=null;if(at){let ot=at.getIntersection(N);if(ot!==null&&(N.isAnEndpoint(ot)||(Et=ot),!at.isAnEndpoint(ot))){let et=this._splitSafely(at,ot);for(let lt=0,Ft=et.length;lt<Ft;lt++)k.push(et[lt])}}let G=null;if(wt){let ot=wt.getIntersection(N);if(ot!==null&&(N.isAnEndpoint(ot)||(G=ot),!wt.isAnEndpoint(ot))){let et=this._splitSafely(wt,ot);for(let lt=0,Ft=et.length;lt<Ft;lt++)k.push(et[lt])}}if(Et!==null||G!==null){let ot=null;Et===null?ot=G:G===null?ot=Et:ot=ft.comparePoints(Et,G)<=0?Et:G,this.queue.remove(N.rightSE),k.push(N.rightSE);let et=N.split(ot);for(let lt=0,Ft=et.length;lt<Ft;lt++)k.push(et[lt])}k.length>0?(this.tree.remove(N),k.push(P)):(this.segments.push(N),N.prev=at)}else{if(at&&wt){let Et=at.getIntersection(wt);if(Et!==null){if(!at.isAnEndpoint(Et)){let G=this._splitSafely(at,Et);for(let ot=0,et=G.length;ot<et;ot++)k.push(G[ot])}if(!wt.isAnEndpoint(Et)){let G=this._splitSafely(wt,Et);for(let ot=0,et=G.length;ot<et;ot++)k.push(G[ot])}}}this.tree.remove(N)}return k}_splitSafely(P,N){this.tree.remove(P);let k=P.rightSE;this.queue.remove(k);let $=P.split(N);return $.push(k),P.consumedBy===void 0&&this.tree.add(P),$}}let z=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Pt=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Ot{run(P,N,k){dt.type=P,X.reset();let $=[new Te(N,!0)];for(let ot=0,et=k.length;ot<et;ot++)$.push(new Te(k[ot],!1));if(dt.numMultiPolys=$.length,dt.type==="difference"){let ot=$[0],et=1;for(;et<$.length;)S($[et].bbox,ot.bbox)!==null?et++:$.splice(et,1)}if(dt.type==="intersection")for(let ot=0,et=$.length;ot<et;ot++){let lt=$[ot];for(let Ft=ot+1,Kt=$.length;Ft<Kt;Ft++)if(S(lt.bbox,$[Ft].bbox)===null)return[]}let V=new g(ft.compare);for(let ot=0,et=$.length;ot<et;ot++){let lt=$[ot].getSweepEvents();for(let Ft=0,Kt=lt.length;Ft<Kt;Ft++)if(V.insert(lt[Ft]),V.size>z)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let ht=new tt(V),at=V.size,wt=V.pop();for(;wt;){let ot=wt.key;if(V.size===at){let lt=ot.segment;throw new Error(\`Unable to pop() \${ot.isLeft?"left":"right"} SweepEvent [\${ot.point.x}, \${ot.point.y}] from segment #\${lt.id} [\${lt.leftSE.point.x}, \${lt.leftSE.point.y}] -> [\${lt.rightSE.point.x}, \${lt.rightSE.point.y}] from queue.\`)}if(V.size>z)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(ht.segments.length>Pt)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let et=ht.process(ot);for(let lt=0,Ft=et.length;lt<Ft;lt++){let Kt=et[lt];Kt.consumedBy===void 0&&V.insert(Kt)}at=V.size,wt=V.pop()}X.reset();let Et=be.factory(ht.segments);return new Me(Et).getGeom()}}let dt=new Ot;var ne={union:function(rt){for(var P=arguments.length,N=new Array(P>1?P-1:0),k=1;k<P;k++)N[k-1]=arguments[k];return dt.run("union",rt,N)},intersection:function(rt){for(var P=arguments.length,N=new Array(P>1?P-1:0),k=1;k<P;k++)N[k-1]=arguments[k];return dt.run("intersection",rt,N)},xor:function(rt){for(var P=arguments.length,N=new Array(P>1?P-1:0),k=1;k<P;k++)N[k-1]=arguments[k];return dt.run("xor",rt,N)},difference:function(rt){for(var P=arguments.length,N=new Array(P>1?P-1:0),k=1;k<P;k++)N[k-1]=arguments[k];return dt.run("difference",rt,N)}};return ne})});var OL=st((Tg,NL)=>{(function(n,t){typeof Tg=="object"&&typeof NL!="undefined"?t(Tg):typeof define=="function"&&define.amd?define(["exports"],t):t(n.jsts={})})(Tg,function(n){"use strict";function t(){}function e(r){this.message=r||""}function o(r){this.message=r||""}function s(r){this.message=r||""}function c(){}function h(r){return r===null?Ze:r.color}function p(r){return r===null?null:r.parent}function g(r,i){r!==null&&(r.color=i)}function m(r){return r===null?null:r.left}function v(r){return r===null?null:r.right}function E(){this.root_=null,this.size_=0}function x(){}function M(){this.array_=[],arguments[0]instanceof at&&this.addAll(arguments[0])}function A(){}function I(r){this.message=r||""}function S(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(r){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),a=Math.max(Math.min(i.length,9007199254740991),0)||0,l=1 in arguments&&parseInt(Number(arguments[1]),10)||0;l=l<0?Math.max(a+l,0):Math.min(l,a);var d=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:a;for(d=d<0?Math.max(a+arguments[2],0):Math.min(d,a);l<d;)i[l]=r,++l;return i},writable:!0}),Number.isFinite=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},Number.isInteger=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(r){return r!=r},Math.trunc=Math.trunc||function(r){return r<0?Math.ceil(r):Math.floor(r)};var w=function(){};w.prototype.interfaces_=function(){return[]},w.prototype.getClass=function(){return w},w.prototype.equalsWithTolerance=function(r,i,a){return Math.abs(r-i)<=a};var R=function(r){function i(a){r.call(this,a),this.name="IllegalArgumentException",this.message=a,this.stack=new r().stack}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i}(Error),C=function(){},F={MAX_VALUE:{configurable:!0}};C.isNaN=function(r){return Number.isNaN(r)},C.doubleToLongBits=function(r){return r},C.longBitsToDouble=function(r){return r},C.isInfinite=function(r){return!Number.isFinite(r)},F.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(C,F);var W=function(){},X=function(){},q=function(){},D=function r(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=r.NULL_ORDINATE;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.z=i.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=r.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},xt={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};D.prototype.setOrdinate=function(r,i){switch(r){case D.X:this.x=i;break;case D.Y:this.y=i;break;case D.Z:this.z=i;break;default:throw new R("Invalid ordinate index: "+r)}},D.prototype.equals2D=function(){if(arguments.length===1){var r=arguments[0];return this.x===r.x&&this.y===r.y}if(arguments.length===2){var i=arguments[0],a=arguments[1];return!!w.equalsWithTolerance(this.x,i.x,a)&&!!w.equalsWithTolerance(this.y,i.y,a)}},D.prototype.getOrdinate=function(r){switch(r){case D.X:return this.x;case D.Y:return this.y;case D.Z:return this.z}throw new R("Invalid ordinate index: "+r)},D.prototype.equals3D=function(r){return this.x===r.x&&this.y===r.y&&(this.z===r.z||C.isNaN(this.z))&&C.isNaN(r.z)},D.prototype.equals=function(r){return r instanceof D&&this.equals2D(r)},D.prototype.equalInZ=function(r,i){return w.equalsWithTolerance(this.z,r.z,i)},D.prototype.compareTo=function(r){var i=r;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0},D.prototype.clone=function(){},D.prototype.copy=function(){return new D(this)},D.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},D.prototype.distance3D=function(r){var i=this.x-r.x,a=this.y-r.y,l=this.z-r.z;return Math.sqrt(i*i+a*a+l*l)},D.prototype.distance=function(r){var i=this.x-r.x,a=this.y-r.y;return Math.sqrt(i*i+a*a)},D.prototype.hashCode=function(){var r=17;return r=37*r+D.hashCode(this.x),r=37*r+D.hashCode(this.y)},D.prototype.setCoordinate=function(r){this.x=r.x,this.y=r.y,this.z=r.z},D.prototype.interfaces_=function(){return[W,X,t]},D.prototype.getClass=function(){return D},D.hashCode=function(){if(arguments.length===1){var r=arguments[0],i=C.doubleToLongBits(r);return Math.trunc((i^i)>>>32)}},xt.DimensionalComparator.get=function(){return B},xt.serialVersionUID.get=function(){return 6683108902428367e3},xt.NULL_ORDINATE.get=function(){return C.NaN},xt.X.get=function(){return 0},xt.Y.get=function(){return 1},xt.Z.get=function(){return 2},Object.defineProperties(D,xt);var B=function(r){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var i=arguments[0];if(i!==2&&i!==3)throw new R("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};B.prototype.compare=function(r,i){var a=r,l=i,d=B.compare(a.x,l.x);if(d!==0)return d;var _=B.compare(a.y,l.y);return _!==0?_:this._dimensionsToTest<=2?0:B.compare(a.z,l.z)},B.prototype.interfaces_=function(){return[q]},B.prototype.getClass=function(){return B},B.compare=function(r,i){return r<i?-1:r>i?1:C.isNaN(r)?C.isNaN(i)?0:-1:C.isNaN(i)?1:0};var j=function(){};j.prototype.create=function(){},j.prototype.interfaces_=function(){return[]},j.prototype.getClass=function(){return j};var J=function(){},Dt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};J.prototype.interfaces_=function(){return[]},J.prototype.getClass=function(){return J},J.toLocationSymbol=function(r){switch(r){case J.EXTERIOR:return"e";case J.BOUNDARY:return"b";case J.INTERIOR:return"i";case J.NONE:return"-"}throw new R("Unknown location value: "+r)},Dt.INTERIOR.get=function(){return 0},Dt.BOUNDARY.get=function(){return 1},Dt.EXTERIOR.get=function(){return 2},Dt.NONE.get=function(){return-1},Object.defineProperties(J,Dt);var Q=function(r,i){return r.interfaces_&&r.interfaces_().indexOf(i)>-1},At=function(){},Mt={LOG_10:{configurable:!0}};At.prototype.interfaces_=function(){return[]},At.prototype.getClass=function(){return At},At.log10=function(r){var i=Math.log(r);return C.isInfinite(i)||C.isNaN(i)?i:i/At.LOG_10},At.min=function(r,i,a,l){var d=r;return i<d&&(d=i),a<d&&(d=a),l<d&&(d=l),d},At.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1],a=arguments[2];return r<i?i:r>a?a:r}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var l=arguments[0],d=arguments[1],_=arguments[2];return l<d?d:l>_?_:l}},At.wrap=function(r,i){return r<0?i- -r%i:r%i},At.max=function(){if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2],l=r;return i>l&&(l=i),a>l&&(l=a),l}if(arguments.length===4){var d=arguments[0],_=arguments[1],b=arguments[2],L=arguments[3],H=d;return _>H&&(H=_),b>H&&(H=b),L>H&&(H=L),H}},At.average=function(r,i){return(r+i)/2},Mt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(At,Mt);var Rt=function(r){this.str=r};Rt.prototype.append=function(r){this.str+=r},Rt.prototype.setCharAt=function(r,i){this.str=this.str.substr(0,r)+i+this.str.substr(r+1)},Rt.prototype.toString=function(r){return this.str};var pt=function(r){this.value=r};pt.prototype.intValue=function(){return this.value},pt.prototype.compareTo=function(r){return this.value<r?-1:this.value>r?1:0},pt.isNaN=function(r){return Number.isNaN(r)};var yt=function(){};yt.isWhitespace=function(r){return r<=32&&r>=0||r===127},yt.toUpperCase=function(r){return r.toUpperCase()};var K=function r(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var i=arguments[0];this.init(i)}else if(arguments[0]instanceof r){var a=arguments[0];this.init(a)}else if(typeof arguments[0]=="string"){var l=arguments[0];r.call(this,r.parse(l))}}else if(arguments.length===2){var d=arguments[0],_=arguments[1];this.init(d,_)}},Bt={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};K.prototype.le=function(r){return(this._hi<r._hi||this._hi===r._hi)&&this._lo<=r._lo},K.prototype.extractSignificantDigits=function(r,i){var a=this.abs(),l=K.magnitude(a._hi),d=K.TEN.pow(l);(a=a.divide(d)).gt(K.TEN)?(a=a.divide(K.TEN),l+=1):a.lt(K.ONE)&&(a=a.multiply(K.TEN),l-=1);for(var _=l+1,b=new Rt,L=K.MAX_PRINT_DIGITS-1,H=0;H<=L;H++){r&&H===_&&b.append(".");var it=Math.trunc(a._hi);if(it<0)break;var bt=!1,Tt=0;it>9?(bt=!0,Tt="9"):Tt="0"+it,b.append(Tt),a=a.subtract(K.valueOf(it)).multiply(K.TEN),bt&&a.selfAdd(K.TEN);var Jt=!0,Qt=K.magnitude(a._hi);if(Qt<0&&Math.abs(Qt)>=L-H&&(Jt=!1),!Jt)break}return i[0]=l,b.toString()},K.prototype.sqr=function(){return this.multiply(this)},K.prototype.doubleValue=function(){return this._hi+this._lo},K.prototype.subtract=function(){if(arguments[0]instanceof K){var r=arguments[0];return this.add(r.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},K.prototype.equals=function(){if(arguments.length===1){var r=arguments[0];return this._hi===r._hi&&this._lo===r._lo}},K.prototype.isZero=function(){return this._hi===0&&this._lo===0},K.prototype.selfSubtract=function(){if(arguments[0]instanceof K){var r=arguments[0];return this.isNaN()?this:this.selfAdd(-r._hi,-r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}},K.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},K.prototype.min=function(r){return this.le(r)?this:r},K.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof K){var r=arguments[0];return this.selfDivide(r._hi,r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1],d=null,_=null,b=null,L=null,H=null,it=null,bt=null,Tt=null;return H=this._hi/a,it=K.SPLIT*H,d=it-H,Tt=K.SPLIT*a,d=it-d,_=H-d,b=Tt-a,bt=H*a,b=Tt-b,L=a-b,Tt=d*b-bt+d*L+_*b+_*L,it=(this._hi-bt-Tt+this._lo-H*l)/a,Tt=H+it,this._hi=Tt,this._lo=H-Tt+it,this}},K.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},K.prototype.divide=function(){if(arguments[0]instanceof K){var r=arguments[0],i=null,a=null,l=null,d=null,_=null,b=null,L=null,H=null;return a=(_=this._hi/r._hi)-(i=(b=K.SPLIT*_)-(i=b-_)),H=i*(l=(H=K.SPLIT*r._hi)-(l=H-r._hi))-(L=_*r._hi)+i*(d=r._hi-l)+a*l+a*d,b=(this._hi-L-H+this._lo-_*r._lo)/r._hi,new K(H=_+b,_-H+b)}if(typeof arguments[0]=="number"){var it=arguments[0];return C.isNaN(it)?K.createNaN():K.copy(this).selfDivide(it,0)}},K.prototype.ge=function(r){return(this._hi>r._hi||this._hi===r._hi)&&this._lo>=r._lo},K.prototype.pow=function(r){if(r===0)return K.valueOf(1);var i=new K(this),a=K.valueOf(1),l=Math.abs(r);if(l>1)for(;l>0;)l%2==1&&a.selfMultiply(i),(l/=2)>0&&(i=i.sqr());else a=i;return r<0?a.reciprocal():a},K.prototype.ceil=function(){if(this.isNaN())return K.NaN;var r=Math.ceil(this._hi),i=0;return r===this._hi&&(i=Math.ceil(this._lo)),new K(r,i)},K.prototype.compareTo=function(r){var i=r;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0},K.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},K.prototype.setValue=function(){if(arguments[0]instanceof K){var r=arguments[0];return this.init(r),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},K.prototype.max=function(r){return this.ge(r)?this:r},K.prototype.sqrt=function(){if(this.isZero())return K.valueOf(0);if(this.isNegative())return K.NaN;var r=1/Math.sqrt(this._hi),i=this._hi*r,a=K.valueOf(i),l=this.subtract(a.sqr())._hi*(.5*r);return a.add(l)},K.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof K){var r=arguments[0];return this.selfAdd(r._hi,r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],a=null,l=null,d=null,_=null,b=null,L=null;return d=this._hi+i,b=d-this._hi,_=d-b,_=i-b+(this._hi-_),L=_+this._lo,a=d+L,l=L+(d-a),this._hi=a+l,this._lo=l+(a-this._hi),this}}else if(arguments.length===2){var H=arguments[0],it=arguments[1],bt=null,Tt=null,Jt=null,Qt=null,le=null,Ee=null,Nn=null;Qt=this._hi+H,Tt=this._lo+it,le=Qt-(Ee=Qt-this._hi),Jt=Tt-(Nn=Tt-this._lo);var Kn=(bt=Qt+(Ee=(le=H-Ee+(this._hi-le))+Tt))+(Ee=(Jt=it-Nn+(this._lo-Jt))+(Ee+(Qt-bt))),ci=Ee+(bt-Kn);return this._hi=Kn,this._lo=ci,this}},K.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof K){var r=arguments[0];return this.selfMultiply(r._hi,r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1],d=null,_=null,b=null,L=null,H=null,it=null;d=(H=K.SPLIT*this._hi)-this._hi,it=K.SPLIT*a,d=H-d,_=this._hi-d,b=it-a;var bt=(H=this._hi*a)+(it=d*(b=it-b)-H+d*(L=a-b)+_*b+_*L+(this._hi*l+this._lo*a)),Tt=it+(d=H-bt);return this._hi=bt,this._lo=Tt,this}},K.prototype.selfSqr=function(){return this.selfMultiply(this)},K.prototype.floor=function(){if(this.isNaN())return K.NaN;var r=Math.floor(this._hi),i=0;return r===this._hi&&(i=Math.floor(this._lo)),new K(r,i)},K.prototype.negate=function(){return this.isNaN()?this:new K(-this._hi,-this._lo)},K.prototype.clone=function(){},K.prototype.multiply=function(){if(arguments[0]instanceof K){var r=arguments[0];return r.isNaN()?K.createNaN():K.copy(this).selfMultiply(r)}if(typeof arguments[0]=="number"){var i=arguments[0];return C.isNaN(i)?K.createNaN():K.copy(this).selfMultiply(i,0)}},K.prototype.isNaN=function(){return C.isNaN(this._hi)},K.prototype.intValue=function(){return Math.trunc(this._hi)},K.prototype.toString=function(){var r=K.magnitude(this._hi);return r>=-3&&r<=20?this.toStandardNotation():this.toSciNotation()},K.prototype.toStandardNotation=function(){var r=this.getSpecialNumberString();if(r!==null)return r;var i=new Array(1).fill(null),a=this.extractSignificantDigits(!0,i),l=i[0]+1,d=a;if(a.charAt(0)===".")d="0"+a;else if(l<0)d="0."+K.stringOfChar("0",-l)+a;else if(a.indexOf(".")===-1){var _=l-a.length;d=a+K.stringOfChar("0",_)+".0"}return this.isNegative()?"-"+d:d},K.prototype.reciprocal=function(){var r=null,i=null,a=null,l=null,d=null,_=null,b=null,L=null;i=(d=1/this._hi)-(r=(_=K.SPLIT*d)-(r=_-d)),a=(L=K.SPLIT*this._hi)-this._hi;var H=d+(_=(1-(b=d*this._hi)-(L=r*(a=L-a)-b+r*(l=this._hi-a)+i*a+i*l)-d*this._lo)/this._hi);return new K(H,d-H+_)},K.prototype.toSciNotation=function(){if(this.isZero())return K.SCI_NOT_ZERO;var r=this.getSpecialNumberString();if(r!==null)return r;var i=new Array(1).fill(null),a=this.extractSignificantDigits(!1,i),l=K.SCI_NOT_EXPONENT_CHAR+i[0];if(a.charAt(0)==="0")throw new Error("Found leading zero: "+a);var d="";a.length>1&&(d=a.substring(1));var _=a.charAt(0)+"."+d;return this.isNegative()?"-"+_+l:_+l},K.prototype.abs=function(){return this.isNaN()?K.NaN:this.isNegative()?this.negate():new K(this)},K.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},K.prototype.lt=function(r){return(this._hi<r._hi||this._hi===r._hi)&&this._lo<r._lo},K.prototype.add=function(){if(arguments[0]instanceof K){var r=arguments[0];return K.copy(this).selfAdd(r)}if(typeof arguments[0]=="number"){var i=arguments[0];return K.copy(this).selfAdd(i)}},K.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var r=arguments[0];this._hi=r,this._lo=0}else if(arguments[0]instanceof K){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this._hi=a,this._lo=l}},K.prototype.gt=function(r){return(this._hi>r._hi||this._hi===r._hi)&&this._lo>r._lo},K.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},K.prototype.trunc=function(){return this.isNaN()?K.NaN:this.isPositive()?this.floor():this.ceil()},K.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},K.prototype.interfaces_=function(){return[t,W,X]},K.prototype.getClass=function(){return K},K.sqr=function(r){return K.valueOf(r).selfMultiply(r)},K.valueOf=function(){if(typeof arguments[0]=="string"){var r=arguments[0];return K.parse(r)}if(typeof arguments[0]=="number"){var i=arguments[0];return new K(i)}},K.sqrt=function(r){return K.valueOf(r).sqrt()},K.parse=function(r){for(var i=0,a=r.length;yt.isWhitespace(r.charAt(i));)i++;var l=!1;if(i<a){var d=r.charAt(i);d!=="-"&&d!=="+"||(i++,d==="-"&&(l=!0))}for(var _=new K,b=0,L=0,H=0;!(i>=a);){var it=r.charAt(i);if(i++,yt.isDigit(it)){var bt=it-"0";_.selfMultiply(K.TEN),_.selfAdd(bt),b++}else{if(it!=="."){if(it==="e"||it==="E"){var Tt=r.substring(i);try{H=pt.parseInt(Tt)}catch(Nn){throw Nn instanceof Error?new Error("Invalid exponent "+Tt+" in string "+r):Nn}break}throw new Error("Unexpected character '"+it+"' at position "+i+" in string "+r)}L=b}}var Jt=_,Qt=b-L-H;if(Qt===0)Jt=_;else if(Qt>0){var le=K.TEN.pow(Qt);Jt=_.divide(le)}else if(Qt<0){var Ee=K.TEN.pow(-Qt);Jt=_.multiply(Ee)}return l?Jt.negate():Jt},K.createNaN=function(){return new K(C.NaN,C.NaN)},K.copy=function(r){return new K(r)},K.magnitude=function(r){var i=Math.abs(r),a=Math.log(i)/Math.log(10),l=Math.trunc(Math.floor(a));return 10*Math.pow(10,l)<=i&&(l+=1),l},K.stringOfChar=function(r,i){for(var a=new Rt,l=0;l<i;l++)a.append(r);return a.toString()},Bt.PI.get=function(){return new K(3.141592653589793,12246467991473532e-32)},Bt.TWO_PI.get=function(){return new K(6.283185307179586,24492935982947064e-32)},Bt.PI_2.get=function(){return new K(1.5707963267948966,6123233995736766e-32)},Bt.E.get=function(){return new K(2.718281828459045,14456468917292502e-32)},Bt.NaN.get=function(){return new K(C.NaN,C.NaN)},Bt.EPS.get=function(){return 123259516440783e-46},Bt.SPLIT.get=function(){return 134217729},Bt.MAX_PRINT_DIGITS.get=function(){return 32},Bt.TEN.get=function(){return K.valueOf(10)},Bt.ONE.get=function(){return K.valueOf(1)},Bt.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},Bt.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(K,Bt);var Gt=function(){},ae={DP_SAFE_EPSILON:{configurable:!0}};Gt.prototype.interfaces_=function(){return[]},Gt.prototype.getClass=function(){return Gt},Gt.orientationIndex=function(r,i,a){var l=Gt.orientationIndexFilter(r,i,a);if(l<=1)return l;var d=K.valueOf(i.x).selfAdd(-r.x),_=K.valueOf(i.y).selfAdd(-r.y),b=K.valueOf(a.x).selfAdd(-i.x),L=K.valueOf(a.y).selfAdd(-i.y);return d.selfMultiply(L).selfSubtract(_.selfMultiply(b)).signum()},Gt.signOfDet2x2=function(r,i,a,l){return r.multiply(l).selfSubtract(i.multiply(a)).signum()},Gt.intersection=function(r,i,a,l){var d=K.valueOf(l.y).selfSubtract(a.y).selfMultiply(K.valueOf(i.x).selfSubtract(r.x)),_=K.valueOf(l.x).selfSubtract(a.x).selfMultiply(K.valueOf(i.y).selfSubtract(r.y)),b=d.subtract(_),L=K.valueOf(l.x).selfSubtract(a.x).selfMultiply(K.valueOf(r.y).selfSubtract(a.y)),H=K.valueOf(l.y).selfSubtract(a.y).selfMultiply(K.valueOf(r.x).selfSubtract(a.x)),it=L.subtract(H).selfDivide(b).doubleValue(),bt=K.valueOf(r.x).selfAdd(K.valueOf(i.x).selfSubtract(r.x).selfMultiply(it)).doubleValue(),Tt=K.valueOf(i.x).selfSubtract(r.x).selfMultiply(K.valueOf(r.y).selfSubtract(a.y)),Jt=K.valueOf(i.y).selfSubtract(r.y).selfMultiply(K.valueOf(r.x).selfSubtract(a.x)),Qt=Tt.subtract(Jt).selfDivide(b).doubleValue(),le=K.valueOf(a.y).selfAdd(K.valueOf(l.y).selfSubtract(a.y).selfMultiply(Qt)).doubleValue();return new D(bt,le)},Gt.orientationIndexFilter=function(r,i,a){var l=null,d=(r.x-a.x)*(i.y-a.y),_=(r.y-a.y)*(i.x-a.x),b=d-_;if(d>0){if(_<=0)return Gt.signum(b);l=d+_}else{if(!(d<0)||_>=0)return Gt.signum(b);l=-d-_}var L=Gt.DP_SAFE_EPSILON*l;return b>=L||-b>=L?Gt.signum(b):2},Gt.signum=function(r){return r>0?1:r<0?-1:0},ae.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Gt,ae);var ut=function(){},Ut={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Ut.X.get=function(){return 0},Ut.Y.get=function(){return 1},Ut.Z.get=function(){return 2},Ut.M.get=function(){return 3},ut.prototype.setOrdinate=function(r,i,a){},ut.prototype.size=function(){},ut.prototype.getOrdinate=function(r,i){},ut.prototype.getCoordinate=function(){},ut.prototype.getCoordinateCopy=function(r){},ut.prototype.getDimension=function(){},ut.prototype.getX=function(r){},ut.prototype.clone=function(){},ut.prototype.expandEnvelope=function(r){},ut.prototype.copy=function(){},ut.prototype.getY=function(r){},ut.prototype.toCoordinateArray=function(){},ut.prototype.interfaces_=function(){return[X]},ut.prototype.getClass=function(){return ut},Object.defineProperties(ut,Ut);var jt=function(){},ce=function(r){function i(){r.call(this,"Projective point not representable on the Cartesian plane.")}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(jt),te=function(){};te.arraycopy=function(r,i,a,l,d){for(var _=0,b=i;b<i+d;b++)a[l+_]=r[b],_++},te.getProperty=function(r){return{"line.separator":\`
|