@aibee/crc-bmap 0.2.18 → 0.2.19
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/bmap.cjs.min.js +1 -1
- package/lib/bmap.cjs.min.js.map +1 -1
- package/lib/bmap.esm.js +1 -1
- package/lib/bmap.esm.js.map +1 -1
- package/lib/bmap.esm.min.js +1 -1
- package/lib/bmap.esm.min.js.map +1 -1
- package/lib/bmap.min.js +1 -1
- package/lib/bmap.min.js.map +1 -1
- package/package.json +1 -1
package/lib/bmap.cjs.min.js
CHANGED
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
}
|
|
104
104
|
`,i=-1/0,o=this.geometry.getAttribute("position");if(o)for(let c=0;c<o.count;c++){let l=o.getZ(c);l>i&&(i=l)}let a=new zt.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new zt.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new zt.Color(He(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:n,transparent:!0});this.material=a}initLineMaterial(){let t=Ut.createLineMaterial({color:this.options[0].strokeColor,opacity:this.options[0].strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new zt.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],n=this.options[0].height+this.options[0].deltaHeight;return this.options.map(i=>{let{coords:o}=i.geometry;for(let a=0;a<o.length;a++){let c=o[a];for(let l=0;l<c.length;l++){let s=c[l],u=l+1===c.length?c[0]:c[l+1];t.push(new zt.Vector3(s[0],s[1],n)),t.push(new zt.Vector3(u[0],u[1],n))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),n=new zt.BufferGeometry().setFromPoints(t);this.lineGeometry=n}createBorder(){this.line&&this.remove(this.line);let t=new zt.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){this.geometry.dispose(),this.material.dispose(),this.line?.geometry.dispose(),this.clear()}};var Yt=require("three");var Ka=require("lodash"),ap={text:"",icon:"",icon_size:[18,18],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0},he=class extends Yt.Object3D{constructor(t,n){super();this.context=t;this.options=xn((0,Ka.cloneDeep)({...ap,...n}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}options;textAspect=1;spriteText;spriteIcon;box=new Yt.Box2;boxHelper;_initIconPromise=null;get durIconAndText(){return this.options.icon&&this.options.text?2:0}get offset(){return this.options.icon&&this.options.text?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.options.text?this.options.text_font_size*this.textAspect:0}get textHeight(){return this.options.text?this.options.text_font_size:0}get deltaZ(){return .1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",async({value:t})=>{this._initIconPromise&&await this._initIconPromise,this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),await this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text",({value:t})=>{this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-icon_rotate",({value:t})=>{this.spriteIcon&&(this.spriteIcon.material.rotation=t/180*Math.PI)}),this.addEventListener("change-icon_size",({value:t})=>{this.spriteIcon&&this._initScale({zoom:this.context.camera.zoom})})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}async initIcon(){if(this.options.icon)return this._initIconPromise=new Promise(async t=>{let n=await an.getTextureByUrl(this.options.icon),i=new Yt.Sprite(new Yt.SpriteMaterial({map:n,transparent:!0,alphaTest:.2,depthTest:!1,rotation:this.options.icon_rotate/180*Math.PI}));i.visible=!1,i.renderOrder=1e5,n.needsUpdate=!0,this.add(i),this.spriteIcon=i,t(i)}).then(()=>{this._initIconPromise=null})}initText(){if(this.options.text){let t=sn.getTextureByText(this.options.text);this.textAspect=t.image.width/t.image.height;let n=new Yt.Sprite(new Yt.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:!1}));n.visible=!1,n.renderOrder=100001,t.needsUpdate=!0,this.spriteText=n,this.add(n)}}initSize(){let t=0,n=0,{icon:i,text:o}=this.options;i?o?(t=0,n=t*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(t=.5,n=0):o?(n=.5,t=0):(t=0,n=0),this.spriteIcon?.center.set(.5,t),this.spriteText?.center.set(.5,n)}async init(){await this.initIcon(),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}_initScale=({zoom:t})=>{if(this.spriteText){let n=this.textHeight/t;this.spriteText.scale.set(this.textAspect*n,n,.1)}this.spriteIcon&&this.spriteIcon?.scale.set(this.options.icon_size[0]/t,this.options.icon_size[1]/t,.1),this.resetZ()};resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:n,height:i}}=this.context,o=n*(t.x+1)/2,a=i*(-t.y+1)/2;a+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let c=this.iconWidth/2,l=new Yt.Box2(new Yt.Vector2(o-c,a-this.iconHeight),new Yt.Vector2(o+c,a)),s=this.textWidth/2,u=new Yt.Box2(new Yt.Vector2(o-s,a-this.textHeight-this.durIconAndText-this.iconHeight),new Yt.Vector2(o+s,a-this.iconHeight-this.durIconAndText));return this.box=u.union(l),this.box}renderBoxHelper(){if(!this.boxHelper){let t=document.createElement("div");t.style.position="fixed",t.style.border="1px solid red",t.style.pointerEvents="none",this.boxHelper=t,this.context.container.appendChild(t)}this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px"}parentSetVisible(t){this.spriteText&&(this.spriteText.visible=t),this.spriteIcon&&(this.spriteIcon.visible=t),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.unRegistryEvent(),this.spriteText=void 0}};var ve=require("three"),Ja=require("three/examples/jsm/utils/BufferGeometryUtils");var Qa={airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},texts:[],fillColor:"#ffffff",fillOpacity:0,strokeColor:"#ffffff",strokeOpacity:0,secondHeight:0,secondRotate:0,center_x:0,center_y:0},Mr=class extends ve.Object3D{constructor(t,n){super();this.context=t;this.options=n.map(i=>({...Qa,...i})),this.init()}options;mesh;async init(){let t=this.options.map(c=>sn.getTextureByText(c.texts[0],{fillStyle:Zr(c.fillColor,c.fillOpacity),strokeStyle:Zr(c.strokeColor,c.strokeOpacity),lineWidth:6,font:"54px sans-serif"})),n=t.map((c,l)=>{let s=this.options[l],{width:u,height:h}=c.image,f=u/h,d=s.secondHeight*f,g=new ve.PlaneGeometry(d,s.secondHeight),p=new ve.Matrix4().makeTranslation(s.center_x,s.center_y,s.airHeight+s.deltaHeight+s.height).multiply(new ve.Matrix4().makeRotationZ(s.secondRotate));return g.applyMatrix4(p),g}),i=(0,Ja.mergeGeometries)(n,!0);n.forEach(c=>c.dispose());let o=t.map(c=>{let l=new ve.MeshBasicMaterial({map:c,alphaTest:1,side:ve.DoubleSide});return c.needsUpdate=!0,l}),a=new ve.Mesh(i,o);this.mesh=a,this.position.z+=.004,this.add(a)}dispose(){this.mesh?.geometry.dispose(),(this.mesh?.material).forEach(t=>t.dispose()),this.clear()}};var tu=require("three"),oi=class extends ye{startPoint;endPoint;rect;frustum=new tu.Frustum;constructor(e){super(e);let{config:{selectBox:{fill:t,stroke:n}}}=e;this.rect=Ke(n,t),this.svg.appendChild(this.rect),this.registryEvent()}setEnable(e){super.setEnable(e),Jt(this.rect,0,0,0,0),e?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}onPointerDown=e=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(e);t&&(this.startPoint=t),this.endPoint=void 0};onPointerMove=e=>{if(!this.enable||!this.startPoint)return;let t=this.getIntersectByPointerEvent(e);t&&(this.endPoint=t)};onPointerUp=e=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(e);t&&(this.endPoint=t),this.doSelect(),this.startPoint=void 0};onUpdate=()=>{if(this.startPoint){let e=this.getSvgCoordinate(this.startPoint),t={...e};this.endPoint&&(t=this.getSvgCoordinate(this.endPoint));let n={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y)},i=Math.abs(t.x-e.x),o=Math.abs(t.y-e.y);Jt(this.rect,n.x,n.y,i,o)}else Jt(this.rect,0,0,0,0)};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:t,container:{clientWidth:n,clientHeight:i}}}=this,o=et(this.startPoint,t,n,i),a=et(this.endPoint,t,n,i),c={x:Math.min(o.x,a.x),y:Math.min(o.y,a.y)},l={x:Math.max(o.x,a.x),y:Math.max(o.y,a.y)},s=this.searchMapInFrustum(c,l);this.dispatchEvent({type:"selected",list:s})}}searchMapInFrustum(e,t){let{context:n}=this;return n.currentFloor?.graphicLayer.children.filter(i=>i instanceof Bt&&this.searchChildInFrustum(i,e,t))||[]}searchChildInFrustum(e,t,n){let{context:{camera:i,container:{clientWidth:o,clientHeight:a}}}=this;if(!e)return!1;if(!e.mesh){let f=e.getPosition();if(f){let d=et(f,i,o,a);return Ze(d,t,n)}return!1}e.mesh.geometry.boundingBox||e.mesh.geometry.computeBoundingBox();let c=e.mesh.geometry.boundingBox;if(!c)return!1;let{min:l,max:s}=c,u=et(l,i,o,a),h=et(s,i,o,a);return!(!Ze(u,t,n)||!Ze(h,t,n))}dispose(){this.unRegistryEvent()}};var wr=class extends eu.EventDispatcher{constructor(t){super();this.context=t;this.boxSelection=new oi(t),this.boxSelection.setEnable(!1),this.registryEvent()}_list=new Set;boxSelection;prevPanStatus;prevRotateStatus;downPoint=null;isMultipleSelect=!1;get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.context.config.enableBoxSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}onPointerDown=t=>{this.downPoint={x:t.offsetX,y:t.offsetY}};onPointerUp=t=>{if(!this.downPoint)return;let{offsetX:n,offsetY:i}=t,{x:o,y:a}=this.downPoint;if(Math.sqrt((o-n)**2+(a-i)**2)>3)return;let{graphics:c}=this.context.getGraphicsByDeviceXy(n,i),l=new Set(c.map(u=>u.options.id));this.context.getPoisByDeviceXy(n,i).forEach(u=>{if(!l.has(u.options.id)){let h=this.context.currentFloor?.graphicLayer.graphicMap.get(u.options.id)||null;h&&h.options.geometry.type==="point"&&(c.push(h),l.add(u.options.id))}}),(En?t.metaKey:t.ctrlKey)||this._list.clear(),c.forEach(u=>this._list.add(u)),this.selectEnd(),this.downPoint=null};onPointerOut=t=>{this.disableBoxSelection()};onKeyDown=t=>{bn(t.key)&&this.enableBoxSelection()};onKeyUp=t=>{bn(t.key)&&this.disableBoxSelection()};onBoxSelected=({list:t})=>{this._list.clear(),t.forEach(n=>{this._list.add(n)}),this.selectEnd()};selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.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()}};var si=require("three");var Tr=class extends si.EventDispatcher{constructor(t){super();this.context=t;this.registryEvent()}curGraphics=new Set;timer=new Wt;graphicTimerMap=new Map;onPointerMove=({graphics:t,pois:n,e:i})=>{let o=n.map(s=>this.context.currentFloor?.graphicLayer.graphicMap.get(s.options.id)).filter(s=>s&&s.options.geometry.type==="point");if(!t.length&&!o.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:a}=this.context.config.hover,c=new Set;if(o.length){let s,u=1e4;o.forEach(h=>{let f=n.find(d=>d.options.id===h.options.id);if(f instanceof ln){let{x:d,y:g}=f.clientPos,p=Math.sqrt((d-i.offsetX)**2+(g-i.offsetY)**2);p<u&&(u=p,s=h)}else if(f instanceof he){let{x:d,y:g}=f.box.getCenter(new si.Vector2),p=Math.sqrt((d-i.offsetX)**2+(g-i.offsetY)**2);p<u&&(u=p,s=h)}}),c.add(s)}c.size||t.forEach(s=>c.add(s)),c.forEach(s=>{if(this.graphicTimerMap.get(s)||this.curGraphics.has(s))return;let u=this.timer.setTimeout(()=>{this.curGraphics.add(s),this.graphicTimerMap.delete(s),this.timer.clearTimeout(u),this.handleHoverGraphicsChange()},a);this.graphicTimerMap.set(s,u)}),this.graphicTimerMap.forEach((s,u)=>{c.has(u)||(this.timer.clearTimeout(s),this.graphicTimerMap.delete(u))});let l=this.curGraphics.size;this.curGraphics.forEach(s=>{c.has(s)||this.curGraphics.delete(s)}),l!==this.curGraphics.size&&this.handleHoverGraphicsChange()};onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()};onBodyPointerMove=t=>{if(this.curGraphics.size){let n=this.context.container.getBoundingClientRect();(t.clientX<n.left||t.clientX>n.right||t.clientY<n.top||t.clientY>n.bottom)&&this.onPointerLevel()}};handleHoverGraphicsChange(t=this.curGraphics){this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}};var Pn=require("three");var ai=class{constructor(e){this.context=e;this.registryEvent(),this.changePrevCamera()}prevCamera={position:new Pn.Vector3,zoom:1,target:new Pn.Vector3};enable=!0;box=new Pn.Box3;updateBox(){this.box.setFromObject(this.context.scene)}setEnable(e){this.enable=e,e?this.registryEvent():this.unRegistryEvent()}changePrevCamera(){this.prevCamera={position:this.context.camera.position.clone(),zoom:this.context.camera.zoom,target:this.context.control.target.clone()}}backToPrevCamera(){this.setEnable(!1),this.context.camera.position.copy(this.prevCamera.position),this.context.camera.zoom=this.prevCamera.zoom,this.context.control.target.copy(this.prevCamera.target),this.context.control.update(),this.setEnable(!0)}registryEvent(){this.context.addEventListener("control-change",this.onCameraChange)}unRegistryEvent(){this.context.removeEventListener("control-change",this.onCameraChange)}getCurFloorScreenPosition(){if(!this.context.scene.children.filter(m=>m instanceof Ue).length)return null;let t=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:a,max:c}=t,l=et(a,n,i,o),s=et(c,n,i,o),u=et(new Pn.Vector3(a.x,c.y,c.z),n,i,o),h=et(new Pn.Vector3(c.x,a.y,a.z),n,i,o),f=Math.min(l.x,s.x,u.x,h.x),d=Math.max(l.x,s.x,u.x,h.x),g=Math.min(l.y,s.y,u.y,h.y),p=Math.max(l.y,s.y,u.y,h.y);return{left:f,right:d,top:g,bottom:p}}checkDistanceToScreenEdge({left:e,right:t,top:n,bottom:i}){let{width:o,height:a}=this.context.clientSize,[c,l,s,u]=this.context.config.cameraBound.padding,h=t>=u,f=o-e>=l,d=a-n>=s,g=i>=c;return h&&f&&d&&g}onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:t,right:n,top:i,bottom:o}=e;this.checkDistanceToScreenEdge({left:t,right:n,top:i,bottom:o})?this.changePrevCamera():this.backToPrevCamera()}};dispose(){this.unRegistryEvent()}};var go=require("three"),nu=require("three/examples/jsm/controls/MapControls"),Dn=require("@tweenjs/tween.js");var ui=class extends nu.MapControls{constructor(t,n,i){super(n,i);this.context=t;this.camera=n;this.domElement=i;this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=n.zoom,this.registryEvent()}prevCameraZoom=1;tweenGroup=new Dn.Group;offsetY=0;registryEvent(){this.addEventListener("change",()=>{let t=this.camera.zoom;t!==this.prevCameraZoom&&(this.prevCameraZoom=t,this.dispatchEvent({type:"change-zoom",zoom:t}))}),this.context.addEventListener("update",this.tweenUpdate)}tweenUpdate=()=>{this.tweenGroup.update()};setPolarAngle(t,n=!1){let{maxPolarAngle:i,minPolarAngle:o}=this,a=i===o;(n||t<=i&&t>=o)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),a||(this.maxPolarAngle=i,this.minPolarAngle=o)}async setPolarAngleByDuration(t,n=!1,i=500){return i<=0?this.setPolarAngle(t,n):rn(new Promise(o=>{let a={polar:this.getPolarAngle()},c={polar:t},l=new Dn.Tween(a,this.tweenGroup).to(c,i).onUpdate(()=>{this.setPolarAngle(a.polar,n)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(l),o(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500)}setAzimuthalAngle(t,n){let{maxAzimuthAngle:i,minAzimuthAngle:o,maxPolarAngle:a,minPolarAngle:c}=this,l=i===o;if(n||t<=i&&t>=o){this.maxAzimuthAngle=t,this.minAzimuthAngle=t;let s=this.getPolarAngle();this.maxPolarAngle=s,this.minPolarAngle=s,this.update(),this.maxPolarAngle=a,this.minPolarAngle=c}l||(this.maxAzimuthAngle=i,this.minAzimuthAngle=o)}setAzimuthalAngleDuration(t,n=!1,i=500){return i<=0?this.setAzimuthalAngle(t,n):rn(new Promise(o=>{let a={azimuthal:this.getAzimuthalAngle()},c={azimuthal:t},l=new Dn.Tween(a,this.tweenGroup).to(c,i).onUpdate(()=>{this.setAzimuthalAngle(a.azimuthal,n)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(l),o(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500)}getCameraLookAt(){return new go.Vector3().subVectors(this.target,this.camera.position)}async setCameraPositionByTarget(t,n){let i=this.target.clone(),o=this.getCameraLookAt();if(!n){this.camera.position.copy(t.clone().sub(o)),this.target.copy(t.clone()),this.update();return}return rn(new Promise(a=>{let c=new Dn.Tween(i,this.tweenGroup).to(t,n).onUpdate(()=>{this.camera.position.copy(i.clone().sub(o)),this.target.copy(i.clone()),this.update()}).onComplete(()=>{this.tweenGroup.remove(c),this.camera.position.copy(t.clone().sub(o)),this.target.copy(t.clone()),this.update(),this.enabled=!0,a(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}setZoom(t,n,i=!1){let{minZoom:o,maxZoom:a}=this;(i||t>=o&&t<=a)&&(this.camera.position.copy(n.clone().sub(this.getCameraLookAt())),this.target.copy(n),this.camera.zoom=t,this.update())}setZoomByDuration(t,n,i=!1,o=500){let a=this.getCameraLookAt(),c={zoom:this.camera.zoom,target:this.target.clone()};return o?rn(new Promise(l=>{let s=new Dn.Tween(c,this.tweenGroup).to({zoom:t,target:n},o).onUpdate(()=>{this.setZoom(c.zoom,c.target,i)}).onComplete(()=>{this.tweenGroup.remove(s),this.enabled=!0,l(!0)}).onStart(()=>{this.enabled=!1}).start()}),o+500):this.setZoom(t,n,i)}setTargetByOffset(t,n=this.target.clone()){if(!t)return;let i=new go.Vector3;i.setFromMatrixColumn(this.camera.matrix,1),i.normalize(),i.multiplyScalar(t/this.camera.zoom),n.add(i),this.setCameraPositionByTarget(n,0)}dispose(){this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll()}};var Vn=require("three");var li=class extends Vn.WebGLRenderer{event=new Vn.EventDispatcher;scene;camera;enable=!0;timer=new Wt;constructor(e){super({antialias:!0,alpha:!0,...e}),this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=Vn.PCFSoftShadowMap}setCameraAndScene(e,t){this.scene=e,this.camera=t}autoRender(){this.scene&&this.camera&&this.enable&&(this.event.dispatchEvent({type:"update"}),this.render(this.scene,this.camera)),this.timer.requestAnimationFrame(()=>{this.autoRender()})}pauseRender(){this.enable=!1}continueRender(){this.enable=!0}addEventListener(e,t){this.event.addEventListener(e,t)}removeEventListener(e,t){this.event.removeEventListener(e,t)}dispose(){this.timer.dispose(),this.enable=!1,super.dispose()}};var ru=require("three"),ci=class extends ru.Scene{constructor(){super()}};var iu=require("three"),hi=class extends iu.OrthographicCamera{constructor(e,t){super(-e/2,e/2,t/2,-t/2,-1e3,5e3),this.up.set(0,0,1),this.position.set(0,0,100),this.lookAt(0,0,0)}};var Cr=class extends gt.EventDispatcher{constructor(t,n){super();this.container=t;this.config=n;this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new wr(this),this.hoverHelper=new Tr(this),this.resizeClientSize(),this.registryEvent()}scene=new ci;renderer=new li;camera;control;lights=Hi();currentFloor;selection;hoverHelper;basicRatio;cameraBound;clientSize={width:0,height:0,x:0,y:0};renderRf=0;resizeClientSize(){let{x:t,y:n,width:i,height:o}=this.container.getBoundingClientRect();this.clientSize={width:i||this.container.clientWidth,height:o||this.container.clientHeight,x:t,y:n}}init(){let{clientWidth:t,clientHeight:n}=this.container;this.camera=new hi(t,n),this.renderer.setSize(t,n),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new ui(this,this.camera,this.renderer.domElement),this.control.maxPolarAngle=this.config.control.maxPolar,this.container.appendChild(this.renderer.domElement),this.scene.add(this.lights),this.basicRatio=this.getRatio(),this.control.addEventListener("change",()=>{this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})}),this.control.addEventListener("change-zoom",({zoom:i})=>{this.dispatchEvent({type:"control-zoom-change",zoom:i})}),this.renderer.addEventListener("update",()=>{this.dispatchEvent({type:"update"})}),this.cameraBound=new ai(this)}getRatio(t=new gt.Vector3(0,0,0),n=new gt.Vector3(100,0,0)){let{clientWidth:i,clientHeight:o}=this.container,a=et(t,this.camera,i,o),c=et(n,this.camera,i,o);return Math.ceil(Math.sqrt((c.x-a.x)**2+(c.y-a.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(n=>{n instanceof gt.AmbientLight&&(n.color=new gt.Color(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let n=t.getCenter();n&&(this.lights.position.x=n.x,this.lights.position.y=n.y),this.cameraBound.updateBox()}onWindowResize=()=>{let{container:t,camera:n,renderer:i}=this,{clientWidth:o,clientHeight:a}=t;o=Math.max(1,o),a=Math.max(1,a),n.left=-o/2,n.right=o/2,n.top=a/2,n.bottom=-a/2,n.updateProjectionMatrix(),i.setSize(o,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:o,height:a})};onClick=t=>{let{graphics:n,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY);n.length&&this.dispatchEvent({type:"graphic-click",graphics:n,position:i});let o=this.getPoisByDeviceXy(t.offsetX,t.offsetY);o.length&&this.dispatchEvent({type:"poi-click",pois:o})};getGraphicsByDeviceXy(t,n){let i=new gt.Vector2;i.x=t/this.clientSize.width*2-1,i.y=n/this.clientSize.height*-2+1;let o=new gt.Raycaster;return o.setFromCamera(i,this.camera),o.ray.origin.sub(o.ray.direction.clone().multiplyScalar(100)),this.currentFloor?.graphicLayer.getGraphicByRaycaster(o)||{graphics:[],position:null}}getPoisByDeviceXy(t,n){let i=this.currentFloor?.poiLayer.getPoiByDeviceXy(t,n),o=this.currentFloor?.poiLayer2.getPoiByDeviceXy(t,n);return(i||[]).concat(o||[])}onPointerover=t=>{let{graphics:n,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),o=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-over",e:t,graphics:n,pois:o,position:i})};onPointermove=t=>{let{graphics:n,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),o=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-move",e:t,graphics:n,pois:o,position:i})};onPointerleave=t=>{this.dispatchEvent({type:"pointer-level"})};onSelectionSelect=({graphics:t,isMultipleSelect:n})=>{this.dispatchEvent({type:"select-graphic",graphics:t,isMultipleSelect:n})};onHoverChange=({graphics:t})=>{this.dispatchEvent({type:"hover",graphics:t})};registryEvent(){window.addEventListener("resize",this.onWindowResize),this.container.addEventListener("click",this.onClick),this.container.addEventListener("pointerover",this.onPointerover),this.container.addEventListener("pointermove",this.onPointermove),this.container.addEventListener("pointerleave",this.onPointerleave),this.container.addEventListener("pointercancel",this.onPointerleave),this.container.addEventListener("pointerout",this.onPointerleave),this.selection.addEventListener("select",this.onSelectionSelect),this.hoverHelper.addEventListener("hover-change",this.onHoverChange)}unRegistryEvent(){window.removeEventListener("resize",this.onWindowResize),this.container.removeEventListener("click",this.onClick),this.container.removeEventListener("pointerover",this.onPointerover),this.container.removeEventListener("pointermove",this.onPointermove),this.container.removeEventListener("pointerleave",this.onPointerleave),this.container.removeEventListener("pointercancel",this.onPointerleave),this.container.removeEventListener("pointerout",this.onPointerleave),this.selection.removeEventListener("select",this.onSelectionSelect),this.hoverHelper.removeEventListener("hover-change",this.onHoverChange)}setPolarAngle(t,n=500){return this.control.setPolarAngleByDuration(t,!0,n)}setAzimuthalAngle(t,n=500){return this.control.setAzimuthalAngleDuration(t,!0,n)}getCameraLookAt(){return this.control.getCameraLookAt()}setZoom(t,n,i=500){return this.control.setZoomByDuration(t,n,!0,i)}getFitCameraToObjectZoom(t,n=[20,20,20,20],i=500,o=!0){let[a,c,l,s]=n,{clientSize:{width:u,height:h}}=this,f=this.control.getPolarAngle();o&&this.setPolarAngle(0,0);let d=new gt.Box3().setFromObject(t);this.setPolarAngle(f,0);let{max:g,min:p}=d,m=new gt.Vector3(p.x,g.y,g.z),v=new gt.Vector3(g.x,g.y,g.z),b=new gt.Vector3(g.x,p.y,p.z),y=new gt.Vector3(p.x,p.y,p.z),S=et(m,this.camera,u,h),x=et(v,this.camera,u,h),_=et(y,this.camera,u,h),M=et(b,this.camera,u,h),C=new gt.Box2().setFromPoints([new gt.Vector2(S.x,S.y),new gt.Vector2(x.x,x.y),new gt.Vector2(_.x,_.y),new gt.Vector2(M.x,M.y)]).getSize(new gt.Vector2),P=(u-c-s)/C.x,D=(h-a-l)/C.y,R=Math.min(P,D),W=new gt.Vector3((g.x+p.x)/2,(g.y+p.y)/2,(g.z+p.z)/2);return{zoom:R*this.camera.zoom,center:W}}fitCameraToObject(t,n=[20,20,20,20],i=500,o=!0){let{zoom:a,center:c}=this.getFitCameraToObjectZoom(t,n,i,o);return this.setZoom(a,c,i)}getFitCameraToGroundZoom(t=[20,20,20,20],n=500,i=!0){if(this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,n,i).zoom}fitCameraToGround(t=[20,20,20,20],n=500,i=!0){return this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundUpper,t,n,i):Promise.resolve(!1)}async setCameraPosition(t,n){return this.control.setCameraPositionByTarget(t,n)}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}dispose(){this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.renderer.dispose(),this.lights.children.forEach(t=>t.dispose()),ne(this.scene)}};var ou=require("lodash"),su={apiDomain:"",apiInfo:{},apiPath:{floorGraphic:"/api/inception-map/floor/get",floorRange:"/api/inception-map/range/get",equipmentList:"/api/inception-map/equipment/get",roadNetwork:"/api/inception-map/road_network/get"},enableBoxSelect:!0,resizeObserver:!1,initTransToMark:!1,heatMap:{radius:50,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0},defaultPadding:[20,20,20,20],svg:{circle:{radius:"2",fill:"#1CADFF"},line:{stroke:"#1CADFF"}},selectBox:{stroke:"#1CADFF",fill:"rgba(28, 173, 255, 0.3)"},hover:{time:100},ground:{color:"#F6F6F6",opacity:1,height:.001,stroke:!1,strokeColor:"#E6E6E6",strokeOpacity:1},markGraphic:{color:"#EEF0F3",opacity:1,height:.001,stroke:!1,strokeColor:"#000",strokeOpacity:1},graphic:{fillOpacity:1},cameraBound:{padding:[150,150,150,150]},poi:{boxScale:1}};function mo(r){return(0,ou.merge)({},su,r)}var au=require("lodash");var uu=(t=>(t[t.D2=0]="D2",t[t.D3=1.1]="D3",t))(uu||{}),yo=class extends pi.EventDispatcher{constructor(t,n={}){super();this.container=t;this.config=mo(n),this.context=new Cr(t,this.config),this.registryEvent()}config;context;polarKeys=[];azimuthalKeys=[];svgLine;svgPolygon;basicZoom=1;prevCameraZoom=1;type="2d";currentBuildGround=null;observe=null;buildingCenter=[0,0];timer=new Wt;plugins=[];changeBuildingCenter(t,{brand:n,project:i}){let o=t?ur(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:i,brand:n})}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(n=>n!==t)}triggerHooks(t,n){this.dispatchEvent({type:t,data:n})}switchFloorByFloor(t,n=t.graphicLayer.children){this.triggerHooks("switch_floor_before",{curFloor:t,graphics:n}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",{curFloor:t,graphics:n})}initialFloorCamera(){this.context.cameraBound.setEnable(!1),this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,0),this.context.setPolarAngle(this.config.control.defaultPolar,0),this.context.fitCameraToGround(void 0,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*30,this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.basicZoom=this.context.camera.zoom,this.context.control.addEventListener("change",this.onControlChange),this.onControlChange(),this.context.cameraBound.setEnable(!0),this.context.cameraBound.changePrevCamera()}onControlChange=()=>{let{camera:{zoom:t}}=this.context;t!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=t)};addModel(t,n){if(t.options.geometry.type==="polygon"){let i=this.context.currentFloor?.addModel({...n,position:t.getPosition().setZ(.1),id:t.options.id});if(i){let{facilityAngle:o=0,facilityXScale:a=1,facilityYScale:c=1}=t.options.userData;i.rotateZ((180-o)/180*Math.PI),i.scale.set(a,c,1)}}}addHeatmap(t){return this.context.currentFloor?.addHeatmap(t)}getLegacyToGraphicMap(){return this.context.currentFloor?.userData.legacyToGraphicMap||new Map}getFloorAllGraphics(){return this.context.currentFloor?.graphicLayer.children.filter(t=>t instanceof Bt)||[]}createGraphicPoi(t,n){if(this.context.currentFloor){n.id===void 0&&(n.id=t.options.id);let i=t.getCenter();return this.context.currentFloor.addPoi({...n,position:{...i,z:i.z+t.options.height/2}})}return null}removeHeatMap(){this.context.currentFloor?.removeHeatMap()}translateElementToCenter(t,n=500){let i=t.getPosition();return this.context.setCameraPosition(i,n)}async translateElementToCenterX(t,n=500){return rn(new Promise(i=>{let o=this.context.control.target.clone(),a=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:c,height:l},camera:s}=this.context,h=et(a,s,c,l).x-c/2,f=new pi.Vector3;f.setFromMatrixColumn(this.context.camera.matrix,0),f.normalize(),f.multiplyScalar(h/this.context.camera.zoom),o.add(f),this.context.setCameraPosition(o,n).then(i)})}),n+500)}getElementDeviceCoordinate(t){let n=t.position.clone(),{clientWidth:i,clientHeight:o}=this.container;return et(n,this.context.camera,i,o)}changeMapType(t,n=500){return this.type=t,t==="2d"?this.context.setPolarAngle(0,n):this.context.setPolarAngle(1.1,n)}async resetView(t=300){let n=t/3;await this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,n),await this.context.setPolarAngle(this.config.control.defaultPolar,n),await this.context.fitCameraToGround(this.config.defaultPadding,n,!1)}reduceMap(t=.5,n=500){let i=this.context.camera.zoom;return this.context.setZoom(i-t,this.context.control.target,n)}enlargeMap(t=.5,n=500){let i=this.context.camera.zoom;return this.context.setZoom(i+t,this.context.control.target,n)}onKeydown=t=>{this.polarKeys.includes(t.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(t.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)};onKeyUp=t=>{if(this.polarKeys.includes(t.code)){let n=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=n,this.context.control.minPolarAngle=n}if(this.azimuthalKeys.includes(t.code)){let n=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=n,this.context.control.minAzimuthAngle=n}};registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver((0,au.debounce)(this.resize,5));t.observe(this.container),this.observe=t}}unRegistryEvent(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),this.observe?.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t=.1){let n=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(n+t,500)}async measureDistance(){return this.cancelDistance(),new Promise((t,n)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new vr(this.context);let i=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){i(),n("cancel")},this.svgLine.addEventListener("distance",({distance:o})=>{t(o)})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,n)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new _r(this.context);let i=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){i(),n("cancel")},this.svgPolygon.addEventListener("area",({area:o})=>{t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}getGraphicByNodeId(t){return this.context.currentFloor?.graphicLayer.getGraphicByNodeId(t)||null}deleteGraphic(t){this.context.currentFloor?.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){if(!t.transformToBuildingGround&&this.currentBuildGround){let n=ur(this.currentBuildGround.info.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=n[0],o[1]-=n[1]})});else{let[i,o]=t.geometry.cds;t.geometry.coords=[i-n[0],o-n[1]]}}return this.context.currentFloor?.graphicLayer.createGraphic(t)}removePoiById(t){this.context.currentFloor?.poiLayer.removePoiById(t),this.context.currentFloor?.poiLayer2.removePoiById(t)}getPoiById(t){return this.context.currentFloor?.poiLayer.getPoiById(t)||this.context.currentFloor?.poiLayer2.getPoiById(t)}getPois(){return[...(this.context.currentFloor?.poiLayer.pois||[]).filter(t=>!t.options.built_in),...this.context.currentFloor?.poiLayer2.pois||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let t=this.context.control.getAzimuthalAngle(),n=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let i=this.context.getFitCameraToGroundZoom(void 0,0)||1;this.context.camera.zoom=n,this.context.control.minZoom=i,this.context.control.maxZoom=i*25,this.basicZoom=n,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(t,0),this.context.cameraBound.setEnable(!0)};dispose(){this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.context.dispose(),this.unRegistryEvent(),sn.dispose(),an.dispose(),Mn.dispose(),un.dispose(),Ut.dispose()}};var lu=require("three"),qe=class extends lu.EventDispatcher{bmap;constructor(e){super(),this.bmap=e}dispose(){}};var vo=class extends qe{equipmentList=[];equipmentMap=new Map;constructor(e){super(e),this.fetchEquipment(),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}async fetchEquipment(){let{apiDomain:e,apiPath:{equipmentList:t},apiInfo:n}=this.bmap.config,i=`${e}${t}`;await fetch(i,n).then(o=>o.json()).then(o=>o.data).then(o=>{this.equipmentList=o,this.equipmentMap=new Map(o.map(a=>[a.equipment_id,a]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)}onSwitchFloor=({data:{graphics:e}})=>{this.equipmentList.length&&this.changeGraphicToEquipment(e)};getGraphicEquipment(e){return e.userData.data.info.userData.equipment}changeGraphicToEquipment(e){e.filter(t=>{let n=this.getGraphicEquipment(t);return n&&this.equipmentMap.has(n)}).forEach(t=>{let n=this.equipmentMap.get(this.getGraphicEquipment(t)),i=this.bmap.createGraphicPoi(t,{icon:n?.equipment_icon,built_in:!0,icon_size:[14,14]});i&&(i.userData.data=n,i.userData.type="equipment")})}dispose(){this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),Array.from(this.bmap.context.currentFloor?.poiLayer.pois||[]).forEach(e=>{e.userData.type==="equipment"&&this.bmap.context.currentFloor?.poiLayer.removePoi(e)})}};var Gt=require("three");var Z=require("three"),_e=class extends Z.BufferGeometry{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new Z.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(e){this.setGeometry(e,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(e){this.setPoints(e,this.widthCallback)}}})}};_e.prototype.setMatrixWorld=function(r){this.matrixWorld=r};_e.prototype.setGeometry=function(r,e){this._geometry=r,this.setPoints(r.getAttribute("position").array,e)};_e.prototype.setPoints=function(r,e){if(!(r instanceof Float32Array)&&!(r instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=r,this.widthCallback=e,this.positions=[],this.counters=[],r.length&&r[0]instanceof Z.Vector3)for(var t=0;t<r.length;t++){var n=r[t],i=t/r.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(i),this.counters.push(i)}else for(var t=0;t<r.length;t+=3){var i=t/r.length;this.positions.push(r[t],r[t+1],r[t+2]),this.positions.push(r[t],r[t+1],r[t+2]),this.counters.push(i),this.counters.push(i)}this.process()};function up(r,e){var t=new Z.Matrix4,n=new Z.Ray,i=new Z.Sphere,o=new Z.Vector3,a=this.geometry;if(a.boundingSphere||a.computeBoundingSphere(),i.copy(a.boundingSphere),i.applyMatrix4(this.matrixWorld),r.ray.intersectSphere(i,o)!==!1){t.copy(this.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(t);var c=new Z.Vector3,l=new Z.Vector3,s=new Z.Vector3,u=this instanceof Z.LineSegments?2:1,h=a.index,f=a.attributes;if(h!==null)for(var d=h.array,g=f.position.array,p=f.width.array,m=0,v=d.length-1;m<v;m+=u){var b=d[m],y=d[m+1];c.fromArray(g,b*3),l.fromArray(g,y*3);var S=p[Math.floor(m/3)]!==void 0?p[Math.floor(m/3)]:1,x=r.params.Line.threshold+this.material.lineWidth*S/2,_=x*x,M=n.distanceSqToSegment(c,l,o,s);if(!(M>_)){o.applyMatrix4(this.matrixWorld);var w=r.ray.origin.distanceTo(o);w<r.near||w>r.far||(e.push({distance:w,point:s.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}),m=v)}}}}_e.prototype.raycast=up;_e.prototype.compareV3=function(r,e){var t=r*6,n=e*6;return this.positions[t]===this.positions[n]&&this.positions[t+1]===this.positions[n+1]&&this.positions[t+2]===this.positions[n+2]};_e.prototype.copyV3=function(r){var e=r*6;return[this.positions[e],this.positions[e+1],this.positions[e+2]]};_e.prototype.getDistance=function(r){let e=0;for(let t=0;t<r;t++){let n=6*t,i=new Z.Vector3(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new Z.Vector3(this.positions[n+6],this.positions[n+7],this.positions[n+8]),a=i.distanceTo(o);e+=a}return e};_e.prototype.process=function(){var r=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var e;let t=this.getDistance(r-1);var n;this.compareV3(0,r-1)?n=this.copyV3(r-2):n=this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(var i=0;i<r;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?e=this.widthCallback(i/(r-1)):e=1,this.width.push(e),this.width.push(e),i===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(i===r-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let a=this.getDistance(i)/t;this.uvs.push(a,0),this.uvs.push(a,1)}if(i<r-1){n=this.copyV3(i),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var o=i*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}i>0&&(n=this.copyV3(i),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(r-1,0)?n=this.copyV3(1):n=this.copyV3(r-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new Z.BufferAttribute(new Float32Array(this.positions),3),previous:new Z.BufferAttribute(new Float32Array(this.previous),3),next:new Z.BufferAttribute(new Float32Array(this.next),3),side:new Z.BufferAttribute(new Float32Array(this.side),1),width:new Z.BufferAttribute(new Float32Array(this.width),1),uv:new Z.BufferAttribute(new Float32Array(this.uvs),2),index:new Z.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new Z.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function _o(r,e,t,n,i){var o;if(r=r.subarray||r.slice?r:r.buffer,t=t.subarray||t.slice?t:t.buffer,r=e?r.subarray?r.subarray(e,i&&e+i):r.slice(e,i&&e+i):r,t.set)t.set(r,n);else for(o=0;o<r.length;o++)t[o+n]=r[o];return t}_e.prototype.advance=function(r){var e=this._attributes.position.array,t=this._attributes.previous.array,n=this._attributes.next.array,i=e.length;_o(e,0,t,0,i),_o(e,6,e,0,i-6),e[i-6]=r.x,e[i-5]=r.y,e[i-4]=r.z,e[i-3]=r.x,e[i-2]=r.y,e[i-1]=r.z,_o(e,6,n,0,i-6),n[i-6]=r.x,n[i-5]=r.y,n[i-4]=r.z,n[i-3]=r.x,n[i-2]=r.y,n[i-1]=r.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};Z.ShaderChunk.meshline_vert=["",Z.ShaderChunk.logdepthbuf_pars_vertex,Z.ShaderChunk.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",Z.ShaderChunk.logdepthbuf_vertex,Z.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",Z.ShaderChunk.fog_vertex,"}"].join(`
|
|
105
105
|
`);Z.ShaderChunk.meshline_frag=["",Z.ShaderChunk.fog_pars_fragment,Z.ShaderChunk.logdepthbuf_pars_fragment,"","uniform sampler2D map;","uniform sampler2D alphaMap;","uniform float useMap;","uniform float useAlphaMap;","uniform float useDash;","uniform float dashArray;","uniform float dashOffset;","uniform float dashRatio;","uniform float visibility;","uniform float alphaTest;","uniform vec2 repeat;","uniform float thresholdRatio;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","void main() {","",Z.ShaderChunk.logdepthbuf_fragment,""," vec4 c = vColor;"," if( useMap == 1. ) c *= texture2D( map, vUV * repeat );"," if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;"," if( c.a < alphaTest ) discard;"," if( useDash == 1. ){"," c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));"," }"," gl_FragColor = c;"," gl_FragColor.a *= step(vCounters, visibility);","",Z.ShaderChunk.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
|
|
106
|
-
`);var Ar=class extends Z.ShaderMaterial{constructor(e){super({uniforms:Object.assign({},Z.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new Z.Color(16777215)},opacity:{value:1},resolution:{value:new Z.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new Z.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:Z.ShaderChunk.meshline_vert,fragmentShader:Z.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(t){this.uniforms.lineWidth.value=t}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(t){this.uniforms.map.value=t}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(t){this.uniforms.useMap.value=t}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(t){this.uniforms.alphaMap.value=t}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(t){this.uniforms.useAlphaMap.value=t}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(t){this.uniforms.color.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(t){this.uniforms.sizeAttenuation.value=t}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(t){this.uniforms.dashArray.value=t,this.useDash=t!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(t){this.uniforms.dashRatio.value=t}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(t){this.uniforms.useDash.value=t}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(t){this.uniforms.visibility.value=t}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(t){this.uniforms.alphaTest.value=t}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(t){this.uniforms.repeat.value.copy(t)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(t){this.uniforms.thresholdRatio.value=t}}}),this.setValues(e)}};Ar.prototype.copy=function(r){return Z.ShaderMaterial.prototype.copy.call(this,r),this.lineWidth=r.lineWidth,this.map=r.map,this.useMap=r.useMap,this.alphaMap=r.alphaMap,this.useAlphaMap=r.useAlphaMap,this.color.copy(r.color),this.opacity=r.opacity,this.resolution.copy(r.resolution),this.sizeAttenuation=r.sizeAttenuation,this.dashArray.copy(r.dashArray),this.dashOffset.copy(r.dashOffset),this.dashRatio.copy(r.dashRatio),this.useDash=r.useDash,this.visibility=r.visibility,this.alphaTest=r.alphaTest,this.repeat.copy(r.repeat),this};var cu="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAMAAACROYkbAAABrVBMVEVsjPdsjPdqi/doifdpivdrjPdsjPdsjPd/m/igtfqTq/lykfdri/dsjPdtjfe/zPv8/f/w8/6zw/p0kvdri/dsjPdtjffU3vz////////3+f62xfpzkfdri/dsjPdsjPeZr/nr8P7////////4+f62xfp0kvdri/dsjPdsjPdujveXrvne5v3////////3+f63x/t2lPdri/dsjPdsjPdsjPdri/eMpfjb4/3+/v/////4+v+7yft1k/dri/dsjPdsjPdri/eJovjl6/3////////3+f6Jo/lqivdsjPdri/dvjveluPry9f7////////i6f2BnPhqi/dsjPdrjPdvjveluPrv8v7////////l6/6Uq/lsjPdsjPdsjPdvjveluPrv8v7////////m6/6Uq/lsjPdsjPdsjPdsjPeZr/nv8v7////////s8f6XrvlsjPdsjPdtjffS2/z////////w9P6bsfltjfdsjPdtjffBz/v7/P/y9f6svvpxkPdrjPdsjPdsjPd+mviftPqVrPlykfdri/dsjPdsjPdri/doifdpifdrjPdsjPclkRlrAAAAx0lEQVQ4y2NgwAsYmZhZWNkYyAfsHJxc3Dy85BvAxy8gKCQsIkq2AWLiEpJS0jKycuQaIK+gqKSsoqqmrkGmAZpa2jq6evoGhkbG5BlgYmpmbmFpZW1ja0emE+wdHJ2cXVzd3D3INMDTy9vH188/IDCIPP3BIaFh4RGRUdExseQZEBefkJiUnJKalp5BngGZWdk5uXn5BemFZAZBUXFJaVl5RSWZ9jMwVFXX1NbVNzSSq5+hqbmlta29g2z9DJ1d3T29ffhUAABKPSh5Xst3GwAAAABJRU5ErkJggg==";var hu={texture_url:cu,lineWidth:8,color:16777215},fi=class extends Gt.Object3D{constructor(t,n){super();this.navigation=t;this.config=Object.assign({},hu,n),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}mesh=null;geometry=null;material=null;texture=null;config=hu;points=[];basicRepeat=1;prevCameraZoom=0;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)}onControlChange=()=>{let t=this.navigation.bmap.context.camera.zoom;t!==this.prevCameraZoom&&(this.prevCameraZoom=t,this.changeRepeat())};onUpdate=()=>{this.texture};onResize=()=>{if(this.material){let{width:t,height:n}=this.navigation.bmap.context.clientSize;this.material.resolution.set(t,n)}};getRepeat(){let{points:t,navigation:{bmap:{context:{camera:n,clientSize:{width:i,height:o}}}}}=this,a=t.map(([l,s])=>et(new Gt.Vector3(l,s,0),n,i,o)).map(({x:l,y:s})=>[l,s]);return Ne(a)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new Gt.Vector2(t,1)}loadTexture(t){return new Promise((n,i)=>{new Gt.TextureLoader().load(t,n,void 0,i)})}transformPoints(t){let n=[];for(let i=0;i<t.length;i++)n.push(...t[i],0);return n}updatePoints(t){this.points=t,this.changeRepeat();let n=this.transformPoints(t);this.geometry&&this.geometry.setPoints(n)}movePath(t){this.material&&(this.material.thresholdRatio=t)}async create(t){let n=this.geometry=new _e;if(this.updatePoints(t),!this.texture){let a=this.texture=await this.loadTexture(this.config.texture_url);a.wrapS=a.wrapT=Gt.RepeatWrapping}let i=this.material=new Ar({useMap:!0,color:new Gt.Color(this.config.color),transparent:!0,resolution:new Gt.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:Gt.NormalBlending,repeat:new Gt.Vector2(this.getRepeat(),1)}),o=this.mesh=new Gt.Mesh(n,i);return o.renderOrder=9,this.add(o),o}dispose(){this.unRegistryEvent(),this.clear(),this.geometry?.dispose(),this.material?.dispose(),this.texture?.dispose()}};var Pr=require("@tweenjs/tween.js"),pn=require("three");var pu=require("three");var fu=require("@tweenjs/tween.js"),cp={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},di=class extends pu.EventDispatcher{constructor(t,n){super();this.navigation=t;this.options=Object.assign({},cp,n),this.registryEvent()}offset=!1;reset=!1;position=[0,0];routeIndex=0;pointIndex=0;paths=[];options;timer=new Wt;resetTimer=null;tweenUtil=new wn;simulationTween;get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){return this.curRoutePath?.points||[]}registryEvent(){this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.addEventListener("add-path",this.onAddPaths)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.removeEventListener("add-path",this.onAddPaths)}onAddPaths=({paths:t})=>{this.paths=t,this.resetStatus(t),this.emitNavigationStatus()};onUpdate=()=>{this.tweenUtil.update()};resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,n){let{curRoutePathPoints:i,position:o,curRoutePath:a,paths:c,routeIndex:l}=this;if(!i.length)return null;let s=i;if(o){let p=_n(i,o);s=s.slice(p+1),s.unshift(o)}let u=[{floor:a?.floor,points:s},...c.slice(l+1)].filter(p=>p.floor===t),{distance:h,closestPoint:f,index:d,i:g}=u.reduce((p,m,v)=>{let{distance:b,closestPoint:y,index:S}=m.points.reduce((x,_,M,w)=>{if(!w[M+1])return x;let{distance:C,closestPoint:P}=no(n,_,w[M+1]);return C<x.distance?{distance:C,closestPoint:P,index:M}:x},{distance:1/0,closestPoint:m.points[0],index:0});return b<p.distance?{distance:b,closestPoint:y,index:v,i:S}:p},{distance:1/0,closestPoint:s[0],index:0,i:0});return{distance:h,closestPoint:f,routeIndex:d+l,pointIndex:d===0?g+this.pointIndex:g}}toPosition(t,n){let i=this.adsorb(t,n);if(!i)return;let{distance:o,closestPoint:a,routeIndex:c,pointIndex:l}=i;o>this.options.offsetDistance?(this.offset=!0,this.resetTimer||(this.resetTimer=this.timer.setTimeout(()=>{this.reset=!0,this.resetTimer=null},this.options.offsetToResetTime))):(this.offset=!1,this.reset=!1,this.resetTimer&&this.timer.clearTimeout(this.resetTimer)),this.routeIndex=c,this.pointIndex=l,this.position=a,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}async startCurRouteSimulation(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let n=[];return new Promise(i=>{let o=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],a=this.getCurRouteRemainDistance(),c=a/this.options.simulationSpeed,l=this.simulationTween=new fu.Tween({distance:0},this.tweenUtil.group).to({distance:a},c*1e3).onUpdate(s=>{let u=hr(o,s.distance);u&&(n.push({floor:t.floor,pos:u}),this.toPosition(t.floor,u))}).onComplete(()=>{this.tweenUtil.remove(l),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,i(this.startCurRouteSimulation())):(i(!0),console.log(n))}).start()})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:n,position:i}=this;if(!t.length)return 0;let o=[i,...t.slice(n+1)];return Ne(o)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((o,a)=>o+a.distance,0)+t,curRoute:t}}getNextDirDistance(){if(!this.position)return null;let{pointIndex:t,curRoutePathPoints:n,position:i}=this,o=n[t],a=n[t+1],c=n[t+2];if(!o||!a)return null;let l=qt(i,a);return t===0&&qt(o,i)<5?{dir:"start",distance:l}:c?{dir:Kr(o,a,c),distance:l}:{dir:"end",distance:l}}getNavigationInfo(){let{total:t,curRoute:n}=this.getRemainDistance(),i=this.getNextDirDistance();if(!i)return null;let{dir:o,distance:a}=i;return o==="end"&&a>15&&(o="front"),o!=="start"&&a>=this.options.directionEmitThreshold&&(o="front"),n<=5&&(o="end"),{distance:t,curRouteDistance:n,nextDirDistance:a,dir:o,pos:this.position,routeIndex:this.routeIndex,offset:this.offset,reset:this.reset}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear()}};var hp={path:{},cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},positionNavigation:{},offsetY:150,directionEmitThreshold:5,disablePathAnimation:!1,speed:1},xo=class extends qe{path=null;fetchRoadStatus=!1;paths=[];curPathIndex=0;curFloorPath=null;translatePath=null;currentPathPosition=null;options;pathTween=null;startPoi=null;movedDistance=0;pathStart=[0,0];tweenUtil=new wn;animationPathOptions={cPathIndex:0};cPath=[];positionNavigation;pathMoving=!1;nextPoint=null;constructor(e,t={},n){super(e),!n&&typeof t=="object"&&(n=t),this.options=Object.assign({},hp,n);let{apiDomain:i,apiPath:{roadNetwork:o},apiInfo:a}=this.bmap.config;this.positionNavigation=new di(this,{simulationSpeed:this.options.speed,...this.options.positionNavigation}),this.registryEvent()}get curFloorPathLength(){return this.curFloorPath?.distance??0}get curFloorPathPoints(){return this.curFloorPath?.points??[]}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor),this.positionNavigation.addEventListener("navigation-info",this.onNavigationInfo)}onNavigationInfo=({info:e})=>{if(this.dispatchEvent({type:"navigation-info",info:e}),!e.offset){if(e.routeIndex!==this.curPathIndex)return;this.pathMoving?this.nextPoint=e.pos:(this.toPositionBySpeed(e.pos,this.options.speed).then(()=>{this.pathMoving=!1}),this.nextPoint=null)}};pauseAnimation(){this.tweenUtil.pause(),this.positionNavigation.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue(),this.positionNavigation.tweenUtil.continue()}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),this.positionNavigation.removeEventListener("navigation-info",this.onNavigationInfo)}onUpdate=()=>{this.tweenUtil.update()};clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.tweenUtil.clear()),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null),this.translatePath=null}setCurFloorPath(e){e===null?(this.curFloorPath=null,this.currentPathPosition=null):(this.curFloorPath=e,this.currentPathPosition=e.points[0]),this.movedDistance=0}setCurPathIndex(e){this.curPathIndex=e,this.paths[e]?.floor===this.bmap.context.currentFloor?.name?(this.setCurFloorPath(this.paths[e]),this.renderPath(this.translatePoints(this.curFloorPathPoints))):this.clearPath()}onSwitchFloor=({data:{curFloor:e}})=>{if(this.tweenUtil.clear(),this.nextPoint=null,this.pathMoving=!1,this.paths[this.curPathIndex]){let t=this.paths[this.curPathIndex];this.setCurFloorPath(t??null),t?this.renderPath(this.translatePoints(t.points)):this.clearPath()}else this.clearPath()};addPath(e,t=0){this.paths=e,this.curPathIndex=t;let n=this.bmap.context.currentFloor?.name,i=e[t];if(n&&i?.floor===n)if(this.setCurFloorPath(i),this.bmap.currentBuildGround)this.renderPath(this.translatePoints(i.points));else{let o=()=>{this.bmap.removeEventListener("center-change",o),this.renderPath(this.translatePoints(i.points))};this.bmap.addEventListener("center-change",o)}else this.clearPath();this.dispatchEvent({type:"add-path",paths:e})}translatePoints(e){let[t,n]=this.bmap.buildingCenter;return e.map(i=>[i[0]-t,i[1]-n])}renderPath(e){this.translatePath=e;let t=this.catmullRomCurve3(e);this.cPath=t,this.animationPathOptions={cPathIndex:0},this.pathStart=t[0],this.path?this.path.updatePoints(t):(this.path=new fi(this,this.options.path),this.path.create(t),this.path.position.z=this.bmap.context.currentFloor.groundMaxHeight+.5,this.bmap.context.scene.add(this.path)),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null),this.options.needStartPoi&&(this.startPoi=new he(this.bmap.context,{...this.options.startPoi,id:"navigation_start_poi",position:{x:t[0][0],y:t[0][1],z:.51},collision_enable:!1})||null,this.bmap.context.currentFloor?.poiLayer2.pushPoi(this.startPoi)),this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(e){return eo(e,!1,!0,.1,170,2.5)}getPathDirection(){if(!this.curFloorPath||!this.currentPathPosition||this.curFloorPathPoints.length<2)return null;let e=_n(this.curFloorPathPoints,this.currentPathPosition),t=this.curFloorPathPoints[e],n=this.curFloorPathPoints[e+1],i=new pn.Vector3(n[0]-t[0],n[1]-t[1],0).normalize(),o=new pn.Vector3(0,1,0).normalize(),a=i.angleTo(o),c=new pn.Vector3().crossVectors(o,i);return(Object.is(c.y,0)?-1:1)*a}async changeCameraToPathUp(e=100){let t=this.getPathDirection();if(t===null)return;let n=this.bmap.context.control.getAzimuthalAngle();Math.abs(n-t)>Math.PI&&(n>0?t=Math.PI*2+t:t=t-Math.PI*2);let i=Math.abs(t-this.bmap.context.control.getAzimuthalAngle());if(i<.01)return;let{control:o}=this.bmap.context,a=e/Math.PI*6*i;return new Promise(c=>{let l={azimuthal:o.getAzimuthalAngle()},s={azimuthal:t},u=new Pr.Tween(l,this.tweenUtil.group).to(s,a).easing(Pr.Easing.Quadratic.InOut).onUpdate(async()=>{o.target.copy(this.startPoi.position),o.setAzimuthalAngle(l.azimuthal,!0),o.setTargetByOffset(this.options.offsetY)}).onComplete(()=>{o.enabled=!0,this.tweenUtil.remove(u),c(!0)}).onStart(()=>{o.enabled=!1}).start()})}async initNavigationCamera(){await this.translateCameraToStartPoi(300),await this.changeCameraToPathUp(300)}async translateCameraToStartPoi(e=100){if(!this.startPoi)return;let{clientSize:{width:t,height:n},camera:i,control:o}=this.bmap.context,a=Math.round(t/2),c=Math.round(n/2),l=o.target.clone(),s=et(this.startPoi.position,i,t,n),u=s.x-a,h=c-s.y+this.options.offsetY;if(!(Math.abs(u)<1&&Math.abs(h)<1)){if(Math.abs(u)>=1){let f=new pn.Vector3;f.setFromMatrixColumn(i.matrix,0),f.normalize(),f.multiplyScalar(u/i.zoom),l.add(new pn.Vector3(f.x,0,0))}if(Math.abs(h)>=1){let f=new pn.Vector3;f.setFromMatrixColumn(i.matrix,1),f.normalize(),f.multiplyScalar(h/i.zoom),l.add(new pn.Vector3(0,f.y,0))}return this.bmap.context.setCameraPosition(l,e)}}async initCameraZoom(e=100){if(!this.startPoi)return;let{clientSize:{width:t,height:n},currentFloor:i}=this.bmap.context,{max:o,min:a}=i.box,l=Math.min(t/(o.x-a.x),n/(o.y-a.y))*(o.x-a.x)/20;return this.bmap.context.setZoom(l,this.startPoi.position,e)}toPosition(e,t){this.positionNavigation.toPosition(e,t)}startSimulation(){this.positionNavigation.startSimulation()}setSimulationSpeed(e){this.positionNavigation.changeSimulationSpeed(e)}async toPositionBySpeed(e,t){let{currentPathPosition:n,curFloorPath:i,curFloorPathPoints:o}=this;if(!i||!n)return null;let a=this.movedDistance,c=io(o,e);if(a===-1||c===-1||c<=a)return null;let l=c-a;if(!l)return;let s=Math.min(l/t,3);return this.pathTween&&this.tweenUtil.clear(),this.pathMoving=!0,new Promise(u=>{let h=this.pathTween=new Pr.Tween({distance:0},this.tweenUtil.group).to({distance:l},s*1e3).onUpdate(async f=>{this.moveDistance(f.distance+a,h)}).onComplete(()=>{if(this.tweenUtil.remove(h),this.nextPoint){let f=this.nextPoint;this.nextPoint=null,u(this.toPositionBySpeed(f,this.options.speed))}else u(!0)}).start()})}async moveDistance(e,t){this.movedDistance=e,this.path?.movePath(this.movedDistance/this.curFloorPathLength);let n=hr(this.curFloorPathPoints,this.movedDistance);if(n===null)return;this.currentPathPosition=n;let i=this.translatePoints([n])[0];this.startPoi&&(this.startPoi.position.setX(i[0]).setY(i[1]),this.options.disablePathAnimation||this.bmap.context.control.setTargetByOffset(this.options.offsetY,this.startPoi.position.clone())),this.options.disablePathAnimation||(t?.pause(),this.positionNavigation.tweenUtil.pause(),await this.changeCameraToPathUp(500/this.options.speed),this.positionNavigation.tweenUtil.continue(),t?.resume())}setStartPoiRotate(e){if(this.startPoi){let n=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(360-e-n)%360}}dispose(){this.tweenUtil.dispose(),this.unRegistryEvent(),this.path?.dispose(),this.startPoi?.dispose(),this.positionNavigation.dispose()}};var du=require("three"),Eo=class extends qe{poiLayer;floors=[];group=new du.Group;constructor(e){super(e),this.poiLayer=new An(e.context)}show(e){let t=e[0].userData.height;e.forEach(o=>{o.poiLayer.pois.forEach(a=>{this.poiLayer.pushPoi(a)}),o.poiLayer.pois.length=0,o.poiLayer.dispose(),o.position.z=t,t+=o.userData.height});let{scene:n,currentFloor:i}=this.bmap.context;i&&(n.remove(i),i.dispose()),this.group.add(this.poiLayer,...e),n.add(this.group),this.floors=e,this.bmap.context.cameraBound.updateBox()}hide(){let{scene:e}=this.bmap.context;e.remove(this.group),this.poiLayer.clear(!0),this.floors.forEach(t=>{t.dispose()}),this.floors=[],this.group.clear()}fitCamera(){let{context:e,config:t,type:n}=this.bmap;e.cameraBound.setEnable(!1),e.control.minZoom=0,e.control.maxZoom=1/0,e.camera.zoom=1,e.setAzimuthalAngle(t.control.defaultAzimuthal,0),e.setPolarAngle(t.control.defaultPolar,0),e.fitCameraToObject(this.group,void 0,0);let i=e.camera.zoom;e.control.minZoom=i,e.control.maxZoom=i*25,n==="3d"&&e.fitCameraToObject(this.group,t.defaultPadding,0,!1),this.bmap.basicZoom=e.camera.zoom,e.control.addEventListener("change",this.bmap.onControlChange.bind(this.bmap)),this.bmap.onControlChange(),e.cameraBound.setEnable(!0)}dispose(){this.poiLayer.dispose(),this.floors.forEach(e=>e.dispose()),this.floors=[]}};var gu=require("three");function Dr(r){let e=new Blob([r],{type:"text/javascript"}),t=URL.createObjectURL(e),n=new Worker(t);return URL.revokeObjectURL(t),n}function bo(){return Dr(`var RP=Object.create;var Zd=Object.defineProperty,LP=Object.defineProperties,NP=Object.getOwnPropertyDescriptor,OP=Object.getOwnPropertyDescriptors,DP=Object.getOwnPropertyNames,Wv=Object.getOwnPropertySymbols,FP=Object.getPrototypeOf,qv=Object.prototype.hasOwnProperty,UP=Object.prototype.propertyIsEnumerable;var $d=(r,t,e)=>t in r?Zd(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Wc=(r,t)=>{for(var e in t||(t={}))qv.call(t,e)&&$d(r,e,t[e]);if(Wv)for(var e of Wv(t))UP.call(t,e)&&$d(r,e,t[e]);return r},Xv=(r,t)=>LP(r,OP(t));var ye=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var BP=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of DP(t))!qv.call(r,a)&&a!==e&&Zd(r,a,{get:()=>t[a],enumerable:!(o=NP(t,a))||o.enumerable});return r};var Er=(r,t,e)=>(e=r!=null?RP(FP(r)):{},BP(t||!r||!r.__esModule?Zd(e,"default",{value:r,enumerable:!0}):e,r));var Ei=(r,t,e)=>$d(r,typeof t!="symbol"?t+"":t,e);var $v=ye((lz,Yv)=>{var Jd=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(a=>(a.key===t&&Object.assign(a,{priority:o}),a)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};Yv.exports=Jd});var Kv=ye((cz,Jv)=>{function Zv(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,Zv(a,t)):o!==t&&e.set(o,a);return e}Jv.exports=Zv});var t_=ye((fz,jv)=>{function zP(r){let t=Number(r);return!(isNaN(t)||t<=0)}function Qv(r){let t=new Map;return Object.keys(r).forEach(o=>{let a=r[o];if(a!==null&&typeof a=="object"&&!Array.isArray(a))return t.set(o,Qv(a));if(!zP(a))throw new Error(\`Could not add node at key "\${o}", make sure it's a valid node\`,a);return t.set(o,Number(a))}),t}jv.exports=Qv});var r_=ye((hz,n_)=>{function e_(r){if(!(r instanceof Map))throw new Error(\`Invalid graph: Expected Map instead found \${typeof r}\`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){e_(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}n_.exports=e_});var a_=ye((pz,s_)=>{var kP=$v(),GP=Kv(),i_=t_(),o_=r_(),Kd=class{constructor(t){t instanceof Map?(o_(t),this.graph=t):t?this.graph=i_(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(o_(e),o=e):o=i_(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=GP(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,c=new kP,p=new Map,d=[],g=0,y=[];if(o.avoid&&(y=[].concat(o.avoid)),y.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(y.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(c.set(t,0);!c.isEmpty();){let _=c.next();if(_.key===e){g=_.priority;let x=_.key;for(;p.has(x);)d.push(x),x=p.get(x);break}a.add(_.key),(this.graph.get(_.key)||new Map).forEach((x,T)=>{if(a.has(T)||y.includes(T))return null;if(!c.has(T))return p.set(T,_.key),c.set(T,_.priority+x);let C=c.get(T).priority,I=_.priority+x;return I<C?(p.set(T,_.key),c.set(T,I)):null})}return d.length?(o.trim?d.shift():d=d.concat([t]),o.reverse||(d=d.reverse()),o.cost?{path:d,cost:g}:d):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};s_.exports=Kd});var tp=ye((wz,K1)=>{"use strict";var J1=Object.getOwnPropertySymbols,HO=Object.prototype.hasOwnProperty,VO=Object.prototype.propertyIsEnumerable;function WO(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function qO(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(c){return t[c]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(c){a[c]=c}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(c){return!1}}K1.exports=qO()?Object.assign:function(r,t){for(var e,o=WO(r),a,c=1;c<arguments.length;c++){e=Object(arguments[c]);for(var p in e)HO.call(e,p)&&(o[p]=e[p]);if(J1){a=J1(e);for(var d=0;d<a.length;d++)VO.call(e,a[d])&&(o[a[d]]=e[a[d]])}}return o}});var Mm=ye((Em,wm)=>{(function(r,t){typeof Em=="object"&&typeof wm!="undefined"?wm.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(Em,function(){"use strict";function r(M,E,L,A,z){(function G(Y,X,U,H,Q){for(;H>U;){if(H-U>600){var gt=H-U+1,$=X-U+1,Nt=Math.log(gt),j=.5*Math.exp(2*Nt/3),pt=.5*Math.sqrt(Nt*j*(gt-j)/gt)*($-gt/2<0?-1:1),Ct=Math.max(U,Math.floor(X-$*j/gt+pt)),Tt=Math.min(H,Math.floor(X+(gt-$)*j/gt+pt));G(Y,X,Ct,Tt,Q)}var ft=Y[X],dt=U,Z=H;for(t(Y,U,X),Q(Y[H],ft)>0&&t(Y,U,H);dt<Z;){for(t(Y,dt,Z),dt++,Z--;Q(Y[dt],ft)<0;)dt++;for(;Q(Y[Z],ft)>0;)Z--}Q(Y[U],ft)===0?t(Y,U,Z):t(Y,++Z,H),Z<=X&&(U=Z+1),X<=Z&&(H=Z-1)}})(M,E,L||0,A||M.length-1,z||e)}function t(M,E,L){var A=M[E];M[E]=M[L],M[L]=A}function e(M,E){return M<E?-1:M>E?1:0}var o=function(M){M===void 0&&(M=9),this._maxEntries=Math.max(4,M),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(M,E,L){if(!L)return E.indexOf(M);for(var A=0;A<E.length;A++)if(L(M,E[A]))return A;return-1}function c(M,E){p(M,0,M.children.length,E,M)}function p(M,E,L,A,z){z||(z=C(null)),z.minX=1/0,z.minY=1/0,z.maxX=-1/0,z.maxY=-1/0;for(var G=E;G<L;G++){var Y=M.children[G];d(z,M.leaf?A(Y):Y)}return z}function d(M,E){return M.minX=Math.min(M.minX,E.minX),M.minY=Math.min(M.minY,E.minY),M.maxX=Math.max(M.maxX,E.maxX),M.maxY=Math.max(M.maxY,E.maxY),M}function g(M,E){return M.minX-E.minX}function y(M,E){return M.minY-E.minY}function _(M){return(M.maxX-M.minX)*(M.maxY-M.minY)}function w(M){return M.maxX-M.minX+(M.maxY-M.minY)}function x(M,E){return M.minX<=E.minX&&M.minY<=E.minY&&E.maxX<=M.maxX&&E.maxY<=M.maxY}function T(M,E){return E.minX<=M.maxX&&E.minY<=M.maxY&&E.maxX>=M.minX&&E.maxY>=M.minY}function C(M){return{children:M,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function I(M,E,L,A,z){for(var G=[E,L];G.length;)if(!((L=G.pop())-(E=G.pop())<=A)){var Y=E+Math.ceil((L-E)/A/2)*A;r(M,Y,E,L,z),G.push(E,Y,Y,L)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(M){var E=this.data,L=[];if(!T(M,E))return L;for(var A=this.toBBox,z=[];E;){for(var G=0;G<E.children.length;G++){var Y=E.children[G],X=E.leaf?A(Y):Y;T(M,X)&&(E.leaf?L.push(Y):x(M,X)?this._all(Y,L):z.push(Y))}E=z.pop()}return L},o.prototype.collides=function(M){var E=this.data;if(!T(M,E))return!1;for(var L=[];E;){for(var A=0;A<E.children.length;A++){var z=E.children[A],G=E.leaf?this.toBBox(z):z;if(T(M,G)){if(E.leaf||x(M,G))return!0;L.push(z)}}E=L.pop()}return!1},o.prototype.load=function(M){if(!M||!M.length)return this;if(M.length<this._minEntries){for(var E=0;E<M.length;E++)this.insert(M[E]);return this}var L=this._build(M.slice(),0,M.length-1,0);if(this.data.children.length)if(this.data.height===L.height)this._splitRoot(this.data,L);else{if(this.data.height<L.height){var A=this.data;this.data=L,L=A}this._insert(L,this.data.height-L.height-1,!0)}else this.data=L;return this},o.prototype.insert=function(M){return M&&this._insert(M,this.data.height-1),this},o.prototype.clear=function(){return this.data=C([]),this},o.prototype.remove=function(M,E){if(!M)return this;for(var L,A,z,G=this.data,Y=this.toBBox(M),X=[],U=[];G||X.length;){if(G||(G=X.pop(),A=X[X.length-1],L=U.pop(),z=!0),G.leaf){var H=a(M,G.children,E);if(H!==-1)return G.children.splice(H,1),X.push(G),this._condense(X),this}z||G.leaf||!x(G,Y)?A?(L++,G=A.children[L],z=!1):G=null:(X.push(G),U.push(L),L=0,A=G,G=G.children[0])}return this},o.prototype.toBBox=function(M){return M},o.prototype.compareMinX=function(M,E){return M.minX-E.minX},o.prototype.compareMinY=function(M,E){return M.minY-E.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(M){return this.data=M,this},o.prototype._all=function(M,E){for(var L=[];M;)M.leaf?E.push.apply(E,M.children):L.push.apply(L,M.children),M=L.pop();return E},o.prototype._build=function(M,E,L,A){var z,G=L-E+1,Y=this._maxEntries;if(G<=Y)return c(z=C(M.slice(E,L+1)),this.toBBox),z;A||(A=Math.ceil(Math.log(G)/Math.log(Y)),Y=Math.ceil(G/Math.pow(Y,A-1))),(z=C([])).leaf=!1,z.height=A;var X=Math.ceil(G/Y),U=X*Math.ceil(Math.sqrt(Y));I(M,E,L,U,this.compareMinX);for(var H=E;H<=L;H+=U){var Q=Math.min(H+U-1,L);I(M,H,Q,X,this.compareMinY);for(var gt=H;gt<=Q;gt+=X){var $=Math.min(gt+X-1,Q);z.children.push(this._build(M,gt,$,A-1))}}return c(z,this.toBBox),z},o.prototype._chooseSubtree=function(M,E,L,A){for(;A.push(E),!E.leaf&&A.length-1!==L;){for(var z=1/0,G=1/0,Y=void 0,X=0;X<E.children.length;X++){var U=E.children[X],H=_(U),Q=(gt=M,$=U,(Math.max($.maxX,gt.maxX)-Math.min($.minX,gt.minX))*(Math.max($.maxY,gt.maxY)-Math.min($.minY,gt.minY))-H);Q<G?(G=Q,z=H<z?H:z,Y=U):Q===G&&H<z&&(z=H,Y=U)}E=Y||E.children[0]}var gt,$;return E},o.prototype._insert=function(M,E,L){var A=L?M:this.toBBox(M),z=[],G=this._chooseSubtree(A,this.data,E,z);for(G.children.push(M),d(G,A);E>=0&&z[E].children.length>this._maxEntries;)this._split(z,E),E--;this._adjustParentBBoxes(A,z,E)},o.prototype._split=function(M,E){var L=M[E],A=L.children.length,z=this._minEntries;this._chooseSplitAxis(L,z,A);var G=this._chooseSplitIndex(L,z,A),Y=C(L.children.splice(G,L.children.length-G));Y.height=L.height,Y.leaf=L.leaf,c(L,this.toBBox),c(Y,this.toBBox),E?M[E-1].children.push(Y):this._splitRoot(L,Y)},o.prototype._splitRoot=function(M,E){this.data=C([M,E]),this.data.height=M.height+1,this.data.leaf=!1,c(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(M,E,L){for(var A,z,G,Y,X,U,H,Q=1/0,gt=1/0,$=E;$<=L-E;$++){var Nt=p(M,0,$,this.toBBox),j=p(M,$,L,this.toBBox),pt=(z=Nt,G=j,Y=void 0,X=void 0,U=void 0,H=void 0,Y=Math.max(z.minX,G.minX),X=Math.max(z.minY,G.minY),U=Math.min(z.maxX,G.maxX),H=Math.min(z.maxY,G.maxY),Math.max(0,U-Y)*Math.max(0,H-X)),Ct=_(Nt)+_(j);pt<Q?(Q=pt,A=$,gt=Ct<gt?Ct:gt):pt===Q&&Ct<gt&&(gt=Ct,A=$)}return A||L-E},o.prototype._chooseSplitAxis=function(M,E,L){var A=M.leaf?this.compareMinX:g,z=M.leaf?this.compareMinY:y;this._allDistMargin(M,E,L,A)<this._allDistMargin(M,E,L,z)&&M.children.sort(A)},o.prototype._allDistMargin=function(M,E,L,A){M.children.sort(A);for(var z=this.toBBox,G=p(M,0,E,z),Y=p(M,L-E,L,z),X=w(G)+w(Y),U=E;U<L-E;U++){var H=M.children[U];d(G,M.leaf?z(H):H),X+=w(G)}for(var Q=L-E-1;Q>=E;Q--){var gt=M.children[Q];d(Y,M.leaf?z(gt):gt),X+=w(Y)}return X},o.prototype._adjustParentBBoxes=function(M,E,L){for(var A=L;A>=0;A--)d(E[A],M)},o.prototype._condense=function(M){for(var E=M.length-1,L=void 0;E>=0;E--)M[E].children.length===0?E>0?(L=M[E-1].children).splice(L.indexOf(M[E]),1):this.clear():c(M[E],this.toBBox)},o})});var Q1=ye((Sm,bm)=>{(function(r,t){typeof Sm=="object"&&typeof bm!="undefined"?bm.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(Sm,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var c=(this.length>>1)-1;c>=0;c--)this._down(c)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,c=a.data,p=a.compare,d=c[o];o>0;){var g=o-1>>1,y=c[g];if(p(d,y)>=0)break;c[o]=y,o=g}c[o]=d},r.prototype._down=function(o){for(var a=this,c=a.data,p=a.compare,d=this.length>>1,g=c[o];o<d;){var y=(o<<1)+1,_=c[y],w=y+1;if(w<this.length&&p(c[w],_)<0&&(y=w,_=c[w]),p(_,g)>=0)break;c[o]=_,o=y}c[o]=g};function t(e,o){return e<o?-1:e>o?1:0}return r})});var tx=ye((Cz,j1)=>{j1.exports=function(t,e,o,a){var c=t[0],p=t[1],d=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var g=(a-o)/2,y=0,_=g-1;y<g;_=y++){var w=e[o+y*2+0],x=e[o+y*2+1],T=e[o+_*2+0],C=e[o+_*2+1],I=x>p!=C>p&&c<(T-w)*(p-x)/(C-x)+w;I&&(d=!d)}return d}});var nx=ye((Pz,ex)=>{ex.exports=function(t,e,o,a){var c=t[0],p=t[1],d=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var g=a-o,y=0,_=g-1;y<g;_=y++){var w=e[y+o][0],x=e[y+o][1],T=e[_+o][0],C=e[_+o][1],I=x>p!=C>p&&c<(T-w)*(p-x)/(C-x)+w;I&&(d=!d)}return d}});var ox=ye((Iz,rp)=>{var rx=tx(),ix=nx();rp.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?ix(t,e,o,a):rx(t,e,o,a)};rp.exports.nested=ix;rp.exports.flat=rx});var ax=ye((ip,sx)=>{(function(r,t){typeof ip=="object"&&typeof sx!="undefined"?t(ip):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(ip,function(r){"use strict";let e=33306690738754706e-32;function o(T,C,I,M,E){let L,A,z,G,Y=C[0],X=M[0],U=0,H=0;X>Y==X>-Y?(L=Y,Y=C[++U]):(L=X,X=M[++H]);let Q=0;if(U<T&&H<I)for(X>Y==X>-Y?(z=L-((A=Y+L)-Y),Y=C[++U]):(z=L-((A=X+L)-X),X=M[++H]),L=A,z!==0&&(E[Q++]=z);U<T&&H<I;)X>Y==X>-Y?(z=L-((A=L+Y)-(G=A-L))+(Y-G),Y=C[++U]):(z=L-((A=L+X)-(G=A-L))+(X-G),X=M[++H]),L=A,z!==0&&(E[Q++]=z);for(;U<T;)z=L-((A=L+Y)-(G=A-L))+(Y-G),Y=C[++U],L=A,z!==0&&(E[Q++]=z);for(;H<I;)z=L-((A=L+X)-(G=A-L))+(X-G),X=M[++H],L=A,z!==0&&(E[Q++]=z);return L===0&&Q!==0||(E[Q++]=L),Q}function a(T){return new Float64Array(T)}let c=33306690738754716e-32,p=22204460492503146e-32,d=11093356479670487e-47,g=a(4),y=a(8),_=a(12),w=a(16),x=a(4);r.orient2d=function(T,C,I,M,E,L){let A=(C-L)*(I-E),z=(T-E)*(M-L),G=A-z;if(A===0||z===0||A>0!=z>0)return G;let Y=Math.abs(A+z);return Math.abs(G)>=c*Y?G:-function(X,U,H,Q,gt,$,Nt){let j,pt,Ct,Tt,ft,dt,Z,st,vt,zt,bt,qt,le,se,Zt,_e,Vt,pe,at=X-gt,He=H-gt,ae=U-$,ce=Q-$;ft=(Zt=(st=at-(Z=(dt=134217729*at)-(dt-at)))*(zt=ce-(vt=(dt=134217729*ce)-(dt-ce)))-((se=at*ce)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=ae-(Z=(dt=134217729*ae)-(dt-ae)))*(zt=He-(vt=(dt=134217729*He)-(dt-He)))-((_e=ae*He)-Z*vt-st*vt-Z*zt))),g[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),g[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,g[2]=qt-(pe-ft)+(bt-ft),g[3]=pe;let fe=function(J,rt){let D=rt[0];for(let N=1;N<J;N++)D+=rt[N];return D}(4,g),it=p*Nt;if(fe>=it||-fe>=it||(j=X-(at+(ft=X-at))+(ft-gt),Ct=H-(He+(ft=H-He))+(ft-gt),pt=U-(ae+(ft=U-ae))+(ft-$),Tt=Q-(ce+(ft=Q-ce))+(ft-$),j===0&&pt===0&&Ct===0&&Tt===0)||(it=d*Nt+e*Math.abs(fe),(fe+=at*Tt+ce*j-(ae*Ct+He*pt))>=it||-fe>=it))return fe;ft=(Zt=(st=j-(Z=(dt=134217729*j)-(dt-j)))*(zt=ce-(vt=(dt=134217729*ce)-(dt-ce)))-((se=j*ce)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=pt-(Z=(dt=134217729*pt)-(dt-pt)))*(zt=He-(vt=(dt=134217729*He)-(dt-He)))-((_e=pt*He)-Z*vt-st*vt-Z*zt))),x[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),x[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,x[2]=qt-(pe-ft)+(bt-ft),x[3]=pe;let B=o(4,g,4,x,y);ft=(Zt=(st=at-(Z=(dt=134217729*at)-(dt-at)))*(zt=Tt-(vt=(dt=134217729*Tt)-(dt-Tt)))-((se=at*Tt)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=ae-(Z=(dt=134217729*ae)-(dt-ae)))*(zt=Ct-(vt=(dt=134217729*Ct)-(dt-Ct)))-((_e=ae*Ct)-Z*vt-st*vt-Z*zt))),x[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),x[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,x[2]=qt-(pe-ft)+(bt-ft),x[3]=pe;let P=o(B,y,4,x,_);ft=(Zt=(st=j-(Z=(dt=134217729*j)-(dt-j)))*(zt=Tt-(vt=(dt=134217729*Tt)-(dt-Tt)))-((se=j*Tt)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=pt-(Z=(dt=134217729*pt)-(dt-pt)))*(zt=Ct-(vt=(dt=134217729*Ct)-(dt-Ct)))-((_e=pt*Ct)-Z*vt-st*vt-Z*zt))),x[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),x[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,x[2]=qt-(pe-ft)+(bt-ft),x[3]=pe;let F=o(P,_,4,x,w);return w[F-1]}(T,C,I,M,E,L,Y)},r.orient2dfast=function(T,C,I,M,E,L){return(C-L)*(I-E)-(T-E)*(M-L)},Object.defineProperty(r,"__esModule",{value:!0})})});var px=ye((Rz,Pm)=>{"use strict";var ux=Mm(),sp=Q1(),YO=ox(),$O=ax().orient2d;sp.default&&(sp=sp.default);Pm.exports=hx;Pm.exports.default=hx;function hx(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=jO(r),a=new ux(16);a.toBBox=function(L){return{minX:L[0],minY:L[1],maxX:L[0],maxY:L[1]}},a.compareMinX=function(L,A){return L[0]-A[0]},a.compareMinY=function(L,A){return L[1]-A[1]},a.load(r);for(var c=[],p=0,d;p<o.length;p++){var g=o[p];a.remove(g),d=fx(g,d),c.push(d)}var y=new ux(16);for(p=0;p<c.length;p++)y.insert(Tm(c[p]));for(var _=t*t,w=e*e;c.length;){var x=c.shift(),T=x.p,C=x.next.p,I=Am(T,C);if(!(I<w)){var M=I/_;g=ZO(a,x.prev.p,T,C,x.next.next.p,M,y),g&&Math.min(Am(g,T),Am(g,C))<=M&&(c.push(x),c.push(fx(g,x)),a.remove(g),y.remove(x),y.insert(Tm(x)),y.insert(Tm(x.next)))}}x=d;var E=[];do E.push(x.p),x=x.next;while(x!==d);return E.push(x.p),E}function ZO(r,t,e,o,a,c,p){for(var d=new sp([],JO),g=r.data;g;){for(var y=0;y<g.children.length;y++){var _=g.children[y],w=g.leaf?Cm(_,e,o):KO(e,o,_);w>c||d.push({node:_,dist:w})}for(;d.length&&!d.peek().node.children;){var x=d.pop(),T=x.node,C=Cm(T,t,e),I=Cm(T,o,a);if(x.dist<C&&x.dist<I&&cx(e,T,p)&&cx(o,T,p))return T}g=d.pop(),g&&(g=g.node)}return null}function JO(r,t){return r.dist-t.dist}function KO(r,t,e){if(lx(r,e)||lx(t,e))return 0;var o=op(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=op(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var c=op(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(c===0)return 0;var p=op(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return p===0?0:Math.min(o,a,c,p)}function lx(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function cx(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),c=Math.max(r[0],t[0]),p=Math.max(r[1],t[1]),d=e.search({minX:o,minY:a,maxX:c,maxY:p}),g=0;g<d.length;g++)if(QO(d[g].p,d[g].next.p,r,t))return!1;return!0}function rc(r,t,e){return $O(r[0],r[1],t[0],t[1],e[0],e[1])}function QO(r,t,e,o){return r!==o&&t!==e&&rc(r,t,e)>0!=rc(r,t,o)>0&&rc(e,o,r)>0!=rc(e,o,t)>0}function Tm(r){var t=r.p,e=r.next.p;return r.minX=Math.min(t[0],e[0]),r.minY=Math.min(t[1],e[1]),r.maxX=Math.max(t[0],e[0]),r.maxY=Math.max(t[1],e[1]),r}function jO(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],c=0;c<r.length;c++){var p=r[c];p[0]<t[0]&&(t=p),p[0]>o[0]&&(o=p),p[1]<e[1]&&(e=p),p[1]>a[1]&&(a=p)}var d=[t,e,o,a],g=d.slice();for(c=0;c<r.length;c++)YO(r[c],d)||g.push(r[c]);return eD(g)}function fx(r,t){var e={p:r,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function Am(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function Cm(r,t,e){var o=t[0],a=t[1],c=e[0]-o,p=e[1]-a;if(c!==0||p!==0){var d=((r[0]-o)*c+(r[1]-a)*p)/(c*c+p*p);d>1?(o=e[0],a=e[1]):d>0&&(o+=c*d,a+=p*d)}return c=r[0]-o,p=r[1]-a,c*c+p*p}function op(r,t,e,o,a,c,p,d){var g=e-r,y=o-t,_=p-a,w=d-c,x=r-a,T=t-c,C=g*g+y*y,I=g*_+y*w,M=_*_+w*w,E=g*x+y*T,L=_*x+w*T,A=C*M-I*I,z,G,Y,X,U=A,H=A;A===0?(G=0,U=1,X=L,H=M):(G=I*L-M*E,X=C*L-I*E,G<0?(G=0,X=L,H=M):G>U&&(G=U,X=L+I,H=M)),X<0?(X=0,-E<0?G=0:-E>C?G=U:(G=-E,U=C)):X>H&&(X=H,-E+I<0?G=0:-E+I>C?G=U:(G=-E+I,U=C)),z=G===0?0:G/U,Y=X===0?0:X/H;var Q=(1-z)*r+z*e,gt=(1-z)*t+z*o,$=(1-Y)*a+Y*p,Nt=(1-Y)*c+Y*d,j=$-Q,pt=Nt-gt;return j*j+pt*pt}function tD(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function eD(r){r.sort(tD);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&rc(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}for(var o=[],a=r.length-1;a>=0;a--){for(;o.length>=2&&rc(o[o.length-2],o[o.length-1],r[a])<=0;)o.pop();o.push(r[a])}return o.pop(),t.pop(),t.concat(o)}});var _x=ye((Rm,Lm)=>{(function(r,t){typeof Rm=="object"&&typeof Lm!="undefined"?Lm.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(Rm,function(){"use strict";function r(a,c,p,d,g){t(a,c,p||0,d||a.length-1,g||o)}function t(a,c,p,d,g){for(;d>p;){if(d-p>600){var y=d-p+1,_=c-p+1,w=Math.log(y),x=.5*Math.exp(2*w/3),T=.5*Math.sqrt(w*x*(y-x)/y)*(_-y/2<0?-1:1),C=Math.max(p,Math.floor(c-_*x/y+T)),I=Math.min(d,Math.floor(c+(y-_)*x/y+T));t(a,c,C,I,g)}var M=a[c],E=p,L=d;for(e(a,p,c),g(a[d],M)>0&&e(a,p,d);E<L;){for(e(a,E,L),E++,L--;g(a[E],M)<0;)E++;for(;g(a[L],M)>0;)L--}g(a[p],M)===0?e(a,p,L):(L++,e(a,L,d)),L<=c&&(p=L+1),c<=L&&(d=L-1)}}function e(a,c,p){var d=a[c];a[c]=a[p],a[p]=d}function o(a,c){return a<c?-1:a>c?1:0}return r})});var Fm=ye((rG,Dm)=>{"use strict";Dm.exports=uf;Dm.exports.default=uf;var dD=_x();function uf(r,t){if(!(this instanceof uf))return new uf(r,t);this._maxEntries=Math.max(4,r||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}uf.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!up(r,t))return e;for(var a=[],c,p,d,g;t;){for(c=0,p=t.children.length;c<p;c++)d=t.children[c],g=t.leaf?o(d):d,up(r,g)&&(t.leaf?e.push(d):Om(r,g)?this._all(d,e):a.push(d));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!up(r,t))return!1;for(var o=[],a,c,p,d;t;){for(a=0,c=t.children.length;a<c;a++)if(p=t.children[a],d=t.leaf?e(p):p,up(r,d)){if(t.leaf||Om(r,d))return!0;o.push(p)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=sc([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],c=[],p,d,g,y;e||a.length;){if(e||(e=a.pop(),d=a[a.length-1],p=c.pop(),y=!0),e.leaf&&(g=gD(r,e.children,t),g!==-1))return e.children.splice(g,1),a.push(e),this._condense(a),this;!y&&!e.leaf&&Om(e,o)?(a.push(e),c.push(p),p=0,d=e,e=e.children[0]):d?(p++,e=d.children[p],y=!1):e=null}return this},toBBox:function(r){return r},compareMinX:xx,compareMinY:Ex,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,c=this._maxEntries,p;if(a<=c)return p=sc(r.slice(t,e+1)),oc(p,this.toBBox),p;o||(o=Math.ceil(Math.log(a)/Math.log(c)),c=Math.ceil(a/Math.pow(c,o-1))),p=sc([]),p.leaf=!1,p.height=o;var d=Math.ceil(a/c),g=d*Math.ceil(Math.sqrt(c)),y,_,w,x;for(wx(r,t,e,g,this.compareMinX),y=t;y<=e;y+=g)for(w=Math.min(y+g-1,e),wx(r,y,w,d,this.compareMinY),_=y;_<=w;_+=d)x=Math.min(_+d-1,w),p.children.push(this._build(r,_,x,o-1));return oc(p,this.toBBox),p},_chooseSubtree:function(r,t,e,o){for(var a,c,p,d,g,y,_,w;o.push(t),!(t.leaf||o.length-1===e);){for(_=w=1/0,a=0,c=t.children.length;a<c;a++)p=t.children[a],g=Nm(p),y=mD(r,p)-g,y<w?(w=y,_=g<_?g:_,d=p):y===w&&g<_&&(_=g,d=p);t=d||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),c=[],p=this._chooseSubtree(a,this.data,t,c);for(p.children.push(r),af(p,a);t>=0&&c[t].children.length>this._maxEntries;)this._split(c,t),t--;this._adjustParentBBoxes(a,c,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var c=this._chooseSplitIndex(e,a,o),p=sc(e.children.splice(c,e.children.length-c));p.height=e.height,p.leaf=e.leaf,oc(e,this.toBBox),oc(p,this.toBBox),t?r[t-1].children.push(p):this._splitRoot(e,p)},_splitRoot:function(r,t){this.data=sc([r,t]),this.data.height=r.height+1,this.data.leaf=!1,oc(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,c,p,d,g,y,_;for(g=y=1/0,o=t;o<=e-t;o++)a=sf(r,0,o,this.toBBox),c=sf(r,o,e,this.toBBox),p=yD(a,c),d=Nm(a)+Nm(c),p<g?(g=p,_=o,y=d<y?d:y):p===g&&d<y&&(y=d,_=o);return _},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:xx,a=r.leaf?this.compareMinY:Ex,c=this._allDistMargin(r,t,e,o),p=this._allDistMargin(r,t,e,a);c<p&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,c=sf(r,0,t,a),p=sf(r,e-t,e,a),d=ap(c)+ap(p),g,y;for(g=t;g<e-t;g++)y=r.children[g],af(c,r.leaf?a(y):y),d+=ap(c);for(g=e-t-1;g>=t;g--)y=r.children[g],af(p,r.leaf?a(y):y),d+=ap(p);return d},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)af(t[o],r)},_condense:function(r){for(var t=r.length-1,e;t>=0;t--)r[t].children.length===0?t>0?(e=r[t-1].children,e.splice(e.indexOf(r[t]),1)):this.clear():oc(r[t],this.toBBox)},_initFormat:function(r){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(r[0])),this.compareMinY=new Function("a","b",t.join(r[1])),this.toBBox=new Function("a","return {minX: a"+r[0]+", minY: a"+r[1]+", maxX: a"+r[2]+", maxY: a"+r[3]+"};")}};function gD(r,t,e){if(!e)return t.indexOf(r);for(var o=0;o<t.length;o++)if(e(r,t[o]))return o;return-1}function oc(r,t){sf(r,0,r.children.length,t,r)}function sf(r,t,e,o,a){a||(a=sc(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var c=t,p;c<e;c++)p=r.children[c],af(a,r.leaf?o(p):p);return a}function af(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function xx(r,t){return r.minX-t.minX}function Ex(r,t){return r.minY-t.minY}function Nm(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function ap(r){return r.maxX-r.minX+(r.maxY-r.minY)}function mD(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function yD(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),c=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,c-o)}function Om(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function up(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function sc(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function wx(r,t,e,o,a){for(var c=[t,e],p;c.length;)e=c.pop(),t=c.pop(),!(e-t<=o)&&(p=t+Math.ceil((e-t)/o/2)*o,dD(r,p,t,e,a),c.push(t,p,p,e))}});var Cx=ye((m5,Hm)=>{"use strict";Hm.exports=hp;Hm.exports.default=hp;function hp(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,c=bx(r,0,a,e,!0),p=[];if(!c||c.next===c.prev)return p;var d,g,y,_,w,x,T;if(o&&(c=AD(r,t,c,e)),r.length>80*e){d=y=r[0],g=_=r[1];for(var C=e;C<a;C+=e)w=r[C],x=r[C+1],w<d&&(d=w),x<g&&(g=x),w>y&&(y=w),x>_&&(_=x);T=Math.max(y-d,_-g),T=T!==0?32767/T:0}return ff(c,p,e,d,g,T,0),p}function bx(r,t,e,o,a){var c,p;if(a===Gm(r,t,e,o)>0)for(c=t;c<e;c+=o)p=Sx(c,r[c],r[c+1],p);else for(c=e-o;c>=t;c-=o)p=Sx(c,r[c],r[c+1],p);return p&&pp(p,p.next)&&(pf(p),p=p.next),p}function sl(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(pp(e,e.next)||Lr(e.prev,e,e.next)===0)){if(pf(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function ff(r,t,e,o,a,c,p){if(r){!p&&c&&LD(r,o,a,c);for(var d=r,g,y;r.prev!==r.next;){if(g=r.prev,y=r.next,c?SD(r,o,a,c):MD(r)){t.push(g.i/e|0),t.push(r.i/e|0),t.push(y.i/e|0),pf(r),r=y.next,d=y.next;continue}if(r=y,r===d){p?p===1?(r=bD(sl(r),t,e),ff(r,t,e,o,a,c,2)):p===2&&TD(r,t,e,o,a,c):ff(sl(r),t,e,o,a,c,1);break}}}}function MD(r){var t=r.prev,e=r,o=r.next;if(Lr(t,e,o)>=0)return!1;for(var a=t.x,c=e.x,p=o.x,d=t.y,g=e.y,y=o.y,_=a<c?a<p?a:p:c<p?c:p,w=d<g?d<y?d:y:g<y?g:y,x=a>c?a>p?a:p:c>p?c:p,T=d>g?d>y?d:y:g>y?g:y,C=o.next;C!==t;){if(C.x>=_&&C.x<=x&&C.y>=w&&C.y<=T&&lc(a,d,c,g,p,y,C.x,C.y)&&Lr(C.prev,C,C.next)>=0)return!1;C=C.next}return!0}function SD(r,t,e,o){var a=r.prev,c=r,p=r.next;if(Lr(a,c,p)>=0)return!1;for(var d=a.x,g=c.x,y=p.x,_=a.y,w=c.y,x=p.y,T=d<g?d<y?d:y:g<y?g:y,C=_<w?_<x?_:x:w<x?w:x,I=d>g?d>y?d:y:g>y?g:y,M=_>w?_>x?_:x:w>x?w:x,E=zm(T,C,t,e,o),L=zm(I,M,t,e,o),A=r.prevZ,z=r.nextZ;A&&A.z>=E&&z&&z.z<=L;){if(A.x>=T&&A.x<=I&&A.y>=C&&A.y<=M&&A!==a&&A!==p&&lc(d,_,g,w,y,x,A.x,A.y)&&Lr(A.prev,A,A.next)>=0||(A=A.prevZ,z.x>=T&&z.x<=I&&z.y>=C&&z.y<=M&&z!==a&&z!==p&&lc(d,_,g,w,y,x,z.x,z.y)&&Lr(z.prev,z,z.next)>=0))return!1;z=z.nextZ}for(;A&&A.z>=E;){if(A.x>=T&&A.x<=I&&A.y>=C&&A.y<=M&&A!==a&&A!==p&&lc(d,_,g,w,y,x,A.x,A.y)&&Lr(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;z&&z.z<=L;){if(z.x>=T&&z.x<=I&&z.y>=C&&z.y<=M&&z!==a&&z!==p&&lc(d,_,g,w,y,x,z.x,z.y)&&Lr(z.prev,z,z.next)>=0)return!1;z=z.nextZ}return!0}function bD(r,t,e){var o=r;do{var a=o.prev,c=o.next.next;!pp(a,c)&&Tx(a,o,o.next,c)&&hf(a,c)&&hf(c,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(c.i/e|0),pf(o),pf(o.next),o=r=c),o=o.next}while(o!==r);return sl(o)}function TD(r,t,e,o,a,c){var p=r;do{for(var d=p.next.next;d!==p.prev;){if(p.i!==d.i&&DD(p,d)){var g=Ax(p,d);p=sl(p,p.next),g=sl(g,g.next),ff(p,t,e,o,a,c,0),ff(g,t,e,o,a,c,0);return}d=d.next}p=p.next}while(p!==r)}function AD(r,t,e,o){var a=[],c,p,d,g,y;for(c=0,p=t.length;c<p;c++)d=t[c]*o,g=c<p-1?t[c+1]*o:r.length,y=bx(r,d,g,o,!1),y===y.next&&(y.steiner=!0),a.push(OD(y));for(a.sort(CD),c=0;c<a.length;c++)e=PD(a[c],e);return e}function CD(r,t){return r.x-t.x}function PD(r,t){var e=ID(r,t);if(!e)return t;var o=Ax(e,r);return sl(o,o.next),sl(e,e.next)}function ID(r,t){var e=t,o=r.x,a=r.y,c=-1/0,p;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var d=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=o&&d>c&&(c=d,p=e.x<e.next.x?e:e.next,d===o))return p}e=e.next}while(e!==t);if(!p)return null;var g=p,y=p.x,_=p.y,w=1/0,x;e=p;do o>=e.x&&e.x>=y&&o!==e.x&&lc(a<_?o:c,a,y,_,a<_?c:o,a,e.x,e.y)&&(x=Math.abs(a-e.y)/(o-e.x),hf(e,r)&&(x<w||x===w&&(e.x>p.x||e.x===p.x&&RD(p,e)))&&(p=e,w=x)),e=e.next;while(e!==g);return p}function RD(r,t){return Lr(r.prev,r,t.prev)<0&&Lr(t.next,r,r.next)<0}function LD(r,t,e,o){var a=r;do a.z===0&&(a.z=zm(a.x,a.y,t,e,o)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==r);a.prevZ.nextZ=null,a.prevZ=null,ND(a)}function ND(r){var t,e,o,a,c,p,d,g,y=1;do{for(e=r,r=null,c=null,p=0;e;){for(p++,o=e,d=0,t=0;t<y&&(d++,o=o.nextZ,!!o);t++);for(g=y;d>0||g>0&&o;)d!==0&&(g===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,d--):(a=o,o=o.nextZ,g--),c?c.nextZ=a:r=a,a.prevZ=c,c=a;e=o}c.nextZ=null,y*=2}while(p>1);return r}function zm(r,t,e,o,a){return r=(r-e)*a|0,t=(t-o)*a|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function OD(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function lc(r,t,e,o,a,c,p,d){return(a-p)*(t-d)>=(r-p)*(c-d)&&(r-p)*(o-d)>=(e-p)*(t-d)&&(e-p)*(c-d)>=(a-p)*(o-d)}function DD(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!FD(r,t)&&(hf(r,t)&&hf(t,r)&&UD(r,t)&&(Lr(r.prev,r,t.prev)||Lr(r,t.prev,t))||pp(r,t)&&Lr(r.prev,r,r.next)>0&&Lr(t.prev,t,t.next)>0)}function Lr(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function pp(r,t){return r.x===t.x&&r.y===t.y}function Tx(r,t,e,o){var a=fp(Lr(r,t,e)),c=fp(Lr(r,t,o)),p=fp(Lr(e,o,r)),d=fp(Lr(e,o,t));return!!(a!==c&&p!==d||a===0&&cp(r,e,t)||c===0&&cp(r,o,t)||p===0&&cp(e,r,o)||d===0&&cp(e,t,o))}function cp(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function fp(r){return r>0?1:r<0?-1:0}function FD(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Tx(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function hf(r,t){return Lr(r.prev,r,r.next)<0?Lr(r,t,r.next)>=0&&Lr(r,r.prev,t)>=0:Lr(r,t,r.prev)<0||Lr(r,r.next,t)<0}function UD(r,t){var e=r,o=!1,a=(r.x+t.x)/2,c=(r.y+t.y)/2;do e.y>c!=e.next.y>c&&e.next.y!==e.y&&a<(e.next.x-e.x)*(c-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function Ax(r,t){var e=new km(r.i,r.x,r.y),o=new km(t.i,t.x,t.y),a=r.next,c=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,c.next=o,o.prev=c,o}function Sx(r,t,e,o){var a=new km(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function pf(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function km(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}hp.deviation=function(r,t,e,o){var a=t&&t.length,c=a?t[0]*e:r.length,p=Math.abs(Gm(r,0,c,e));if(a)for(var d=0,g=t.length;d<g;d++){var y=t[d]*e,_=d<g-1?t[d+1]*e:r.length;p-=Math.abs(Gm(r,y,_,e))}var w=0;for(d=0;d<o.length;d+=3){var x=o[d]*e,T=o[d+1]*e,C=o[d+2]*e;w+=Math.abs((r[x]-r[C])*(r[T+1]-r[x+1])-(r[x]-r[T])*(r[C+1]-r[x+1]))}return p===0&&w===0?0:Math.abs((w-p)/p)};function Gm(r,t,e,o){for(var a=0,c=t,p=e-o;c<e;c+=o)a+=(r[p]-r[c])*(r[c+1]+r[p+1]),p=c;return a}hp.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var c=0;c<r[a].length;c++)for(var p=0;p<t;p++)e.vertices.push(r[a][c][p]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var Ym=ye(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.earthRadius=63710088e-1;Ie.factors={centimeters:Ie.earthRadius*100,centimetres:Ie.earthRadius*100,degrees:Ie.earthRadius/111325,feet:Ie.earthRadius*3.28084,inches:Ie.earthRadius*39.37,kilometers:Ie.earthRadius/1e3,kilometres:Ie.earthRadius/1e3,meters:Ie.earthRadius,metres:Ie.earthRadius,miles:Ie.earthRadius/1609.344,millimeters:Ie.earthRadius*1e3,millimetres:Ie.earthRadius*1e3,nauticalmiles:Ie.earthRadius/1852,radians:1,yards:Ie.earthRadius*1.0936};Ie.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/Ie.earthRadius,yards:1.0936133};Ie.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 Au(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}Ie.feature=Au;function zD(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Vm(t).geometry;case"LineString":return qm(t).geometry;case"Polygon":return Wm(t).geometry;case"MultiPoint":return Ix(t).geometry;case"MultiLineString":return Px(t).geometry;case"MultiPolygon":return Rx(t).geometry;default:throw new Error(r+" is invalid")}}Ie.geometry=zD;function Vm(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(!dp(r[0])||!dp(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Au(o,t,e)}Ie.point=Vm;function kD(r,t,e){return e===void 0&&(e={}),gp(r.map(function(o){return Vm(o,t)}),e)}Ie.points=kD;function Wm(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var c=a[o];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var p=0;p<c[c.length-1].length;p++)if(c[c.length-1][p]!==c[0][p])throw new Error("First and last Position are not equivalent.")}var d={type:"Polygon",coordinates:r};return Au(d,t,e)}Ie.polygon=Wm;function GD(r,t,e){return e===void 0&&(e={}),gp(r.map(function(o){return Wm(o,t)}),e)}Ie.polygons=GD;function qm(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 Au(o,t,e)}Ie.lineString=qm;function HD(r,t,e){return e===void 0&&(e={}),gp(r.map(function(o){return qm(o,t)}),e)}Ie.lineStrings=HD;function gp(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}Ie.featureCollection=gp;function Px(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Au(o,t,e)}Ie.multiLineString=Px;function Ix(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Au(o,t,e)}Ie.multiPoint=Ix;function Rx(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Au(o,t,e)}Ie.multiPolygon=Rx;function VD(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Au(o,t,e)}Ie.geometryCollection=VD;function WD(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}Ie.round=WD;function Lx(r,t){t===void 0&&(t="kilometers");var e=Ie.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}Ie.radiansToLength=Lx;function Xm(r,t){t===void 0&&(t="kilometers");var e=Ie.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}Ie.lengthToRadians=Xm;function qD(r,t){return Nx(Xm(r,t))}Ie.lengthToDegrees=qD;function XD(r){var t=r%360;return t<0&&(t+=360),t}Ie.bearingToAzimuth=XD;function Nx(r){var t=r%(2*Math.PI);return t*180/Math.PI}Ie.radiansToDegrees=Nx;function YD(r){var t=r%360;return t*Math.PI/180}Ie.degreesToRadians=YD;function $D(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return Lx(Xm(r,t),e)}Ie.convertLength=$D;function ZD(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=Ie.areaFactors[t];if(!o)throw new Error("invalid original units");var a=Ie.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}Ie.convertArea=ZD;function dp(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}Ie.isNumber=dp;function JD(r){return!!r&&r.constructor===Object}Ie.isObject=JD;function KD(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!dp(t))throw new Error("bbox must only contain numbers")})}Ie.validateBBox=KD;function QD(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}Ie.validateId=QD});var Zm=ye(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});var ji=Ym();function df(r,t,e){if(r!==null)for(var o,a,c,p,d,g,y,_=0,w=0,x,T=r.type,C=T==="FeatureCollection",I=T==="Feature",M=C?r.features.length:1,E=0;E<M;E++){y=C?r.features[E].geometry:I?r.geometry:r,x=y?y.type==="GeometryCollection":!1,d=x?y.geometries.length:1;for(var L=0;L<d;L++){var A=0,z=0;if(p=x?y.geometries[L]:y,p!==null){g=p.coordinates;var G=p.type;switch(_=e&&(G==="Polygon"||G==="MultiPolygon")?1:0,G){case null:break;case"Point":if(t(g,w,E,A,z)===!1)return!1;w++,A++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],w,E,A,z)===!1)return!1;w++,G==="MultiPoint"&&A++}G==="LineString"&&A++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(a=0;a<g[o].length-_;a++){if(t(g[o][a],w,E,A,z)===!1)return!1;w++}G==="MultiLineString"&&A++,G==="Polygon"&&z++}G==="Polygon"&&A++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(z=0,a=0;a<g[o].length;a++){for(c=0;c<g[o][a].length-_;c++){if(t(g[o][a][c],w,E,A,z)===!1)return!1;w++}z++}A++}break;case"GeometryCollection":for(o=0;o<p.geometries.length;o++)if(df(p.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function jD(r,t,e,o){var a=e;return df(r,function(c,p,d,g,y){p===0&&e===void 0?a=c:a=t(a,c,p,d,g,y)},o),a}function Ox(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}function t3(r,t,e){var o=e;return Ox(r,function(a,c){c===0&&e===void 0?o=a:o=t(o,a,c)}),o}function Dx(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function e3(r,t,e){var o=e;return Dx(r,function(a,c){c===0&&e===void 0?o=a:o=t(o,a,c)}),o}function n3(r){var t=[];return df(r,function(e){t.push(e)}),t}function $m(r,t){var e,o,a,c,p,d,g,y,_,w,x=0,T=r.type==="FeatureCollection",C=r.type==="Feature",I=T?r.features.length:1;for(e=0;e<I;e++){for(d=T?r.features[e].geometry:C?r.geometry:r,y=T?r.features[e].properties:C?r.properties:{},_=T?r.features[e].bbox:C?r.bbox:void 0,w=T?r.features[e].id:C?r.id:void 0,g=d?d.type==="GeometryCollection":!1,p=g?d.geometries.length:1,a=0;a<p;a++){if(c=g?d.geometries[a]:d,c===null){if(t(null,x,y,_,w)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(c,x,y,_,w)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<c.geometries.length;o++)if(t(c.geometries[o],x,y,_,w)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}x++}}function r3(r,t,e){var o=e;return $m(r,function(a,c,p,d,g){c===0&&e===void 0?o=a:o=t(o,a,c,p,d,g)}),o}function mp(r,t){$m(r,function(e,o,a,c,p){var d=e===null?null:e.type;switch(d){case null:case"Point":case"LineString":case"Polygon":return t(ji.feature(e,a,{bbox:c,id:p}),o,0)===!1?!1:void 0}var g;switch(d){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var y=0;y<e.coordinates.length;y++){var _=e.coordinates[y],w={type:g,coordinates:_};if(t(ji.feature(w,a),o,y)===!1)return!1}})}function i3(r,t,e){var o=e;return mp(r,function(a,c,p){c===0&&p===0&&e===void 0?o=a:o=t(o,a,c,p)}),o}function Fx(r,t){mp(r,function(e,o,a){var c=0;if(e.geometry){var p=e.geometry.type;if(!(p==="Point"||p==="MultiPoint")){var d,g=0,y=0,_=0;if(df(e,function(w,x,T,C,I){if(d===void 0||o>g||C>y||I>_){d=w,g=o,y=C,_=I,c=0;return}var M=ji.lineString([d,w],e.properties);if(t(M,o,a,I,c)===!1)return!1;c++,d=w})===!1)return!1}}})}function o3(r,t,e){var o=e,a=!1;return Fx(r,function(c,p,d,g,y){a===!1&&e===void 0?o=c:o=t(o,c,p,d,g,y),a=!0}),o}function Ux(r,t){if(!r)throw new Error("geojson is required");mp(r,function(e,o,a){if(e.geometry!==null){var c=e.geometry.type,p=e.geometry.coordinates;switch(c){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var d=0;d<p.length;d++)if(t(ji.lineString(p[d],e.properties),o,a,d)===!1)return!1;break}}})}function s3(r,t,e){var o=e;return Ux(r,function(a,c,p,d){c===0&&e===void 0?o=a:o=t(o,a,c,p,d)}),o}function a3(r,t){if(t=t||{},!ji.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,c=t.segmentIndex||0,p=t.properties,d;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),p=p||r.features[e].properties,d=r.features[e].geometry;break;case"Feature":p=p||r.properties,d=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":d=r;break;default:throw new Error("geojson is invalid")}if(d===null)return null;var g=d.coordinates;switch(d.type){case"Point":case"MultiPoint":return null;case"LineString":return c<0&&(c=g.length+c-1),ji.lineString([g[c],g[c+1]],p,t);case"Polygon":return a<0&&(a=g.length+a),c<0&&(c=g[a].length+c-1),ji.lineString([g[a][c],g[a][c+1]],p,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c-1),ji.lineString([g[o][c],g[o][c+1]],p,t);case"MultiPolygon":return o<0&&(o=g.length+o),a<0&&(a=g[o].length+a),c<0&&(c=g[o][a].length-c-1),ji.lineString([g[o][a][c],g[o][a][c+1]],p,t)}throw new Error("geojson is invalid")}function u3(r,t){if(t=t||{},!ji.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,c=t.coordIndex||0,p=t.properties,d;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),p=p||r.features[e].properties,d=r.features[e].geometry;break;case"Feature":p=p||r.properties,d=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":d=r;break;default:throw new Error("geojson is invalid")}if(d===null)return null;var g=d.coordinates;switch(d.type){case"Point":return ji.point(g,p,t);case"MultiPoint":return o<0&&(o=g.length+o),ji.point(g[o],p,t);case"LineString":return c<0&&(c=g.length+c),ji.point(g[c],p,t);case"Polygon":return a<0&&(a=g.length+a),c<0&&(c=g[a].length+c),ji.point(g[a][c],p,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c),ji.point(g[o][c],p,t);case"MultiPolygon":return o<0&&(o=g.length+o),a<0&&(a=g[o].length+a),c<0&&(c=g[o][a].length-c),ji.point(g[o][a][c],p,t)}throw new Error("geojson is invalid")}li.coordAll=n3;li.coordEach=df;li.coordReduce=jD;li.featureEach=Dx;li.featureReduce=e3;li.findPoint=u3;li.findSegment=a3;li.flattenEach=mp;li.flattenReduce=i3;li.geomEach=$m;li.geomReduce=r3;li.lineEach=Ux;li.lineReduce=s3;li.propEach=Ox;li.propReduce=t3;li.segmentEach=Fx;li.segmentReduce=o3});var Bx=ye(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});var l3=Zm();function Jm(r){var t=[1/0,1/0,-1/0,-1/0];return l3.coordEach(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Jm.default=Jm;Km.default=Jm});var yp=ye((L5,Qm)=>{var ha=Mm(),kx=Ym(),Gx=Zm(),cc=Bx().default,c3=Gx.featureEach,I5=Gx.coordEach,R5=kx.polygon,zx=kx.featureCollection;function Hx(r){var t=new ha(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:cc(e),ha.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:cc(a),o.push(a)}):c3(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:cc(a),o.push(a)}),ha.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:cc(e),ha.prototype.remove.call(this,e,o)},t.clear=function(){return ha.prototype.clear.call(this)},t.search=function(e){var o=ha.prototype.search.call(this,this.toBBox(e));return zx(o)},t.collides=function(e){return ha.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=ha.prototype.all.call(this);return zx(e)},t.toJSON=function(){return ha.prototype.toJSON.call(this)},t.fromJSON=function(e){return ha.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=cc(e);else if(e.type==="FeatureCollection")o=cc(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Qm.exports=Hx;Qm.exports.default=Hx});var i0=ye((GV,Qx)=>{"use strict";var Kx=Object.prototype.toString;Qx.exports=function(t){var e=Kx.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Kx.call(t.callee)==="[object Function]"),o}});var aE=ye((HV,sE)=>{"use strict";var oE;Object.keys||(yf=Object.prototype.hasOwnProperty,o0=Object.prototype.toString,jx=i0(),s0=Object.prototype.propertyIsEnumerable,tE=!s0.call({toString:null},"toString"),eE=s0.call(function(){},"prototype"),vf=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],wp=function(r){var t=r.constructor;return t&&t.prototype===r},nE={$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},rE=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!nE["$"+r]&&yf.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{wp(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),iE=function(r){if(typeof window=="undefined"||!rE)return wp(r);try{return wp(r)}catch(t){return!1}},oE=function(t){var e=t!==null&&typeof t=="object",o=o0.call(t)==="[object Function]",a=jx(t),c=e&&o0.call(t)==="[object String]",p=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var d=eE&&o;if(c&&t.length>0&&!yf.call(t,0))for(var g=0;g<t.length;++g)p.push(String(g));if(a&&t.length>0)for(var y=0;y<t.length;++y)p.push(String(y));else for(var _ in t)!(d&&_==="prototype")&&yf.call(t,_)&&p.push(String(_));if(tE)for(var w=iE(t),x=0;x<vf.length;++x)!(w&&vf[x]==="constructor")&&yf.call(t,vf[x])&&p.push(vf[x]);return p});var yf,o0,jx,s0,tE,eE,vf,wp,nE,rE,iE;sE.exports=oE});var a0=ye((VV,cE)=>{"use strict";var x3=Array.prototype.slice,E3=i0(),uE=Object.keys,Mp=uE?function(t){return uE(t)}:aE(),lE=Object.keys;Mp.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 E3(o)?lE(x3.call(o)):lE(o)})}else Object.keys=Mp;return Object.keys||Mp};cE.exports=Mp});var u0=ye((WV,fE)=>{"use strict";fE.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(e 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 c=Object.getOwnPropertySymbols(t);if(c.length!==1||c[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var p=Object.getOwnPropertyDescriptor(t,e);if(p.value!==a||p.enumerable!==!0)return!1}return!0}});var Sp=ye((qV,hE)=>{"use strict";var w3=u0();hE.exports=function(){return w3()&&!!Symbol.toStringTag}});var gE=ye((XV,dE)=>{"use strict";var pE=typeof Symbol!="undefined"&&Symbol,M3=u0();dE.exports=function(){return typeof pE!="function"||typeof Symbol!="function"||typeof pE("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:M3()}});var vE=ye((YV,yE)=>{"use strict";var mE={foo:{}},S3=Object;yE.exports=function(){return{__proto__:mE}.foo===mE.foo&&!({__proto__:null}instanceof S3)}});var EE=ye(($V,xE)=>{"use strict";var b3="Function.prototype.bind called on incompatible ",T3=Object.prototype.toString,A3=Math.max,C3="[object Function]",_E=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var c=0;c<e.length;c+=1)o[c+t.length]=e[c];return o},P3=function(t,e){for(var o=[],a=e||0,c=0;a<t.length;a+=1,c+=1)o[c]=t[a];return o},I3=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};xE.exports=function(t){var e=this;if(typeof e!="function"||T3.apply(e)!==C3)throw new TypeError(b3+e);for(var o=P3(arguments,1),a,c=function(){if(this instanceof a){var _=e.apply(this,_E(o,arguments));return Object(_)===_?_:this}return e.apply(t,_E(o,arguments))},p=A3(0,e.length-o.length),d=[],g=0;g<p;g++)d[g]="$"+g;if(a=Function("binder","return function ("+I3(d,",")+"){ return binder.apply(this,arguments); }")(c),e.prototype){var y=function(){};y.prototype=e.prototype,a.prototype=new y,y.prototype=null}return a}});var bp=ye((ZV,wE)=>{"use strict";var R3=EE();wE.exports=Function.prototype.bind||R3});var SE=ye((JV,ME)=>{"use strict";var L3=Function.prototype.call,N3=Object.prototype.hasOwnProperty,O3=bp();ME.exports=O3.call(L3,N3)});var ll=ye((KV,PE)=>{"use strict";var Bn,dc=SyntaxError,CE=Function,pc=TypeError,l0=function(r){try{return CE('"use strict"; return ('+r+").constructor;")()}catch(t){}},al=Object.getOwnPropertyDescriptor;if(al)try{al({},"")}catch(r){al=null}var c0=function(){throw new pc},D3=al?function(){try{return arguments.callee,c0}catch(r){try{return al(arguments,"callee").get}catch(t){return c0}}}():c0,fc=gE()(),F3=vE()(),Ti=Object.getPrototypeOf||(F3?function(r){return r.__proto__}:null),hc={},U3=typeof Uint8Array=="undefined"||!Ti?Bn:Ti(Uint8Array),ul={"%AggregateError%":typeof AggregateError=="undefined"?Bn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Bn:ArrayBuffer,"%ArrayIteratorPrototype%":fc&&Ti?Ti([][Symbol.iterator]()):Bn,"%AsyncFromSyncIteratorPrototype%":Bn,"%AsyncFunction%":hc,"%AsyncGenerator%":hc,"%AsyncGeneratorFunction%":hc,"%AsyncIteratorPrototype%":hc,"%Atomics%":typeof Atomics=="undefined"?Bn:Atomics,"%BigInt%":typeof BigInt=="undefined"?Bn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Bn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Bn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Bn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array=="undefined"?Bn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Bn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Bn:FinalizationRegistry,"%Function%":CE,"%GeneratorFunction%":hc,"%Int8Array%":typeof Int8Array=="undefined"?Bn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Bn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Bn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":fc&&Ti?Ti(Ti([][Symbol.iterator]())):Bn,"%JSON%":typeof JSON=="object"?JSON:Bn,"%Map%":typeof Map=="undefined"?Bn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!fc||!Ti?Bn:Ti(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Bn:Promise,"%Proxy%":typeof Proxy=="undefined"?Bn:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect=="undefined"?Bn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Bn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!fc||!Ti?Bn:Ti(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Bn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":fc&&Ti?Ti(""[Symbol.iterator]()):Bn,"%Symbol%":fc?Symbol:Bn,"%SyntaxError%":dc,"%ThrowTypeError%":D3,"%TypedArray%":U3,"%TypeError%":pc,"%Uint8Array%":typeof Uint8Array=="undefined"?Bn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Bn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Bn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Bn:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap=="undefined"?Bn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Bn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Bn:WeakSet};if(Ti)try{null.error}catch(r){bE=Ti(Ti(r)),ul["%Error.prototype%"]=bE}var bE,B3=function r(t){var e;if(t==="%AsyncFunction%")e=l0("async function () {}");else if(t==="%GeneratorFunction%")e=l0("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=l0("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&Ti&&(e=Ti(a.prototype))}return ul[t]=e,e},TE={"%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"]},_f=bp(),Tp=SE(),z3=_f.call(Function.call,Array.prototype.concat),k3=_f.call(Function.apply,Array.prototype.splice),AE=_f.call(Function.call,String.prototype.replace),Ap=_f.call(Function.call,String.prototype.slice),G3=_f.call(Function.call,RegExp.prototype.exec),H3=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,V3=/\\\\(\\\\)?/g,W3=function(t){var e=Ap(t,0,1),o=Ap(t,-1);if(e==="%"&&o!=="%")throw new dc("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new dc("invalid intrinsic syntax, expected opening \`%\`");var a=[];return AE(t,H3,function(c,p,d,g){a[a.length]=d?AE(g,V3,"$1"):p||c}),a},q3=function(t,e){var o=t,a;if(Tp(TE,o)&&(a=TE[o],o="%"+a[0]+"%"),Tp(ul,o)){var c=ul[o];if(c===hc&&(c=B3(o)),typeof c=="undefined"&&!e)throw new pc("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:c}}throw new dc("intrinsic "+t+" does not exist!")};PE.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new pc("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new pc('"allowMissing" argument must be a boolean');if(G3(/^%?[^%]*%?$/,t)===null)throw new dc("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=W3(t),a=o.length>0?o[0]:"",c=q3("%"+a+"%",e),p=c.name,d=c.value,g=!1,y=c.alias;y&&(a=y[0],k3(o,z3([0,1],y)));for(var _=1,w=!0;_<o.length;_+=1){var x=o[_],T=Ap(x,0,1),C=Ap(x,-1);if((T==='"'||T==="'"||T==="\`"||C==='"'||C==="'"||C==="\`")&&T!==C)throw new dc("property names with quotes must have matching quotes");if((x==="constructor"||!w)&&(g=!0),a+="."+x,p="%"+a+"%",Tp(ul,p))d=ul[p];else if(d!=null){if(!(x in d)){if(!e)throw new pc("base intrinsic for "+t+" exists, but the property is not available.");return}if(al&&_+1>=o.length){var I=al(d,x);w=!!I,w&&"get"in I&&!("originalValue"in I.get)?d=I.get:d=d[x]}else w=Tp(d,x),d=d[x];w&&!g&&(ul[p]=d)}}return d}});var xf=ye((QV,IE)=>{"use strict";var X3=ll(),f0=X3("%Object.defineProperty%",!0),h0=function(){if(f0)try{return f0({},"a",{value:1}),!0}catch(t){return!1}return!1};h0.hasArrayLengthDefineBug=function(){if(!h0())return null;try{return f0([],"length",{value:1}).length!==1}catch(t){return!0}};IE.exports=h0});var p0=ye((jV,RE)=>{"use strict";var Y3=ll(),Cp=Y3("%Object.getOwnPropertyDescriptor%",!0);if(Cp)try{Cp([],"length")}catch(r){Cp=null}RE.exports=Cp});var Pp=ye((t6,NE)=>{"use strict";var $3=xf()(),d0=ll(),Ef=$3&&d0("%Object.defineProperty%",!0);if(Ef)try{Ef({},"a",{value:1})}catch(r){Ef=!1}var Z3=d0("%SyntaxError%"),gc=d0("%TypeError%"),LE=p0();NE.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new gc("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new gc("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new gc("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new gc("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new gc("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new gc("\`loose\`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,d=arguments.length>6?arguments[6]:!1,g=!!LE&&LE(t,e);if(Ef)Ef(t,e,{configurable:p===null&&g?g.configurable:!p,enumerable:a===null&&g?g.enumerable:!a,value:o,writable:c===null&&g?g.writable:!c});else if(d||!a&&!c&&!p)t[e]=o;else throw new Z3("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var zE=ye((e6,BE)=>{"use strict";var UE=ll(),OE=Pp(),J3=xf()(),DE=p0(),FE=UE("%TypeError%"),K3=UE("%Math.floor%");BE.exports=function(t,e){if(typeof t!="function")throw new FE("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||K3(e)!==e)throw new FE("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,c=!0;if("length"in t&&DE){var p=DE(t,"length");p&&!p.configurable&&(a=!1),p&&!p.writable&&(c=!1)}return(a||c||!o)&&(J3?OE(t,"length",e,!0,!0):OE(t,"length",e)),t}});var Rp=ye((n6,Ip)=>{"use strict";var g0=bp(),mc=ll(),Q3=zE(),j3=mc("%TypeError%"),GE=mc("%Function.prototype.apply%"),HE=mc("%Function.prototype.call%"),VE=mc("%Reflect.apply%",!0)||g0.call(HE,GE),wf=mc("%Object.defineProperty%",!0),tF=mc("%Math.max%");if(wf)try{wf({},"a",{value:1})}catch(r){wf=null}Ip.exports=function(t){if(typeof t!="function")throw new j3("a function is required");var e=VE(g0,HE,arguments);return Q3(e,1+tF(0,t.length-(arguments.length-1)),!0)};var kE=function(){return VE(g0,GE,arguments)};wf?wf(Ip.exports,"apply",{value:kE}):Ip.exports.apply=kE});var m0=ye((r6,XE)=>{"use strict";var WE=ll(),qE=Rp(),eF=qE(WE("String.prototype.indexOf"));XE.exports=function(t,e){var o=WE(t,!!e);return typeof o=="function"&&eF(t,".prototype.")>-1?qE(o):o}});var ZE=ye((i6,$E)=>{"use strict";var nF=Sp()(),rF=m0(),y0=rF("Object.prototype.toString"),Lp=function(t){return nF&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:y0(t)==="[object Arguments]"},YE=function(t){return Lp(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&y0(t)!=="[object Array]"&&y0(t.callee)==="[object Function]"},iF=function(){return Lp(arguments)}();Lp.isLegacyArguments=YE;$E.exports=iF?Lp:YE});var yc=ye((o6,jE)=>{"use strict";var oF=a0(),sF=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",aF=Object.prototype.toString,uF=Array.prototype.concat,JE=Pp(),lF=function(r){return typeof r=="function"&&aF.call(r)==="[object Function]"},KE=xf()(),cF=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!lF(o)||!o())return}KE?JE(r,t,e,!0):JE(r,t,e)},QE=function(r,t){var e=arguments.length>2?arguments[2]:{},o=oF(t);sF&&(o=uF.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)cF(r,o[a],t[o[a]],e[o[a]])};QE.supportsDescriptors=!!KE;jE.exports=QE});var v0=ye((s6,ew)=>{"use strict";var tw=function(r){return r!==r};ew.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||tw(t)&&tw(e))}});var _0=ye((a6,nw)=>{"use strict";var fF=v0();nw.exports=function(){return typeof Object.is=="function"?Object.is:fF}});var iw=ye((u6,rw)=>{"use strict";var hF=_0(),pF=yc();rw.exports=function(){var t=hF();return pF(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var uw=ye((l6,aw)=>{"use strict";var dF=yc(),gF=Rp(),mF=v0(),ow=_0(),yF=iw(),sw=gF(ow(),Object);dF(sw,{getPolyfill:ow,implementation:mF,shim:yF});aw.exports=sw});var pw=ye((c6,hw)=>{"use strict";var x0=m0(),lw=Sp()(),cw,fw,E0,w0;lw&&(cw=x0("Object.prototype.hasOwnProperty"),fw=x0("RegExp.prototype.exec"),E0={},Np=function(){throw E0},w0={toString:Np,valueOf:Np},typeof Symbol.toPrimitive=="symbol"&&(w0[Symbol.toPrimitive]=Np));var Np,vF=x0("Object.prototype.toString"),_F=Object.getOwnPropertyDescriptor,xF="[object RegExp]";hw.exports=lw?function(t){if(!t||typeof t!="object")return!1;var e=_F(t,"lastIndex"),o=e&&cw(e,"value");if(!o)return!1;try{fw(t,w0)}catch(a){return a===E0}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:vF(t)===xF}});var gw=ye((f6,dw)=>{"use strict";var Sf=function(){return typeof function(){}.name=="string"},Mf=Object.getOwnPropertyDescriptor;if(Mf)try{Mf([],"length")}catch(r){Mf=null}Sf.functionsHaveConfigurableNames=function(){if(!Sf()||!Mf)return!1;var t=Mf(function(){},"name");return!!t&&!!t.configurable};var EF=Function.prototype.bind;Sf.boundFunctionsHaveNames=function(){return Sf()&&typeof EF=="function"&&function(){}.bind().name!==""};dw.exports=Sf});var vw=ye((h6,yw)=>{"use strict";var mw=Pp(),wF=xf()(),MF=gw().functionsHaveConfigurableNames(),SF=TypeError;yw.exports=function(t,e){if(typeof t!="function")throw new SF("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||MF)&&(wF?mw(t,"name",e,!0,!0):mw(t,"name",e)),t}});var M0=ye((p6,_w)=>{"use strict";var bF=vw(),TF=Object,AF=TypeError;_w.exports=bF(function(){if(this!=null&&this!==TF(this))throw new AF("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 S0=ye((d6,xw)=>{"use strict";var CF=M0(),PF=yc().supportsDescriptors,IF=Object.getOwnPropertyDescriptor;xw.exports=function(){if(PF&&/a/mig.flags==="gim"){var t=IF(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),e==="dy")return t.get}}return CF}});var Mw=ye((g6,ww)=>{"use strict";var RF=yc().supportsDescriptors,LF=S0(),NF=Object.getOwnPropertyDescriptor,OF=Object.defineProperty,DF=TypeError,Ew=Object.getPrototypeOf,FF=/a/;ww.exports=function(){if(!RF||!Ew)throw new DF("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=LF(),e=Ew(FF),o=NF(e,"flags");return(!o||o.get!==t)&&OF(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Aw=ye((m6,Tw)=>{"use strict";var UF=yc(),BF=Rp(),zF=M0(),Sw=S0(),kF=Mw(),bw=BF(Sw());UF(bw,{getPolyfill:Sw,implementation:zF,shim:kF});Tw.exports=bw});var Pw=ye((y6,Cw)=>{"use strict";var GF=Date.prototype.getDay,HF=function(t){try{return GF.call(t),!0}catch(e){return!1}},VF=Object.prototype.toString,WF="[object Date]",qF=Sp()();Cw.exports=function(t){return typeof t!="object"||t===null?!1:qF?HF(t):VF.call(t)===WF}});var b0=ye((v6,kw)=>{var Iw=a0(),Rw=ZE(),Lw=uw(),Nw=pw(),Ow=Aw(),Dw=Pw(),Fw=Date.prototype.getTime;function zw(r,t,e){var o=e||{};return(o.strict?Lw(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?Lw(r,t):r==t:XF(r,t,o)}function Uw(r){return r==null}function Bw(r){return!(!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number")}function XF(r,t,e){var o,a;if(typeof r!=typeof t||Uw(r)||Uw(t)||r.prototype!==t.prototype||Rw(r)!==Rw(t))return!1;var c=Nw(r),p=Nw(t);if(c!==p)return!1;if(c||p)return r.source===t.source&&Ow(r)===Ow(t);if(Dw(r)&&Dw(t))return Fw.call(r)===Fw.call(t);var d=Bw(r),g=Bw(t);if(d!==g)return!1;if(d||g){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var y=Iw(r),_=Iw(t)}catch(w){return!1}if(y.length!==_.length)return!1;for(y.sort(),_.sort(),o=y.length-1;o>=0;o--)if(y[o]!=_[o])return!1;for(o=y.length-1;o>=0;o--)if(a=y[o],!zw(r[a],t[a],e))return!1;return!0}kw.exports=zw});var U0=ye((SW,Yw)=>{var FU=b0(),pa=function(r){this.precision=r&&r.precision?r.precision:17,this.direction=r&&r.direction?r.direction:!1,this.pseudoNode=r&&r.pseudoNode?r.pseudoNode:!1,this.objectComparator=r&&r.objectComparator?r.objectComparator:UU};pa.prototype.compare=function(r,t){if(r.type!==t.type||!Xw(r,t))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,t.coordinates);case"LineString":return this.compareLine(r.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(r,t);case"Feature":return this.compareFeature(r,t);default:if(r.type.indexOf("Multi")===0){var e=this,o=qw(r),a=qw(t);return o.every(function(c){return this.some(function(p){return e.compare(c,p)})},a)}}return!1};function qw(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function Xw(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}pa.prototype.compareCoord=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e++)if(r[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};pa.prototype.compareLine=function(r,t,e,o){if(!Xw(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),c=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],c[0])&&(c=this.fixStartIndex(c,a),!c))){var p=this.compareCoord(a[e],c[e]);return this.direction||p?this.comparePath(a,c):this.compareCoord(a[e],c[c.length-(1+e)])?this.comparePath(a.slice().reverse(),c):!1}};pa.prototype.fixStartIndex=function(r,t){for(var e,o=-1,a=0;a<r.length;a++)if(this.compareCoord(r[a],t[0])){o=a;break}return o>=0&&(e=[].concat(r.slice(o,r.length),r.slice(1,o+1))),e};pa.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};pa.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(c){return this.some(function(p){return a.compareLine(c,p,1,!0)})},o)}else return!1};pa.prototype.compareFeature=function(r,t){return r.id!==t.id||!this.objectComparator(r.properties,t.properties)||!this.compareBBox(r,t)?!1:this.compare(r.geometry,t.geometry)};pa.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};pa.prototype.removePseudo=function(r){return r};function UU(r,t){return FU(r,t,{strict:!0})}Yw.exports=pa});var $w=ye((FW,Fp)=>{function Pu(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}Pu.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var c=this._regionQuery(a);if(c.length<this.minPts)this.noise.push(a);else{var p=this.clusters.length;this.clusters.push([]),this._addToCluster(a,p),this._expandCluster(p,c)}}return this.clusters};Pu.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Pu.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};Pu.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};Pu.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};Pu.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};Pu.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof Fp!="undefined"&&Fp.exports&&(Fp.exports=Pu)});var Zw=ye((UW,Up)=>{function Iu(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}Iu.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};Iu.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var c=0;c<this.k;c++){for(var p=new Array(_),d=0,g=0;g<_;g++)p[g]=0;for(var y=0;y<e;y++){var _=this.dataset[y].length;if(c===this.assignments[y]){for(var g=0;g<_;g++)p[g]+=this.dataset[y][g];d++}}if(d>0){for(var g=0;g<_;g++)p[g]/=d;this.centroids[c]=p}else this.centroids[c]=this.randomCentroid(),a=!0}}return this.getClusters()};Iu.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};Iu.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};Iu.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};Iu.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,c=t.length,p,d=0;d<c;d++)p=e(r,t[d]),p<o&&(o=p,a=d);return a};Iu.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof Up!="undefined"&&Up.exports&&(Up.exports=Iu)});var B0=ye((BW,Bp)=>{function da(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}da.prototype.insert=function(r,t){for(var e=this._queue.length,o=e;o--;){var a=this._priorities[o];this._sorting==="desc"?t>a&&(e=o):t<a&&(e=o)}this._insertAt(r,t,e)};da.prototype.remove=function(r){for(var t=this._queue.length;t--;){var e=this._queue[t];if(r===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};da.prototype.forEach=function(r){this._queue.forEach(r)};da.prototype.getElements=function(){return this._queue};da.prototype.getElementPriority=function(r){return this._priorities[r]};da.prototype.getPriorities=function(){return this._priorities};da.prototype.getElementsWithPriorities=function(){for(var r=[],t=0,e=this._queue.length;t<e;t++)r.push([this._queue[t],this._priorities[t]]);return r};da.prototype._init=function(r,t,e){if(r&&t){if(this._queue=[],this._priorities=[],r.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<r.length;o++)this.insert(r[o],t[o])}e&&(this._sorting=e)};da.prototype._insertAt=function(r,t,e){this._queue.length===e?(this._queue.push(r),this._priorities.push(t)):(this._queue.splice(e,0,r),this._priorities.splice(e,0,t))};typeof Bp!="undefined"&&Bp.exports&&(Bp.exports=da)});var Kw=ye((zW,_c)=>{typeof _c!="undefined"&&_c.exports&&(Jw=B0());var Jw;function Za(r,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,t,e,o)}Za.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,c=this.dataset.length;a<c;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var p=this.clusters.length-1;this._orderedList.push(a);var d=new Jw(null,null,"asc"),g=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,g,d),this._expandCluster(p,d))}return this.clusters};Za.prototype.getReachabilityPlot=function(){for(var r=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],a=this._reachability[o];r.push([o,a])}return r};Za.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Za.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var c=o.distance(o.dataset[r],o.dataset[a]),p=Math.max(o._coreDistance,c);o._reachability[a]===void 0?(o._reachability[a]=p,e.insert(a,p)):p<o._reachability[a]&&(o._reachability[a]=p,e.remove(a),e.insert(a,p))}})};Za.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var c=e[o];if(this._processed[c]===void 0){var p=this._regionQuery(c);this._processed[c]=1,this.clusters[r].push(c),this._orderedList.push(c),this._distanceToCore(c)!==void 0&&(this._updateQueue(c,p,t),this._expandCluster(r,t))}}};Za.prototype._distanceToCore=function(r){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(r,e);if(o.length>=this.minPts)return e}};Za.prototype._regionQuery=function(r,t){t=t||this.epsilon;for(var e=[],o=0,a=this.dataset.length;o<a;o++)this.distance(this.dataset[r],this.dataset[o])<t&&e.push(o);return e};Za.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof _c!="undefined"&&_c.exports&&(_c.exports=Za)});var Qw=ye((kW,zp)=>{typeof zp!="undefined"&&zp.exports&&(zp.exports={DBSCAN:$w(),KMEANS:Zw(),OPTICS:Kw(),PriorityQueue:B0()})});var z0=ye((XW,tM)=>{"use strict";tM.exports={eudist:function(t,e,o){for(var a=t.length,c=0,p=0;p<a;p++){var d=(t[p]||0)-(e[p]||0);c+=d*d}return o?Math.sqrt(c):c},mandist:function(t,e,o){for(var a=t.length,c=0,p=0;p<a;p++)c+=Math.abs((t[p]||0)-(e[p]||0));return o?Math.sqrt(c):c},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var rM=ye((YW,nM)=>{"use strict";var eM=z0(),VU=eM.eudist,WU=eM.dist;nM.exports={kmrand:function(t,e){for(var o={},a=[],c=e<<2,p=t.length,d=t[0].length>0;a.length<e&&c-- >0;){var g=t[Math.floor(Math.random()*p)],y=d?g.join("_"):""+g;o[y]||(o[y]=!0,a.push(g))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?VU:WU,a=[],c=t.length,p=t[0].length>0,d={},g=t[Math.floor(Math.random()*c)],y=p?g.join("_"):""+g;for(a.push(g),d[y]=!0;a.length<e;){for(var _=[],w=a.length,x=0,T=[],C=0;C<c;C++){for(var I=1/0,M=0;M<w;M++){var E=o(t[C],a[M]);E<=I&&(I=E)}_[C]=I}for(var L=0;L<c;L++)x+=_[L];for(var A=0;A<c;A++)T[A]={i:A,v:t[A],pr:_[A]/x,cs:0};T.sort(function(X,U){return X.pr-U.pr}),T[0].cs=T[0].pr;for(var z=1;z<c;z++)T[z].cs=T[z-1].cs+T[z].pr;for(var G=Math.random(),Y=0;Y<c-1&&T[Y++].cs<G;);a.push(T[Y-1].v)}return a}}});var uM=ye((JW,aM)=>{"use strict";var k0=z0(),sM=rM(),qU=k0.eudist,$W=k0.mandist,ZW=k0.dist,XU=sM.kmrand,YU=sM.kmpp,iM=1e4;function oM(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function $U(r,t,e,o){var a=[],c=[],p=[],d=[],g=!1,y=o||iM,_=r.length,w=r[0].length,x=w>0,T=[];if(e)e=="kmrand"?a=XU(r,t):e=="kmpp"?a=YU(r,t):a=e;else for(var C={};a.length<t;){var I=Math.floor(Math.random()*_);C[I]||(C[I]=!0,a.push(r[I]))}do{oM(t,0,T);for(var M=0;M<_;M++){for(var E=1/0,L=0,A=0;A<t;A++){var d=x?qU(r[M],a[A]):Math.abs(r[M]-a[A]);d<=E&&(E=d,L=A)}p[M]=L,T[L]++}for(var z=[],c=[],G=0,Y=0;Y<t;Y++)z[Y]=x?oM(w,0,z[Y]):0,c[Y]=a[Y];if(x){for(var X=0;X<t;X++)a[X]=[];for(var U=0;U<_;U++)for(var H=p[U],Q=z[H],gt=r[U],$=0;$<w;$++)Q[$]+=gt[$];g=!0;for(var Nt=0;Nt<t;Nt++){for(var j=a[Nt],pt=z[Nt],Ct=c[Nt],Tt=T[Nt],ft=0;ft<w;ft++)j[ft]=pt[ft]/Tt||0;if(g){for(var dt=0;dt<w;dt++)if(Ct[dt]!=j[dt]){g=!1;break}}}}else{for(var Z=0;Z<_;Z++){var st=p[Z];z[st]+=r[Z]}for(var vt=0;vt<t;vt++)a[vt]=z[vt]/T[vt]||0;g=!0;for(var zt=0;zt<t;zt++)if(c[zt]!=a[zt]){g=!1;break}}g=g||--y<=0}while(!g);return{it:iM-y,k:t,idxs:p,centroids:a}}aM.exports=$U});var Sc=ye((X0,Y0)=>{(function(r,t){typeof X0=="object"&&typeof Y0!="undefined"?Y0.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(X0,function(){"use strict";function r(it,B){if(!(it instanceof B))throw new TypeError("Cannot call a class as a function")}function t(it,B){for(var P=0;P<B.length;P++){var F=B[P];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(it,F.key,F)}}function e(it,B,P){return B&&t(it.prototype,B),P&&t(it,P),it}var o=function(){function it(B,P){this.next=null,this.key=B,this.data=P,this.left=null,this.right=null}return it}();function a(it,B){return it>B?1:it<B?-1:0}function c(it,B,P){for(var F=new o(null,null),J=F,rt=F;;){var D=P(it,B.key);if(D<0){if(B.left===null)break;if(P(it,B.left.key)<0){var N=B.left;if(B.left=N.right,N.right=B,B=N,B.left===null)break}rt.left=B,rt=B,B=B.left}else if(D>0){if(B.right===null)break;if(P(it,B.right.key)>0){var N=B.right;if(B.right=N.left,N.left=B,B=N,B.right===null)break}J.right=B,J=B,B=B.right}else break}return J.right=B.left,rt.left=B.right,B.left=F.right,B.right=F.left,B}function p(it,B,P,F){var J=new o(it,B);if(P===null)return J.left=J.right=null,J;P=c(it,P,F);var rt=F(it,P.key);return rt<0?(J.left=P.left,J.right=P,P.left=null):rt>=0&&(J.right=P.right,J.left=P,P.right=null),J}function d(it,B,P){var F=null,J=null;if(B){B=c(it,B,P);var rt=P(B.key,it);rt===0?(F=B.left,J=B.right):rt<0?(J=B.right,B.right=null,F=B):(F=B.left,B.left=null,J=B)}return{left:F,right:J}}function g(it,B,P){return B===null?it:(it===null||(B=c(it.key,B,P),B.left=it),B)}function y(it,B,P,F,J){if(it){F(""+B+(P?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+J(it)+\`
|
|
106
|
+
`);var Ar=class extends Z.ShaderMaterial{constructor(e){super({uniforms:Object.assign({},Z.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new Z.Color(16777215)},opacity:{value:1},resolution:{value:new Z.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new Z.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:Z.ShaderChunk.meshline_vert,fragmentShader:Z.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(t){this.uniforms.lineWidth.value=t}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(t){this.uniforms.map.value=t}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(t){this.uniforms.useMap.value=t}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(t){this.uniforms.alphaMap.value=t}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(t){this.uniforms.useAlphaMap.value=t}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(t){this.uniforms.color.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(t){this.uniforms.sizeAttenuation.value=t}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(t){this.uniforms.dashArray.value=t,this.useDash=t!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(t){this.uniforms.dashRatio.value=t}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(t){this.uniforms.useDash.value=t}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(t){this.uniforms.visibility.value=t}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(t){this.uniforms.alphaTest.value=t}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(t){this.uniforms.repeat.value.copy(t)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(t){this.uniforms.thresholdRatio.value=t}}}),this.setValues(e)}};Ar.prototype.copy=function(r){return Z.ShaderMaterial.prototype.copy.call(this,r),this.lineWidth=r.lineWidth,this.map=r.map,this.useMap=r.useMap,this.alphaMap=r.alphaMap,this.useAlphaMap=r.useAlphaMap,this.color.copy(r.color),this.opacity=r.opacity,this.resolution.copy(r.resolution),this.sizeAttenuation=r.sizeAttenuation,this.dashArray.copy(r.dashArray),this.dashOffset.copy(r.dashOffset),this.dashRatio.copy(r.dashRatio),this.useDash=r.useDash,this.visibility=r.visibility,this.alphaTest=r.alphaTest,this.repeat.copy(r.repeat),this};var cu="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAMAAACROYkbAAABrVBMVEVsjPdsjPdqi/doifdpivdrjPdsjPdsjPd/m/igtfqTq/lykfdri/dsjPdtjfe/zPv8/f/w8/6zw/p0kvdri/dsjPdtjffU3vz////////3+f62xfpzkfdri/dsjPdsjPeZr/nr8P7////////4+f62xfp0kvdri/dsjPdsjPdujveXrvne5v3////////3+f63x/t2lPdri/dsjPdsjPdsjPdri/eMpfjb4/3+/v/////4+v+7yft1k/dri/dsjPdsjPdri/eJovjl6/3////////3+f6Jo/lqivdsjPdri/dvjveluPry9f7////////i6f2BnPhqi/dsjPdrjPdvjveluPrv8v7////////l6/6Uq/lsjPdsjPdsjPdvjveluPrv8v7////////m6/6Uq/lsjPdsjPdsjPdsjPeZr/nv8v7////////s8f6XrvlsjPdsjPdtjffS2/z////////w9P6bsfltjfdsjPdtjffBz/v7/P/y9f6svvpxkPdrjPdsjPdsjPd+mviftPqVrPlykfdri/dsjPdsjPdri/doifdpifdrjPdsjPclkRlrAAAAx0lEQVQ4y2NgwAsYmZhZWNkYyAfsHJxc3Dy85BvAxy8gKCQsIkq2AWLiEpJS0jKycuQaIK+gqKSsoqqmrkGmAZpa2jq6evoGhkbG5BlgYmpmbmFpZW1ja0emE+wdHJ2cXVzd3D3INMDTy9vH188/IDCIPP3BIaFh4RGRUdExseQZEBefkJiUnJKalp5BngGZWdk5uXn5BemFZAZBUXFJaVl5RSWZ9jMwVFXX1NbVNzSSq5+hqbmlta29g2z9DJ1d3T29ffhUAABKPSh5Xst3GwAAAABJRU5ErkJggg==";var hu={texture_url:cu,lineWidth:8,color:16777215},fi=class extends Gt.Object3D{constructor(t,n){super();this.navigation=t;this.config=Object.assign({},hu,n),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}mesh=null;geometry=null;material=null;texture=null;config=hu;points=[];basicRepeat=1;prevCameraZoom=0;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)}onControlChange=()=>{let t=this.navigation.bmap.context.camera.zoom;t!==this.prevCameraZoom&&(this.prevCameraZoom=t,this.changeRepeat())};onUpdate=()=>{this.texture};onResize=()=>{if(this.material){let{width:t,height:n}=this.navigation.bmap.context.clientSize;this.material.resolution.set(t,n)}};getRepeat(){let{points:t,navigation:{bmap:{context:{camera:n,clientSize:{width:i,height:o}}}}}=this,a=t.map(([l,s])=>et(new Gt.Vector3(l,s,0),n,i,o)).map(({x:l,y:s})=>[l,s]);return Ne(a)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new Gt.Vector2(t,1)}loadTexture(t){return new Promise((n,i)=>{new Gt.TextureLoader().load(t,n,void 0,i)})}transformPoints(t){let n=[];for(let i=0;i<t.length;i++)n.push(...t[i],0);return n}updatePoints(t){this.points=t,this.changeRepeat();let n=this.transformPoints(t);this.geometry&&this.geometry.setPoints(n)}movePath(t){this.material&&(this.material.thresholdRatio=t)}async create(t){let n=this.geometry=new _e;if(this.updatePoints(t),!this.texture){let a=this.texture=await this.loadTexture(this.config.texture_url);a.wrapS=a.wrapT=Gt.RepeatWrapping}let i=this.material=new Ar({useMap:!0,color:new Gt.Color(this.config.color),transparent:!0,resolution:new Gt.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:Gt.NormalBlending,repeat:new Gt.Vector2(this.getRepeat(),1)}),o=this.mesh=new Gt.Mesh(n,i);return o.renderOrder=9,this.add(o),o}dispose(){this.unRegistryEvent(),this.clear(),this.geometry?.dispose(),this.material?.dispose(),this.texture?.dispose()}};var Pr=require("@tweenjs/tween.js"),pn=require("three");var pu=require("three");var fu=require("@tweenjs/tween.js"),cp={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},di=class extends pu.EventDispatcher{constructor(t,n){super();this.navigation=t;this.options=Object.assign({},cp,n),this.registryEvent()}offset=!1;reset=!1;position=[0,0];routeIndex=0;pointIndex=0;paths=[];options;timer=new Wt;resetTimer=null;tweenUtil=new wn;simulationTween;get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){return this.curRoutePath?.points||[]}registryEvent(){this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.addEventListener("add-path",this.onAddPaths)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.removeEventListener("add-path",this.onAddPaths)}onAddPaths=({paths:t})=>{this.paths=t,this.resetStatus(t),this.emitNavigationStatus()};onUpdate=()=>{this.tweenUtil.update()};resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,n){let{curRoutePathPoints:i,position:o,curRoutePath:a,paths:c,routeIndex:l}=this;if(!i.length)return null;let s=i;if(o){let p=_n(i,o);s=s.slice(p+1),s.unshift(o)}let u=[{floor:a?.floor,points:s},...c.slice(l+1)].filter(p=>p.floor===t),{distance:h,closestPoint:f,index:d,i:g}=u.reduce((p,m,v)=>{let{distance:b,closestPoint:y,index:S}=m.points.reduce((x,_,M,w)=>{if(!w[M+1])return x;let{distance:C,closestPoint:P}=no(n,_,w[M+1]);return C<x.distance?{distance:C,closestPoint:P,index:M}:x},{distance:1/0,closestPoint:m.points[0],index:0});return b<p.distance?{distance:b,closestPoint:y,index:v,i:S}:p},{distance:1/0,closestPoint:s[0],index:0,i:0});return{distance:h,closestPoint:f,routeIndex:d+l,pointIndex:d===0?g+this.pointIndex:g}}toPosition(t,n){let i=this.adsorb(t,n);if(!i)return;let{distance:o,closestPoint:a,routeIndex:c,pointIndex:l}=i;o>this.options.offsetDistance?(this.offset=!0,this.resetTimer||(this.resetTimer=this.timer.setTimeout(()=>{this.reset=!0,this.resetTimer=null},this.options.offsetToResetTime))):(this.offset=!1,this.reset=!1,this.resetTimer&&this.timer.clearTimeout(this.resetTimer)),this.routeIndex=c,this.pointIndex=l,this.position=a,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}async startCurRouteSimulation(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let n=[];return new Promise(i=>{let o=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],a=this.getCurRouteRemainDistance(),c=a/this.options.simulationSpeed,l=this.simulationTween=new fu.Tween({distance:0},this.tweenUtil.group).to({distance:a},c*1e3).onUpdate(s=>{let u=hr(o,s.distance);u&&(n.push({floor:t.floor,pos:u}),this.toPosition(t.floor,u))}).onComplete(()=>{this.tweenUtil.remove(l),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,i(this.startCurRouteSimulation())):(i(!0),console.log(n))}).start()})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:n,position:i}=this;if(!t.length)return 0;let o=[i,...t.slice(n+1)];return Ne(o)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((o,a)=>o+a.distance,0)+t,curRoute:t}}getNextDirDistance(){if(!this.position)return null;let{pointIndex:t,curRoutePathPoints:n,position:i}=this,o=n[t],a=n[t+1],c=n[t+2];if(!o||!a)return null;let l=qt(i,a);return t===0&&qt(o,i)<5?{dir:"start",distance:l}:c?{dir:Kr(o,a,c),distance:l}:{dir:"end",distance:l}}getNavigationInfo(){let{total:t,curRoute:n}=this.getRemainDistance(),i=this.getNextDirDistance();if(!i)return null;let{dir:o,distance:a}=i;return o==="end"&&a>15&&(o="front"),o!=="start"&&a>=this.options.directionEmitThreshold&&(o="front"),n<=5&&(o="end"),{distance:t,curRouteDistance:n,nextDirDistance:a,dir:o,pos:this.position,routeIndex:this.routeIndex,offset:this.offset,reset:this.reset}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear()}};var hp={path:{},cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},positionNavigation:{},offsetY:150,directionEmitThreshold:5,disablePathAnimation:!1,speed:1},xo=class extends qe{path=null;fetchRoadStatus=!1;paths=[];curPathIndex=0;curFloorPath=null;translatePath=null;currentPathPosition=null;options;pathTween=null;startPoi=null;movedDistance=0;pathStart=[0,0];tweenUtil=new wn;animationPathOptions={cPathIndex:0};cPath=[];positionNavigation;pathMoving=!1;nextPoint=null;constructor(e,t={},n){super(e),!n&&typeof t=="object"&&(n=t),this.options=Object.assign({},hp,n);let{apiDomain:i,apiPath:{roadNetwork:o},apiInfo:a}=this.bmap.config;this.positionNavigation=new di(this,{simulationSpeed:this.options.speed,...this.options.positionNavigation}),this.registryEvent()}get curFloorPathLength(){return this.curFloorPath?.distance??0}get curFloorPathPoints(){return this.curFloorPath?.points??[]}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor),this.positionNavigation.addEventListener("navigation-info",this.onNavigationInfo)}onNavigationInfo=({info:e})=>{if(this.dispatchEvent({type:"navigation-info",info:e}),!e.offset){if(e.routeIndex!==this.curPathIndex)return;this.pathMoving?this.nextPoint=e.pos:(this.toPositionBySpeed(e.pos,this.options.speed).then(()=>{this.pathMoving=!1}),this.nextPoint=null)}};pauseAnimation(){this.tweenUtil.pause(),this.positionNavigation.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue(),this.positionNavigation.tweenUtil.continue()}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),this.positionNavigation.removeEventListener("navigation-info",this.onNavigationInfo)}onUpdate=()=>{this.tweenUtil.update()};clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.tweenUtil.clear()),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null),this.translatePath=null}setCurFloorPath(e){e===null?(this.curFloorPath=null,this.currentPathPosition=null):(this.curFloorPath=e,this.currentPathPosition=e.points[0]),this.movedDistance=0}setCurPathIndex(e){this.curPathIndex=e,this.paths[e]?.floor===this.bmap.context.currentFloor?.name?(this.setCurFloorPath(this.paths[e]),this.renderPath(this.translatePoints(this.curFloorPathPoints))):this.clearPath()}onSwitchFloor=({data:{curFloor:e}})=>{if(this.tweenUtil.clear(),this.nextPoint=null,this.pathMoving=!1,this.paths[this.curPathIndex]){let t=this.paths[this.curPathIndex];this.setCurFloorPath(t??null),t?this.renderPath(this.translatePoints(t.points)):this.clearPath()}else this.clearPath()};addPath(e,t=0){this.paths=e,this.curPathIndex=t;let n=this.bmap.context.currentFloor?.name,i=e[t];if(n&&i?.floor===n)if(this.setCurFloorPath(i),this.bmap.currentBuildGround)this.renderPath(this.translatePoints(i.points));else{let o=()=>{this.bmap.removeEventListener("center-change",o),this.renderPath(this.translatePoints(i.points))};this.bmap.addEventListener("center-change",o)}else this.clearPath();this.dispatchEvent({type:"add-path",paths:e})}translatePoints(e){let[t,n]=this.bmap.buildingCenter;return e.map(i=>[i[0]-t,i[1]-n])}renderPath(e){this.translatePath=e;let t=this.catmullRomCurve3(e);this.cPath=t,this.animationPathOptions={cPathIndex:0},this.pathStart=t[0],this.path?this.path.updatePoints(t):(this.path=new fi(this,this.options.path),this.path.create(t),this.path.position.z=this.bmap.context.currentFloor.groundMaxHeight+.5,this.bmap.context.scene.add(this.path)),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null),this.options.needStartPoi&&(this.startPoi=new he(this.bmap.context,{...this.options.startPoi,id:"navigation_start_poi",position:{x:t[0][0],y:t[0][1],z:.51},collision_enable:!1})||null,this.bmap.context.currentFloor?.poiLayer2.pushPoi(this.startPoi)),this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(e){return eo(e,!1,!0,.1,170,2.5)}getPathDirection(){if(!this.curFloorPath||!this.currentPathPosition||this.curFloorPathPoints.length<2)return null;let e=_n(this.curFloorPathPoints,this.currentPathPosition),t=this.curFloorPathPoints[e],n=this.curFloorPathPoints[e+1],i=new pn.Vector3(n[0]-t[0],n[1]-t[1],0).normalize(),o=new pn.Vector3(0,1,0).normalize(),a=i.angleTo(o),c=new pn.Vector3().crossVectors(o,i);return(Object.is(c.y,0)?-1:1)*a}async changeCameraToPathUp(e=100){let t=this.getPathDirection();if(t===null)return;let n=this.bmap.context.control.getAzimuthalAngle();Math.abs(n-t)>Math.PI&&(n>0?t=Math.PI*2+t:t=t-Math.PI*2);let i=Math.abs(t-this.bmap.context.control.getAzimuthalAngle());if(i<.01)return;let{control:o}=this.bmap.context,a=e/Math.PI*6*i;return new Promise(c=>{let l={azimuthal:o.getAzimuthalAngle()},s={azimuthal:t},u=new Pr.Tween(l,this.tweenUtil.group).to(s,a).easing(Pr.Easing.Quadratic.InOut).onUpdate(async()=>{o.target.copy(this.startPoi.position),o.setAzimuthalAngle(l.azimuthal,!0),o.setTargetByOffset(this.options.offsetY)}).onComplete(()=>{o.enabled=!0,this.tweenUtil.remove(u),c(!0)}).onStart(()=>{o.enabled=!1}).start()})}async initNavigationCamera(){await this.translateCameraToStartPoi(300),await this.changeCameraToPathUp(300)}async translateCameraToStartPoi(e=100){if(!this.startPoi)return;let{clientSize:{width:t,height:n},camera:i,control:o}=this.bmap.context,a=Math.round(t/2),c=Math.round(n/2),l=o.target.clone(),s=et(this.startPoi.position,i,t,n),u=s.x-a,h=c-s.y+this.options.offsetY;if(!(Math.abs(u)<1&&Math.abs(h)<1)){if(Math.abs(u)>=1){let f=new pn.Vector3;f.setFromMatrixColumn(i.matrix,0),f.normalize(),f.multiplyScalar(u/i.zoom),l.add(new pn.Vector3(f.x,0,0))}if(Math.abs(h)>=1){let f=new pn.Vector3;f.setFromMatrixColumn(i.matrix,1),f.normalize(),f.multiplyScalar(h/i.zoom),l.add(new pn.Vector3(0,f.y,0))}return this.bmap.context.setCameraPosition(l,e)}}async initCameraZoom(e=100){if(!this.startPoi)return;let{clientSize:{width:t,height:n},currentFloor:i}=this.bmap.context,{max:o,min:a}=i.box,l=Math.min(t/(o.x-a.x),n/(o.y-a.y))*(o.x-a.x)/20;return this.bmap.context.setZoom(l,this.startPoi.position,e)}toPosition(e,t){this.positionNavigation.toPosition(e,t)}startSimulation(){this.positionNavigation.startSimulation()}setSimulationSpeed(e){this.positionNavigation.changeSimulationSpeed(e)}async toPositionBySpeed(e,t){let{currentPathPosition:n,curFloorPath:i,curFloorPathPoints:o}=this;if(!i||!n)return null;let a=this.movedDistance,c=io(o,e);if(a===-1||c===-1||c<=a)return null;let l=c-a;if(!l)return;let s=Math.min(l/t,1);return this.pathTween&&this.tweenUtil.clear(),this.pathMoving=!0,new Promise(u=>{let h=this.pathTween=new Pr.Tween({distance:0},this.tweenUtil.group).to({distance:l},s*1e3).onUpdate(async f=>{this.moveDistance(f.distance+a,h)}).onComplete(()=>{if(this.tweenUtil.remove(h),this.nextPoint){let f=this.nextPoint;this.nextPoint=null,u(this.toPositionBySpeed(f,this.options.speed))}else u(!0)}).start()})}async moveDistance(e,t){this.movedDistance=e,this.path?.movePath(this.movedDistance/this.curFloorPathLength);let n=hr(this.curFloorPathPoints,this.movedDistance);if(n===null)return;this.currentPathPosition=n;let i=this.translatePoints([n])[0];this.startPoi&&(this.startPoi.position.setX(i[0]).setY(i[1]),this.options.disablePathAnimation||this.bmap.context.control.setTargetByOffset(this.options.offsetY,this.startPoi.position.clone())),this.options.disablePathAnimation||(t?.pause(),this.positionNavigation.tweenUtil.pause(),await this.changeCameraToPathUp(500/this.options.speed),this.positionNavigation.tweenUtil.continue(),t?.resume())}setStartPoiRotate(e){if(this.startPoi){let n=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(360-e-n)%360}}dispose(){this.tweenUtil.dispose(),this.unRegistryEvent(),this.path?.dispose(),this.startPoi?.dispose(),this.positionNavigation.dispose()}};var du=require("three"),Eo=class extends qe{poiLayer;floors=[];group=new du.Group;constructor(e){super(e),this.poiLayer=new An(e.context)}show(e){let t=e[0].userData.height;e.forEach(o=>{o.poiLayer.pois.forEach(a=>{this.poiLayer.pushPoi(a)}),o.poiLayer.pois.length=0,o.poiLayer.dispose(),o.position.z=t,t+=o.userData.height});let{scene:n,currentFloor:i}=this.bmap.context;i&&(n.remove(i),i.dispose()),this.group.add(this.poiLayer,...e),n.add(this.group),this.floors=e,this.bmap.context.cameraBound.updateBox()}hide(){let{scene:e}=this.bmap.context;e.remove(this.group),this.poiLayer.clear(!0),this.floors.forEach(t=>{t.dispose()}),this.floors=[],this.group.clear()}fitCamera(){let{context:e,config:t,type:n}=this.bmap;e.cameraBound.setEnable(!1),e.control.minZoom=0,e.control.maxZoom=1/0,e.camera.zoom=1,e.setAzimuthalAngle(t.control.defaultAzimuthal,0),e.setPolarAngle(t.control.defaultPolar,0),e.fitCameraToObject(this.group,void 0,0);let i=e.camera.zoom;e.control.minZoom=i,e.control.maxZoom=i*25,n==="3d"&&e.fitCameraToObject(this.group,t.defaultPadding,0,!1),this.bmap.basicZoom=e.camera.zoom,e.control.addEventListener("change",this.bmap.onControlChange.bind(this.bmap)),this.bmap.onControlChange(),e.cameraBound.setEnable(!0)}dispose(){this.poiLayer.dispose(),this.floors.forEach(e=>e.dispose()),this.floors=[]}};var gu=require("three");function Dr(r){let e=new Blob([r],{type:"text/javascript"}),t=URL.createObjectURL(e),n=new Worker(t);return URL.revokeObjectURL(t),n}function bo(){return Dr(`var RP=Object.create;var Zd=Object.defineProperty,LP=Object.defineProperties,NP=Object.getOwnPropertyDescriptor,OP=Object.getOwnPropertyDescriptors,DP=Object.getOwnPropertyNames,Wv=Object.getOwnPropertySymbols,FP=Object.getPrototypeOf,qv=Object.prototype.hasOwnProperty,UP=Object.prototype.propertyIsEnumerable;var $d=(r,t,e)=>t in r?Zd(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Wc=(r,t)=>{for(var e in t||(t={}))qv.call(t,e)&&$d(r,e,t[e]);if(Wv)for(var e of Wv(t))UP.call(t,e)&&$d(r,e,t[e]);return r},Xv=(r,t)=>LP(r,OP(t));var ye=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var BP=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of DP(t))!qv.call(r,a)&&a!==e&&Zd(r,a,{get:()=>t[a],enumerable:!(o=NP(t,a))||o.enumerable});return r};var Er=(r,t,e)=>(e=r!=null?RP(FP(r)):{},BP(t||!r||!r.__esModule?Zd(e,"default",{value:r,enumerable:!0}):e,r));var Ei=(r,t,e)=>$d(r,typeof t!="symbol"?t+"":t,e);var $v=ye((lz,Yv)=>{var Jd=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(a=>(a.key===t&&Object.assign(a,{priority:o}),a)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};Yv.exports=Jd});var Kv=ye((cz,Jv)=>{function Zv(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,Zv(a,t)):o!==t&&e.set(o,a);return e}Jv.exports=Zv});var t_=ye((fz,jv)=>{function zP(r){let t=Number(r);return!(isNaN(t)||t<=0)}function Qv(r){let t=new Map;return Object.keys(r).forEach(o=>{let a=r[o];if(a!==null&&typeof a=="object"&&!Array.isArray(a))return t.set(o,Qv(a));if(!zP(a))throw new Error(\`Could not add node at key "\${o}", make sure it's a valid node\`,a);return t.set(o,Number(a))}),t}jv.exports=Qv});var r_=ye((hz,n_)=>{function e_(r){if(!(r instanceof Map))throw new Error(\`Invalid graph: Expected Map instead found \${typeof r}\`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){e_(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}n_.exports=e_});var a_=ye((pz,s_)=>{var kP=$v(),GP=Kv(),i_=t_(),o_=r_(),Kd=class{constructor(t){t instanceof Map?(o_(t),this.graph=t):t?this.graph=i_(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(o_(e),o=e):o=i_(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=GP(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,c=new kP,p=new Map,d=[],g=0,y=[];if(o.avoid&&(y=[].concat(o.avoid)),y.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(y.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(c.set(t,0);!c.isEmpty();){let _=c.next();if(_.key===e){g=_.priority;let x=_.key;for(;p.has(x);)d.push(x),x=p.get(x);break}a.add(_.key),(this.graph.get(_.key)||new Map).forEach((x,T)=>{if(a.has(T)||y.includes(T))return null;if(!c.has(T))return p.set(T,_.key),c.set(T,_.priority+x);let C=c.get(T).priority,I=_.priority+x;return I<C?(p.set(T,_.key),c.set(T,I)):null})}return d.length?(o.trim?d.shift():d=d.concat([t]),o.reverse||(d=d.reverse()),o.cost?{path:d,cost:g}:d):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};s_.exports=Kd});var tp=ye((wz,K1)=>{"use strict";var J1=Object.getOwnPropertySymbols,HO=Object.prototype.hasOwnProperty,VO=Object.prototype.propertyIsEnumerable;function WO(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function qO(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(c){return t[c]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(c){a[c]=c}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(c){return!1}}K1.exports=qO()?Object.assign:function(r,t){for(var e,o=WO(r),a,c=1;c<arguments.length;c++){e=Object(arguments[c]);for(var p in e)HO.call(e,p)&&(o[p]=e[p]);if(J1){a=J1(e);for(var d=0;d<a.length;d++)VO.call(e,a[d])&&(o[a[d]]=e[a[d]])}}return o}});var Mm=ye((Em,wm)=>{(function(r,t){typeof Em=="object"&&typeof wm!="undefined"?wm.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(Em,function(){"use strict";function r(M,E,L,A,z){(function G(Y,X,U,H,Q){for(;H>U;){if(H-U>600){var gt=H-U+1,$=X-U+1,Nt=Math.log(gt),j=.5*Math.exp(2*Nt/3),pt=.5*Math.sqrt(Nt*j*(gt-j)/gt)*($-gt/2<0?-1:1),Ct=Math.max(U,Math.floor(X-$*j/gt+pt)),Tt=Math.min(H,Math.floor(X+(gt-$)*j/gt+pt));G(Y,X,Ct,Tt,Q)}var ft=Y[X],dt=U,Z=H;for(t(Y,U,X),Q(Y[H],ft)>0&&t(Y,U,H);dt<Z;){for(t(Y,dt,Z),dt++,Z--;Q(Y[dt],ft)<0;)dt++;for(;Q(Y[Z],ft)>0;)Z--}Q(Y[U],ft)===0?t(Y,U,Z):t(Y,++Z,H),Z<=X&&(U=Z+1),X<=Z&&(H=Z-1)}})(M,E,L||0,A||M.length-1,z||e)}function t(M,E,L){var A=M[E];M[E]=M[L],M[L]=A}function e(M,E){return M<E?-1:M>E?1:0}var o=function(M){M===void 0&&(M=9),this._maxEntries=Math.max(4,M),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(M,E,L){if(!L)return E.indexOf(M);for(var A=0;A<E.length;A++)if(L(M,E[A]))return A;return-1}function c(M,E){p(M,0,M.children.length,E,M)}function p(M,E,L,A,z){z||(z=C(null)),z.minX=1/0,z.minY=1/0,z.maxX=-1/0,z.maxY=-1/0;for(var G=E;G<L;G++){var Y=M.children[G];d(z,M.leaf?A(Y):Y)}return z}function d(M,E){return M.minX=Math.min(M.minX,E.minX),M.minY=Math.min(M.minY,E.minY),M.maxX=Math.max(M.maxX,E.maxX),M.maxY=Math.max(M.maxY,E.maxY),M}function g(M,E){return M.minX-E.minX}function y(M,E){return M.minY-E.minY}function _(M){return(M.maxX-M.minX)*(M.maxY-M.minY)}function w(M){return M.maxX-M.minX+(M.maxY-M.minY)}function x(M,E){return M.minX<=E.minX&&M.minY<=E.minY&&E.maxX<=M.maxX&&E.maxY<=M.maxY}function T(M,E){return E.minX<=M.maxX&&E.minY<=M.maxY&&E.maxX>=M.minX&&E.maxY>=M.minY}function C(M){return{children:M,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function I(M,E,L,A,z){for(var G=[E,L];G.length;)if(!((L=G.pop())-(E=G.pop())<=A)){var Y=E+Math.ceil((L-E)/A/2)*A;r(M,Y,E,L,z),G.push(E,Y,Y,L)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(M){var E=this.data,L=[];if(!T(M,E))return L;for(var A=this.toBBox,z=[];E;){for(var G=0;G<E.children.length;G++){var Y=E.children[G],X=E.leaf?A(Y):Y;T(M,X)&&(E.leaf?L.push(Y):x(M,X)?this._all(Y,L):z.push(Y))}E=z.pop()}return L},o.prototype.collides=function(M){var E=this.data;if(!T(M,E))return!1;for(var L=[];E;){for(var A=0;A<E.children.length;A++){var z=E.children[A],G=E.leaf?this.toBBox(z):z;if(T(M,G)){if(E.leaf||x(M,G))return!0;L.push(z)}}E=L.pop()}return!1},o.prototype.load=function(M){if(!M||!M.length)return this;if(M.length<this._minEntries){for(var E=0;E<M.length;E++)this.insert(M[E]);return this}var L=this._build(M.slice(),0,M.length-1,0);if(this.data.children.length)if(this.data.height===L.height)this._splitRoot(this.data,L);else{if(this.data.height<L.height){var A=this.data;this.data=L,L=A}this._insert(L,this.data.height-L.height-1,!0)}else this.data=L;return this},o.prototype.insert=function(M){return M&&this._insert(M,this.data.height-1),this},o.prototype.clear=function(){return this.data=C([]),this},o.prototype.remove=function(M,E){if(!M)return this;for(var L,A,z,G=this.data,Y=this.toBBox(M),X=[],U=[];G||X.length;){if(G||(G=X.pop(),A=X[X.length-1],L=U.pop(),z=!0),G.leaf){var H=a(M,G.children,E);if(H!==-1)return G.children.splice(H,1),X.push(G),this._condense(X),this}z||G.leaf||!x(G,Y)?A?(L++,G=A.children[L],z=!1):G=null:(X.push(G),U.push(L),L=0,A=G,G=G.children[0])}return this},o.prototype.toBBox=function(M){return M},o.prototype.compareMinX=function(M,E){return M.minX-E.minX},o.prototype.compareMinY=function(M,E){return M.minY-E.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(M){return this.data=M,this},o.prototype._all=function(M,E){for(var L=[];M;)M.leaf?E.push.apply(E,M.children):L.push.apply(L,M.children),M=L.pop();return E},o.prototype._build=function(M,E,L,A){var z,G=L-E+1,Y=this._maxEntries;if(G<=Y)return c(z=C(M.slice(E,L+1)),this.toBBox),z;A||(A=Math.ceil(Math.log(G)/Math.log(Y)),Y=Math.ceil(G/Math.pow(Y,A-1))),(z=C([])).leaf=!1,z.height=A;var X=Math.ceil(G/Y),U=X*Math.ceil(Math.sqrt(Y));I(M,E,L,U,this.compareMinX);for(var H=E;H<=L;H+=U){var Q=Math.min(H+U-1,L);I(M,H,Q,X,this.compareMinY);for(var gt=H;gt<=Q;gt+=X){var $=Math.min(gt+X-1,Q);z.children.push(this._build(M,gt,$,A-1))}}return c(z,this.toBBox),z},o.prototype._chooseSubtree=function(M,E,L,A){for(;A.push(E),!E.leaf&&A.length-1!==L;){for(var z=1/0,G=1/0,Y=void 0,X=0;X<E.children.length;X++){var U=E.children[X],H=_(U),Q=(gt=M,$=U,(Math.max($.maxX,gt.maxX)-Math.min($.minX,gt.minX))*(Math.max($.maxY,gt.maxY)-Math.min($.minY,gt.minY))-H);Q<G?(G=Q,z=H<z?H:z,Y=U):Q===G&&H<z&&(z=H,Y=U)}E=Y||E.children[0]}var gt,$;return E},o.prototype._insert=function(M,E,L){var A=L?M:this.toBBox(M),z=[],G=this._chooseSubtree(A,this.data,E,z);for(G.children.push(M),d(G,A);E>=0&&z[E].children.length>this._maxEntries;)this._split(z,E),E--;this._adjustParentBBoxes(A,z,E)},o.prototype._split=function(M,E){var L=M[E],A=L.children.length,z=this._minEntries;this._chooseSplitAxis(L,z,A);var G=this._chooseSplitIndex(L,z,A),Y=C(L.children.splice(G,L.children.length-G));Y.height=L.height,Y.leaf=L.leaf,c(L,this.toBBox),c(Y,this.toBBox),E?M[E-1].children.push(Y):this._splitRoot(L,Y)},o.prototype._splitRoot=function(M,E){this.data=C([M,E]),this.data.height=M.height+1,this.data.leaf=!1,c(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(M,E,L){for(var A,z,G,Y,X,U,H,Q=1/0,gt=1/0,$=E;$<=L-E;$++){var Nt=p(M,0,$,this.toBBox),j=p(M,$,L,this.toBBox),pt=(z=Nt,G=j,Y=void 0,X=void 0,U=void 0,H=void 0,Y=Math.max(z.minX,G.minX),X=Math.max(z.minY,G.minY),U=Math.min(z.maxX,G.maxX),H=Math.min(z.maxY,G.maxY),Math.max(0,U-Y)*Math.max(0,H-X)),Ct=_(Nt)+_(j);pt<Q?(Q=pt,A=$,gt=Ct<gt?Ct:gt):pt===Q&&Ct<gt&&(gt=Ct,A=$)}return A||L-E},o.prototype._chooseSplitAxis=function(M,E,L){var A=M.leaf?this.compareMinX:g,z=M.leaf?this.compareMinY:y;this._allDistMargin(M,E,L,A)<this._allDistMargin(M,E,L,z)&&M.children.sort(A)},o.prototype._allDistMargin=function(M,E,L,A){M.children.sort(A);for(var z=this.toBBox,G=p(M,0,E,z),Y=p(M,L-E,L,z),X=w(G)+w(Y),U=E;U<L-E;U++){var H=M.children[U];d(G,M.leaf?z(H):H),X+=w(G)}for(var Q=L-E-1;Q>=E;Q--){var gt=M.children[Q];d(Y,M.leaf?z(gt):gt),X+=w(Y)}return X},o.prototype._adjustParentBBoxes=function(M,E,L){for(var A=L;A>=0;A--)d(E[A],M)},o.prototype._condense=function(M){for(var E=M.length-1,L=void 0;E>=0;E--)M[E].children.length===0?E>0?(L=M[E-1].children).splice(L.indexOf(M[E]),1):this.clear():c(M[E],this.toBBox)},o})});var Q1=ye((Sm,bm)=>{(function(r,t){typeof Sm=="object"&&typeof bm!="undefined"?bm.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(Sm,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var c=(this.length>>1)-1;c>=0;c--)this._down(c)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,c=a.data,p=a.compare,d=c[o];o>0;){var g=o-1>>1,y=c[g];if(p(d,y)>=0)break;c[o]=y,o=g}c[o]=d},r.prototype._down=function(o){for(var a=this,c=a.data,p=a.compare,d=this.length>>1,g=c[o];o<d;){var y=(o<<1)+1,_=c[y],w=y+1;if(w<this.length&&p(c[w],_)<0&&(y=w,_=c[w]),p(_,g)>=0)break;c[o]=_,o=y}c[o]=g};function t(e,o){return e<o?-1:e>o?1:0}return r})});var tx=ye((Cz,j1)=>{j1.exports=function(t,e,o,a){var c=t[0],p=t[1],d=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var g=(a-o)/2,y=0,_=g-1;y<g;_=y++){var w=e[o+y*2+0],x=e[o+y*2+1],T=e[o+_*2+0],C=e[o+_*2+1],I=x>p!=C>p&&c<(T-w)*(p-x)/(C-x)+w;I&&(d=!d)}return d}});var nx=ye((Pz,ex)=>{ex.exports=function(t,e,o,a){var c=t[0],p=t[1],d=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var g=a-o,y=0,_=g-1;y<g;_=y++){var w=e[y+o][0],x=e[y+o][1],T=e[_+o][0],C=e[_+o][1],I=x>p!=C>p&&c<(T-w)*(p-x)/(C-x)+w;I&&(d=!d)}return d}});var ox=ye((Iz,rp)=>{var rx=tx(),ix=nx();rp.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?ix(t,e,o,a):rx(t,e,o,a)};rp.exports.nested=ix;rp.exports.flat=rx});var ax=ye((ip,sx)=>{(function(r,t){typeof ip=="object"&&typeof sx!="undefined"?t(ip):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(ip,function(r){"use strict";let e=33306690738754706e-32;function o(T,C,I,M,E){let L,A,z,G,Y=C[0],X=M[0],U=0,H=0;X>Y==X>-Y?(L=Y,Y=C[++U]):(L=X,X=M[++H]);let Q=0;if(U<T&&H<I)for(X>Y==X>-Y?(z=L-((A=Y+L)-Y),Y=C[++U]):(z=L-((A=X+L)-X),X=M[++H]),L=A,z!==0&&(E[Q++]=z);U<T&&H<I;)X>Y==X>-Y?(z=L-((A=L+Y)-(G=A-L))+(Y-G),Y=C[++U]):(z=L-((A=L+X)-(G=A-L))+(X-G),X=M[++H]),L=A,z!==0&&(E[Q++]=z);for(;U<T;)z=L-((A=L+Y)-(G=A-L))+(Y-G),Y=C[++U],L=A,z!==0&&(E[Q++]=z);for(;H<I;)z=L-((A=L+X)-(G=A-L))+(X-G),X=M[++H],L=A,z!==0&&(E[Q++]=z);return L===0&&Q!==0||(E[Q++]=L),Q}function a(T){return new Float64Array(T)}let c=33306690738754716e-32,p=22204460492503146e-32,d=11093356479670487e-47,g=a(4),y=a(8),_=a(12),w=a(16),x=a(4);r.orient2d=function(T,C,I,M,E,L){let A=(C-L)*(I-E),z=(T-E)*(M-L),G=A-z;if(A===0||z===0||A>0!=z>0)return G;let Y=Math.abs(A+z);return Math.abs(G)>=c*Y?G:-function(X,U,H,Q,gt,$,Nt){let j,pt,Ct,Tt,ft,dt,Z,st,vt,zt,bt,qt,le,se,Zt,_e,Vt,pe,at=X-gt,He=H-gt,ae=U-$,ce=Q-$;ft=(Zt=(st=at-(Z=(dt=134217729*at)-(dt-at)))*(zt=ce-(vt=(dt=134217729*ce)-(dt-ce)))-((se=at*ce)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=ae-(Z=(dt=134217729*ae)-(dt-ae)))*(zt=He-(vt=(dt=134217729*He)-(dt-He)))-((_e=ae*He)-Z*vt-st*vt-Z*zt))),g[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),g[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,g[2]=qt-(pe-ft)+(bt-ft),g[3]=pe;let fe=function(J,rt){let D=rt[0];for(let N=1;N<J;N++)D+=rt[N];return D}(4,g),it=p*Nt;if(fe>=it||-fe>=it||(j=X-(at+(ft=X-at))+(ft-gt),Ct=H-(He+(ft=H-He))+(ft-gt),pt=U-(ae+(ft=U-ae))+(ft-$),Tt=Q-(ce+(ft=Q-ce))+(ft-$),j===0&&pt===0&&Ct===0&&Tt===0)||(it=d*Nt+e*Math.abs(fe),(fe+=at*Tt+ce*j-(ae*Ct+He*pt))>=it||-fe>=it))return fe;ft=(Zt=(st=j-(Z=(dt=134217729*j)-(dt-j)))*(zt=ce-(vt=(dt=134217729*ce)-(dt-ce)))-((se=j*ce)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=pt-(Z=(dt=134217729*pt)-(dt-pt)))*(zt=He-(vt=(dt=134217729*He)-(dt-He)))-((_e=pt*He)-Z*vt-st*vt-Z*zt))),x[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),x[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,x[2]=qt-(pe-ft)+(bt-ft),x[3]=pe;let B=o(4,g,4,x,y);ft=(Zt=(st=at-(Z=(dt=134217729*at)-(dt-at)))*(zt=Tt-(vt=(dt=134217729*Tt)-(dt-Tt)))-((se=at*Tt)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=ae-(Z=(dt=134217729*ae)-(dt-ae)))*(zt=Ct-(vt=(dt=134217729*Ct)-(dt-Ct)))-((_e=ae*Ct)-Z*vt-st*vt-Z*zt))),x[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),x[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,x[2]=qt-(pe-ft)+(bt-ft),x[3]=pe;let P=o(B,y,4,x,_);ft=(Zt=(st=j-(Z=(dt=134217729*j)-(dt-j)))*(zt=Tt-(vt=(dt=134217729*Tt)-(dt-Tt)))-((se=j*Tt)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=pt-(Z=(dt=134217729*pt)-(dt-pt)))*(zt=Ct-(vt=(dt=134217729*Ct)-(dt-Ct)))-((_e=pt*Ct)-Z*vt-st*vt-Z*zt))),x[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),x[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,x[2]=qt-(pe-ft)+(bt-ft),x[3]=pe;let F=o(P,_,4,x,w);return w[F-1]}(T,C,I,M,E,L,Y)},r.orient2dfast=function(T,C,I,M,E,L){return(C-L)*(I-E)-(T-E)*(M-L)},Object.defineProperty(r,"__esModule",{value:!0})})});var px=ye((Rz,Pm)=>{"use strict";var ux=Mm(),sp=Q1(),YO=ox(),$O=ax().orient2d;sp.default&&(sp=sp.default);Pm.exports=hx;Pm.exports.default=hx;function hx(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=jO(r),a=new ux(16);a.toBBox=function(L){return{minX:L[0],minY:L[1],maxX:L[0],maxY:L[1]}},a.compareMinX=function(L,A){return L[0]-A[0]},a.compareMinY=function(L,A){return L[1]-A[1]},a.load(r);for(var c=[],p=0,d;p<o.length;p++){var g=o[p];a.remove(g),d=fx(g,d),c.push(d)}var y=new ux(16);for(p=0;p<c.length;p++)y.insert(Tm(c[p]));for(var _=t*t,w=e*e;c.length;){var x=c.shift(),T=x.p,C=x.next.p,I=Am(T,C);if(!(I<w)){var M=I/_;g=ZO(a,x.prev.p,T,C,x.next.next.p,M,y),g&&Math.min(Am(g,T),Am(g,C))<=M&&(c.push(x),c.push(fx(g,x)),a.remove(g),y.remove(x),y.insert(Tm(x)),y.insert(Tm(x.next)))}}x=d;var E=[];do E.push(x.p),x=x.next;while(x!==d);return E.push(x.p),E}function ZO(r,t,e,o,a,c,p){for(var d=new sp([],JO),g=r.data;g;){for(var y=0;y<g.children.length;y++){var _=g.children[y],w=g.leaf?Cm(_,e,o):KO(e,o,_);w>c||d.push({node:_,dist:w})}for(;d.length&&!d.peek().node.children;){var x=d.pop(),T=x.node,C=Cm(T,t,e),I=Cm(T,o,a);if(x.dist<C&&x.dist<I&&cx(e,T,p)&&cx(o,T,p))return T}g=d.pop(),g&&(g=g.node)}return null}function JO(r,t){return r.dist-t.dist}function KO(r,t,e){if(lx(r,e)||lx(t,e))return 0;var o=op(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=op(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var c=op(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(c===0)return 0;var p=op(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return p===0?0:Math.min(o,a,c,p)}function lx(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function cx(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),c=Math.max(r[0],t[0]),p=Math.max(r[1],t[1]),d=e.search({minX:o,minY:a,maxX:c,maxY:p}),g=0;g<d.length;g++)if(QO(d[g].p,d[g].next.p,r,t))return!1;return!0}function rc(r,t,e){return $O(r[0],r[1],t[0],t[1],e[0],e[1])}function QO(r,t,e,o){return r!==o&&t!==e&&rc(r,t,e)>0!=rc(r,t,o)>0&&rc(e,o,r)>0!=rc(e,o,t)>0}function Tm(r){var t=r.p,e=r.next.p;return r.minX=Math.min(t[0],e[0]),r.minY=Math.min(t[1],e[1]),r.maxX=Math.max(t[0],e[0]),r.maxY=Math.max(t[1],e[1]),r}function jO(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],c=0;c<r.length;c++){var p=r[c];p[0]<t[0]&&(t=p),p[0]>o[0]&&(o=p),p[1]<e[1]&&(e=p),p[1]>a[1]&&(a=p)}var d=[t,e,o,a],g=d.slice();for(c=0;c<r.length;c++)YO(r[c],d)||g.push(r[c]);return eD(g)}function fx(r,t){var e={p:r,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function Am(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function Cm(r,t,e){var o=t[0],a=t[1],c=e[0]-o,p=e[1]-a;if(c!==0||p!==0){var d=((r[0]-o)*c+(r[1]-a)*p)/(c*c+p*p);d>1?(o=e[0],a=e[1]):d>0&&(o+=c*d,a+=p*d)}return c=r[0]-o,p=r[1]-a,c*c+p*p}function op(r,t,e,o,a,c,p,d){var g=e-r,y=o-t,_=p-a,w=d-c,x=r-a,T=t-c,C=g*g+y*y,I=g*_+y*w,M=_*_+w*w,E=g*x+y*T,L=_*x+w*T,A=C*M-I*I,z,G,Y,X,U=A,H=A;A===0?(G=0,U=1,X=L,H=M):(G=I*L-M*E,X=C*L-I*E,G<0?(G=0,X=L,H=M):G>U&&(G=U,X=L+I,H=M)),X<0?(X=0,-E<0?G=0:-E>C?G=U:(G=-E,U=C)):X>H&&(X=H,-E+I<0?G=0:-E+I>C?G=U:(G=-E+I,U=C)),z=G===0?0:G/U,Y=X===0?0:X/H;var Q=(1-z)*r+z*e,gt=(1-z)*t+z*o,$=(1-Y)*a+Y*p,Nt=(1-Y)*c+Y*d,j=$-Q,pt=Nt-gt;return j*j+pt*pt}function tD(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function eD(r){r.sort(tD);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&rc(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}for(var o=[],a=r.length-1;a>=0;a--){for(;o.length>=2&&rc(o[o.length-2],o[o.length-1],r[a])<=0;)o.pop();o.push(r[a])}return o.pop(),t.pop(),t.concat(o)}});var _x=ye((Rm,Lm)=>{(function(r,t){typeof Rm=="object"&&typeof Lm!="undefined"?Lm.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(Rm,function(){"use strict";function r(a,c,p,d,g){t(a,c,p||0,d||a.length-1,g||o)}function t(a,c,p,d,g){for(;d>p;){if(d-p>600){var y=d-p+1,_=c-p+1,w=Math.log(y),x=.5*Math.exp(2*w/3),T=.5*Math.sqrt(w*x*(y-x)/y)*(_-y/2<0?-1:1),C=Math.max(p,Math.floor(c-_*x/y+T)),I=Math.min(d,Math.floor(c+(y-_)*x/y+T));t(a,c,C,I,g)}var M=a[c],E=p,L=d;for(e(a,p,c),g(a[d],M)>0&&e(a,p,d);E<L;){for(e(a,E,L),E++,L--;g(a[E],M)<0;)E++;for(;g(a[L],M)>0;)L--}g(a[p],M)===0?e(a,p,L):(L++,e(a,L,d)),L<=c&&(p=L+1),c<=L&&(d=L-1)}}function e(a,c,p){var d=a[c];a[c]=a[p],a[p]=d}function o(a,c){return a<c?-1:a>c?1:0}return r})});var Fm=ye((rG,Dm)=>{"use strict";Dm.exports=uf;Dm.exports.default=uf;var dD=_x();function uf(r,t){if(!(this instanceof uf))return new uf(r,t);this._maxEntries=Math.max(4,r||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}uf.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!up(r,t))return e;for(var a=[],c,p,d,g;t;){for(c=0,p=t.children.length;c<p;c++)d=t.children[c],g=t.leaf?o(d):d,up(r,g)&&(t.leaf?e.push(d):Om(r,g)?this._all(d,e):a.push(d));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!up(r,t))return!1;for(var o=[],a,c,p,d;t;){for(a=0,c=t.children.length;a<c;a++)if(p=t.children[a],d=t.leaf?e(p):p,up(r,d)){if(t.leaf||Om(r,d))return!0;o.push(p)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=sc([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],c=[],p,d,g,y;e||a.length;){if(e||(e=a.pop(),d=a[a.length-1],p=c.pop(),y=!0),e.leaf&&(g=gD(r,e.children,t),g!==-1))return e.children.splice(g,1),a.push(e),this._condense(a),this;!y&&!e.leaf&&Om(e,o)?(a.push(e),c.push(p),p=0,d=e,e=e.children[0]):d?(p++,e=d.children[p],y=!1):e=null}return this},toBBox:function(r){return r},compareMinX:xx,compareMinY:Ex,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,c=this._maxEntries,p;if(a<=c)return p=sc(r.slice(t,e+1)),oc(p,this.toBBox),p;o||(o=Math.ceil(Math.log(a)/Math.log(c)),c=Math.ceil(a/Math.pow(c,o-1))),p=sc([]),p.leaf=!1,p.height=o;var d=Math.ceil(a/c),g=d*Math.ceil(Math.sqrt(c)),y,_,w,x;for(wx(r,t,e,g,this.compareMinX),y=t;y<=e;y+=g)for(w=Math.min(y+g-1,e),wx(r,y,w,d,this.compareMinY),_=y;_<=w;_+=d)x=Math.min(_+d-1,w),p.children.push(this._build(r,_,x,o-1));return oc(p,this.toBBox),p},_chooseSubtree:function(r,t,e,o){for(var a,c,p,d,g,y,_,w;o.push(t),!(t.leaf||o.length-1===e);){for(_=w=1/0,a=0,c=t.children.length;a<c;a++)p=t.children[a],g=Nm(p),y=mD(r,p)-g,y<w?(w=y,_=g<_?g:_,d=p):y===w&&g<_&&(_=g,d=p);t=d||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),c=[],p=this._chooseSubtree(a,this.data,t,c);for(p.children.push(r),af(p,a);t>=0&&c[t].children.length>this._maxEntries;)this._split(c,t),t--;this._adjustParentBBoxes(a,c,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var c=this._chooseSplitIndex(e,a,o),p=sc(e.children.splice(c,e.children.length-c));p.height=e.height,p.leaf=e.leaf,oc(e,this.toBBox),oc(p,this.toBBox),t?r[t-1].children.push(p):this._splitRoot(e,p)},_splitRoot:function(r,t){this.data=sc([r,t]),this.data.height=r.height+1,this.data.leaf=!1,oc(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,c,p,d,g,y,_;for(g=y=1/0,o=t;o<=e-t;o++)a=sf(r,0,o,this.toBBox),c=sf(r,o,e,this.toBBox),p=yD(a,c),d=Nm(a)+Nm(c),p<g?(g=p,_=o,y=d<y?d:y):p===g&&d<y&&(y=d,_=o);return _},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:xx,a=r.leaf?this.compareMinY:Ex,c=this._allDistMargin(r,t,e,o),p=this._allDistMargin(r,t,e,a);c<p&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,c=sf(r,0,t,a),p=sf(r,e-t,e,a),d=ap(c)+ap(p),g,y;for(g=t;g<e-t;g++)y=r.children[g],af(c,r.leaf?a(y):y),d+=ap(c);for(g=e-t-1;g>=t;g--)y=r.children[g],af(p,r.leaf?a(y):y),d+=ap(p);return d},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)af(t[o],r)},_condense:function(r){for(var t=r.length-1,e;t>=0;t--)r[t].children.length===0?t>0?(e=r[t-1].children,e.splice(e.indexOf(r[t]),1)):this.clear():oc(r[t],this.toBBox)},_initFormat:function(r){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(r[0])),this.compareMinY=new Function("a","b",t.join(r[1])),this.toBBox=new Function("a","return {minX: a"+r[0]+", minY: a"+r[1]+", maxX: a"+r[2]+", maxY: a"+r[3]+"};")}};function gD(r,t,e){if(!e)return t.indexOf(r);for(var o=0;o<t.length;o++)if(e(r,t[o]))return o;return-1}function oc(r,t){sf(r,0,r.children.length,t,r)}function sf(r,t,e,o,a){a||(a=sc(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var c=t,p;c<e;c++)p=r.children[c],af(a,r.leaf?o(p):p);return a}function af(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function xx(r,t){return r.minX-t.minX}function Ex(r,t){return r.minY-t.minY}function Nm(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function ap(r){return r.maxX-r.minX+(r.maxY-r.minY)}function mD(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function yD(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),c=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,c-o)}function Om(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function up(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function sc(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function wx(r,t,e,o,a){for(var c=[t,e],p;c.length;)e=c.pop(),t=c.pop(),!(e-t<=o)&&(p=t+Math.ceil((e-t)/o/2)*o,dD(r,p,t,e,a),c.push(t,p,p,e))}});var Cx=ye((m5,Hm)=>{"use strict";Hm.exports=hp;Hm.exports.default=hp;function hp(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,c=bx(r,0,a,e,!0),p=[];if(!c||c.next===c.prev)return p;var d,g,y,_,w,x,T;if(o&&(c=AD(r,t,c,e)),r.length>80*e){d=y=r[0],g=_=r[1];for(var C=e;C<a;C+=e)w=r[C],x=r[C+1],w<d&&(d=w),x<g&&(g=x),w>y&&(y=w),x>_&&(_=x);T=Math.max(y-d,_-g),T=T!==0?32767/T:0}return ff(c,p,e,d,g,T,0),p}function bx(r,t,e,o,a){var c,p;if(a===Gm(r,t,e,o)>0)for(c=t;c<e;c+=o)p=Sx(c,r[c],r[c+1],p);else for(c=e-o;c>=t;c-=o)p=Sx(c,r[c],r[c+1],p);return p&&pp(p,p.next)&&(pf(p),p=p.next),p}function sl(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(pp(e,e.next)||Lr(e.prev,e,e.next)===0)){if(pf(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function ff(r,t,e,o,a,c,p){if(r){!p&&c&&LD(r,o,a,c);for(var d=r,g,y;r.prev!==r.next;){if(g=r.prev,y=r.next,c?SD(r,o,a,c):MD(r)){t.push(g.i/e|0),t.push(r.i/e|0),t.push(y.i/e|0),pf(r),r=y.next,d=y.next;continue}if(r=y,r===d){p?p===1?(r=bD(sl(r),t,e),ff(r,t,e,o,a,c,2)):p===2&&TD(r,t,e,o,a,c):ff(sl(r),t,e,o,a,c,1);break}}}}function MD(r){var t=r.prev,e=r,o=r.next;if(Lr(t,e,o)>=0)return!1;for(var a=t.x,c=e.x,p=o.x,d=t.y,g=e.y,y=o.y,_=a<c?a<p?a:p:c<p?c:p,w=d<g?d<y?d:y:g<y?g:y,x=a>c?a>p?a:p:c>p?c:p,T=d>g?d>y?d:y:g>y?g:y,C=o.next;C!==t;){if(C.x>=_&&C.x<=x&&C.y>=w&&C.y<=T&&lc(a,d,c,g,p,y,C.x,C.y)&&Lr(C.prev,C,C.next)>=0)return!1;C=C.next}return!0}function SD(r,t,e,o){var a=r.prev,c=r,p=r.next;if(Lr(a,c,p)>=0)return!1;for(var d=a.x,g=c.x,y=p.x,_=a.y,w=c.y,x=p.y,T=d<g?d<y?d:y:g<y?g:y,C=_<w?_<x?_:x:w<x?w:x,I=d>g?d>y?d:y:g>y?g:y,M=_>w?_>x?_:x:w>x?w:x,E=zm(T,C,t,e,o),L=zm(I,M,t,e,o),A=r.prevZ,z=r.nextZ;A&&A.z>=E&&z&&z.z<=L;){if(A.x>=T&&A.x<=I&&A.y>=C&&A.y<=M&&A!==a&&A!==p&&lc(d,_,g,w,y,x,A.x,A.y)&&Lr(A.prev,A,A.next)>=0||(A=A.prevZ,z.x>=T&&z.x<=I&&z.y>=C&&z.y<=M&&z!==a&&z!==p&&lc(d,_,g,w,y,x,z.x,z.y)&&Lr(z.prev,z,z.next)>=0))return!1;z=z.nextZ}for(;A&&A.z>=E;){if(A.x>=T&&A.x<=I&&A.y>=C&&A.y<=M&&A!==a&&A!==p&&lc(d,_,g,w,y,x,A.x,A.y)&&Lr(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;z&&z.z<=L;){if(z.x>=T&&z.x<=I&&z.y>=C&&z.y<=M&&z!==a&&z!==p&&lc(d,_,g,w,y,x,z.x,z.y)&&Lr(z.prev,z,z.next)>=0)return!1;z=z.nextZ}return!0}function bD(r,t,e){var o=r;do{var a=o.prev,c=o.next.next;!pp(a,c)&&Tx(a,o,o.next,c)&&hf(a,c)&&hf(c,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(c.i/e|0),pf(o),pf(o.next),o=r=c),o=o.next}while(o!==r);return sl(o)}function TD(r,t,e,o,a,c){var p=r;do{for(var d=p.next.next;d!==p.prev;){if(p.i!==d.i&&DD(p,d)){var g=Ax(p,d);p=sl(p,p.next),g=sl(g,g.next),ff(p,t,e,o,a,c,0),ff(g,t,e,o,a,c,0);return}d=d.next}p=p.next}while(p!==r)}function AD(r,t,e,o){var a=[],c,p,d,g,y;for(c=0,p=t.length;c<p;c++)d=t[c]*o,g=c<p-1?t[c+1]*o:r.length,y=bx(r,d,g,o,!1),y===y.next&&(y.steiner=!0),a.push(OD(y));for(a.sort(CD),c=0;c<a.length;c++)e=PD(a[c],e);return e}function CD(r,t){return r.x-t.x}function PD(r,t){var e=ID(r,t);if(!e)return t;var o=Ax(e,r);return sl(o,o.next),sl(e,e.next)}function ID(r,t){var e=t,o=r.x,a=r.y,c=-1/0,p;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var d=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=o&&d>c&&(c=d,p=e.x<e.next.x?e:e.next,d===o))return p}e=e.next}while(e!==t);if(!p)return null;var g=p,y=p.x,_=p.y,w=1/0,x;e=p;do o>=e.x&&e.x>=y&&o!==e.x&&lc(a<_?o:c,a,y,_,a<_?c:o,a,e.x,e.y)&&(x=Math.abs(a-e.y)/(o-e.x),hf(e,r)&&(x<w||x===w&&(e.x>p.x||e.x===p.x&&RD(p,e)))&&(p=e,w=x)),e=e.next;while(e!==g);return p}function RD(r,t){return Lr(r.prev,r,t.prev)<0&&Lr(t.next,r,r.next)<0}function LD(r,t,e,o){var a=r;do a.z===0&&(a.z=zm(a.x,a.y,t,e,o)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==r);a.prevZ.nextZ=null,a.prevZ=null,ND(a)}function ND(r){var t,e,o,a,c,p,d,g,y=1;do{for(e=r,r=null,c=null,p=0;e;){for(p++,o=e,d=0,t=0;t<y&&(d++,o=o.nextZ,!!o);t++);for(g=y;d>0||g>0&&o;)d!==0&&(g===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,d--):(a=o,o=o.nextZ,g--),c?c.nextZ=a:r=a,a.prevZ=c,c=a;e=o}c.nextZ=null,y*=2}while(p>1);return r}function zm(r,t,e,o,a){return r=(r-e)*a|0,t=(t-o)*a|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function OD(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function lc(r,t,e,o,a,c,p,d){return(a-p)*(t-d)>=(r-p)*(c-d)&&(r-p)*(o-d)>=(e-p)*(t-d)&&(e-p)*(c-d)>=(a-p)*(o-d)}function DD(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!FD(r,t)&&(hf(r,t)&&hf(t,r)&&UD(r,t)&&(Lr(r.prev,r,t.prev)||Lr(r,t.prev,t))||pp(r,t)&&Lr(r.prev,r,r.next)>0&&Lr(t.prev,t,t.next)>0)}function Lr(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function pp(r,t){return r.x===t.x&&r.y===t.y}function Tx(r,t,e,o){var a=fp(Lr(r,t,e)),c=fp(Lr(r,t,o)),p=fp(Lr(e,o,r)),d=fp(Lr(e,o,t));return!!(a!==c&&p!==d||a===0&&cp(r,e,t)||c===0&&cp(r,o,t)||p===0&&cp(e,r,o)||d===0&&cp(e,t,o))}function cp(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function fp(r){return r>0?1:r<0?-1:0}function FD(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Tx(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function hf(r,t){return Lr(r.prev,r,r.next)<0?Lr(r,t,r.next)>=0&&Lr(r,r.prev,t)>=0:Lr(r,t,r.prev)<0||Lr(r,r.next,t)<0}function UD(r,t){var e=r,o=!1,a=(r.x+t.x)/2,c=(r.y+t.y)/2;do e.y>c!=e.next.y>c&&e.next.y!==e.y&&a<(e.next.x-e.x)*(c-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function Ax(r,t){var e=new km(r.i,r.x,r.y),o=new km(t.i,t.x,t.y),a=r.next,c=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,c.next=o,o.prev=c,o}function Sx(r,t,e,o){var a=new km(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function pf(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function km(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}hp.deviation=function(r,t,e,o){var a=t&&t.length,c=a?t[0]*e:r.length,p=Math.abs(Gm(r,0,c,e));if(a)for(var d=0,g=t.length;d<g;d++){var y=t[d]*e,_=d<g-1?t[d+1]*e:r.length;p-=Math.abs(Gm(r,y,_,e))}var w=0;for(d=0;d<o.length;d+=3){var x=o[d]*e,T=o[d+1]*e,C=o[d+2]*e;w+=Math.abs((r[x]-r[C])*(r[T+1]-r[x+1])-(r[x]-r[T])*(r[C+1]-r[x+1]))}return p===0&&w===0?0:Math.abs((w-p)/p)};function Gm(r,t,e,o){for(var a=0,c=t,p=e-o;c<e;c+=o)a+=(r[p]-r[c])*(r[c+1]+r[p+1]),p=c;return a}hp.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var c=0;c<r[a].length;c++)for(var p=0;p<t;p++)e.vertices.push(r[a][c][p]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var Ym=ye(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.earthRadius=63710088e-1;Ie.factors={centimeters:Ie.earthRadius*100,centimetres:Ie.earthRadius*100,degrees:Ie.earthRadius/111325,feet:Ie.earthRadius*3.28084,inches:Ie.earthRadius*39.37,kilometers:Ie.earthRadius/1e3,kilometres:Ie.earthRadius/1e3,meters:Ie.earthRadius,metres:Ie.earthRadius,miles:Ie.earthRadius/1609.344,millimeters:Ie.earthRadius*1e3,millimetres:Ie.earthRadius*1e3,nauticalmiles:Ie.earthRadius/1852,radians:1,yards:Ie.earthRadius*1.0936};Ie.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/Ie.earthRadius,yards:1.0936133};Ie.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 Au(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}Ie.feature=Au;function zD(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Vm(t).geometry;case"LineString":return qm(t).geometry;case"Polygon":return Wm(t).geometry;case"MultiPoint":return Ix(t).geometry;case"MultiLineString":return Px(t).geometry;case"MultiPolygon":return Rx(t).geometry;default:throw new Error(r+" is invalid")}}Ie.geometry=zD;function Vm(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(!dp(r[0])||!dp(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Au(o,t,e)}Ie.point=Vm;function kD(r,t,e){return e===void 0&&(e={}),gp(r.map(function(o){return Vm(o,t)}),e)}Ie.points=kD;function Wm(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var c=a[o];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var p=0;p<c[c.length-1].length;p++)if(c[c.length-1][p]!==c[0][p])throw new Error("First and last Position are not equivalent.")}var d={type:"Polygon",coordinates:r};return Au(d,t,e)}Ie.polygon=Wm;function GD(r,t,e){return e===void 0&&(e={}),gp(r.map(function(o){return Wm(o,t)}),e)}Ie.polygons=GD;function qm(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 Au(o,t,e)}Ie.lineString=qm;function HD(r,t,e){return e===void 0&&(e={}),gp(r.map(function(o){return qm(o,t)}),e)}Ie.lineStrings=HD;function gp(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}Ie.featureCollection=gp;function Px(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Au(o,t,e)}Ie.multiLineString=Px;function Ix(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Au(o,t,e)}Ie.multiPoint=Ix;function Rx(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Au(o,t,e)}Ie.multiPolygon=Rx;function VD(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Au(o,t,e)}Ie.geometryCollection=VD;function WD(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}Ie.round=WD;function Lx(r,t){t===void 0&&(t="kilometers");var e=Ie.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}Ie.radiansToLength=Lx;function Xm(r,t){t===void 0&&(t="kilometers");var e=Ie.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}Ie.lengthToRadians=Xm;function qD(r,t){return Nx(Xm(r,t))}Ie.lengthToDegrees=qD;function XD(r){var t=r%360;return t<0&&(t+=360),t}Ie.bearingToAzimuth=XD;function Nx(r){var t=r%(2*Math.PI);return t*180/Math.PI}Ie.radiansToDegrees=Nx;function YD(r){var t=r%360;return t*Math.PI/180}Ie.degreesToRadians=YD;function $D(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return Lx(Xm(r,t),e)}Ie.convertLength=$D;function ZD(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=Ie.areaFactors[t];if(!o)throw new Error("invalid original units");var a=Ie.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}Ie.convertArea=ZD;function dp(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}Ie.isNumber=dp;function JD(r){return!!r&&r.constructor===Object}Ie.isObject=JD;function KD(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!dp(t))throw new Error("bbox must only contain numbers")})}Ie.validateBBox=KD;function QD(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}Ie.validateId=QD});var Zm=ye(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});var ji=Ym();function df(r,t,e){if(r!==null)for(var o,a,c,p,d,g,y,_=0,w=0,x,T=r.type,C=T==="FeatureCollection",I=T==="Feature",M=C?r.features.length:1,E=0;E<M;E++){y=C?r.features[E].geometry:I?r.geometry:r,x=y?y.type==="GeometryCollection":!1,d=x?y.geometries.length:1;for(var L=0;L<d;L++){var A=0,z=0;if(p=x?y.geometries[L]:y,p!==null){g=p.coordinates;var G=p.type;switch(_=e&&(G==="Polygon"||G==="MultiPolygon")?1:0,G){case null:break;case"Point":if(t(g,w,E,A,z)===!1)return!1;w++,A++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],w,E,A,z)===!1)return!1;w++,G==="MultiPoint"&&A++}G==="LineString"&&A++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(a=0;a<g[o].length-_;a++){if(t(g[o][a],w,E,A,z)===!1)return!1;w++}G==="MultiLineString"&&A++,G==="Polygon"&&z++}G==="Polygon"&&A++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(z=0,a=0;a<g[o].length;a++){for(c=0;c<g[o][a].length-_;c++){if(t(g[o][a][c],w,E,A,z)===!1)return!1;w++}z++}A++}break;case"GeometryCollection":for(o=0;o<p.geometries.length;o++)if(df(p.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function jD(r,t,e,o){var a=e;return df(r,function(c,p,d,g,y){p===0&&e===void 0?a=c:a=t(a,c,p,d,g,y)},o),a}function Ox(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}function t3(r,t,e){var o=e;return Ox(r,function(a,c){c===0&&e===void 0?o=a:o=t(o,a,c)}),o}function Dx(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function e3(r,t,e){var o=e;return Dx(r,function(a,c){c===0&&e===void 0?o=a:o=t(o,a,c)}),o}function n3(r){var t=[];return df(r,function(e){t.push(e)}),t}function $m(r,t){var e,o,a,c,p,d,g,y,_,w,x=0,T=r.type==="FeatureCollection",C=r.type==="Feature",I=T?r.features.length:1;for(e=0;e<I;e++){for(d=T?r.features[e].geometry:C?r.geometry:r,y=T?r.features[e].properties:C?r.properties:{},_=T?r.features[e].bbox:C?r.bbox:void 0,w=T?r.features[e].id:C?r.id:void 0,g=d?d.type==="GeometryCollection":!1,p=g?d.geometries.length:1,a=0;a<p;a++){if(c=g?d.geometries[a]:d,c===null){if(t(null,x,y,_,w)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(c,x,y,_,w)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<c.geometries.length;o++)if(t(c.geometries[o],x,y,_,w)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}x++}}function r3(r,t,e){var o=e;return $m(r,function(a,c,p,d,g){c===0&&e===void 0?o=a:o=t(o,a,c,p,d,g)}),o}function mp(r,t){$m(r,function(e,o,a,c,p){var d=e===null?null:e.type;switch(d){case null:case"Point":case"LineString":case"Polygon":return t(ji.feature(e,a,{bbox:c,id:p}),o,0)===!1?!1:void 0}var g;switch(d){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var y=0;y<e.coordinates.length;y++){var _=e.coordinates[y],w={type:g,coordinates:_};if(t(ji.feature(w,a),o,y)===!1)return!1}})}function i3(r,t,e){var o=e;return mp(r,function(a,c,p){c===0&&p===0&&e===void 0?o=a:o=t(o,a,c,p)}),o}function Fx(r,t){mp(r,function(e,o,a){var c=0;if(e.geometry){var p=e.geometry.type;if(!(p==="Point"||p==="MultiPoint")){var d,g=0,y=0,_=0;if(df(e,function(w,x,T,C,I){if(d===void 0||o>g||C>y||I>_){d=w,g=o,y=C,_=I,c=0;return}var M=ji.lineString([d,w],e.properties);if(t(M,o,a,I,c)===!1)return!1;c++,d=w})===!1)return!1}}})}function o3(r,t,e){var o=e,a=!1;return Fx(r,function(c,p,d,g,y){a===!1&&e===void 0?o=c:o=t(o,c,p,d,g,y),a=!0}),o}function Ux(r,t){if(!r)throw new Error("geojson is required");mp(r,function(e,o,a){if(e.geometry!==null){var c=e.geometry.type,p=e.geometry.coordinates;switch(c){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var d=0;d<p.length;d++)if(t(ji.lineString(p[d],e.properties),o,a,d)===!1)return!1;break}}})}function s3(r,t,e){var o=e;return Ux(r,function(a,c,p,d){c===0&&e===void 0?o=a:o=t(o,a,c,p,d)}),o}function a3(r,t){if(t=t||{},!ji.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,c=t.segmentIndex||0,p=t.properties,d;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),p=p||r.features[e].properties,d=r.features[e].geometry;break;case"Feature":p=p||r.properties,d=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":d=r;break;default:throw new Error("geojson is invalid")}if(d===null)return null;var g=d.coordinates;switch(d.type){case"Point":case"MultiPoint":return null;case"LineString":return c<0&&(c=g.length+c-1),ji.lineString([g[c],g[c+1]],p,t);case"Polygon":return a<0&&(a=g.length+a),c<0&&(c=g[a].length+c-1),ji.lineString([g[a][c],g[a][c+1]],p,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c-1),ji.lineString([g[o][c],g[o][c+1]],p,t);case"MultiPolygon":return o<0&&(o=g.length+o),a<0&&(a=g[o].length+a),c<0&&(c=g[o][a].length-c-1),ji.lineString([g[o][a][c],g[o][a][c+1]],p,t)}throw new Error("geojson is invalid")}function u3(r,t){if(t=t||{},!ji.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,c=t.coordIndex||0,p=t.properties,d;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),p=p||r.features[e].properties,d=r.features[e].geometry;break;case"Feature":p=p||r.properties,d=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":d=r;break;default:throw new Error("geojson is invalid")}if(d===null)return null;var g=d.coordinates;switch(d.type){case"Point":return ji.point(g,p,t);case"MultiPoint":return o<0&&(o=g.length+o),ji.point(g[o],p,t);case"LineString":return c<0&&(c=g.length+c),ji.point(g[c],p,t);case"Polygon":return a<0&&(a=g.length+a),c<0&&(c=g[a].length+c),ji.point(g[a][c],p,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c),ji.point(g[o][c],p,t);case"MultiPolygon":return o<0&&(o=g.length+o),a<0&&(a=g[o].length+a),c<0&&(c=g[o][a].length-c),ji.point(g[o][a][c],p,t)}throw new Error("geojson is invalid")}li.coordAll=n3;li.coordEach=df;li.coordReduce=jD;li.featureEach=Dx;li.featureReduce=e3;li.findPoint=u3;li.findSegment=a3;li.flattenEach=mp;li.flattenReduce=i3;li.geomEach=$m;li.geomReduce=r3;li.lineEach=Ux;li.lineReduce=s3;li.propEach=Ox;li.propReduce=t3;li.segmentEach=Fx;li.segmentReduce=o3});var Bx=ye(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});var l3=Zm();function Jm(r){var t=[1/0,1/0,-1/0,-1/0];return l3.coordEach(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Jm.default=Jm;Km.default=Jm});var yp=ye((L5,Qm)=>{var ha=Mm(),kx=Ym(),Gx=Zm(),cc=Bx().default,c3=Gx.featureEach,I5=Gx.coordEach,R5=kx.polygon,zx=kx.featureCollection;function Hx(r){var t=new ha(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:cc(e),ha.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:cc(a),o.push(a)}):c3(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:cc(a),o.push(a)}),ha.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:cc(e),ha.prototype.remove.call(this,e,o)},t.clear=function(){return ha.prototype.clear.call(this)},t.search=function(e){var o=ha.prototype.search.call(this,this.toBBox(e));return zx(o)},t.collides=function(e){return ha.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=ha.prototype.all.call(this);return zx(e)},t.toJSON=function(){return ha.prototype.toJSON.call(this)},t.fromJSON=function(e){return ha.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=cc(e);else if(e.type==="FeatureCollection")o=cc(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Qm.exports=Hx;Qm.exports.default=Hx});var i0=ye((GV,Qx)=>{"use strict";var Kx=Object.prototype.toString;Qx.exports=function(t){var e=Kx.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Kx.call(t.callee)==="[object Function]"),o}});var aE=ye((HV,sE)=>{"use strict";var oE;Object.keys||(yf=Object.prototype.hasOwnProperty,o0=Object.prototype.toString,jx=i0(),s0=Object.prototype.propertyIsEnumerable,tE=!s0.call({toString:null},"toString"),eE=s0.call(function(){},"prototype"),vf=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],wp=function(r){var t=r.constructor;return t&&t.prototype===r},nE={$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},rE=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!nE["$"+r]&&yf.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{wp(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),iE=function(r){if(typeof window=="undefined"||!rE)return wp(r);try{return wp(r)}catch(t){return!1}},oE=function(t){var e=t!==null&&typeof t=="object",o=o0.call(t)==="[object Function]",a=jx(t),c=e&&o0.call(t)==="[object String]",p=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var d=eE&&o;if(c&&t.length>0&&!yf.call(t,0))for(var g=0;g<t.length;++g)p.push(String(g));if(a&&t.length>0)for(var y=0;y<t.length;++y)p.push(String(y));else for(var _ in t)!(d&&_==="prototype")&&yf.call(t,_)&&p.push(String(_));if(tE)for(var w=iE(t),x=0;x<vf.length;++x)!(w&&vf[x]==="constructor")&&yf.call(t,vf[x])&&p.push(vf[x]);return p});var yf,o0,jx,s0,tE,eE,vf,wp,nE,rE,iE;sE.exports=oE});var a0=ye((VV,cE)=>{"use strict";var x3=Array.prototype.slice,E3=i0(),uE=Object.keys,Mp=uE?function(t){return uE(t)}:aE(),lE=Object.keys;Mp.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 E3(o)?lE(x3.call(o)):lE(o)})}else Object.keys=Mp;return Object.keys||Mp};cE.exports=Mp});var u0=ye((WV,fE)=>{"use strict";fE.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(e 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 c=Object.getOwnPropertySymbols(t);if(c.length!==1||c[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var p=Object.getOwnPropertyDescriptor(t,e);if(p.value!==a||p.enumerable!==!0)return!1}return!0}});var Sp=ye((qV,hE)=>{"use strict";var w3=u0();hE.exports=function(){return w3()&&!!Symbol.toStringTag}});var gE=ye((XV,dE)=>{"use strict";var pE=typeof Symbol!="undefined"&&Symbol,M3=u0();dE.exports=function(){return typeof pE!="function"||typeof Symbol!="function"||typeof pE("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:M3()}});var vE=ye((YV,yE)=>{"use strict";var mE={foo:{}},S3=Object;yE.exports=function(){return{__proto__:mE}.foo===mE.foo&&!({__proto__:null}instanceof S3)}});var EE=ye(($V,xE)=>{"use strict";var b3="Function.prototype.bind called on incompatible ",T3=Object.prototype.toString,A3=Math.max,C3="[object Function]",_E=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var c=0;c<e.length;c+=1)o[c+t.length]=e[c];return o},P3=function(t,e){for(var o=[],a=e||0,c=0;a<t.length;a+=1,c+=1)o[c]=t[a];return o},I3=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};xE.exports=function(t){var e=this;if(typeof e!="function"||T3.apply(e)!==C3)throw new TypeError(b3+e);for(var o=P3(arguments,1),a,c=function(){if(this instanceof a){var _=e.apply(this,_E(o,arguments));return Object(_)===_?_:this}return e.apply(t,_E(o,arguments))},p=A3(0,e.length-o.length),d=[],g=0;g<p;g++)d[g]="$"+g;if(a=Function("binder","return function ("+I3(d,",")+"){ return binder.apply(this,arguments); }")(c),e.prototype){var y=function(){};y.prototype=e.prototype,a.prototype=new y,y.prototype=null}return a}});var bp=ye((ZV,wE)=>{"use strict";var R3=EE();wE.exports=Function.prototype.bind||R3});var SE=ye((JV,ME)=>{"use strict";var L3=Function.prototype.call,N3=Object.prototype.hasOwnProperty,O3=bp();ME.exports=O3.call(L3,N3)});var ll=ye((KV,PE)=>{"use strict";var Bn,dc=SyntaxError,CE=Function,pc=TypeError,l0=function(r){try{return CE('"use strict"; return ('+r+").constructor;")()}catch(t){}},al=Object.getOwnPropertyDescriptor;if(al)try{al({},"")}catch(r){al=null}var c0=function(){throw new pc},D3=al?function(){try{return arguments.callee,c0}catch(r){try{return al(arguments,"callee").get}catch(t){return c0}}}():c0,fc=gE()(),F3=vE()(),Ti=Object.getPrototypeOf||(F3?function(r){return r.__proto__}:null),hc={},U3=typeof Uint8Array=="undefined"||!Ti?Bn:Ti(Uint8Array),ul={"%AggregateError%":typeof AggregateError=="undefined"?Bn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Bn:ArrayBuffer,"%ArrayIteratorPrototype%":fc&&Ti?Ti([][Symbol.iterator]()):Bn,"%AsyncFromSyncIteratorPrototype%":Bn,"%AsyncFunction%":hc,"%AsyncGenerator%":hc,"%AsyncGeneratorFunction%":hc,"%AsyncIteratorPrototype%":hc,"%Atomics%":typeof Atomics=="undefined"?Bn:Atomics,"%BigInt%":typeof BigInt=="undefined"?Bn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Bn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Bn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Bn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array=="undefined"?Bn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Bn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Bn:FinalizationRegistry,"%Function%":CE,"%GeneratorFunction%":hc,"%Int8Array%":typeof Int8Array=="undefined"?Bn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Bn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Bn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":fc&&Ti?Ti(Ti([][Symbol.iterator]())):Bn,"%JSON%":typeof JSON=="object"?JSON:Bn,"%Map%":typeof Map=="undefined"?Bn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!fc||!Ti?Bn:Ti(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Bn:Promise,"%Proxy%":typeof Proxy=="undefined"?Bn:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect=="undefined"?Bn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Bn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!fc||!Ti?Bn:Ti(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Bn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":fc&&Ti?Ti(""[Symbol.iterator]()):Bn,"%Symbol%":fc?Symbol:Bn,"%SyntaxError%":dc,"%ThrowTypeError%":D3,"%TypedArray%":U3,"%TypeError%":pc,"%Uint8Array%":typeof Uint8Array=="undefined"?Bn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Bn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Bn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Bn:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap=="undefined"?Bn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Bn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Bn:WeakSet};if(Ti)try{null.error}catch(r){bE=Ti(Ti(r)),ul["%Error.prototype%"]=bE}var bE,B3=function r(t){var e;if(t==="%AsyncFunction%")e=l0("async function () {}");else if(t==="%GeneratorFunction%")e=l0("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=l0("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&Ti&&(e=Ti(a.prototype))}return ul[t]=e,e},TE={"%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"]},_f=bp(),Tp=SE(),z3=_f.call(Function.call,Array.prototype.concat),k3=_f.call(Function.apply,Array.prototype.splice),AE=_f.call(Function.call,String.prototype.replace),Ap=_f.call(Function.call,String.prototype.slice),G3=_f.call(Function.call,RegExp.prototype.exec),H3=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,V3=/\\\\(\\\\)?/g,W3=function(t){var e=Ap(t,0,1),o=Ap(t,-1);if(e==="%"&&o!=="%")throw new dc("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new dc("invalid intrinsic syntax, expected opening \`%\`");var a=[];return AE(t,H3,function(c,p,d,g){a[a.length]=d?AE(g,V3,"$1"):p||c}),a},q3=function(t,e){var o=t,a;if(Tp(TE,o)&&(a=TE[o],o="%"+a[0]+"%"),Tp(ul,o)){var c=ul[o];if(c===hc&&(c=B3(o)),typeof c=="undefined"&&!e)throw new pc("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:c}}throw new dc("intrinsic "+t+" does not exist!")};PE.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new pc("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new pc('"allowMissing" argument must be a boolean');if(G3(/^%?[^%]*%?$/,t)===null)throw new dc("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=W3(t),a=o.length>0?o[0]:"",c=q3("%"+a+"%",e),p=c.name,d=c.value,g=!1,y=c.alias;y&&(a=y[0],k3(o,z3([0,1],y)));for(var _=1,w=!0;_<o.length;_+=1){var x=o[_],T=Ap(x,0,1),C=Ap(x,-1);if((T==='"'||T==="'"||T==="\`"||C==='"'||C==="'"||C==="\`")&&T!==C)throw new dc("property names with quotes must have matching quotes");if((x==="constructor"||!w)&&(g=!0),a+="."+x,p="%"+a+"%",Tp(ul,p))d=ul[p];else if(d!=null){if(!(x in d)){if(!e)throw new pc("base intrinsic for "+t+" exists, but the property is not available.");return}if(al&&_+1>=o.length){var I=al(d,x);w=!!I,w&&"get"in I&&!("originalValue"in I.get)?d=I.get:d=d[x]}else w=Tp(d,x),d=d[x];w&&!g&&(ul[p]=d)}}return d}});var xf=ye((QV,IE)=>{"use strict";var X3=ll(),f0=X3("%Object.defineProperty%",!0),h0=function(){if(f0)try{return f0({},"a",{value:1}),!0}catch(t){return!1}return!1};h0.hasArrayLengthDefineBug=function(){if(!h0())return null;try{return f0([],"length",{value:1}).length!==1}catch(t){return!0}};IE.exports=h0});var p0=ye((jV,RE)=>{"use strict";var Y3=ll(),Cp=Y3("%Object.getOwnPropertyDescriptor%",!0);if(Cp)try{Cp([],"length")}catch(r){Cp=null}RE.exports=Cp});var Pp=ye((t6,NE)=>{"use strict";var $3=xf()(),d0=ll(),Ef=$3&&d0("%Object.defineProperty%",!0);if(Ef)try{Ef({},"a",{value:1})}catch(r){Ef=!1}var Z3=d0("%SyntaxError%"),gc=d0("%TypeError%"),LE=p0();NE.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new gc("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new gc("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new gc("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new gc("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new gc("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new gc("\`loose\`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,d=arguments.length>6?arguments[6]:!1,g=!!LE&&LE(t,e);if(Ef)Ef(t,e,{configurable:p===null&&g?g.configurable:!p,enumerable:a===null&&g?g.enumerable:!a,value:o,writable:c===null&&g?g.writable:!c});else if(d||!a&&!c&&!p)t[e]=o;else throw new Z3("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var zE=ye((e6,BE)=>{"use strict";var UE=ll(),OE=Pp(),J3=xf()(),DE=p0(),FE=UE("%TypeError%"),K3=UE("%Math.floor%");BE.exports=function(t,e){if(typeof t!="function")throw new FE("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||K3(e)!==e)throw new FE("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,c=!0;if("length"in t&&DE){var p=DE(t,"length");p&&!p.configurable&&(a=!1),p&&!p.writable&&(c=!1)}return(a||c||!o)&&(J3?OE(t,"length",e,!0,!0):OE(t,"length",e)),t}});var Rp=ye((n6,Ip)=>{"use strict";var g0=bp(),mc=ll(),Q3=zE(),j3=mc("%TypeError%"),GE=mc("%Function.prototype.apply%"),HE=mc("%Function.prototype.call%"),VE=mc("%Reflect.apply%",!0)||g0.call(HE,GE),wf=mc("%Object.defineProperty%",!0),tF=mc("%Math.max%");if(wf)try{wf({},"a",{value:1})}catch(r){wf=null}Ip.exports=function(t){if(typeof t!="function")throw new j3("a function is required");var e=VE(g0,HE,arguments);return Q3(e,1+tF(0,t.length-(arguments.length-1)),!0)};var kE=function(){return VE(g0,GE,arguments)};wf?wf(Ip.exports,"apply",{value:kE}):Ip.exports.apply=kE});var m0=ye((r6,XE)=>{"use strict";var WE=ll(),qE=Rp(),eF=qE(WE("String.prototype.indexOf"));XE.exports=function(t,e){var o=WE(t,!!e);return typeof o=="function"&&eF(t,".prototype.")>-1?qE(o):o}});var ZE=ye((i6,$E)=>{"use strict";var nF=Sp()(),rF=m0(),y0=rF("Object.prototype.toString"),Lp=function(t){return nF&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:y0(t)==="[object Arguments]"},YE=function(t){return Lp(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&y0(t)!=="[object Array]"&&y0(t.callee)==="[object Function]"},iF=function(){return Lp(arguments)}();Lp.isLegacyArguments=YE;$E.exports=iF?Lp:YE});var yc=ye((o6,jE)=>{"use strict";var oF=a0(),sF=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",aF=Object.prototype.toString,uF=Array.prototype.concat,JE=Pp(),lF=function(r){return typeof r=="function"&&aF.call(r)==="[object Function]"},KE=xf()(),cF=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!lF(o)||!o())return}KE?JE(r,t,e,!0):JE(r,t,e)},QE=function(r,t){var e=arguments.length>2?arguments[2]:{},o=oF(t);sF&&(o=uF.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)cF(r,o[a],t[o[a]],e[o[a]])};QE.supportsDescriptors=!!KE;jE.exports=QE});var v0=ye((s6,ew)=>{"use strict";var tw=function(r){return r!==r};ew.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||tw(t)&&tw(e))}});var _0=ye((a6,nw)=>{"use strict";var fF=v0();nw.exports=function(){return typeof Object.is=="function"?Object.is:fF}});var iw=ye((u6,rw)=>{"use strict";var hF=_0(),pF=yc();rw.exports=function(){var t=hF();return pF(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var uw=ye((l6,aw)=>{"use strict";var dF=yc(),gF=Rp(),mF=v0(),ow=_0(),yF=iw(),sw=gF(ow(),Object);dF(sw,{getPolyfill:ow,implementation:mF,shim:yF});aw.exports=sw});var pw=ye((c6,hw)=>{"use strict";var x0=m0(),lw=Sp()(),cw,fw,E0,w0;lw&&(cw=x0("Object.prototype.hasOwnProperty"),fw=x0("RegExp.prototype.exec"),E0={},Np=function(){throw E0},w0={toString:Np,valueOf:Np},typeof Symbol.toPrimitive=="symbol"&&(w0[Symbol.toPrimitive]=Np));var Np,vF=x0("Object.prototype.toString"),_F=Object.getOwnPropertyDescriptor,xF="[object RegExp]";hw.exports=lw?function(t){if(!t||typeof t!="object")return!1;var e=_F(t,"lastIndex"),o=e&&cw(e,"value");if(!o)return!1;try{fw(t,w0)}catch(a){return a===E0}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:vF(t)===xF}});var gw=ye((f6,dw)=>{"use strict";var Sf=function(){return typeof function(){}.name=="string"},Mf=Object.getOwnPropertyDescriptor;if(Mf)try{Mf([],"length")}catch(r){Mf=null}Sf.functionsHaveConfigurableNames=function(){if(!Sf()||!Mf)return!1;var t=Mf(function(){},"name");return!!t&&!!t.configurable};var EF=Function.prototype.bind;Sf.boundFunctionsHaveNames=function(){return Sf()&&typeof EF=="function"&&function(){}.bind().name!==""};dw.exports=Sf});var vw=ye((h6,yw)=>{"use strict";var mw=Pp(),wF=xf()(),MF=gw().functionsHaveConfigurableNames(),SF=TypeError;yw.exports=function(t,e){if(typeof t!="function")throw new SF("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||MF)&&(wF?mw(t,"name",e,!0,!0):mw(t,"name",e)),t}});var M0=ye((p6,_w)=>{"use strict";var bF=vw(),TF=Object,AF=TypeError;_w.exports=bF(function(){if(this!=null&&this!==TF(this))throw new AF("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 S0=ye((d6,xw)=>{"use strict";var CF=M0(),PF=yc().supportsDescriptors,IF=Object.getOwnPropertyDescriptor;xw.exports=function(){if(PF&&/a/mig.flags==="gim"){var t=IF(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),e==="dy")return t.get}}return CF}});var Mw=ye((g6,ww)=>{"use strict";var RF=yc().supportsDescriptors,LF=S0(),NF=Object.getOwnPropertyDescriptor,OF=Object.defineProperty,DF=TypeError,Ew=Object.getPrototypeOf,FF=/a/;ww.exports=function(){if(!RF||!Ew)throw new DF("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=LF(),e=Ew(FF),o=NF(e,"flags");return(!o||o.get!==t)&&OF(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Aw=ye((m6,Tw)=>{"use strict";var UF=yc(),BF=Rp(),zF=M0(),Sw=S0(),kF=Mw(),bw=BF(Sw());UF(bw,{getPolyfill:Sw,implementation:zF,shim:kF});Tw.exports=bw});var Pw=ye((y6,Cw)=>{"use strict";var GF=Date.prototype.getDay,HF=function(t){try{return GF.call(t),!0}catch(e){return!1}},VF=Object.prototype.toString,WF="[object Date]",qF=Sp()();Cw.exports=function(t){return typeof t!="object"||t===null?!1:qF?HF(t):VF.call(t)===WF}});var b0=ye((v6,kw)=>{var Iw=a0(),Rw=ZE(),Lw=uw(),Nw=pw(),Ow=Aw(),Dw=Pw(),Fw=Date.prototype.getTime;function zw(r,t,e){var o=e||{};return(o.strict?Lw(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?Lw(r,t):r==t:XF(r,t,o)}function Uw(r){return r==null}function Bw(r){return!(!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number")}function XF(r,t,e){var o,a;if(typeof r!=typeof t||Uw(r)||Uw(t)||r.prototype!==t.prototype||Rw(r)!==Rw(t))return!1;var c=Nw(r),p=Nw(t);if(c!==p)return!1;if(c||p)return r.source===t.source&&Ow(r)===Ow(t);if(Dw(r)&&Dw(t))return Fw.call(r)===Fw.call(t);var d=Bw(r),g=Bw(t);if(d!==g)return!1;if(d||g){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var y=Iw(r),_=Iw(t)}catch(w){return!1}if(y.length!==_.length)return!1;for(y.sort(),_.sort(),o=y.length-1;o>=0;o--)if(y[o]!=_[o])return!1;for(o=y.length-1;o>=0;o--)if(a=y[o],!zw(r[a],t[a],e))return!1;return!0}kw.exports=zw});var U0=ye((SW,Yw)=>{var FU=b0(),pa=function(r){this.precision=r&&r.precision?r.precision:17,this.direction=r&&r.direction?r.direction:!1,this.pseudoNode=r&&r.pseudoNode?r.pseudoNode:!1,this.objectComparator=r&&r.objectComparator?r.objectComparator:UU};pa.prototype.compare=function(r,t){if(r.type!==t.type||!Xw(r,t))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,t.coordinates);case"LineString":return this.compareLine(r.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(r,t);case"Feature":return this.compareFeature(r,t);default:if(r.type.indexOf("Multi")===0){var e=this,o=qw(r),a=qw(t);return o.every(function(c){return this.some(function(p){return e.compare(c,p)})},a)}}return!1};function qw(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function Xw(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}pa.prototype.compareCoord=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e++)if(r[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};pa.prototype.compareLine=function(r,t,e,o){if(!Xw(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),c=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],c[0])&&(c=this.fixStartIndex(c,a),!c))){var p=this.compareCoord(a[e],c[e]);return this.direction||p?this.comparePath(a,c):this.compareCoord(a[e],c[c.length-(1+e)])?this.comparePath(a.slice().reverse(),c):!1}};pa.prototype.fixStartIndex=function(r,t){for(var e,o=-1,a=0;a<r.length;a++)if(this.compareCoord(r[a],t[0])){o=a;break}return o>=0&&(e=[].concat(r.slice(o,r.length),r.slice(1,o+1))),e};pa.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};pa.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(c){return this.some(function(p){return a.compareLine(c,p,1,!0)})},o)}else return!1};pa.prototype.compareFeature=function(r,t){return r.id!==t.id||!this.objectComparator(r.properties,t.properties)||!this.compareBBox(r,t)?!1:this.compare(r.geometry,t.geometry)};pa.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};pa.prototype.removePseudo=function(r){return r};function UU(r,t){return FU(r,t,{strict:!0})}Yw.exports=pa});var $w=ye((FW,Fp)=>{function Pu(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}Pu.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var c=this._regionQuery(a);if(c.length<this.minPts)this.noise.push(a);else{var p=this.clusters.length;this.clusters.push([]),this._addToCluster(a,p),this._expandCluster(p,c)}}return this.clusters};Pu.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Pu.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};Pu.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};Pu.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};Pu.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};Pu.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof Fp!="undefined"&&Fp.exports&&(Fp.exports=Pu)});var Zw=ye((UW,Up)=>{function Iu(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}Iu.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};Iu.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var c=0;c<this.k;c++){for(var p=new Array(_),d=0,g=0;g<_;g++)p[g]=0;for(var y=0;y<e;y++){var _=this.dataset[y].length;if(c===this.assignments[y]){for(var g=0;g<_;g++)p[g]+=this.dataset[y][g];d++}}if(d>0){for(var g=0;g<_;g++)p[g]/=d;this.centroids[c]=p}else this.centroids[c]=this.randomCentroid(),a=!0}}return this.getClusters()};Iu.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};Iu.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};Iu.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};Iu.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,c=t.length,p,d=0;d<c;d++)p=e(r,t[d]),p<o&&(o=p,a=d);return a};Iu.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof Up!="undefined"&&Up.exports&&(Up.exports=Iu)});var B0=ye((BW,Bp)=>{function da(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}da.prototype.insert=function(r,t){for(var e=this._queue.length,o=e;o--;){var a=this._priorities[o];this._sorting==="desc"?t>a&&(e=o):t<a&&(e=o)}this._insertAt(r,t,e)};da.prototype.remove=function(r){for(var t=this._queue.length;t--;){var e=this._queue[t];if(r===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};da.prototype.forEach=function(r){this._queue.forEach(r)};da.prototype.getElements=function(){return this._queue};da.prototype.getElementPriority=function(r){return this._priorities[r]};da.prototype.getPriorities=function(){return this._priorities};da.prototype.getElementsWithPriorities=function(){for(var r=[],t=0,e=this._queue.length;t<e;t++)r.push([this._queue[t],this._priorities[t]]);return r};da.prototype._init=function(r,t,e){if(r&&t){if(this._queue=[],this._priorities=[],r.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<r.length;o++)this.insert(r[o],t[o])}e&&(this._sorting=e)};da.prototype._insertAt=function(r,t,e){this._queue.length===e?(this._queue.push(r),this._priorities.push(t)):(this._queue.splice(e,0,r),this._priorities.splice(e,0,t))};typeof Bp!="undefined"&&Bp.exports&&(Bp.exports=da)});var Kw=ye((zW,_c)=>{typeof _c!="undefined"&&_c.exports&&(Jw=B0());var Jw;function Za(r,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,t,e,o)}Za.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,c=this.dataset.length;a<c;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var p=this.clusters.length-1;this._orderedList.push(a);var d=new Jw(null,null,"asc"),g=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,g,d),this._expandCluster(p,d))}return this.clusters};Za.prototype.getReachabilityPlot=function(){for(var r=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],a=this._reachability[o];r.push([o,a])}return r};Za.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Za.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var c=o.distance(o.dataset[r],o.dataset[a]),p=Math.max(o._coreDistance,c);o._reachability[a]===void 0?(o._reachability[a]=p,e.insert(a,p)):p<o._reachability[a]&&(o._reachability[a]=p,e.remove(a),e.insert(a,p))}})};Za.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var c=e[o];if(this._processed[c]===void 0){var p=this._regionQuery(c);this._processed[c]=1,this.clusters[r].push(c),this._orderedList.push(c),this._distanceToCore(c)!==void 0&&(this._updateQueue(c,p,t),this._expandCluster(r,t))}}};Za.prototype._distanceToCore=function(r){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(r,e);if(o.length>=this.minPts)return e}};Za.prototype._regionQuery=function(r,t){t=t||this.epsilon;for(var e=[],o=0,a=this.dataset.length;o<a;o++)this.distance(this.dataset[r],this.dataset[o])<t&&e.push(o);return e};Za.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof _c!="undefined"&&_c.exports&&(_c.exports=Za)});var Qw=ye((kW,zp)=>{typeof zp!="undefined"&&zp.exports&&(zp.exports={DBSCAN:$w(),KMEANS:Zw(),OPTICS:Kw(),PriorityQueue:B0()})});var z0=ye((XW,tM)=>{"use strict";tM.exports={eudist:function(t,e,o){for(var a=t.length,c=0,p=0;p<a;p++){var d=(t[p]||0)-(e[p]||0);c+=d*d}return o?Math.sqrt(c):c},mandist:function(t,e,o){for(var a=t.length,c=0,p=0;p<a;p++)c+=Math.abs((t[p]||0)-(e[p]||0));return o?Math.sqrt(c):c},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var rM=ye((YW,nM)=>{"use strict";var eM=z0(),VU=eM.eudist,WU=eM.dist;nM.exports={kmrand:function(t,e){for(var o={},a=[],c=e<<2,p=t.length,d=t[0].length>0;a.length<e&&c-- >0;){var g=t[Math.floor(Math.random()*p)],y=d?g.join("_"):""+g;o[y]||(o[y]=!0,a.push(g))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?VU:WU,a=[],c=t.length,p=t[0].length>0,d={},g=t[Math.floor(Math.random()*c)],y=p?g.join("_"):""+g;for(a.push(g),d[y]=!0;a.length<e;){for(var _=[],w=a.length,x=0,T=[],C=0;C<c;C++){for(var I=1/0,M=0;M<w;M++){var E=o(t[C],a[M]);E<=I&&(I=E)}_[C]=I}for(var L=0;L<c;L++)x+=_[L];for(var A=0;A<c;A++)T[A]={i:A,v:t[A],pr:_[A]/x,cs:0};T.sort(function(X,U){return X.pr-U.pr}),T[0].cs=T[0].pr;for(var z=1;z<c;z++)T[z].cs=T[z-1].cs+T[z].pr;for(var G=Math.random(),Y=0;Y<c-1&&T[Y++].cs<G;);a.push(T[Y-1].v)}return a}}});var uM=ye((JW,aM)=>{"use strict";var k0=z0(),sM=rM(),qU=k0.eudist,$W=k0.mandist,ZW=k0.dist,XU=sM.kmrand,YU=sM.kmpp,iM=1e4;function oM(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function $U(r,t,e,o){var a=[],c=[],p=[],d=[],g=!1,y=o||iM,_=r.length,w=r[0].length,x=w>0,T=[];if(e)e=="kmrand"?a=XU(r,t):e=="kmpp"?a=YU(r,t):a=e;else for(var C={};a.length<t;){var I=Math.floor(Math.random()*_);C[I]||(C[I]=!0,a.push(r[I]))}do{oM(t,0,T);for(var M=0;M<_;M++){for(var E=1/0,L=0,A=0;A<t;A++){var d=x?qU(r[M],a[A]):Math.abs(r[M]-a[A]);d<=E&&(E=d,L=A)}p[M]=L,T[L]++}for(var z=[],c=[],G=0,Y=0;Y<t;Y++)z[Y]=x?oM(w,0,z[Y]):0,c[Y]=a[Y];if(x){for(var X=0;X<t;X++)a[X]=[];for(var U=0;U<_;U++)for(var H=p[U],Q=z[H],gt=r[U],$=0;$<w;$++)Q[$]+=gt[$];g=!0;for(var Nt=0;Nt<t;Nt++){for(var j=a[Nt],pt=z[Nt],Ct=c[Nt],Tt=T[Nt],ft=0;ft<w;ft++)j[ft]=pt[ft]/Tt||0;if(g){for(var dt=0;dt<w;dt++)if(Ct[dt]!=j[dt]){g=!1;break}}}}else{for(var Z=0;Z<_;Z++){var st=p[Z];z[st]+=r[Z]}for(var vt=0;vt<t;vt++)a[vt]=z[vt]/T[vt]||0;g=!0;for(var zt=0;zt<t;zt++)if(c[zt]!=a[zt]){g=!1;break}}g=g||--y<=0}while(!g);return{it:iM-y,k:t,idxs:p,centroids:a}}aM.exports=$U});var Sc=ye((X0,Y0)=>{(function(r,t){typeof X0=="object"&&typeof Y0!="undefined"?Y0.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(X0,function(){"use strict";function r(it,B){if(!(it instanceof B))throw new TypeError("Cannot call a class as a function")}function t(it,B){for(var P=0;P<B.length;P++){var F=B[P];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(it,F.key,F)}}function e(it,B,P){return B&&t(it.prototype,B),P&&t(it,P),it}var o=function(){function it(B,P){this.next=null,this.key=B,this.data=P,this.left=null,this.right=null}return it}();function a(it,B){return it>B?1:it<B?-1:0}function c(it,B,P){for(var F=new o(null,null),J=F,rt=F;;){var D=P(it,B.key);if(D<0){if(B.left===null)break;if(P(it,B.left.key)<0){var N=B.left;if(B.left=N.right,N.right=B,B=N,B.left===null)break}rt.left=B,rt=B,B=B.left}else if(D>0){if(B.right===null)break;if(P(it,B.right.key)>0){var N=B.right;if(B.right=N.left,N.left=B,B=N,B.right===null)break}J.right=B,J=B,B=B.right}else break}return J.right=B.left,rt.left=B.right,B.left=F.right,B.right=F.left,B}function p(it,B,P,F){var J=new o(it,B);if(P===null)return J.left=J.right=null,J;P=c(it,P,F);var rt=F(it,P.key);return rt<0?(J.left=P.left,J.right=P,P.left=null):rt>=0&&(J.right=P.right,J.left=P,P.right=null),J}function d(it,B,P){var F=null,J=null;if(B){B=c(it,B,P);var rt=P(B.key,it);rt===0?(F=B.left,J=B.right):rt<0?(J=B.right,B.right=null,F=B):(F=B.left,B.left=null,J=B)}return{left:F,right:J}}function g(it,B,P){return B===null?it:(it===null||(B=c(it.key,B,P),B.left=it),B)}function y(it,B,P,F,J){if(it){F(""+B+(P?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+J(it)+\`
|
|
107
107
|
\`);var rt=B+(P?" ":"\\u2502 ");it.left&&y(it.left,rt,!1,F,J),it.right&&y(it.right,rt,!0,F,J)}}var _=function(){function it(B){B===void 0&&(B=a),this._root=null,this._size=0,this._comparator=B}return it.prototype.insert=function(B,P){return this._size++,this._root=p(B,P,this._root,this._comparator)},it.prototype.add=function(B,P){var F=new o(B,P);this._root===null&&(F.left=F.right=null,this._size++,this._root=F);var J=this._comparator,rt=c(B,this._root,J),D=J(B,rt.key);return D===0?this._root=rt:(D<0?(F.left=rt.left,F.right=rt,rt.left=null):D>0&&(F.right=rt.right,F.left=rt,rt.right=null),this._size++,this._root=F),this._root},it.prototype.remove=function(B){this._root=this._remove(B,this._root,this._comparator)},it.prototype._remove=function(B,P,F){var J;if(P===null)return null;P=c(B,P,F);var rt=F(B,P.key);return rt===0?(P.left===null?J=P.right:(J=c(B,P.left,F),J.right=P.right),this._size--,J):P},it.prototype.pop=function(){var B=this._root;if(B){for(;B.left;)B=B.left;return this._root=c(B.key,this._root,this._comparator),this._root=this._remove(B.key,this._root,this._comparator),{key:B.key,data:B.data}}return null},it.prototype.findStatic=function(B){for(var P=this._root,F=this._comparator;P;){var J=F(B,P.key);if(J===0)return P;J<0?P=P.left:P=P.right}return null},it.prototype.find=function(B){return this._root&&(this._root=c(B,this._root,this._comparator),this._comparator(B,this._root.key)!==0)?null:this._root},it.prototype.contains=function(B){for(var P=this._root,F=this._comparator;P;){var J=F(B,P.key);if(J===0)return!0;J<0?P=P.left:P=P.right}return!1},it.prototype.forEach=function(B,P){for(var F=this._root,J=[],rt=!1;!rt;)F!==null?(J.push(F),F=F.left):J.length!==0?(F=J.pop(),B.call(P,F),F=F.right):rt=!0;return this},it.prototype.range=function(B,P,F,J){for(var rt=[],D=this._comparator,N=this._root,W;rt.length!==0||N;)if(N)rt.push(N),N=N.left;else{if(N=rt.pop(),W=D(N.key,P),W>0)break;if(D(N.key,B)>=0&&F.call(J,N))return this;N=N.right}return this},it.prototype.keys=function(){var B=[];return this.forEach(function(P){var F=P.key;return B.push(F)}),B},it.prototype.values=function(){var B=[];return this.forEach(function(P){var F=P.data;return B.push(F)}),B},it.prototype.min=function(){return this._root?this.minNode(this._root).key:null},it.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},it.prototype.minNode=function(B){if(B===void 0&&(B=this._root),B)for(;B.left;)B=B.left;return B},it.prototype.maxNode=function(B){if(B===void 0&&(B=this._root),B)for(;B.right;)B=B.right;return B},it.prototype.at=function(B){for(var P=this._root,F=!1,J=0,rt=[];!F;)if(P)rt.push(P),P=P.left;else if(rt.length>0){if(P=rt.pop(),J===B)return P;J++,P=P.right}else F=!0;return null},it.prototype.next=function(B){var P=this._root,F=null;if(B.right){for(F=B.right;F.left;)F=F.left;return F}for(var J=this._comparator;P;){var rt=J(B.key,P.key);if(rt===0)break;rt<0?(F=P,P=P.left):P=P.right}return F},it.prototype.prev=function(B){var P=this._root,F=null;if(B.left!==null){for(F=B.left;F.right;)F=F.right;return F}for(var J=this._comparator;P;){var rt=J(B.key,P.key);if(rt===0)break;rt<0?P=P.left:(F=P,P=P.right)}return F},it.prototype.clear=function(){return this._root=null,this._size=0,this},it.prototype.toList=function(){return T(this._root)},it.prototype.load=function(B,P,F){P===void 0&&(P=[]),F===void 0&&(F=!1);var J=B.length,rt=this._comparator;if(F&&M(B,P,0,J-1,rt),this._root===null)this._root=w(B,P,0,J),this._size=J;else{var D=I(this.toList(),x(B,P),rt);J=this._size+J,this._root=C({head:D},0,J)}return this},it.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(it.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(it.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),it.prototype.toString=function(B){B===void 0&&(B=function(J){return String(J.key)});var P=[];return y(this._root,"",!0,function(F){return P.push(F)},B),P.join("")},it.prototype.update=function(B,P,F){var J=this._comparator,rt=d(B,this._root,J),D=rt.left,N=rt.right;J(B,P)<0?N=p(P,F,N,J):D=p(P,F,D,J),this._root=g(D,N,J)},it.prototype.split=function(B){return d(B,this._root,this._comparator)},it}();function w(it,B,P,F){var J=F-P;if(J>0){var rt=P+Math.floor(J/2),D=it[rt],N=B[rt],W=new o(D,N);return W.left=w(it,B,P,rt),W.right=w(it,B,rt+1,F),W}return null}function x(it,B){for(var P=new o(null,null),F=P,J=0;J<it.length;J++)F=F.next=new o(it[J],B[J]);return F.next=null,P.next}function T(it){for(var B=it,P=[],F=!1,J=new o(null,null),rt=J;!F;)B?(P.push(B),B=B.left):P.length>0?(B=rt=rt.next=P.pop(),B=B.right):F=!0;return rt.next=null,J.next}function C(it,B,P){var F=P-B;if(F>0){var J=B+Math.floor(F/2),rt=C(it,B,J),D=it.head;return D.left=rt,it.head=it.head.next,D.right=C(it,J+1,P),D}return null}function I(it,B,P){for(var F=new o(null,null),J=F,rt=it,D=B;rt!==null&&D!==null;)P(rt.key,D.key)<0?(J.next=rt,rt=rt.next):(J.next=D,D=D.next),J=J.next;return rt!==null?J.next=rt:D!==null&&(J.next=D),F.next}function M(it,B,P,F,J){if(!(P>=F)){for(var rt=it[P+F>>1],D=P-1,N=F+1;;){do D++;while(J(it[D],rt)<0);do N--;while(J(it[N],rt)>0);if(D>=N)break;var W=it[D];it[D]=it[N],it[N]=W,W=B[D],B[D]=B[N],B[N]=W}M(it,B,P,N,J),M(it,B,N+1,F,J)}}var E=function(B,P){return B.ll.x<=P.x&&P.x<=B.ur.x&&B.ll.y<=P.y&&P.y<=B.ur.y},L=function(B,P){if(P.ur.x<B.ll.x||B.ur.x<P.ll.x||P.ur.y<B.ll.y||B.ur.y<P.ll.y)return null;var F=B.ll.x<P.ll.x?P.ll.x:B.ll.x,J=B.ur.x<P.ur.x?B.ur.x:P.ur.x,rt=B.ll.y<P.ll.y?P.ll.y:B.ll.y,D=B.ur.y<P.ur.y?B.ur.y:P.ur.y;return{ll:{x:F,y:rt},ur:{x:J,y:D}}},A=Number.EPSILON;A===void 0&&(A=Math.pow(2,-52));var z=A*A,G=function(B,P){if(-A<B&&B<A&&-A<P&&P<A)return 0;var F=B-P;return F*F<z*B*P?0:B<P?-1:1},Y=function(){function it(){r(this,it),this.reset()}return e(it,[{key:"reset",value:function(){this.xRounder=new X,this.yRounder=new X}},{key:"round",value:function(P,F){return{x:this.xRounder.round(P),y:this.yRounder.round(F)}}}]),it}(),X=function(){function it(){r(this,it),this.tree=new _,this.round(0)}return e(it,[{key:"round",value:function(P){var F=this.tree.add(P),J=this.tree.prev(F);if(J!==null&&G(F.key,J.key)===0)return this.tree.remove(P),J.key;var rt=this.tree.next(F);return rt!==null&&G(F.key,rt.key)===0?(this.tree.remove(P),rt.key):P}}]),it}(),U=new Y,H=function(B,P){return B.x*P.y-B.y*P.x},Q=function(B,P){return B.x*P.x+B.y*P.y},gt=function(B,P,F){var J={x:P.x-B.x,y:P.y-B.y},rt={x:F.x-B.x,y:F.y-B.y},D=H(J,rt);return G(D,0)},$=function(B){return Math.sqrt(Q(B,B))},Nt=function(B,P,F){var J={x:P.x-B.x,y:P.y-B.y},rt={x:F.x-B.x,y:F.y-B.y};return H(rt,J)/$(rt)/$(J)},j=function(B,P,F){var J={x:P.x-B.x,y:P.y-B.y},rt={x:F.x-B.x,y:F.y-B.y};return Q(rt,J)/$(rt)/$(J)},pt=function(B,P,F){return P.y===0?null:{x:B.x+P.x/P.y*(F-B.y),y:F}},Ct=function(B,P,F){return P.x===0?null:{x:F,y:B.y+P.y/P.x*(F-B.x)}},Tt=function(B,P,F,J){if(P.x===0)return Ct(F,J,B.x);if(J.x===0)return Ct(B,P,F.x);if(P.y===0)return pt(F,J,B.y);if(J.y===0)return pt(B,P,F.y);var rt=H(P,J);if(rt==0)return null;var D={x:F.x-B.x,y:F.y-B.y},N=H(D,P)/rt,W=H(D,J)/rt,xt=B.x+W*P.x,wt=F.x+N*J.x,lt=B.y+W*P.y,Bt=F.y+N*J.y,Lt=(xt+wt)/2,Ut=(lt+Bt)/2;return{x:Lt,y:Ut}},ft=function(){e(it,null,[{key:"compare",value:function(P,F){var J=it.comparePoints(P.point,F.point);return J!==0?J:(P.point!==F.point&&P.link(F),P.isLeft!==F.isLeft?P.isLeft?1:-1:Z.compare(P.segment,F.segment))}},{key:"comparePoints",value:function(P,F){return P.x<F.x?-1:P.x>F.x?1:P.y<F.y?-1:P.y>F.y?1:0}}]);function it(B,P){r(this,it),B.events===void 0?B.events=[this]:B.events.push(this),this.point=B,this.isLeft=P}return e(it,[{key:"link",value:function(P){if(P.point===this.point)throw new Error("Tried to link already linked events");for(var F=P.point.events,J=0,rt=F.length;J<rt;J++){var D=F[J];this.point.events.push(D),D.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var P=this.point.events.length,F=0;F<P;F++){var J=this.point.events[F];if(J.segment.consumedBy===void 0)for(var rt=F+1;rt<P;rt++){var D=this.point.events[rt];D.consumedBy===void 0&&J.otherSE.point.events===D.otherSE.point.events&&J.segment.consume(D.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var P=[],F=0,J=this.point.events.length;F<J;F++){var rt=this.point.events[F];rt!==this&&!rt.segment.ringOut&&rt.segment.isInResult()&&P.push(rt)}return P}},{key:"getLeftmostComparator",value:function(P){var F=this,J=new Map,rt=function(N){var W=N.otherSE;J.set(N,{sine:Nt(F.point,P.point,W.point),cosine:j(F.point,P.point,W.point)})};return function(D,N){J.has(D)||rt(D),J.has(N)||rt(N);var W=J.get(D),xt=W.sine,wt=W.cosine,lt=J.get(N),Bt=lt.sine,Lt=lt.cosine;return xt>=0&&Bt>=0?wt<Lt?1:wt>Lt?-1:0:xt<0&&Bt<0?wt<Lt?-1:wt>Lt?1:0:Bt<xt?-1:Bt>xt?1:0}}}]),it}(),dt=0,Z=function(){e(it,null,[{key:"compare",value:function(P,F){var J=P.leftSE.point.x,rt=F.leftSE.point.x,D=P.rightSE.point.x,N=F.rightSE.point.x;if(N<J)return 1;if(D<rt)return-1;var W=P.leftSE.point.y,xt=F.leftSE.point.y,wt=P.rightSE.point.y,lt=F.rightSE.point.y;if(J<rt){if(xt<W&&xt<wt)return 1;if(xt>W&&xt>wt)return-1;var Bt=P.comparePoint(F.leftSE.point);if(Bt<0)return 1;if(Bt>0)return-1;var Lt=F.comparePoint(P.rightSE.point);return Lt!==0?Lt:-1}if(J>rt){if(W<xt&&W<lt)return-1;if(W>xt&&W>lt)return 1;var Ut=F.comparePoint(P.leftSE.point);if(Ut!==0)return Ut;var Xt=P.comparePoint(F.rightSE.point);return Xt<0?1:Xt>0?-1:1}if(W<xt)return-1;if(W>xt)return 1;if(D<N){var de=F.comparePoint(P.rightSE.point);if(de!==0)return de}if(D>N){var Ft=P.comparePoint(F.rightSE.point);if(Ft<0)return 1;if(Ft>0)return-1}if(D!==N){var Se=wt-W,xe=D-J,he=lt-xt,Jt=N-rt;if(Se>xe&&he<Jt)return 1;if(Se<xe&&he>Jt)return-1}return D>N?1:D<N||wt<lt?-1:wt>lt?1:P.id<F.id?-1:P.id>F.id?1:0}}]);function it(B,P,F,J){r(this,it),this.id=++dt,this.leftSE=B,B.segment=this,B.otherSE=P,this.rightSE=P,P.segment=this,P.otherSE=B,this.rings=F,this.windings=J}return e(it,[{key:"replaceRightSE",value:function(P){this.rightSE=P,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var P=this.leftSE.point.y,F=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:P<F?P:F},ur:{x:this.rightSE.point.x,y:P>F?P:F}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(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}},{key:"comparePoint",value:function(P){if(this.isAnEndpoint(P))return 0;var F=this.leftSE.point,J=this.rightSE.point,rt=this.vector();if(F.x===J.x)return P.x===F.x?0:P.x<F.x?1:-1;var D=(P.y-F.y)/rt.y,N=F.x+D*rt.x;if(P.x===N)return 0;var W=(P.x-F.x)/rt.x,xt=F.y+W*rt.y;return P.y===xt?0:P.y<xt?-1:1}},{key:"getIntersection",value:function(P){var F=this.bbox(),J=P.bbox(),rt=L(F,J);if(rt===null)return null;var D=this.leftSE.point,N=this.rightSE.point,W=P.leftSE.point,xt=P.rightSE.point,wt=E(F,W)&&this.comparePoint(W)===0,lt=E(J,D)&&P.comparePoint(D)===0,Bt=E(F,xt)&&this.comparePoint(xt)===0,Lt=E(J,N)&&P.comparePoint(N)===0;if(lt&&wt)return Lt&&!Bt?N:!Lt&&Bt?xt:null;if(lt)return Bt&&D.x===xt.x&&D.y===xt.y?null:D;if(wt)return Lt&&N.x===W.x&&N.y===W.y?null:W;if(Lt&&Bt)return null;if(Lt)return N;if(Bt)return xt;var Ut=Tt(D,this.vector(),W,P.vector());return Ut===null||!E(rt,Ut)?null:U.round(Ut.x,Ut.y)}},{key:"split",value:function(P){var F=[],J=P.events!==void 0,rt=new ft(P,!0),D=new ft(P,!1),N=this.rightSE;this.replaceRightSE(D),F.push(D),F.push(rt);var W=new it(rt,N,this.rings.slice(),this.windings.slice());return ft.comparePoints(W.leftSE.point,W.rightSE.point)>0&&W.swapEvents(),ft.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),J&&(rt.checkForConsuming(),D.checkForConsuming()),F}},{key:"swapEvents",value:function(){var P=this.rightSE;this.rightSE=this.leftSE,this.leftSE=P,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var F=0,J=this.windings.length;F<J;F++)this.windings[F]*=-1}},{key:"consume",value:function(P){for(var F=this,J=P;F.consumedBy;)F=F.consumedBy;for(;J.consumedBy;)J=J.consumedBy;var rt=it.compare(F,J);if(rt!==0){if(rt>0){var D=F;F=J,J=D}if(F.prev===J){var N=F;F=J,J=N}for(var W=0,xt=J.rings.length;W<xt;W++){var wt=J.rings[W],lt=J.windings[W],Bt=F.rings.indexOf(wt);Bt===-1?(F.rings.push(wt),F.windings.push(lt)):F.windings[Bt]+=lt}J.rings=null,J.windings=null,J.consumedBy=F,J.leftSE.consumedBy=F.leftSE,J.rightSE.consumedBy=F.rightSE}}},{key:"prevInResult",value:function(){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)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var P=this.prev.consumedBy||this.prev;this._beforeState=P.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var P=this.beforeState();this._afterState={rings:P.rings.slice(0),windings:P.windings.slice(0),multiPolys:[]};for(var F=this._afterState.rings,J=this._afterState.windings,rt=this._afterState.multiPolys,D=0,N=this.rings.length;D<N;D++){var W=this.rings[D],xt=this.windings[D],wt=F.indexOf(W);wt===-1?(F.push(W),J.push(xt)):J[wt]+=xt}for(var lt=[],Bt=[],Lt=0,Ut=F.length;Lt<Ut;Lt++)if(J[Lt]!==0){var Xt=F[Lt],de=Xt.poly;if(Bt.indexOf(de)===-1)if(Xt.isExterior)lt.push(de);else{Bt.indexOf(de)===-1&&Bt.push(de);var Ft=lt.indexOf(Xt.poly);Ft!==-1&<.splice(Ft,1)}}for(var Se=0,xe=lt.length;Se<xe;Se++){var he=lt[Se].multiPoly;rt.indexOf(he)===-1&&rt.push(he)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var P=this.beforeState().multiPolys,F=this.afterState().multiPolys;switch(pe.type){case"union":{var J=P.length===0,rt=F.length===0;this._isInResult=J!==rt;break}case"intersection":{var D,N;P.length<F.length?(D=P.length,N=F.length):(D=F.length,N=P.length),this._isInResult=N===pe.numMultiPolys&&D<N;break}case"xor":{var W=Math.abs(P.length-F.length);this._isInResult=W%2===1;break}case"difference":{var xt=function(lt){return lt.length===1&<[0].isSubject};this._isInResult=xt(P)!==xt(F);break}default:throw new Error("Unrecognized operation type found ".concat(pe.type))}return this._isInResult}}],[{key:"fromRing",value:function(P,F,J){var rt,D,N,W=ft.comparePoints(P,F);if(W<0)rt=P,D=F,N=1;else if(W>0)rt=F,D=P,N=-1;else throw new Error("Tried to create degenerate segment at [".concat(P.x,", ").concat(P.y,"]"));var xt=new ft(rt,!0),wt=new ft(D,!1);return new it(xt,wt,[J],[N])}}]),it}(),st=function(){function it(B,P,F){if(r(this,it),!Array.isArray(B)||B.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=P,this.isExterior=F,this.segments=[],typeof B[0][0]!="number"||typeof B[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var J=U.round(B[0][0],B[0][1]);this.bbox={ll:{x:J.x,y:J.y},ur:{x:J.x,y:J.y}};for(var rt=J,D=1,N=B.length;D<N;D++){if(typeof B[D][0]!="number"||typeof B[D][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var W=U.round(B[D][0],B[D][1]);W.x===rt.x&&W.y===rt.y||(this.segments.push(Z.fromRing(rt,W,this)),W.x<this.bbox.ll.x&&(this.bbox.ll.x=W.x),W.y<this.bbox.ll.y&&(this.bbox.ll.y=W.y),W.x>this.bbox.ur.x&&(this.bbox.ur.x=W.x),W.y>this.bbox.ur.y&&(this.bbox.ur.y=W.y),rt=W)}(J.x!==rt.x||J.y!==rt.y)&&this.segments.push(Z.fromRing(rt,J,this))}return e(it,[{key:"getSweepEvents",value:function(){for(var P=[],F=0,J=this.segments.length;F<J;F++){var rt=this.segments[F];P.push(rt.leftSE),P.push(rt.rightSE)}return P}}]),it}(),vt=function(){function it(B,P){if(r(this,it),!Array.isArray(B))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new st(B[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(var F=1,J=B.length;F<J;F++){var rt=new st(B[F],this,!1);rt.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=rt.bbox.ll.x),rt.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=rt.bbox.ll.y),rt.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=rt.bbox.ur.x),rt.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=rt.bbox.ur.y),this.interiorRings.push(rt)}this.multiPoly=P}return e(it,[{key:"getSweepEvents",value:function(){for(var P=this.exteriorRing.getSweepEvents(),F=0,J=this.interiorRings.length;F<J;F++)for(var rt=this.interiorRings[F].getSweepEvents(),D=0,N=rt.length;D<N;D++)P.push(rt[D]);return P}}]),it}(),zt=function(){function it(B,P){if(r(this,it),!Array.isArray(B))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof B[0][0][0]=="number"&&(B=[B])}catch(D){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var F=0,J=B.length;F<J;F++){var rt=new vt(B[F],this);rt.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=rt.bbox.ll.x),rt.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=rt.bbox.ll.y),rt.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=rt.bbox.ur.x),rt.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=rt.bbox.ur.y),this.polys.push(rt)}this.isSubject=P}return e(it,[{key:"getSweepEvents",value:function(){for(var P=[],F=0,J=this.polys.length;F<J;F++)for(var rt=this.polys[F].getSweepEvents(),D=0,N=rt.length;D<N;D++)P.push(rt[D]);return P}}]),it}(),bt=function(){e(it,null,[{key:"factory",value:function(P){for(var F=[],J=0,rt=P.length;J<rt;J++){var D=P[J];if(!(!D.isInResult()||D.ringOut)){for(var N=null,W=D.leftSE,xt=D.rightSE,wt=[W],lt=W.point,Bt=[];N=W,W=xt,wt.push(W),W.point!==lt;)for(;;){var Lt=W.getAvailableLinkedEvents();if(Lt.length===0){var Ut=wt[0].point,Xt=wt[wt.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(Ut.x,",")+" ".concat(Ut.y,"]. Last matching segment found ends at")+" [".concat(Xt.x,", ").concat(Xt.y,"]."))}if(Lt.length===1){xt=Lt[0].otherSE;break}for(var de=null,Ft=0,Se=Bt.length;Ft<Se;Ft++)if(Bt[Ft].point===W.point){de=Ft;break}if(de!==null){var xe=Bt.splice(de)[0],he=wt.splice(xe.index);he.unshift(he[0].otherSE),F.push(new it(he.reverse()));continue}Bt.push({index:wt.length,point:W.point});var Jt=W.getLeftmostComparator(N);xt=Lt.sort(Jt)[0].otherSE;break}F.push(new it(wt))}}return F}}]);function it(B){r(this,it),this.events=B;for(var P=0,F=B.length;P<F;P++)B[P].segment.ringOut=this;this.poly=null}return e(it,[{key:"getGeom",value:function(){for(var P=this.events[0].point,F=[P],J=1,rt=this.events.length-1;J<rt;J++){var D=this.events[J].point,N=this.events[J+1].point;gt(D,P,N)!==0&&(F.push(D),P=D)}if(F.length===1)return null;var W=F[0],xt=F[1];gt(W,P,xt)===0&&F.shift(),F.push(F[0]);for(var wt=this.isExteriorRing()?1:-1,lt=this.isExteriorRing()?0:F.length-1,Bt=this.isExteriorRing()?F.length:-1,Lt=[],Ut=lt;Ut!=Bt;Ut+=wt)Lt.push([F[Ut].x,F[Ut].y]);return Lt}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var P=this.enclosingRing();this._isExteriorRing=P?!P.isExteriorRing():!0}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var P=this.events[0],F=1,J=this.events.length;F<J;F++){var rt=this.events[F];ft.compare(P,rt)>0&&(P=rt)}for(var D=P.segment.prevInResult(),N=D?D.prevInResult():null;;){if(!D)return null;if(!N)return D.ringOut;if(N.ringOut!==D.ringOut)return N.ringOut.enclosingRing()!==D.ringOut?D.ringOut:D.ringOut.enclosingRing();D=N.prevInResult(),N=D?D.prevInResult():null}}}]),it}(),qt=function(){function it(B){r(this,it),this.exteriorRing=B,B.poly=this,this.interiorRings=[]}return e(it,[{key:"addInterior",value:function(P){this.interiorRings.push(P),P.poly=this}},{key:"getGeom",value:function(){var P=[this.exteriorRing.getGeom()];if(P[0]===null)return null;for(var F=0,J=this.interiorRings.length;F<J;F++){var rt=this.interiorRings[F].getGeom();rt!==null&&P.push(rt)}return P}}]),it}(),le=function(){function it(B){r(this,it),this.rings=B,this.polys=this._composePolys(B)}return e(it,[{key:"getGeom",value:function(){for(var P=[],F=0,J=this.polys.length;F<J;F++){var rt=this.polys[F].getGeom();rt!==null&&P.push(rt)}return P}},{key:"_composePolys",value:function(P){for(var F=[],J=0,rt=P.length;J<rt;J++){var D=P[J];if(!D.poly)if(D.isExteriorRing())F.push(new qt(D));else{var N=D.enclosingRing();N.poly||F.push(new qt(N)),N.poly.addInterior(D)}}return F}}]),it}(),se=function(){function it(B){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Z.compare;r(this,it),this.queue=B,this.tree=new _(P),this.segments=[]}return e(it,[{key:"process",value:function(P){var F=P.segment,J=[];if(P.consumedBy)return P.isLeft?this.queue.remove(P.otherSE):this.tree.remove(F),J;var rt=P.isLeft?this.tree.insert(F):this.tree.find(F);if(!rt)throw new Error("Unable to find segment #".concat(F.id," ")+"[".concat(F.leftSE.point.x,", ").concat(F.leftSE.point.y,"] -> ")+"[".concat(F.rightSE.point.x,", ").concat(F.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var D=rt,N=rt,W=void 0,xt=void 0;W===void 0;)D=this.tree.prev(D),D===null?W=null:D.key.consumedBy===void 0&&(W=D.key);for(;xt===void 0;)N=this.tree.next(N),N===null?xt=null:N.key.consumedBy===void 0&&(xt=N.key);if(P.isLeft){var wt=null;if(W){var lt=W.getIntersection(F);if(lt!==null&&(F.isAnEndpoint(lt)||(wt=lt),!W.isAnEndpoint(lt)))for(var Bt=this._splitSafely(W,lt),Lt=0,Ut=Bt.length;Lt<Ut;Lt++)J.push(Bt[Lt])}var Xt=null;if(xt){var de=xt.getIntersection(F);if(de!==null&&(F.isAnEndpoint(de)||(Xt=de),!xt.isAnEndpoint(de)))for(var Ft=this._splitSafely(xt,de),Se=0,xe=Ft.length;Se<xe;Se++)J.push(Ft[Se])}if(wt!==null||Xt!==null){var he=null;if(wt===null)he=Xt;else if(Xt===null)he=wt;else{var Jt=ft.comparePoints(wt,Xt);he=Jt<=0?wt:Xt}this.queue.remove(F.rightSE),J.push(F.rightSE);for(var et=F.split(he),kt=0,ct=et.length;kt<ct;kt++)J.push(et[kt])}J.length>0?(this.tree.remove(F),J.push(P)):(this.segments.push(F),F.prev=W)}else{if(W&&xt){var jt=W.getIntersection(xt);if(jt!==null){if(!W.isAnEndpoint(jt))for(var Kt=this._splitSafely(W,jt),Mt=0,me=Kt.length;Mt<me;Mt++)J.push(Kt[Mt]);if(!xt.isAnEndpoint(jt))for(var be=this._splitSafely(xt,jt),Jn=0,$e=be.length;Jn<$e;Jn++)J.push(be[Jn])}}this.tree.remove(F)}return J}},{key:"_splitSafely",value:function(P,F){this.tree.remove(P);var J=P.rightSE;this.queue.remove(J);var rt=P.split(F);return rt.push(J),P.consumedBy===void 0&&this.tree.insert(P),rt}}]),it}(),Zt=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,_e=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Vt=function(){function it(){r(this,it)}return e(it,[{key:"run",value:function(P,F,J){pe.type=P,U.reset();for(var rt=[new zt(F,!0)],D=0,N=J.length;D<N;D++)rt.push(new zt(J[D],!1));if(pe.numMultiPolys=rt.length,pe.type==="difference")for(var W=rt[0],xt=1;xt<rt.length;)L(rt[xt].bbox,W.bbox)!==null?xt++:rt.splice(xt,1);if(pe.type==="intersection"){for(var wt=0,lt=rt.length;wt<lt;wt++)for(var Bt=rt[wt],Lt=wt+1,Ut=rt.length;Lt<Ut;Lt++)if(L(Bt.bbox,rt[Lt].bbox)===null)return[]}for(var Xt=new _(ft.compare),de=0,Ft=rt.length;de<Ft;de++)for(var Se=rt[de].getSweepEvents(),xe=0,he=Se.length;xe<he;xe++)if(Xt.insert(Se[xe]),Xt.size>Zt)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var Jt=new se(Xt),et=Xt.size,kt=Xt.pop();kt;){var ct=kt.key;if(Xt.size===et){var jt=ct.segment;throw new Error("Unable to pop() ".concat(ct.isLeft?"left":"right"," SweepEvent ")+"[".concat(ct.point.x,", ").concat(ct.point.y,"] from segment #").concat(jt.id," ")+"[".concat(jt.leftSE.point.x,", ").concat(jt.leftSE.point.y,"] -> ")+"[".concat(jt.rightSE.point.x,", ").concat(jt.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(Xt.size>Zt)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(Jt.segments.length>_e)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var Kt=Jt.process(ct),Mt=0,me=Kt.length;Mt<me;Mt++){var be=Kt[Mt];be.consumedBy===void 0&&Xt.insert(be)}et=Xt.size,kt=Xt.pop()}U.reset();var Jn=bt.factory(Jt.segments),$e=new le(Jn);return $e.getGeom()}}]),it}(),pe=new Vt,at=function(B){for(var P=arguments.length,F=new Array(P>1?P-1:0),J=1;J<P;J++)F[J-1]=arguments[J];return pe.run("union",B,F)},He=function(B){for(var P=arguments.length,F=new Array(P>1?P-1:0),J=1;J<P;J++)F[J-1]=arguments[J];return pe.run("intersection",B,F)},ae=function(B){for(var P=arguments.length,F=new Array(P>1?P-1:0),J=1;J<P;J++)F[J-1]=arguments[J];return pe.run("xor",B,F)},ce=function(B){for(var P=arguments.length,F=new Array(P>1?P-1:0),J=1;J<P;J++)F[J-1]=arguments[J];return pe.run("difference",B,F)},fe={union:at,intersection:He,xor:ae,difference:ce};return fe})});var AM=ye((Vp,TM)=>{(function(r,t){typeof Vp=="object"&&typeof TM!="undefined"?t(Vp):typeof define=="function"&&define.amd?define(["exports"],t):t(r.jsts={})})(Vp,function(r){"use strict";function t(){}function e(n){this.message=n||""}function o(n){this.message=n||""}function a(n){this.message=n||""}function c(){}function p(n){return n===null?eo:n.color}function d(n){return n===null?null:n.parent}function g(n,i){n!==null&&(n.color=i)}function y(n){return n===null?null:n.left}function _(n){return n===null?null:n.right}function w(){this.root_=null,this.size_=0}function x(){}function T(){this.array_=[],arguments[0]instanceof Jt&&this.addAll(arguments[0])}function C(){}function I(n){this.message=n||""}function M(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(n){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),s=Math.max(Math.min(i.length,9007199254740991),0)||0,l=1 in arguments&&parseInt(Number(arguments[1]),10)||0;l=l<0?Math.max(s+l,0):Math.min(l,s);var h=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:s;for(h=h<0?Math.max(s+arguments[2],0):Math.min(h,s);l<h;)i[l]=n,++l;return i},writable:!0}),Number.isFinite=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},Number.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(n){return n!=n},Math.trunc=Math.trunc||function(n){return n<0?Math.ceil(n):Math.floor(n)};var E=function(){};E.prototype.interfaces_=function(){return[]},E.prototype.getClass=function(){return E},E.prototype.equalsWithTolerance=function(n,i,s){return Math.abs(n-i)<=s};var L=function(n){function i(s){n.call(this,s),this.name="IllegalArgumentException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),A=function(){},z={MAX_VALUE:{configurable:!0}};A.isNaN=function(n){return Number.isNaN(n)},A.doubleToLongBits=function(n){return n},A.longBitsToDouble=function(n){return n},A.isInfinite=function(n){return!Number.isFinite(n)},z.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(A,z);var G=function(){},Y=function(){},X=function(){},U=function n(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=n.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=n.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},H={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};U.prototype.setOrdinate=function(n,i){switch(n){case U.X:this.x=i;break;case U.Y:this.y=i;break;case U.Z:this.z=i;break;default:throw new L("Invalid ordinate index: "+n)}},U.prototype.equals2D=function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var i=arguments[0],s=arguments[1];return!!E.equalsWithTolerance(this.x,i.x,s)&&!!E.equalsWithTolerance(this.y,i.y,s)}},U.prototype.getOrdinate=function(n){switch(n){case U.X:return this.x;case U.Y:return this.y;case U.Z:return this.z}throw new L("Invalid ordinate index: "+n)},U.prototype.equals3D=function(n){return this.x===n.x&&this.y===n.y&&(this.z===n.z||A.isNaN(this.z))&&A.isNaN(n.z)},U.prototype.equals=function(n){return n instanceof U&&this.equals2D(n)},U.prototype.equalInZ=function(n,i){return E.equalsWithTolerance(this.z,n.z,i)},U.prototype.compareTo=function(n){var i=n;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0},U.prototype.clone=function(){},U.prototype.copy=function(){return new U(this)},U.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},U.prototype.distance3D=function(n){var i=this.x-n.x,s=this.y-n.y,l=this.z-n.z;return Math.sqrt(i*i+s*s+l*l)},U.prototype.distance=function(n){var i=this.x-n.x,s=this.y-n.y;return Math.sqrt(i*i+s*s)},U.prototype.hashCode=function(){var n=17;return n=37*n+U.hashCode(this.x),n=37*n+U.hashCode(this.y)},U.prototype.setCoordinate=function(n){this.x=n.x,this.y=n.y,this.z=n.z},U.prototype.interfaces_=function(){return[G,Y,t]},U.prototype.getClass=function(){return U},U.hashCode=function(){if(arguments.length===1){var n=arguments[0],i=A.doubleToLongBits(n);return Math.trunc((i^i)>>>32)}},H.DimensionalComparator.get=function(){return Q},H.serialVersionUID.get=function(){return 6683108902428367e3},H.NULL_ORDINATE.get=function(){return A.NaN},H.X.get=function(){return 0},H.Y.get=function(){return 1},H.Z.get=function(){return 2},Object.defineProperties(U,H);var Q=function(n){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var i=arguments[0];if(i!==2&&i!==3)throw new L("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};Q.prototype.compare=function(n,i){var s=n,l=i,h=Q.compare(s.x,l.x);if(h!==0)return h;var v=Q.compare(s.y,l.y);return v!==0?v:this._dimensionsToTest<=2?0:Q.compare(s.z,l.z)},Q.prototype.interfaces_=function(){return[X]},Q.prototype.getClass=function(){return Q},Q.compare=function(n,i){return n<i?-1:n>i?1:A.isNaN(n)?A.isNaN(i)?0:-1:A.isNaN(i)?1:0};var gt=function(){};gt.prototype.create=function(){},gt.prototype.interfaces_=function(){return[]},gt.prototype.getClass=function(){return gt};var $=function(){},Nt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};$.prototype.interfaces_=function(){return[]},$.prototype.getClass=function(){return $},$.toLocationSymbol=function(n){switch(n){case $.EXTERIOR:return"e";case $.BOUNDARY:return"b";case $.INTERIOR:return"i";case $.NONE:return"-"}throw new L("Unknown location value: "+n)},Nt.INTERIOR.get=function(){return 0},Nt.BOUNDARY.get=function(){return 1},Nt.EXTERIOR.get=function(){return 2},Nt.NONE.get=function(){return-1},Object.defineProperties($,Nt);var j=function(n,i){return n.interfaces_&&n.interfaces_().indexOf(i)>-1},pt=function(){},Ct={LOG_10:{configurable:!0}};pt.prototype.interfaces_=function(){return[]},pt.prototype.getClass=function(){return pt},pt.log10=function(n){var i=Math.log(n);return A.isInfinite(i)||A.isNaN(i)?i:i/pt.LOG_10},pt.min=function(n,i,s,l){var h=n;return i<h&&(h=i),s<h&&(h=s),l<h&&(h=l),h},pt.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1],s=arguments[2];return n<i?i:n>s?s:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var l=arguments[0],h=arguments[1],v=arguments[2];return l<h?h:l>v?v:l}},pt.wrap=function(n,i){return n<0?i- -n%i:n%i},pt.max=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2],l=n;return i>l&&(l=i),s>l&&(l=s),l}if(arguments.length===4){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3],V=h;return v>V&&(V=v),S>V&&(V=S),R>V&&(V=R),V}},pt.average=function(n,i){return(n+i)/2},Ct.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(pt,Ct);var Tt=function(n){this.str=n};Tt.prototype.append=function(n){this.str+=n},Tt.prototype.setCharAt=function(n,i){this.str=this.str.substr(0,n)+i+this.str.substr(n+1)},Tt.prototype.toString=function(n){return this.str};var ft=function(n){this.value=n};ft.prototype.intValue=function(){return this.value},ft.prototype.compareTo=function(n){return this.value<n?-1:this.value>n?1:0},ft.isNaN=function(n){return Number.isNaN(n)};var dt=function(){};dt.isWhitespace=function(n){return n<=32&&n>=0||n===127},dt.toUpperCase=function(n){return n.toUpperCase()};var Z=function n(){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 n){var s=arguments[0];this.init(s)}else if(typeof arguments[0]=="string"){var l=arguments[0];n.call(this,n.parse(l))}}else if(arguments.length===2){var h=arguments[0],v=arguments[1];this.init(h,v)}},st={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}};Z.prototype.le=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<=n._lo},Z.prototype.extractSignificantDigits=function(n,i){var s=this.abs(),l=Z.magnitude(s._hi),h=Z.TEN.pow(l);(s=s.divide(h)).gt(Z.TEN)?(s=s.divide(Z.TEN),l+=1):s.lt(Z.ONE)&&(s=s.multiply(Z.TEN),l-=1);for(var v=l+1,S=new Tt,R=Z.MAX_PRINT_DIGITS-1,V=0;V<=R;V++){n&&V===v&&S.append(".");var nt=Math.trunc(s._hi);if(nt<0)break;var _t=!1,Et=0;nt>9?(_t=!0,Et="9"):Et="0"+nt,S.append(Et),s=s.subtract(Z.valueOf(nt)).multiply(Z.TEN),_t&&s.selfAdd(Z.TEN);var Wt=!0,$t=Z.magnitude(s._hi);if($t<0&&Math.abs($t)>=R-V&&(Wt=!1),!Wt)break}return i[0]=l,S.toString()},Z.prototype.sqr=function(){return this.multiply(this)},Z.prototype.doubleValue=function(){return this._hi+this._lo},Z.prototype.subtract=function(){if(arguments[0]instanceof Z){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},Z.prototype.equals=function(){if(arguments.length===1){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}},Z.prototype.isZero=function(){return this._hi===0&&this._lo===0},Z.prototype.selfSubtract=function(){if(arguments[0]instanceof Z){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n._hi,-n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}},Z.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},Z.prototype.min=function(n){return this.le(n)?this:n},Z.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof Z){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1],h=null,v=null,S=null,R=null,V=null,nt=null,_t=null,Et=null;return V=this._hi/s,nt=Z.SPLIT*V,h=nt-V,Et=Z.SPLIT*s,h=nt-h,v=V-h,S=Et-s,_t=V*s,S=Et-S,R=s-S,Et=h*S-_t+h*R+v*S+v*R,nt=(this._hi-_t-Et+this._lo-V*l)/s,Et=V+nt,this._hi=Et,this._lo=V-Et+nt,this}},Z.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},Z.prototype.divide=function(){if(arguments[0]instanceof Z){var n=arguments[0],i=null,s=null,l=null,h=null,v=null,S=null,R=null,V=null;return s=(v=this._hi/n._hi)-(i=(S=Z.SPLIT*v)-(i=S-v)),V=i*(l=(V=Z.SPLIT*n._hi)-(l=V-n._hi))-(R=v*n._hi)+i*(h=n._hi-l)+s*l+s*h,S=(this._hi-R-V+this._lo-v*n._lo)/n._hi,new Z(V=v+S,v-V+S)}if(typeof arguments[0]=="number"){var nt=arguments[0];return A.isNaN(nt)?Z.createNaN():Z.copy(this).selfDivide(nt,0)}},Z.prototype.ge=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>=n._lo},Z.prototype.pow=function(n){if(n===0)return Z.valueOf(1);var i=new Z(this),s=Z.valueOf(1),l=Math.abs(n);if(l>1)for(;l>0;)l%2==1&&s.selfMultiply(i),(l/=2)>0&&(i=i.sqr());else s=i;return n<0?s.reciprocal():s},Z.prototype.ceil=function(){if(this.isNaN())return Z.NaN;var n=Math.ceil(this._hi),i=0;return n===this._hi&&(i=Math.ceil(this._lo)),new Z(n,i)},Z.prototype.compareTo=function(n){var i=n;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0},Z.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},Z.prototype.setValue=function(){if(arguments[0]instanceof Z){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},Z.prototype.max=function(n){return this.ge(n)?this:n},Z.prototype.sqrt=function(){if(this.isZero())return Z.valueOf(0);if(this.isNegative())return Z.NaN;var n=1/Math.sqrt(this._hi),i=this._hi*n,s=Z.valueOf(i),l=this.subtract(s.sqr())._hi*(.5*n);return s.add(l)},Z.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof Z){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],s=null,l=null,h=null,v=null,S=null,R=null;return h=this._hi+i,S=h-this._hi,v=h-S,v=i-S+(this._hi-v),R=v+this._lo,s=h+R,l=R+(h-s),this._hi=s+l,this._lo=l+(s-this._hi),this}}else if(arguments.length===2){var V=arguments[0],nt=arguments[1],_t=null,Et=null,Wt=null,$t=null,ie=null,Ee=null,An=null;$t=this._hi+V,Et=this._lo+nt,ie=$t-(Ee=$t-this._hi),Wt=Et-(An=Et-this._lo);var Wn=(_t=$t+(Ee=(ie=V-Ee+(this._hi-ie))+Et))+(Ee=(Wt=nt-An+(this._lo-Wt))+(Ee+($t-_t))),Qr=Ee+(_t-Wn);return this._hi=Wn,this._lo=Qr,this}},Z.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof Z){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1],h=null,v=null,S=null,R=null,V=null,nt=null;h=(V=Z.SPLIT*this._hi)-this._hi,nt=Z.SPLIT*s,h=V-h,v=this._hi-h,S=nt-s;var _t=(V=this._hi*s)+(nt=h*(S=nt-S)-V+h*(R=s-S)+v*S+v*R+(this._hi*l+this._lo*s)),Et=nt+(h=V-_t);return this._hi=_t,this._lo=Et,this}},Z.prototype.selfSqr=function(){return this.selfMultiply(this)},Z.prototype.floor=function(){if(this.isNaN())return Z.NaN;var n=Math.floor(this._hi),i=0;return n===this._hi&&(i=Math.floor(this._lo)),new Z(n,i)},Z.prototype.negate=function(){return this.isNaN()?this:new Z(-this._hi,-this._lo)},Z.prototype.clone=function(){},Z.prototype.multiply=function(){if(arguments[0]instanceof Z){var n=arguments[0];return n.isNaN()?Z.createNaN():Z.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return A.isNaN(i)?Z.createNaN():Z.copy(this).selfMultiply(i,0)}},Z.prototype.isNaN=function(){return A.isNaN(this._hi)},Z.prototype.intValue=function(){return Math.trunc(this._hi)},Z.prototype.toString=function(){var n=Z.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()},Z.prototype.toStandardNotation=function(){var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!0,i),l=i[0]+1,h=s;if(s.charAt(0)===".")h="0"+s;else if(l<0)h="0."+Z.stringOfChar("0",-l)+s;else if(s.indexOf(".")===-1){var v=l-s.length;h=s+Z.stringOfChar("0",v)+".0"}return this.isNegative()?"-"+h:h},Z.prototype.reciprocal=function(){var n=null,i=null,s=null,l=null,h=null,v=null,S=null,R=null;i=(h=1/this._hi)-(n=(v=Z.SPLIT*h)-(n=v-h)),s=(R=Z.SPLIT*this._hi)-this._hi;var V=h+(v=(1-(S=h*this._hi)-(R=n*(s=R-s)-S+n*(l=this._hi-s)+i*s+i*l)-h*this._lo)/this._hi);return new Z(V,h-V+v)},Z.prototype.toSciNotation=function(){if(this.isZero())return Z.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!1,i),l=Z.SCI_NOT_EXPONENT_CHAR+i[0];if(s.charAt(0)==="0")throw new Error("Found leading zero: "+s);var h="";s.length>1&&(h=s.substring(1));var v=s.charAt(0)+"."+h;return this.isNegative()?"-"+v+l:v+l},Z.prototype.abs=function(){return this.isNaN()?Z.NaN:this.isNegative()?this.negate():new Z(this)},Z.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},Z.prototype.lt=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<n._lo},Z.prototype.add=function(){if(arguments[0]instanceof Z){var n=arguments[0];return Z.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return Z.copy(this).selfAdd(i)}},Z.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this._hi=n,this._lo=0}else if(arguments[0]instanceof Z){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this._hi=s,this._lo=l}},Z.prototype.gt=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>n._lo},Z.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},Z.prototype.trunc=function(){return this.isNaN()?Z.NaN:this.isPositive()?this.floor():this.ceil()},Z.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},Z.prototype.interfaces_=function(){return[t,G,Y]},Z.prototype.getClass=function(){return Z},Z.sqr=function(n){return Z.valueOf(n).selfMultiply(n)},Z.valueOf=function(){if(typeof arguments[0]=="string"){var n=arguments[0];return Z.parse(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return new Z(i)}},Z.sqrt=function(n){return Z.valueOf(n).sqrt()},Z.parse=function(n){for(var i=0,s=n.length;dt.isWhitespace(n.charAt(i));)i++;var l=!1;if(i<s){var h=n.charAt(i);h!=="-"&&h!=="+"||(i++,h==="-"&&(l=!0))}for(var v=new Z,S=0,R=0,V=0;!(i>=s);){var nt=n.charAt(i);if(i++,dt.isDigit(nt)){var _t=nt-"0";v.selfMultiply(Z.TEN),v.selfAdd(_t),S++}else{if(nt!=="."){if(nt==="e"||nt==="E"){var Et=n.substring(i);try{V=ft.parseInt(Et)}catch(An){throw An instanceof Error?new Error("Invalid exponent "+Et+" in string "+n):An}break}throw new Error("Unexpected character '"+nt+"' at position "+i+" in string "+n)}R=S}}var Wt=v,$t=S-R-V;if($t===0)Wt=v;else if($t>0){var ie=Z.TEN.pow($t);Wt=v.divide(ie)}else if($t<0){var Ee=Z.TEN.pow(-$t);Wt=v.multiply(Ee)}return l?Wt.negate():Wt},Z.createNaN=function(){return new Z(A.NaN,A.NaN)},Z.copy=function(n){return new Z(n)},Z.magnitude=function(n){var i=Math.abs(n),s=Math.log(i)/Math.log(10),l=Math.trunc(Math.floor(s));return 10*Math.pow(10,l)<=i&&(l+=1),l},Z.stringOfChar=function(n,i){for(var s=new Tt,l=0;l<i;l++)s.append(n);return s.toString()},st.PI.get=function(){return new Z(3.141592653589793,12246467991473532e-32)},st.TWO_PI.get=function(){return new Z(6.283185307179586,24492935982947064e-32)},st.PI_2.get=function(){return new Z(1.5707963267948966,6123233995736766e-32)},st.E.get=function(){return new Z(2.718281828459045,14456468917292502e-32)},st.NaN.get=function(){return new Z(A.NaN,A.NaN)},st.EPS.get=function(){return 123259516440783e-46},st.SPLIT.get=function(){return 134217729},st.MAX_PRINT_DIGITS.get=function(){return 32},st.TEN.get=function(){return Z.valueOf(10)},st.ONE.get=function(){return Z.valueOf(1)},st.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},st.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(Z,st);var vt=function(){},zt={DP_SAFE_EPSILON:{configurable:!0}};vt.prototype.interfaces_=function(){return[]},vt.prototype.getClass=function(){return vt},vt.orientationIndex=function(n,i,s){var l=vt.orientationIndexFilter(n,i,s);if(l<=1)return l;var h=Z.valueOf(i.x).selfAdd(-n.x),v=Z.valueOf(i.y).selfAdd(-n.y),S=Z.valueOf(s.x).selfAdd(-i.x),R=Z.valueOf(s.y).selfAdd(-i.y);return h.selfMultiply(R).selfSubtract(v.selfMultiply(S)).signum()},vt.signOfDet2x2=function(n,i,s,l){return n.multiply(l).selfSubtract(i.multiply(s)).signum()},vt.intersection=function(n,i,s,l){var h=Z.valueOf(l.y).selfSubtract(s.y).selfMultiply(Z.valueOf(i.x).selfSubtract(n.x)),v=Z.valueOf(l.x).selfSubtract(s.x).selfMultiply(Z.valueOf(i.y).selfSubtract(n.y)),S=h.subtract(v),R=Z.valueOf(l.x).selfSubtract(s.x).selfMultiply(Z.valueOf(n.y).selfSubtract(s.y)),V=Z.valueOf(l.y).selfSubtract(s.y).selfMultiply(Z.valueOf(n.x).selfSubtract(s.x)),nt=R.subtract(V).selfDivide(S).doubleValue(),_t=Z.valueOf(n.x).selfAdd(Z.valueOf(i.x).selfSubtract(n.x).selfMultiply(nt)).doubleValue(),Et=Z.valueOf(i.x).selfSubtract(n.x).selfMultiply(Z.valueOf(n.y).selfSubtract(s.y)),Wt=Z.valueOf(i.y).selfSubtract(n.y).selfMultiply(Z.valueOf(n.x).selfSubtract(s.x)),$t=Et.subtract(Wt).selfDivide(S).doubleValue(),ie=Z.valueOf(s.y).selfAdd(Z.valueOf(l.y).selfSubtract(s.y).selfMultiply($t)).doubleValue();return new U(_t,ie)},vt.orientationIndexFilter=function(n,i,s){var l=null,h=(n.x-s.x)*(i.y-s.y),v=(n.y-s.y)*(i.x-s.x),S=h-v;if(h>0){if(v<=0)return vt.signum(S);l=h+v}else{if(!(h<0)||v>=0)return vt.signum(S);l=-h-v}var R=vt.DP_SAFE_EPSILON*l;return S>=R||-S>=R?vt.signum(S):2},vt.signum=function(n){return n>0?1:n<0?-1:0},zt.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(vt,zt);var bt=function(){},qt={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};qt.X.get=function(){return 0},qt.Y.get=function(){return 1},qt.Z.get=function(){return 2},qt.M.get=function(){return 3},bt.prototype.setOrdinate=function(n,i,s){},bt.prototype.size=function(){},bt.prototype.getOrdinate=function(n,i){},bt.prototype.getCoordinate=function(){},bt.prototype.getCoordinateCopy=function(n){},bt.prototype.getDimension=function(){},bt.prototype.getX=function(n){},bt.prototype.clone=function(){},bt.prototype.expandEnvelope=function(n){},bt.prototype.copy=function(){},bt.prototype.getY=function(n){},bt.prototype.toCoordinateArray=function(){},bt.prototype.interfaces_=function(){return[Y]},bt.prototype.getClass=function(){return bt},Object.defineProperties(bt,qt);var le=function(){},se=function(n){function i(){n.call(this,"Projective point not representable on the Cartesian plane.")}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(le),Zt=function(){};Zt.arraycopy=function(n,i,s,l,h){for(var v=0,S=i;S<i+h;S++)s[l+v]=n[S],v++},Zt.getProperty=function(n){return{"line.separator":\`
|
|
108
108
|
\`}[n]};var _e=function n(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var s=arguments[0],l=arguments[1];this.x=s,this.y=l,this.w=1}else if(arguments[0]instanceof n&&arguments[1]instanceof n){var h=arguments[0],v=arguments[1];this.x=h.y*v.w-v.y*h.w,this.y=v.x*h.w-h.x*v.w,this.w=h.x*v.y-v.x*h.y}else if(arguments[0]instanceof U&&arguments[1]instanceof U){var S=arguments[0],R=arguments[1];this.x=S.y-R.y,this.y=R.x-S.x,this.w=S.x*R.y-R.x*S.y}}else if(arguments.length===3){var V=arguments[0],nt=arguments[1],_t=arguments[2];this.x=V,this.y=nt,this.w=_t}else if(arguments.length===4){var Et=arguments[0],Wt=arguments[1],$t=arguments[2],ie=arguments[3],Ee=Et.y-Wt.y,An=Wt.x-Et.x,Wn=Et.x*Wt.y-Wt.x*Et.y,Qr=$t.y-ie.y,jo=ie.x-$t.x,Os=$t.x*ie.y-ie.x*$t.y;this.x=An*Os-jo*Wn,this.y=Qr*Wn-Ee*Os,this.w=Ee*jo-Qr*An}};_e.prototype.getY=function(){var n=this.y/this.w;if(A.isNaN(n)||A.isInfinite(n))throw new se;return n},_e.prototype.getX=function(){var n=this.x/this.w;if(A.isNaN(n)||A.isInfinite(n))throw new se;return n},_e.prototype.getCoordinate=function(){var n=new U;return n.x=this.getX(),n.y=this.getY(),n},_e.prototype.interfaces_=function(){return[]},_e.prototype.getClass=function(){return _e},_e.intersection=function(n,i,s,l){var h=n.y-i.y,v=i.x-n.x,S=n.x*i.y-i.x*n.y,R=s.y-l.y,V=l.x-s.x,nt=s.x*l.y-l.x*s.y,_t=h*V-R*v,Et=(v*nt-V*S)/_t,Wt=(R*S-h*nt)/_t;if(A.isNaN(Et)||A.isInfinite(Et)||A.isNaN(Wt)||A.isInfinite(Wt))throw new se;return new U(Et,Wt)};var Vt=function n(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof U){var i=arguments[0];this.init(i.x,i.x,i.y,i.y)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.init(l.x,h.x,l.y,h.y)}else if(arguments.length===4){var v=arguments[0],S=arguments[1],R=arguments[2],V=arguments[3];this.init(v,S,R,V)}},pe={serialVersionUID:{configurable:!0}};Vt.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Vt.prototype.equals=function(n){if(!(n instanceof Vt))return!1;var i=n;return this.isNull()?i.isNull():this._maxx===i.getMaxX()&&this._maxy===i.getMaxY()&&this._minx===i.getMinX()&&this._miny===i.getMinY()},Vt.prototype.intersection=function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new Vt;var i=this._minx>n._minx?this._minx:n._minx,s=this._miny>n._miny?this._miny:n._miny,l=this._maxx<n._maxx?this._maxx:n._maxx,h=this._maxy<n._maxy?this._maxy:n._maxy;return new Vt(i,l,s,h)},Vt.prototype.isNull=function(){return this._maxx<this._minx},Vt.prototype.getMaxX=function(){return this._maxx},Vt.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof U){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof Vt){var i=arguments[0];return!this.isNull()&&!i.isNull()&&i.getMinX()>=this._minx&&i.getMaxX()<=this._maxx&&i.getMinY()>=this._miny&&i.getMaxY()<=this._maxy}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return!this.isNull()&&s>=this._minx&&s<=this._maxx&&l>=this._miny&&l<=this._maxy}},Vt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Vt){var n=arguments[0];return!this.isNull()&&!n.isNull()&&!(n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny)}if(arguments[0]instanceof U){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return!this.isNull()&&!(s>this._maxx||s<this._minx||l>this._maxy||l<this._miny)}},Vt.prototype.getMinY=function(){return this._miny},Vt.prototype.getMinX=function(){return this._minx},Vt.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof U){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof Vt){var i=arguments[0];if(i.isNull())return null;this.isNull()?(this._minx=i.getMinX(),this._maxx=i.getMaxX(),this._miny=i.getMinY(),this._maxy=i.getMaxY()):(i._minx<this._minx&&(this._minx=i._minx),i._maxx>this._maxx&&(this._maxx=i._maxx),i._miny<this._miny&&(this._miny=i._miny),i._maxy>this._maxy&&(this._maxy=i._maxy))}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.isNull()?(this._minx=s,this._maxx=s,this._miny=l,this._maxy=l):(s<this._minx&&(this._minx=s),s>this._maxx&&(this._maxx=s),l<this._miny&&(this._miny=l),l>this._maxy&&(this._maxy=l))}},Vt.prototype.minExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n<i?n:i},Vt.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Vt.prototype.compareTo=function(n){var i=n;return this.isNull()?i.isNull()?0:-1:i.isNull()?1:this._minx<i._minx?-1:this._minx>i._minx?1:this._miny<i._miny?-1:this._miny>i._miny?1:this._maxx<i._maxx?-1:this._maxx>i._maxx?1:this._maxy<i._maxy?-1:this._maxy>i._maxy?1:0},Vt.prototype.translate=function(n,i){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+i,this.getMaxY()+i)},Vt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Vt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Vt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Vt.prototype.maxExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n>i?n:i},Vt.prototype.expandBy=function(){if(arguments.length===1){var n=arguments[0];this.expandBy(n,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this.isNull())return null;this._minx-=i,this._maxx+=i,this._miny-=s,this._maxy+=s,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},Vt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Vt){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof U){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return this.covers(s,l)}},Vt.prototype.centre=function(){return this.isNull()?null:new U((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Vt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof U){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof Vt){var i=arguments[0];this._minx=i._minx,this._maxx=i._maxx,this._miny=i._miny,this._maxy=i._maxy}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.init(s.x,l.x,s.y,l.y)}else if(arguments.length===4){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3];h<v?(this._minx=h,this._maxx=v):(this._minx=v,this._maxx=h),S<R?(this._miny=S,this._maxy=R):(this._miny=R,this._maxy=S)}},Vt.prototype.getMaxY=function(){return this._maxy},Vt.prototype.distance=function(n){if(this.intersects(n))return 0;var i=0;this._maxx<n._minx?i=n._minx-this._maxx:this._minx>n._maxx&&(i=this._minx-n._maxx);var s=0;return this._maxy<n._miny?s=n._miny-this._maxy:this._miny>n._maxy&&(s=this._miny-n._maxy),i===0?s:s===0?i:Math.sqrt(i*i+s*s)},Vt.prototype.hashCode=function(){var n=17;return n=37*n+U.hashCode(this._minx),n=37*n+U.hashCode(this._maxx),n=37*n+U.hashCode(this._miny),n=37*n+U.hashCode(this._maxy)},Vt.prototype.interfaces_=function(){return[G,t]},Vt.prototype.getClass=function(){return Vt},Vt.intersects=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];return s.x>=(n.x<i.x?n.x:i.x)&&s.x<=(n.x>i.x?n.x:i.x)&&s.y>=(n.y<i.y?n.y:i.y)&&s.y<=(n.y>i.y?n.y:i.y)}if(arguments.length===4){var l=arguments[0],h=arguments[1],v=arguments[2],S=arguments[3],R=Math.min(v.x,S.x),V=Math.max(v.x,S.x),nt=Math.min(l.x,h.x),_t=Math.max(l.x,h.x);return!(nt>V)&&!(_t<R)&&(R=Math.min(v.y,S.y),V=Math.max(v.y,S.y),nt=Math.min(l.y,h.y),_t=Math.max(l.y,h.y),!(nt>V)&&!(_t<R))}},pe.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Vt,pe);var at={typeStr:/^\\s*(\\w+)\\s*\\(\\s*(.*)\\s*\\)\\s*$/,emptyTypeStr:/^\\s*(\\w+)\\s*EMPTY\\s*$/,spaces:/\\s+/,parenComma:/\\)\\s*,\\s*\\(/,doubleParenComma:/\\)\\s*\\)\\s*,\\s*\\(\\s*\\(/,trimParens:/^\\s*\\(?(.*?)\\)?\\s*$/},He=function(n){this.geometryFactory=n||new Ce};He.prototype.read=function(n){var i,s,l;n=n.replace(/[\\n\\r]/g," ");var h=at.typeStr.exec(n);if(n.search("EMPTY")!==-1&&((h=at.emptyTypeStr.exec(n))[2]=void 0),h&&(s=h[1].toLowerCase(),l=h[2],ce[s]&&(i=ce[s].apply(this,[l]))),i===void 0)throw new Error("Could not parse WKT "+n);return i},He.prototype.write=function(n){return this.extractGeometry(n)},He.prototype.extractGeometry=function(n){var i=n.getGeometryType().toLowerCase();if(!ae[i])return null;var s=i.toUpperCase();return n.isEmpty()?s+" EMPTY":s+"("+ae[i].apply(this,[n])+")"};var ae={coordinate:function(n){return n.x+" "+n.y},point:function(n){return ae.coordinate.call(this,n._coordinates._coordinates[0])},multipoint:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push("("+ae.point.apply(this,[n._geometries[s]])+")");return i.join(",")},linestring:function(n){for(var i=[],s=0,l=n._points._coordinates.length;s<l;++s)i.push(ae.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},linearring:function(n){for(var i=[],s=0,l=n._points._coordinates.length;s<l;++s)i.push(ae.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},multilinestring:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push("("+ae.linestring.apply(this,[n._geometries[s]])+")");return i.join(",")},polygon:function(n){var i=[];i.push("("+ae.linestring.apply(this,[n._shell])+")");for(var s=0,l=n._holes.length;s<l;++s)i.push("("+ae.linestring.apply(this,[n._holes[s]])+")");return i.join(",")},multipolygon:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push("("+ae.polygon.apply(this,[n._geometries[s]])+")");return i.join(",")},geometrycollection:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push(this.extractGeometry(n._geometries[s]));return i.join(",")}},ce={point:function(n){if(n===void 0)return this.geometryFactory.createPoint();var i=n.trim().split(at.spaces);return this.geometryFactory.createPoint(new U(Number.parseFloat(i[0]),Number.parseFloat(i[1])))},multipoint:function(n){if(n===void 0)return this.geometryFactory.createMultiPoint();for(var i,s=n.trim().split(","),l=[],h=0,v=s.length;h<v;++h)i=s[h].replace(at.trimParens,"$1"),l.push(ce.point.apply(this,[i]));return this.geometryFactory.createMultiPoint(l)},linestring:function(n){if(n===void 0)return this.geometryFactory.createLineString();for(var i,s=n.trim().split(","),l=[],h=0,v=s.length;h<v;++h)i=s[h].trim().split(at.spaces),l.push(new U(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(l)},linearring:function(n){if(n===void 0)return this.geometryFactory.createLinearRing();for(var i,s=n.trim().split(","),l=[],h=0,v=s.length;h<v;++h)i=s[h].trim().split(at.spaces),l.push(new U(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(l)},multilinestring:function(n){if(n===void 0)return this.geometryFactory.createMultiLineString();for(var i,s=n.trim().split(at.parenComma),l=[],h=0,v=s.length;h<v;++h)i=s[h].replace(at.trimParens,"$1"),l.push(ce.linestring.apply(this,[i]));return this.geometryFactory.createMultiLineString(l)},polygon:function(n){if(n===void 0)return this.geometryFactory.createPolygon();for(var i,s,l,h,v=n.trim().split(at.parenComma),S=[],R=0,V=v.length;R<V;++R)i=v[R].replace(at.trimParens,"$1"),s=ce.linestring.apply(this,[i]),l=this.geometryFactory.createLinearRing(s._points),R===0?h=l:S.push(l);return this.geometryFactory.createPolygon(h,S)},multipolygon:function(n){if(n===void 0)return this.geometryFactory.createMultiPolygon();for(var i,s=n.trim().split(at.doubleParenComma),l=[],h=0,v=s.length;h<v;++h)i=s[h].replace(at.trimParens,"$1"),l.push(ce.polygon.apply(this,[i]));return this.geometryFactory.createMultiPolygon(l)},geometrycollection:function(n){if(n===void 0)return this.geometryFactory.createGeometryCollection();for(var i=(n=n.replace(/,\\s*([A-Za-z])/g,"|$1")).trim().split("|"),s=[],l=0,h=i.length;l<h;++l)s.push(this.read(i[l]));return this.geometryFactory.createGeometryCollection(s)}},fe=function(n){this.parser=new He(n)};fe.prototype.write=function(n){return this.parser.write(n)},fe.toLineString=function(n,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+n.x+" "+n.y+", "+i.x+" "+i.y+" )"};var it=function(n){function i(s){n.call(this,s),this.name="RuntimeException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),B=function(n){function i(){if(n.call(this),arguments.length===0)n.call(this);else if(arguments.length===1){var s=arguments[0];n.call(this,s)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(it),P=function(){};P.prototype.interfaces_=function(){return[]},P.prototype.getClass=function(){return P},P.shouldNeverReachHere=function(){if(arguments.length===0)P.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new B("Should never reach here"+(n!==null?": "+n:""))}},P.isTrue=function(){var n,i;if(arguments.length===1)n=arguments[0],P.isTrue(n,null);else if(arguments.length===2&&(n=arguments[0],i=arguments[1],!n))throw i===null?new B:new B(i)},P.equals=function(){var n,i,s;if(arguments.length===2)n=arguments[0],i=arguments[1],P.equals(n,i,null);else if(arguments.length===3&&(n=arguments[0],i=arguments[1],s=arguments[2],!i.equals(n)))throw new B("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))};var F=function(){this._result=null,this._inputLines=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new U,this._intPt[1]=new U,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},J={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};F.prototype.getIndexAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intLineIndex[n][i]},F.prototype.getTopologySummary=function(){var n=new Tt;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()},F.prototype.computeIntersection=function(n,i,s,l){this._inputLines[0][0]=n,this._inputLines[0][1]=i,this._inputLines[1][0]=s,this._inputLines[1][1]=l,this._result=this.computeIntersect(n,i,s,l)},F.prototype.getIntersectionNum=function(){return this._result},F.prototype.computeIntLineIndex=function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var n=arguments[0];this.getEdgeDistance(n,0)>this.getEdgeDistance(n,1)?(this._intLineIndex[n][0]=0,this._intLineIndex[n][1]=1):(this._intLineIndex[n][0]=1,this._intLineIndex[n][1]=0)}},F.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},F.prototype.setPrecisionModel=function(n){this._precisionModel=n},F.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var n=arguments[0],i=0;i<this._result;i++)if(!this._intPt[i].equals2D(this._inputLines[n][0])&&!this._intPt[i].equals2D(this._inputLines[n][1]))return!0;return!1}},F.prototype.getIntersection=function(n){return this._intPt[n]},F.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},F.prototype.hasIntersection=function(){return this._result!==F.NO_INTERSECTION},F.prototype.getEdgeDistance=function(n,i){return F.computeEdgeDistance(this._intPt[i],this._inputLines[n][0],this._inputLines[n][1])},F.prototype.isCollinear=function(){return this._result===F.COLLINEAR_INTERSECTION},F.prototype.toString=function(){return fe.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+fe.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},F.prototype.getEndpoint=function(n,i){return this._inputLines[n][i]},F.prototype.isIntersection=function(n){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(n))return!0;return!1},F.prototype.getIntersectionAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][i]]},F.prototype.interfaces_=function(){return[]},F.prototype.getClass=function(){return F},F.computeEdgeDistance=function(n,i,s){var l=Math.abs(s.x-i.x),h=Math.abs(s.y-i.y),v=-1;if(n.equals(i))v=0;else if(n.equals(s))v=l>h?l:h;else{var S=Math.abs(n.x-i.x),R=Math.abs(n.y-i.y);(v=l>h?S:R)!==0||n.equals(i)||(v=Math.max(S,R))}return P.isTrue(!(v===0&&!n.equals(i)),"Bad distance calculation"),v},F.nonRobustComputeEdgeDistance=function(n,i,s){var l=n.x-i.x,h=n.y-i.y,v=Math.sqrt(l*l+h*h);return P.isTrue(!(v===0&&!n.equals(i)),"Invalid distance calculation"),v},J.DONT_INTERSECT.get=function(){return 0},J.DO_INTERSECT.get=function(){return 1},J.COLLINEAR.get=function(){return 2},J.NO_INTERSECTION.get=function(){return 0},J.POINT_INTERSECTION.get=function(){return 1},J.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(F,J);var rt=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isInSegmentEnvelopes=function(s){var l=new Vt(this._inputLines[0][0],this._inputLines[0][1]),h=new Vt(this._inputLines[1][0],this._inputLines[1][1]);return l.contains(s)&&h.contains(s)},i.prototype.computeIntersection=function(){if(arguments.length!==3)return n.prototype.computeIntersection.apply(this,arguments);var s=arguments[0],l=arguments[1],h=arguments[2];if(this._isProper=!1,Vt.intersects(l,h,s)&&W.orientationIndex(l,h,s)===0&&W.orientationIndex(h,l,s)===0)return this._isProper=!0,(s.equals(l)||s.equals(h))&&(this._isProper=!1),this._result=n.POINT_INTERSECTION,null;this._result=n.NO_INTERSECTION},i.prototype.normalizeToMinimum=function(s,l,h,v,S){S.x=this.smallestInAbsValue(s.x,l.x,h.x,v.x),S.y=this.smallestInAbsValue(s.y,l.y,h.y,v.y),s.x-=S.x,s.y-=S.y,l.x-=S.x,l.y-=S.y,h.x-=S.x,h.y-=S.y,v.x-=S.x,v.y-=S.y},i.prototype.safeHCoordinateIntersection=function(s,l,h,v){var S=null;try{S=_e.intersection(s,l,h,v)}catch(R){if(!(R instanceof se))throw R;S=i.nearestEndpoint(s,l,h,v)}return S},i.prototype.intersection=function(s,l,h,v){var S=this.intersectionWithNormalization(s,l,h,v);return this.isInSegmentEnvelopes(S)||(S=new U(i.nearestEndpoint(s,l,h,v))),this._precisionModel!==null&&this._precisionModel.makePrecise(S),S},i.prototype.smallestInAbsValue=function(s,l,h,v){var S=s,R=Math.abs(S);return Math.abs(l)<R&&(S=l,R=Math.abs(l)),Math.abs(h)<R&&(S=h,R=Math.abs(h)),Math.abs(v)<R&&(S=v),S},i.prototype.checkDD=function(s,l,h,v,S){var R=vt.intersection(s,l,h,v),V=this.isInSegmentEnvelopes(R);Zt.out.println("DD in env = "+V+" --------------------- "+R),S.distance(R)>1e-4&&Zt.out.println("Distance = "+S.distance(R))},i.prototype.intersectionWithNormalization=function(s,l,h,v){var S=new U(s),R=new U(l),V=new U(h),nt=new U(v),_t=new U;this.normalizeToEnvCentre(S,R,V,nt,_t);var Et=this.safeHCoordinateIntersection(S,R,V,nt);return Et.x+=_t.x,Et.y+=_t.y,Et},i.prototype.computeCollinearIntersection=function(s,l,h,v){var S=Vt.intersects(s,l,h),R=Vt.intersects(s,l,v),V=Vt.intersects(h,v,s),nt=Vt.intersects(h,v,l);return S&&R?(this._intPt[0]=h,this._intPt[1]=v,n.COLLINEAR_INTERSECTION):V&&nt?(this._intPt[0]=s,this._intPt[1]=l,n.COLLINEAR_INTERSECTION):S&&V?(this._intPt[0]=h,this._intPt[1]=s,!h.equals(s)||R||nt?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):S&&nt?(this._intPt[0]=h,this._intPt[1]=l,!h.equals(l)||R||V?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):R&&V?(this._intPt[0]=v,this._intPt[1]=s,!v.equals(s)||S||nt?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):R&&nt?(this._intPt[0]=v,this._intPt[1]=l,!v.equals(l)||S||V?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):n.NO_INTERSECTION},i.prototype.normalizeToEnvCentre=function(s,l,h,v,S){var R=s.x<l.x?s.x:l.x,V=s.y<l.y?s.y:l.y,nt=s.x>l.x?s.x:l.x,_t=s.y>l.y?s.y:l.y,Et=h.x<v.x?h.x:v.x,Wt=h.y<v.y?h.y:v.y,$t=h.x>v.x?h.x:v.x,ie=h.y>v.y?h.y:v.y,Ee=((R>Et?R:Et)+(nt<$t?nt:$t))/2,An=((V>Wt?V:Wt)+(_t<ie?_t:ie))/2;S.x=Ee,S.y=An,s.x-=S.x,s.y-=S.y,l.x-=S.x,l.y-=S.y,h.x-=S.x,h.y-=S.y,v.x-=S.x,v.y-=S.y},i.prototype.computeIntersect=function(s,l,h,v){if(this._isProper=!1,!Vt.intersects(s,l,h,v))return n.NO_INTERSECTION;var S=W.orientationIndex(s,l,h),R=W.orientationIndex(s,l,v);if(S>0&&R>0||S<0&&R<0)return n.NO_INTERSECTION;var V=W.orientationIndex(h,v,s),nt=W.orientationIndex(h,v,l);return V>0&&nt>0||V<0&&nt<0?n.NO_INTERSECTION:S===0&&R===0&&V===0&&nt===0?this.computeCollinearIntersection(s,l,h,v):(S===0||R===0||V===0||nt===0?(this._isProper=!1,s.equals2D(h)||s.equals2D(v)?this._intPt[0]=s:l.equals2D(h)||l.equals2D(v)?this._intPt[0]=l:S===0?this._intPt[0]=new U(h):R===0?this._intPt[0]=new U(v):V===0?this._intPt[0]=new U(s):nt===0&&(this._intPt[0]=new U(l))):(this._isProper=!0,this._intPt[0]=this.intersection(s,l,h,v)),n.POINT_INTERSECTION)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.nearestEndpoint=function(s,l,h,v){var S=s,R=W.distancePointLine(s,h,v),V=W.distancePointLine(l,h,v);return V<R&&(R=V,S=l),(V=W.distancePointLine(h,s,l))<R&&(R=V,S=h),(V=W.distancePointLine(v,s,l))<R&&(R=V,S=v),S},i}(F),D=function(){};D.prototype.interfaces_=function(){return[]},D.prototype.getClass=function(){return D},D.orientationIndex=function(n,i,s){var l=i.x-n.x,h=i.y-n.y,v=s.x-i.x,S=s.y-i.y;return D.signOfDet2x2(l,h,v,S)},D.signOfDet2x2=function(n,i,s,l){var h=null,v=null,S=null;if(h=1,n===0||l===0)return i===0||s===0?0:i>0?s>0?-h:h:s>0?h:-h;if(i===0||s===0)return l>0?n>0?h:-h:n>0?-h:h;if(i>0?l>0?i<=l||(h=-h,v=n,n=s,s=v,v=i,i=l,l=v):i<=-l?(h=-h,s=-s,l=-l):(v=n,n=-s,s=v,v=i,i=-l,l=v):l>0?-i<=l?(h=-h,n=-n,i=-i):(v=-n,n=s,s=v,v=-i,i=l,l=v):i>=l?(n=-n,i=-i,s=-s,l=-l):(h=-h,v=-n,n=-s,s=v,v=-i,i=-l,l=v),n>0){if(!(s>0)||!(n<=s))return h}else{if(s>0||!(n>=s))return-h;h=-h,n=-n,s=-s}for(;;){if(S=Math.floor(s/n),s-=S*n,(l-=S*i)<0)return-h;if(l>i)return h;if(n>s+s){if(i<l+l)return h}else{if(i>l+l)return-h;s=n-s,l=i-l,h=-h}if(l===0)return s===0?0:-h;if(s===0||(S=Math.floor(n/s),n-=S*s,(i-=S*l)<0))return h;if(i>l)return-h;if(s>n+n){if(l<i+i)return-h}else{if(l>i+i)return h;n=s-n,i=l-i,h=-h}if(i===0)return n===0?0:h;if(n===0)return-h}};var N=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n};N.prototype.countSegment=function(n,i){if(n.x<this._p.x&&i.x<this._p.x)return null;if(this._p.x===i.x&&this._p.y===i.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&i.y===this._p.y){var s=n.x,l=i.x;return s>l&&(s=i.x,l=n.x),this._p.x>=s&&this._p.x<=l&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&i.y<=this._p.y||i.y>this._p.y&&n.y<=this._p.y){var h=n.x-this._p.x,v=n.y-this._p.y,S=i.x-this._p.x,R=i.y-this._p.y,V=D.signOfDet2x2(h,v,S,R);if(V===0)return this._isPointOnSegment=!0,null;R<v&&(V=-V),V>0&&this._crossingCount++}},N.prototype.isPointInPolygon=function(){return this.getLocation()!==$.EXTERIOR},N.prototype.getLocation=function(){return this._isPointOnSegment?$.BOUNDARY:this._crossingCount%2==1?$.INTERIOR:$.EXTERIOR},N.prototype.isOnSegment=function(){return this._isPointOnSegment},N.prototype.interfaces_=function(){return[]},N.prototype.getClass=function(){return N},N.locatePointInRing=function(){if(arguments[0]instanceof U&&j(arguments[1],bt)){for(var n=arguments[0],i=arguments[1],s=new N(n),l=new U,h=new U,v=1;v<i.size();v++)if(i.getCoordinate(v,l),i.getCoordinate(v-1,h),s.countSegment(l,h),s.isOnSegment())return s.getLocation();return s.getLocation()}if(arguments[0]instanceof U&&arguments[1]instanceof Array){for(var S=arguments[0],R=arguments[1],V=new N(S),nt=1;nt<R.length;nt++){var _t=R[nt],Et=R[nt-1];if(V.countSegment(_t,Et),V.isOnSegment())return V.getLocation()}return V.getLocation()}};var W=function(){},xt={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};W.prototype.interfaces_=function(){return[]},W.prototype.getClass=function(){return W},W.orientationIndex=function(n,i,s){return vt.orientationIndex(n,i,s)},W.signedArea=function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var i=0,s=n[0].x,l=1;l<n.length-1;l++){var h=n[l].x-s,v=n[l+1].y;i+=h*(n[l-1].y-v)}return i/2}if(j(arguments[0],bt)){var S=arguments[0],R=S.size();if(R<3)return 0;var V=new U,nt=new U,_t=new U;S.getCoordinate(0,nt),S.getCoordinate(1,_t);var Et=nt.x;_t.x-=Et;for(var Wt=0,$t=1;$t<R-1;$t++)V.y=nt.y,nt.x=_t.x,nt.y=_t.y,S.getCoordinate($t+1,_t),_t.x-=Et,Wt+=nt.x*(V.y-_t.y);return Wt/2}},W.distanceLineLine=function(n,i,s,l){if(n.equals(i))return W.distancePointLine(n,s,l);if(s.equals(l))return W.distancePointLine(l,n,i);var h=!1;if(Vt.intersects(n,i,s,l)){var v=(i.x-n.x)*(l.y-s.y)-(i.y-n.y)*(l.x-s.x);if(v===0)h=!0;else{var S=(n.y-s.y)*(l.x-s.x)-(n.x-s.x)*(l.y-s.y),R=((n.y-s.y)*(i.x-n.x)-(n.x-s.x)*(i.y-n.y))/v,V=S/v;(V<0||V>1||R<0||R>1)&&(h=!0)}}else h=!0;return h?pt.min(W.distancePointLine(n,s,l),W.distancePointLine(i,s,l),W.distancePointLine(s,n,i),W.distancePointLine(l,n,i)):0},W.isPointInRing=function(n,i){return W.locatePointInRing(n,i)!==$.EXTERIOR},W.computeLength=function(n){var i=n.size();if(i<=1)return 0;var s=0,l=new U;n.getCoordinate(0,l);for(var h=l.x,v=l.y,S=1;S<i;S++){n.getCoordinate(S,l);var R=l.x,V=l.y,nt=R-h,_t=V-v;s+=Math.sqrt(nt*nt+_t*_t),h=R,v=V}return s},W.isCCW=function(n){var i=n.length-1;if(i<3)throw new L("Ring has fewer than 4 points, so orientation cannot be determined");for(var s=n[0],l=0,h=1;h<=i;h++){var v=n[h];v.y>s.y&&(s=v,l=h)}var S=l;do(S-=1)<0&&(S=i);while(n[S].equals2D(s)&&S!==l);var R=l;do R=(R+1)%i;while(n[R].equals2D(s)&&R!==l);var V=n[S],nt=n[R];if(V.equals2D(s)||nt.equals2D(s)||V.equals2D(nt))return!1;var _t=W.computeOrientation(V,s,nt),Et=!1;return Et=_t===0?V.x>nt.x:_t>0,Et},W.locatePointInRing=function(n,i){return N.locatePointInRing(n,i)},W.distancePointLinePerpendicular=function(n,i,s){var l=(s.x-i.x)*(s.x-i.x)+(s.y-i.y)*(s.y-i.y),h=((i.y-n.y)*(s.x-i.x)-(i.x-n.x)*(s.y-i.y))/l;return Math.abs(h)*Math.sqrt(l)},W.computeOrientation=function(n,i,s){return W.orientationIndex(n,i,s)},W.distancePointLine=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(i.length===0)throw new L("Line array must contain at least one vertex");for(var s=n.distance(i[0]),l=0;l<i.length-1;l++){var h=W.distancePointLine(n,i[l],i[l+1]);h<s&&(s=h)}return s}if(arguments.length===3){var v=arguments[0],S=arguments[1],R=arguments[2];if(S.x===R.x&&S.y===R.y)return v.distance(S);var V=(R.x-S.x)*(R.x-S.x)+(R.y-S.y)*(R.y-S.y),nt=((v.x-S.x)*(R.x-S.x)+(v.y-S.y)*(R.y-S.y))/V;if(nt<=0)return v.distance(S);if(nt>=1)return v.distance(R);var _t=((S.y-v.y)*(R.x-S.x)-(S.x-v.x)*(R.y-S.y))/V;return Math.abs(_t)*Math.sqrt(V)}},W.isOnLine=function(n,i){for(var s=new rt,l=1;l<i.length;l++){var h=i[l-1],v=i[l];if(s.computeIntersection(n,h,v),s.hasIntersection())return!0}return!1},xt.CLOCKWISE.get=function(){return-1},xt.RIGHT.get=function(){return W.CLOCKWISE},xt.COUNTERCLOCKWISE.get=function(){return 1},xt.LEFT.get=function(){return W.COUNTERCLOCKWISE},xt.COLLINEAR.get=function(){return 0},xt.STRAIGHT.get=function(){return W.COLLINEAR},Object.defineProperties(W,xt);var wt=function(){};wt.prototype.filter=function(n){},wt.prototype.interfaces_=function(){return[]},wt.prototype.getClass=function(){return wt};var lt=function(){var n=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=n,this._SRID=n.getSRID()},Bt={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};lt.prototype.isGeometryCollection=function(){return this.getSortIndex()===lt.SORTINDEX_GEOMETRYCOLLECTION},lt.prototype.getFactory=function(){return this._factory},lt.prototype.getGeometryN=function(n){return this},lt.prototype.getArea=function(){return 0},lt.prototype.isRectangle=function(){return!1},lt.prototype.equals=function(){if(arguments[0]instanceof lt){var n=arguments[0];return n!==null&&this.equalsTopo(n)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof lt))return!1;var s=i;return this.equalsExact(s)}},lt.prototype.equalsExact=function(n){return this===n||this.equalsExact(n,0)},lt.prototype.geometryChanged=function(){this.apply(lt.geometryChangedFilter)},lt.prototype.geometryChangedAction=function(){this._envelope=null},lt.prototype.equalsNorm=function(n){return n!==null&&this.norm().equalsExact(n.norm())},lt.prototype.getLength=function(){return 0},lt.prototype.getNumGeometries=function(){return 1},lt.prototype.compareTo=function(){if(arguments.length===1){var n=arguments[0],i=n;return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(n)}if(arguments.length===2){var s=arguments[0],l=arguments[1];return this.getSortIndex()!==s.getSortIndex()?this.getSortIndex()-s.getSortIndex():this.isEmpty()&&s.isEmpty()?0:this.isEmpty()?-1:s.isEmpty()?1:this.compareToSameClass(s,l)}},lt.prototype.getUserData=function(){return this._userData},lt.prototype.getSRID=function(){return this._SRID},lt.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},lt.prototype.checkNotGeometryCollection=function(n){if(n.getSortIndex()===lt.SORTINDEX_GEOMETRYCOLLECTION)throw new L("This method does not support GeometryCollection arguments")},lt.prototype.equal=function(n,i,s){return s===0?n.equals(i):n.distance(i)<=s},lt.prototype.norm=function(){var n=this.copy();return n.normalize(),n},lt.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},lt.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Vt(this._envelope)},lt.prototype.setSRID=function(n){this._SRID=n},lt.prototype.setUserData=function(n){this._userData=n},lt.prototype.compare=function(n,i){for(var s=n.iterator(),l=i.iterator();s.hasNext()&&l.hasNext();){var h=s.next(),v=l.next(),S=h.compareTo(v);if(S!==0)return S}return s.hasNext()?1:l.hasNext()?-1:0},lt.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},lt.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===lt.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===lt.SORTINDEX_MULTIPOINT||this.getSortIndex()===lt.SORTINDEX_MULTILINESTRING||this.getSortIndex()===lt.SORTINDEX_MULTIPOLYGON},lt.prototype.interfaces_=function(){return[Y,G,t]},lt.prototype.getClass=function(){return lt},lt.hasNonEmptyElements=function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1},lt.hasNullElements=function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1},Bt.serialVersionUID.get=function(){return 8763622679187377e3},Bt.SORTINDEX_POINT.get=function(){return 0},Bt.SORTINDEX_MULTIPOINT.get=function(){return 1},Bt.SORTINDEX_LINESTRING.get=function(){return 2},Bt.SORTINDEX_LINEARRING.get=function(){return 3},Bt.SORTINDEX_MULTILINESTRING.get=function(){return 4},Bt.SORTINDEX_POLYGON.get=function(){return 5},Bt.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Bt.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Bt.geometryChangedFilter.get=function(){return Lt},Object.defineProperties(lt,Bt);var Lt=function(){};Lt.interfaces_=function(){return[wt]},Lt.filter=function(n){n.geometryChangedAction()};var Ut=function(){};Ut.prototype.filter=function(n){},Ut.prototype.interfaces_=function(){return[]},Ut.prototype.getClass=function(){return Ut};var Xt=function(){},de={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};Xt.prototype.isInBoundary=function(n){},Xt.prototype.interfaces_=function(){return[]},Xt.prototype.getClass=function(){return Xt},de.Mod2BoundaryNodeRule.get=function(){return Ft},de.EndPointBoundaryNodeRule.get=function(){return Se},de.MultiValentEndPointBoundaryNodeRule.get=function(){return xe},de.MonoValentEndPointBoundaryNodeRule.get=function(){return he},de.MOD2_BOUNDARY_RULE.get=function(){return new Ft},de.ENDPOINT_BOUNDARY_RULE.get=function(){return new Se},de.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new xe},de.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new he},de.OGC_SFS_BOUNDARY_RULE.get=function(){return Xt.MOD2_BOUNDARY_RULE},Object.defineProperties(Xt,de);var Ft=function(){};Ft.prototype.isInBoundary=function(n){return n%2==1},Ft.prototype.interfaces_=function(){return[Xt]},Ft.prototype.getClass=function(){return Ft};var Se=function(){};Se.prototype.isInBoundary=function(n){return n>0},Se.prototype.interfaces_=function(){return[Xt]},Se.prototype.getClass=function(){return Se};var xe=function(){};xe.prototype.isInBoundary=function(n){return n>1},xe.prototype.interfaces_=function(){return[Xt]},xe.prototype.getClass=function(){return xe};var he=function(){};he.prototype.isInBoundary=function(n){return n===1},he.prototype.interfaces_=function(){return[Xt]},he.prototype.getClass=function(){return he};var Jt=function(){};Jt.prototype.add=function(){},Jt.prototype.addAll=function(){},Jt.prototype.isEmpty=function(){},Jt.prototype.iterator=function(){},Jt.prototype.size=function(){},Jt.prototype.toArray=function(){},Jt.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var et=function(){};et.prototype.hasNext=function(){},et.prototype.next=function(){},et.prototype.remove=function(){};var kt=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(){},i.prototype.set=function(){},i.prototype.isEmpty=function(){},i}(Jt);(o.prototype=new Error).name="NoSuchElementException";var ct=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof Jt&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.ensureCapacity=function(){},i.prototype.interfaces_=function(){return[n,Jt]},i.prototype.add=function(s){return arguments.length===1?this.array_.push(s):this.array_.splice(arguments[0],arguments[1]),!0},i.prototype.clear=function(){this.array_=[]},i.prototype.addAll=function(s){for(var l=s.iterator();l.hasNext();)this.add(l.next());return!0},i.prototype.set=function(s,l){var h=this.array_[s];return this.array_[s]=l,h},i.prototype.iterator=function(){return new jt(this)},i.prototype.get=function(s){if(s<0||s>=this.size())throw new e;return this.array_[s]},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.size=function(){return this.array_.length},i.prototype.toArray=function(){for(var s=[],l=0,h=this.array_.length;l<h;l++)s.push(this.array_[l]);return s},i.prototype.remove=function(s){for(var l=!1,h=0,v=this.array_.length;h<v;h++)if(this.array_[h]===s){this.array_.splice(h,1),l=!0;break}return l},i}(kt),jt=function(n){function i(s){n.call(this),this.arrayList_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new o;return this.arrayList_.get(this.position_++)},i.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},i.prototype.set=function(s){return this.arrayList_.set(this.position_-1,s)},i.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},i}(et),Kt=function(n){function i(){if(n.call(this),arguments.length!==0){if(arguments.length===1){var l=arguments[0];this.ensureCapacity(l.length),this.add(l,!0)}else if(arguments.length===2){var h=arguments[0],v=arguments[1];this.ensureCapacity(h.length),this.add(h,v)}}}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={coordArrayType:{configurable:!0}};return s.coordArrayType.get=function(){return new Array(0).fill(null)},i.prototype.getCoordinate=function(l){return this.get(l)},i.prototype.addAll=function(){if(arguments.length===2){for(var l=arguments[0],h=arguments[1],v=!1,S=l.iterator();S.hasNext();)this.add(S.next(),h),v=!0;return v}return n.prototype.addAll.apply(this,arguments)},i.prototype.clone=function(){for(var l=n.prototype.clone.call(this),h=0;h<this.size();h++)l.add(h,this.get(h).copy());return l},i.prototype.toCoordinateArray=function(){return this.toArray(i.coordArrayType)},i.prototype.add=function(){if(arguments.length===1){var l=arguments[0];n.prototype.add.call(this,l)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var h=arguments[0],v=arguments[1];return this.add(h,v,!0),!0}if(arguments[0]instanceof U&&typeof arguments[1]=="boolean"){var S=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(S))return null;n.prototype.add.call(this,S)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var R=arguments[0],V=arguments[1];return this.add(R,V),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var nt=arguments[0],_t=arguments[1];if(arguments[2])for(var Et=0;Et<nt.length;Et++)this.add(nt[Et],_t);else for(var Wt=nt.length-1;Wt>=0;Wt--)this.add(nt[Wt],_t);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof U){var $t=arguments[0],ie=arguments[1];if(!arguments[2]){var Ee=this.size();if(Ee>0&&($t>0&&this.get($t-1).equals2D(ie)||$t<Ee&&this.get($t).equals2D(ie)))return null}n.prototype.add.call(this,$t,ie)}}else if(arguments.length===4){var An=arguments[0],Wn=arguments[1],Qr=arguments[2],jo=arguments[3],Os=1;Qr>jo&&(Os=-1);for(var Oc=Qr;Oc!==jo;Oc+=Os)this.add(An[Oc],Wn);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new U(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,s),i}(ct),Mt=function(){},me={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};me.ForwardComparator.get=function(){return be},me.BidirectionalComparator.get=function(){return Jn},me.coordArrayType.get=function(){return new Array(0).fill(null)},Mt.prototype.interfaces_=function(){return[]},Mt.prototype.getClass=function(){return Mt},Mt.isRing=function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])},Mt.ptNotInList=function(n,i){for(var s=0;s<n.length;s++){var l=n[s];if(Mt.indexOf(l,i)<0)return l}return null},Mt.scroll=function(n,i){var s=Mt.indexOf(i,n);if(s<0)return null;var l=new Array(n.length).fill(null);Zt.arraycopy(n,s,l,0,n.length-s),Zt.arraycopy(n,0,l,n.length-s,s),Zt.arraycopy(l,0,n,0,n.length)},Mt.equals=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(n===i)return!0;if(n===null||i===null||n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(!n[s].equals(i[s]))return!1;return!0}if(arguments.length===3){var l=arguments[0],h=arguments[1],v=arguments[2];if(l===h)return!0;if(l===null||h===null||l.length!==h.length)return!1;for(var S=0;S<l.length;S++)if(v.compare(l[S],h[S])!==0)return!1;return!0}},Mt.intersection=function(n,i){for(var s=new Kt,l=0;l<n.length;l++)i.intersects(n[l])&&s.add(n[l],!0);return s.toCoordinateArray()},Mt.hasRepeatedPoints=function(n){for(var i=1;i<n.length;i++)if(n[i-1].equals(n[i]))return!0;return!1},Mt.removeRepeatedPoints=function(n){return Mt.hasRepeatedPoints(n)?new Kt(n,!1).toCoordinateArray():n},Mt.reverse=function(n){for(var i=n.length-1,s=Math.trunc(i/2),l=0;l<=s;l++){var h=n[l];n[l]=n[i-l],n[i-l]=h}},Mt.removeNull=function(n){for(var i=0,s=0;s<n.length;s++)n[s]!==null&&i++;var l=new Array(i).fill(null);if(i===0)return l;for(var h=0,v=0;v<n.length;v++)n[v]!==null&&(l[h++]=n[v]);return l},Mt.copyDeep=function(){if(arguments.length===1){for(var n=arguments[0],i=new Array(n.length).fill(null),s=0;s<n.length;s++)i[s]=new U(n[s]);return i}if(arguments.length===5)for(var l=arguments[0],h=arguments[1],v=arguments[2],S=arguments[3],R=arguments[4],V=0;V<R;V++)v[S+V]=new U(l[h+V])},Mt.isEqualReversed=function(n,i){for(var s=0;s<n.length;s++){var l=n[s],h=i[n.length-s-1];if(l.compareTo(h)!==0)return!1}return!0},Mt.envelope=function(n){for(var i=new Vt,s=0;s<n.length;s++)i.expandToInclude(n[s]);return i},Mt.toCoordinateArray=function(n){return n.toArray(Mt.coordArrayType)},Mt.atLeastNCoordinatesOrNothing=function(n,i){return i.length>=n?i:[]},Mt.indexOf=function(n,i){for(var s=0;s<i.length;s++)if(n.equals(i[s]))return s;return-1},Mt.increasingDirection=function(n){for(var i=0;i<Math.trunc(n.length/2);i++){var s=n.length-1-i,l=n[i].compareTo(n[s]);if(l!==0)return l}return 1},Mt.compare=function(n,i){for(var s=0;s<n.length&&s<i.length;){var l=n[s].compareTo(i[s]);if(l!==0)return l;s++}return s<i.length?-1:s<n.length?1:0},Mt.minCoordinate=function(n){for(var i=null,s=0;s<n.length;s++)(i===null||i.compareTo(n[s])>0)&&(i=n[s]);return i},Mt.extract=function(n,i,s){i=pt.clamp(i,0,n.length);var l=(s=pt.clamp(s,-1,n.length))-i+1;s<0&&(l=0),i>=n.length&&(l=0),s<i&&(l=0);var h=new Array(l).fill(null);if(l===0)return h;for(var v=0,S=i;S<=s;S++)h[v++]=n[S];return h},Object.defineProperties(Mt,me);var be=function(){};be.prototype.compare=function(n,i){return Mt.compare(n,i)},be.prototype.interfaces_=function(){return[X]},be.prototype.getClass=function(){return be};var Jn=function(){};Jn.prototype.compare=function(n,i){var s=n,l=i;if(s.length<l.length)return-1;if(s.length>l.length)return 1;if(s.length===0)return 0;var h=Mt.compare(s,l);return Mt.isEqualReversed(s,l)?0:h},Jn.prototype.OLDcompare=function(n,i){var s=n,l=i;if(s.length<l.length)return-1;if(s.length>l.length)return 1;if(s.length===0)return 0;for(var h=Mt.increasingDirection(s),v=Mt.increasingDirection(l),S=h>0?0:s.length-1,R=v>0?0:s.length-1,V=0;V<s.length;V++){var nt=s[S].compareTo(l[R]);if(nt!==0)return nt;S+=h,R+=v}return 0},Jn.prototype.interfaces_=function(){return[X]},Jn.prototype.getClass=function(){return Jn};var $e=function(){};$e.prototype.get=function(){},$e.prototype.put=function(){},$e.prototype.size=function(){},$e.prototype.values=function(){},$e.prototype.entrySet=function(){};var Vi=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}($e);(a.prototype=new Error).name="OperationNotSupported",(c.prototype=new Jt).contains=function(){};var zr=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof Jt&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.contains=function(s){for(var l=0,h=this.array_.length;l<h;l++)if(this.array_[l]===s)return!0;return!1},i.prototype.add=function(s){return!this.contains(s)&&(this.array_.push(s),!0)},i.prototype.addAll=function(s){for(var l=s.iterator();l.hasNext();)this.add(l.next());return!0},i.prototype.remove=function(s){throw new Error},i.prototype.size=function(){return this.array_.length},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.toArray=function(){for(var s=[],l=0,h=this.array_.length;l<h;l++)s.push(this.array_[l]);return s},i.prototype.iterator=function(){return new Ja(this)},i}(c),Ja=function(n){function i(s){n.call(this),this.hashSet_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new o;return this.hashSet_.array_[this.position_++]},i.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},i.prototype.remove=function(){throw new a},i}(et),eo=0;(w.prototype=new Vi).get=function(n){for(var i=this.root_;i!==null;){var s=n.compareTo(i.key);if(s<0)i=i.left;else{if(!(s>0))return i.value;i=i.right}}return null},w.prototype.put=function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:eo,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var s,l,h=this.root_;do if(s=h,(l=n.compareTo(h.key))<0)h=h.left;else{if(!(l>0)){var v=h.value;return h.value=i,v}h=h.right}while(h!==null);var S={key:n,left:null,right:null,value:i,parent:s,color:eo,getValue:function(){return this.value},getKey:function(){return this.key}};return l<0?s.left=S:s.right=S,this.fixAfterInsertion(S),this.size_++,null},w.prototype.fixAfterInsertion=function(n){for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)if(d(n)===y(d(d(n)))){var i=_(d(d(n)));p(i)===1?(g(d(n),eo),g(i,eo),g(d(d(n)),1),n=d(d(n))):(n===_(d(n))&&(n=d(n),this.rotateLeft(n)),g(d(n),eo),g(d(d(n)),1),this.rotateRight(d(d(n))))}else{var s=y(d(d(n)));p(s)===1?(g(d(n),eo),g(s,eo),g(d(d(n)),1),n=d(d(n))):(n===y(d(n))&&(n=d(n),this.rotateRight(n)),g(d(n),eo),g(d(d(n)),1),this.rotateLeft(d(d(n))))}this.root_.color=eo},w.prototype.values=function(){var n=new ct,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=w.successor(i))!==null;)n.add(i.value);return n},w.prototype.entrySet=function(){var n=new zr,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=w.successor(i))!==null;)n.add(i);return n},w.prototype.rotateLeft=function(n){if(n!=null){var i=n.right;n.right=i.left,i.left!=null&&(i.left.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.left===n?n.parent.left=i:n.parent.right=i,i.left=n,n.parent=i}},w.prototype.rotateRight=function(n){if(n!=null){var i=n.left;n.left=i.right,i.right!=null&&(i.right.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.right===n?n.parent.right=i:n.parent.left=i,i.right=n,n.parent=i}},w.prototype.getFirstEntry=function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n},w.successor=function(n){if(n===null)return null;if(n.right!==null){for(var i=n.right;i.left!==null;)i=i.left;return i}for(var s=n.parent,l=n;s!==null&&l===s.right;)l=s,s=s.parent;return s},w.prototype.size=function(){return this.size_};var ya=function(){};ya.prototype.interfaces_=function(){return[]},ya.prototype.getClass=function(){return ya},x.prototype=new c,(T.prototype=new x).contains=function(n){for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===0)return!0;return!1},T.prototype.add=function(n){if(this.contains(n))return!1;for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===1)return this.array_.splice(i,0,n),!0;return this.array_.push(n),!0},T.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next());return!0},T.prototype.remove=function(n){throw new a},T.prototype.size=function(){return this.array_.length},T.prototype.isEmpty=function(){return this.array_.length===0},T.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n},T.prototype.iterator=function(){return new As(this)};var As=function(n){this.treeSet_=n,this.position_=0};As.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},As.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},As.prototype.remove=function(){throw new a};var Ho=function(){};Ho.sort=function(){var n,i,s,l,h=arguments[0];if(arguments.length===1)l=function(S,R){return S.compareTo(R)},h.sort(l);else if(arguments.length===2)s=arguments[1],l=function(S,R){return s.compare(S,R)},h.sort(l);else if(arguments.length===3){(i=h.slice(arguments[1],arguments[2])).sort();var v=h.slice(0,arguments[1]).concat(i,h.slice(arguments[2],h.length));for(h.splice(0,h.length),n=0;n<v.length;n++)h.push(v[n])}else if(arguments.length===4)for(i=h.slice(arguments[1],arguments[2]),s=arguments[3],l=function(S,R){return s.compare(S,R)},i.sort(l),v=h.slice(0,arguments[1]).concat(i,h.slice(arguments[2],h.length)),h.splice(0,h.length),n=0;n<v.length;n++)h.push(v[n])},Ho.asList=function(n){for(var i=new ct,s=0,l=n.length;s<l;s++)i.add(n[s]);return i};var Be=function(){},fi={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};fi.P.get=function(){return 0},fi.L.get=function(){return 1},fi.A.get=function(){return 2},fi.FALSE.get=function(){return-1},fi.TRUE.get=function(){return-2},fi.DONTCARE.get=function(){return-3},fi.SYM_FALSE.get=function(){return"F"},fi.SYM_TRUE.get=function(){return"T"},fi.SYM_DONTCARE.get=function(){return"*"},fi.SYM_P.get=function(){return"0"},fi.SYM_L.get=function(){return"1"},fi.SYM_A.get=function(){return"2"},Be.prototype.interfaces_=function(){return[]},Be.prototype.getClass=function(){return Be},Be.toDimensionSymbol=function(n){switch(n){case Be.FALSE:return Be.SYM_FALSE;case Be.TRUE:return Be.SYM_TRUE;case Be.DONTCARE:return Be.SYM_DONTCARE;case Be.P:return Be.SYM_P;case Be.L:return Be.SYM_L;case Be.A:return Be.SYM_A}throw new L("Unknown dimension value: "+n)},Be.toDimensionValue=function(n){switch(dt.toUpperCase(n)){case Be.SYM_FALSE:return Be.FALSE;case Be.SYM_TRUE:return Be.TRUE;case Be.SYM_DONTCARE:return Be.DONTCARE;case Be.SYM_P:return Be.P;case Be.SYM_L:return Be.L;case Be.SYM_A:return Be.A}throw new L("Unknown dimension symbol: "+n)},Object.defineProperties(Be,fi);var Wi=function(){};Wi.prototype.filter=function(n){},Wi.prototype.interfaces_=function(){return[]},Wi.prototype.getClass=function(){return Wi};var Ci=function(){};Ci.prototype.filter=function(n,i){},Ci.prototype.isDone=function(){},Ci.prototype.isGeometryChanged=function(){},Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci};var Sr=function(n){function i(l,h){if(n.call(this,h),this._geometries=l||[],n.hasNullElements(this._geometries))throw new L("geometries must not contain null elements")}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){for(var l=new Vt,h=0;h<this._geometries.length;h++)l.expandToInclude(this._geometries[h].getEnvelopeInternal());return l},i.prototype.getGeometryN=function(l){return this._geometries[l]},i.prototype.getSortIndex=function(){return n.SORTINDEX_GEOMETRYCOLLECTION},i.prototype.getCoordinates=function(){for(var l=new Array(this.getNumPoints()).fill(null),h=-1,v=0;v<this._geometries.length;v++)for(var S=this._geometries[v].getCoordinates(),R=0;R<S.length;R++)l[++h]=S[R];return l},i.prototype.getArea=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getArea();return l},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var v=l;if(this._geometries.length!==v._geometries.length)return!1;for(var S=0;S<this._geometries.length;S++)if(!this._geometries[S].equalsExact(v._geometries[S],h))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var l=0;l<this._geometries.length;l++)this._geometries[l].normalize();Ho.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var l=Be.FALSE,h=0;h<this._geometries.length;h++)l=Math.max(l,this._geometries[h].getBoundaryDimension());return l},i.prototype.getDimension=function(){for(var l=Be.FALSE,h=0;h<this._geometries.length;h++)l=Math.max(l,this._geometries[h].getDimension());return l},i.prototype.getLength=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getLength();return l},i.prototype.getNumPoints=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getNumPoints();return l},i.prototype.getNumGeometries=function(){return this._geometries.length},i.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),v=0;v<this._geometries.length;v++)h[v]=this._geometries[v].reverse();return this.getFactory().createGeometryCollection(h)},i.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0],h=new T(Ho.asList(this._geometries)),v=new T(Ho.asList(l._geometries));return this.compare(h,v)}if(arguments.length===2){for(var S=arguments[0],R=arguments[1],V=S,nt=this.getNumGeometries(),_t=V.getNumGeometries(),Et=0;Et<nt&&Et<_t;){var Wt=this.getGeometryN(Et),$t=V.getGeometryN(Et),ie=Wt.compareToSameClass($t,R);if(ie!==0)return ie;Et++}return Et<nt?1:Et<_t?-1:0}},i.prototype.apply=function(){if(j(arguments[0],Ut))for(var l=arguments[0],h=0;h<this._geometries.length;h++)this._geometries[h].apply(l);else if(j(arguments[0],Ci)){var v=arguments[0];if(this._geometries.length===0)return null;for(var S=0;S<this._geometries.length&&(this._geometries[S].apply(v),!v.isDone());S++);v.isGeometryChanged()&&this.geometryChanged()}else if(j(arguments[0],Wi)){var R=arguments[0];R.filter(this);for(var V=0;V<this._geometries.length;V++)this._geometries[V].apply(R)}else if(j(arguments[0],wt)){var nt=arguments[0];nt.filter(this);for(var _t=0;_t<this._geometries.length;_t++)this._geometries[_t].apply(nt)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),P.shouldNeverReachHere(),null},i.prototype.clone=function(){var l=n.prototype.clone.call(this);l._geometries=new Array(this._geometries.length).fill(null);for(var h=0;h<this._geometries.length;h++)l._geometries[h]=this._geometries[h].clone();return l},i.prototype.getGeometryType=function(){return"GeometryCollection"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.isEmpty=function(){for(var l=0;l<this._geometries.length;l++)if(!this._geometries[l].isEmpty())return!1;return!0},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(i,s),i}(lt),K=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return lt.SORTINDEX_MULTILINESTRING},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&n.prototype.equalsExact.call(this,l,h)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?Be.FALSE:0},i.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var l=0;l<this._geometries.length;l++)if(!this._geometries[l].isClosed())return!1;return!0},i.prototype.getDimension=function(){return 1},i.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),v=0;v<this._geometries.length;v++)h[l-1-v]=this._geometries[v].reverse();return this.getFactory().createMultiLineString(h)},i.prototype.getBoundary=function(){return new mt(this).getBoundary()},i.prototype.getGeometryType=function(){return"MultiLineString"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.interfaces_=function(){return[ya]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,s),i}(Sr),mt=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var n=arguments[0],i=Xt.MOD2_BOUNDARY_RULE;this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this._geom=s,this._geomFact=s.getFactory(),this._bnRule=l}};mt.prototype.boundaryMultiLineString=function(n){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var i=this.computeBoundaryCoordinates(n);return i.length===1?this._geomFact.createPoint(i[0]):this._geomFact.createMultiPointFromCoords(i)},mt.prototype.getBoundary=function(){return this._geom instanceof Qt?this.boundaryLineString(this._geom):this._geom instanceof K?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},mt.prototype.boundaryLineString=function(n){return this._geom.isEmpty()?this.getEmptyMultiPoint():n.isClosed()?this._bnRule.isInBoundary(2)?n.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([n.getStartPoint(),n.getEndPoint()])},mt.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},mt.prototype.computeBoundaryCoordinates=function(n){var i=new ct;this._endpointMap=new w;for(var s=0;s<n.getNumGeometries();s++){var l=n.getGeometryN(s);l.getNumPoints()!==0&&(this.addEndpoint(l.getCoordinateN(0)),this.addEndpoint(l.getCoordinateN(l.getNumPoints()-1)))}for(var h=this._endpointMap.entrySet().iterator();h.hasNext();){var v=h.next(),S=v.getValue().count;this._bnRule.isInBoundary(S)&&i.add(v.getKey())}return Mt.toCoordinateArray(i)},mt.prototype.addEndpoint=function(n){var i=this._endpointMap.get(n);i===null&&(i=new Pt,this._endpointMap.put(n,i)),i.count++},mt.prototype.interfaces_=function(){return[]},mt.prototype.getClass=function(){return mt},mt.getBoundary=function(){if(arguments.length===1){var n=arguments[0];return new mt(n).getBoundary()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new mt(i,s).getBoundary()}};var Pt=function(){this.count=null};Pt.prototype.interfaces_=function(){return[]},Pt.prototype.getClass=function(){return Pt};var yt=function(){},Rt={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};yt.prototype.interfaces_=function(){return[]},yt.prototype.getClass=function(){return yt},yt.chars=function(n,i){for(var s=new Array(i).fill(null),l=0;l<i;l++)s[l]=n;return String(s)},yt.getStackTrace=function(){if(arguments.length===1){var n=arguments[0],i=new function(){},s=new function(){}(i);return n.printStackTrace(s),i.toString()}if(arguments.length===2){for(var l=arguments[0],h=arguments[1],v="",S=new function(){}(new function(){}(yt.getStackTrace(l))),R=0;R<h;R++)try{v+=S.readLine()+yt.NEWLINE}catch(V){if(!(V instanceof C))throw V;P.shouldNeverReachHere()}return v}},yt.split=function(n,i){for(var s=i.length,l=new ct,h=""+n,v=h.indexOf(i);v>=0;){var S=h.substring(0,v);l.add(S),v=(h=h.substring(v+s)).indexOf(i)}h.length>0&&l.add(h);for(var R=new Array(l.size()).fill(null),V=0;V<R.length;V++)R[V]=l.get(V);return R},yt.toString=function(){if(arguments.length===1){var n=arguments[0];return yt.SIMPLE_ORDINATE_FORMAT.format(n)}},yt.spaces=function(n){return yt.chars(" ",n)},Rt.NEWLINE.get=function(){return Zt.getProperty("line.separator")},Rt.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(yt,Rt);var Yt=function(){};Yt.prototype.interfaces_=function(){return[]},Yt.prototype.getClass=function(){return Yt},Yt.copyCoord=function(n,i,s,l){for(var h=Math.min(n.getDimension(),s.getDimension()),v=0;v<h;v++)s.setOrdinate(l,v,n.getOrdinate(i,v))},Yt.isRing=function(n){var i=n.size();return i===0||!(i<=3)&&n.getOrdinate(0,bt.X)===n.getOrdinate(i-1,bt.X)&&n.getOrdinate(0,bt.Y)===n.getOrdinate(i-1,bt.Y)},Yt.isEqual=function(n,i){var s=n.size();if(s!==i.size())return!1;for(var l=Math.min(n.getDimension(),i.getDimension()),h=0;h<s;h++)for(var v=0;v<l;v++){var S=n.getOrdinate(h,v),R=i.getOrdinate(h,v);if(n.getOrdinate(h,v)!==i.getOrdinate(h,v)&&(!A.isNaN(S)||!A.isNaN(R)))return!1}return!0},Yt.extend=function(n,i,s){var l=n.create(s,i.getDimension()),h=i.size();if(Yt.copy(i,0,l,0,h),h>0)for(var v=h;v<s;v++)Yt.copy(i,h-1,l,v,1);return l},Yt.reverse=function(n){for(var i=n.size()-1,s=Math.trunc(i/2),l=0;l<=s;l++)Yt.swap(n,l,i-l)},Yt.swap=function(n,i,s){if(i===s)return null;for(var l=0;l<n.getDimension();l++){var h=n.getOrdinate(i,l);n.setOrdinate(i,l,n.getOrdinate(s,l)),n.setOrdinate(s,l,h)}},Yt.copy=function(n,i,s,l,h){for(var v=0;v<h;v++)Yt.copyCoord(n,i+v,s,l+v)},Yt.toString=function(){if(arguments.length===1){var n=arguments[0],i=n.size();if(i===0)return"()";var s=n.getDimension(),l=new Tt;l.append("(");for(var h=0;h<i;h++){h>0&&l.append(" ");for(var v=0;v<s;v++)v>0&&l.append(","),l.append(yt.toString(n.getOrdinate(h,v)))}return l.append(")"),l.toString()}},Yt.ensureValidRing=function(n,i){var s=i.size();return s===0?i:s<=3?Yt.createClosedRing(n,i,4):i.getOrdinate(0,bt.X)===i.getOrdinate(s-1,bt.X)&&i.getOrdinate(0,bt.Y)===i.getOrdinate(s-1,bt.Y)?i:Yt.createClosedRing(n,i,s+1)},Yt.createClosedRing=function(n,i,s){var l=n.create(s,i.getDimension()),h=i.size();Yt.copy(i,0,l,0,h);for(var v=h;v<s;v++)Yt.copy(i,0,l,v,1);return l};var Qt=function(n){function i(l,h){n.call(this,h),this._points=null,this.init(l)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new Vt:this._points.expandEnvelope(new Vt)},i.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},i.prototype.getSortIndex=function(){return n.SORTINDEX_LINESTRING},i.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var v=l;if(this._points.size()!==v._points.size())return!1;for(var S=0;S<this._points.size();S++)if(!this.equal(this._points.getCoordinate(S),v._points.getCoordinate(S),h))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var l=0;l<Math.trunc(this._points.size()/2);l++){var h=this._points.size()-1-l;if(!this._points.getCoordinate(l).equals(this._points.getCoordinate(h)))return this._points.getCoordinate(l).compareTo(this._points.getCoordinate(h))>0&&Yt.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?Be.FALSE:0},i.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},i.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},i.prototype.getDimension=function(){return 1},i.prototype.getLength=function(){return W.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var l=this._points.copy();return Yt.reverse(l),this.getFactory().createLineString(l)},i.prototype.compareToSameClass=function(){if(arguments.length===1){for(var l=arguments[0],h=0,v=0;h<this._points.size()&&v<l._points.size();){var S=this._points.getCoordinate(h).compareTo(l._points.getCoordinate(v));if(S!==0)return S;h++,v++}return h<this._points.size()?1:v<l._points.size()?-1:0}if(arguments.length===2){var R=arguments[0];return arguments[1].compare(this._points,R._points)}},i.prototype.apply=function(){if(j(arguments[0],Ut))for(var l=arguments[0],h=0;h<this._points.size();h++)l.filter(this._points.getCoordinate(h));else if(j(arguments[0],Ci)){var v=arguments[0];if(this._points.size()===0)return null;for(var S=0;S<this._points.size()&&(v.filter(this._points,S),!v.isDone());S++);v.isGeometryChanged()&&this.geometryChanged()}else j(arguments[0],Wi)?arguments[0].filter(this):j(arguments[0],wt)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new mt(this).getBoundary()},i.prototype.isEquivalentClass=function(l){return l instanceof i},i.prototype.clone=function(){var l=n.prototype.clone.call(this);return l._points=this._points.clone(),l},i.prototype.getCoordinateN=function(l){return this._points.getCoordinate(l)},i.prototype.getGeometryType=function(){return"LineString"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._points},i.prototype.isEmpty=function(){return this._points.size()===0},i.prototype.init=function(l){if(l===null&&(l=this.getFactory().getCoordinateSequenceFactory().create([])),l.size()===1)throw new L("Invalid number of points in LineString (found "+l.size()+" - must be 0 or >= 2)");this._points=l},i.prototype.isCoordinate=function(l){for(var h=0;h<this._points.size();h++)if(this._points.getCoordinate(h).equals(l))return!0;return!1},i.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},i.prototype.getPointN=function(l){return this.getFactory().createPoint(this._points.getCoordinate(l))},i.prototype.interfaces_=function(){return[ya]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,s),i}(lt),Te=function(){};Te.prototype.interfaces_=function(){return[]},Te.prototype.getClass=function(){return Te};var ge=function(n){function i(l,h){n.call(this,h),this._coordinates=l||null,this.init(this._coordinates)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new Vt;var l=new Vt;return l.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),l},i.prototype.getSortIndex=function(){return n.SORTINDEX_POINT},i.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&(!(!this.isEmpty()||!l.isEmpty())||this.isEmpty()===l.isEmpty()&&this.equal(l.getCoordinate(),this.getCoordinate(),h))}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){},i.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},i.prototype.getBoundaryDimension=function(){return Be.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getNumPoints=function(){return this.isEmpty()?0:1},i.prototype.reverse=function(){return this.copy()},i.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},i.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0];return this.getCoordinate().compareTo(l.getCoordinate())}if(arguments.length===2){var h=arguments[0];return arguments[1].compare(this._coordinates,h._coordinates)}},i.prototype.apply=function(){if(j(arguments[0],Ut)){var l=arguments[0];if(this.isEmpty())return null;l.filter(this.getCoordinate())}else if(j(arguments[0],Ci)){var h=arguments[0];if(this.isEmpty())return null;h.filter(this._coordinates,0),h.isGeometryChanged()&&this.geometryChanged()}else j(arguments[0],Wi)?arguments[0].filter(this):j(arguments[0],wt)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.clone=function(){var l=n.prototype.clone.call(this);return l._coordinates=this._coordinates.clone(),l},i.prototype.getGeometryType=function(){return"Point"},i.prototype.copy=function(){return new i(this._coordinates.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._coordinates},i.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},i.prototype.isEmpty=function(){return this._coordinates.size()===0},i.prototype.init=function(l){l===null&&(l=this.getFactory().getCoordinateSequenceFactory().create([])),P.isTrue(l.size()<=1),this._coordinates=l},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[Te]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,s),i}(lt),Ne=function(){};Ne.prototype.interfaces_=function(){return[]},Ne.prototype.getClass=function(){return Ne};var ue=function(n){function i(l,h,v){if(n.call(this,v),this._shell=null,this._holes=null,l===null&&(l=this.getFactory().createLinearRing()),h===null&&(h=[]),n.hasNullElements(h))throw new L("holes must not contain null elements");if(l.isEmpty()&&n.hasNonEmptyElements(h))throw new L("shell is empty but holes are not");this._shell=l,this._holes=h}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},i.prototype.getSortIndex=function(){return n.SORTINDEX_POLYGON},i.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var l=new Array(this.getNumPoints()).fill(null),h=-1,v=this._shell.getCoordinates(),S=0;S<v.length;S++)l[++h]=v[S];for(var R=0;R<this._holes.length;R++)for(var V=this._holes[R].getCoordinates(),nt=0;nt<V.length;nt++)l[++h]=V[nt];return l},i.prototype.getArea=function(){var l=0;l+=Math.abs(W.signedArea(this._shell.getCoordinateSequence()));for(var h=0;h<this._holes.length;h++)l-=Math.abs(W.signedArea(this._holes[h].getCoordinateSequence()));return l},i.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var l=this._shell.getCoordinateSequence(),h=this.getEnvelopeInternal(),v=0;v<5;v++){var S=l.getX(v);if(S!==h.getMinX()&&S!==h.getMaxX())return!1;var R=l.getY(v);if(R!==h.getMinY()&&R!==h.getMaxY())return!1}for(var V=l.getX(0),nt=l.getY(0),_t=1;_t<=4;_t++){var Et=l.getX(_t),Wt=l.getY(_t);if(Et!==V==(Wt!==nt))return!1;V=Et,nt=Wt}return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var v=l,S=this._shell,R=v._shell;if(!S.equalsExact(R,h)||this._holes.length!==v._holes.length)return!1;for(var V=0;V<this._holes.length;V++)if(!this._holes[V].equalsExact(v._holes[V],h))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var l=0;l<this._holes.length;l++)this.normalize(this._holes[l],!1);Ho.sort(this._holes)}else if(arguments.length===2){var h=arguments[0],v=arguments[1];if(h.isEmpty())return null;var S=new Array(h.getCoordinates().length-1).fill(null);Zt.arraycopy(h.getCoordinates(),0,S,0,S.length);var R=Mt.minCoordinate(h.getCoordinates());Mt.scroll(S,R),Zt.arraycopy(S,0,h.getCoordinates(),0,S.length),h.getCoordinates()[S.length]=S[0],W.isCCW(h.getCoordinates())===v&&Mt.reverse(h.getCoordinates())}},i.prototype.getCoordinate=function(){return this._shell.getCoordinate()},i.prototype.getNumInteriorRing=function(){return this._holes.length},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.getLength=function(){var l=0;l+=this._shell.getLength();for(var h=0;h<this._holes.length;h++)l+=this._holes[h].getLength();return l},i.prototype.getNumPoints=function(){for(var l=this._shell.getNumPoints(),h=0;h<this._holes.length;h++)l+=this._holes[h].getNumPoints();return l},i.prototype.reverse=function(){var l=this.copy();l._shell=this._shell.copy().reverse(),l._holes=new Array(this._holes.length).fill(null);for(var h=0;h<this._holes.length;h++)l._holes[h]=this._holes[h].copy().reverse();return l},i.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},i.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0],h=this._shell,v=l._shell;return h.compareToSameClass(v)}if(arguments.length===2){var S=arguments[0],R=arguments[1],V=S,nt=this._shell,_t=V._shell,Et=nt.compareToSameClass(_t,R);if(Et!==0)return Et;for(var Wt=this.getNumInteriorRing(),$t=V.getNumInteriorRing(),ie=0;ie<Wt&&ie<$t;){var Ee=this.getInteriorRingN(ie),An=V.getInteriorRingN(ie),Wn=Ee.compareToSameClass(An,R);if(Wn!==0)return Wn;ie++}return ie<Wt?1:ie<$t?-1:0}},i.prototype.apply=function(l){if(j(l,Ut)){this._shell.apply(l);for(var h=0;h<this._holes.length;h++)this._holes[h].apply(l)}else if(j(l,Ci)){if(this._shell.apply(l),!l.isDone())for(var v=0;v<this._holes.length&&(this._holes[v].apply(l),!l.isDone());v++);l.isGeometryChanged()&&this.geometryChanged()}else if(j(l,Wi))l.filter(this);else if(j(l,wt)){l.filter(this),this._shell.apply(l);for(var S=0;S<this._holes.length;S++)this._holes[S].apply(l)}},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var l=new Array(this._holes.length+1).fill(null);l[0]=this._shell;for(var h=0;h<this._holes.length;h++)l[h+1]=this._holes[h];return l.length<=1?this.getFactory().createLinearRing(l[0].getCoordinateSequence()):this.getFactory().createMultiLineString(l)},i.prototype.clone=function(){var l=n.prototype.clone.call(this);l._shell=this._shell.clone(),l._holes=new Array(this._holes.length).fill(null);for(var h=0;h<this._holes.length;h++)l._holes[h]=this._holes[h].clone();return l},i.prototype.getGeometryType=function(){return"Polygon"},i.prototype.copy=function(){for(var l=this._shell.copy(),h=new Array(this._holes.length).fill(null),v=0;v<h.length;v++)h[v]=this._holes[v].copy();return new i(l,h,this._factory)},i.prototype.getExteriorRing=function(){return this._shell},i.prototype.isEmpty=function(){return this._shell.isEmpty()},i.prototype.getInteriorRingN=function(l){return this._holes[l]},i.prototype.interfaces_=function(){return[Ne]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(i,s),i}(lt),Oe=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return lt.SORTINDEX_MULTIPOINT},i.prototype.isValid=function(){return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&n.prototype.equalsExact.call(this,l,h)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getCoordinate=function(){if(arguments.length===1){var l=arguments[0];return this._geometries[l].getCoordinate()}return n.prototype.getCoordinate.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return Be.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.getGeometryType=function(){return"MultiPoint"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.interfaces_=function(){return[Te]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,s),i}(Sr),bn=function(n){function i(l,h){l instanceof U&&h instanceof Ce&&(l=h.getCoordinateSequenceFactory().create(l)),n.call(this,l,h),this.validateConstruction()}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return lt.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return Be.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},i.prototype.reverse=function(){var l=this._points.copy();return Yt.reverse(l),this.getFactory().createLinearRing(l)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new L("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new L("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},i.prototype.getGeometryType=function(){return"LinearRing"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.MINIMUM_VALID_SIZE.get=function(){return 4},s.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(i,s),i}(Qt),Un=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return lt.SORTINDEX_MULTIPOLYGON},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&n.prototype.equalsExact.call(this,l,h)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),v=0;v<this._geometries.length;v++)h[v]=this._geometries[v].reverse();return this.getFactory().createMultiPolygon(h)},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var l=new ct,h=0;h<this._geometries.length;h++)for(var v=this._geometries[h].getBoundary(),S=0;S<v.getNumGeometries();S++)l.add(v.getGeometryN(S));var R=new Array(l.size()).fill(null);return this.getFactory().createMultiLineString(l.toArray(R))},i.prototype.getGeometryType=function(){return"MultiPolygon"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.interfaces_=function(){return[Ne]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(i,s),i}(Sr),Kn=function(n){this._factory=n||null,this._isUserDataCopied=!1},qi={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Kn.prototype.setCopyUserData=function(n){this._isUserDataCopied=n},Kn.prototype.edit=function(n,i){if(n===null)return null;var s=this.editInternal(n,i);return this._isUserDataCopied&&s.setUserData(n.getUserData()),s},Kn.prototype.editInternal=function(n,i){return this._factory===null&&(this._factory=n.getFactory()),n instanceof Sr?this.editGeometryCollection(n,i):n instanceof ue?this.editPolygon(n,i):n instanceof ge?i.edit(n,this._factory):n instanceof Qt?i.edit(n,this._factory):(P.shouldNeverReachHere("Unsupported Geometry class: "+n.getClass().getName()),null)},Kn.prototype.editGeometryCollection=function(n,i){for(var s=i.edit(n,this._factory),l=new ct,h=0;h<s.getNumGeometries();h++){var v=this.edit(s.getGeometryN(h),i);v===null||v.isEmpty()||l.add(v)}return s.getClass()===Oe?this._factory.createMultiPoint(l.toArray([])):s.getClass()===K?this._factory.createMultiLineString(l.toArray([])):s.getClass()===Un?this._factory.createMultiPolygon(l.toArray([])):this._factory.createGeometryCollection(l.toArray([]))},Kn.prototype.editPolygon=function(n,i){var s=i.edit(n,this._factory);if(s===null&&(s=this._factory.createPolygon(null)),s.isEmpty())return s;var l=this.edit(s.getExteriorRing(),i);if(l===null||l.isEmpty())return this._factory.createPolygon();for(var h=new ct,v=0;v<s.getNumInteriorRing();v++){var S=this.edit(s.getInteriorRingN(v),i);S===null||S.isEmpty()||h.add(S)}return this._factory.createPolygon(l,h.toArray([]))},Kn.prototype.interfaces_=function(){return[]},Kn.prototype.getClass=function(){return Kn},Kn.GeometryEditorOperation=function(){},qi.NoOpGeometryOperation.get=function(){return ir},qi.CoordinateOperation.get=function(){return ze},qi.CoordinateSequenceOperation.get=function(){return Cs},Object.defineProperties(Kn,qi);var ir=function(){};ir.prototype.edit=function(n,i){return n},ir.prototype.interfaces_=function(){return[Kn.GeometryEditorOperation]},ir.prototype.getClass=function(){return ir};var ze=function(){};ze.prototype.edit=function(n,i){var s=this.editCoordinates(n.getCoordinates(),n);return s===null?n:n instanceof bn?i.createLinearRing(s):n instanceof Qt?i.createLineString(s):n instanceof ge?s.length>0?i.createPoint(s[0]):i.createPoint():n},ze.prototype.interfaces_=function(){return[Kn.GeometryEditorOperation]},ze.prototype.getClass=function(){return ze};var Cs=function(){};Cs.prototype.edit=function(n,i){return n instanceof bn?i.createLinearRing(this.edit(n.getCoordinateSequence(),n)):n instanceof Qt?i.createLineString(this.edit(n.getCoordinateSequence(),n)):n instanceof ge?i.createPoint(this.edit(n.getCoordinateSequence(),n)):n},Cs.prototype.interfaces_=function(){return[Kn.GeometryEditorOperation]},Cs.prototype.getClass=function(){return Cs};var De=function(){if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=new Array(n).fill(null);for(var i=0;i<n;i++)this._coordinates[i]=new U}else if(j(arguments[0],bt)){var s=arguments[0];if(s===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=s.getDimension(),this._coordinates=new Array(s.size()).fill(null);for(var l=0;l<this._coordinates.length;l++)this._coordinates[l]=s.getCoordinateCopy(l)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var h=arguments[0],v=arguments[1];this._coordinates=h,this._dimension=v,h===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var S=arguments[0],R=arguments[1];this._coordinates=new Array(S).fill(null),this._dimension=R;for(var V=0;V<S;V++)this._coordinates[V]=new U}}},Vo={serialVersionUID:{configurable:!0}};De.prototype.setOrdinate=function(n,i,s){switch(i){case bt.X:this._coordinates[n].x=s;break;case bt.Y:this._coordinates[n].y=s;break;case bt.Z:this._coordinates[n].z=s;break;default:throw new L("invalid ordinateIndex")}},De.prototype.size=function(){return this._coordinates.length},De.prototype.getOrdinate=function(n,i){switch(i){case bt.X:return this._coordinates[n].x;case bt.Y:return this._coordinates[n].y;case bt.Z:return this._coordinates[n].z}return A.NaN},De.prototype.getCoordinate=function(){if(arguments.length===1){var n=arguments[0];return this._coordinates[n]}if(arguments.length===2){var i=arguments[0],s=arguments[1];s.x=this._coordinates[i].x,s.y=this._coordinates[i].y,s.z=this._coordinates[i].z}},De.prototype.getCoordinateCopy=function(n){return new U(this._coordinates[n])},De.prototype.getDimension=function(){return this._dimension},De.prototype.getX=function(n){return this._coordinates[n].x},De.prototype.clone=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].clone();return new De(n,this._dimension)},De.prototype.expandEnvelope=function(n){for(var i=0;i<this._coordinates.length;i++)n.expandToInclude(this._coordinates[i]);return n},De.prototype.copy=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].copy();return new De(n,this._dimension)},De.prototype.toString=function(){if(this._coordinates.length>0){var n=new Tt(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var i=1;i<this._coordinates.length;i++)n.append(", "),n.append(this._coordinates[i]);return n.append(")"),n.toString()}return"()"},De.prototype.getY=function(n){return this._coordinates[n].y},De.prototype.toCoordinateArray=function(){return this._coordinates},De.prototype.interfaces_=function(){return[bt,t]},De.prototype.getClass=function(){return De},Vo.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(De,Vo);var Pi=function(){},Wo={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};Pi.prototype.readResolve=function(){return Pi.instance()},Pi.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new De(n)}if(j(arguments[0],bt)){var i=arguments[0];return new De(i)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return l>3&&(l=3),l<2?new De(s):new De(s,l)}},Pi.prototype.interfaces_=function(){return[gt,t]},Pi.prototype.getClass=function(){return Pi},Pi.instance=function(){return Pi.instanceObject},Wo.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Wo.instanceObject.get=function(){return new Pi},Object.defineProperties(Pi,Wo);var Ka=function(n){function i(){n.call(this),this.map_=new Map}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(s){return this.map_.get(s)||null},i.prototype.put=function(s,l){return this.map_.set(s,l),l},i.prototype.values=function(){for(var s=new ct,l=this.map_.values(),h=l.next();!h.done;)s.add(h.value),h=l.next();return s},i.prototype.entrySet=function(){var s=new zr;return this.map_.entries().forEach(function(l){return s.add(l)}),s},i.prototype.size=function(){return this.map_.size()},i}($e),Me=function n(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=n.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof ti){var i=arguments[0];this._modelType=i,i===n.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var s=arguments[0];this._modelType=n.FIXED,this.setScale(s)}else if(arguments[0]instanceof n){var l=arguments[0];this._modelType=l._modelType,this._scale=l._scale}}},Xi={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Me.prototype.equals=function(n){if(!(n instanceof Me))return!1;var i=n;return this._modelType===i._modelType&&this._scale===i._scale},Me.prototype.compareTo=function(n){var i=n,s=this.getMaximumSignificantDigits(),l=i.getMaximumSignificantDigits();return new ft(s).compareTo(new ft(l))},Me.prototype.getScale=function(){return this._scale},Me.prototype.isFloating=function(){return this._modelType===Me.FLOATING||this._modelType===Me.FLOATING_SINGLE},Me.prototype.getType=function(){return this._modelType},Me.prototype.toString=function(){var n="UNKNOWN";return this._modelType===Me.FLOATING?n="Floating":this._modelType===Me.FLOATING_SINGLE?n="Floating-Single":this._modelType===Me.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n},Me.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var n=arguments[0];return A.isNaN(n)||this._modelType===Me.FLOATING_SINGLE?n:this._modelType===Me.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof U){var i=arguments[0];if(this._modelType===Me.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}},Me.prototype.getMaximumSignificantDigits=function(){var n=16;return this._modelType===Me.FLOATING?n=16:this._modelType===Me.FLOATING_SINGLE?n=6:this._modelType===Me.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n},Me.prototype.setScale=function(n){this._scale=Math.abs(n)},Me.prototype.interfaces_=function(){return[t,G]},Me.prototype.getClass=function(){return Me},Me.mostPrecise=function(n,i){return n.compareTo(i)>=0?n:i},Xi.serialVersionUID.get=function(){return 7777263578777804e3},Xi.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(Me,Xi);var ti=function n(i){this._name=i||null,n.nameToTypeMap.put(i,this)},ei={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ti.prototype.readResolve=function(){return ti.nameToTypeMap.get(this._name)},ti.prototype.toString=function(){return this._name},ti.prototype.interfaces_=function(){return[t]},ti.prototype.getClass=function(){return ti},ei.serialVersionUID.get=function(){return-552860263173159e4},ei.nameToTypeMap.get=function(){return new Ka},Object.defineProperties(ti,ei),Me.Type=ti,Me.FIXED=new ti("FIXED"),Me.FLOATING=new ti("FLOATING"),Me.FLOATING_SINGLE=new ti("FLOATING SINGLE");var Ce=function n(){this._precisionModel=new Me,this._SRID=0,this._coordinateSequenceFactory=n.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?j(arguments[0],gt)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Me&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},Ou={serialVersionUID:{configurable:!0}};Ce.prototype.toGeometry=function(n){return n.isNull()?this.createPoint(null):n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new U(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new U(n.getMinX(),n.getMinY()),new U(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new U(n.getMinX(),n.getMinY()),new U(n.getMinX(),n.getMaxY()),new U(n.getMaxX(),n.getMaxY()),new U(n.getMaxX(),n.getMinY()),new U(n.getMinX(),n.getMinY())]),null)},Ce.prototype.createLineString=function(n){return n?n instanceof Array?new Qt(this.getCoordinateSequenceFactory().create(n),this):j(n,bt)?new Qt(n,this):void 0:new Qt(this.getCoordinateSequenceFactory().create([]),this)},Ce.prototype.createMultiLineString=function(){if(arguments.length===0)return new K(null,this);if(arguments.length===1){var n=arguments[0];return new K(n,this)}},Ce.prototype.buildGeometry=function(n){for(var i=null,s=!1,l=!1,h=n.iterator();h.hasNext();){var v=h.next(),S=v.getClass();i===null&&(i=S),S!==i&&(s=!0),v.isGeometryCollectionOrDerived()&&(l=!0)}if(i===null)return this.createGeometryCollection();if(s||l)return this.createGeometryCollection(Ce.toGeometryArray(n));var R=n.iterator().next();if(n.size()>1){if(R instanceof ue)return this.createMultiPolygon(Ce.toPolygonArray(n));if(R instanceof Qt)return this.createMultiLineString(Ce.toLineStringArray(n));if(R instanceof ge)return this.createMultiPoint(Ce.toPointArray(n));P.shouldNeverReachHere("Unhandled class: "+R.getClass().getName())}return R},Ce.prototype.createMultiPointFromCoords=function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)},Ce.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof U){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(j(arguments[0],bt)){var i=arguments[0];return new ge(i,this)}}},Ce.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Ce.prototype.createPolygon=function(){if(arguments.length===0)return new ue(null,null,this);if(arguments.length===1){if(j(arguments[0],bt)){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof Array){var i=arguments[0];return this.createPolygon(this.createLinearRing(i))}if(arguments[0]instanceof bn){var s=arguments[0];return this.createPolygon(s,null)}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];return new ue(l,h,this)}},Ce.prototype.getSRID=function(){return this._SRID},Ce.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Sr(null,this);if(arguments.length===1){var n=arguments[0];return new Sr(n,this)}},Ce.prototype.createGeometry=function(n){return new Kn(this).edit(n,{edit:function(){if(arguments.length===2){var i=arguments[0];return this._coordinateSequenceFactory.create(i)}}})},Ce.prototype.getPrecisionModel=function(){return this._precisionModel},Ce.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(j(arguments[0],bt)){var i=arguments[0];return new bn(i,this)}}},Ce.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Un(null,this);if(arguments.length===1){var n=arguments[0];return new Un(n,this)}},Ce.prototype.createMultiPoint=function(){if(arguments.length===0)return new Oe(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new Oe(n,this)}if(arguments[0]instanceof Array){var i=arguments[0];return this.createMultiPoint(i!==null?this.getCoordinateSequenceFactory().create(i):null)}if(j(arguments[0],bt)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var l=new Array(s.size()).fill(null),h=0;h<s.size();h++){var v=this.getCoordinateSequenceFactory().create(1,s.getDimension());Yt.copy(s,h,v,0,1),l[h]=this.createPoint(v)}return this.createMultiPoint(l)}}},Ce.prototype.interfaces_=function(){return[t]},Ce.prototype.getClass=function(){return Ce},Ce.toMultiPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toGeometryArray=function(n){if(n===null)return null;var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.getDefaultCoordinateSequenceFactory=function(){return Pi.instance()},Ce.toMultiLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toMultiPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toLinearRingArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.createPointFromInternalCoord=function(n,i){return i.getPrecisionModel().makePrecise(n),i.getFactory().createPoint(n)},Ou.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(Ce,Ou);var Qa=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],gl=function(n){this.geometryFactory=n||new Ce};gl.prototype.read=function(n){var i,s=(i=typeof n=="string"?JSON.parse(n):n).type;if(!no[s])throw new Error("Unknown GeoJSON type: "+i.type);return Qa.indexOf(s)!==-1?no[s].apply(this,[i.coordinates]):s==="GeometryCollection"?no[s].apply(this,[i.geometries]):no[s].apply(this,[i])},gl.prototype.write=function(n){var i=n.getGeometryType();if(!_o[i])throw new Error("Geometry is not supported");return _o[i].apply(this,[n])};var no={Feature:function(n){var i={};for(var s in n)i[s]=n[s];if(n.geometry){var l=n.geometry.type;if(!no[l])throw new Error("Unknown GeoJSON type: "+n.type);i.geometry=this.read(n.geometry)}return n.bbox&&(i.bbox=no.bbox.apply(this,[n.bbox])),i},FeatureCollection:function(n){var i={};if(n.features){i.features=[];for(var s=0;s<n.features.length;++s)i.features.push(this.read(n.features[s]))}return n.bbox&&(i.bbox=this.parse.bbox.apply(this,[n.bbox])),i},coordinates:function(n){for(var i=[],s=0;s<n.length;++s){var l=n[s];i.push(new U(l[0],l[1]))}return i},bbox:function(n){return this.geometryFactory.createLinearRing([new U(n[0],n[1]),new U(n[2],n[1]),new U(n[2],n[3]),new U(n[0],n[3]),new U(n[0],n[1])])},Point:function(n){var i=new U(n[0],n[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(n){for(var i=[],s=0;s<n.length;++s)i.push(no.Point.apply(this,[n[s]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(n){var i=no.coordinates.apply(this,[n]);return this.geometryFactory.createLineString(i)},MultiLineString:function(n){for(var i=[],s=0;s<n.length;++s)i.push(no.LineString.apply(this,[n[s]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(n){for(var i=no.coordinates.apply(this,[n[0]]),s=this.geometryFactory.createLinearRing(i),l=[],h=1;h<n.length;++h){var v=n[h],S=no.coordinates.apply(this,[v]),R=this.geometryFactory.createLinearRing(S);l.push(R)}return this.geometryFactory.createPolygon(s,l)},MultiPolygon:function(n){for(var i=[],s=0;s<n.length;++s){var l=n[s];i.push(no.Polygon.apply(this,[l]))}return this.geometryFactory.createMultiPolygon(i)},GeometryCollection:function(n){for(var i=[],s=0;s<n.length;++s){var l=n[s];i.push(this.read(l))}return this.geometryFactory.createGeometryCollection(i)}},_o={coordinate:function(n){return[n.x,n.y]},Point:function(n){return{type:"Point",coordinates:_o.coordinate.apply(this,[n.getCoordinate()])}},MultiPoint:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=_o.Point.apply(this,[l]);i.push(h.coordinates)}return{type:"MultiPoint",coordinates:i}},LineString:function(n){for(var i=[],s=n.getCoordinates(),l=0;l<s.length;++l){var h=s[l];i.push(_o.coordinate.apply(this,[h]))}return{type:"LineString",coordinates:i}},MultiLineString:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=_o.LineString.apply(this,[l]);i.push(h.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(n){var i=[],s=_o.LineString.apply(this,[n._shell]);i.push(s.coordinates);for(var l=0;l<n._holes.length;++l){var h=n._holes[l],v=_o.LineString.apply(this,[h]);i.push(v.coordinates)}return{type:"Polygon",coordinates:i}},MultiPolygon:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=_o.Polygon.apply(this,[l]);i.push(h.coordinates)}return{type:"MultiPolygon",coordinates:i}},GeometryCollection:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=l.getGeometryType();i.push(_o[h].apply(this,[l]))}return{type:"GeometryCollection",geometries:i}}},Du=function(n){this.geometryFactory=n||new Ce,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new gl(this.geometryFactory)};Du.prototype.read=function(n){var i=this.parser.read(n);return this.precisionModel.getType()===Me.FIXED&&this.reducePrecision(i),i},Du.prototype.reducePrecision=function(n){var i,s;if(n.coordinate)this.precisionModel.makePrecise(n.coordinate);else if(n.points)for(i=0,s=n.points.length;i<s;i++)this.precisionModel.makePrecise(n.points[i]);else if(n.geometries)for(i=0,s=n.geometries.length;i<s;i++)this.reducePrecision(n.geometries[i])};var va=function(){this.parser=new gl(this.geometryFactory)};va.prototype.write=function(n){return this.parser.write(n)};var Gt=function(){},Fu={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};Gt.prototype.interfaces_=function(){return[]},Gt.prototype.getClass=function(){return Gt},Gt.opposite=function(n){return n===Gt.LEFT?Gt.RIGHT:n===Gt.RIGHT?Gt.LEFT:n},Fu.ON.get=function(){return 0},Fu.LEFT.get=function(){return 1},Fu.RIGHT.get=function(){return 2},Object.defineProperties(Gt,Fu),(I.prototype=new Error).name="EmptyStackException",(M.prototype=new kt).add=function(n){return this.array_.push(n),!0},M.prototype.get=function(n){if(n<0||n>=this.size())throw new Error;return this.array_[n]},M.prototype.push=function(n){return this.array_.push(n),n},M.prototype.pop=function(n){if(this.array_.length===0)throw new I;return this.array_.pop()},M.prototype.peek=function(){if(this.array_.length===0)throw new I;return this.array_[this.array_.length-1]},M.prototype.empty=function(){return this.array_.length===0},M.prototype.isEmpty=function(){return this.empty()},M.prototype.search=function(n){return this.array_.indexOf(n)},M.prototype.size=function(){return this.array_.length},M.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n};var xo=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};xo.prototype.getCoordinate=function(){return this._minCoord},xo.prototype.getRightmostSide=function(n,i){var s=this.getRightmostSideOfSegment(n,i);return s<0&&(s=this.getRightmostSideOfSegment(n,i-1)),s<0&&(this._minCoord=null,this.checkForRightmostCoordinate(n)),s},xo.prototype.findRightmostEdgeAtVertex=function(){var n=this._minDe.getEdge().getCoordinates();P.isTrue(this._minIndex>0&&this._minIndex<n.length,"rightmost point expected to be interior vertex of edge");var i=n[this._minIndex-1],s=n[this._minIndex+1],l=W.computeOrientation(this._minCoord,s,i),h=!1;(i.y<this._minCoord.y&&s.y<this._minCoord.y&&l===W.COUNTERCLOCKWISE||i.y>this._minCoord.y&&s.y>this._minCoord.y&&l===W.CLOCKWISE)&&(h=!0),h&&(this._minIndex=this._minIndex-1)},xo.prototype.getRightmostSideOfSegment=function(n,i){var s=n.getEdge().getCoordinates();if(i<0||i+1>=s.length||s[i].y===s[i+1].y)return-1;var l=Gt.LEFT;return s[i].y<s[i+1].y&&(l=Gt.RIGHT),l},xo.prototype.getEdge=function(){return this._orientedDe},xo.prototype.checkForRightmostCoordinate=function(n){for(var i=n.getEdge().getCoordinates(),s=0;s<i.length-1;s++)(this._minCoord===null||i[s].x>this._minCoord.x)&&(this._minDe=n,this._minIndex=s,this._minCoord=i[s])},xo.prototype.findRightmostEdgeAtNode=function(){var n=this._minDe.getNode().getEdges();this._minDe=n.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},xo.prototype.findEdge=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isForward()&&this.checkForRightmostCoordinate(s)}P.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===Gt.LEFT&&(this._orientedDe=this._minDe.getSym())},xo.prototype.interfaces_=function(){return[]},xo.prototype.getClass=function(){return xo};var qo=function(n){function i(s,l){n.call(this,i.msgWithCoord(s,l)),this.pt=l?new U(l):null,this.name="TopologyException"}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getCoordinate=function(){return this.pt},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.msgWithCoord=function(s,l){return l?s:s+" [ "+l+" ]"},i}(it),Uu=function(){this.array_=[]};Uu.prototype.addLast=function(n){this.array_.push(n)},Uu.prototype.removeFirst=function(){return this.array_.shift()},Uu.prototype.isEmpty=function(){return this.array_.length===0};var kr=function(){this._finder=null,this._dirEdgeList=new ct,this._nodes=new ct,this._rightMostCoord=null,this._env=null,this._finder=new xo};kr.prototype.clearVisitedEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();)n.next().setVisited(!1)},kr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},kr.prototype.computeNodeDepth=function(n){for(var i=null,s=n.getEdges().iterator();s.hasNext();){var l=s.next();if(l.isVisited()||l.getSym().isVisited()){i=l;break}}if(i===null)throw new qo("unable to find edge to compute depths at "+n.getCoordinate());n.getEdges().computeDepths(i);for(var h=n.getEdges().iterator();h.hasNext();){var v=h.next();v.setVisited(!0),this.copySymDepths(v)}},kr.prototype.computeDepth=function(n){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(Gt.RIGHT,n),this.copySymDepths(i),this.computeDepths(i)},kr.prototype.create=function(n){this.addReachable(n),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},kr.prototype.findResultEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();){var i=n.next();i.getDepth(Gt.RIGHT)>=1&&i.getDepth(Gt.LEFT)<=0&&!i.isInteriorAreaEdge()&&i.setInResult(!0)}},kr.prototype.computeDepths=function(n){var i=new zr,s=new Uu,l=n.getNode();for(s.addLast(l),i.add(l),n.setVisited(!0);!s.isEmpty();){var h=s.removeFirst();i.add(h),this.computeNodeDepth(h);for(var v=h.getEdges().iterator();v.hasNext();){var S=v.next().getSym();if(!S.isVisited()){var R=S.getNode();i.contains(R)||(s.addLast(R),i.add(R))}}}},kr.prototype.compareTo=function(n){var i=n;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},kr.prototype.getEnvelope=function(){if(this._env===null){for(var n=new Vt,i=this._dirEdgeList.iterator();i.hasNext();)for(var s=i.next().getEdge().getCoordinates(),l=0;l<s.length-1;l++)n.expandToInclude(s[l]);this._env=n}return this._env},kr.prototype.addReachable=function(n){var i=new M;for(i.add(n);!i.empty();){var s=i.pop();this.add(s,i)}},kr.prototype.copySymDepths=function(n){var i=n.getSym();i.setDepth(Gt.LEFT,n.getDepth(Gt.RIGHT)),i.setDepth(Gt.RIGHT,n.getDepth(Gt.LEFT))},kr.prototype.add=function(n,i){n.setVisited(!0),this._nodes.add(n);for(var s=n.getEdges().iterator();s.hasNext();){var l=s.next();this._dirEdgeList.add(l);var h=l.getSym().getNode();h.isVisited()||i.push(h)}},kr.prototype.getNodes=function(){return this._nodes},kr.prototype.getDirectedEdges=function(){return this._dirEdgeList},kr.prototype.interfaces_=function(){return[G]},kr.prototype.getClass=function(){return kr};var Hn=function n(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var i=arguments[0];this.init(i.length)}else if(Number.isInteger(arguments[0])){var s=arguments[0];this.init(1),this.location[Gt.ON]=s}else if(arguments[0]instanceof n){var l=arguments[0];if(this.init(l.location.length),l!==null)for(var h=0;h<this.location.length;h++)this.location[h]=l.location[h]}}else if(arguments.length===3){var v=arguments[0],S=arguments[1],R=arguments[2];this.init(3),this.location[Gt.ON]=v,this.location[Gt.LEFT]=S,this.location[Gt.RIGHT]=R}};Hn.prototype.setAllLocations=function(n){for(var i=0;i<this.location.length;i++)this.location[i]=n},Hn.prototype.isNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==$.NONE)return!1;return!0},Hn.prototype.setAllLocationsIfNull=function(n){for(var i=0;i<this.location.length;i++)this.location[i]===$.NONE&&(this.location[i]=n)},Hn.prototype.isLine=function(){return this.location.length===1},Hn.prototype.merge=function(n){if(n.location.length>this.location.length){var i=new Array(3).fill(null);i[Gt.ON]=this.location[Gt.ON],i[Gt.LEFT]=$.NONE,i[Gt.RIGHT]=$.NONE,this.location=i}for(var s=0;s<this.location.length;s++)this.location[s]===$.NONE&&s<n.location.length&&(this.location[s]=n.location[s])},Hn.prototype.getLocations=function(){return this.location},Hn.prototype.flip=function(){if(this.location.length<=1)return null;var n=this.location[Gt.LEFT];this.location[Gt.LEFT]=this.location[Gt.RIGHT],this.location[Gt.RIGHT]=n},Hn.prototype.toString=function(){var n=new Tt;return this.location.length>1&&n.append($.toLocationSymbol(this.location[Gt.LEFT])),n.append($.toLocationSymbol(this.location[Gt.ON])),this.location.length>1&&n.append($.toLocationSymbol(this.location[Gt.RIGHT])),n.toString()},Hn.prototype.setLocations=function(n,i,s){this.location[Gt.ON]=n,this.location[Gt.LEFT]=i,this.location[Gt.RIGHT]=s},Hn.prototype.get=function(n){return n<this.location.length?this.location[n]:$.NONE},Hn.prototype.isArea=function(){return this.location.length>1},Hn.prototype.isAnyNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===$.NONE)return!0;return!1},Hn.prototype.setLocation=function(){if(arguments.length===1){var n=arguments[0];this.setLocation(Gt.ON,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.location[i]=s}},Hn.prototype.init=function(n){this.location=new Array(n).fill(null),this.setAllLocations($.NONE)},Hn.prototype.isEqualOnSide=function(n,i){return this.location[i]===n.location[i]},Hn.prototype.allPositionsEqual=function(n){for(var i=0;i<this.location.length;i++)if(this.location[i]!==n)return!1;return!0},Hn.prototype.interfaces_=function(){return[]},Hn.prototype.getClass=function(){return Hn};var Tn=function n(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var i=arguments[0];this.elt[0]=new Hn(i),this.elt[1]=new Hn(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.elt[0]=new Hn(s.elt[0]),this.elt[1]=new Hn(s.elt[1])}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.elt[0]=new Hn($.NONE),this.elt[1]=new Hn($.NONE),this.elt[l].setLocation(h)}else if(arguments.length===3){var v=arguments[0],S=arguments[1],R=arguments[2];this.elt[0]=new Hn(v,S,R),this.elt[1]=new Hn(v,S,R)}else if(arguments.length===4){var V=arguments[0],nt=arguments[1],_t=arguments[2],Et=arguments[3];this.elt[0]=new Hn($.NONE,$.NONE,$.NONE),this.elt[1]=new Hn($.NONE,$.NONE,$.NONE),this.elt[V].setLocations(nt,_t,Et)}};Tn.prototype.getGeometryCount=function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n},Tn.prototype.setAllLocations=function(n,i){this.elt[n].setAllLocations(i)},Tn.prototype.isNull=function(n){return this.elt[n].isNull()},Tn.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var n=arguments[0];this.setAllLocationsIfNull(0,n),this.setAllLocationsIfNull(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.elt[i].setAllLocationsIfNull(s)}},Tn.prototype.isLine=function(n){return this.elt[n].isLine()},Tn.prototype.merge=function(n){for(var i=0;i<2;i++)this.elt[i]===null&&n.elt[i]!==null?this.elt[i]=new Hn(n.elt[i]):this.elt[i].merge(n.elt[i])},Tn.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},Tn.prototype.getLocation=function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(Gt.ON)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.elt[i].get(s)}},Tn.prototype.toString=function(){var n=new Tt;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()},Tn.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var n=arguments[0];return this.elt[n].isArea()}},Tn.prototype.isAnyNull=function(n){return this.elt[n].isAnyNull()},Tn.prototype.setLocation=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setLocation(Gt.ON,i)}else if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2];this.elt[s].setLocation(l,h)}},Tn.prototype.isEqualOnSide=function(n,i){return this.elt[0].isEqualOnSide(n.elt[0],i)&&this.elt[1].isEqualOnSide(n.elt[1],i)},Tn.prototype.allPositionsEqual=function(n,i){return this.elt[n].allPositionsEqual(i)},Tn.prototype.toLine=function(n){this.elt[n].isArea()&&(this.elt[n]=new Hn(this.elt[n].location[0]))},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn},Tn.toLineLabel=function(n){for(var i=new Tn($.NONE),s=0;s<2;s++)i.setLocation(s,n.getLocation(s));return i};var pr=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new ct,this._pts=new ct,this._label=new Tn($.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new ct,this._geometryFactory=null;var n=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(n),this.computeRing()};pr.prototype.computeRing=function(){if(this._ring!==null)return null;for(var n=new Array(this._pts.size()).fill(null),i=0;i<this._pts.size();i++)n[i]=this._pts.get(i);this._ring=this._geometryFactory.createLinearRing(n),this._isHole=W.isCCW(this._ring.getCoordinates())},pr.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},pr.prototype.computePoints=function(n){this._startDe=n;var i=n,s=!0;do{if(i===null)throw new qo("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new qo("Directed Edge visited twice during ring-building at "+i.getCoordinate());this._edges.add(i);var l=i.getLabel();P.isTrue(l.isArea()),this.mergeLabel(l),this.addPoints(i.getEdge(),i.isForward(),s),s=!1,this.setEdgeRing(i,this),i=this.getNext(i)}while(i!==this._startDe)},pr.prototype.getLinearRing=function(){return this._ring},pr.prototype.getCoordinate=function(n){return this._pts.get(n)},pr.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var n=this._startDe;do{var i=n.getNode().getEdges().getOutgoingDegree(this);i>this._maxNodeDegree&&(this._maxNodeDegree=i),n=this.getNext(n)}while(n!==this._startDe);this._maxNodeDegree*=2},pr.prototype.addPoints=function(n,i,s){var l=n.getCoordinates();if(i){var h=1;s&&(h=0);for(var v=h;v<l.length;v++)this._pts.add(l[v])}else{var S=l.length-2;s&&(S=l.length-1);for(var R=S;R>=0;R--)this._pts.add(l[R])}},pr.prototype.isHole=function(){return this._isHole},pr.prototype.setInResult=function(){var n=this._startDe;do n.getEdge().setInResult(!0),n=n.getNext();while(n!==this._startDe)},pr.prototype.containsPoint=function(n){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(n)||!W.isPointInRing(n,i.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();)if(s.next().containsPoint(n))return!1;return!0},pr.prototype.addHole=function(n){this._holes.add(n)},pr.prototype.isShell=function(){return this._shell===null},pr.prototype.getLabel=function(){return this._label},pr.prototype.getEdges=function(){return this._edges},pr.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},pr.prototype.getShell=function(){return this._shell},pr.prototype.mergeLabel=function(){if(arguments.length===1){var n=arguments[0];this.mergeLabel(n,0),this.mergeLabel(n,1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],l=i.getLocation(s,Gt.RIGHT);if(l===$.NONE)return null;if(this._label.getLocation(s)===$.NONE)return this._label.setLocation(s,l),null}},pr.prototype.setShell=function(n){this._shell=n,n!==null&&n.addHole(this)},pr.prototype.toPolygon=function(n){for(var i=new Array(this._holes.size()).fill(null),s=0;s<this._holes.size();s++)i[s]=this._holes.get(s).getLinearRing();return n.createPolygon(this.getLinearRing(),i)},pr.prototype.interfaces_=function(){return[]},pr.prototype.getClass=function(){return pr};var nd=function(n){function i(){var s=arguments[0],l=arguments[1];n.call(this,s,l)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.setEdgeRing=function(s,l){s.setMinEdgeRing(l)},i.prototype.getNext=function(s){return s.getNextMin()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(pr),Of=function(n){function i(){var s=arguments[0],l=arguments[1];n.call(this,s,l)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildMinimalRings=function(){var s=new ct,l=this._startDe;do{if(l.getMinEdgeRing()===null){var h=new nd(l,this._geometryFactory);s.add(h)}l=l.getNext()}while(l!==this._startDe);return s},i.prototype.setEdgeRing=function(s,l){s.setEdgeRing(l)},i.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var s=this._startDe;do s.getNode().getEdges().linkMinimalDirectedEdges(this),s=s.getNext();while(s!==this._startDe)},i.prototype.getNext=function(s){return s.getNext()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(pr),Ii=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._label=n}}};Ii.prototype.setVisited=function(n){this._isVisited=n},Ii.prototype.setInResult=function(n){this._isInResult=n},Ii.prototype.isCovered=function(){return this._isCovered},Ii.prototype.isCoveredSet=function(){return this._isCoveredSet},Ii.prototype.setLabel=function(n){this._label=n},Ii.prototype.getLabel=function(){return this._label},Ii.prototype.setCovered=function(n){this._isCovered=n,this._isCoveredSet=!0},Ii.prototype.updateIM=function(n){P.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(n)},Ii.prototype.isInResult=function(){return this._isInResult},Ii.prototype.isVisited=function(){return this._isVisited},Ii.prototype.interfaces_=function(){return[]},Ii.prototype.getClass=function(){return Ii};var ml=function(n){function i(){n.call(this),this._coord=null,this._edges=null;var s=arguments[0],l=arguments[1];this._coord=s,this._edges=l,this._label=new Tn(0,$.NONE)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isIncidentEdgeInResult=function(){for(var s=this.getEdges().getEdges().iterator();s.hasNext();)if(s.next().getEdge().isInResult())return!0;return!1},i.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},i.prototype.getCoordinate=function(){return this._coord},i.prototype.print=function(s){s.println("node "+this._coord+" lbl: "+this._label)},i.prototype.computeIM=function(s){},i.prototype.computeMergedLocation=function(s,l){var h=$.NONE;if(h=this._label.getLocation(l),!s.isNull(l)){var v=s.getLocation(l);h!==$.BOUNDARY&&(h=v)}return h},i.prototype.setLabel=function(){if(arguments.length!==2)return n.prototype.setLabel.apply(this,arguments);var s=arguments[0],l=arguments[1];this._label===null?this._label=new Tn(s,l):this._label.setLocation(s,l)},i.prototype.getEdges=function(){return this._edges},i.prototype.mergeLabel=function(){if(arguments[0]instanceof i){var s=arguments[0];this.mergeLabel(s._label)}else if(arguments[0]instanceof Tn)for(var l=arguments[0],h=0;h<2;h++){var v=this.computeMergedLocation(l,h);this._label.getLocation(h)===$.NONE&&this._label.setLocation(h,v)}},i.prototype.add=function(s){this._edges.insert(s),s.setNode(this)},i.prototype.setLabelBoundary=function(s){if(this._label===null)return null;var l=$.NONE;this._label!==null&&(l=this._label.getLocation(s));var h=null;switch(l){case $.BOUNDARY:h=$.INTERIOR;break;case $.INTERIOR:default:h=$.BOUNDARY}this._label.setLocation(s,h)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Ii),Eo=function(){this.nodeMap=new w,this.nodeFact=null;var n=arguments[0];this.nodeFact=n};Eo.prototype.find=function(n){return this.nodeMap.get(n)},Eo.prototype.addNode=function(){if(arguments[0]instanceof U){var n=arguments[0],i=this.nodeMap.get(n);return i===null&&(i=this.nodeFact.createNode(n),this.nodeMap.put(n,i)),i}if(arguments[0]instanceof ml){var s=arguments[0],l=this.nodeMap.get(s.getCoordinate());return l===null?(this.nodeMap.put(s.getCoordinate(),s),s):(l.mergeLabel(s),l)}},Eo.prototype.print=function(n){for(var i=this.iterator();i.hasNext();)i.next().print(n)},Eo.prototype.iterator=function(){return this.nodeMap.values().iterator()},Eo.prototype.values=function(){return this.nodeMap.values()},Eo.prototype.getBoundaryNodes=function(n){for(var i=new ct,s=this.iterator();s.hasNext();){var l=s.next();l.getLabel().getLocation(n)===$.BOUNDARY&&i.add(l)}return i},Eo.prototype.add=function(n){var i=n.getCoordinate();this.addNode(i).add(n)},Eo.prototype.interfaces_=function(){return[]},Eo.prototype.getClass=function(){return Eo};var kn=function(){},_a={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};kn.prototype.interfaces_=function(){return[]},kn.prototype.getClass=function(){return kn},kn.isNorthern=function(n){return n===kn.NE||n===kn.NW},kn.isOpposite=function(n,i){return n===i?!1:(n-i+4)%4===2},kn.commonHalfPlane=function(n,i){if(n===i)return n;if((n-i+4)%4===2)return-1;var s=n<i?n:i;return s===0&&(n>i?n:i)===3?3:s},kn.isInHalfPlane=function(n,i){return i===kn.SE?n===kn.SE||n===kn.SW:n===i||n===i+1},kn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new L("Cannot compute the quadrant for point ( "+n+", "+i+" )");return n>=0?i>=0?kn.NE:kn.SE:i>=0?kn.NW:kn.SW}if(arguments[0]instanceof U&&arguments[1]instanceof U){var s=arguments[0],l=arguments[1];if(l.x===s.x&&l.y===s.y)throw new L("Cannot compute the quadrant for two identical points "+s);return l.x>=s.x?l.y>=s.y?kn.NE:kn.SE:l.y>=s.y?kn.NW:kn.SW}},_a.NE.get=function(){return 0},_a.NW.get=function(){return 1},_a.SW.get=function(){return 2},_a.SE.get=function(){return 3},Object.defineProperties(kn,_a);var Gr=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];this._edge=i,this.init(s,l),this._label=null}else if(arguments.length===4){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3];this._edge=h,this.init(v,S),this._label=R}};Gr.prototype.compareDirection=function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:W.computeOrientation(n._p0,n._p1,this._p1)},Gr.prototype.getDy=function(){return this._dy},Gr.prototype.getCoordinate=function(){return this._p0},Gr.prototype.setNode=function(n){this._node=n},Gr.prototype.print=function(n){var i=Math.atan2(this._dy,this._dx),s=this.getClass().getName(),l=s.lastIndexOf("."),h=s.substring(l+1);n.print(" "+h+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)},Gr.prototype.compareTo=function(n){var i=n;return this.compareDirection(i)},Gr.prototype.getDirectedCoordinate=function(){return this._p1},Gr.prototype.getDx=function(){return this._dx},Gr.prototype.getLabel=function(){return this._label},Gr.prototype.getEdge=function(){return this._edge},Gr.prototype.getQuadrant=function(){return this._quadrant},Gr.prototype.getNode=function(){return this._node},Gr.prototype.toString=function(){var n=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),s=i.lastIndexOf(".");return" "+i.substring(s+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label},Gr.prototype.computeLabel=function(n){},Gr.prototype.init=function(n,i){this._p0=n,this._p1=i,this._dx=i.x-n.x,this._dy=i.y-n.y,this._quadrant=kn.quadrant(this._dx,this._dy),P.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},Gr.prototype.interfaces_=function(){return[G]},Gr.prototype.getClass=function(){return Gr};var Ac=function(n){function i(){var s=arguments[0],l=arguments[1];if(n.call(this,s),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=l,l)this.init(s.getCoordinate(0),s.getCoordinate(1));else{var h=s.getNumPoints()-1;this.init(s.getCoordinate(h),s.getCoordinate(h-1))}this.computeDirectedLabel()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getNextMin=function(){return this._nextMin},i.prototype.getDepth=function(s){return this._depth[s]},i.prototype.setVisited=function(s){this._isVisited=s},i.prototype.computeDirectedLabel=function(){this._label=new Tn(this._edge.getLabel()),this._isForward||this._label.flip()},i.prototype.getNext=function(){return this._next},i.prototype.setDepth=function(s,l){if(this._depth[s]!==-999&&this._depth[s]!==l)throw new qo("assigned depths do not match",this.getCoordinate());this._depth[s]=l},i.prototype.isInteriorAreaEdge=function(){for(var s=!0,l=0;l<2;l++)this._label.isArea(l)&&this._label.getLocation(l,Gt.LEFT)===$.INTERIOR&&this._label.getLocation(l,Gt.RIGHT)===$.INTERIOR||(s=!1);return s},i.prototype.setNextMin=function(s){this._nextMin=s},i.prototype.print=function(s){n.prototype.print.call(this,s),s.print(" "+this._depth[Gt.LEFT]+"/"+this._depth[Gt.RIGHT]),s.print(" ("+this.getDepthDelta()+")"),this._isInResult&&s.print(" inResult")},i.prototype.setMinEdgeRing=function(s){this._minEdgeRing=s},i.prototype.isLineEdge=function(){var s=this._label.isLine(0)||this._label.isLine(1),l=!this._label.isArea(0)||this._label.allPositionsEqual(0,$.EXTERIOR),h=!this._label.isArea(1)||this._label.allPositionsEqual(1,$.EXTERIOR);return s&&l&&h},i.prototype.setEdgeRing=function(s){this._edgeRing=s},i.prototype.getMinEdgeRing=function(){return this._minEdgeRing},i.prototype.getDepthDelta=function(){var s=this._edge.getDepthDelta();return this._isForward||(s=-s),s},i.prototype.setInResult=function(s){this._isInResult=s},i.prototype.getSym=function(){return this._sym},i.prototype.isForward=function(){return this._isForward},i.prototype.getEdge=function(){return this._edge},i.prototype.printEdge=function(s){this.print(s),s.print(" "),this._isForward?this._edge.print(s):this._edge.printReverse(s)},i.prototype.setSym=function(s){this._sym=s},i.prototype.setVisitedEdge=function(s){this.setVisited(s),this._sym.setVisited(s)},i.prototype.setEdgeDepths=function(s,l){var h=this.getEdge().getDepthDelta();this._isForward||(h=-h);var v=1;s===Gt.LEFT&&(v=-1);var S=Gt.opposite(s),R=l+h*v;this.setDepth(s,l),this.setDepth(S,R)},i.prototype.getEdgeRing=function(){return this._edgeRing},i.prototype.isInResult=function(){return this._isInResult},i.prototype.setNext=function(s){this._next=s},i.prototype.isVisited=function(){return this._isVisited},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.depthFactor=function(s,l){return s===$.EXTERIOR&&l===$.INTERIOR?1:s===$.INTERIOR&&l===$.EXTERIOR?-1:0},i}(Gr),ja=function(){};ja.prototype.createNode=function(n){return new ml(n,null)},ja.prototype.interfaces_=function(){return[]},ja.prototype.getClass=function(){return ja};var nr=function(){if(this._edges=new ct,this._nodes=null,this._edgeEndList=new ct,arguments.length===0)this._nodes=new Eo(new ja);else if(arguments.length===1){var n=arguments[0];this._nodes=new Eo(n)}};nr.prototype.printEdges=function(n){n.println("Edges:");for(var i=0;i<this._edges.size();i++){n.println("edge "+i+":");var s=this._edges.get(i);s.print(n),s.eiList.print(n)}},nr.prototype.find=function(n){return this._nodes.find(n)},nr.prototype.addNode=function(){if(arguments[0]instanceof ml){var n=arguments[0];return this._nodes.addNode(n)}if(arguments[0]instanceof U){var i=arguments[0];return this._nodes.addNode(i)}},nr.prototype.getNodeIterator=function(){return this._nodes.iterator()},nr.prototype.linkResultDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()},nr.prototype.debugPrintln=function(n){Zt.out.println(n)},nr.prototype.isBoundaryNode=function(n,i){var s=this._nodes.find(i);if(s===null)return!1;var l=s.getLabel();return l!==null&&l.getLocation(n)===$.BOUNDARY},nr.prototype.linkAllDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkAllDirectedEdges()},nr.prototype.matchInSameDirection=function(n,i,s,l){return!!n.equals(s)&&W.computeOrientation(n,i,l)===W.COLLINEAR&&kn.quadrant(n,i)===kn.quadrant(s,l)},nr.prototype.getEdgeEnds=function(){return this._edgeEndList},nr.prototype.debugPrint=function(n){Zt.out.print(n)},nr.prototype.getEdgeIterator=function(){return this._edges.iterator()},nr.prototype.findEdgeInSameDirection=function(n,i){for(var s=0;s<this._edges.size();s++){var l=this._edges.get(s),h=l.getCoordinates();if(this.matchInSameDirection(n,i,h[0],h[1])||this.matchInSameDirection(n,i,h[h.length-1],h[h.length-2]))return l}return null},nr.prototype.insertEdge=function(n){this._edges.add(n)},nr.prototype.findEdgeEnd=function(n){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var s=i.next();if(s.getEdge()===n)return s}return null},nr.prototype.addEdges=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();this._edges.add(s);var l=new Ac(s,!0),h=new Ac(s,!1);l.setSym(h),h.setSym(l),this.add(l),this.add(h)}},nr.prototype.add=function(n){this._nodes.add(n),this._edgeEndList.add(n)},nr.prototype.getNodes=function(){return this._nodes.values()},nr.prototype.findEdge=function(n,i){for(var s=0;s<this._edges.size();s++){var l=this._edges.get(s),h=l.getCoordinates();if(n.equals(h[0])&&i.equals(h[1]))return l}return null},nr.prototype.interfaces_=function(){return[]},nr.prototype.getClass=function(){return nr},nr.linkResultDirectedEdges=function(n){for(var i=n.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var hi=function(){this._geometryFactory=null,this._shellList=new ct;var n=arguments[0];this._geometryFactory=n};hi.prototype.sortShellsAndHoles=function(n,i,s){for(var l=n.iterator();l.hasNext();){var h=l.next();h.isHole()?s.add(h):i.add(h)}},hi.prototype.computePolygons=function(n){for(var i=new ct,s=n.iterator();s.hasNext();){var l=s.next().toPolygon(this._geometryFactory);i.add(l)}return i},hi.prototype.placeFreeHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var l=s.next();if(l.getShell()===null){var h=this.findEdgeRingContaining(l,n);if(h===null)throw new qo("unable to assign hole to a shell",l.getCoordinate(0));l.setShell(h)}}},hi.prototype.buildMinimalEdgeRings=function(n,i,s){for(var l=new ct,h=n.iterator();h.hasNext();){var v=h.next();if(v.getMaxNodeDegree()>2){v.linkDirectedEdgesForMinimalEdgeRings();var S=v.buildMinimalRings(),R=this.findShell(S);R!==null?(this.placePolygonHoles(R,S),i.add(R)):s.addAll(S)}else l.add(v)}return l},hi.prototype.containsPoint=function(n){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(n))return!0;return!1},hi.prototype.buildMaximalEdgeRings=function(n){for(var i=new ct,s=n.iterator();s.hasNext();){var l=s.next();if(l.isInResult()&&l.getLabel().isArea()&&l.getEdgeRing()===null){var h=new Of(l,this._geometryFactory);i.add(h),h.setInResult()}}return i},hi.prototype.placePolygonHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var l=s.next();l.isHole()&&l.setShell(n)}},hi.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},hi.prototype.findEdgeRingContaining=function(n,i){for(var s=n.getLinearRing(),l=s.getEnvelopeInternal(),h=s.getCoordinateN(0),v=null,S=null,R=i.iterator();R.hasNext();){var V=R.next(),nt=V.getLinearRing(),_t=nt.getEnvelopeInternal();v!==null&&(S=v.getLinearRing().getEnvelopeInternal());var Et=!1;_t.contains(l)&&W.isPointInRing(h,nt.getCoordinates())&&(Et=!0),Et&&(v===null||S.contains(_t))&&(v=V)}return v},hi.prototype.findShell=function(n){for(var i=0,s=null,l=n.iterator();l.hasNext();){var h=l.next();h.isHole()||(s=h,i++)}return P.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),s},hi.prototype.add=function(){if(arguments.length===1){var n=arguments[0];this.add(n.getEdgeEnds(),n.getNodes())}else if(arguments.length===2){var i=arguments[0],s=arguments[1];nr.linkResultDirectedEdges(s);var l=this.buildMaximalEdgeRings(i),h=new ct,v=this.buildMinimalEdgeRings(l,this._shellList,h);this.sortShellsAndHoles(v,this._shellList,h),this.placeFreeHoles(this._shellList,h)}},hi.prototype.interfaces_=function(){return[]},hi.prototype.getClass=function(){return hi};var $n=function(){};$n.prototype.getBounds=function(){},$n.prototype.interfaces_=function(){return[]},$n.prototype.getClass=function(){return $n};var qe=function(){this._bounds=null,this._item=null;var n=arguments[0],i=arguments[1];this._bounds=n,this._item=i};qe.prototype.getItem=function(){return this._item},qe.prototype.getBounds=function(){return this._bounds},qe.prototype.interfaces_=function(){return[$n,t]},qe.prototype.getClass=function(){return qe};var us=function(){this._size=null,this._items=null,this._size=0,this._items=new ct,this._items.add(null)};us.prototype.poll=function(){if(this.isEmpty())return null;var n=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),n},us.prototype.size=function(){return this._size},us.prototype.reorder=function(n){for(var i=null,s=this._items.get(n);2*n<=this._size&&((i=2*n)!==this._size&&this._items.get(i+1).compareTo(this._items.get(i))<0&&i++,this._items.get(i).compareTo(s)<0);n=i)this._items.set(n,this._items.get(i));this._items.set(n,s)},us.prototype.clear=function(){this._size=0,this._items.clear()},us.prototype.isEmpty=function(){return this._size===0},us.prototype.add=function(n){this._items.add(null),this._size+=1;var i=this._size;for(this._items.set(0,n);n.compareTo(this._items.get(Math.trunc(i/2)))<0;i/=2)this._items.set(i,this._items.get(Math.trunc(i/2)));this._items.set(i,n)},us.prototype.interfaces_=function(){return[]},us.prototype.getClass=function(){return us};var Ps=function(){};Ps.prototype.visitItem=function(n){},Ps.prototype.interfaces_=function(){return[]},Ps.prototype.getClass=function(){return Ps};var xa=function(){};xa.prototype.insert=function(n,i){},xa.prototype.remove=function(n,i){},xa.prototype.query=function(){},xa.prototype.interfaces_=function(){return[]},xa.prototype.getClass=function(){return xa};var yr=function(){if(this._childBoundables=new ct,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._level=n}}},Df={serialVersionUID:{configurable:!0}};yr.prototype.getLevel=function(){return this._level},yr.prototype.size=function(){return this._childBoundables.size()},yr.prototype.getChildBoundables=function(){return this._childBoundables},yr.prototype.addChildBoundable=function(n){P.isTrue(this._bounds===null),this._childBoundables.add(n)},yr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},yr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},yr.prototype.interfaces_=function(){return[$n,t]},yr.prototype.getClass=function(){return yr},Df.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(yr,Df);var ro=function(){};ro.reverseOrder=function(){return{compare:function(n,i){return i.compareTo(n)}}},ro.min=function(n){return ro.sort(n),n.get(0)},ro.sort=function(n,i){var s=n.toArray();i?Ho.sort(s,i):Ho.sort(s);for(var l=n.iterator(),h=0,v=s.length;h<v;h++)l.next(),l.set(s[h])},ro.singletonList=function(n){var i=new ct;return i.add(n),i};var cr=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var n=arguments[0],i=arguments[1],s=arguments[2];this._boundable1=n,this._boundable2=i,this._itemDistance=s,this._distance=this.distance()};cr.prototype.expandToQueue=function(n,i){var s=cr.isComposite(this._boundable1),l=cr.isComposite(this._boundable2);if(s&&l)return cr.area(this._boundable1)>cr.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,n,i),null):(this.expand(this._boundable2,this._boundable1,n,i),null);if(s)return this.expand(this._boundable1,this._boundable2,n,i),null;if(l)return this.expand(this._boundable2,this._boundable1,n,i),null;throw new L("neither boundable is composite")},cr.prototype.isLeaves=function(){return!(cr.isComposite(this._boundable1)||cr.isComposite(this._boundable2))},cr.prototype.compareTo=function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0},cr.prototype.expand=function(n,i,s,l){for(var h=n.getChildBoundables().iterator();h.hasNext();){var v=h.next(),S=new cr(v,i,this._itemDistance);S.getDistance()<l&&s.add(S)}},cr.prototype.getBoundable=function(n){return n===0?this._boundable1:this._boundable2},cr.prototype.getDistance=function(){return this._distance},cr.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},cr.prototype.interfaces_=function(){return[G]},cr.prototype.getClass=function(){return cr},cr.area=function(n){return n.getBounds().getArea()},cr.isComposite=function(n){return n instanceof yr};var br=function n(){if(this._root=null,this._built=!1,this._itemBoundables=new ct,this._nodeCapacity=null,arguments.length===0){var i=n.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var s=arguments[0];P.isTrue(s>1,"Node capacity must be greater than 1"),this._nodeCapacity=s}},Tr={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};br.prototype.getNodeCapacity=function(){return this._nodeCapacity},br.prototype.lastNode=function(n){return n.get(n.size()-1)},br.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof yr?n+=this.size(s):s instanceof qe&&(n+=1)}return n}},br.prototype.removeItem=function(n,i){for(var s=null,l=n.getChildBoundables().iterator();l.hasNext();){var h=l.next();h instanceof qe&&h.getItem()===i&&(s=h)}return s!==null&&(n.getChildBoundables().remove(s),!0)},br.prototype.itemsTree=function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new ct:n}if(arguments.length===1){for(var i=arguments[0],s=new ct,l=i.getChildBoundables().iterator();l.hasNext();){var h=l.next();if(h instanceof yr){var v=this.itemsTree(h);v!==null&&s.add(v)}else h instanceof qe?s.add(h.getItem()):P.shouldNeverReachHere()}return s.size()<=0?null:s}},br.prototype.insert=function(n,i){P.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new qe(n,i))},br.prototype.boundablesAtLevel=function(){if(arguments.length===1){var n=arguments[0],i=new ct;return this.boundablesAtLevel(n,this._root,i),i}if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2];if(P.isTrue(s>-2),l.getLevel()===s)return h.add(l),null;for(var v=l.getChildBoundables().iterator();v.hasNext();){var S=v.next();S instanceof yr?this.boundablesAtLevel(s,S,h):(P.isTrue(S instanceof qe),s===-1&&h.add(S))}return null}},br.prototype.query=function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new ct;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i),i}if(arguments.length===2){var s=arguments[0],l=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,l)}else if(arguments.length===3){if(j(arguments[2],Ps)&&arguments[0]instanceof Object&&arguments[1]instanceof yr)for(var h=arguments[0],v=arguments[1],S=arguments[2],R=v.getChildBoundables(),V=0;V<R.size();V++){var nt=R.get(V);this.getIntersectsOp().intersects(nt.getBounds(),h)&&(nt instanceof yr?this.query(h,nt,S):nt instanceof qe?S.visitItem(nt.getItem()):P.shouldNeverReachHere())}else if(j(arguments[2],kt)&&arguments[0]instanceof Object&&arguments[1]instanceof yr)for(var _t=arguments[0],Et=arguments[1],Wt=arguments[2],$t=Et.getChildBoundables(),ie=0;ie<$t.size();ie++){var Ee=$t.get(ie);this.getIntersectsOp().intersects(Ee.getBounds(),_t)&&(Ee instanceof yr?this.query(_t,Ee,Wt):Ee instanceof qe?Wt.add(Ee.getItem()):P.shouldNeverReachHere())}}},br.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},br.prototype.getRoot=function(){return this.build(),this._root},br.prototype.remove=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,i)}if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2],v=this.removeItem(l,h);if(v)return!0;for(var S=null,R=l.getChildBoundables().iterator();R.hasNext();){var V=R.next();if(this.getIntersectsOp().intersects(V.getBounds(),s)&&V instanceof yr&&(v=this.remove(s,V,h))){S=V;break}}return S!==null&&S.getChildBoundables().isEmpty()&&l.getChildBoundables().remove(S),v}},br.prototype.createHigherLevels=function(n,i){P.isTrue(!n.isEmpty());var s=this.createParentBoundables(n,i+1);return s.size()===1?s.get(0):this.createHigherLevels(s,i+1)},br.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();if(s instanceof yr){var l=this.depth(s);l>n&&(n=l)}}return n+1}},br.prototype.createParentBoundables=function(n,i){P.isTrue(!n.isEmpty());var s=new ct;s.add(this.createNode(i));var l=new ct(n);ro.sort(l,this.getComparator());for(var h=l.iterator();h.hasNext();){var v=h.next();this.lastNode(s).getChildBoundables().size()===this.getNodeCapacity()&&s.add(this.createNode(i)),this.lastNode(s).addChildBoundable(v)}return s},br.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},br.prototype.interfaces_=function(){return[t]},br.prototype.getClass=function(){return br},br.compareDoubles=function(n,i){return n>i?1:n<i?-1:0},Tr.IntersectsOp.get=function(){return Cc},Tr.serialVersionUID.get=function(){return-3886435814360241e3},Tr.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(br,Tr);var Cc=function(){},wo=function(){};wo.prototype.distance=function(n,i){},wo.prototype.interfaces_=function(){return[]},wo.prototype.getClass=function(){return wo};var Pc=function(n){function i(l){l=l||i.DEFAULT_NODE_CAPACITY,n.call(this,l)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return i.prototype.createParentBoundablesFromVerticalSlices=function(l,h){P.isTrue(l.length>0);for(var v=new ct,S=0;S<l.length;S++)v.addAll(this.createParentBoundablesFromVerticalSlice(l[S],h));return v},i.prototype.createNode=function(l){return new yl(l)},i.prototype.size=function(){return arguments.length===0?n.prototype.size.call(this):n.prototype.size.apply(this,arguments)},i.prototype.insert=function(){if(arguments.length!==2)return n.prototype.insert.apply(this,arguments);var l=arguments[0],h=arguments[1];if(l.isNull())return null;n.prototype.insert.call(this,l,h)},i.prototype.getIntersectsOp=function(){return i.intersectsOp},i.prototype.verticalSlices=function(l,h){for(var v=Math.trunc(Math.ceil(l.size()/h)),S=new Array(h).fill(null),R=l.iterator(),V=0;V<h;V++){S[V]=new ct;for(var nt=0;R.hasNext()&&nt<v;){var _t=R.next();S[V].add(_t),nt++}}return S},i.prototype.query=function(){if(arguments.length===1){var l=arguments[0];return n.prototype.query.call(this,l)}if(arguments.length===2){var h=arguments[0],v=arguments[1];n.prototype.query.call(this,h,v)}else if(arguments.length===3){if(j(arguments[2],Ps)&&arguments[0]instanceof Object&&arguments[1]instanceof yr){var S=arguments[0],R=arguments[1],V=arguments[2];n.prototype.query.call(this,S,R,V)}else if(j(arguments[2],kt)&&arguments[0]instanceof Object&&arguments[1]instanceof yr){var nt=arguments[0],_t=arguments[1],Et=arguments[2];n.prototype.query.call(this,nt,_t,Et)}}},i.prototype.getComparator=function(){return i.yComparator},i.prototype.createParentBoundablesFromVerticalSlice=function(l,h){return n.prototype.createParentBoundables.call(this,l,h)},i.prototype.remove=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return n.prototype.remove.call(this,l,h)}return n.prototype.remove.apply(this,arguments)},i.prototype.depth=function(){return arguments.length===0?n.prototype.depth.call(this):n.prototype.depth.apply(this,arguments)},i.prototype.createParentBoundables=function(l,h){P.isTrue(!l.isEmpty());var v=Math.trunc(Math.ceil(l.size()/this.getNodeCapacity())),S=new ct(l);ro.sort(S,i.xComparator);var R=this.verticalSlices(S,Math.trunc(Math.ceil(Math.sqrt(v))));return this.createParentBoundablesFromVerticalSlices(R,h)},i.prototype.nearestNeighbour=function(){if(arguments.length===1){if(j(arguments[0],wo)){var l=arguments[0],h=new cr(this.getRoot(),this.getRoot(),l);return this.nearestNeighbour(h)}if(arguments[0]instanceof cr){var v=arguments[0];return this.nearestNeighbour(v,A.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&j(arguments[1],wo)){var S=arguments[0],R=arguments[1],V=new cr(this.getRoot(),S.getRoot(),R);return this.nearestNeighbour(V)}if(arguments[0]instanceof cr&&typeof arguments[1]=="number"){var nt=arguments[0],_t=arguments[1],Et=null,Wt=new us;for(Wt.add(nt);!Wt.isEmpty()&&_t>0;){var $t=Wt.poll(),ie=$t.getDistance();if(ie>=_t)break;$t.isLeaves()?(_t=ie,Et=$t):$t.expandToQueue(Wt,_t)}return[Et.getBoundable(0).getItem(),Et.getBoundable(1).getItem()]}}else if(arguments.length===3){var Ee=arguments[0],An=arguments[1],Wn=arguments[2],Qr=new qe(Ee,An),jo=new cr(this.getRoot(),Qr,Wn);return this.nearestNeighbour(jo)[0]}},i.prototype.interfaces_=function(){return[xa,t]},i.prototype.getClass=function(){return i},i.centreX=function(l){return i.avg(l.getMinX(),l.getMaxX())},i.avg=function(l,h){return(l+h)/2},i.centreY=function(l){return i.avg(l.getMinY(),l.getMaxY())},s.STRtreeNode.get=function(){return yl},s.serialVersionUID.get=function(){return 0x39920f7d5f261e0},s.xComparator.get=function(){return{interfaces_:function(){return[X]},compare:function(l,h){return n.compareDoubles(i.centreX(l.getBounds()),i.centreX(h.getBounds()))}}},s.yComparator.get=function(){return{interfaces_:function(){return[X]},compare:function(l,h){return n.compareDoubles(i.centreY(l.getBounds()),i.centreY(h.getBounds()))}}},s.intersectsOp.get=function(){return{interfaces_:function(){return[n.IntersectsOp]},intersects:function(l,h){return l.intersects(h)}}},s.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(i,s),i}(br),yl=function(n){function i(){var s=arguments[0];n.call(this,s)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.computeBounds=function(){for(var s=null,l=this.getChildBoundables().iterator();l.hasNext();){var h=l.next();s===null?s=new Vt(h.getBounds()):s.expandToInclude(h.getBounds())}return s},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(yr),Qn=function(){};Qn.prototype.interfaces_=function(){return[]},Qn.prototype.getClass=function(){return Qn},Qn.relativeSign=function(n,i){return n<i?-1:n>i?1:0},Qn.compare=function(n,i,s){if(i.equals2D(s))return 0;var l=Qn.relativeSign(i.x,s.x),h=Qn.relativeSign(i.y,s.y);switch(n){case 0:return Qn.compareValue(l,h);case 1:return Qn.compareValue(h,l);case 2:return Qn.compareValue(h,-l);case 3:return Qn.compareValue(-l,h);case 4:return Qn.compareValue(-l,-h);case 5:return Qn.compareValue(-h,-l);case 6:return Qn.compareValue(-h,l);case 7:return Qn.compareValue(l,-h)}return P.shouldNeverReachHere("invalid octant value"),0},Qn.compareValue=function(n,i){return n<0?-1:n>0?1:i<0?-1:i>0?1:0};var ls=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];this._segString=n,this.coord=new U(i),this.segmentIndex=s,this._segmentOctant=l,this._isInterior=!i.equals2D(n.getCoordinate(s))};ls.prototype.getCoordinate=function(){return this.coord},ls.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex)},ls.prototype.compareTo=function(n){var i=n;return this.segmentIndex<i.segmentIndex?-1:this.segmentIndex>i.segmentIndex?1:this.coord.equals2D(i.coord)?0:Qn.compare(this._segmentOctant,this.coord,i.coord)},ls.prototype.isEndPoint=function(n){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===n},ls.prototype.isInterior=function(){return this._isInterior},ls.prototype.interfaces_=function(){return[G]},ls.prototype.getClass=function(){return ls};var Hr=function(){this._nodeMap=new w,this._edge=null;var n=arguments[0];this._edge=n};Hr.prototype.getSplitCoordinates=function(){var n=new Kt;this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var l=i.next();this.addEdgeCoordinates(s,l,n),s=l}return n.toCoordinateArray()},Hr.prototype.addCollapsedNodes=function(){var n=new ct;this.findCollapsesFromInsertedNodes(n),this.findCollapsesFromExistingVertices(n);for(var i=n.iterator();i.hasNext();){var s=i.next().intValue();this.add(this._edge.getCoordinate(s),s)}},Hr.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},Hr.prototype.findCollapsesFromExistingVertices=function(n){for(var i=0;i<this._edge.size()-2;i++){var s=this._edge.getCoordinate(i),l=this._edge.getCoordinate(i+2);s.equals2D(l)&&n.add(new ft(i+1))}},Hr.prototype.addEdgeCoordinates=function(n,i,s){var l=this._edge.getCoordinate(i.segmentIndex),h=i.isInterior()||!i.coord.equals2D(l);s.add(new U(n.coord),!1);for(var v=n.segmentIndex+1;v<=i.segmentIndex;v++)s.add(this._edge.getCoordinate(v));h&&s.add(new U(i.coord))},Hr.prototype.iterator=function(){return this._nodeMap.values().iterator()},Hr.prototype.addSplitEdges=function(n){this.addEndpoints(),this.addCollapsedNodes();for(var i=this.iterator(),s=i.next();i.hasNext();){var l=i.next(),h=this.createSplitEdge(s,l);n.add(h),s=l}},Hr.prototype.findCollapseIndex=function(n,i,s){if(!n.coord.equals2D(i.coord))return!1;var l=i.segmentIndex-n.segmentIndex;return i.isInterior()||l--,l===1&&(s[0]=n.segmentIndex+1,!0)},Hr.prototype.findCollapsesFromInsertedNodes=function(n){for(var i=new Array(1).fill(null),s=this.iterator(),l=s.next();s.hasNext();){var h=s.next();this.findCollapseIndex(l,h,i)&&n.add(new ft(i[0])),l=h}},Hr.prototype.getEdge=function(){return this._edge},Hr.prototype.addEndpoints=function(){var n=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(n),n)},Hr.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,l=this._edge.getCoordinate(i.segmentIndex),h=i.isInterior()||!i.coord.equals2D(l);h||s--;var v=new Array(s).fill(null),S=0;v[S++]=new U(n.coord);for(var R=n.segmentIndex+1;R<=i.segmentIndex;R++)v[S++]=this._edge.getCoordinate(R);return h&&(v[S]=new U(i.coord)),new or(v,this._edge.getData())},Hr.prototype.add=function(n,i){var s=new ls(this._edge,n,i,this._edge.getSegmentOctant(i)),l=this._nodeMap.get(s);return l!==null?(P.isTrue(l.coord.equals2D(n),"Found equal nodes with different coordinates"),l):(this._nodeMap.put(s,s),s)},Hr.prototype.checkSplitEdgesCorrectness=function(n){var i=this._edge.getCoordinates(),s=n.get(0).getCoordinate(0);if(!s.equals2D(i[0]))throw new it("bad split edge start point at "+s);var l=n.get(n.size()-1).getCoordinates(),h=l[l.length-1];if(!h.equals2D(i[i.length-1]))throw new it("bad split edge end point at "+h)},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr};var Ys=function(){};Ys.prototype.interfaces_=function(){return[]},Ys.prototype.getClass=function(){return Ys},Ys.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new L("Cannot compute the octant for point ( "+n+", "+i+" )");var s=Math.abs(n),l=Math.abs(i);return n>=0?i>=0?s>=l?0:1:s>=l?7:6:i>=0?s>=l?3:2:s>=l?4:5}if(arguments[0]instanceof U&&arguments[1]instanceof U){var h=arguments[0],v=arguments[1],S=v.x-h.x,R=v.y-h.y;if(S===0&&R===0)throw new L("Cannot compute the octant for two identical points "+h);return Ys.octant(S,R)}};var Mo=function(){};Mo.prototype.getCoordinates=function(){},Mo.prototype.size=function(){},Mo.prototype.getCoordinate=function(n){},Mo.prototype.isClosed=function(){},Mo.prototype.setData=function(n){},Mo.prototype.getData=function(){},Mo.prototype.interfaces_=function(){return[]},Mo.prototype.getClass=function(){return Mo};var tu=function(){};tu.prototype.addIntersection=function(n,i){},tu.prototype.interfaces_=function(){return[Mo]},tu.prototype.getClass=function(){return tu};var or=function(){this._nodeList=new Hr(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};or.prototype.getCoordinates=function(){return this._pts},or.prototype.size=function(){return this._pts.length},or.prototype.getCoordinate=function(n){return this._pts[n]},or.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},or.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))},or.prototype.setData=function(n){this._data=n},or.prototype.safeOctant=function(n,i){return n.equals2D(i)?0:Ys.octant(n,i)},or.prototype.getData=function(){return this._data},or.prototype.addIntersection=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.addIntersectionNode(n,i)}else if(arguments.length===4){var s=arguments[0],l=arguments[1],h=arguments[3],v=new U(s.getIntersection(h));this.addIntersection(v,l)}},or.prototype.toString=function(){return fe.toLineString(new De(this._pts))},or.prototype.getNodeList=function(){return this._nodeList},or.prototype.addIntersectionNode=function(n,i){var s=i,l=s+1;if(l<this._pts.length){var h=this._pts[l];n.equals2D(h)&&(s=l)}return this._nodeList.add(n,s)},or.prototype.addIntersections=function(n,i,s){for(var l=0;l<n.getIntersectionNum();l++)this.addIntersection(n,i,s,l)},or.prototype.interfaces_=function(){return[tu]},or.prototype.getClass=function(){return or},or.getNodedSubstrings=function(){if(arguments.length===1){var n=arguments[0],i=new ct;return or.getNodedSubstrings(n,i),i}if(arguments.length===2)for(var s=arguments[0],l=arguments[1],h=s.iterator();h.hasNext();)h.next().getNodeList().addSplitEdges(l)};var ee=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new U,this.p1=new U;else if(arguments.length===1){var n=arguments[0];this.p0=new U(n.p0),this.p1=new U(n.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var i=arguments[0],s=arguments[1],l=arguments[2],h=arguments[3];this.p0=new U(i,s),this.p1=new U(l,h)}},Ff={serialVersionUID:{configurable:!0}};ee.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},ee.prototype.orientationIndex=function(){if(arguments[0]instanceof ee){var n=arguments[0],i=W.orientationIndex(this.p0,this.p1,n.p0),s=W.orientationIndex(this.p0,this.p1,n.p1);return i>=0&&s>=0||i<=0&&s<=0?Math.max(i,s):0}if(arguments[0]instanceof U){var l=arguments[0];return W.orientationIndex(this.p0,this.p1,l)}},ee.prototype.toGeometry=function(n){return n.createLineString([this.p0,this.p1])},ee.prototype.isVertical=function(){return this.p0.x===this.p1.x},ee.prototype.equals=function(n){if(!(n instanceof ee))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},ee.prototype.intersection=function(n){var i=new rt;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null},ee.prototype.project=function(){if(arguments[0]instanceof U){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new U(n);var i=this.projectionFactor(n),s=new U;return s.x=this.p0.x+i*(this.p1.x-this.p0.x),s.y=this.p0.y+i*(this.p1.y-this.p0.y),s}if(arguments[0]instanceof ee){var l=arguments[0],h=this.projectionFactor(l.p0),v=this.projectionFactor(l.p1);if(h>=1&&v>=1||h<=0&&v<=0)return null;var S=this.project(l.p0);h<0&&(S=this.p0),h>1&&(S=this.p1);var R=this.project(l.p1);return v<0&&(R=this.p0),v>1&&(R=this.p1),new ee(S,R)}},ee.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},ee.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},ee.prototype.getCoordinate=function(n){return n===0?this.p0:this.p1},ee.prototype.distancePerpendicular=function(n){return W.distancePointLinePerpendicular(n,this.p0,this.p1)},ee.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},ee.prototype.midPoint=function(){return ee.midPoint(this.p0,this.p1)},ee.prototype.projectionFactor=function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var i=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,l=i*i+s*s;return l<=0?A.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*s)/l},ee.prototype.closestPoints=function(n){var i=this.intersection(n);if(i!==null)return[i,i];var s=new Array(2).fill(null),l=A.MAX_VALUE,h=null,v=this.closestPoint(n.p0);l=v.distance(n.p0),s[0]=v,s[1]=n.p0;var S=this.closestPoint(n.p1);(h=S.distance(n.p1))<l&&(l=h,s[0]=S,s[1]=n.p1);var R=n.closestPoint(this.p0);(h=R.distance(this.p0))<l&&(l=h,s[0]=this.p0,s[1]=R);var V=n.closestPoint(this.p1);return(h=V.distance(this.p1))<l&&(l=h,s[0]=this.p1,s[1]=V),s},ee.prototype.closestPoint=function(n){var i=this.projectionFactor(n);return i>0&&i<1?this.project(n):this.p0.distance(n)<this.p1.distance(n)?this.p0:this.p1},ee.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},ee.prototype.getLength=function(){return this.p0.distance(this.p1)},ee.prototype.compareTo=function(n){var i=n,s=this.p0.compareTo(i.p0);return s!==0?s:this.p1.compareTo(i.p1)},ee.prototype.reverse=function(){var n=this.p0;this.p0=this.p1,this.p1=n},ee.prototype.equalsTopo=function(n){return this.p0.equals(n.p0)&&(this.p1.equals(n.p1)||this.p0.equals(n.p1))&&this.p1.equals(n.p0)},ee.prototype.lineIntersection=function(n){try{return _e.intersection(this.p0,this.p1,n.p0,n.p1)}catch(i){if(!(i instanceof se))throw i}return null},ee.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},ee.prototype.pointAlongOffset=function(n,i){var s=this.p0.x+n*(this.p1.x-this.p0.x),l=this.p0.y+n*(this.p1.y-this.p0.y),h=this.p1.x-this.p0.x,v=this.p1.y-this.p0.y,S=Math.sqrt(h*h+v*v),R=0,V=0;if(i!==0){if(S<=0)throw new Error("Cannot compute offset from zero-length line segment");R=i*h/S,V=i*v/S}return new U(s-V,l+R)},ee.prototype.setCoordinates=function(){if(arguments.length===1){var n=arguments[0];this.setCoordinates(n.p0,n.p1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.p0.x=i.x,this.p0.y=i.y,this.p1.x=s.x,this.p1.y=s.y}},ee.prototype.segmentFraction=function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||A.isNaN(i))&&(i=1),i},ee.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},ee.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},ee.prototype.distance=function(){if(arguments[0]instanceof ee){var n=arguments[0];return W.distanceLineLine(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof U){var i=arguments[0];return W.distancePointLine(i,this.p0,this.p1)}},ee.prototype.pointAlong=function(n){var i=new U;return i.x=this.p0.x+n*(this.p1.x-this.p0.x),i.y=this.p0.y+n*(this.p1.y-this.p0.y),i},ee.prototype.hashCode=function(){var n=A.doubleToLongBits(this.p0.x);n^=31*A.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),s=A.doubleToLongBits(this.p1.x);return s^=31*A.doubleToLongBits(this.p1.y),i^(Math.trunc(s)^Math.trunc(s>>32))},ee.prototype.interfaces_=function(){return[G,t]},ee.prototype.getClass=function(){return ee},ee.midPoint=function(n,i){return new U((n.x+i.x)/2,(n.y+i.y)/2)},Ff.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(ee,Ff);var pi=function(){this.tempEnv1=new Vt,this.tempEnv2=new Vt,this._overlapSeg1=new ee,this._overlapSeg2=new ee};pi.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];n.getLineSegment(i,this._overlapSeg1),s.getLineSegment(l,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},pi.prototype.interfaces_=function(){return[]},pi.prototype.getClass=function(){return pi};var di=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];this._pts=n,this._start=i,this._end=s,this._context=l};di.prototype.getLineSegment=function(n,i){i.p0=this._pts[n],i.p1=this._pts[n+1]},di.prototype.computeSelect=function(n,i,s,l){var h=this._pts[i],v=this._pts[s];if(l.tempEnv1.init(h,v),s-i==1)return l.select(this,i),null;if(!n.intersects(l.tempEnv1))return null;var S=Math.trunc((i+s)/2);i<S&&this.computeSelect(n,i,S,l),S<s&&this.computeSelect(n,S,s,l)},di.prototype.getCoordinates=function(){for(var n=new Array(this._end-this._start+1).fill(null),i=0,s=this._start;s<=this._end;s++)n[i++]=this._pts[s];return n},di.prototype.computeOverlaps=function(n,i){this.computeOverlapsInternal(this._start,this._end,n,n._start,n._end,i)},di.prototype.setId=function(n){this._id=n},di.prototype.select=function(n,i){this.computeSelect(n,this._start,this._end,i)},di.prototype.getEnvelope=function(){if(this._env===null){var n=this._pts[this._start],i=this._pts[this._end];this._env=new Vt(n,i)}return this._env},di.prototype.getEndIndex=function(){return this._end},di.prototype.getStartIndex=function(){return this._start},di.prototype.getContext=function(){return this._context},di.prototype.getId=function(){return this._id},di.prototype.computeOverlapsInternal=function(n,i,s,l,h,v){var S=this._pts[n],R=this._pts[i],V=s._pts[l],nt=s._pts[h];if(i-n==1&&h-l==1)return v.overlap(this,n,s,l),null;if(v.tempEnv1.init(S,R),v.tempEnv2.init(V,nt),!v.tempEnv1.intersects(v.tempEnv2))return null;var _t=Math.trunc((n+i)/2),Et=Math.trunc((l+h)/2);n<_t&&(l<Et&&this.computeOverlapsInternal(n,_t,s,l,Et,v),Et<h&&this.computeOverlapsInternal(n,_t,s,Et,h,v)),_t<i&&(l<Et&&this.computeOverlapsInternal(_t,i,s,l,Et,v),Et<h&&this.computeOverlapsInternal(_t,i,s,Et,h,v))},di.prototype.interfaces_=function(){return[]},di.prototype.getClass=function(){return di};var io=function(){};io.prototype.interfaces_=function(){return[]},io.prototype.getClass=function(){return io},io.getChainStartIndices=function(n){var i=0,s=new ct;s.add(new ft(i));do{var l=io.findChainEnd(n,i);s.add(new ft(l)),i=l}while(i<n.length-1);return io.toIntArray(s)},io.findChainEnd=function(n,i){for(var s=i;s<n.length-1&&n[s].equals2D(n[s+1]);)s++;if(s>=n.length-1)return n.length-1;for(var l=kn.quadrant(n[s],n[s+1]),h=i+1;h<n.length&&!(!n[h-1].equals2D(n[h])&&kn.quadrant(n[h-1],n[h])!==l);)h++;return h-1},io.getChains=function(){if(arguments.length===1){var n=arguments[0];return io.getChains(n,null)}if(arguments.length===2){for(var i=arguments[0],s=arguments[1],l=new ct,h=io.getChainStartIndices(i),v=0;v<h.length-1;v++){var S=new di(i,h[v],h[v+1],s);l.add(S)}return l}},io.toIntArray=function(n){for(var i=new Array(n.size()).fill(null),s=0;s<i.length;s++)i[s]=n.get(s).intValue();return i};var Ri=function(){};Ri.prototype.computeNodes=function(n){},Ri.prototype.getNodedSubstrings=function(){},Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri};var $s=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setSegmentIntersector(n)}}};$s.prototype.setSegmentIntersector=function(n){this._segInt=n},$s.prototype.interfaces_=function(){return[Ri]},$s.prototype.getClass=function(){return $s};var Bu=function(n){function i(l){l?n.call(this,l):n.call(this),this._monoChains=new ct,this._index=new Pc,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={SegmentOverlapAction:{configurable:!0}};return i.prototype.getMonotoneChains=function(){return this._monoChains},i.prototype.getNodedSubstrings=function(){return or.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(l){for(var h=io.getChains(l.getCoordinates(),l).iterator();h.hasNext();){var v=h.next();v.setId(this._idCounter++),this._index.insert(v.getEnvelope(),v),this._monoChains.add(v)}},i.prototype.computeNodes=function(l){this._nodedSegStrings=l;for(var h=l.iterator();h.hasNext();)this.add(h.next());this.intersectChains()},i.prototype.intersectChains=function(){for(var l=new fr(this._segInt),h=this._monoChains.iterator();h.hasNext();)for(var v=h.next(),S=this._index.query(v.getEnvelope()).iterator();S.hasNext();){var R=S.next();if(R.getId()>v.getId()&&(v.computeOverlaps(R,l),this._nOverlaps++),this._segInt.isDone())return null}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.SegmentOverlapAction.get=function(){return fr},Object.defineProperties(i,s),i}($s),fr=function(n){function i(){n.call(this),this._si=null;var s=arguments[0];this._si=s}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.overlap=function(){if(arguments.length!==4)return n.prototype.overlap.apply(this,arguments);var s=arguments[0],l=arguments[1],h=arguments[2],v=arguments[3],S=s.getContext(),R=h.getContext();this._si.processIntersections(S,l,R,v)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(pi),Fe=function n(){if(this._quadrantSegments=n.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=n.CAP_ROUND,this._joinStyle=n.JOIN_ROUND,this._mitreLimit=n.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=n.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setQuadrantSegments(i)}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.setQuadrantSegments(s),this.setEndCapStyle(l)}else if(arguments.length===4){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3];this.setQuadrantSegments(h),this.setEndCapStyle(v),this.setJoinStyle(S),this.setMitreLimit(R)}}},So={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Fe.prototype.getEndCapStyle=function(){return this._endCapStyle},Fe.prototype.isSingleSided=function(){return this._isSingleSided},Fe.prototype.setQuadrantSegments=function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=Fe.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Fe.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==Fe.JOIN_ROUND&&(this._quadrantSegments=Fe.DEFAULT_QUADRANT_SEGMENTS)},Fe.prototype.getJoinStyle=function(){return this._joinStyle},Fe.prototype.setJoinStyle=function(n){this._joinStyle=n},Fe.prototype.setSimplifyFactor=function(n){this._simplifyFactor=n<0?0:n},Fe.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Fe.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Fe.prototype.setEndCapStyle=function(n){this._endCapStyle=n},Fe.prototype.getMitreLimit=function(){return this._mitreLimit},Fe.prototype.setMitreLimit=function(n){this._mitreLimit=n},Fe.prototype.setSingleSided=function(n){this._isSingleSided=n},Fe.prototype.interfaces_=function(){return[]},Fe.prototype.getClass=function(){return Fe},Fe.bufferDistanceError=function(n){var i=Math.PI/2/n;return 1-Math.cos(i/2)},So.CAP_ROUND.get=function(){return 1},So.CAP_FLAT.get=function(){return 2},So.CAP_SQUARE.get=function(){return 3},So.JOIN_ROUND.get=function(){return 1},So.JOIN_MITRE.get=function(){return 2},So.JOIN_BEVEL.get=function(){return 3},So.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},So.DEFAULT_MITRE_LIMIT.get=function(){return 5},So.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(Fe,So);var sr=function(n){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=W.COUNTERCLOCKWISE,this._inputLine=n||null},Ea={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};sr.prototype.isDeletable=function(n,i,s,l){var h=this._inputLine[n],v=this._inputLine[i],S=this._inputLine[s];return!!this.isConcave(h,v,S)&&!!this.isShallow(h,v,S,l)&&this.isShallowSampled(h,v,n,s,l)},sr.prototype.deleteShallowConcavities=function(){for(var n=1,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i),l=!1;s<this._inputLine.length;){var h=!1;this.isDeletable(n,i,s,this._distanceTol)&&(this._isDeleted[i]=sr.DELETE,h=!0,l=!0),n=h?s:i,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i)}return l},sr.prototype.isShallowConcavity=function(n,i,s,l){return W.computeOrientation(n,i,s)!==this._angleOrientation?!1:W.distancePointLine(i,n,s)<l},sr.prototype.isShallowSampled=function(n,i,s,l,h){var v=Math.trunc((l-s)/sr.NUM_PTS_TO_CHECK);v<=0&&(v=1);for(var S=s;S<l;S+=v)if(!this.isShallow(n,i,this._inputLine[S],h))return!1;return!0},sr.prototype.isConcave=function(n,i,s){var l=W.computeOrientation(n,i,s)===this._angleOrientation;return l},sr.prototype.simplify=function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=W.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},sr.prototype.findNextNonDeletedIndex=function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===sr.DELETE;)i++;return i},sr.prototype.isShallow=function(n,i,s,l){return W.distancePointLine(i,n,s)<l},sr.prototype.collapseLine=function(){for(var n=new Kt,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==sr.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()},sr.prototype.interfaces_=function(){return[]},sr.prototype.getClass=function(){return sr},sr.simplify=function(n,i){return new sr(n).simplify(i)},Ea.INIT.get=function(){return 0},Ea.DELETE.get=function(){return 1},Ea.KEEP.get=function(){return 1},Ea.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(sr,Ea);var Li=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new ct},Uf={COORDINATE_ARRAY_TYPE:{configurable:!0}};Li.prototype.getCoordinates=function(){return this._ptList.toArray(Li.COORDINATE_ARRAY_TYPE)},Li.prototype.setPrecisionModel=function(n){this._precisionModel=n},Li.prototype.addPt=function(n){var i=new U(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},Li.prototype.revere=function(){},Li.prototype.addPts=function(n,i){if(i)for(var s=0;s<n.length;s++)this.addPt(n[s]);else for(var l=n.length-1;l>=0;l--)this.addPt(n[l])},Li.prototype.isRedundant=function(n){if(this._ptList.size()<1)return!1;var i=this._ptList.get(this._ptList.size()-1);return n.distance(i)<this._minimimVertexDistance},Li.prototype.toString=function(){return new Ce().createLineString(this.getCoordinates()).toString()},Li.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var n=new U(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(n.equals(i))return null;this._ptList.add(n)},Li.prototype.setMinimumVertexDistance=function(n){this._minimimVertexDistance=n},Li.prototype.interfaces_=function(){return[]},Li.prototype.getClass=function(){return Li},Uf.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Li,Uf);var ke=function(){},Zs={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};ke.prototype.interfaces_=function(){return[]},ke.prototype.getClass=function(){return ke},ke.toDegrees=function(n){return 180*n/Math.PI},ke.normalize=function(n){for(;n>Math.PI;)n-=ke.PI_TIMES_2;for(;n<=-Math.PI;)n+=ke.PI_TIMES_2;return n},ke.angle=function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var i=arguments[0],s=arguments[1],l=s.x-i.x,h=s.y-i.y;return Math.atan2(h,l)}},ke.isAcute=function(n,i,s){var l=n.x-i.x,h=n.y-i.y;return l*(s.x-i.x)+h*(s.y-i.y)>0},ke.isObtuse=function(n,i,s){var l=n.x-i.x,h=n.y-i.y;return l*(s.x-i.x)+h*(s.y-i.y)<0},ke.interiorAngle=function(n,i,s){var l=ke.angle(i,n),h=ke.angle(i,s);return Math.abs(h-l)},ke.normalizePositive=function(n){if(n<0){for(;n<0;)n+=ke.PI_TIMES_2;n>=ke.PI_TIMES_2&&(n=0)}else{for(;n>=ke.PI_TIMES_2;)n-=ke.PI_TIMES_2;n<0&&(n=0)}return n},ke.angleBetween=function(n,i,s){var l=ke.angle(i,n),h=ke.angle(i,s);return ke.diff(l,h)},ke.diff=function(n,i){var s=null;return(s=n<i?i-n:n-i)>Math.PI&&(s=2*Math.PI-s),s},ke.toRadians=function(n){return n*Math.PI/180},ke.getTurn=function(n,i){var s=Math.sin(i-n);return s>0?ke.COUNTERCLOCKWISE:s<0?ke.CLOCKWISE:ke.NONE},ke.angleBetweenOriented=function(n,i,s){var l=ke.angle(i,n),h=ke.angle(i,s)-l;return h<=-Math.PI?h+ke.PI_TIMES_2:h>Math.PI?h-ke.PI_TIMES_2:h},Zs.PI_TIMES_2.get=function(){return 2*Math.PI},Zs.PI_OVER_2.get=function(){return Math.PI/2},Zs.PI_OVER_4.get=function(){return Math.PI/4},Zs.COUNTERCLOCKWISE.get=function(){return W.COUNTERCLOCKWISE},Zs.CLOCKWISE.get=function(){return W.CLOCKWISE},Zs.NONE.get=function(){return W.COLLINEAR},Object.defineProperties(ke,Zs);var Vn=function n(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new ee,this._seg1=new ee,this._offset0=new ee,this._offset1=new ee,this._side=0,this._hasNarrowConcaveAngle=!1;var i=arguments[0],s=arguments[1],l=arguments[2];this._precisionModel=i,this._bufParams=s,this._li=new rt,this._filletAngleQuantum=Math.PI/2/s.getQuadrantSegments(),s.getQuadrantSegments()>=8&&s.getJoinStyle()===Fe.JOIN_ROUND&&(this._closingSegLengthFactor=n.MAX_CLOSING_SEG_LEN_FACTOR),this.init(l)},cs={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Vn.prototype.addNextSegment=function(n,i){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var s=W.computeOrientation(this._s0,this._s1,this._s2),l=s===W.CLOCKWISE&&this._side===Gt.LEFT||s===W.COUNTERCLOCKWISE&&this._side===Gt.RIGHT;s===0?this.addCollinear(i):l?this.addOutsideTurn(s,i):this.addInsideTurn(s,i)},Vn.prototype.addLineEndCap=function(n,i){var s=new ee(n,i),l=new ee;this.computeOffsetSegment(s,Gt.LEFT,this._distance,l);var h=new ee;this.computeOffsetSegment(s,Gt.RIGHT,this._distance,h);var v=i.x-n.x,S=i.y-n.y,R=Math.atan2(S,v);switch(this._bufParams.getEndCapStyle()){case Fe.CAP_ROUND:this._segList.addPt(l.p1),this.addFilletArc(i,R+Math.PI/2,R-Math.PI/2,W.CLOCKWISE,this._distance),this._segList.addPt(h.p1);break;case Fe.CAP_FLAT:this._segList.addPt(l.p1),this._segList.addPt(h.p1);break;case Fe.CAP_SQUARE:var V=new U;V.x=Math.abs(this._distance)*Math.cos(R),V.y=Math.abs(this._distance)*Math.sin(R);var nt=new U(l.p1.x+V.x,l.p1.y+V.y),_t=new U(h.p1.x+V.x,h.p1.y+V.y);this._segList.addPt(nt),this._segList.addPt(_t)}},Vn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Vn.prototype.addMitreJoin=function(n,i,s,l){var h=!0,v=null;try{v=_e.intersection(i.p0,i.p1,s.p0,s.p1),(l<=0?1:v.distance(n)/Math.abs(l))>this._bufParams.getMitreLimit()&&(h=!1)}catch(S){if(!(S instanceof se))throw S;v=new U(0,0),h=!1}h?this._segList.addPt(v):this.addLimitedMitreJoin(i,s,l,this._bufParams.getMitreLimit())},Vn.prototype.addFilletCorner=function(n,i,s,l,h){var v=i.x-n.x,S=i.y-n.y,R=Math.atan2(S,v),V=s.x-n.x,nt=s.y-n.y,_t=Math.atan2(nt,V);l===W.CLOCKWISE?R<=_t&&(R+=2*Math.PI):R>=_t&&(R-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(n,R,_t,l,h),this._segList.addPt(s)},Vn.prototype.addOutsideTurn=function(n,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*Vn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Fe.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Fe.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(i&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))},Vn.prototype.createSquare=function(n){this._segList.addPt(new U(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new U(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new U(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new U(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()},Vn.prototype.addSegments=function(n,i){this._segList.addPts(n,i)},Vn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},Vn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},Vn.prototype.initSideSegments=function(n,i,s){this._s1=n,this._s2=i,this._side=s,this._seg1.setCoordinates(n,i),this.computeOffsetSegment(this._seg1,s,this._distance,this._offset1)},Vn.prototype.addLimitedMitreJoin=function(n,i,s,l){var h=this._seg0.p1,v=ke.angle(h,this._seg0.p0),S=ke.angleBetweenOriented(this._seg0.p0,h,this._seg1.p1)/2,R=ke.normalize(v+S),V=ke.normalize(R+Math.PI),nt=l*s,_t=s-nt*Math.abs(Math.sin(S)),Et=h.x+nt*Math.cos(V),Wt=h.y+nt*Math.sin(V),$t=new U(Et,Wt),ie=new ee(h,$t),Ee=ie.pointAlongOffset(1,_t),An=ie.pointAlongOffset(1,-_t);this._side===Gt.LEFT?(this._segList.addPt(Ee),this._segList.addPt(An)):(this._segList.addPt(An),this._segList.addPt(Ee))},Vn.prototype.computeOffsetSegment=function(n,i,s,l){var h=i===Gt.LEFT?1:-1,v=n.p1.x-n.p0.x,S=n.p1.y-n.p0.y,R=Math.sqrt(v*v+S*S),V=h*s*v/R,nt=h*s*S/R;l.p0.x=n.p0.x-nt,l.p0.y=n.p0.y+V,l.p1.x=n.p1.x-nt,l.p1.y=n.p1.y+V},Vn.prototype.addFilletArc=function(n,i,s,l,h){var v=l===W.CLOCKWISE?-1:1,S=Math.abs(i-s),R=Math.trunc(S/this._filletAngleQuantum+.5);if(R<1)return null;for(var V=S/R,nt=0,_t=new U;nt<S;){var Et=i+v*nt;_t.x=n.x+h*Math.cos(Et),_t.y=n.y+h*Math.sin(Et),this._segList.addPt(_t),nt+=V}},Vn.prototype.addInsideTurn=function(n,i){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*Vn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var s=new U((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(s);var l=new U((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(l)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},Vn.prototype.createCircle=function(n){var i=new U(n.x+this._distance,n.y);this._segList.addPt(i),this.addFilletArc(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Vn.prototype.addBevelJoin=function(n,i){this._segList.addPt(n.p1),this._segList.addPt(i.p0)},Vn.prototype.init=function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Li,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*Vn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Vn.prototype.addCollinear=function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Fe.JOIN_BEVEL||this._bufParams.getJoinStyle()===Fe.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,W.CLOCKWISE,this._distance))},Vn.prototype.closeRing=function(){this._segList.closeRing()},Vn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Vn.prototype.interfaces_=function(){return[]},Vn.prototype.getClass=function(){return Vn},cs.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},cs.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},cs.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},cs.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Vn,cs);var ni=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i};ni.prototype.getOffsetCurve=function(n,i){if(this._distance=i,i===0)return null;var s=i<0,l=Math.abs(i),h=this.getSegGen(l);n.length<=1?this.computePointCurve(n[0],h):this.computeOffsetCurve(n,s,h);var v=h.getCoordinates();return s&&Mt.reverse(v),v},ni.prototype.computeSingleSidedBufferCurve=function(n,i,s){var l=this.simplifyTolerance(this._distance);if(i){s.addSegments(n,!0);var h=sr.simplify(n,-l),v=h.length-1;s.initSideSegments(h[v],h[v-1],Gt.LEFT),s.addFirstSegment();for(var S=v-2;S>=0;S--)s.addNextSegment(h[S],!0)}else{s.addSegments(n,!1);var R=sr.simplify(n,l),V=R.length-1;s.initSideSegments(R[0],R[1],Gt.LEFT),s.addFirstSegment();for(var nt=2;nt<=V;nt++)s.addNextSegment(R[nt],!0)}s.addLastSegment(),s.closeRing()},ni.prototype.computeRingBufferCurve=function(n,i,s){var l=this.simplifyTolerance(this._distance);i===Gt.RIGHT&&(l=-l);var h=sr.simplify(n,l),v=h.length-1;s.initSideSegments(h[v-1],h[0],i);for(var S=1;S<=v;S++){var R=S!==1;s.addNextSegment(h[S],R)}s.closeRing()},ni.prototype.computeLineBufferCurve=function(n,i){var s=this.simplifyTolerance(this._distance),l=sr.simplify(n,s),h=l.length-1;i.initSideSegments(l[0],l[1],Gt.LEFT);for(var v=2;v<=h;v++)i.addNextSegment(l[v],!0);i.addLastSegment(),i.addLineEndCap(l[h-1],l[h]);var S=sr.simplify(n,-s),R=S.length-1;i.initSideSegments(S[R],S[R-1],Gt.LEFT);for(var V=R-2;V>=0;V--)i.addNextSegment(S[V],!0);i.addLastSegment(),i.addLineEndCap(S[1],S[0]),i.closeRing()},ni.prototype.computePointCurve=function(n,i){switch(this._bufParams.getEndCapStyle()){case Fe.CAP_ROUND:i.createCircle(n);break;case Fe.CAP_SQUARE:i.createSquare(n)}},ni.prototype.getLineCurve=function(n,i){if(this._distance=i,i<0&&!this._bufParams.isSingleSided()||i===0)return null;var s=Math.abs(i),l=this.getSegGen(s);if(n.length<=1)this.computePointCurve(n[0],l);else if(this._bufParams.isSingleSided()){var h=i<0;this.computeSingleSidedBufferCurve(n,h,l)}else this.computeLineBufferCurve(n,l);return l.getCoordinates()},ni.prototype.getBufferParameters=function(){return this._bufParams},ni.prototype.simplifyTolerance=function(n){return n*this._bufParams.getSimplifyFactor()},ni.prototype.getRingCurve=function(n,i,s){if(this._distance=s,n.length<=2)return this.getLineCurve(n,s);if(s===0)return ni.copyCoordinates(n);var l=this.getSegGen(s);return this.computeRingBufferCurve(n,i,l),l.getCoordinates()},ni.prototype.computeOffsetCurve=function(n,i,s){var l=this.simplifyTolerance(this._distance);if(i){var h=sr.simplify(n,-l),v=h.length-1;s.initSideSegments(h[v],h[v-1],Gt.LEFT),s.addFirstSegment();for(var S=v-2;S>=0;S--)s.addNextSegment(h[S],!0)}else{var R=sr.simplify(n,l),V=R.length-1;s.initSideSegments(R[0],R[1],Gt.LEFT),s.addFirstSegment();for(var nt=2;nt<=V;nt++)s.addNextSegment(R[nt],!0)}s.addLastSegment()},ni.prototype.getSegGen=function(n){return new Vn(this._precisionModel,this._bufParams,n)},ni.prototype.interfaces_=function(){return[]},ni.prototype.getClass=function(){return ni},ni.copyCoordinates=function(n){for(var i=new Array(n.length).fill(null),s=0;s<i.length;s++)i[s]=new U(n[s]);return i};var Js=function(){this._subgraphs=null,this._seg=new ee,this._cga=new W;var n=arguments[0];this._subgraphs=n},Ic={DepthSegment:{configurable:!0}};Js.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var n=arguments[0],i=new ct,s=this._subgraphs.iterator();s.hasNext();){var l=s.next(),h=l.getEnvelope();n.y<h.getMinY()||n.y>h.getMaxY()||this.findStabbedSegments(n,l.getDirectedEdges(),i)}return i}if(arguments.length===3){if(j(arguments[2],kt)&&arguments[0]instanceof U&&arguments[1]instanceof Ac){for(var v=arguments[0],S=arguments[1],R=arguments[2],V=S.getEdge().getCoordinates(),nt=0;nt<V.length-1;nt++)if(this._seg.p0=V[nt],this._seg.p1=V[nt+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<v.x)&&!(this._seg.isHorizontal()||v.y<this._seg.p0.y||v.y>this._seg.p1.y||W.computeOrientation(this._seg.p0,this._seg.p1,v)===W.RIGHT)){var _t=S.getDepth(Gt.LEFT);this._seg.p0.equals(V[nt])||(_t=S.getDepth(Gt.RIGHT));var Et=new fs(this._seg,_t);R.add(Et)}}else if(j(arguments[2],kt)&&arguments[0]instanceof U&&j(arguments[1],kt))for(var Wt=arguments[0],$t=arguments[1],ie=arguments[2],Ee=$t.iterator();Ee.hasNext();){var An=Ee.next();An.isForward()&&this.findStabbedSegments(Wt,An,ie)}}},Js.prototype.getDepth=function(n){var i=this.findStabbedSegments(n);return i.size()===0?0:ro.min(i)._leftDepth},Js.prototype.interfaces_=function(){return[]},Js.prototype.getClass=function(){return Js},Ic.DepthSegment.get=function(){return fs},Object.defineProperties(Js,Ic);var fs=function(){this._upwardSeg=null,this._leftDepth=null;var n=arguments[0],i=arguments[1];this._upwardSeg=new ee(n),this._leftDepth=i};fs.prototype.compareTo=function(n){var i=n;if(this._upwardSeg.minX()>=i._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=i._upwardSeg.minX())return-1;var s=this._upwardSeg.orientationIndex(i._upwardSeg);return s!==0||(s=-1*i._upwardSeg.orientationIndex(this._upwardSeg))!=0?s:this._upwardSeg.compareTo(i._upwardSeg)},fs.prototype.compareX=function(n,i){var s=n.p0.compareTo(i.p0);return s!==0?s:n.p1.compareTo(i.p1)},fs.prototype.toString=function(){return this._upwardSeg.toString()},fs.prototype.interfaces_=function(){return[G]},fs.prototype.getClass=function(){return fs};var Ve=function(n,i,s){this.p0=n||null,this.p1=i||null,this.p2=s||null};Ve.prototype.area=function(){return Ve.area(this.p0,this.p1,this.p2)},Ve.prototype.signedArea=function(){return Ve.signedArea(this.p0,this.p1,this.p2)},Ve.prototype.interpolateZ=function(n){if(n===null)throw new L("Supplied point is null.");return Ve.interpolateZ(n,this.p0,this.p1,this.p2)},Ve.prototype.longestSideLength=function(){return Ve.longestSideLength(this.p0,this.p1,this.p2)},Ve.prototype.isAcute=function(){return Ve.isAcute(this.p0,this.p1,this.p2)},Ve.prototype.circumcentre=function(){return Ve.circumcentre(this.p0,this.p1,this.p2)},Ve.prototype.area3D=function(){return Ve.area3D(this.p0,this.p1,this.p2)},Ve.prototype.centroid=function(){return Ve.centroid(this.p0,this.p1,this.p2)},Ve.prototype.inCentre=function(){return Ve.inCentre(this.p0,this.p1,this.p2)},Ve.prototype.interfaces_=function(){return[]},Ve.prototype.getClass=function(){return Ve},Ve.area=function(n,i,s){return Math.abs(((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2)},Ve.signedArea=function(n,i,s){return((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2},Ve.det=function(n,i,s,l){return n*l-i*s},Ve.interpolateZ=function(n,i,s,l){var h=i.x,v=i.y,S=s.x-h,R=l.x-h,V=s.y-v,nt=l.y-v,_t=S*nt-R*V,Et=n.x-h,Wt=n.y-v,$t=(nt*Et-R*Wt)/_t,ie=(-V*Et+S*Wt)/_t;return i.z+$t*(s.z-i.z)+ie*(l.z-i.z)},Ve.longestSideLength=function(n,i,s){var l=n.distance(i),h=i.distance(s),v=s.distance(n),S=l;return h>S&&(S=h),v>S&&(S=v),S},Ve.isAcute=function(n,i,s){return!!ke.isAcute(n,i,s)&&!!ke.isAcute(i,s,n)&&!!ke.isAcute(s,n,i)},Ve.circumcentre=function(n,i,s){var l=s.x,h=s.y,v=n.x-l,S=n.y-h,R=i.x-l,V=i.y-h,nt=2*Ve.det(v,S,R,V),_t=Ve.det(S,v*v+S*S,V,R*R+V*V),Et=Ve.det(v,v*v+S*S,R,R*R+V*V);return new U(l-_t/nt,h+Et/nt)},Ve.perpendicularBisector=function(n,i){var s=i.x-n.x,l=i.y-n.y,h=new _e(n.x+s/2,n.y+l/2,1),v=new _e(n.x-l+s/2,n.y+s+l/2,1);return new _e(h,v)},Ve.angleBisector=function(n,i,s){var l=i.distance(n),h=l/(l+i.distance(s)),v=s.x-n.x,S=s.y-n.y;return new U(n.x+h*v,n.y+h*S)},Ve.area3D=function(n,i,s){var l=i.x-n.x,h=i.y-n.y,v=i.z-n.z,S=s.x-n.x,R=s.y-n.y,V=s.z-n.z,nt=h*V-v*R,_t=v*S-l*V,Et=l*R-h*S,Wt=nt*nt+_t*_t+Et*Et,$t=Math.sqrt(Wt)/2;return $t},Ve.centroid=function(n,i,s){var l=(n.x+i.x+s.x)/3,h=(n.y+i.y+s.y)/3;return new U(l,h)},Ve.inCentre=function(n,i,s){var l=i.distance(s),h=n.distance(s),v=n.distance(i),S=l+h+v,R=(l*n.x+h*i.x+v*s.x)/S,V=(l*n.y+h*i.y+v*s.y)/S;return new U(R,V)};var Ni=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new ct;var n=arguments[0],i=arguments[1],s=arguments[2];this._inputGeom=n,this._distance=i,this._curveBuilder=s};Ni.prototype.addPoint=function(n){if(this._distance<=0)return null;var i=n.getCoordinates(),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,$.EXTERIOR,$.INTERIOR)},Ni.prototype.addPolygon=function(n){var i=this._distance,s=Gt.LEFT;this._distance<0&&(i=-this._distance,s=Gt.RIGHT);var l=n.getExteriorRing(),h=Mt.removeRepeatedPoints(l.getCoordinates());if(this._distance<0&&this.isErodedCompletely(l,this._distance)||this._distance<=0&&h.length<3)return null;this.addPolygonRing(h,i,s,$.EXTERIOR,$.INTERIOR);for(var v=0;v<n.getNumInteriorRing();v++){var S=n.getInteriorRingN(v),R=Mt.removeRepeatedPoints(S.getCoordinates());this._distance>0&&this.isErodedCompletely(S,-this._distance)||this.addPolygonRing(R,i,Gt.opposite(s),$.INTERIOR,$.EXTERIOR)}},Ni.prototype.isTriangleErodedCompletely=function(n,i){var s=new Ve(n[0],n[1],n[2]),l=s.inCentre();return W.distancePointLine(l,s.p0,s.p1)<Math.abs(i)},Ni.prototype.addLineString=function(n){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=Mt.removeRepeatedPoints(n.getCoordinates()),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,$.EXTERIOR,$.INTERIOR)},Ni.prototype.addCurve=function(n,i,s){if(n===null||n.length<2)return null;var l=new or(n,new Tn(0,$.BOUNDARY,i,s));this._curveList.add(l)},Ni.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Ni.prototype.addPolygonRing=function(n,i,s,l,h){if(i===0&&n.length<bn.MINIMUM_VALID_SIZE)return null;var v=l,S=h;n.length>=bn.MINIMUM_VALID_SIZE&&W.isCCW(n)&&(v=h,S=l,s=Gt.opposite(s));var R=this._curveBuilder.getRingCurve(n,s,i);this.addCurve(R,v,S)},Ni.prototype.add=function(n){if(n.isEmpty())return null;n instanceof ue?this.addPolygon(n):n instanceof Qt?this.addLineString(n):n instanceof ge?this.addPoint(n):n instanceof Oe?this.addCollection(n):n instanceof K?this.addCollection(n):n instanceof Un?this.addCollection(n):n instanceof Sr&&this.addCollection(n)},Ni.prototype.isErodedCompletely=function(n,i){var s=n.getCoordinates();if(s.length<4)return i<0;if(s.length===4)return this.isTriangleErodedCompletely(s,i);var l=n.getEnvelopeInternal(),h=Math.min(l.getHeight(),l.getWidth());return i<0&&2*Math.abs(i)>h},Ni.prototype.addCollection=function(n){for(var i=0;i<n.getNumGeometries();i++){var s=n.getGeometryN(i);this.add(s)}},Ni.prototype.interfaces_=function(){return[]},Ni.prototype.getClass=function(){return Ni};var eu=function(){};eu.prototype.locate=function(n){},eu.prototype.interfaces_=function(){return[]},eu.prototype.getClass=function(){return eu};var oo=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var n=arguments[0];this._parent=n,this._atStart=!0,this._index=0,this._max=n.getNumGeometries()};oo.prototype.next=function(){if(this._atStart)return this._atStart=!1,oo.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new o;var n=this._parent.getGeometryN(this._index++);return n instanceof Sr?(this._subcollectionIterator=new oo(n),this._subcollectionIterator.next()):n},oo.prototype.remove=function(){throw new Error(this.getClass().getName())},oo.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},oo.prototype.interfaces_=function(){return[et]},oo.prototype.getClass=function(){return oo},oo.isAtomic=function(n){return!(n instanceof Sr)};var ri=function(){this._geom=null;var n=arguments[0];this._geom=n};ri.prototype.locate=function(n){return ri.locate(n,this._geom)},ri.prototype.interfaces_=function(){return[eu]},ri.prototype.getClass=function(){return ri},ri.isPointInRing=function(n,i){return!!i.getEnvelopeInternal().intersects(n)&&W.isPointInRing(n,i.getCoordinates())},ri.containsPointInPolygon=function(n,i){if(i.isEmpty())return!1;var s=i.getExteriorRing();if(!ri.isPointInRing(n,s))return!1;for(var l=0;l<i.getNumInteriorRing();l++){var h=i.getInteriorRingN(l);if(ri.isPointInRing(n,h))return!1}return!0},ri.containsPoint=function(n,i){if(i instanceof ue)return ri.containsPointInPolygon(n,i);if(i instanceof Sr)for(var s=new oo(i);s.hasNext();){var l=s.next();if(l!==i&&ri.containsPoint(n,l))return!0}return!1},ri.locate=function(n,i){return i.isEmpty()?$.EXTERIOR:ri.containsPoint(n,i)?$.INTERIOR:$.EXTERIOR};var Vr=function(){this._edgeMap=new w,this._edgeList=null,this._ptInAreaLocation=[$.NONE,$.NONE]};Vr.prototype.getNextCW=function(n){this.getEdges();var i=this._edgeList.indexOf(n),s=i-1;return i===0&&(s=this._edgeList.size()-1),this._edgeList.get(s)},Vr.prototype.propagateSideLabels=function(n){for(var i=$.NONE,s=this.iterator();s.hasNext();){var l=s.next().getLabel();l.isArea(n)&&l.getLocation(n,Gt.LEFT)!==$.NONE&&(i=l.getLocation(n,Gt.LEFT))}if(i===$.NONE)return null;for(var h=i,v=this.iterator();v.hasNext();){var S=v.next(),R=S.getLabel();if(R.getLocation(n,Gt.ON)===$.NONE&&R.setLocation(n,Gt.ON,h),R.isArea(n)){var V=R.getLocation(n,Gt.LEFT),nt=R.getLocation(n,Gt.RIGHT);if(nt!==$.NONE){if(nt!==h)throw new qo("side location conflict",S.getCoordinate());V===$.NONE&&P.shouldNeverReachHere("found single null side (at "+S.getCoordinate()+")"),h=V}else P.isTrue(R.getLocation(n,Gt.LEFT)===$.NONE,"found single null side"),R.setLocation(n,Gt.RIGHT,h),R.setLocation(n,Gt.LEFT,h)}}},Vr.prototype.getCoordinate=function(){var n=this.iterator();return n.hasNext()?n.next().getCoordinate():null},Vr.prototype.print=function(n){Zt.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(n)},Vr.prototype.isAreaLabelsConsistent=function(n){return this.computeEdgeEndLabels(n.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},Vr.prototype.checkAreaLabelsConsistent=function(n){var i=this.getEdges();if(i.size()<=0)return!0;var s=i.size()-1,l=i.get(s).getLabel().getLocation(n,Gt.LEFT);P.isTrue(l!==$.NONE,"Found unlabelled area edge");for(var h=l,v=this.iterator();v.hasNext();){var S=v.next().getLabel();P.isTrue(S.isArea(n),"Found non-area edge");var R=S.getLocation(n,Gt.LEFT),V=S.getLocation(n,Gt.RIGHT);if(R===V||V!==h)return!1;h=R}return!0},Vr.prototype.findIndex=function(n){this.iterator();for(var i=0;i<this._edgeList.size();i++)if(this._edgeList.get(i)===n)return i;return-1},Vr.prototype.iterator=function(){return this.getEdges().iterator()},Vr.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new ct(this._edgeMap.values())),this._edgeList},Vr.prototype.getLocation=function(n,i,s){return this._ptInAreaLocation[n]===$.NONE&&(this._ptInAreaLocation[n]=ri.locate(i,s[n].getGeometry())),this._ptInAreaLocation[n]},Vr.prototype.toString=function(){var n=new Tt;n.append("EdgeEndStar: "+this.getCoordinate()),n.append(\`
|
|
109
109
|
\`);for(var i=this.iterator();i.hasNext();){var s=i.next();n.append(s),n.append(\`
|