@aibee/crc-bmap 0.8.55 → 0.8.56

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.
@@ -104,14 +104,14 @@
104
104
  gl_FragColor = vec4(uColor2, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
105
105
  }
106
106
  }
107
- `,n=-1/0,r=this.geometry.getAttribute("position");if(r)for(let s=0;s<r.count;s++){let a=r.getZ(s);a>n&&(n=a)}let o=new at.ShaderMaterial({uniforms:{maxZ:{value:n},uColor:{value:new at.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new at.Color(Ee(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=L.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 at.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(n=>{let{coords:r}=n.geometry;for(let o=0;o<r.length;o++){let s=r[o];for(let a=0;a<s.length;a++){let l=s[a],u=a+1===s.length?s[0]:s[a+1];t.push(new at.Vector3(l[0],l[1],e)),t.push(new at.Vector3(u[0],u[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new at.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new at.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t;this.geometry.dispose(),this.material.dispose(),(t=this.line)==null||t.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>w({},fa,n)),this.init()}};var ft=require("three");var w1=require("lodash");var UC={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1},st=class extends ft.Object3D{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!this.options.icon&&this.options.text?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:.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",t=>g(this,null,function*(){let{value:e}=t;this._initIconPromise&&(yield this._initIconPromise),this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),yield this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-text",t=>{let{value:e}=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-text_font_size",t=>{let{value:e}=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",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this.spriteIcon&&this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return g(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>g(this,null,function*(){let e=yield Fe.getTextureByUrl(this.options.icon),n=new ft.Sprite(new ft.SpriteMaterial({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI}));n.visible=!1,n.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(n),this.spriteIcon=n,t(n)})).then(()=>{this._initIconPromise=null})})}initText(){if(this.options.text){let t=Ut.getTextureByText(this.options.text);this.textAspect=t.image.width/t.image.height;let e=new ft.Sprite(new ft.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}}initSize(){var t,e;let n=0,r=0,{icon:o,text:s}=this.options;o?s?(n=0,r=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,r=0):s?(r=.5,n=0):(n=0,r=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,r)}init(){return g(this,null,function*(){yield this.initIcon(),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:e,height:n}}=this.context,r=e*(t.x+1)/2,o=n*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let s=this.iconWidth/2,a=new ft.Box2(new ft.Vector2(r-s,o-this.iconHeight),new ft.Vector2(r+s,o)),l=this.textWidth/2,u=new ft.Box2(new ft.Vector2(r-l,o-this.textHeight-this.durIconAndText-this.iconHeight),new ft.Vector2(r+l,o-this.iconHeight-this.durIconAndText));return this.box=u.union(a),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let n=document.createElement("div");n.style.position="absolute",n.style.zIndex="999",n.style.border="1px solid red",n.style.pointerEvents="none",this.boxHelper=n,this.context.container.appendChild(n)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(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.clear(),this.unRegistryEvent(),this.spriteText=void 0,this.spriteIcon=void 0}constructor(t,e){super(),this.context=t,this.textAspect=1,this.box=new ft.Box2,this._initIconPromise=null,this._initScale=n=>{let{zoom:r}=n;if(this.spriteText){let s=this.textHeight/r;this.spriteText.scale.set(this.textAspect*s,s,.1)}if(this.spriteIcon){var o;(o=this.spriteIcon)==null||o.scale.set(this.options.icon_size[0]/r,this.options.icon_size[1]/r,.1)}this.resetZ()},this.options=Fn((0,w1.cloneDeep)(w({},UC,e)),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};var kt=require("three"),W1=require("three/examples/jsm/utils/BufferGeometryUtils");var S1={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},go=class extends kt.Object3D{init(){return g(this,null,function*(){let t=this.options.map(s=>Ut.getTextureByText(s.texts[0],{fillStyle:As(s.fillColor,s.fillOpacity),strokeStyle:As(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"54px sans-serif"})),e=t.map((s,a)=>{let l=this.options[a],{width:u,height:h}=s.image,c=u/h,p=l.secondHeight*c,m=new kt.PlaneGeometry(p,l.secondHeight),y=new kt.Matrix4().makeTranslation(l.center_x,l.center_y,l.airHeight+l.deltaHeight+l.height).multiply(new kt.Matrix4().makeRotationZ(l.secondRotate));return m.applyMatrix4(y),m}),n=(0,W1.mergeGeometries)(e,!0);e.forEach(s=>s.dispose());let r=t.map(s=>{let a=new kt.MeshBasicMaterial({map:s,alphaTest:1,side:kt.DoubleSide});return s.needsUpdate=!0,a}),o=new kt.Mesh(n,r);this.mesh=o,this.position.z+=.04,this.add(o)})}dispose(){var t,e;(t=this.mesh)==null||t.geometry.dispose(),((e=this.mesh)==null?void 0:e.material).forEach(n=>n.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>w({},S1,n)),this.init()}};var b1=require("three"),Aa=class extends Gt{setEnable(t){super.setEnable(t),yt(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:n,clientHeight:r}}}=this,o=D(this.startPoint,e,n,r),s=D(this.endPoint,e,n,r),a={x:Math.min(o.x,s.x),y:Math.min(o.y,s.y)},l={x:Math.max(o.x,s.x),y:Math.max(o.y,s.y)},u=this.searchMapInFrustum(a,l);this.dispatchEvent({type:"selected",list:u})}}searchMapInFrustum(t,e){var n;let{context:r}=this;return((n=r.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof tt&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:r,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let m=D(p,r,o,s);return Qe(m,e,n)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let a=t.mesh.geometry.boundingBox;if(!a)return!1;let{min:l,max:u}=a,h=D(l,r,o,s),c=D(u,r,o,s);return!(!Qe(h,e,n)||!Qe(c,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new b1.Frustum,this.onPointerDown=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=r=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o)},this.onPointerUp=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let r=this.getSvgCoordinate(this.startPoint),o=w({},r);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(r.x,o.x),y:Math.min(r.y,o.y)},a=Math.abs(o.x-r.x),l=Math.abs(o.y-r.y);yt(this.rect,s.x,s.y,a,l)}else yt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=He(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var Ao=class extends Y1.EventDispatcher{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)}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()}constructor(t){super(),this.context=t,this._list=new Set,this.downPoint=null,this.downTime=0,this.isMultipleSelect=!1,this.onPointerDown=e=>{Date.now()-this.downTime<200||(this.downPoint={x:e.offsetX,y:e.offsetY},this.downTime=Date.now())},this.onPointerUp=e=>{if(!this.downPoint)return;let{offsetX:n,offsetY:r}=e,{x:o,y:s}=this.downPoint;if(Math.sqrt((o-n)**2+(s-r)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(n,r),l=new Set(a.map(h=>h.options.id));this.context.getPoisByDeviceXy(n,r).forEach(h=>{if(!l.has(h.options.id)){var c;let p=((c=this.context.currentFloor)==null?void 0:c.graphicLayer.graphicMap.get(h.options.id))||null;p&&p.options.geometry.type==="point"&&(a.push(p),l.add(h.options.id))}}),(Rn?e.metaKey:e.ctrlKey)||this._list.clear(),a.forEach(h=>this._list.add(h)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{Un(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Un(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:n}=e;this._list.clear(),n.forEach(r=>{this._list.add(r)}),this.selectEnd()},this.boxSelection=new Aa(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var M7=f(We(),1),j7=f(Se(),1),g7=f(be(),1),A7=f(Ye(),1),T7=f(Ie(),1),w7=f(Xe(),1),W7=f(De(),1),S7=f(I(),1);var Ta=require("three");var To=class extends Ta.EventDispatcher{handleHoverGraphicsChange(t){t===void 0&&(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()}constructor(t){super(),this.context=t,this.curGraphics=new Set,this.timer=new nt,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:n,pois:r,e:o}=e,s=r.map(h=>{var c;return(c=this.context.currentFloor)==null?void 0:c.graphicLayer.graphicMap.get(h.options.id)}).filter(h=>h&&h.options.geometry.type==="point");if(!n.length&&!s.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:a}=this.context.config.hover,l=new Set;if(s.length){let h,c=1e4;s.forEach(p=>{let m=r.find(y=>y.options.id===p.options.id);if(m instanceof Xn){let{x:y,y:M}=m.clientPos,j=Math.sqrt((y-o.offsetX)**2+(M-o.offsetY)**2);j<c&&(c=j,h=p)}else if(m instanceof st){let{x:y,y:M}=m.box.getCenter(new Ta.Vector2),j=Math.sqrt((y-o.offsetX)**2+(M-o.offsetY)**2);j<c&&(c=j,h=p)}}),l.add(h)}l.size||n.forEach(h=>l.add(h)),l.forEach(h=>{if(this.graphicTimerMap.get(h)||this.curGraphics.has(h))return;let c=this.timer.setTimeout(()=>{this.curGraphics.add(h),this.graphicTimerMap.delete(h),this.timer.clearTimeout(c),this.handleHoverGraphicsChange()},a);this.graphicTimerMap.set(h,c)}),this.graphicTimerMap.forEach((h,c)=>{l.has(c)||(this.timer.clearTimeout(h),this.graphicTimerMap.delete(c))});let u=this.curGraphics.size;this.curGraphics.forEach(h=>{l.has(h)||this.curGraphics.delete(h)}),u!==this.curGraphics.size&&this.handleHoverGraphicsChange()},this.onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()},this.onBodyPointerMove=e=>{if(this.curGraphics.size){let n=this.context.container.getBoundingClientRect();(e.clientX<n.left||e.clientX>n.right||e.clientY<n.top||e.clientY>n.bottom)&&this.onPointerLevel()}},this.registryEvent()}};var X7=f(I(),1),ri=require("three");var wa=class{updateBox(){this.box.setFromObject(this.context.scene)}setEnable(t){this.enable=t,t?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(j=>j instanceof Nt).length)return null;let e=this.box,{camera:n,clientSize:{width:r,height:o}}=this.context,{min:s,max:a}=e,l=D(s,n,r,o),u=D(a,n,r,o),h=D(new ri.Vector3(s.x,a.y,a.z),n,r,o),c=D(new ri.Vector3(a.x,s.y,s.z),n,r,o),p=Math.min(l.x,u.x,h.x,c.x),m=Math.max(l.x,u.x,h.x,c.x),y=Math.min(l.y,u.y,h.y,c.y),M=Math.max(l.y,u.y,h.y,c.y);return{left:p,right:m,top:y,bottom:M}}checkDistanceToScreenEdge(t){let{left:e,right:n,top:r,bottom:o}=t,{width:s,height:a}=this.context.clientSize,[l,u,h,c]=this.context.config.cameraBound.padding,p=n>=c,m=s-e>=u,y=a-r>=h,M=o>=l;return p&&m&&y&&M}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new ri.Vector3,zoom:1,target:new ri.Vector3},this.enable=!0,this.box=new ri.Box3,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:n,right:r,top:o,bottom:s}=e;this.checkDistanceToScreenEdge({left:n,right:r,top:o,bottom:s})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var U7=f(qh(),1),$h=require("three"),oi=require("@tweenjs/tween.js");var F7=f(I(),1),z7=f(C(),1),S=require("three"),Sa=new S.Ray,R1=new S.Plane,o3=Math.cos(70*S.MathUtils.DEG2RAD),ba=class extends S.EventDispatcher{dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerUp),this.domElement.removeEventListener("wheel",this.onMouseWheel),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp),this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null)}constructor(t,e){super(),this.rotateLineStart=new S.Vector2,this.rotateLineEnd=new S.Vector2,this.spherical=new S.Spherical,this.sphericalDelta=new S.Spherical,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new S.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.screenSpacePanning=!1,this.mouseButtons={LEFT:S.MOUSE.PAN,MIDDLE:S.MOUSE.DOLLY,RIGHT:S.MOUSE.ROTATE},this.touches={ONE:S.TOUCH.PAN,TWO:S.TOUCH.DOLLY_ROTATE},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(P){P.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=P},this.stopListenToKeyEvents=function(){var P;(P=this._domElementKeyEvents)==null||P.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent({type:"change"}),n.update(),o=r.NONE},this.update=function(){let P=new S.Vector3,T=new S.Quaternion().setFromUnitVectors(t.up,new S.Vector3(0,1,0)),N=T.clone().invert(),H=new S.Vector3,Kt=new S.Quaternion,Ae=new S.Vector3,se=2*Math.PI;return function(Qi){Qi===void 0&&(Qi=null);let Ge=n.object.position;P.copy(Ge).sub(n.target),P.applyQuaternion(T),a.setFromVector3(P),n.autoRotate&&o===r.NONE&&Ue(Ji(Qi)),n.enableDamping?(a.theta+=l.theta*n.dampingFactor,a.phi+=l.phi*n.dampingFactor):(a.theta+=l.theta,a.phi+=l.phi);let ke=n.minAzimuthAngle,Ve=n.maxAzimuthAngle;isFinite(ke)&&isFinite(Ve)&&(ke<-Math.PI?ke+=se:ke>Math.PI&&(ke-=se),Ve<-Math.PI?Ve+=se:Ve>Math.PI&&(Ve-=se),ke<=Ve?a.theta=Math.max(ke,Math.min(Ve,a.theta)):a.theta=a.theta>(ke+Ve)/2?Math.max(ke,a.theta):Math.min(Ve,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(h,n.dampingFactor):n.target.add(h),n.zoomToCursor&&R||n.object.isOrthographicCamera?a.radius=Et(a.radius):a.radius=Et(a.radius*u),P.setFromSpherical(a),P.applyQuaternion(N),Ge.copy(n.target).add(P),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,h.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),h.set(0,0,0));let Xo=!1;if(n.zoomToCursor&&R){let Hi=null;if(n.object.isPerspectiveCamera){let qi=P.length();Hi=Et(qi*u);let Do=qi-Hi;n.object.position.addScaledVector(v,Do),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let qi=new S.Vector3(Z.x,Z.y,0);qi.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/u)),n.object.updateProjectionMatrix(),Xo=!0;let Do=new S.Vector3(Z.x,Z.y,0);Do.unproject(n.object),n.object.position.sub(Do).add(qi),n.object.updateMatrixWorld(),Hi=P.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Hi!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Hi).add(n.object.position):(Sa.origin.copy(n.object.position),Sa.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Sa.direction))<o3?t.lookAt(n.target):(R1.setFromNormalAndCoplanarPoint(n.object.up,n.target),Sa.intersectPlane(R1,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/u)),n.object.updateProjectionMatrix(),Xo=!0);return u=1,R=!1,Xo||H.distanceToSquared(n.object.position)>s||8*(1-Kt.dot(n.object.quaternion))>s||Ae.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),H.copy(n.object.position),Kt.copy(n.object.quaternion),Ae.copy(n.target),Xo=!1,!0):!1}}();let n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=r.NONE,s=1e-6,a=new S.Spherical,l=new S.Spherical,u=1,h=new S.Vector3,c=new S.Vector2,p=new S.Vector2,m=new S.Vector2,y=new S.Vector2,M=new S.Vector2,j=new S.Vector2,A=new S.Vector2,W=new S.Vector2,X=new S.Vector2,v=new S.Vector3,Z=new S.Vector2,R=!1,b=[],B={};function Ji(P){return P!==null?2*Math.PI/60*n.autoRotateSpeed*P:2*Math.PI/60/60*n.autoRotateSpeed}function li(){return Math.pow(.95,n.zoomSpeed)}function Ue(P){l.theta-=P}function an(P){l.phi-=P}let ui=function(){let P=new S.Vector3;return function(N,H){P.setFromMatrixColumn(H,0),P.multiplyScalar(-N),h.add(P)}}(),xn=function(){let P=new S.Vector3;return function(N,H){n.screenSpacePanning===!0?P.setFromMatrixColumn(H,1):(P.setFromMatrixColumn(H,0),P.crossVectors(n.object.up,P)),P.multiplyScalar(N),h.add(P)}}(),Ne=function(){let P=new S.Vector3;return function(N,H){let Kt=n.domElement;if(n.object.isPerspectiveCamera){let Ae=n.object.position;P.copy(Ae).sub(n.target);let se=P.length();se*=Math.tan(n.object.fov/2*Math.PI/180),ui(2*N*se/Kt.clientHeight,n.object.matrix),xn(2*H*se/Kt.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(ui(N*(n.object.right-n.object.left)/n.object.zoom/Kt.clientWidth,n.object.matrix),xn(H*(n.object.top-n.object.bottom)/n.object.zoom/Kt.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function hi(P){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?u/=P:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Bi(P){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?u*=P:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Li(P){if(!n.zoomToCursor)return;R=!0;let T=n.domElement.getBoundingClientRect(),N=P.clientX-T.left,H=P.clientY-T.top,Kt=T.width,Ae=T.height;Z.x=N/Kt*2-1,Z.y=-(H/Ae)*2+1,v.set(Z.x,Z.y,1).unproject(n.object).sub(n.object.position).normalize()}function Et(P){return Math.max(n.minDistance,Math.min(n.maxDistance,P))}function Sc(P){c.set(P.clientX,P.clientY)}function fT(P){Li(P),A.set(P.clientX,P.clientY)}function bc(P){y.set(P.clientX,P.clientY)}function mT(P){p.set(P.clientX,P.clientY),m.subVectors(p,c).multiplyScalar(n.rotateSpeed);let T=n.domElement;Ue(2*Math.PI*m.x/T.clientHeight),an(2*Math.PI*m.y/T.clientHeight),c.copy(p),n.update()}function yT(P){W.set(P.clientX,P.clientY),X.subVectors(W,A),X.y>0?hi(li()):X.y<0&&Bi(li()),A.copy(W),n.update()}function PT(P){M.set(P.clientX,P.clientY),j.subVectors(M,y).multiplyScalar(n.panSpeed),Ne(j.x,j.y),y.copy(M),n.update()}function MT(P){Li(P),P.deltaY<0?Bi(li()):P.deltaY>0&&hi(li()),n.update()}function jT(P){let T=!1;switch(P.code){case n.keys.UP:P.ctrlKey||P.metaKey||P.shiftKey?an(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ne(0,n.keyPanSpeed),T=!0;break;case n.keys.BOTTOM:P.ctrlKey||P.metaKey||P.shiftKey?an(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ne(0,-n.keyPanSpeed),T=!0;break;case n.keys.LEFT:P.ctrlKey||P.metaKey||P.shiftKey?Ue(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ne(n.keyPanSpeed,0),T=!0;break;case n.keys.RIGHT:P.ctrlKey||P.metaKey||P.shiftKey?Ue(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ne(-n.keyPanSpeed,0),T=!0;break}T&&(P.preventDefault(),n.update())}function Yc(){if(b.length===1)c.set(b[0].pageX,b[0].pageY);else{let P=(b[0].pageX-b[0].pageY)/(b[1].pageX-b[1].pageY),T=b[0].pageY-P*b[0].pageX;n.rotateLineStart.set(P,T);let N=.5*(b[0].pageX+b[1].pageX),H=.5*(b[0].pageY+b[1].pageY);c.set(N,H)}}function Ic(){if(b.length===1)y.set(b[0].pageX,b[0].pageY);else{let P=.5*(b[0].pageX+b[1].pageX),T=.5*(b[0].pageY+b[1].pageY);y.set(P,T)}}function Xc(){let P=b[0].pageX-b[1].pageX,T=b[0].pageY-b[1].pageY,N=Math.sqrt(P*P+T*T);A.set(0,N)}function gT(){n.enableZoom&&Xc(),n.enablePan&&Ic()}function AT(){n.enableZoom&&Xc(),n.enableRotate&&Yc()}function Dc(P){if(b.length==1)p.set(P.pageX,P.pageY);else{let N=Ba(P),H=.5*(P.pageX+N.x),Kt=.5*(P.pageY+N.y);p.set(H,Kt);let Ae=(P.pageY-N.y)/(P.pageX-N.x),se=N.y-Ae*N.x;if(n.rotateLineEnd.set(Ae,se),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let La=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),Qi=Ae*La+se;if(Number.isFinite(La)&&Number.isFinite(Qi)){let Ge=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(Ge)<.5&&(Ge=-Math.sign(Ge)*(Math.PI-Math.abs(Ge))),Math.abs(Ge)<.1&&(l.theta+=Ge)}}n.rotateLineStart.copy(n.rotateLineEnd)}m.subVectors(p,c).multiplyScalar(n.rotateSpeed);let T=n.domElement;an(2*Math.PI*m.y/T.clientHeight),c.copy(p)}function Zc(P){if(b.length===1)M.set(P.pageX,P.pageY);else{let T=Ba(P),N=.5*(P.pageX+T.x),H=.5*(P.pageY+T.y);M.set(N,H)}j.subVectors(M,y).multiplyScalar(n.panSpeed),Ne(j.x,j.y),y.copy(M)}function vc(P){let T=Ba(P),N=P.pageX-T.x,H=P.pageY-T.y,Kt=Math.sqrt(N*N+H*H);W.set(0,Kt),X.set(0,Math.pow(W.y/A.y,n.zoomSpeed)),hi(X.y),A.copy(W)}function TT(P){n.enableZoom&&vc(P),n.enablePan&&Zc(P)}function wT(P){n.enableZoom&&vc(P),n.enableRotate&&Dc(P)}this.onPointerDown=function(T){n.enabled!==!1&&(b.length===0&&(n.domElement.setPointerCapture(T.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),IT(T),T.pointerType==="touch"?bT(T):WT(T))},this.onPointerMove=function(T){n.enabled!==!1&&(T.pointerType==="touch"?YT(T):ST(T))},this.onPointerUp=function(T){XT(T),b.length===0&&(n.domElement.releasePointerCapture(T.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=r.NONE};function WT(P){let T;switch(P.button){case 0:T=n.mouseButtons.LEFT;break;case 1:T=n.mouseButtons.MIDDLE;break;case 2:T=n.mouseButtons.RIGHT;break;default:T=-1}switch(T){case S.MOUSE.DOLLY:if(n.enableZoom===!1)return;fT(P),o=r.DOLLY;break;case S.MOUSE.ROTATE:if(P.ctrlKey||P.metaKey||P.shiftKey){if(n.enablePan===!1)return;bc(P),o=r.PAN}else{if(n.enableRotate===!1)return;Sc(P),o=r.ROTATE}break;case S.MOUSE.PAN:if(P.ctrlKey||P.metaKey||P.shiftKey){if(n.enableRotate===!1)return;Sc(P),o=r.ROTATE}else{if(n.enablePan===!1)return;bc(P),o=r.PAN}break;default:o=r.NONE}o!==r.NONE&&n.dispatchEvent({type:"start"})}function ST(P){switch(o){case r.ROTATE:if(n.enableRotate===!1)return;mT(P);break;case r.DOLLY:if(n.enableZoom===!1)return;yT(P);break;case r.PAN:if(n.enablePan===!1)return;PT(P);break}}this.onMouseWheel=function(T){n.enabled===!1||n.enableZoom===!1||o!==r.NONE||(T.preventDefault(),n.dispatchEvent({type:"start"}),MT(T),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(T){n.enabled===!1||n.enablePan===!1||jT(T)};function bT(P){switch(xc(P),b.length){case 1:switch(n.touches.ONE){case S.TOUCH.ROTATE:if(n.enableRotate===!1)return;Yc(),o=r.TOUCH_ROTATE;break;case S.TOUCH.PAN:if(n.enablePan===!1)return;Ic(),o=r.TOUCH_PAN;break;default:o=r.NONE}break;case 2:switch(n.touches.TWO){case S.TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;gT(),o=r.TOUCH_DOLLY_PAN;break;case S.TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;AT(),o=r.TOUCH_DOLLY_ROTATE;break;default:o=r.NONE}break;default:o=r.NONE}o!==r.NONE&&n.dispatchEvent({type:"start"})}function YT(P){switch(xc(P),o){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;Dc(P),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;Zc(P),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;TT(P),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;wT(P),n.update();break;default:o=r.NONE}}this.onContextMenu=function(T){n.enabled!==!1&&T.preventDefault()};function IT(P){b.push(P)}function XT(P){delete B[P.pointerId];for(let T=0;T<b.length;T++)if(b[T].pointerId==P.pointerId){b.splice(T,1);return}}function xc(P){let T=B[P.pointerId];T===void 0&&(T=new S.Vector2,B[P.pointerId]=T),T.set(P.pageX,P.pageY)}function Ba(P){let T=P.pointerId===b[0].pointerId?b[1]:b[0];return B[T.pointerId]}n.domElement.addEventListener("contextmenu",this.onContextMenu),n.domElement.addEventListener("pointerdown",this.onPointerDown),n.domElement.addEventListener("pointercancel",this.onPointerUp),n.domElement.addEventListener("wheel",this.onMouseWheel,{passive:!1}),this.update()}};var Ya=class extends ba{registryEvent(){this.addEventListener("change",this.onChange),this.context.addEventListener("update",this.tweenUpdate)}unRegistryEvent(){this.removeEventListener("change",this.onChange),this.context.removeEventListener("update",this.tweenUpdate)}setPolarAngle(t,e){e===void 0&&(e=!1);let{maxPolarAngle:n,minPolarAngle:r}=this,o=n===r;(e||t<=n&&t>=r)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=n,this.minPolarAngle=r)}setPolarAngleByDuration(t,e,n){return g(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):zt(new Promise(r=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new oi.Tween(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),r(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:n,minAzimuthAngle:r}=this,o=n===r;(e||t<=n&&t>=r)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=n,this.minAzimuthAngle=r)}setAzimuthalAngleDuration(t,e,n){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setAzimuthalAngle(t,e):zt(new Promise(r=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new oi.Tween(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),r(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}getCameraLookAt(){return new $h.Vector3().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return g(this,null,function*(){let n=this.target.clone(),r=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(r)),this.target.copy(t.clone()),this.update();return}return zt(new Promise(o=>{let s=new oi.Tween(n,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(n.clone().sub(r)),this.target.copy(n.clone()),this.update()}).onComplete(()=>{this.tweenGroup.remove(s),this.enabled=!0,o(!0)}).onStart(()=>{this.enabled=!1}).start()}),e+500)})}setZoom(t,e,n){n===void 0&&(n=!1);let{minZoom:r,maxZoom:o}=this;(n||t>=r&&t<=o)&&(this.camera.position.copy(e.clone().sub(this.getCameraLookAt())),this.target.copy(e),this.camera.zoom=t,this.update())}setZoomByDuration(t,e,n,r){return g(this,null,function*(){n===void 0&&(n=!1),r===void 0&&(r=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return r?zt(new Promise(s=>{let a=new oi.Tween(o,this.tweenGroup).to({zoom:t,target:e},r).onUpdate(()=>{this.setZoom(o.zoom,o.target,n)}).onComplete(()=>{this.tweenGroup.remove(a),this.enabled=!0,s(!0)}).onStart(()=>{this.enabled=!1}).start()}),r+500).finally(()=>{this.enabled=!0}):this.setZoom(t,e,n)})}setTargetByOffset(t,e){if(e===void 0&&(e=this.target.clone()),!t)return;this.camera.updateMatrix();let n=new $h.Vector3;n.setFromMatrixColumn(this.camera.matrix,1),n.normalize(),n.multiplyScalar(t/this.camera.zoom),e.add(n),this.setCameraPositionByTarget(e,0)}clearTween(){this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll()}dispose(){super.dispose(),this.unRegistryEvent(),this.clearTween()}constructor(t,e,n){super(e,n),this.context=t,this.camera=e,this.domElement=n,this.prevCameraZoom=1,this.tweenGroup=new oi.Group,this.offsetY=0,this.onChange=()=>{let r=this.camera.zoom;r!==this.prevCameraZoom&&(this.prevCameraZoom=r,this.dispatchEvent({type:"change-zoom",zoom:r}))},this.tweenUpdate=()=>{this.tweenGroup.update()},this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=e.zoom,this.registryEvent()}};var Ri=require("three");var Ia=class extends Ri.WebGLRenderer{setCameraAndScene(t,e){this.scene=t,this.camera=e}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(t,e){this.event.addEventListener(t,e)}removeEventListener(t,e){this.event.removeEventListener(t,e)}dispose(){this.timer.dispose(),this.enable=!1,super.dispose()}constructor(t){super(w({antialias:!0,alpha:!0},t)),this.event=new Ri.EventDispatcher,this.enable=!0,this.timer=new nt,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=Ri.PCFSoftShadowMap}};var vn=require("three"),U1=require("three/examples/jsm/loaders/RGBELoader.js");var Xa=class extends vn.Scene{constructor(){super(),new U1.RGBELoader().load(u1,t=>{t.mapping=vn.EquirectangularReflectionMapping,this.environment=t;let e=new vn.Matrix4;e.makeRotationX(Math.PI/2),this.environmentRotation=new vn.Euler().setFromRotationMatrix(e)})}};var N1=require("three"),Da=class extends N1.OrthographicCamera{constructor(t,e){super(-t/2,t/2,e/2,-e/2,-1e4,5e4),this.up.set(0,0,1),this.position.set(0,0,100),this.lookAt(0,0,0)}};var wo=class extends z.EventDispatcher{resizeClientSize(){let{x:t,y:e,width:n,height:r}=this.container.getBoundingClientRect();this.clientSize={width:n||this.container.clientWidth,height:r||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new Da(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new Ya(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.onControlChange),this.control.addEventListener("change-zoom",this.onControlChangeZoom),this.renderer.addEventListener("update",this.onRendererUpdate),this.cameraBound=new wa(this)}getRatio(t,e){t===void 0&&(t=new z.Vector3(0,0,0)),e===void 0&&(e=new z.Vector3(100,0,0));let{clientWidth:n,clientHeight:r}=this.container,o=D(t,this.camera,n,r),s=D(e,this.camera,n,r);return Math.ceil(Math.sqrt((s.x-o.x)**2+(s.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof z.AmbientLight&&(e.color=new z.Color(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let e=t.getCenter();e&&(this.lights.position.x=e.x,this.lights.position.y=e.y),this.cameraBound.updateBox()}getGraphicsByDeviceXy(t,e){var n;let r=new z.Vector2;r.x=t/this.clientSize.width*2-1,r.y=e/this.clientSize.height*-2+1;let o=new z.Raycaster;return o.setFromCamera(r,this.camera),o.ray.origin.sub(o.ray.direction.clone().multiplyScalar(100)),((n=this.currentFloor)==null?void 0:n.graphicLayer.getGraphicByRaycaster(o))||{graphics:[],position:null}}getPoisByDeviceXy(t,e){var n,r;let o=(n=this.currentFloor)==null?void 0:n.poiLayer.getPoiByDeviceXy(t,e),s=(r=this.currentFloor)==null?void 0:r.poiLayer2.getPoiByDeviceXy(t,e);return(o||[]).concat(s||[])}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),this.control.removeEventListener("change",this.onControlChange),this.control.removeEventListener("change-zoom",this.onControlChangeZoom),this.renderer.removeEventListener("update",this.onRendererUpdate)}setPolarAngle(t,e){return e===void 0&&(e=500),this.control.setPolarAngleByDuration(t,!0,e)}setAzimuthalAngle(t,e){return e===void 0&&(e=500),this.control.setAzimuthalAngleDuration(t,!0,e)}getCameraLookAt(){return this.control.getCameraLookAt()}setZoom(t,e,n){return n===void 0&&(n=500),this.control.setZoomByDuration(t,e,!0,n)}getFitCameraToObjectZoom(t,e,n,r){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),r===void 0&&(r=!0);let[o,s,a,l]=e,{clientSize:{width:u,height:h}}=this,c=this.control.getPolarAngle();r&&this.setPolarAngle(0,0);let p=new z.Box3().setFromObject(t);this.setPolarAngle(c,0);let{max:m,min:y}=p,M=new z.Vector3(y.x,m.y,m.z),j=new z.Vector3(m.x,m.y,m.z),A=new z.Vector3(m.x,y.y,y.z),W=new z.Vector3(y.x,y.y,y.z),X=D(M,this.camera,u,h),v=D(j,this.camera,u,h),Z=D(W,this.camera,u,h),R=D(A,this.camera,u,h),B=new z.Box2().setFromPoints([new z.Vector2(X.x,X.y),new z.Vector2(v.x,v.y),new z.Vector2(Z.x,Z.y),new z.Vector2(R.x,R.y)]).getSize(new z.Vector2),Ji=(u-s-l)/B.x,li=(h-o-a)/B.y,Ue=Math.min(Ji,li),an=new z.Vector3((m.x+y.x)/2,(m.y+y.y)/2,(m.z+y.z)/2),ui=Ue*this.camera.zoom,xn=this.camera.clone();xn.zoom=ui,xn.updateMatrix();let Ne=(u-B.x*Ue)/2,hi=(h-B.y*Ue)/2,Bi=Ne<s||Ne<l?(s-l)/2:0,Li=hi<o||hi<a?(o-a)/2:0;if(Bi){let Et=new z.Vector3;Et.setFromMatrixColumn(xn.matrix,0),Et.normalize(),Et.multiplyScalar(Bi/ui),an.add(Et)}if(Li){let Et=new z.Vector3;Et.setFromMatrixColumn(xn.matrix,1),Et.normalize(),Et.multiplyScalar(Li/ui),an.add(Et)}return{zoom:Ue*this.camera.zoom,center:an}}fitCameraToObject(t,e,n,r){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),r===void 0&&(r=!0);let{zoom:o,center:s}=this.getFitCameraToObjectZoom(t,e,n,r);return this.setZoom(o,s,n)}getFitCameraToGroundZoom(t,e,n){if(t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),n===void 0&&(n=!0),this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,e,n).zoom}fitCameraToGround(t,e,n){return t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),n===void 0&&(n=!0),this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundLayer,t,e,n):Promise.resolve(!1)}setCameraPosition(t,e){return g(this,null,function*(){return this.control.setCameraPositionByTarget(t,e)})}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}dispose(){var t;(t=this.currentFloor)==null||t.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(e=>e.dispose()),it(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new Xa,this.renderer=new Ia,this.lights=$0(),this.clientSize={width:0,height:0,x:0,y:0},this.renderRf=0,this.onControlChange=()=>{this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})},this.onControlChangeZoom=n=>{let{zoom:r}=n;this.dispatchEvent({type:"control-zoom-change",zoom:r})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:n,camera:r,renderer:o}=this,{clientWidth:s,clientHeight:a}=n;s=Math.max(1,s),a=Math.max(1,a),r.left=-s/2,r.right=s/2,r.top=a/2,r.bottom=-a/2,r.updateProjectionMatrix(),o.setSize(s,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:s,height:a})},this.onClick=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY);r.length&&this.dispatchEvent({type:"graphic-click",graphics:r,position:o});let s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);s.length&&this.dispatchEvent({type:"poi-click",pois:s})},this.onPointerover=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:r,pois:s,position:o})},this.onPointermove=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:r,pois:s,position:o})},this.onPointerleave=n=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=n=>{let{graphics:r,isMultipleSelect:o}=n;this.dispatchEvent({type:"select-graphic",graphics:r,isMultipleSelect:o})},this.onHoverChange=n=>{let{graphics:r}=n;this.dispatchEvent({type:"hover",graphics:r})},this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new Ao(this),this.hoverHelper=new To(this),this.resizeClientSize(),this.registryEvent()}};var G1=require("lodash"),k1={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 tc(i){return(0,G1.merge)({},k1,i)}var V1=require("lodash");var s3=function(i){return i[i.D2=0]="D2",i[i.D3=1.1]="D3",i}({}),ec=class extends Za.EventDispatcher{changeBuildingCenter(t,e){let{brand:n,project:r}=e,o=t?Mr(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:r,brand:n})}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloorByFloor(t,e){e===void 0&&(e=t.graphicLayer.children),this.triggerHooks(Pt.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(Pt.SWITCH_FLOOR_AFTER,{curFloor:t,graphics:e})}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(this.config.defaultPadding,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()}addModel(t,e){if(t.options.geometry.type==="polygon"){var n;let r=(n=this.context.currentFloor)==null?void 0:n.addModel(w({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(r){let{facilityAngle:o=0,facilityXScale:s=1,facilityYScale:a=1}=t.options.userData;r.rotateZ((180-o)/180*Math.PI),r.scale.set(s,a,1)}}}addHeatmap(t){var e;return(e=this.context.currentFloor)==null?void 0:e.addHeatmap(t)}getLegacyToGraphicMap(){var t;return((t=this.context.currentFloor)==null?void 0:t.userData.legacyToGraphicMap)||new Map}getFloorAllGraphics(){var t;return((t=this.context.currentFloor)==null?void 0:t.graphicLayer.children.filter(e=>e instanceof tt))||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let n=t.options.center,r=t.getCenter(),o=(n==null?void 0:n[0])||r.x,s=(n==null?void 0:n[1])||r.y;return console.log(o,s,n,r),this.context.currentFloor.addPoi(w({},e,{position:{x:o,y:s,z:r.z+t.options.height/2}}))}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e){e===void 0&&(e=500);let n=t.getPosition();return this.context.setCameraPosition(n,e)}translateElementToCenterX(t,e){return g(this,null,function*(){return e===void 0&&(e=500),zt(new Promise(n=>{let r=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:s,height:a},camera:l}=this.context,h=D(o,l,s,a).x-s/2,c=new Za.Vector3;c.setFromMatrixColumn(this.context.camera.matrix,0),c.normalize(),c.multiplyScalar(h/this.context.camera.zoom),r.add(c),this.context.setCameraPosition(r,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:r}=this.container;return D(e,this.context.camera,n,r)}changeMapType(t,e){return e===void 0&&(e=500),this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}resetView(t){return g(this,null,function*(){t===void 0&&(t=300);let e=t/3;yield this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),yield this.context.setPolarAngle(this.config.control.defaultPolar,e),yield this.context.fitCameraToGround(this.config.defaultPadding,e,!1)})}reduceMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver(this.debounceResize);t.observe(this.container),this.observe=t}}unRegistryEvent(){var t;this.context.control.removeEventListener("change",this.onControlChange),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),(t=this.observe)==null||t.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t){t===void 0&&(t=.1);let e=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(e+t,500)}measureDistance(){return g(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new mo(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",r=>{let{distance:o}=r;t(o)})})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new yo(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",r=>{let{area:o}=r;t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}getGraphicByNodeId(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.graphicLayer.getGraphicByNodeId(t))||((n=this.context.currentFloor)==null?void 0:n.parkingSpaceLayer.graphicMap.get(t))||null}deleteGraphic(t){var e;(e=this.context.currentFloor)==null||e.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){var e;if(!t.transformToBuildingGround&&this.currentBuildGround){let n=Mr(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(r=>{Array.isArray(r)&&r.forEach(o=>{o[0]-=n[0],o[1]-=n[1]})});else{let[r,o]=t.geometry.cds;t.geometry.coords=[r-n[0],o-n[1]]}}return(e=this.context.currentFloor)==null?void 0:e.graphicLayer.createGraphic(t)}removePoiById(t){var e,n;(e=this.context.currentFloor)==null||e.poiLayer.removePoiById(t),(n=this.context.currentFloor)==null||n.poiLayer2.removePoiById(t)}getPoiById(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.poiLayer.getPoiById(t))||((n=this.context.currentFloor)==null?void 0:n.poiLayer2.getPoiById(t))}getPois(){var t,e;return[...(((t=this.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).filter(n=>!n.options.built_in),...((e=this.context.currentFloor)==null?void 0:e.poiLayer2.pois)||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}dispose(){this.unRegistryEvent(),this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.plugins=[],this.context.dispose(),this.context=null,this.container=null,Ut.dispose(),Fe.dispose(),jn.dispose(),Dt.dispose(),L.dispose(),this.debounceResize=null}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.basicZoom=1,this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new nt,this.plugins=[],this.onControlChange=()=>{let{camera:{zoom:n}}=this.context;n!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=n)},this.onKeydown=n=>{this.polarKeys.includes(n.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(n.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=n=>{if(this.polarKeys.includes(n.code)){let r=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=r,this.context.control.minPolarAngle=r}if(this.azimuthalKeys.includes(n.code)){let r=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=r,this.context.control.minAzimuthAngle=r}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),r=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 o=this.context.getFitCameraToGroundZoom(void 0,0)||1;this.context.camera.zoom=r,this.context.control.minZoom=o,this.context.control.maxZoom=o*25,this.basicZoom=r,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=tc(e),this.context=new wo(t,this.config),this.debounceResize=(0,V1.debounce)(this.resize,30),this.registryEvent()}};var WB=f(I(),1);var J1=require("three"),vt=class extends J1.EventDispatcher{dispose(){this.bmap=null}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var nc=class extends vt{fetchEquipment(){return g(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,r=""+t+e;yield fetch(r,n).then(o=>o.json()).then(o=>o.data).then(o=>{this.equipmentList=o,this.equipmentMap=new Map(o.map(s=>[s.equipment_id,s]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)})}getGraphicEquipment(t){return t.userData.data.info.userData.equipment}changeGraphicToEquipment(t){t.filter(e=>{let n=this.getGraphicEquipment(e);return n&&this.equipmentMap.has(n)}).forEach(e=>{let n=this.equipmentMap.get(this.getGraphicEquipment(e)),r=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});r&&(r.userData.data=n,r.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(Pt.SWITCH_FLOOR_AFTER,this.onSwitchFloor),Array.from(((t=this.bmap.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).forEach(e=>{if(e.userData.type==="equipment"){var n;(n=this.bmap.context.currentFloor)==null||n.poiLayer.removePoi(e)}})}constructor(t){super(t),this.equipmentList=[],this.equipmentMap=new Map,this.onSwitchFloor=e=>{let{data:{graphics:n}}=e;this.equipmentList.length&&this.changeGraphicToEquipment(n)},this.fetchEquipment(),this.bmap.addEventListener(Pt.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var YL=f(Tr(),1),IL=f(Ze(),1),XL=f(I(),1),DL=f(qh(),1);var JB=f(I(),1),BB=f(C(),1),lt=require("three");var XB=f(eh(),1),DB=f(Kr(),1),ZB=f(_r(),1),vB=f(Or(),1),xB=f(Fr(),1),EB=f(zr(),1),KB=f(Ur(),1),_B=f(Nr(),1),CB=f(Gr(),1),OB=f(kr(),1),FB=f(Vr(),1),zB=f(Jr(),1),RB=f(Br(),1),UB=f(Qr(),1),NB=f(Hr(),1),GB=f(C(),1),kB=f(zh(),1),Y=require("three"),Yt=class extends Y.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 Y.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}})}};Yt.prototype.setMatrixWorld=function(i){this.matrixWorld=i};Yt.prototype.setGeometry=function(i,t){this._geometry=i,this.setPoints(i.getAttribute("position").array,t)};Yt.prototype.setPoints=function(i,t){if(!(i instanceof Float32Array)&&!(i instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=i,this.widthCallback=t,this.positions=[],this.counters=[],i.length&&i[0]instanceof Y.Vector3)for(var e=0;e<i.length;e++){var n=i[e],r=e/i.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(r),this.counters.push(r)}else for(var e=0;e<i.length;e+=3){var r=e/i.length;this.positions.push(i[e],i[e+1],i[e+2]),this.positions.push(i[e],i[e+1],i[e+2]),this.counters.push(r),this.counters.push(r)}this.process()};function a3(i,t){var e=new Y.Matrix4,n=new Y.Ray,r=new Y.Sphere,o=new Y.Vector3,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(this.matrixWorld),i.ray.intersectSphere(r,o)!==!1){e.copy(this.matrixWorld).invert(),n.copy(i.ray).applyMatrix4(e);var a=new Y.Vector3,l=new Y.Vector3,u=new Y.Vector3,h=this instanceof Y.LineSegments?2:1,c=s.index,p=s.attributes;if(c!==null)for(var m=c.array,y=p.position.array,M=p.width.array,j=0,A=m.length-1;j<A;j+=h){var W=m[j],X=m[j+1];a.fromArray(y,W*3),l.fromArray(y,X*3);var v=M[Math.floor(j/3)]!==void 0?M[Math.floor(j/3)]:1,Z=i.params.Line.threshold+this.material.lineWidth*v/2,R=Z*Z,b=n.distanceSqToSegment(a,l,o,u);if(!(b>R)){o.applyMatrix4(this.matrixWorld);var B=i.ray.origin.distanceTo(o);B<i.near||B>i.far||(t.push({distance:B,point:u.clone().applyMatrix4(this.matrixWorld),index:j,face:null,faceIndex:null,object:this}),j=A)}}}}Yt.prototype.raycast=a3;Yt.prototype.compareV3=function(i,t){var e=i*6,n=t*6;return this.positions[e]===this.positions[n]&&this.positions[e+1]===this.positions[n+1]&&this.positions[e+2]===this.positions[n+2]};Yt.prototype.copyV3=function(i){var t=i*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};Yt.prototype.getDistance=function(i){let t=0;for(let e=0;e<i;e++){let n=6*e,r=new Y.Vector3(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new Y.Vector3(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=r.distanceTo(o);t+=s}return t};Yt.prototype.process=function(){var i=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(i-1);var n;this.compareV3(0,i-1)?n=this.copyV3(i-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 r=0;r<i;r++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(r/(i-1)):t=1,this.width.push(t),this.width.push(t),r===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(r===i-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(r)/e;this.uvs.push(s,0),this.uvs.push(s,1)}if(r<i-1){n=this.copyV3(r),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var o=r*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}r>0&&(n=this.copyV3(r),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(i-1,0)?n=this.copyV3(1):n=this.copyV3(i-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 Y.BufferAttribute(new Float32Array(this.positions),3),previous:new Y.BufferAttribute(new Float32Array(this.previous),3),next:new Y.BufferAttribute(new Float32Array(this.next),3),side:new Y.BufferAttribute(new Float32Array(this.side),1),width:new Y.BufferAttribute(new Float32Array(this.width),1),uv:new Y.BufferAttribute(new Float32Array(this.uvs),2),index:new Y.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new Y.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 ic(i,t,e,n,r){var o;if(i=i.subarray||i.slice?i:i.buffer,e=e.subarray||e.slice?e:e.buffer,i=t?i.subarray?i.subarray(t,r&&t+r):i.slice(t,r&&t+r):i,e.set)e.set(i,n);else for(o=0;o<i.length;o++)e[o+n]=i[o];return e}Yt.prototype.advance=function(i){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,r=t.length;ic(t,0,e,0,r),ic(t,6,t,0,r-6),t[r-6]=i.x,t[r-5]=i.y,t[r-4]=i.z,t[r-3]=i.x,t[r-2]=i.y,t[r-1]=i.z,ic(t,6,n,0,r-6),n[r-6]=i.x,n[r-5]=i.y,n[r-4]=i.z,n[r-3]=i.x,n[r-2]=i.y,n[r-1]=i.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};Y.ShaderChunk.meshline_vert=["",Y.ShaderChunk.logdepthbuf_pars_vertex,Y.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;","",Y.ShaderChunk.logdepthbuf_vertex,Y.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",Y.ShaderChunk.fog_vertex,"}"].join(`
107
+ `,n=-1/0,r=this.geometry.getAttribute("position");if(r)for(let s=0;s<r.count;s++){let a=r.getZ(s);a>n&&(n=a)}let o=new at.ShaderMaterial({uniforms:{maxZ:{value:n},uColor:{value:new at.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new at.Color(Ee(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=L.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 at.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(n=>{let{coords:r}=n.geometry;for(let o=0;o<r.length;o++){let s=r[o];for(let a=0;a<s.length;a++){let l=s[a],u=a+1===s.length?s[0]:s[a+1];t.push(new at.Vector3(l[0],l[1],e)),t.push(new at.Vector3(u[0],u[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new at.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new at.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t;this.geometry.dispose(),this.material.dispose(),(t=this.line)==null||t.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>w({},fa,n)),this.init()}};var ft=require("three");var w1=require("lodash");var UC={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1},st=class extends ft.Object3D{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!this.options.icon&&this.options.text?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:.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",t=>g(this,null,function*(){let{value:e}=t;this._initIconPromise&&(yield this._initIconPromise),this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),yield this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-text",t=>{let{value:e}=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-text_font_size",t=>{let{value:e}=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",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this.spriteIcon&&this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return g(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>g(this,null,function*(){let e=yield Fe.getTextureByUrl(this.options.icon),n=new ft.Sprite(new ft.SpriteMaterial({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI}));n.visible=!1,n.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(n),this.spriteIcon=n,t(n)})).then(()=>{this._initIconPromise=null})})}initText(){if(this.options.text){let t=Ut.getTextureByText(this.options.text);this.textAspect=t.image.width/t.image.height;let e=new ft.Sprite(new ft.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}}initSize(){var t,e;let n=0,r=0,{icon:o,text:s}=this.options;o?s?(n=0,r=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,r=0):s?(r=.5,n=0):(n=0,r=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,r)}init(){return g(this,null,function*(){yield this.initIcon(),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:e,height:n}}=this.context,r=e*(t.x+1)/2,o=n*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let s=this.iconWidth/2,a=new ft.Box2(new ft.Vector2(r-s,o-this.iconHeight),new ft.Vector2(r+s,o)),l=this.textWidth/2,u=new ft.Box2(new ft.Vector2(r-l,o-this.textHeight-this.durIconAndText-this.iconHeight),new ft.Vector2(r+l,o-this.iconHeight-this.durIconAndText));return this.box=u.union(a),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let n=document.createElement("div");n.style.position="absolute",n.style.zIndex="999",n.style.border="1px solid red",n.style.pointerEvents="none",this.boxHelper=n,this.context.container.appendChild(n)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(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.clear(),this.unRegistryEvent(),this.spriteText=void 0,this.spriteIcon=void 0}constructor(t,e){super(),this.context=t,this.textAspect=1,this.box=new ft.Box2,this._initIconPromise=null,this._initScale=n=>{let{zoom:r}=n;if(this.spriteText){let s=this.textHeight/r;this.spriteText.scale.set(this.textAspect*s,s,.1)}if(this.spriteIcon){var o;(o=this.spriteIcon)==null||o.scale.set(this.options.icon_size[0]/r,this.options.icon_size[1]/r,.1)}this.resetZ()},this.options=Fn((0,w1.cloneDeep)(w({},UC,e)),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};var kt=require("three"),W1=require("three/examples/jsm/utils/BufferGeometryUtils");var S1={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},go=class extends kt.Object3D{init(){return g(this,null,function*(){let t=this.options.map(s=>Ut.getTextureByText(s.texts[0],{fillStyle:As(s.fillColor,s.fillOpacity),strokeStyle:As(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"54px sans-serif"})),e=t.map((s,a)=>{let l=this.options[a],{width:u,height:h}=s.image,c=u/h,p=l.secondHeight*c,m=new kt.PlaneGeometry(p,l.secondHeight),y=new kt.Matrix4().makeTranslation(l.center_x,l.center_y,l.airHeight+l.deltaHeight+l.height).multiply(new kt.Matrix4().makeRotationZ(l.secondRotate));return m.applyMatrix4(y),m}),n=(0,W1.mergeGeometries)(e,!0);e.forEach(s=>s.dispose());let r=t.map(s=>{let a=new kt.MeshBasicMaterial({map:s,alphaTest:1,side:kt.DoubleSide});return s.needsUpdate=!0,a}),o=new kt.Mesh(n,r);this.mesh=o,this.position.z+=.04,this.add(o)})}dispose(){var t,e;(t=this.mesh)==null||t.geometry.dispose(),((e=this.mesh)==null?void 0:e.material).forEach(n=>n.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>w({},S1,n)),this.init()}};var b1=require("three"),Aa=class extends Gt{setEnable(t){super.setEnable(t),yt(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:n,clientHeight:r}}}=this,o=D(this.startPoint,e,n,r),s=D(this.endPoint,e,n,r),a={x:Math.min(o.x,s.x),y:Math.min(o.y,s.y)},l={x:Math.max(o.x,s.x),y:Math.max(o.y,s.y)},u=this.searchMapInFrustum(a,l);this.dispatchEvent({type:"selected",list:u})}}searchMapInFrustum(t,e){var n;let{context:r}=this;return((n=r.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof tt&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:r,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let m=D(p,r,o,s);return Qe(m,e,n)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let a=t.mesh.geometry.boundingBox;if(!a)return!1;let{min:l,max:u}=a,h=D(l,r,o,s),c=D(u,r,o,s);return!(!Qe(h,e,n)||!Qe(c,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new b1.Frustum,this.onPointerDown=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=r=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o)},this.onPointerUp=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let r=this.getSvgCoordinate(this.startPoint),o=w({},r);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(r.x,o.x),y:Math.min(r.y,o.y)},a=Math.abs(o.x-r.x),l=Math.abs(o.y-r.y);yt(this.rect,s.x,s.y,a,l)}else yt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=He(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var Ao=class extends Y1.EventDispatcher{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)}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()}constructor(t){super(),this.context=t,this._list=new Set,this.downPoint=null,this.downTime=0,this.isMultipleSelect=!1,this.onPointerDown=e=>{Date.now()-this.downTime<200||(this.downPoint={x:e.offsetX,y:e.offsetY},this.downTime=Date.now())},this.onPointerUp=e=>{if(!this.downPoint)return;let{offsetX:n,offsetY:r}=e,{x:o,y:s}=this.downPoint;if(Math.sqrt((o-n)**2+(s-r)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(n,r),l=new Set(a.map(h=>h.options.id));this.context.getPoisByDeviceXy(n,r).forEach(h=>{if(!l.has(h.options.id)){var c;let p=((c=this.context.currentFloor)==null?void 0:c.graphicLayer.graphicMap.get(h.options.id))||null;p&&p.options.geometry.type==="point"&&(a.push(p),l.add(h.options.id))}}),(Rn?e.metaKey:e.ctrlKey)||this._list.clear(),a.forEach(h=>this._list.add(h)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{Un(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Un(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:n}=e;this._list.clear(),n.forEach(r=>{this._list.add(r)}),this.selectEnd()},this.boxSelection=new Aa(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var M7=f(We(),1),j7=f(Se(),1),g7=f(be(),1),A7=f(Ye(),1),T7=f(Ie(),1),w7=f(Xe(),1),W7=f(De(),1),S7=f(I(),1);var Ta=require("three");var To=class extends Ta.EventDispatcher{handleHoverGraphicsChange(t){t===void 0&&(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()}constructor(t){super(),this.context=t,this.curGraphics=new Set,this.timer=new nt,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:n,pois:r,e:o}=e,s=r.map(h=>{var c;return(c=this.context.currentFloor)==null?void 0:c.graphicLayer.graphicMap.get(h.options.id)}).filter(h=>h&&h.options.geometry.type==="point");if(!n.length&&!s.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:a}=this.context.config.hover,l=new Set;if(s.length){let h,c=1e4;s.forEach(p=>{let m=r.find(y=>y.options.id===p.options.id);if(m instanceof Xn){let{x:y,y:M}=m.clientPos,j=Math.sqrt((y-o.offsetX)**2+(M-o.offsetY)**2);j<c&&(c=j,h=p)}else if(m instanceof st){let{x:y,y:M}=m.box.getCenter(new Ta.Vector2),j=Math.sqrt((y-o.offsetX)**2+(M-o.offsetY)**2);j<c&&(c=j,h=p)}}),l.add(h)}l.size||n.forEach(h=>l.add(h)),l.forEach(h=>{if(this.graphicTimerMap.get(h)||this.curGraphics.has(h))return;let c=this.timer.setTimeout(()=>{this.curGraphics.add(h),this.graphicTimerMap.delete(h),this.timer.clearTimeout(c),this.handleHoverGraphicsChange()},a);this.graphicTimerMap.set(h,c)}),this.graphicTimerMap.forEach((h,c)=>{l.has(c)||(this.timer.clearTimeout(h),this.graphicTimerMap.delete(c))});let u=this.curGraphics.size;this.curGraphics.forEach(h=>{l.has(h)||this.curGraphics.delete(h)}),u!==this.curGraphics.size&&this.handleHoverGraphicsChange()},this.onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()},this.onBodyPointerMove=e=>{if(this.curGraphics.size){let n=this.context.container.getBoundingClientRect();(e.clientX<n.left||e.clientX>n.right||e.clientY<n.top||e.clientY>n.bottom)&&this.onPointerLevel()}},this.registryEvent()}};var X7=f(I(),1),ri=require("three");var wa=class{updateBox(){this.box.setFromObject(this.context.scene)}setEnable(t){this.enable=t,t?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(j=>j instanceof Nt).length)return null;let e=this.box,{camera:n,clientSize:{width:r,height:o}}=this.context,{min:s,max:a}=e,l=D(s,n,r,o),u=D(a,n,r,o),h=D(new ri.Vector3(s.x,a.y,a.z),n,r,o),c=D(new ri.Vector3(a.x,s.y,s.z),n,r,o),p=Math.min(l.x,u.x,h.x,c.x),m=Math.max(l.x,u.x,h.x,c.x),y=Math.min(l.y,u.y,h.y,c.y),M=Math.max(l.y,u.y,h.y,c.y);return{left:p,right:m,top:y,bottom:M}}checkDistanceToScreenEdge(t){let{left:e,right:n,top:r,bottom:o}=t,{width:s,height:a}=this.context.clientSize,[l,u,h,c]=this.context.config.cameraBound.padding,p=n>=c,m=s-e>=u,y=a-r>=h,M=o>=l;return p&&m&&y&&M}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new ri.Vector3,zoom:1,target:new ri.Vector3},this.enable=!0,this.box=new ri.Box3,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:n,right:r,top:o,bottom:s}=e;this.checkDistanceToScreenEdge({left:n,right:r,top:o,bottom:s})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var U7=f(qh(),1),$h=require("three"),oi=require("@tweenjs/tween.js");var F7=f(I(),1),z7=f(C(),1),S=require("three"),Sa=new S.Ray,R1=new S.Plane,o3=Math.cos(70*S.MathUtils.DEG2RAD),ba=class extends S.EventDispatcher{dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerUp),this.domElement.removeEventListener("wheel",this.onMouseWheel),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp),this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null)}constructor(t,e){super(),this.rotateLineStart=new S.Vector2,this.rotateLineEnd=new S.Vector2,this.spherical=new S.Spherical,this.sphericalDelta=new S.Spherical,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new S.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.screenSpacePanning=!1,this.mouseButtons={LEFT:S.MOUSE.PAN,MIDDLE:S.MOUSE.DOLLY,RIGHT:S.MOUSE.ROTATE},this.touches={ONE:S.TOUCH.PAN,TWO:S.TOUCH.DOLLY_ROTATE},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(P){P.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=P},this.stopListenToKeyEvents=function(){var P;(P=this._domElementKeyEvents)==null||P.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent({type:"change"}),n.update(),o=r.NONE},this.update=function(){let P=new S.Vector3,T=new S.Quaternion().setFromUnitVectors(t.up,new S.Vector3(0,1,0)),N=T.clone().invert(),H=new S.Vector3,Kt=new S.Quaternion,Ae=new S.Vector3,se=2*Math.PI;return function(Qi){Qi===void 0&&(Qi=null);let Ge=n.object.position;P.copy(Ge).sub(n.target),P.applyQuaternion(T),a.setFromVector3(P),n.autoRotate&&o===r.NONE&&Ue(Ji(Qi)),n.enableDamping?(a.theta+=l.theta*n.dampingFactor,a.phi+=l.phi*n.dampingFactor):(a.theta+=l.theta,a.phi+=l.phi);let ke=n.minAzimuthAngle,Ve=n.maxAzimuthAngle;isFinite(ke)&&isFinite(Ve)&&(ke<-Math.PI?ke+=se:ke>Math.PI&&(ke-=se),Ve<-Math.PI?Ve+=se:Ve>Math.PI&&(Ve-=se),ke<=Ve?a.theta=Math.max(ke,Math.min(Ve,a.theta)):a.theta=a.theta>(ke+Ve)/2?Math.max(ke,a.theta):Math.min(Ve,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(h,n.dampingFactor):n.target.add(h),n.zoomToCursor&&R||n.object.isOrthographicCamera?a.radius=Et(a.radius):a.radius=Et(a.radius*u),P.setFromSpherical(a),P.applyQuaternion(N),Ge.copy(n.target).add(P),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,h.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),h.set(0,0,0));let Xo=!1;if(n.zoomToCursor&&R){let Hi=null;if(n.object.isPerspectiveCamera){let qi=P.length();Hi=Et(qi*u);let Do=qi-Hi;n.object.position.addScaledVector(v,Do),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let qi=new S.Vector3(Z.x,Z.y,0);qi.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/u)),n.object.updateProjectionMatrix(),Xo=!0;let Do=new S.Vector3(Z.x,Z.y,0);Do.unproject(n.object),n.object.position.sub(Do).add(qi),n.object.updateMatrixWorld(),Hi=P.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Hi!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Hi).add(n.object.position):(Sa.origin.copy(n.object.position),Sa.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Sa.direction))<o3?t.lookAt(n.target):(R1.setFromNormalAndCoplanarPoint(n.object.up,n.target),Sa.intersectPlane(R1,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/u)),n.object.updateProjectionMatrix(),Xo=!0);return u=1,R=!1,Xo||H.distanceToSquared(n.object.position)>s||8*(1-Kt.dot(n.object.quaternion))>s||Ae.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),H.copy(n.object.position),Kt.copy(n.object.quaternion),Ae.copy(n.target),Xo=!1,!0):!1}}();let n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=r.NONE,s=1e-6,a=new S.Spherical,l=new S.Spherical,u=1,h=new S.Vector3,c=new S.Vector2,p=new S.Vector2,m=new S.Vector2,y=new S.Vector2,M=new S.Vector2,j=new S.Vector2,A=new S.Vector2,W=new S.Vector2,X=new S.Vector2,v=new S.Vector3,Z=new S.Vector2,R=!1,b=[],B={};function Ji(P){return P!==null?2*Math.PI/60*n.autoRotateSpeed*P:2*Math.PI/60/60*n.autoRotateSpeed}function li(){return Math.pow(.95,n.zoomSpeed)}function Ue(P){l.theta-=P}function an(P){l.phi-=P}let ui=function(){let P=new S.Vector3;return function(N,H){P.setFromMatrixColumn(H,0),P.multiplyScalar(-N),h.add(P)}}(),xn=function(){let P=new S.Vector3;return function(N,H){n.screenSpacePanning===!0?P.setFromMatrixColumn(H,1):(P.setFromMatrixColumn(H,0),P.crossVectors(n.object.up,P)),P.multiplyScalar(N),h.add(P)}}(),Ne=function(){let P=new S.Vector3;return function(N,H){let Kt=n.domElement;if(n.object.isPerspectiveCamera){let Ae=n.object.position;P.copy(Ae).sub(n.target);let se=P.length();se*=Math.tan(n.object.fov/2*Math.PI/180),ui(2*N*se/Kt.clientHeight,n.object.matrix),xn(2*H*se/Kt.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(ui(N*(n.object.right-n.object.left)/n.object.zoom/Kt.clientWidth,n.object.matrix),xn(H*(n.object.top-n.object.bottom)/n.object.zoom/Kt.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function hi(P){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?u/=P:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Bi(P){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?u*=P:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Li(P){if(!n.zoomToCursor)return;R=!0;let T=n.domElement.getBoundingClientRect(),N=P.clientX-T.left,H=P.clientY-T.top,Kt=T.width,Ae=T.height;Z.x=N/Kt*2-1,Z.y=-(H/Ae)*2+1,v.set(Z.x,Z.y,1).unproject(n.object).sub(n.object.position).normalize()}function Et(P){return Math.max(n.minDistance,Math.min(n.maxDistance,P))}function Sc(P){c.set(P.clientX,P.clientY)}function fT(P){Li(P),A.set(P.clientX,P.clientY)}function bc(P){y.set(P.clientX,P.clientY)}function mT(P){p.set(P.clientX,P.clientY),m.subVectors(p,c).multiplyScalar(n.rotateSpeed);let T=n.domElement;Ue(2*Math.PI*m.x/T.clientHeight),an(2*Math.PI*m.y/T.clientHeight),c.copy(p),n.update()}function yT(P){W.set(P.clientX,P.clientY),X.subVectors(W,A),X.y>0?hi(li()):X.y<0&&Bi(li()),A.copy(W),n.update()}function PT(P){M.set(P.clientX,P.clientY),j.subVectors(M,y).multiplyScalar(n.panSpeed),Ne(j.x,j.y),y.copy(M),n.update()}function MT(P){Li(P),P.deltaY<0?Bi(li()):P.deltaY>0&&hi(li()),n.update()}function jT(P){let T=!1;switch(P.code){case n.keys.UP:P.ctrlKey||P.metaKey||P.shiftKey?an(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ne(0,n.keyPanSpeed),T=!0;break;case n.keys.BOTTOM:P.ctrlKey||P.metaKey||P.shiftKey?an(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ne(0,-n.keyPanSpeed),T=!0;break;case n.keys.LEFT:P.ctrlKey||P.metaKey||P.shiftKey?Ue(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ne(n.keyPanSpeed,0),T=!0;break;case n.keys.RIGHT:P.ctrlKey||P.metaKey||P.shiftKey?Ue(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ne(-n.keyPanSpeed,0),T=!0;break}T&&(P.preventDefault(),n.update())}function Yc(){if(b.length===1)c.set(b[0].pageX,b[0].pageY);else{let P=(b[0].pageX-b[0].pageY)/(b[1].pageX-b[1].pageY),T=b[0].pageY-P*b[0].pageX;n.rotateLineStart.set(P,T);let N=.5*(b[0].pageX+b[1].pageX),H=.5*(b[0].pageY+b[1].pageY);c.set(N,H)}}function Ic(){if(b.length===1)y.set(b[0].pageX,b[0].pageY);else{let P=.5*(b[0].pageX+b[1].pageX),T=.5*(b[0].pageY+b[1].pageY);y.set(P,T)}}function Xc(){let P=b[0].pageX-b[1].pageX,T=b[0].pageY-b[1].pageY,N=Math.sqrt(P*P+T*T);A.set(0,N)}function gT(){n.enableZoom&&Xc(),n.enablePan&&Ic()}function AT(){n.enableZoom&&Xc(),n.enableRotate&&Yc()}function Dc(P){if(b.length==1)p.set(P.pageX,P.pageY);else{let N=Ba(P),H=.5*(P.pageX+N.x),Kt=.5*(P.pageY+N.y);p.set(H,Kt);let Ae=(P.pageY-N.y)/(P.pageX-N.x),se=N.y-Ae*N.x;if(n.rotateLineEnd.set(Ae,se),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let La=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),Qi=Ae*La+se;if(Number.isFinite(La)&&Number.isFinite(Qi)){let Ge=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(Ge)<.5&&(Ge=-Math.sign(Ge)*(Math.PI-Math.abs(Ge))),Math.abs(Ge)<.1&&(l.theta+=Ge)}}n.rotateLineStart.copy(n.rotateLineEnd)}m.subVectors(p,c).multiplyScalar(n.rotateSpeed);let T=n.domElement;an(2*Math.PI*m.y/T.clientHeight),c.copy(p)}function Zc(P){if(b.length===1)M.set(P.pageX,P.pageY);else{let T=Ba(P),N=.5*(P.pageX+T.x),H=.5*(P.pageY+T.y);M.set(N,H)}j.subVectors(M,y).multiplyScalar(n.panSpeed),Ne(j.x,j.y),y.copy(M)}function vc(P){let T=Ba(P),N=P.pageX-T.x,H=P.pageY-T.y,Kt=Math.sqrt(N*N+H*H);W.set(0,Kt),X.set(0,Math.pow(W.y/A.y,n.zoomSpeed)),hi(X.y),A.copy(W)}function TT(P){n.enableZoom&&vc(P),n.enablePan&&Zc(P)}function wT(P){n.enableZoom&&vc(P),n.enableRotate&&Dc(P)}this.onPointerDown=function(T){n.enabled!==!1&&(b.length===0&&(n.domElement.setPointerCapture(T.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),IT(T),T.pointerType==="touch"?bT(T):WT(T))},this.onPointerMove=function(T){n.enabled!==!1&&(T.pointerType==="touch"?YT(T):ST(T))},this.onPointerUp=function(T){XT(T),b.length===0&&(n.domElement.releasePointerCapture(T.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=r.NONE};function WT(P){let T;switch(P.button){case 0:T=n.mouseButtons.LEFT;break;case 1:T=n.mouseButtons.MIDDLE;break;case 2:T=n.mouseButtons.RIGHT;break;default:T=-1}switch(T){case S.MOUSE.DOLLY:if(n.enableZoom===!1)return;fT(P),o=r.DOLLY;break;case S.MOUSE.ROTATE:if(P.ctrlKey||P.metaKey||P.shiftKey){if(n.enablePan===!1)return;bc(P),o=r.PAN}else{if(n.enableRotate===!1)return;Sc(P),o=r.ROTATE}break;case S.MOUSE.PAN:if(P.ctrlKey||P.metaKey||P.shiftKey){if(n.enableRotate===!1)return;Sc(P),o=r.ROTATE}else{if(n.enablePan===!1)return;bc(P),o=r.PAN}break;default:o=r.NONE}o!==r.NONE&&n.dispatchEvent({type:"start"})}function ST(P){switch(o){case r.ROTATE:if(n.enableRotate===!1)return;mT(P);break;case r.DOLLY:if(n.enableZoom===!1)return;yT(P);break;case r.PAN:if(n.enablePan===!1)return;PT(P);break}}this.onMouseWheel=function(T){n.enabled===!1||n.enableZoom===!1||o!==r.NONE||(T.preventDefault(),n.dispatchEvent({type:"start"}),MT(T),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(T){n.enabled===!1||n.enablePan===!1||jT(T)};function bT(P){switch(xc(P),b.length){case 1:switch(n.touches.ONE){case S.TOUCH.ROTATE:if(n.enableRotate===!1)return;Yc(),o=r.TOUCH_ROTATE;break;case S.TOUCH.PAN:if(n.enablePan===!1)return;Ic(),o=r.TOUCH_PAN;break;default:o=r.NONE}break;case 2:switch(n.touches.TWO){case S.TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;gT(),o=r.TOUCH_DOLLY_PAN;break;case S.TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;AT(),o=r.TOUCH_DOLLY_ROTATE;break;default:o=r.NONE}break;default:o=r.NONE}o!==r.NONE&&n.dispatchEvent({type:"start"})}function YT(P){switch(xc(P),o){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;Dc(P),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;Zc(P),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;TT(P),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;wT(P),n.update();break;default:o=r.NONE}}this.onContextMenu=function(T){n.enabled!==!1&&T.preventDefault()};function IT(P){b.push(P)}function XT(P){delete B[P.pointerId];for(let T=0;T<b.length;T++)if(b[T].pointerId==P.pointerId){b.splice(T,1);return}}function xc(P){let T=B[P.pointerId];T===void 0&&(T=new S.Vector2,B[P.pointerId]=T),T.set(P.pageX,P.pageY)}function Ba(P){let T=P.pointerId===b[0].pointerId?b[1]:b[0];return B[T.pointerId]}n.domElement.addEventListener("contextmenu",this.onContextMenu),n.domElement.addEventListener("pointerdown",this.onPointerDown),n.domElement.addEventListener("pointercancel",this.onPointerUp),n.domElement.addEventListener("wheel",this.onMouseWheel,{passive:!1}),this.update()}};var Ya=class extends ba{registryEvent(){this.addEventListener("change",this.onChange),this.context.addEventListener("update",this.tweenUpdate)}unRegistryEvent(){this.removeEventListener("change",this.onChange),this.context.removeEventListener("update",this.tweenUpdate)}setPolarAngle(t,e){e===void 0&&(e=!1);let{maxPolarAngle:n,minPolarAngle:r}=this,o=n===r;(e||t<=n&&t>=r)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=n,this.minPolarAngle=r)}setPolarAngleByDuration(t,e,n){return g(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):zt(new Promise(r=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new oi.Tween(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),r(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:n,minAzimuthAngle:r}=this,o=n===r;(e||t<=n&&t>=r)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=n,this.minAzimuthAngle=r)}setAzimuthalAngleDuration(t,e,n){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setAzimuthalAngle(t,e):zt(new Promise(r=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new oi.Tween(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),r(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}getCameraLookAt(){return new $h.Vector3().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return g(this,null,function*(){let n=this.target.clone(),r=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(r)),this.target.copy(t.clone()),this.update();return}return zt(new Promise(o=>{let s=new oi.Tween(n,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(n.clone().sub(r)),this.target.copy(n.clone()),this.update()}).onComplete(()=>{this.tweenGroup.remove(s),this.enabled=!0,o(!0)}).onStart(()=>{this.enabled=!1}).start()}),e+500)})}setZoom(t,e,n){n===void 0&&(n=!1);let{minZoom:r,maxZoom:o}=this;(n||t>=r&&t<=o)&&(this.camera.position.copy(e.clone().sub(this.getCameraLookAt())),this.target.copy(e),this.camera.zoom=t,this.update())}setZoomByDuration(t,e,n,r){return g(this,null,function*(){n===void 0&&(n=!1),r===void 0&&(r=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return r?zt(new Promise(s=>{let a=new oi.Tween(o,this.tweenGroup).to({zoom:t,target:e},r).onUpdate(()=>{this.setZoom(o.zoom,o.target,n)}).onComplete(()=>{this.tweenGroup.remove(a),this.enabled=!0,s(!0)}).onStart(()=>{this.enabled=!1}).start()}),r+500).finally(()=>{this.enabled=!0}):this.setZoom(t,e,n)})}setTargetByOffset(t,e){if(e===void 0&&(e=this.target.clone()),!t)return;this.camera.updateMatrix();let n=new $h.Vector3;n.setFromMatrixColumn(this.camera.matrix,1),n.normalize(),n.multiplyScalar(t/this.camera.zoom),e.add(n),this.setCameraPositionByTarget(e,0)}clearTween(){this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll()}dispose(){super.dispose(),this.unRegistryEvent(),this.clearTween()}constructor(t,e,n){super(e,n),this.context=t,this.camera=e,this.domElement=n,this.prevCameraZoom=1,this.tweenGroup=new oi.Group,this.offsetY=0,this.onChange=()=>{let r=this.camera.zoom;r!==this.prevCameraZoom&&(this.prevCameraZoom=r,this.dispatchEvent({type:"change-zoom",zoom:r}))},this.tweenUpdate=()=>{this.tweenGroup.update()},this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=e.zoom,this.registryEvent()}};var Ri=require("three");var Ia=class extends Ri.WebGLRenderer{setCameraAndScene(t,e){this.scene=t,this.camera=e}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(t,e){this.event.addEventListener(t,e)}removeEventListener(t,e){this.event.removeEventListener(t,e)}dispose(){this.timer.dispose(),this.enable=!1,super.dispose()}constructor(t){super(w({antialias:!0,alpha:!0},t)),this.event=new Ri.EventDispatcher,this.enable=!0,this.timer=new nt,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=Ri.PCFSoftShadowMap}};var vn=require("three"),U1=require("three/examples/jsm/loaders/RGBELoader.js");var Xa=class extends vn.Scene{constructor(){super(),new U1.RGBELoader().load(u1,t=>{t.mapping=vn.EquirectangularReflectionMapping,this.environment=t;let e=new vn.Matrix4;e.makeRotationX(Math.PI/2),this.environmentRotation=new vn.Euler().setFromRotationMatrix(e)})}};var N1=require("three"),Da=class extends N1.OrthographicCamera{constructor(t,e){super(-t/2,t/2,e/2,-e/2,-1e4,5e4),this.up.set(0,0,1),this.position.set(0,0,100),this.lookAt(0,0,0)}};var wo=class extends z.EventDispatcher{resizeClientSize(){let{x:t,y:e,width:n,height:r}=this.container.getBoundingClientRect();this.clientSize={width:n||this.container.clientWidth,height:r||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new Da(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new Ya(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.onControlChange),this.control.addEventListener("change-zoom",this.onControlChangeZoom),this.renderer.addEventListener("update",this.onRendererUpdate),this.cameraBound=new wa(this)}getRatio(t,e){t===void 0&&(t=new z.Vector3(0,0,0)),e===void 0&&(e=new z.Vector3(100,0,0));let{clientWidth:n,clientHeight:r}=this.container,o=D(t,this.camera,n,r),s=D(e,this.camera,n,r);return Math.ceil(Math.sqrt((s.x-o.x)**2+(s.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof z.AmbientLight&&(e.color=new z.Color(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let e=t.getCenter();e&&(this.lights.position.x=e.x,this.lights.position.y=e.y),this.cameraBound.updateBox()}getGraphicsByDeviceXy(t,e){var n;let r=new z.Vector2;r.x=t/this.clientSize.width*2-1,r.y=e/this.clientSize.height*-2+1;let o=new z.Raycaster;return o.setFromCamera(r,this.camera),o.ray.origin.sub(o.ray.direction.clone().multiplyScalar(100)),((n=this.currentFloor)==null?void 0:n.graphicLayer.getGraphicByRaycaster(o))||{graphics:[],position:null}}getPoisByDeviceXy(t,e){var n,r;let o=(n=this.currentFloor)==null?void 0:n.poiLayer.getPoiByDeviceXy(t,e),s=(r=this.currentFloor)==null?void 0:r.poiLayer2.getPoiByDeviceXy(t,e);return(o||[]).concat(s||[])}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),this.control.removeEventListener("change",this.onControlChange),this.control.removeEventListener("change-zoom",this.onControlChangeZoom),this.renderer.removeEventListener("update",this.onRendererUpdate)}setPolarAngle(t,e){return e===void 0&&(e=500),this.control.setPolarAngleByDuration(t,!0,e)}setAzimuthalAngle(t,e){return e===void 0&&(e=500),this.control.setAzimuthalAngleDuration(t,!0,e)}getCameraLookAt(){return this.control.getCameraLookAt()}setZoom(t,e,n){return n===void 0&&(n=500),this.control.setZoomByDuration(t,e,!0,n)}getFitCameraToObjectZoom(t,e,n,r){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),r===void 0&&(r=!0);let[o,s,a,l]=e,{clientSize:{width:u,height:h}}=this,c=this.control.getPolarAngle();r&&this.setPolarAngle(0,0);let p=new z.Box3().setFromObject(t);this.setPolarAngle(c,0);let{max:m,min:y}=p,M=new z.Vector3(y.x,m.y,m.z),j=new z.Vector3(m.x,m.y,m.z),A=new z.Vector3(m.x,y.y,y.z),W=new z.Vector3(y.x,y.y,y.z),X=D(M,this.camera,u,h),v=D(j,this.camera,u,h),Z=D(W,this.camera,u,h),R=D(A,this.camera,u,h),B=new z.Box2().setFromPoints([new z.Vector2(X.x,X.y),new z.Vector2(v.x,v.y),new z.Vector2(Z.x,Z.y),new z.Vector2(R.x,R.y)]).getSize(new z.Vector2),Ji=(u-s-l)/B.x,li=(h-o-a)/B.y,Ue=Math.min(Ji,li),an=new z.Vector3((m.x+y.x)/2,(m.y+y.y)/2,(m.z+y.z)/2),ui=Ue*this.camera.zoom,xn=this.camera.clone();xn.zoom=ui,xn.updateMatrix();let Ne=(u-B.x*Ue)/2,hi=(h-B.y*Ue)/2,Bi=Ne<s||Ne<l?(s-l)/2:0,Li=hi<o||hi<a?(o-a)/2:0;if(Bi){let Et=new z.Vector3;Et.setFromMatrixColumn(xn.matrix,0),Et.normalize(),Et.multiplyScalar(Bi/ui),an.add(Et)}if(Li){let Et=new z.Vector3;Et.setFromMatrixColumn(xn.matrix,1),Et.normalize(),Et.multiplyScalar(Li/ui),an.add(Et)}return{zoom:Ue*this.camera.zoom,center:an}}fitCameraToObject(t,e,n,r){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),r===void 0&&(r=!0);let{zoom:o,center:s}=this.getFitCameraToObjectZoom(t,e,n,r);return this.setZoom(o,s,n)}getFitCameraToGroundZoom(t,e,n){if(t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),n===void 0&&(n=!0),this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,e,n).zoom}fitCameraToGround(t,e,n){return t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),n===void 0&&(n=!0),this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundLayer,t,e,n):Promise.resolve(!1)}setCameraPosition(t,e){return g(this,null,function*(){return this.control.setCameraPositionByTarget(t,e)})}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}dispose(){var t;(t=this.currentFloor)==null||t.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(e=>e.dispose()),it(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new Xa,this.renderer=new Ia,this.lights=$0(),this.clientSize={width:0,height:0,x:0,y:0},this.renderRf=0,this.onControlChange=()=>{this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})},this.onControlChangeZoom=n=>{let{zoom:r}=n;this.dispatchEvent({type:"control-zoom-change",zoom:r})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:n,camera:r,renderer:o}=this,{clientWidth:s,clientHeight:a}=n;s=Math.max(1,s),a=Math.max(1,a),r.left=-s/2,r.right=s/2,r.top=a/2,r.bottom=-a/2,r.updateProjectionMatrix(),o.setSize(s,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:s,height:a})},this.onClick=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY);r.length&&this.dispatchEvent({type:"graphic-click",graphics:r,position:o});let s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);s.length&&this.dispatchEvent({type:"poi-click",pois:s})},this.onPointerover=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:r,pois:s,position:o})},this.onPointermove=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:r,pois:s,position:o})},this.onPointerleave=n=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=n=>{let{graphics:r,isMultipleSelect:o}=n;this.dispatchEvent({type:"select-graphic",graphics:r,isMultipleSelect:o})},this.onHoverChange=n=>{let{graphics:r}=n;this.dispatchEvent({type:"hover",graphics:r})},this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new Ao(this),this.hoverHelper=new To(this),this.resizeClientSize(),this.registryEvent()}};var G1=require("lodash"),k1={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 tc(i){return(0,G1.merge)({},k1,i)}var V1=require("lodash");var s3=function(i){return i[i.D2=0]="D2",i[i.D3=1.1]="D3",i}({}),ec=class extends Za.EventDispatcher{changeBuildingCenter(t,e){let{brand:n,project:r}=e,o=t?Mr(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:r,brand:n})}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloorByFloor(t,e){e===void 0&&(e=t.graphicLayer.children),this.triggerHooks(Pt.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(Pt.SWITCH_FLOOR_AFTER,{curFloor:t,graphics:e})}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(this.config.defaultPadding,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()}addModel(t,e){if(t.options.geometry.type==="polygon"){var n;let r=(n=this.context.currentFloor)==null?void 0:n.addModel(w({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(r){let{facilityAngle:o=0,facilityXScale:s=1,facilityYScale:a=1}=t.options.userData;r.rotateZ((180-o)/180*Math.PI),r.scale.set(s,a,1)}}}addHeatmap(t){var e;return(e=this.context.currentFloor)==null?void 0:e.addHeatmap(t)}getLegacyToGraphicMap(){var t;return((t=this.context.currentFloor)==null?void 0:t.userData.legacyToGraphicMap)||new Map}getFloorAllGraphics(){var t;return((t=this.context.currentFloor)==null?void 0:t.graphicLayer.children.filter(e=>e instanceof tt))||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let n=t.options.center,r=t.getCenter(),o=(n==null?void 0:n[0])||r.x,s=(n==null?void 0:n[1])||r.y;return console.log(o,s,n,r),this.context.currentFloor.addPoi(w({},e,{position:{x:o,y:s,z:r.z+t.options.height/2}}))}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e){e===void 0&&(e=500);let n=t.getPosition();return this.context.setCameraPosition(n,e)}translateElementToCenterX(t,e){return g(this,null,function*(){return e===void 0&&(e=500),zt(new Promise(n=>{let r=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:s,height:a},camera:l}=this.context,h=D(o,l,s,a).x-s/2,c=new Za.Vector3;c.setFromMatrixColumn(this.context.camera.matrix,0),c.normalize(),c.multiplyScalar(h/this.context.camera.zoom),r.add(c),this.context.setCameraPosition(r,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:r}=this.container;return D(e,this.context.camera,n,r)}changeMapType(t,e){return e===void 0&&(e=500),this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}resetView(t){return g(this,null,function*(){t===void 0&&(t=300);let e=t/3;yield this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),yield this.context.setPolarAngle(this.config.control.defaultPolar,e),yield this.context.fitCameraToGround(this.config.defaultPadding,e,!1)})}reduceMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver(this.debounceResize);t.observe(this.container),this.observe=t}}unRegistryEvent(){var t;this.context.control.removeEventListener("change",this.onControlChange),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),(t=this.observe)==null||t.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t){t===void 0&&(t=.1);let e=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(e+t,500)}measureDistance(){return g(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new mo(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",r=>{let{distance:o}=r;t(o)})})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new yo(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",r=>{let{area:o}=r;t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}getGraphicByNodeId(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.graphicLayer.getGraphicByNodeId(t))||((n=this.context.currentFloor)==null?void 0:n.parkingSpaceLayer.graphicMap.get(t))||null}deleteGraphic(t){var e;(e=this.context.currentFloor)==null||e.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){var e;if(!t.transformToBuildingGround&&this.currentBuildGround){let n=Mr(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(r=>{Array.isArray(r)&&r.forEach(o=>{o[0]-=n[0],o[1]-=n[1]})});else{let[r,o]=t.geometry.cds;t.geometry.coords=[r-n[0],o-n[1]]}}return(e=this.context.currentFloor)==null?void 0:e.graphicLayer.createGraphic(t)}removePoiById(t){var e,n;(e=this.context.currentFloor)==null||e.poiLayer.removePoiById(t),(n=this.context.currentFloor)==null||n.poiLayer2.removePoiById(t)}getPoiById(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.poiLayer.getPoiById(t))||((n=this.context.currentFloor)==null?void 0:n.poiLayer2.getPoiById(t))}getPois(){var t,e;return[...(((t=this.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).filter(n=>!n.options.built_in),...((e=this.context.currentFloor)==null?void 0:e.poiLayer2.pois)||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}dispose(){this.unRegistryEvent(),this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.plugins=[],this.context.dispose(),this.context=null,this.container=null,Ut.dispose(),Fe.dispose(),jn.dispose(),Dt.dispose(),L.dispose(),this.debounceResize=null}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.basicZoom=1,this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new nt,this.plugins=[],this.onControlChange=()=>{let{camera:{zoom:n}}=this.context;n!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=n)},this.onKeydown=n=>{this.polarKeys.includes(n.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(n.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=n=>{if(this.polarKeys.includes(n.code)){let r=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=r,this.context.control.minPolarAngle=r}if(this.azimuthalKeys.includes(n.code)){let r=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=r,this.context.control.minAzimuthAngle=r}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),r=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 o=this.context.getFitCameraToGroundZoom(void 0,0)||1;this.context.camera.zoom=r,this.context.control.minZoom=o,this.context.control.maxZoom=o*25,this.basicZoom=r,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=tc(e),this.context=new wo(t,this.config),this.debounceResize=(0,V1.debounce)(this.resize,30),this.registryEvent()}};var WB=f(I(),1);var J1=require("three"),vt=class extends J1.EventDispatcher{dispose(){this.bmap=null}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var nc=class extends vt{fetchEquipment(){return g(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,r=""+t+e;yield fetch(r,n).then(o=>o.json()).then(o=>o.data).then(o=>{this.equipmentList=o,this.equipmentMap=new Map(o.map(s=>[s.equipment_id,s]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)})}getGraphicEquipment(t){return t.userData.data.info.userData.equipment}changeGraphicToEquipment(t){t.filter(e=>{let n=this.getGraphicEquipment(e);return n&&this.equipmentMap.has(n)}).forEach(e=>{let n=this.equipmentMap.get(this.getGraphicEquipment(e)),r=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});r&&(r.userData.data=n,r.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(Pt.SWITCH_FLOOR_AFTER,this.onSwitchFloor),Array.from(((t=this.bmap.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).forEach(e=>{if(e.userData.type==="equipment"){var n;(n=this.bmap.context.currentFloor)==null||n.poiLayer.removePoi(e)}}),super.dispose()}constructor(t){super(t),this.equipmentList=[],this.equipmentMap=new Map,this.onSwitchFloor=e=>{let{data:{graphics:n}}=e;this.equipmentList.length&&this.changeGraphicToEquipment(n)},this.fetchEquipment(),this.bmap.addEventListener(Pt.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var YL=f(Tr(),1),IL=f(Ze(),1),XL=f(I(),1),DL=f(qh(),1);var JB=f(I(),1),BB=f(C(),1),lt=require("three");var XB=f(eh(),1),DB=f(Kr(),1),ZB=f(_r(),1),vB=f(Or(),1),xB=f(Fr(),1),EB=f(zr(),1),KB=f(Ur(),1),_B=f(Nr(),1),CB=f(Gr(),1),OB=f(kr(),1),FB=f(Vr(),1),zB=f(Jr(),1),RB=f(Br(),1),UB=f(Qr(),1),NB=f(Hr(),1),GB=f(C(),1),kB=f(zh(),1),Y=require("three"),Yt=class extends Y.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 Y.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}})}};Yt.prototype.setMatrixWorld=function(i){this.matrixWorld=i};Yt.prototype.setGeometry=function(i,t){this._geometry=i,this.setPoints(i.getAttribute("position").array,t)};Yt.prototype.setPoints=function(i,t){if(!(i instanceof Float32Array)&&!(i instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=i,this.widthCallback=t,this.positions=[],this.counters=[],i.length&&i[0]instanceof Y.Vector3)for(var e=0;e<i.length;e++){var n=i[e],r=e/i.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(r),this.counters.push(r)}else for(var e=0;e<i.length;e+=3){var r=e/i.length;this.positions.push(i[e],i[e+1],i[e+2]),this.positions.push(i[e],i[e+1],i[e+2]),this.counters.push(r),this.counters.push(r)}this.process()};function a3(i,t){var e=new Y.Matrix4,n=new Y.Ray,r=new Y.Sphere,o=new Y.Vector3,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(this.matrixWorld),i.ray.intersectSphere(r,o)!==!1){e.copy(this.matrixWorld).invert(),n.copy(i.ray).applyMatrix4(e);var a=new Y.Vector3,l=new Y.Vector3,u=new Y.Vector3,h=this instanceof Y.LineSegments?2:1,c=s.index,p=s.attributes;if(c!==null)for(var m=c.array,y=p.position.array,M=p.width.array,j=0,A=m.length-1;j<A;j+=h){var W=m[j],X=m[j+1];a.fromArray(y,W*3),l.fromArray(y,X*3);var v=M[Math.floor(j/3)]!==void 0?M[Math.floor(j/3)]:1,Z=i.params.Line.threshold+this.material.lineWidth*v/2,R=Z*Z,b=n.distanceSqToSegment(a,l,o,u);if(!(b>R)){o.applyMatrix4(this.matrixWorld);var B=i.ray.origin.distanceTo(o);B<i.near||B>i.far||(t.push({distance:B,point:u.clone().applyMatrix4(this.matrixWorld),index:j,face:null,faceIndex:null,object:this}),j=A)}}}}Yt.prototype.raycast=a3;Yt.prototype.compareV3=function(i,t){var e=i*6,n=t*6;return this.positions[e]===this.positions[n]&&this.positions[e+1]===this.positions[n+1]&&this.positions[e+2]===this.positions[n+2]};Yt.prototype.copyV3=function(i){var t=i*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};Yt.prototype.getDistance=function(i){let t=0;for(let e=0;e<i;e++){let n=6*e,r=new Y.Vector3(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new Y.Vector3(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=r.distanceTo(o);t+=s}return t};Yt.prototype.process=function(){var i=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(i-1);var n;this.compareV3(0,i-1)?n=this.copyV3(i-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 r=0;r<i;r++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(r/(i-1)):t=1,this.width.push(t),this.width.push(t),r===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(r===i-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(r)/e;this.uvs.push(s,0),this.uvs.push(s,1)}if(r<i-1){n=this.copyV3(r),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var o=r*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}r>0&&(n=this.copyV3(r),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(i-1,0)?n=this.copyV3(1):n=this.copyV3(i-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 Y.BufferAttribute(new Float32Array(this.positions),3),previous:new Y.BufferAttribute(new Float32Array(this.previous),3),next:new Y.BufferAttribute(new Float32Array(this.next),3),side:new Y.BufferAttribute(new Float32Array(this.side),1),width:new Y.BufferAttribute(new Float32Array(this.width),1),uv:new Y.BufferAttribute(new Float32Array(this.uvs),2),index:new Y.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new Y.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 ic(i,t,e,n,r){var o;if(i=i.subarray||i.slice?i:i.buffer,e=e.subarray||e.slice?e:e.buffer,i=t?i.subarray?i.subarray(t,r&&t+r):i.slice(t,r&&t+r):i,e.set)e.set(i,n);else for(o=0;o<i.length;o++)e[o+n]=i[o];return e}Yt.prototype.advance=function(i){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,r=t.length;ic(t,0,e,0,r),ic(t,6,t,0,r-6),t[r-6]=i.x,t[r-5]=i.y,t[r-4]=i.z,t[r-3]=i.x,t[r-2]=i.y,t[r-1]=i.z,ic(t,6,n,0,r-6),n[r-6]=i.x,n[r-5]=i.y,n[r-4]=i.z,n[r-3]=i.x,n[r-2]=i.y,n[r-1]=i.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};Y.ShaderChunk.meshline_vert=["",Y.ShaderChunk.logdepthbuf_pars_vertex,Y.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;","",Y.ShaderChunk.logdepthbuf_vertex,Y.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",Y.ShaderChunk.fog_vertex,"}"].join(`
108
108
  `);Y.ShaderChunk.meshline_frag=["",Y.ShaderChunk.fog_pars_fragment,Y.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() {","",Y.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);","",Y.ShaderChunk.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
109
109
  `);var si=class extends Y.ShaderMaterial{constructor(t){super({uniforms:Object.assign({},Y.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new Y.Color(16777215)},opacity:{value:1},resolution:{value:new Y.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 Y.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:Y.ShaderChunk.meshline_vert,fragmentShader:Y.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};si.prototype.copy=function(i){return Y.ShaderMaterial.prototype.copy.call(this,i),this.lineWidth=i.lineWidth,this.map=i.map,this.useMap=i.useMap,this.alphaMap=i.alphaMap,this.useAlphaMap=i.useAlphaMap,this.color.copy(i.color),this.opacity=i.opacity,this.resolution.copy(i.resolution),this.sizeAttenuation=i.sizeAttenuation,this.dashArray.copy(i.dashArray),this.dashOffset.copy(i.dashOffset),this.dashRatio.copy(i.dashRatio),this.useDash=i.useDash,this.visibility=i.visibility,this.alphaTest=i.alphaTest,this.repeat.copy(i.repeat),this};var B1={texture_url:pa,lineWidth:10,color:16777215},va=class extends lt.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getDepthTestByControl(){let t=this.navigation.bmap.context.control.getPolarAngle();return!(t>=0&&t<=.15)}setDepthTest(t){this.depthTest=t,this.material&&(this.material.depthTest=t)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:r}}}}}=this,o=t.map(a=>{let[l,u]=a;return D(new lt.Vector3(l,u,0),e,n,r)}).map(a=>{let{x:l,y:u}=a;return[l,u]});return Ft(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new lt.Vector2(t,1)}loadTexture(t){return new Promise((e,n)=>{new lt.TextureLoader().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return g(this,null,function*(){let e=this.geometry=new Yt;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=lt.RepeatWrapping}let n=this.material=new si({useMap:!0,color:new lt.Color(this.config.color),transparent:!0,resolution:new lt.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:this.depthTest,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:lt.NormalBlending,repeat:new lt.Vector2(this.getRepeat(),1)}),r=this.mesh=new lt.Mesh(e,n);return r.renderOrder=9,this.add(r),r})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=B1,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.depthTest=!0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat()),this.setDepthTest(this.getDepthTestByControl())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:r}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,r)}},this.config=Object.assign({},B1,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom,this.setDepthTest(this.getDepthTestByControl())}};var Ui=require("@tweenjs/tween.js"),Re=require("three");var eL=f(Ma(),1),nL=f(I(),1),iL=f(C(),1),Ea=require("three");var L1=require("@tweenjs/tween.js"),Q1=require("lodash");var l3={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},xa=class extends Ea.EventDispatcher{get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){var t;return((t=this.curRoutePath)==null?void 0:t.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)}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,e){let{curRoutePathPoints:n,position:r,curRoutePath:o,paths:s,routeIndex:a}=this;if(!n.length)return null;let l=n;if(r){let y=ve(n,r);l=l.slice(y+1),l.unshift(r)}let u=[{floor:o==null?void 0:o.floor,points:l},...s.slice(a+1)],{distance:h,closestPoint:c,index:p,i:m}=u.reduce((y,M,j)=>{if(M.floor!==t)return y;let{distance:A,closestPoint:W,index:X}=M.points.reduce((v,Z,R,b)=>{if(!b[R+1])return w({},v,{distance:v.distance===1/0?U(Z,e):v.distance});let{distance:B,closestPoint:Ji}=_l(e,Z,b[R+1]);return B<v.distance?{distance:B,closestPoint:Ji,index:R}:v},{distance:1/0,closestPoint:M.points[0],index:0});return A<y.distance?{distance:A,closestPoint:W,index:j,i:X}:y},{distance:1/0,closestPoint:l[0],index:0,i:0});return{distance:h,closestPoint:c,routeIndex:p+a,pointIndex:p===0?m+this.pointIndex:m}}toPosition(t,e){let n=this.adsorb(t,e);if(!n)return;let{distance:r,closestPoint:o,routeIndex:s,pointIndex:a}=n;r>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.resetTimer=null)),this.routeIndex=s,this.pointIndex=a,this.position=o,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}pause(){var t;this.tweenUtil.clear(),(t=this.throttleUpdatePosition)==null||t.cancel(),this.paused=!0}continue(){this.paused=!1,this.startCurRouteSimulation()}startCurRouteSimulation(){return g(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let r=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),s=o/this.options.simulationSpeed,a=this.throttleUpdatePosition=(0,Q1.throttle)(u=>{let h=Gn(r,u.distance);h&&(e.push({floor:t.floor,pos:h}),this.toPosition(t.floor,h))},100),l=this.simulationTween=new L1.Tween({distance:0},this.tweenUtil.group).to({distance:o},s*1e3).onUpdate(a).onComplete(()=>{this.tweenUtil.remove(l),a.flush(),a.cancel(),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,setTimeout(()=>{n(this.startCurRouteSimulation())},3e3)):(n(!0),console.log(e,this.routeIndex,this.paths))}).start()})})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.paused||this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[n,...t.slice(e+1)];return Ft(r)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[...t.slice(0,e+1),n];return Ft(r)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((r,o)=>r+o.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:n,position:r,curRoutePath:o}=this,s=e,a=Ke.FRONT,l=(o==null||(t=o.pointInfos[s])==null?void 0:t.crossName)||"",u=0,h=0,c=0;for(;a===Ke.FRONT&&s<=n.length;){let y=n[s],M=n[s+1],j=n[s+2];if(!y||!M)a=Ke.END;else if(u+=U(y,M),!j)a=Ke.END;else{a=Ws(y,M,j),h=jr(y,M,j),c=(new Ea.Vector2(j[0]-M[0],j[1]-M[1]).angle()*180/Math.PI-90+360)%360;var p;l=(p=o==null?void 0:o.pointInfos[s+1].crossName)!=null?p:"",s+=1}}if(n[s]&&(u=U(r,n[s])),a===Ke.END&&u<=this.options.directionEmitThreshold)return{dir:a,distance:u,crossName:l,angle:h,nextAngle:c};let m=this.getCurRouteToStartDistance();return e===0&&m<=5?{dir:Ke.START,distance:u,crossName:l,angle:h,nextAngle:c}:(u>=this.options.directionEmitThreshold&&(a=Ke.FRONT),{dir:a,distance:u,crossName:l,angle:h,nextAngle:c})}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),n=this.getNextDirDistance();if(!n)return null;let{dir:r,distance:o,crossName:s,angle:a,nextAngle:l}=n;return e<=10&&(r=Ke.END),{distance:t,curRouteDistance:e,nextDirDistance:o,dir:r,angle:a,nextAngle:l,pos:this.position,routeIndex:this.routeIndex,crossName:s,offset:this.offset,reset:this.reset}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear(),this.navigation=null}constructor(t,e,n){super(),this.navigation=t,this.offset=!1,this.reset=!1,this.position=[0,0],this.routeIndex=0,this.pointIndex=0,this.paths=[],this.timer=new nt,this.resetTimer=null,this.tweenUtil=new qe,this.paused=!1,this.onAddPaths=r=>{let{paths:o}=r;this.paths=o,this.resetStatus(o)},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},l3,e),this.roadData=n,this.registryEvent()}};var aL=f(ks(),1),lL=f(Kr(),1),uL=f(_r(),1),hL=f(Or(),1),cL=f(Fr(),1),pL=f(zr(),1),dL=f(Ur(),1),fL=f(Nr(),1),mL=f(Gr(),1),yL=f(kr(),1),PL=f(Vr(),1),ML=f(Jr(),1),jL=f(Br(),1),gL=f(Qr(),1),AL=f(Hr(),1),TL=f(th(),1),wL=f(I(),1),oe=require("three");var sn=class i extends st{addDebug(){i.canvas.style.cssText=`
110
110
  position: fixed;
111
111
  top: 0;
112
112
  left: 0;
113
113
  z-index: 9999;
114
- `,document.body.appendChild(i.canvas)}setAngle(t){if(console.log("angle",t),i.textureMap.has(t))this._initIcon(i.textureMap.get(t));else{this.draw(t);let e=this.getTexture(this.getImageData());i.textureMap.set(t,e),this._initIcon(e),this._initScale({zoom:this.bmap.context.camera.zoom})}}_initIcon(t){if(this.spriteIcon)this.spriteIcon.material.map=t,t.needsUpdate=!0;else{let e=new oe.Sprite(new oe.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI}));e.renderOrder=1e5+this.options.level,t.needsUpdate=!0,this.add(e),e.center.set(.5,.5),this.spriteIcon=e}}initSize(){this.spriteIcon&&this.spriteIcon.center.set(.5,.5)}draw(t){let{ctx:e}=i,{config:{size:n}}=this,r=n[0]/2,o=n[1]/2,s=4,a=1,l=s+a;if(e.clearRect(0,0,n[0],n[1]),e.setLineDash([10,10]),e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),e.arc(r,o,o-l,-Math.PI/2,Math.PI*2-Math.PI/2,t<Math.PI),e.stroke(),e.strokeStyle="#0A7AFF",t<Math.PI){let u=-Math.PI/2,h=u-t;e.beginPath(),e.arc(r,o,o-l,u,h,!0)}else{let u=-Math.PI/2,h=u+Math.PI*2-t;e.beginPath(),e.arc(r,o,o-l,u,h,!1)}e.stroke(),e.clearRect(r-l*2,0,l*4,l*4),e.beginPath(),e.arc(r,l,s,0,Math.PI*2),e.fillStyle="#0A7AFF",e.fill(),e.setLineDash([10,0]),e.strokeStyle="#fff",e.lineWidth=a,e.stroke(),e.clearRect(0,o-5,10,10),e.clearRect(r-5,n[1]-10,10,10),e.clearRect(n[0]-10,o-5,10,10),t>Math.PI/2&&t<Math.PI?e.fillStyle="#0A7AFF":e.fillStyle="#fff",e.fillRect(0,o-1,10,2),e.fillStyle="#fff",e.fillRect(r-1,n[1]-10,2,10),t>Math.PI&&t<Math.PI/2*3?e.fillStyle="#0A7AFF":e.fillStyle="#fff",e.fillRect(n[0]-10,o-1,10,2)}getImageData(){let{ctx:t}=i,{config:{size:e}}=this;return t.getImageData(0,0,e[0],e[1])}getTexture(t){let{config:{size:e}}=this,n=new oe.DataTexture(Uint8Array.from(t.data),e[0],e[1],oe.RGBAFormat);return n.format=oe.RGBAFormat,n.magFilter=oe.LinearFilter,n.minFilter=oe.LinearFilter,n.colorSpace="srgb",n.flipY=!0,n}dispose(){var t;super.dispose(),(t=this.spriteIcon)==null||t.material.dispose()}static dispose(){this.textureMap.forEach(t=>{t.dispose()}),this.textureMap.clear(),this.ctx=null,this.canvas=null}constructor(t,e){super(t.context,{icon_size:e.size,collision_enable:!1,level:2}),this.bmap=t,this.config=e,i.canvas.width=e.size[0],i.canvas.height=e.size[1]}};sn.canvas=document.createElement("canvas");sn.ctx=sn.canvas.getContext("2d",{willReadFrequently:!0});sn.textureMap=new Map;var u3={path:{},cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},positionNavigation:{},offsetY:150,directionEmitThreshold:5,disablePathAnimation:!1,speed:1,roadData:[],runAnimationMaxTime:1},rc=class extends vt{get curFloorPathLength(){var t,e;return(e=(t=this.curFloorPath)==null?void 0:t.distance)!=null?e:0}get curFloorPathPoints(){var t,e;return(e=(t=this.curFloorPath)==null?void 0:t.points)!=null?e:[]}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener(Pt.SWITCH_FLOOR_AFTER,this.onSwitchFloor),this.positionNavigation.addEventListener("navigation-info",this.onNavigationInfo),this.bmap.context.addEventListener("control-change",this.onControlChangeForStartPoi)}showStartRotateHelperPoi(){var t;if(this.needStartRotateHelperPoi=!0,!this.startPoi||this.startRotateHelperPoi)return;let e=this.startPoi.options.icon_size;this.startRotateHelperPoi=new sn(this.bmap,{size:[e[0]+20,e[1]+20]}),this.startRotateHelperPoi.setAngle(0),this.startRotateHelperPoi.position.setZ(.51),(t=this.bmap.context.currentFloor)==null||t.poiLayer2.pushPoi(this.startRotateHelperPoi)}hideStartRotateHelperPoi(){if(this.needStartRotateHelperPoi=!1,this.startRotateHelperPoi){var t;(t=this.bmap.context.currentFloor)==null||t.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}setStartPoiPosition(t,e){this.startPoi&&(this.startPoi.position.setX(t).setY(e),this.startRotateHelperPoi&&this.startRotateHelperPoi.position.setX(t).setY(e))}toPositionByTask(t){var e;let r=(e=this.taskQueue.getTasks().find(s=>s.meta.type==="toPosition"))==null?void 0:e.tid,o={run:()=>this.toPositionBySpeed(t,this.options.speed),meta:{type:"toPosition"}};r?this.taskQueue.replace(r,o):this.taskQueue.add(o)}pauseAnimation(){this.taskQueue.clear(),this.positionNavigation.pause(),this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue(),this.positionNavigation.continue()}clearTween(){this.tweenUtil.clear(),this.taskQueue.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener(Pt.SWITCH_FLOOR_AFTER,this.onSwitchFloor),this.positionNavigation.removeEventListener("navigation-info",this.onNavigationInfo),this.bmap.context.removeEventListener("control-change",this.onControlChangeForStartPoi)}clearPath(){if(this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.clearTween()),this.startPoi){var t;if((t=this.bmap.context.currentFloor)==null||t.poiLayer2.removePoi(this.startPoi),this.startPoi=null,this.startRotateHelperPoi){var e;(e=this.bmap.context.currentFloor)==null||e.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}this.translatePath=null}setCurFloorPath(t){t===null?(this.curFloorPath=null,this.currentPathPosition=null,this.toPointPosition=null):(this.curFloorPath=t,this.currentPathPosition=t.points[0],this.toPointPosition=t.points[0]),this.movedDistance=0,this.clearTween()}setCurPathIndex(t){var e,n;this.curPathIndex=t,((e=this.paths[t])==null?void 0:e.floor)===((n=this.bmap.context.currentFloor)==null?void 0:n.name)?(this.setCurFloorPath(this.paths[t]),this.renderPath(this.translatePoints(this.curFloorPathPoints))):this.clearPath()}addPath(t,e){e===void 0&&(e=0);var n;this.paths=t,this.curPathIndex=e,this.clearTween();let r=(n=this.bmap.context.currentFloor)==null?void 0:n.name,o=t[e];if(r&&(o==null?void 0:o.floor)===r)if(this.setCurFloorPath(o),this.bmap.currentBuildGround)this.renderPath(this.translatePoints(o.points));else{let s=()=>{this.bmap.removeEventListener("center-change",s),this.renderPath(this.translatePoints(o.points))};this.bmap.addEventListener("center-change",s)}else this.clearPath();this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,n]=this.bmap.buildingCenter;return t.map(r=>[r[0]-e,r[1]-n])}renderPath(t){this.translatePath=t;let e=this.catmullRomCurve3(t);if(this.cPath=e,this.animationPathOptions={cPathIndex:0},this.pathStart=e[0],this.path?this.path.updatePoints(e):(this.path=new va(this,this.options.path),this.path.create(e),this.path.position.z=this.bmap.context.currentFloor.groundMaxHeight+.5,this.bmap.context.scene.add(this.path)),this.path.movePath(0),this.startPoi){var n;if((n=this.bmap.context.currentFloor)==null||n.poiLayer2.removePoi(this.startPoi),this.startPoi=null,this.startRotateHelperPoi){var r;(r=this.bmap.context.currentFloor)==null||r.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}if(this.options.needStartPoi){var o;this.startPoi=new st(this.bmap.context,w({},this.options.startPoi,{id:"navigation_start_poi",position:{x:e[0][0],y:e[0][1],z:.51},collision_enable:!1}))||null,(o=this.bmap.context.currentFloor)==null||o.poiLayer2.pushPoi(this.startPoi),this.needStartRotateHelperPoi&&this.showStartRotateHelperPoi(),console.log(this.startRotateHelperPoi)}this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(t){return wr(t,!1,!0,.1,170,2.5)}getPathDirection(){if(!this.curFloorPath||!this.currentPathPosition||this.curFloorPathPoints.length<2)return null;let t=ve(this.curFloorPathPoints,this.currentPathPosition),e=this.curFloorPathPoints[t],n=this.curFloorPathPoints[t+1],r=new Re.Vector3(n[0]-e[0],n[1]-e[1],0).normalize(),o=new Re.Vector3(0,1,0).normalize(),s=r.angleTo(o),a=new Re.Vector3().crossVectors(o,r);return(Object.is(a.y,0)?-1:1)*s}getPathDirection2(){if(!this.curFloorPath||!this.toPointPosition||this.curFloorPathPoints.length<2)return null;let t=ve(this.curFloorPathPoints,this.toPointPosition),e=this.curFloorPathPoints[t],n=this.curFloorPathPoints[t+1];return(new Re.Vector2(n[0]-e[0],n[1]-e[1]).normalize().angle()*180/Math.PI-90+360)%360}changeCameraToPathUp(t){return g(this,null,function*(){t===void 0&&(t=100);let e=this.getPathDirection();if(e===null)return;let n=this.bmap.context.control.getAzimuthalAngle();Math.abs(n-e)>Math.PI&&(n>0?e=Math.PI*2+e:e=e-Math.PI*2);let r=Math.abs(e-this.bmap.context.control.getAzimuthalAngle());if(r<.01)return;let{control:o}=this.bmap.context,s=t/Math.PI*6*r;return zt(new Promise(a=>{let l={azimuthal:o.getAzimuthalAngle()},u={azimuthal:e},h=o.getPolarAngle(),{maxPolarAngle:c,minPolarAngle:p}=o;o.maxPolarAngle=h,o.minPolarAngle=h;let m=new Ui.Tween(l,this.tweenUtil.group).to(u,s).easing(Ui.Easing.Quadratic.InOut).onUpdate(()=>g(this,null,function*(){this.startPoi&&o.target.copy(this.startPoi.position),o.setAzimuthalAngle(l.azimuthal,!0),o.setTargetByOffset(this.options.offsetY)})).onComplete(()=>{o.enabled=!0,this.tweenUtil.remove(m),o.maxPolarAngle=c,o.minPolarAngle=p,a(!0)}).onStart(()=>{o.enabled=!1}).start()}),s+500).finally(()=>{this.bmap.context.control.enabled=!0})})}initNavigationCamera(t){return g(this,null,function*(){t===void 0&&(t=1e3);var e;let r=(e=this.taskQueue.getTasks().find(s=>s.meta.type==="initNavigationCamera"))==null?void 0:e.tid,o={run:()=>zt(g(this,null,function*(){yield this.initCameraZoom(t/2),yield this.changeCameraToPathUp(t/4),yield this.translateCameraToStartPoi(t/4)}),t+500).finally(()=>{this.bmap.context.control.enabled=!0}),meta:{type:"initNavigationCamera"}};r?this.taskQueue.replace(r,o):this.taskQueue.add(o)})}translateCameraToStartPoi(t){return g(this,null,function*(){if(t===void 0&&(t=100),!this.startPoi)return;let{clientSize:{width:e,height:n},camera:r,control:o}=this.bmap.context,s=Math.round(e/2),a=Math.round(n/2),l=o.target.clone(),u=D(this.startPoi.position,r,e,n),h=u.x-s,c=a-u.y+this.options.offsetY;if(!(Math.abs(h)<=1&&Math.abs(c)<=1)){if(Math.abs(h)>=1){let p=new Re.Vector3;p.setFromMatrixColumn(r.matrix,0),p.normalize(),p.multiplyScalar(h/r.zoom),l.add(new Re.Vector3(p.x,p.y,0))}if(Math.abs(c)>=1){let p=new Re.Vector3;p.setFromMatrixColumn(r.matrix,1),p.normalize(),p.multiplyScalar(c/r.zoom),l.add(new Re.Vector3(p.x,p.y,0))}return zt(new Promise(p=>{let m=o.target.clone();console.log(m,l,t);let y=new Ui.Tween(m,this.tweenUtil.group).to(l,t).onUpdate(()=>{this.bmap.context.control.setCameraPositionByTarget(m,0)}).onComplete(()=>{this.bmap.context.control.setCameraPositionByTarget(l,0),this.tweenUtil.remove(y),this.bmap.context.control.enabled=!0,p(!0)}).onStart(()=>{this.bmap.context.control.enabled=!1}).start()}),t+500).then(()=>{this.bmap.context.control.enabled=!0})}})}initCameraZoom(t){return g(this,null,function*(){if(t===void 0&&(t=100),!this.startPoi)return;let{clientSize:{width:e,height:n},currentFloor:r}=this.bmap.context,{max:o,min:s}=r.box,l=Math.min(e/(o.x-s.x),n/(o.y-s.y))*(o.x-s.x)/45;return this.bmap.context.setZoom(l,this.startPoi.position,t).finally(()=>{this.bmap.context.control.enabled=!0})})}toPosition(t,e){this.positionNavigation.toPosition(t,e)}startSimulation(){this.positionNavigation.startSimulation()}setSimulationSpeed(t){this.positionNavigation.changeSimulationSpeed(t)}toPositionBySpeed(t,e){return g(this,null,function*(){let{currentPathPosition:n,curFloorPath:r,curFloorPathPoints:o}=this;if(!r||!n)return null;let s=this.movedDistance,a=Cl(o,t);if(s===-1||a===-1||a<=s)return null;let l=a-s;if(!l)return;let u=Math.min(l/e,this.options.runAnimationMaxTime);return this.pathTween&&this.clearTween(),zt(new Promise(h=>{let c=this.pathTween=new Ui.Tween({distance:0},this.tweenUtil.group).to({distance:l},u*1e3).onUpdate(p=>g(this,null,function*(){this.moveDistance(p.distance+s,c)})).onComplete(()=>{this.tweenUtil.remove(c),h(!0)}).start()}),u*1e3+500).finally(()=>{this.bmap.context.control.enabled=!0})})}moveDistance(t,e){return g(this,null,function*(){var n;this.movedDistance=t,(n=this.path)==null||n.movePath(this.movedDistance/this.curFloorPathLength);let r=Gn(this.curFloorPathPoints,this.movedDistance);if(r===null)return;this.currentPathPosition=r;let o=this.translatePoints([r])[0];this.startPoi&&(this.setStartPoiPosition(o[0],o[1]),this.options.disablePathAnimation||this.bmap.context.control.setTargetByOffset(this.options.offsetY,this.startPoi.position.clone())),this.options.disablePathAnimation||(e==null||e.pause(),yield this.changeCameraToPathUp(500/this.options.speed),e==null||e.resume())})}setStartPoiRotate(t){if(this.startPoiRotate=t,this.startPoi){let n=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(360-t-n)%360,this.startRotateHelperPoi&&this.startRotateHelperPoi.setAngle((360-t-n)%360)}}dispose(){var t,e;this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.tweenUtil.dispose(),this.unRegistryEvent(),(t=this.startPoi)==null||t.dispose(),(e=this.startRotateHelperPoi)==null||e.dispose(),sn.dispose(),this.positionNavigation.dispose(),super.dispose(),this.startRotateHelperPoi=null}constructor(t,e={},n){super(t),this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curPathIndex=0,this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.toPointPosition=null,this.pathTween=null,this.startPoi=null,this.startPoiRotate=0,this.startRotateHelperPoi=null,this.needStartRotateHelperPoi=!1,this.movedDistance=0,this.pathStart=[0,0],this.tweenUtil=new qe,this.taskQueue=new Vn,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onNavigationInfo=r=>{let{info:o}=r;if(this.dispatchEvent({type:"navigation-info",info:o}),!o.offset){if(o.routeIndex!==this.curPathIndex)return;this.toPointPosition=o.pos,this.toPositionByTask(o.pos)}},this.onUpdate=()=>{this.tweenUtil.update()},this.onSwitchFloor=r=>{let{data:{curFloor:o}}=r;if(this.clearTween(),this.paths[this.curPathIndex]){let s=this.paths[this.curPathIndex];this.setCurFloorPath(s!=null?s:null),s?this.renderPath(this.translatePoints(s.points)):this.clearPath()}else this.clearPath()},this.onControlChangeForStartPoi=()=>{this.startPoi&&this.setStartPoiRotate(this.startPoiRotate)},!n&&typeof e=="object"&&(n=e),this.options=Object.assign({},u3,n),this.positionNavigation=new xa(this,w({simulationSpeed:this.options.speed},this.options.positionNavigation),this.options.roadData),this.registryEvent()}};var RL=f(I(),1);var Ni=require("three"),oc=class extends vt{show(t){let e=0;t.forEach(o=>{o.poiLayer2.pois.forEach(s=>{let a=new Ni.Vector3().setFromMatrixPosition(s.matrixWorld).z;s.position.setZ(a+e),s.options.depth_test=!0,this.poiLayer.pushPoi(s)}),o.poiLayer2.pois.length=0,o.poiLayer2.dispose(),o.position.z=e,e+=o.userData.height});let{scene:n,currentFloor:r}=this.bmap.context;r&&(n.remove(r),r.dispose()),this.group.add(this.poiLayer,...t),n.add(this.group),this.floors=t,this.fitCamera(),this.bmap.context.cameraBound.updateBox(),this.showStatus=!0}hide(){let{scene:t}=this.bmap.context;t.remove(this.group),this.poiLayer.clear(),this.floors.forEach(e=>{e.dispose()}),this.floors=[],this.group.clear(),this.showStatus=!1}fitCamera(){let{context:t,config:e,type:n}=this.bmap;t.cameraBound.setEnable(!1),t.control.minZoom=0,t.control.maxZoom=1/0,t.camera.zoom=1,t.setAzimuthalAngle(e.control.defaultAzimuthal,0),t.setPolarAngle(e.control.defaultPolar,0),t.fitCameraToObject(this.group,e.defaultPadding,0);let r=t.camera.zoom;t.control.minZoom=r,t.control.maxZoom=r*25,n==="3d"&&t.fitCameraToObject(this.group,e.defaultPadding,0,!1),this.bmap.basicZoom=t.camera.zoom,t.control.addEventListener("change",this.bmap.onControlChange.bind(this.bmap)),this.bmap.onControlChange(),t.cameraBound.setEnable(!0)}dispose(){this.poiLayer.dispose(),this.floors.forEach(t=>t.dispose()),this.floors=[],super.dispose()}constructor(t){super(t),this.floors=[],this.group=new Ni.Group,this.showStatus=!1,this.group.name="mul-floor-group",this.poiLayer=new ei(t.context),this.poiLayer.changeParkingSpaceVisibleByZoom=()=>{let e=new Ni.Box3().setFromObject(this.group),{clientSize:{width:n,height:r}}=this.bmap.context,{max:o,min:s}=e,l=Math.min(n/(o.x-s.x),r/(o.y-s.y))*(o.x-s.x)/45;this.poiLayer.pois.filter(u=>u.userData.type==="parkingSpace").map(u=>{let h=this.bmap.context.camera.zoom>=l;u.visible=h,h||u.parentSetVisible(h)})}}};var H1=require("three");function sc(){let i=new Blob([`var xF=Object.create;var $x=Object.defineProperty;var EF=Object.getOwnPropertyDescriptor;var wF=Object.getOwnPropertyNames;var SF=Object.getPrototypeOf,MF=Object.prototype.hasOwnProperty;var at=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var bF=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of wF(t))!MF.call(n,s)&&s!==e&&$x(n,s,{get:()=>t[s],enumerable:!(o=EF(t,s))||o.enumerable});return n};var Ze=(n,t,e)=>(e=n!=null?xF(SF(n)):{},bF(t||!n||!n.__esModule?$x(e,"default",{value:n,enumerable:!0}):e,n));var np=(n,t,e)=>new Promise((o,s)=>{var c=g=>{try{p(e.next(g))}catch(m){s(m)}},h=g=>{try{p(e.throw(g))}catch(m){s(m)}},p=g=>g.done?o(g.value):Promise.resolve(g.value).then(c,h);p((e=e.apply(n,t)).next())});var io=at((Im,Zx)=>{"use strict";var If=function(n){return n&&n.Math===Math&&n};Zx.exports=If(typeof globalThis=="object"&&globalThis)||If(typeof window=="object"&&window)||If(typeof self=="object"&&self)||If(typeof global=="object"&&global)||If(typeof Im=="object"&&Im)||function(){return this}()||Function("return this")()});var Kx=at((bJ,Jx)=>{"use strict";Jx.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var Di=at((AJ,jx)=>{"use strict";var Rm=typeof document=="object"&&document.all;jx.exports=typeof Rm=="undefined"&&Rm!==void 0?function(n){return typeof n=="function"||n===Rm}:function(n){return typeof n=="function"}});var Ea=at((TJ,Qx)=>{"use strict";var AF=Di();Qx.exports=function(n){return typeof n=="object"?n!==null:AF(n)}});var rp=at((CJ,eE)=>{"use strict";var TF=io(),tE=Ea(),Lm=TF.document,CF=tE(Lm)&&tE(Lm.createElement);eE.exports=function(n){return CF?Lm.createElement(n):{}}});var iE=at((PJ,rE)=>{"use strict";var PF=rp(),Nm=PF("span").classList,nE=Nm&&Nm.constructor&&Nm.constructor.prototype;rE.exports=nE===Object.prototype?void 0:nE});var gi=at((IJ,oE)=>{"use strict";oE.exports=function(n){try{return!!n()}catch(t){return!0}}});var Rf=at((RJ,sE)=>{"use strict";var IF=gi();sE.exports=!IF(function(){var n=function(){}.bind();return typeof n!="function"||n.hasOwnProperty("prototype")})});var mi=at((LJ,lE)=>{"use strict";var aE=Rf(),uE=Function.prototype,Om=uE.call,RF=aE&&uE.bind.bind(Om,Om);lE.exports=aE?RF:function(n){return function(){return Om.apply(n,arguments)}}});var ec=at((NJ,fE)=>{"use strict";var cE=mi(),LF=cE({}.toString),NF=cE("".slice);fE.exports=function(n){return NF(LF(n),8,-1)}});var pE=at((OJ,hE)=>{"use strict";var OF=mi(),DF=gi(),FF=ec(),Dm=Object,UF=OF("".split);hE.exports=DF(function(){return!Dm("z").propertyIsEnumerable(0)})?function(n){return FF(n)==="String"?UF(n,""):Dm(n)}:Dm});var ip=at((DJ,dE)=>{"use strict";dE.exports=function(n){return n==null}});var nc=at((FJ,gE)=>{"use strict";var BF=ip(),zF=TypeError;gE.exports=function(n){if(BF(n))throw new zF("Can't call method on "+n);return n}});var rc=at((UJ,mE)=>{"use strict";var GF=pE(),kF=nc();mE.exports=function(n){return GF(kF(n))}});var Lf=at((BJ,yE)=>{"use strict";yE.exports=!1});var op=at((zJ,_E)=>{"use strict";var vE=io(),qF=Object.defineProperty;_E.exports=function(n,t){try{qF(vE,n,{value:t,configurable:!0,writable:!0})}catch(e){vE[n]=t}return t}});var sp=at((GJ,wE)=>{"use strict";var HF=Lf(),VF=io(),WF=op(),xE="__core-js_shared__",EE=wE.exports=VF[xE]||WF(xE,{});(EE.versions||(EE.versions=[])).push({version:"3.39.0",mode:HF?"pure":"global",copyright:"\\xA9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var ap=at((kJ,ME)=>{"use strict";var SE=sp();ME.exports=function(n,t){return SE[n]||(SE[n]=t||{})}});var ic=at((qJ,bE)=>{"use strict";var XF=nc(),YF=Object;bE.exports=function(n){return YF(XF(n))}});var wa=at((HJ,AE)=>{"use strict";var $F=mi(),ZF=ic(),JF=$F({}.hasOwnProperty);AE.exports=Object.hasOwn||function(t,e){return JF(ZF(t),e)}});var Fm=at((VJ,TE)=>{"use strict";var KF=mi(),jF=0,QF=Math.random(),tU=KF(1 .toString);TE.exports=function(n){return"Symbol("+(n===void 0?"":n)+")_"+tU(++jF+QF,36)}});var RE=at((WJ,IE)=>{"use strict";var eU=io(),CE=eU.navigator,PE=CE&&CE.userAgent;IE.exports=PE?String(PE):""});var BE=at((XJ,UE)=>{"use strict";var FE=io(),Um=RE(),LE=FE.process,NE=FE.Deno,OE=LE&&LE.versions||NE&&NE.version,DE=OE&&OE.v8,Ws,up;DE&&(Ws=DE.split("."),up=Ws[0]>0&&Ws[0]<4?1:+(Ws[0]+Ws[1]));!up&&Um&&(Ws=Um.match(/Edge\\/(\\d+)/),(!Ws||Ws[1]>=74)&&(Ws=Um.match(/Chrome\\/(\\d+)/),Ws&&(up=+Ws[1])));UE.exports=up});var Bm=at((YJ,GE)=>{"use strict";var zE=BE(),nU=gi(),rU=io(),iU=rU.String;GE.exports=!!Object.getOwnPropertySymbols&&!nU(function(){var n=Symbol("symbol detection");return!iU(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&zE&&zE<41})});var zm=at(($J,kE)=>{"use strict";var oU=Bm();kE.exports=oU&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Is=at((ZJ,HE)=>{"use strict";var sU=io(),aU=ap(),qE=wa(),uU=Fm(),lU=Bm(),cU=zm(),oc=sU.Symbol,Gm=aU("wks"),fU=cU?oc.for||oc:oc&&oc.withoutSetter||uU;HE.exports=function(n){return qE(Gm,n)||(Gm[n]=lU&&qE(oc,n)?oc[n]:fU("Symbol."+n)),Gm[n]}});var Sa=at((JJ,VE)=>{"use strict";var hU=Ea(),pU=String,dU=TypeError;VE.exports=function(n){if(hU(n))return n;throw new dU(pU(n)+" is not an object")}});var Xs=at((KJ,WE)=>{"use strict";var gU=gi();WE.exports=!gU(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var km=at((jJ,XE)=>{"use strict";var mU=Xs(),yU=gi();XE.exports=mU&&yU(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var qm=at((QJ,YE)=>{"use strict";var vU=Xs(),_U=gi(),xU=rp();YE.exports=!vU&&!_U(function(){return Object.defineProperty(xU("div"),"a",{get:function(){return 7}}).a!==7})});var Rs=at((tK,$E)=>{"use strict";var EU=Rf(),lp=Function.prototype.call;$E.exports=EU?lp.bind(lp):function(){return lp.apply(lp,arguments)}});var sc=at((eK,ZE)=>{"use strict";var Hm=io(),wU=Di(),SU=function(n){return wU(n)?n:void 0};ZE.exports=function(n,t){return arguments.length<2?SU(Hm[n]):Hm[n]&&Hm[n][t]}});var KE=at((nK,JE)=>{"use strict";var MU=mi();JE.exports=MU({}.isPrototypeOf)});var Vm=at((rK,jE)=>{"use strict";var bU=sc(),AU=Di(),TU=KE(),CU=zm(),PU=Object;jE.exports=CU?function(n){return typeof n=="symbol"}:function(n){var t=bU("Symbol");return AU(t)&&TU(t.prototype,PU(n))}});var tw=at((iK,QE)=>{"use strict";var IU=String;QE.exports=function(n){try{return IU(n)}catch(t){return"Object"}}});var Nf=at((oK,ew)=>{"use strict";var RU=Di(),LU=tw(),NU=TypeError;ew.exports=function(n){if(RU(n))return n;throw new NU(LU(n)+" is not a function")}});var cp=at((sK,nw)=>{"use strict";var OU=Nf(),DU=ip();nw.exports=function(n,t){var e=n[t];return DU(e)?void 0:OU(e)}});var iw=at((aK,rw)=>{"use strict";var Wm=Rs(),Xm=Di(),Ym=Ea(),FU=TypeError;rw.exports=function(n,t){var e,o;if(t==="string"&&Xm(e=n.toString)&&!Ym(o=Wm(e,n))||Xm(e=n.valueOf)&&!Ym(o=Wm(e,n))||t!=="string"&&Xm(e=n.toString)&&!Ym(o=Wm(e,n)))return o;throw new FU("Can't convert object to primitive value")}});var uw=at((uK,aw)=>{"use strict";var UU=Rs(),ow=Ea(),sw=Vm(),BU=cp(),zU=iw(),GU=Is(),kU=TypeError,qU=GU("toPrimitive");aw.exports=function(n,t){if(!ow(n)||sw(n))return n;var e=BU(n,qU),o;if(e){if(t===void 0&&(t="default"),o=UU(e,n,t),!ow(o)||sw(o))return o;throw new kU("Can't convert object to primitive value")}return t===void 0&&(t="number"),zU(n,t)}});var $m=at((lK,lw)=>{"use strict";var HU=uw(),VU=Vm();lw.exports=function(n){var t=HU(n,"string");return VU(t)?t:t+""}});var Pu=at(fw=>{"use strict";var WU=Xs(),XU=qm(),YU=km(),fp=Sa(),cw=$m(),$U=TypeError,Zm=Object.defineProperty,ZU=Object.getOwnPropertyDescriptor,Jm="enumerable",Km="configurable",jm="writable";fw.f=WU?YU?function(t,e,o){if(fp(t),e=cw(e),fp(o),typeof t=="function"&&e==="prototype"&&"value"in o&&jm in o&&!o[jm]){var s=ZU(t,e);s&&s[jm]&&(t[e]=o.value,o={configurable:Km in o?o[Km]:s[Km],enumerable:Jm in o?o[Jm]:s[Jm],writable:!1})}return Zm(t,e,o)}:Zm:function(t,e,o){if(fp(t),e=cw(e),fp(o),XU)try{return Zm(t,e,o)}catch(s){}if("get"in o||"set"in o)throw new $U("Accessors not supported");return"value"in o&&(t[e]=o.value),t}});var pw=at((fK,hw)=>{"use strict";var JU=Math.ceil,KU=Math.floor;hw.exports=Math.trunc||function(t){var e=+t;return(e>0?KU:JU)(e)}});var ml=at((hK,dw)=>{"use strict";var jU=pw();dw.exports=function(n){var t=+n;return t!==t||t===0?0:jU(t)}});var mw=at((pK,gw)=>{"use strict";var QU=ml(),tB=Math.max,eB=Math.min;gw.exports=function(n,t){var e=QU(n);return e<0?tB(e+t,0):eB(e,t)}});var Qm=at((dK,yw)=>{"use strict";var nB=ml(),rB=Math.min;yw.exports=function(n){var t=nB(n);return t>0?rB(t,9007199254740991):0}});var Of=at((gK,vw)=>{"use strict";var iB=Qm();vw.exports=function(n){return iB(n.length)}});var Ew=at((mK,xw)=>{"use strict";var oB=rc(),sB=mw(),aB=Of(),_w=function(n){return function(t,e,o){var s=oB(t),c=aB(s);if(c===0)return!n&&-1;var h=sB(o,c),p;if(n&&e!==e){for(;c>h;)if(p=s[h++],p!==p)return!0}else for(;c>h;h++)if((n||h in s)&&s[h]===e)return n||h||0;return!n&&-1}};xw.exports={includes:_w(!0),indexOf:_w(!1)}});var hp=at((yK,ww)=>{"use strict";ww.exports={}});var e0=at((vK,Mw)=>{"use strict";var uB=mi(),t0=wa(),lB=rc(),cB=Ew().indexOf,fB=hp(),Sw=uB([].push);Mw.exports=function(n,t){var e=lB(n),o=0,s=[],c;for(c in e)!t0(fB,c)&&t0(e,c)&&Sw(s,c);for(;t.length>o;)t0(e,c=t[o++])&&(~cB(s,c)||Sw(s,c));return s}});var pp=at((_K,bw)=>{"use strict";bw.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Tw=at((xK,Aw)=>{"use strict";var hB=e0(),pB=pp();Aw.exports=Object.keys||function(t){return hB(t,pB)}});var Pw=at(Cw=>{"use strict";var dB=Xs(),gB=km(),mB=Pu(),yB=Sa(),vB=rc(),_B=Tw();Cw.f=dB&&!gB?Object.defineProperties:function(t,e){yB(t);for(var o=vB(e),s=_B(e),c=s.length,h=0,p;c>h;)mB.f(t,p=s[h++],o[p]);return t}});var Rw=at((wK,Iw)=>{"use strict";var xB=sc();Iw.exports=xB("document","documentElement")});var dp=at((SK,Nw)=>{"use strict";var EB=ap(),wB=Fm(),Lw=EB("keys");Nw.exports=function(n){return Lw[n]||(Lw[n]=wB(n))}});var Df=at((MK,Gw)=>{"use strict";var SB=Sa(),MB=Pw(),Ow=pp(),bB=hp(),AB=Rw(),TB=rp(),CB=dp(),Dw=">",Fw="<",r0="prototype",i0="script",Bw=CB("IE_PROTO"),n0=function(){},zw=function(n){return Fw+i0+Dw+n+Fw+"/"+i0+Dw},Uw=function(n){n.write(zw("")),n.close();var t=n.parentWindow.Object;return n=null,t},PB=function(){var n=TB("iframe"),t="java"+i0+":",e;return n.style.display="none",AB.appendChild(n),n.src=String(t),e=n.contentWindow.document,e.open(),e.write(zw("document.F=Object")),e.close(),e.F},gp,mp=function(){try{gp=new ActiveXObject("htmlfile")}catch(t){}mp=typeof document!="undefined"?document.domain&&gp?Uw(gp):PB():Uw(gp);for(var n=Ow.length;n--;)delete mp[r0][Ow[n]];return mp()};bB[Bw]=!0;Gw.exports=Object.create||function(t,e){var o;return t!==null?(n0[r0]=SB(t),o=new n0,n0[r0]=null,o[Bw]=t):o=mp(),e===void 0?o:MB.f(o,e)}});var a0=at((bK,kw)=>{"use strict";var IB=Is(),RB=Df(),LB=Pu().f,o0=IB("unscopables"),s0=Array.prototype;s0[o0]===void 0&&LB(s0,o0,{configurable:!0,value:RB(null)});kw.exports=function(n){s0[o0][n]=!0}});var yp=at((AK,qw)=>{"use strict";qw.exports={}});var Ww=at((TK,Vw)=>{"use strict";var NB=io(),OB=Di(),Hw=NB.WeakMap;Vw.exports=OB(Hw)&&/native code/.test(String(Hw))});var vp=at((CK,Xw)=>{"use strict";Xw.exports=function(n,t){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:t}}});var ac=at((PK,Yw)=>{"use strict";var DB=Xs(),FB=Pu(),UB=vp();Yw.exports=DB?function(n,t,e){return FB.f(n,t,UB(1,e))}:function(n,t,e){return n[t]=e,n}});var Ep=at((IK,Jw)=>{"use strict";var BB=Ww(),Zw=io(),zB=Ea(),GB=ac(),u0=wa(),l0=sp(),kB=dp(),qB=hp(),$w="Object already initialized",c0=Zw.TypeError,HB=Zw.WeakMap,_p,Ff,xp,VB=function(n){return xp(n)?Ff(n):_p(n,{})},WB=function(n){return function(t){var e;if(!zB(t)||(e=Ff(t)).type!==n)throw new c0("Incompatible receiver, "+n+" required");return e}};BB||l0.state?(Ys=l0.state||(l0.state=new HB),Ys.get=Ys.get,Ys.has=Ys.has,Ys.set=Ys.set,_p=function(n,t){if(Ys.has(n))throw new c0($w);return t.facade=n,Ys.set(n,t),t},Ff=function(n){return Ys.get(n)||{}},xp=function(n){return Ys.has(n)}):(yl=kB("state"),qB[yl]=!0,_p=function(n,t){if(u0(n,yl))throw new c0($w);return t.facade=n,GB(n,yl,t),t},Ff=function(n){return u0(n,yl)?n[yl]:{}},xp=function(n){return u0(n,yl)});var Ys,yl;Jw.exports={set:_p,get:Ff,has:xp,enforce:VB,getterFor:WB}});var tS=at(Qw=>{"use strict";var Kw={}.propertyIsEnumerable,jw=Object.getOwnPropertyDescriptor,XB=jw&&!Kw.call({1:2},1);Qw.f=XB?function(t){var e=jw(this,t);return!!e&&e.enumerable}:Kw});var f0=at(nS=>{"use strict";var YB=Xs(),$B=Rs(),ZB=tS(),JB=vp(),KB=rc(),jB=$m(),QB=wa(),tz=qm(),eS=Object.getOwnPropertyDescriptor;nS.f=YB?eS:function(t,e){if(t=KB(t),e=jB(e),tz)try{return eS(t,e)}catch(o){}if(QB(t,e))return JB(!$B(ZB.f,t,e),t[e])}});var d0=at((NK,iS)=>{"use strict";var h0=Xs(),ez=wa(),rS=Function.prototype,nz=h0&&Object.getOwnPropertyDescriptor,p0=ez(rS,"name"),rz=p0&&function(){}.name==="something",iz=p0&&(!h0||h0&&nz(rS,"name").configurable);iS.exports={EXISTS:p0,PROPER:rz,CONFIGURABLE:iz}});var m0=at((OK,oS)=>{"use strict";var oz=mi(),sz=Di(),g0=sp(),az=oz(Function.toString);sz(g0.inspectSource)||(g0.inspectSource=function(n){return az(n)});oS.exports=g0.inspectSource});var lS=at((DK,uS)=>{"use strict";var v0=mi(),uz=gi(),lz=Di(),wp=wa(),y0=Xs(),cz=d0().CONFIGURABLE,fz=m0(),aS=Ep(),hz=aS.enforce,pz=aS.get,sS=String,Sp=Object.defineProperty,dz=v0("".slice),gz=v0("".replace),mz=v0([].join),yz=y0&&!uz(function(){return Sp(function(){},"length",{value:8}).length!==8}),vz=String(String).split("String"),_z=uS.exports=function(n,t,e){dz(sS(t),0,7)==="Symbol("&&(t="["+gz(sS(t),/^Symbol\\(([^)]*)\\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!wp(n,"name")||cz&&n.name!==t)&&(y0?Sp(n,"name",{value:t,configurable:!0}):n.name=t),yz&&e&&wp(e,"arity")&&n.length!==e.arity&&Sp(n,"length",{value:e.arity});try{e&&wp(e,"constructor")&&e.constructor?y0&&Sp(n,"prototype",{writable:!1}):n.prototype&&(n.prototype=void 0)}catch(s){}var o=hz(n);return wp(o,"source")||(o.source=mz(vz,typeof t=="string"?t:"")),n};Function.prototype.toString=_z(function(){return lz(this)&&pz(this).source||fz(this)},"toString")});var Uf=at((FK,cS)=>{"use strict";var xz=Di(),Ez=Pu(),wz=lS(),Sz=op();cS.exports=function(n,t,e,o){o||(o={});var s=o.enumerable,c=o.name!==void 0?o.name:t;if(xz(e)&&wz(e,c,o),o.global)s?n[t]=e:Sz(t,e);else{try{o.unsafe?n[t]&&(s=!0):delete n[t]}catch(h){}s?n[t]=e:Ez.f(n,t,{value:e,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return n}});var hS=at(fS=>{"use strict";var Mz=e0(),bz=pp(),Az=bz.concat("length","prototype");fS.f=Object.getOwnPropertyNames||function(t){return Mz(t,Az)}});var dS=at(pS=>{"use strict";pS.f=Object.getOwnPropertySymbols});var mS=at((zK,gS)=>{"use strict";var Tz=sc(),Cz=mi(),Pz=hS(),Iz=dS(),Rz=Sa(),Lz=Cz([].concat);gS.exports=Tz("Reflect","ownKeys")||function(t){var e=Pz.f(Rz(t)),o=Iz.f;return o?Lz(e,o(t)):e}});var _S=at((GK,vS)=>{"use strict";var yS=wa(),Nz=mS(),Oz=f0(),Dz=Pu();vS.exports=function(n,t,e){for(var o=Nz(t),s=Dz.f,c=Oz.f,h=0;h<o.length;h++){var p=o[h];!yS(n,p)&&!(e&&yS(e,p))&&s(n,p,c(t,p))}}});var ES=at((kK,xS)=>{"use strict";var Fz=gi(),Uz=Di(),Bz=/#|\\.prototype\\./,Bf=function(n,t){var e=Gz[zz(n)];return e===qz?!0:e===kz?!1:Uz(t)?Fz(t):!!t},zz=Bf.normalize=function(n){return String(n).replace(Bz,".").toLowerCase()},Gz=Bf.data={},kz=Bf.NATIVE="N",qz=Bf.POLYFILL="P";xS.exports=Bf});var Ls=at((qK,wS)=>{"use strict";var Mp=io(),Hz=f0().f,Vz=ac(),Wz=Uf(),Xz=op(),Yz=_S(),$z=ES();wS.exports=function(n,t){var e=n.target,o=n.global,s=n.stat,c,h,p,g,m,_;if(o?h=Mp:s?h=Mp[e]||Xz(e,{}):h=Mp[e]&&Mp[e].prototype,h)for(p in t){if(m=t[p],n.dontCallGetSet?(_=Hz(h,p),g=_&&_.value):g=h[p],c=$z(o?p:e+(s?".":"#")+p,n.forced),!c&&g!==void 0){if(typeof m==typeof g)continue;Yz(m,g)}(n.sham||g&&g.sham)&&Vz(m,"sham",!0),Wz(h,p,m,n)}}});var MS=at((HK,SS)=>{"use strict";var Zz=gi();SS.exports=!Zz(function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype})});var x0=at((VK,AS)=>{"use strict";var Jz=wa(),Kz=Di(),jz=ic(),Qz=dp(),tG=MS(),bS=Qz("IE_PROTO"),_0=Object,eG=_0.prototype;AS.exports=tG?_0.getPrototypeOf:function(n){var t=jz(n);if(Jz(t,bS))return t[bS];var e=t.constructor;return Kz(e)&&t instanceof e?e.prototype:t instanceof _0?eG:null}});var M0=at((WK,PS)=>{"use strict";var nG=gi(),rG=Di(),iG=Ea(),oG=Df(),TS=x0(),sG=Uf(),aG=Is(),uG=Lf(),S0=aG("iterator"),CS=!1,Qa,E0,w0;[].keys&&(w0=[].keys(),"next"in w0?(E0=TS(TS(w0)),E0!==Object.prototype&&(Qa=E0)):CS=!0);var lG=!iG(Qa)||nG(function(){var n={};return Qa[S0].call(n)!==n});lG?Qa={}:uG&&(Qa=oG(Qa));rG(Qa[S0])||sG(Qa,S0,function(){return this});PS.exports={IteratorPrototype:Qa,BUGGY_SAFARI_ITERATORS:CS}});var bp=at((XK,RS)=>{"use strict";var cG=Pu().f,fG=wa(),hG=Is(),IS=hG("toStringTag");RS.exports=function(n,t,e){n&&!e&&(n=n.prototype),n&&!fG(n,IS)&&cG(n,IS,{configurable:!0,value:t})}});var NS=at((YK,LS)=>{"use strict";var pG=M0().IteratorPrototype,dG=Df(),gG=vp(),mG=bp(),yG=yp(),vG=function(){return this};LS.exports=function(n,t,e,o){var s=t+" Iterator";return n.prototype=dG(pG,{next:gG(+!o,e)}),mG(n,s,!1,!0),yG[s]=vG,n}});var b0=at(($K,OS)=>{"use strict";var _G=mi(),xG=Nf();OS.exports=function(n,t,e){try{return _G(xG(Object.getOwnPropertyDescriptor(n,t)[e]))}catch(o){}}});var FS=at((ZK,DS)=>{"use strict";var EG=Ea();DS.exports=function(n){return EG(n)||n===null}});var BS=at((JK,US)=>{"use strict";var wG=FS(),SG=String,MG=TypeError;US.exports=function(n){if(wG(n))return n;throw new MG("Can't set "+SG(n)+" as a prototype")}});var GS=at((KK,zS)=>{"use strict";var bG=b0(),AG=Ea(),TG=nc(),CG=BS();zS.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n=!1,t={},e;try{e=bG(Object.prototype,"__proto__","set"),e(t,[]),n=t instanceof Array}catch(o){}return function(s,c){return TG(s),CG(c),AG(s)&&(n?e(s,c):s.__proto__=c),s}}():void 0)});var KS=at((jK,JS)=>{"use strict";var PG=Ls(),IG=Rs(),Ap=Lf(),$S=d0(),RG=Di(),LG=NS(),kS=x0(),qS=GS(),NG=bp(),OG=ac(),A0=Uf(),DG=Is(),HS=yp(),ZS=M0(),FG=$S.PROPER,UG=$S.CONFIGURABLE,VS=ZS.IteratorPrototype,Tp=ZS.BUGGY_SAFARI_ITERATORS,zf=DG("iterator"),WS="keys",Gf="values",XS="entries",YS=function(){return this};JS.exports=function(n,t,e,o,s,c,h){LG(e,t,o);var p=function(E){if(E===s&&x)return x;if(!Tp&&E&&E in _)return _[E];switch(E){case WS:return function(){return new e(this,E)};case Gf:return function(){return new e(this,E)};case XS:return function(){return new e(this,E)}}return function(){return new e(this)}},g=t+" Iterator",m=!1,_=n.prototype,w=_[zf]||_["@@iterator"]||s&&_[s],x=!Tp&&w||p(s),b=t==="Array"&&_.entries||w,P,I,S;if(b&&(P=kS(b.call(new n)),P!==Object.prototype&&P.next&&(!Ap&&kS(P)!==VS&&(qS?qS(P,VS):RG(P[zf])||A0(P,zf,YS)),NG(P,g,!0,!0),Ap&&(HS[g]=YS))),FG&&s===Gf&&w&&w.name!==Gf&&(!Ap&&UG?OG(_,"name",Gf):(m=!0,x=function(){return IG(w,this)})),s)if(I={values:p(Gf),keys:c?x:p(WS),entries:p(XS)},h)for(S in I)(Tp||m||!(S in _))&&A0(_,S,I[S]);else PG({target:t,proto:!0,forced:Tp||m},I);return(!Ap||h)&&_[zf]!==x&&A0(_,zf,x,{name:s}),HS[t]=x,I}});var QS=at((QK,jS)=>{"use strict";jS.exports=function(n,t){return{value:n,done:t}}});var oM=at((tj,iM)=>{"use strict";var BG=rc(),T0=a0(),tM=yp(),nM=Ep(),zG=Pu().f,GG=KS(),Cp=QS(),kG=Lf(),qG=Xs(),rM="Array Iterator",HG=nM.set,VG=nM.getterFor(rM);iM.exports=GG(Array,"Array",function(n,t){HG(this,{type:rM,target:BG(n),index:0,kind:t})},function(){var n=VG(this),t=n.target,e=n.index++;if(!t||e>=t.length)return n.target=null,Cp(void 0,!0);switch(n.kind){case"keys":return Cp(e,!1);case"values":return Cp(t[e],!1)}return Cp([e,t[e]],!1)},"values");var eM=tM.Arguments=tM.Array;T0("keys");T0("values");T0("entries");if(!kG&&qG&&eM.name!=="values")try{zG(eM,"name",{value:"values"})}catch(n){}});var Ip=at(()=>{"use strict";var sM=io(),uM=Kx(),WG=iE(),kf=oM(),aM=ac(),XG=bp(),YG=Is(),C0=YG("iterator"),P0=kf.values,lM=function(n,t){if(n){if(n[C0]!==P0)try{aM(n,C0,P0)}catch(o){n[C0]=P0}if(XG(n,t,!0),uM[t]){for(var e in kf)if(n[e]!==kf[e])try{aM(n,e,kf[e])}catch(o){n[e]=kf[e]}}}};for(Pp in uM)lM(sM[Pp]&&sM[Pp].prototype,Pp);var Pp;lM(WG,"DOMTokenList")});var hM=at((rj,fM)=>{"use strict";var $G=Is(),ZG=$G("toStringTag"),cM={};cM[ZG]="z";fM.exports=String(cM)==="[object z]"});var I0=at((ij,pM)=>{"use strict";var JG=hM(),KG=Di(),Rp=ec(),jG=Is(),QG=jG("toStringTag"),t4=Object,e4=Rp(function(){return arguments}())==="Arguments",n4=function(n,t){try{return n[t]}catch(e){}};pM.exports=JG?Rp:function(n){var t,e,o;return n===void 0?"Undefined":n===null?"Null":typeof(e=n4(t=t4(n),QG))=="string"?e:e4?Rp(t):(o=Rp(t))==="Object"&&KG(t.callee)?"Arguments":o}});var Lp=at((oj,dM)=>{"use strict";var r4=I0(),i4=String;dM.exports=function(n){if(r4(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return i4(n)}});var mM=at((sj,gM)=>{"use strict";var o4=Sa();gM.exports=function(){var n=o4(this),t="";return n.hasIndices&&(t+="d"),n.global&&(t+="g"),n.ignoreCase&&(t+="i"),n.multiline&&(t+="m"),n.dotAll&&(t+="s"),n.unicode&&(t+="u"),n.unicodeSets&&(t+="v"),n.sticky&&(t+="y"),t}});var vM=at((aj,yM)=>{"use strict";var R0=gi(),s4=io(),L0=s4.RegExp,N0=R0(function(){var n=L0("a","y");return n.lastIndex=2,n.exec("abcd")!==null}),a4=N0||R0(function(){return!L0("a","y").sticky}),u4=N0||R0(function(){var n=L0("^r","gy");return n.lastIndex=2,n.exec("str")!==null});yM.exports={BROKEN_CARET:u4,MISSED_STICKY:a4,UNSUPPORTED_Y:N0}});var xM=at((uj,_M)=>{"use strict";var l4=gi(),c4=io(),f4=c4.RegExp;_M.exports=l4(function(){var n=f4(".","s");return!(n.dotAll&&n.test(\`
114
+ `,document.body.appendChild(i.canvas)}setAngle(t){if(console.log("angle",t),i.textureMap.has(t))this._initIcon(i.textureMap.get(t));else{this.draw(t);let e=this.getTexture(this.getImageData());i.textureMap.set(t,e),this._initIcon(e),this._initScale({zoom:this.bmap.context.camera.zoom})}}_initIcon(t){if(this.spriteIcon)this.spriteIcon.material.map=t,t.needsUpdate=!0;else{let e=new oe.Sprite(new oe.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI}));e.renderOrder=1e5+this.options.level,t.needsUpdate=!0,this.add(e),e.center.set(.5,.5),this.spriteIcon=e}}initSize(){this.spriteIcon&&this.spriteIcon.center.set(.5,.5)}draw(t){let{ctx:e}=i,{config:{size:n}}=this,r=n[0]/2,o=n[1]/2,s=4,a=1,l=s+a;if(e.clearRect(0,0,n[0],n[1]),e.setLineDash([10,10]),e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),e.arc(r,o,o-l,-Math.PI/2,Math.PI*2-Math.PI/2,t<Math.PI),e.stroke(),e.strokeStyle="#0A7AFF",t<Math.PI){let u=-Math.PI/2,h=u-t;e.beginPath(),e.arc(r,o,o-l,u,h,!0)}else{let u=-Math.PI/2,h=u+Math.PI*2-t;e.beginPath(),e.arc(r,o,o-l,u,h,!1)}e.stroke(),e.clearRect(r-l*2,0,l*4,l*4),e.beginPath(),e.arc(r,l,s,0,Math.PI*2),e.fillStyle="#0A7AFF",e.fill(),e.setLineDash([10,0]),e.strokeStyle="#fff",e.lineWidth=a,e.stroke(),e.clearRect(0,o-5,10,10),e.clearRect(r-5,n[1]-10,10,10),e.clearRect(n[0]-10,o-5,10,10),t>Math.PI/2&&t<Math.PI?e.fillStyle="#0A7AFF":e.fillStyle="#fff",e.fillRect(0,o-1,10,2),e.fillStyle="#fff",e.fillRect(r-1,n[1]-10,2,10),t>Math.PI&&t<Math.PI/2*3?e.fillStyle="#0A7AFF":e.fillStyle="#fff",e.fillRect(n[0]-10,o-1,10,2)}getImageData(){let{ctx:t}=i,{config:{size:e}}=this;return t.getImageData(0,0,e[0],e[1])}getTexture(t){let{config:{size:e}}=this,n=new oe.DataTexture(Uint8Array.from(t.data),e[0],e[1],oe.RGBAFormat);return n.format=oe.RGBAFormat,n.magFilter=oe.LinearFilter,n.minFilter=oe.LinearFilter,n.colorSpace="srgb",n.flipY=!0,n}dispose(){var t;super.dispose(),(t=this.spriteIcon)==null||t.material.dispose()}static dispose(){this.textureMap.forEach(t=>{t.dispose()}),this.textureMap.clear(),this.ctx=null,this.canvas=null}constructor(t,e){super(t.context,{icon_size:e.size,collision_enable:!1,level:2}),this.bmap=t,this.config=e,i.canvas.width=e.size[0],i.canvas.height=e.size[1]}};sn.canvas=document.createElement("canvas");sn.ctx=sn.canvas.getContext("2d",{willReadFrequently:!0});sn.textureMap=new Map;var u3={path:{},cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},positionNavigation:{},offsetY:150,directionEmitThreshold:5,disablePathAnimation:!1,speed:1,roadData:[],runAnimationMaxTime:1},rc=class extends vt{get curFloorPathLength(){var t,e;return(e=(t=this.curFloorPath)==null?void 0:t.distance)!=null?e:0}get curFloorPathPoints(){var t,e;return(e=(t=this.curFloorPath)==null?void 0:t.points)!=null?e:[]}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener(Pt.SWITCH_FLOOR_AFTER,this.onSwitchFloor),this.positionNavigation.addEventListener("navigation-info",this.onNavigationInfo),this.bmap.context.addEventListener("control-change",this.onControlChangeForStartPoi)}showStartRotateHelperPoi(){var t;if(this.needStartRotateHelperPoi=!0,!this.startPoi||this.startRotateHelperPoi)return;let e=this.startPoi.options.icon_size;this.startRotateHelperPoi=new sn(this.bmap,{size:[e[0]+20,e[1]+20]}),this.startRotateHelperPoi.setAngle(0),this.startRotateHelperPoi.position.setZ(.51),(t=this.bmap.context.currentFloor)==null||t.poiLayer2.pushPoi(this.startRotateHelperPoi)}hideStartRotateHelperPoi(){if(this.needStartRotateHelperPoi=!1,this.startRotateHelperPoi){var t;(t=this.bmap.context.currentFloor)==null||t.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}setStartPoiPosition(t,e){this.startPoi&&(this.startPoi.position.setX(t).setY(e),this.startRotateHelperPoi&&this.startRotateHelperPoi.position.setX(t).setY(e))}toPositionByTask(t){var e;let r=(e=this.taskQueue.getTasks().find(s=>s.meta.type==="toPosition"))==null?void 0:e.tid,o={run:()=>this.toPositionBySpeed(t,this.options.speed),meta:{type:"toPosition"}};r?this.taskQueue.replace(r,o):this.taskQueue.add(o)}pauseAnimation(){this.taskQueue.clear(),this.positionNavigation.pause(),this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue(),this.positionNavigation.continue()}clearTween(){this.tweenUtil.clear(),this.taskQueue.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener(Pt.SWITCH_FLOOR_AFTER,this.onSwitchFloor),this.positionNavigation.removeEventListener("navigation-info",this.onNavigationInfo),this.bmap.context.removeEventListener("control-change",this.onControlChangeForStartPoi)}clearPath(){if(this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.clearTween()),this.startPoi){var t;if((t=this.bmap.context.currentFloor)==null||t.poiLayer2.removePoi(this.startPoi),this.startPoi=null,this.startRotateHelperPoi){var e;(e=this.bmap.context.currentFloor)==null||e.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}this.translatePath=null}setCurFloorPath(t){t===null?(this.curFloorPath=null,this.currentPathPosition=null,this.toPointPosition=null):(this.curFloorPath=t,this.currentPathPosition=t.points[0],this.toPointPosition=t.points[0]),this.movedDistance=0,this.clearTween()}setCurPathIndex(t){var e,n;this.curPathIndex=t,((e=this.paths[t])==null?void 0:e.floor)===((n=this.bmap.context.currentFloor)==null?void 0:n.name)?(this.setCurFloorPath(this.paths[t]),this.renderPath(this.translatePoints(this.curFloorPathPoints))):this.clearPath()}addPath(t,e){e===void 0&&(e=0);var n;this.paths=t,this.curPathIndex=e,this.clearTween();let r=(n=this.bmap.context.currentFloor)==null?void 0:n.name,o=t[e];if(r&&(o==null?void 0:o.floor)===r)if(this.setCurFloorPath(o),this.bmap.currentBuildGround)this.renderPath(this.translatePoints(o.points));else{let s=()=>{this.bmap.removeEventListener("center-change",s),this.renderPath(this.translatePoints(o.points))};this.bmap.addEventListener("center-change",s)}else this.clearPath();this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,n]=this.bmap.buildingCenter;return t.map(r=>[r[0]-e,r[1]-n])}renderPath(t){this.translatePath=t;let e=this.catmullRomCurve3(t);if(this.cPath=e,this.animationPathOptions={cPathIndex:0},this.pathStart=e[0],this.path?this.path.updatePoints(e):(this.path=new va(this,this.options.path),this.path.create(e),this.path.position.z=this.bmap.context.currentFloor.groundMaxHeight+.5,this.bmap.context.scene.add(this.path)),this.path.movePath(0),this.startPoi){var n;if((n=this.bmap.context.currentFloor)==null||n.poiLayer2.removePoi(this.startPoi),this.startPoi=null,this.startRotateHelperPoi){var r;(r=this.bmap.context.currentFloor)==null||r.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}if(this.options.needStartPoi){var o;this.startPoi=new st(this.bmap.context,w({},this.options.startPoi,{id:"navigation_start_poi",position:{x:e[0][0],y:e[0][1],z:.51},collision_enable:!1}))||null,(o=this.bmap.context.currentFloor)==null||o.poiLayer2.pushPoi(this.startPoi),this.needStartRotateHelperPoi&&this.showStartRotateHelperPoi(),console.log(this.startRotateHelperPoi)}this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(t){return wr(t,!1,!0,.1,170,2.5)}getPathDirection(){if(!this.curFloorPath||!this.currentPathPosition||this.curFloorPathPoints.length<2)return null;let t=ve(this.curFloorPathPoints,this.currentPathPosition),e=this.curFloorPathPoints[t],n=this.curFloorPathPoints[t+1],r=new Re.Vector3(n[0]-e[0],n[1]-e[1],0).normalize(),o=new Re.Vector3(0,1,0).normalize(),s=r.angleTo(o),a=new Re.Vector3().crossVectors(o,r);return(Object.is(a.y,0)?-1:1)*s}getPathDirection2(){if(!this.curFloorPath||!this.toPointPosition||this.curFloorPathPoints.length<2)return null;let t=ve(this.curFloorPathPoints,this.toPointPosition),e=this.curFloorPathPoints[t],n=this.curFloorPathPoints[t+1];return(new Re.Vector2(n[0]-e[0],n[1]-e[1]).normalize().angle()*180/Math.PI-90+360)%360}changeCameraToPathUp(t){return g(this,null,function*(){t===void 0&&(t=100);let e=this.getPathDirection();if(e===null)return;let n=this.bmap.context.control.getAzimuthalAngle();Math.abs(n-e)>Math.PI&&(n>0?e=Math.PI*2+e:e=e-Math.PI*2);let r=Math.abs(e-this.bmap.context.control.getAzimuthalAngle());if(r<.01)return;let{control:o}=this.bmap.context,s=t/Math.PI*6*r;return zt(new Promise(a=>{let l={azimuthal:o.getAzimuthalAngle()},u={azimuthal:e},h=o.getPolarAngle(),{maxPolarAngle:c,minPolarAngle:p}=o;o.maxPolarAngle=h,o.minPolarAngle=h;let m=new Ui.Tween(l,this.tweenUtil.group).to(u,s).easing(Ui.Easing.Quadratic.InOut).onUpdate(()=>g(this,null,function*(){this.startPoi&&o.target.copy(this.startPoi.position),o.setAzimuthalAngle(l.azimuthal,!0),o.setTargetByOffset(this.options.offsetY)})).onComplete(()=>{o.enabled=!0,this.tweenUtil.remove(m),o.maxPolarAngle=c,o.minPolarAngle=p,a(!0)}).onStart(()=>{o.enabled=!1}).start()}),s+500).finally(()=>{this.bmap.context.control.enabled=!0})})}initNavigationCamera(t){return g(this,null,function*(){t===void 0&&(t=1e3);var e;let r=(e=this.taskQueue.getTasks().find(s=>s.meta.type==="initNavigationCamera"))==null?void 0:e.tid,o={run:()=>zt(g(this,null,function*(){yield this.initCameraZoom(t/2),yield this.changeCameraToPathUp(t/4),yield this.translateCameraToStartPoi(t/4)}),t+500).finally(()=>{this.bmap.context.control.enabled=!0}),meta:{type:"initNavigationCamera"}};r?this.taskQueue.replace(r,o):this.taskQueue.add(o)})}translateCameraToStartPoi(t){return g(this,null,function*(){if(t===void 0&&(t=100),!this.startPoi)return;let{clientSize:{width:e,height:n},camera:r,control:o}=this.bmap.context,s=Math.round(e/2),a=Math.round(n/2),l=o.target.clone(),u=D(this.startPoi.position,r,e,n),h=u.x-s,c=a-u.y+this.options.offsetY;if(!(Math.abs(h)<=1&&Math.abs(c)<=1)){if(Math.abs(h)>=1){let p=new Re.Vector3;p.setFromMatrixColumn(r.matrix,0),p.normalize(),p.multiplyScalar(h/r.zoom),l.add(new Re.Vector3(p.x,p.y,0))}if(Math.abs(c)>=1){let p=new Re.Vector3;p.setFromMatrixColumn(r.matrix,1),p.normalize(),p.multiplyScalar(c/r.zoom),l.add(new Re.Vector3(p.x,p.y,0))}return zt(new Promise(p=>{let m=o.target.clone();console.log(m,l,t);let y=new Ui.Tween(m,this.tweenUtil.group).to(l,t).onUpdate(()=>{this.bmap.context.control.setCameraPositionByTarget(m,0)}).onComplete(()=>{this.bmap.context.control.setCameraPositionByTarget(l,0),this.tweenUtil.remove(y),this.bmap.context.control.enabled=!0,p(!0)}).onStart(()=>{this.bmap.context.control.enabled=!1}).start()}),t+500).then(()=>{this.bmap.context.control.enabled=!0})}})}initCameraZoom(t){return g(this,null,function*(){if(t===void 0&&(t=100),!this.startPoi)return;let{clientSize:{width:e,height:n},currentFloor:r}=this.bmap.context,{max:o,min:s}=r.box,l=Math.min(e/(o.x-s.x),n/(o.y-s.y))*(o.x-s.x)/45;return this.bmap.context.setZoom(l,this.startPoi.position,t).finally(()=>{this.bmap.context.control.enabled=!0})})}toPosition(t,e){this.positionNavigation.toPosition(t,e)}startSimulation(){this.positionNavigation.startSimulation()}setSimulationSpeed(t){this.positionNavigation.changeSimulationSpeed(t)}toPositionBySpeed(t,e){return g(this,null,function*(){let{currentPathPosition:n,curFloorPath:r,curFloorPathPoints:o}=this;if(!r||!n)return null;let s=this.movedDistance,a=Cl(o,t);if(s===-1||a===-1||a<=s)return null;let l=a-s;if(!l)return;let u=Math.min(l/e,this.options.runAnimationMaxTime);return this.pathTween&&this.clearTween(),zt(new Promise(h=>{let c=this.pathTween=new Ui.Tween({distance:0},this.tweenUtil.group).to({distance:l},u*1e3).onUpdate(p=>g(this,null,function*(){this.moveDistance(p.distance+s,c)})).onComplete(()=>{this.tweenUtil.remove(c),h(!0)}).start()}),u*1e3+500).finally(()=>{this.bmap.context.control.enabled=!0})})}moveDistance(t,e){return g(this,null,function*(){var n;this.movedDistance=t,(n=this.path)==null||n.movePath(this.movedDistance/this.curFloorPathLength);let r=Gn(this.curFloorPathPoints,this.movedDistance);if(r===null)return;this.currentPathPosition=r;let o=this.translatePoints([r])[0];this.startPoi&&(this.setStartPoiPosition(o[0],o[1]),this.options.disablePathAnimation||this.bmap.context.control.setTargetByOffset(this.options.offsetY,this.startPoi.position.clone())),this.options.disablePathAnimation||(e==null||e.pause(),yield this.changeCameraToPathUp(500/this.options.speed),e==null||e.resume())})}setStartPoiRotate(t){if(this.startPoiRotate=t,this.startPoi){let n=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(360-t-n)%360,this.startRotateHelperPoi&&this.startRotateHelperPoi.setAngle((360-t-n)%360)}}dispose(){var t,e;this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.tweenUtil.dispose(),this.unRegistryEvent(),(t=this.startPoi)==null||t.dispose(),(e=this.startRotateHelperPoi)==null||e.dispose(),sn.dispose(),this.positionNavigation.dispose(),this.startRotateHelperPoi=null,super.dispose()}constructor(t,e={},n){super(t),this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curPathIndex=0,this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.toPointPosition=null,this.pathTween=null,this.startPoi=null,this.startPoiRotate=0,this.startRotateHelperPoi=null,this.needStartRotateHelperPoi=!1,this.movedDistance=0,this.pathStart=[0,0],this.tweenUtil=new qe,this.taskQueue=new Vn,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onNavigationInfo=r=>{let{info:o}=r;if(this.dispatchEvent({type:"navigation-info",info:o}),!o.offset){if(o.routeIndex!==this.curPathIndex)return;this.toPointPosition=o.pos,this.toPositionByTask(o.pos)}},this.onUpdate=()=>{this.tweenUtil.update()},this.onSwitchFloor=r=>{let{data:{curFloor:o}}=r;if(this.clearTween(),this.paths[this.curPathIndex]){let s=this.paths[this.curPathIndex];this.setCurFloorPath(s!=null?s:null),s?this.renderPath(this.translatePoints(s.points)):this.clearPath()}else this.clearPath()},this.onControlChangeForStartPoi=()=>{this.startPoi&&this.setStartPoiRotate(this.startPoiRotate)},!n&&typeof e=="object"&&(n=e),this.options=Object.assign({},u3,n),this.positionNavigation=new xa(this,w({simulationSpeed:this.options.speed},this.options.positionNavigation),this.options.roadData),this.registryEvent()}};var RL=f(I(),1);var Ni=require("three"),oc=class extends vt{show(t){let e=0;t.forEach(o=>{o.poiLayer2.pois.forEach(s=>{let a=new Ni.Vector3().setFromMatrixPosition(s.matrixWorld).z;s.position.setZ(a+e),s.options.depth_test=!0,this.poiLayer.pushPoi(s)}),o.poiLayer2.pois.length=0,o.poiLayer2.dispose(),o.position.z=e,e+=o.userData.height});let{scene:n,currentFloor:r}=this.bmap.context;r&&(n.remove(r),r.dispose()),this.group.add(this.poiLayer,...t),n.add(this.group),this.floors=t,this.fitCamera(),this.bmap.context.cameraBound.updateBox(),this.showStatus=!0}hide(){let{scene:t}=this.bmap.context;t.remove(this.group),this.poiLayer.clear(),this.floors.forEach(e=>{e.dispose()}),this.floors=[],this.group.clear(),this.showStatus=!1}fitCamera(){let{context:t,config:e,type:n}=this.bmap;t.cameraBound.setEnable(!1),t.control.minZoom=0,t.control.maxZoom=1/0,t.camera.zoom=1,t.setAzimuthalAngle(e.control.defaultAzimuthal,0),t.setPolarAngle(e.control.defaultPolar,0),t.fitCameraToObject(this.group,e.defaultPadding,0);let r=t.camera.zoom;t.control.minZoom=r,t.control.maxZoom=r*25,n==="3d"&&t.fitCameraToObject(this.group,e.defaultPadding,0,!1),this.bmap.basicZoom=t.camera.zoom,t.control.addEventListener("change",this.bmap.onControlChange.bind(this.bmap)),this.bmap.onControlChange(),t.cameraBound.setEnable(!0)}dispose(){this.poiLayer.dispose(),this.floors.forEach(t=>t.dispose()),this.floors=[],super.dispose()}constructor(t){super(t),this.floors=[],this.group=new Ni.Group,this.showStatus=!1,this.group.name="mul-floor-group",this.poiLayer=new ei(t.context),this.poiLayer.changeParkingSpaceVisibleByZoom=()=>{let e=new Ni.Box3().setFromObject(this.group),{clientSize:{width:n,height:r}}=this.bmap.context,{max:o,min:s}=e,l=Math.min(n/(o.x-s.x),r/(o.y-s.y))*(o.x-s.x)/45;this.poiLayer.pois.filter(u=>u.userData.type==="parkingSpace").map(u=>{let h=this.bmap.context.camera.zoom>=l;u.visible=h,h||u.parentSetVisible(h)})}}};var H1=require("three");function sc(){let i=new Blob([`var xF=Object.create;var $x=Object.defineProperty;var EF=Object.getOwnPropertyDescriptor;var wF=Object.getOwnPropertyNames;var SF=Object.getPrototypeOf,MF=Object.prototype.hasOwnProperty;var at=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var bF=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of wF(t))!MF.call(n,s)&&s!==e&&$x(n,s,{get:()=>t[s],enumerable:!(o=EF(t,s))||o.enumerable});return n};var Ze=(n,t,e)=>(e=n!=null?xF(SF(n)):{},bF(t||!n||!n.__esModule?$x(e,"default",{value:n,enumerable:!0}):e,n));var np=(n,t,e)=>new Promise((o,s)=>{var c=g=>{try{p(e.next(g))}catch(m){s(m)}},h=g=>{try{p(e.throw(g))}catch(m){s(m)}},p=g=>g.done?o(g.value):Promise.resolve(g.value).then(c,h);p((e=e.apply(n,t)).next())});var io=at((Im,Zx)=>{"use strict";var If=function(n){return n&&n.Math===Math&&n};Zx.exports=If(typeof globalThis=="object"&&globalThis)||If(typeof window=="object"&&window)||If(typeof self=="object"&&self)||If(typeof global=="object"&&global)||If(typeof Im=="object"&&Im)||function(){return this}()||Function("return this")()});var Kx=at((bJ,Jx)=>{"use strict";Jx.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var Di=at((AJ,jx)=>{"use strict";var Rm=typeof document=="object"&&document.all;jx.exports=typeof Rm=="undefined"&&Rm!==void 0?function(n){return typeof n=="function"||n===Rm}:function(n){return typeof n=="function"}});var Ea=at((TJ,Qx)=>{"use strict";var AF=Di();Qx.exports=function(n){return typeof n=="object"?n!==null:AF(n)}});var rp=at((CJ,eE)=>{"use strict";var TF=io(),tE=Ea(),Lm=TF.document,CF=tE(Lm)&&tE(Lm.createElement);eE.exports=function(n){return CF?Lm.createElement(n):{}}});var iE=at((PJ,rE)=>{"use strict";var PF=rp(),Nm=PF("span").classList,nE=Nm&&Nm.constructor&&Nm.constructor.prototype;rE.exports=nE===Object.prototype?void 0:nE});var gi=at((IJ,oE)=>{"use strict";oE.exports=function(n){try{return!!n()}catch(t){return!0}}});var Rf=at((RJ,sE)=>{"use strict";var IF=gi();sE.exports=!IF(function(){var n=function(){}.bind();return typeof n!="function"||n.hasOwnProperty("prototype")})});var mi=at((LJ,lE)=>{"use strict";var aE=Rf(),uE=Function.prototype,Om=uE.call,RF=aE&&uE.bind.bind(Om,Om);lE.exports=aE?RF:function(n){return function(){return Om.apply(n,arguments)}}});var ec=at((NJ,fE)=>{"use strict";var cE=mi(),LF=cE({}.toString),NF=cE("".slice);fE.exports=function(n){return NF(LF(n),8,-1)}});var pE=at((OJ,hE)=>{"use strict";var OF=mi(),DF=gi(),FF=ec(),Dm=Object,UF=OF("".split);hE.exports=DF(function(){return!Dm("z").propertyIsEnumerable(0)})?function(n){return FF(n)==="String"?UF(n,""):Dm(n)}:Dm});var ip=at((DJ,dE)=>{"use strict";dE.exports=function(n){return n==null}});var nc=at((FJ,gE)=>{"use strict";var BF=ip(),zF=TypeError;gE.exports=function(n){if(BF(n))throw new zF("Can't call method on "+n);return n}});var rc=at((UJ,mE)=>{"use strict";var GF=pE(),kF=nc();mE.exports=function(n){return GF(kF(n))}});var Lf=at((BJ,yE)=>{"use strict";yE.exports=!1});var op=at((zJ,_E)=>{"use strict";var vE=io(),qF=Object.defineProperty;_E.exports=function(n,t){try{qF(vE,n,{value:t,configurable:!0,writable:!0})}catch(e){vE[n]=t}return t}});var sp=at((GJ,wE)=>{"use strict";var HF=Lf(),VF=io(),WF=op(),xE="__core-js_shared__",EE=wE.exports=VF[xE]||WF(xE,{});(EE.versions||(EE.versions=[])).push({version:"3.39.0",mode:HF?"pure":"global",copyright:"\\xA9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var ap=at((kJ,ME)=>{"use strict";var SE=sp();ME.exports=function(n,t){return SE[n]||(SE[n]=t||{})}});var ic=at((qJ,bE)=>{"use strict";var XF=nc(),YF=Object;bE.exports=function(n){return YF(XF(n))}});var wa=at((HJ,AE)=>{"use strict";var $F=mi(),ZF=ic(),JF=$F({}.hasOwnProperty);AE.exports=Object.hasOwn||function(t,e){return JF(ZF(t),e)}});var Fm=at((VJ,TE)=>{"use strict";var KF=mi(),jF=0,QF=Math.random(),tU=KF(1 .toString);TE.exports=function(n){return"Symbol("+(n===void 0?"":n)+")_"+tU(++jF+QF,36)}});var RE=at((WJ,IE)=>{"use strict";var eU=io(),CE=eU.navigator,PE=CE&&CE.userAgent;IE.exports=PE?String(PE):""});var BE=at((XJ,UE)=>{"use strict";var FE=io(),Um=RE(),LE=FE.process,NE=FE.Deno,OE=LE&&LE.versions||NE&&NE.version,DE=OE&&OE.v8,Ws,up;DE&&(Ws=DE.split("."),up=Ws[0]>0&&Ws[0]<4?1:+(Ws[0]+Ws[1]));!up&&Um&&(Ws=Um.match(/Edge\\/(\\d+)/),(!Ws||Ws[1]>=74)&&(Ws=Um.match(/Chrome\\/(\\d+)/),Ws&&(up=+Ws[1])));UE.exports=up});var Bm=at((YJ,GE)=>{"use strict";var zE=BE(),nU=gi(),rU=io(),iU=rU.String;GE.exports=!!Object.getOwnPropertySymbols&&!nU(function(){var n=Symbol("symbol detection");return!iU(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&zE&&zE<41})});var zm=at(($J,kE)=>{"use strict";var oU=Bm();kE.exports=oU&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Is=at((ZJ,HE)=>{"use strict";var sU=io(),aU=ap(),qE=wa(),uU=Fm(),lU=Bm(),cU=zm(),oc=sU.Symbol,Gm=aU("wks"),fU=cU?oc.for||oc:oc&&oc.withoutSetter||uU;HE.exports=function(n){return qE(Gm,n)||(Gm[n]=lU&&qE(oc,n)?oc[n]:fU("Symbol."+n)),Gm[n]}});var Sa=at((JJ,VE)=>{"use strict";var hU=Ea(),pU=String,dU=TypeError;VE.exports=function(n){if(hU(n))return n;throw new dU(pU(n)+" is not an object")}});var Xs=at((KJ,WE)=>{"use strict";var gU=gi();WE.exports=!gU(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var km=at((jJ,XE)=>{"use strict";var mU=Xs(),yU=gi();XE.exports=mU&&yU(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var qm=at((QJ,YE)=>{"use strict";var vU=Xs(),_U=gi(),xU=rp();YE.exports=!vU&&!_U(function(){return Object.defineProperty(xU("div"),"a",{get:function(){return 7}}).a!==7})});var Rs=at((tK,$E)=>{"use strict";var EU=Rf(),lp=Function.prototype.call;$E.exports=EU?lp.bind(lp):function(){return lp.apply(lp,arguments)}});var sc=at((eK,ZE)=>{"use strict";var Hm=io(),wU=Di(),SU=function(n){return wU(n)?n:void 0};ZE.exports=function(n,t){return arguments.length<2?SU(Hm[n]):Hm[n]&&Hm[n][t]}});var KE=at((nK,JE)=>{"use strict";var MU=mi();JE.exports=MU({}.isPrototypeOf)});var Vm=at((rK,jE)=>{"use strict";var bU=sc(),AU=Di(),TU=KE(),CU=zm(),PU=Object;jE.exports=CU?function(n){return typeof n=="symbol"}:function(n){var t=bU("Symbol");return AU(t)&&TU(t.prototype,PU(n))}});var tw=at((iK,QE)=>{"use strict";var IU=String;QE.exports=function(n){try{return IU(n)}catch(t){return"Object"}}});var Nf=at((oK,ew)=>{"use strict";var RU=Di(),LU=tw(),NU=TypeError;ew.exports=function(n){if(RU(n))return n;throw new NU(LU(n)+" is not a function")}});var cp=at((sK,nw)=>{"use strict";var OU=Nf(),DU=ip();nw.exports=function(n,t){var e=n[t];return DU(e)?void 0:OU(e)}});var iw=at((aK,rw)=>{"use strict";var Wm=Rs(),Xm=Di(),Ym=Ea(),FU=TypeError;rw.exports=function(n,t){var e,o;if(t==="string"&&Xm(e=n.toString)&&!Ym(o=Wm(e,n))||Xm(e=n.valueOf)&&!Ym(o=Wm(e,n))||t!=="string"&&Xm(e=n.toString)&&!Ym(o=Wm(e,n)))return o;throw new FU("Can't convert object to primitive value")}});var uw=at((uK,aw)=>{"use strict";var UU=Rs(),ow=Ea(),sw=Vm(),BU=cp(),zU=iw(),GU=Is(),kU=TypeError,qU=GU("toPrimitive");aw.exports=function(n,t){if(!ow(n)||sw(n))return n;var e=BU(n,qU),o;if(e){if(t===void 0&&(t="default"),o=UU(e,n,t),!ow(o)||sw(o))return o;throw new kU("Can't convert object to primitive value")}return t===void 0&&(t="number"),zU(n,t)}});var $m=at((lK,lw)=>{"use strict";var HU=uw(),VU=Vm();lw.exports=function(n){var t=HU(n,"string");return VU(t)?t:t+""}});var Pu=at(fw=>{"use strict";var WU=Xs(),XU=qm(),YU=km(),fp=Sa(),cw=$m(),$U=TypeError,Zm=Object.defineProperty,ZU=Object.getOwnPropertyDescriptor,Jm="enumerable",Km="configurable",jm="writable";fw.f=WU?YU?function(t,e,o){if(fp(t),e=cw(e),fp(o),typeof t=="function"&&e==="prototype"&&"value"in o&&jm in o&&!o[jm]){var s=ZU(t,e);s&&s[jm]&&(t[e]=o.value,o={configurable:Km in o?o[Km]:s[Km],enumerable:Jm in o?o[Jm]:s[Jm],writable:!1})}return Zm(t,e,o)}:Zm:function(t,e,o){if(fp(t),e=cw(e),fp(o),XU)try{return Zm(t,e,o)}catch(s){}if("get"in o||"set"in o)throw new $U("Accessors not supported");return"value"in o&&(t[e]=o.value),t}});var pw=at((fK,hw)=>{"use strict";var JU=Math.ceil,KU=Math.floor;hw.exports=Math.trunc||function(t){var e=+t;return(e>0?KU:JU)(e)}});var ml=at((hK,dw)=>{"use strict";var jU=pw();dw.exports=function(n){var t=+n;return t!==t||t===0?0:jU(t)}});var mw=at((pK,gw)=>{"use strict";var QU=ml(),tB=Math.max,eB=Math.min;gw.exports=function(n,t){var e=QU(n);return e<0?tB(e+t,0):eB(e,t)}});var Qm=at((dK,yw)=>{"use strict";var nB=ml(),rB=Math.min;yw.exports=function(n){var t=nB(n);return t>0?rB(t,9007199254740991):0}});var Of=at((gK,vw)=>{"use strict";var iB=Qm();vw.exports=function(n){return iB(n.length)}});var Ew=at((mK,xw)=>{"use strict";var oB=rc(),sB=mw(),aB=Of(),_w=function(n){return function(t,e,o){var s=oB(t),c=aB(s);if(c===0)return!n&&-1;var h=sB(o,c),p;if(n&&e!==e){for(;c>h;)if(p=s[h++],p!==p)return!0}else for(;c>h;h++)if((n||h in s)&&s[h]===e)return n||h||0;return!n&&-1}};xw.exports={includes:_w(!0),indexOf:_w(!1)}});var hp=at((yK,ww)=>{"use strict";ww.exports={}});var e0=at((vK,Mw)=>{"use strict";var uB=mi(),t0=wa(),lB=rc(),cB=Ew().indexOf,fB=hp(),Sw=uB([].push);Mw.exports=function(n,t){var e=lB(n),o=0,s=[],c;for(c in e)!t0(fB,c)&&t0(e,c)&&Sw(s,c);for(;t.length>o;)t0(e,c=t[o++])&&(~cB(s,c)||Sw(s,c));return s}});var pp=at((_K,bw)=>{"use strict";bw.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Tw=at((xK,Aw)=>{"use strict";var hB=e0(),pB=pp();Aw.exports=Object.keys||function(t){return hB(t,pB)}});var Pw=at(Cw=>{"use strict";var dB=Xs(),gB=km(),mB=Pu(),yB=Sa(),vB=rc(),_B=Tw();Cw.f=dB&&!gB?Object.defineProperties:function(t,e){yB(t);for(var o=vB(e),s=_B(e),c=s.length,h=0,p;c>h;)mB.f(t,p=s[h++],o[p]);return t}});var Rw=at((wK,Iw)=>{"use strict";var xB=sc();Iw.exports=xB("document","documentElement")});var dp=at((SK,Nw)=>{"use strict";var EB=ap(),wB=Fm(),Lw=EB("keys");Nw.exports=function(n){return Lw[n]||(Lw[n]=wB(n))}});var Df=at((MK,Gw)=>{"use strict";var SB=Sa(),MB=Pw(),Ow=pp(),bB=hp(),AB=Rw(),TB=rp(),CB=dp(),Dw=">",Fw="<",r0="prototype",i0="script",Bw=CB("IE_PROTO"),n0=function(){},zw=function(n){return Fw+i0+Dw+n+Fw+"/"+i0+Dw},Uw=function(n){n.write(zw("")),n.close();var t=n.parentWindow.Object;return n=null,t},PB=function(){var n=TB("iframe"),t="java"+i0+":",e;return n.style.display="none",AB.appendChild(n),n.src=String(t),e=n.contentWindow.document,e.open(),e.write(zw("document.F=Object")),e.close(),e.F},gp,mp=function(){try{gp=new ActiveXObject("htmlfile")}catch(t){}mp=typeof document!="undefined"?document.domain&&gp?Uw(gp):PB():Uw(gp);for(var n=Ow.length;n--;)delete mp[r0][Ow[n]];return mp()};bB[Bw]=!0;Gw.exports=Object.create||function(t,e){var o;return t!==null?(n0[r0]=SB(t),o=new n0,n0[r0]=null,o[Bw]=t):o=mp(),e===void 0?o:MB.f(o,e)}});var a0=at((bK,kw)=>{"use strict";var IB=Is(),RB=Df(),LB=Pu().f,o0=IB("unscopables"),s0=Array.prototype;s0[o0]===void 0&&LB(s0,o0,{configurable:!0,value:RB(null)});kw.exports=function(n){s0[o0][n]=!0}});var yp=at((AK,qw)=>{"use strict";qw.exports={}});var Ww=at((TK,Vw)=>{"use strict";var NB=io(),OB=Di(),Hw=NB.WeakMap;Vw.exports=OB(Hw)&&/native code/.test(String(Hw))});var vp=at((CK,Xw)=>{"use strict";Xw.exports=function(n,t){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:t}}});var ac=at((PK,Yw)=>{"use strict";var DB=Xs(),FB=Pu(),UB=vp();Yw.exports=DB?function(n,t,e){return FB.f(n,t,UB(1,e))}:function(n,t,e){return n[t]=e,n}});var Ep=at((IK,Jw)=>{"use strict";var BB=Ww(),Zw=io(),zB=Ea(),GB=ac(),u0=wa(),l0=sp(),kB=dp(),qB=hp(),$w="Object already initialized",c0=Zw.TypeError,HB=Zw.WeakMap,_p,Ff,xp,VB=function(n){return xp(n)?Ff(n):_p(n,{})},WB=function(n){return function(t){var e;if(!zB(t)||(e=Ff(t)).type!==n)throw new c0("Incompatible receiver, "+n+" required");return e}};BB||l0.state?(Ys=l0.state||(l0.state=new HB),Ys.get=Ys.get,Ys.has=Ys.has,Ys.set=Ys.set,_p=function(n,t){if(Ys.has(n))throw new c0($w);return t.facade=n,Ys.set(n,t),t},Ff=function(n){return Ys.get(n)||{}},xp=function(n){return Ys.has(n)}):(yl=kB("state"),qB[yl]=!0,_p=function(n,t){if(u0(n,yl))throw new c0($w);return t.facade=n,GB(n,yl,t),t},Ff=function(n){return u0(n,yl)?n[yl]:{}},xp=function(n){return u0(n,yl)});var Ys,yl;Jw.exports={set:_p,get:Ff,has:xp,enforce:VB,getterFor:WB}});var tS=at(Qw=>{"use strict";var Kw={}.propertyIsEnumerable,jw=Object.getOwnPropertyDescriptor,XB=jw&&!Kw.call({1:2},1);Qw.f=XB?function(t){var e=jw(this,t);return!!e&&e.enumerable}:Kw});var f0=at(nS=>{"use strict";var YB=Xs(),$B=Rs(),ZB=tS(),JB=vp(),KB=rc(),jB=$m(),QB=wa(),tz=qm(),eS=Object.getOwnPropertyDescriptor;nS.f=YB?eS:function(t,e){if(t=KB(t),e=jB(e),tz)try{return eS(t,e)}catch(o){}if(QB(t,e))return JB(!$B(ZB.f,t,e),t[e])}});var d0=at((NK,iS)=>{"use strict";var h0=Xs(),ez=wa(),rS=Function.prototype,nz=h0&&Object.getOwnPropertyDescriptor,p0=ez(rS,"name"),rz=p0&&function(){}.name==="something",iz=p0&&(!h0||h0&&nz(rS,"name").configurable);iS.exports={EXISTS:p0,PROPER:rz,CONFIGURABLE:iz}});var m0=at((OK,oS)=>{"use strict";var oz=mi(),sz=Di(),g0=sp(),az=oz(Function.toString);sz(g0.inspectSource)||(g0.inspectSource=function(n){return az(n)});oS.exports=g0.inspectSource});var lS=at((DK,uS)=>{"use strict";var v0=mi(),uz=gi(),lz=Di(),wp=wa(),y0=Xs(),cz=d0().CONFIGURABLE,fz=m0(),aS=Ep(),hz=aS.enforce,pz=aS.get,sS=String,Sp=Object.defineProperty,dz=v0("".slice),gz=v0("".replace),mz=v0([].join),yz=y0&&!uz(function(){return Sp(function(){},"length",{value:8}).length!==8}),vz=String(String).split("String"),_z=uS.exports=function(n,t,e){dz(sS(t),0,7)==="Symbol("&&(t="["+gz(sS(t),/^Symbol\\(([^)]*)\\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!wp(n,"name")||cz&&n.name!==t)&&(y0?Sp(n,"name",{value:t,configurable:!0}):n.name=t),yz&&e&&wp(e,"arity")&&n.length!==e.arity&&Sp(n,"length",{value:e.arity});try{e&&wp(e,"constructor")&&e.constructor?y0&&Sp(n,"prototype",{writable:!1}):n.prototype&&(n.prototype=void 0)}catch(s){}var o=hz(n);return wp(o,"source")||(o.source=mz(vz,typeof t=="string"?t:"")),n};Function.prototype.toString=_z(function(){return lz(this)&&pz(this).source||fz(this)},"toString")});var Uf=at((FK,cS)=>{"use strict";var xz=Di(),Ez=Pu(),wz=lS(),Sz=op();cS.exports=function(n,t,e,o){o||(o={});var s=o.enumerable,c=o.name!==void 0?o.name:t;if(xz(e)&&wz(e,c,o),o.global)s?n[t]=e:Sz(t,e);else{try{o.unsafe?n[t]&&(s=!0):delete n[t]}catch(h){}s?n[t]=e:Ez.f(n,t,{value:e,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return n}});var hS=at(fS=>{"use strict";var Mz=e0(),bz=pp(),Az=bz.concat("length","prototype");fS.f=Object.getOwnPropertyNames||function(t){return Mz(t,Az)}});var dS=at(pS=>{"use strict";pS.f=Object.getOwnPropertySymbols});var mS=at((zK,gS)=>{"use strict";var Tz=sc(),Cz=mi(),Pz=hS(),Iz=dS(),Rz=Sa(),Lz=Cz([].concat);gS.exports=Tz("Reflect","ownKeys")||function(t){var e=Pz.f(Rz(t)),o=Iz.f;return o?Lz(e,o(t)):e}});var _S=at((GK,vS)=>{"use strict";var yS=wa(),Nz=mS(),Oz=f0(),Dz=Pu();vS.exports=function(n,t,e){for(var o=Nz(t),s=Dz.f,c=Oz.f,h=0;h<o.length;h++){var p=o[h];!yS(n,p)&&!(e&&yS(e,p))&&s(n,p,c(t,p))}}});var ES=at((kK,xS)=>{"use strict";var Fz=gi(),Uz=Di(),Bz=/#|\\.prototype\\./,Bf=function(n,t){var e=Gz[zz(n)];return e===qz?!0:e===kz?!1:Uz(t)?Fz(t):!!t},zz=Bf.normalize=function(n){return String(n).replace(Bz,".").toLowerCase()},Gz=Bf.data={},kz=Bf.NATIVE="N",qz=Bf.POLYFILL="P";xS.exports=Bf});var Ls=at((qK,wS)=>{"use strict";var Mp=io(),Hz=f0().f,Vz=ac(),Wz=Uf(),Xz=op(),Yz=_S(),$z=ES();wS.exports=function(n,t){var e=n.target,o=n.global,s=n.stat,c,h,p,g,m,_;if(o?h=Mp:s?h=Mp[e]||Xz(e,{}):h=Mp[e]&&Mp[e].prototype,h)for(p in t){if(m=t[p],n.dontCallGetSet?(_=Hz(h,p),g=_&&_.value):g=h[p],c=$z(o?p:e+(s?".":"#")+p,n.forced),!c&&g!==void 0){if(typeof m==typeof g)continue;Yz(m,g)}(n.sham||g&&g.sham)&&Vz(m,"sham",!0),Wz(h,p,m,n)}}});var MS=at((HK,SS)=>{"use strict";var Zz=gi();SS.exports=!Zz(function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype})});var x0=at((VK,AS)=>{"use strict";var Jz=wa(),Kz=Di(),jz=ic(),Qz=dp(),tG=MS(),bS=Qz("IE_PROTO"),_0=Object,eG=_0.prototype;AS.exports=tG?_0.getPrototypeOf:function(n){var t=jz(n);if(Jz(t,bS))return t[bS];var e=t.constructor;return Kz(e)&&t instanceof e?e.prototype:t instanceof _0?eG:null}});var M0=at((WK,PS)=>{"use strict";var nG=gi(),rG=Di(),iG=Ea(),oG=Df(),TS=x0(),sG=Uf(),aG=Is(),uG=Lf(),S0=aG("iterator"),CS=!1,Qa,E0,w0;[].keys&&(w0=[].keys(),"next"in w0?(E0=TS(TS(w0)),E0!==Object.prototype&&(Qa=E0)):CS=!0);var lG=!iG(Qa)||nG(function(){var n={};return Qa[S0].call(n)!==n});lG?Qa={}:uG&&(Qa=oG(Qa));rG(Qa[S0])||sG(Qa,S0,function(){return this});PS.exports={IteratorPrototype:Qa,BUGGY_SAFARI_ITERATORS:CS}});var bp=at((XK,RS)=>{"use strict";var cG=Pu().f,fG=wa(),hG=Is(),IS=hG("toStringTag");RS.exports=function(n,t,e){n&&!e&&(n=n.prototype),n&&!fG(n,IS)&&cG(n,IS,{configurable:!0,value:t})}});var NS=at((YK,LS)=>{"use strict";var pG=M0().IteratorPrototype,dG=Df(),gG=vp(),mG=bp(),yG=yp(),vG=function(){return this};LS.exports=function(n,t,e,o){var s=t+" Iterator";return n.prototype=dG(pG,{next:gG(+!o,e)}),mG(n,s,!1,!0),yG[s]=vG,n}});var b0=at(($K,OS)=>{"use strict";var _G=mi(),xG=Nf();OS.exports=function(n,t,e){try{return _G(xG(Object.getOwnPropertyDescriptor(n,t)[e]))}catch(o){}}});var FS=at((ZK,DS)=>{"use strict";var EG=Ea();DS.exports=function(n){return EG(n)||n===null}});var BS=at((JK,US)=>{"use strict";var wG=FS(),SG=String,MG=TypeError;US.exports=function(n){if(wG(n))return n;throw new MG("Can't set "+SG(n)+" as a prototype")}});var GS=at((KK,zS)=>{"use strict";var bG=b0(),AG=Ea(),TG=nc(),CG=BS();zS.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n=!1,t={},e;try{e=bG(Object.prototype,"__proto__","set"),e(t,[]),n=t instanceof Array}catch(o){}return function(s,c){return TG(s),CG(c),AG(s)&&(n?e(s,c):s.__proto__=c),s}}():void 0)});var KS=at((jK,JS)=>{"use strict";var PG=Ls(),IG=Rs(),Ap=Lf(),$S=d0(),RG=Di(),LG=NS(),kS=x0(),qS=GS(),NG=bp(),OG=ac(),A0=Uf(),DG=Is(),HS=yp(),ZS=M0(),FG=$S.PROPER,UG=$S.CONFIGURABLE,VS=ZS.IteratorPrototype,Tp=ZS.BUGGY_SAFARI_ITERATORS,zf=DG("iterator"),WS="keys",Gf="values",XS="entries",YS=function(){return this};JS.exports=function(n,t,e,o,s,c,h){LG(e,t,o);var p=function(E){if(E===s&&x)return x;if(!Tp&&E&&E in _)return _[E];switch(E){case WS:return function(){return new e(this,E)};case Gf:return function(){return new e(this,E)};case XS:return function(){return new e(this,E)}}return function(){return new e(this)}},g=t+" Iterator",m=!1,_=n.prototype,w=_[zf]||_["@@iterator"]||s&&_[s],x=!Tp&&w||p(s),b=t==="Array"&&_.entries||w,P,I,S;if(b&&(P=kS(b.call(new n)),P!==Object.prototype&&P.next&&(!Ap&&kS(P)!==VS&&(qS?qS(P,VS):RG(P[zf])||A0(P,zf,YS)),NG(P,g,!0,!0),Ap&&(HS[g]=YS))),FG&&s===Gf&&w&&w.name!==Gf&&(!Ap&&UG?OG(_,"name",Gf):(m=!0,x=function(){return IG(w,this)})),s)if(I={values:p(Gf),keys:c?x:p(WS),entries:p(XS)},h)for(S in I)(Tp||m||!(S in _))&&A0(_,S,I[S]);else PG({target:t,proto:!0,forced:Tp||m},I);return(!Ap||h)&&_[zf]!==x&&A0(_,zf,x,{name:s}),HS[t]=x,I}});var QS=at((QK,jS)=>{"use strict";jS.exports=function(n,t){return{value:n,done:t}}});var oM=at((tj,iM)=>{"use strict";var BG=rc(),T0=a0(),tM=yp(),nM=Ep(),zG=Pu().f,GG=KS(),Cp=QS(),kG=Lf(),qG=Xs(),rM="Array Iterator",HG=nM.set,VG=nM.getterFor(rM);iM.exports=GG(Array,"Array",function(n,t){HG(this,{type:rM,target:BG(n),index:0,kind:t})},function(){var n=VG(this),t=n.target,e=n.index++;if(!t||e>=t.length)return n.target=null,Cp(void 0,!0);switch(n.kind){case"keys":return Cp(e,!1);case"values":return Cp(t[e],!1)}return Cp([e,t[e]],!1)},"values");var eM=tM.Arguments=tM.Array;T0("keys");T0("values");T0("entries");if(!kG&&qG&&eM.name!=="values")try{zG(eM,"name",{value:"values"})}catch(n){}});var Ip=at(()=>{"use strict";var sM=io(),uM=Kx(),WG=iE(),kf=oM(),aM=ac(),XG=bp(),YG=Is(),C0=YG("iterator"),P0=kf.values,lM=function(n,t){if(n){if(n[C0]!==P0)try{aM(n,C0,P0)}catch(o){n[C0]=P0}if(XG(n,t,!0),uM[t]){for(var e in kf)if(n[e]!==kf[e])try{aM(n,e,kf[e])}catch(o){n[e]=kf[e]}}}};for(Pp in uM)lM(sM[Pp]&&sM[Pp].prototype,Pp);var Pp;lM(WG,"DOMTokenList")});var hM=at((rj,fM)=>{"use strict";var $G=Is(),ZG=$G("toStringTag"),cM={};cM[ZG]="z";fM.exports=String(cM)==="[object z]"});var I0=at((ij,pM)=>{"use strict";var JG=hM(),KG=Di(),Rp=ec(),jG=Is(),QG=jG("toStringTag"),t4=Object,e4=Rp(function(){return arguments}())==="Arguments",n4=function(n,t){try{return n[t]}catch(e){}};pM.exports=JG?Rp:function(n){var t,e,o;return n===void 0?"Undefined":n===null?"Null":typeof(e=n4(t=t4(n),QG))=="string"?e:e4?Rp(t):(o=Rp(t))==="Object"&&KG(t.callee)?"Arguments":o}});var Lp=at((oj,dM)=>{"use strict";var r4=I0(),i4=String;dM.exports=function(n){if(r4(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return i4(n)}});var mM=at((sj,gM)=>{"use strict";var o4=Sa();gM.exports=function(){var n=o4(this),t="";return n.hasIndices&&(t+="d"),n.global&&(t+="g"),n.ignoreCase&&(t+="i"),n.multiline&&(t+="m"),n.dotAll&&(t+="s"),n.unicode&&(t+="u"),n.unicodeSets&&(t+="v"),n.sticky&&(t+="y"),t}});var vM=at((aj,yM)=>{"use strict";var R0=gi(),s4=io(),L0=s4.RegExp,N0=R0(function(){var n=L0("a","y");return n.lastIndex=2,n.exec("abcd")!==null}),a4=N0||R0(function(){return!L0("a","y").sticky}),u4=N0||R0(function(){var n=L0("^r","gy");return n.lastIndex=2,n.exec("str")!==null});yM.exports={BROKEN_CARET:u4,MISSED_STICKY:a4,UNSUPPORTED_Y:N0}});var xM=at((uj,_M)=>{"use strict";var l4=gi(),c4=io(),f4=c4.RegExp;_M.exports=l4(function(){var n=f4(".","s");return!(n.dotAll&&n.test(\`
115
115
  \`)&&n.flags==="s")})});var wM=at((lj,EM)=>{"use strict";var h4=gi(),p4=io(),d4=p4.RegExp;EM.exports=h4(function(){var n=d4("(?<a>b)","g");return n.exec("b").groups.a!=="b"||"b".replace(n,"$<a>c")!=="bc"})});var Dp=at((cj,MM)=>{"use strict";var uc=Rs(),Op=mi(),g4=Lp(),m4=mM(),y4=vM(),v4=ap(),_4=Df(),x4=Ep().get,E4=xM(),w4=wM(),S4=v4("native-string-replace",String.prototype.replace),Np=RegExp.prototype.exec,D0=Np,M4=Op("".charAt),b4=Op("".indexOf),A4=Op("".replace),O0=Op("".slice),F0=function(){var n=/a/,t=/b*/g;return uc(Np,n,"a"),uc(Np,t,"a"),n.lastIndex!==0||t.lastIndex!==0}(),SM=y4.BROKEN_CARET,U0=/()??/.exec("")[1]!==void 0,T4=F0||U0||SM||E4||w4;T4&&(D0=function(t){var e=this,o=x4(e),s=g4(t),c=o.raw,h,p,g,m,_,w,x;if(c)return c.lastIndex=e.lastIndex,h=uc(D0,c,s),e.lastIndex=c.lastIndex,h;var b=o.groups,P=SM&&e.sticky,I=uc(m4,e),S=e.source,E=0,R=s;if(P&&(I=A4(I,"y",""),b4(I,"g")===-1&&(I+="g"),R=O0(s,e.lastIndex),e.lastIndex>0&&(!e.multiline||e.multiline&&M4(s,e.lastIndex-1)!==\`
116
116
  \`)&&(S="(?: "+S+")",R=" "+R,E++),p=new RegExp("^(?:"+S+")",I)),U0&&(p=new RegExp("^"+S+"$(?!\\\\s)",I)),F0&&(g=e.lastIndex),m=uc(Np,P?p:e,R),P?m?(m.input=O0(m.input,E),m[0]=O0(m[0],E),m.index=e.lastIndex,e.lastIndex+=m[0].length):e.lastIndex=0:F0&&m&&(e.lastIndex=e.global?m.index+m[0].length:g),U0&&m&&m.length>1&&uc(S4,m[0],p,function(){for(_=1;_<arguments.length-2;_++)arguments[_]===void 0&&(m[_]=void 0)}),m&&b)for(m.groups=w=_4(null),_=0;_<b.length;_++)x=b[_],w[x[0]]=m[x[1]];return m});MM.exports=D0});var Fp=at(()=>{"use strict";var C4=Ls(),bM=Dp();C4({target:"RegExp",proto:!0,forced:/./.exec!==bM},{exec:bM})});var Up=at((pj,AM)=>{"use strict";var P4=ec();AM.exports=Array.isArray||function(t){return P4(t)==="Array"}});var CM=at((dj,TM)=>{"use strict";var I4=Xs(),R4=Up(),L4=TypeError,N4=Object.getOwnPropertyDescriptor,O4=I4&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(n){return n instanceof TypeError}}();TM.exports=O4?function(n,t){if(R4(n)&&!N4(n,"length").writable)throw new L4("Cannot set read only .length");return n.length=t}:function(n,t){return n.length=t}});var B0=at((gj,PM)=>{"use strict";var D4=TypeError,F4=9007199254740991;PM.exports=function(n){if(n>F4)throw D4("Maximum allowed index exceeded");return n}});var z0=at(()=>{"use strict";var U4=Ls(),B4=ic(),z4=Of(),G4=CM(),k4=B0(),q4=gi(),H4=q4(function(){return[].push.call({length:4294967296},1)!==4294967297}),V4=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(n){return n instanceof TypeError}},W4=H4||!V4();U4({target:"Array",proto:!0,arity:1,forced:W4},{push:function(t){var e=B4(this),o=z4(e),s=arguments.length;k4(o+s);for(var c=0;c<s;c++)e[o]=arguments[c],o++;return G4(e,o),o}})});var $s=at((vj,IM)=>{"use strict";var G0=mi(),Bp=Set.prototype;IM.exports={Set,add:G0(Bp.add),has:G0(Bp.has),remove:G0(Bp.delete),proto:Bp}});var Iu=at((_j,RM)=>{"use strict";var X4=$s().has;RM.exports=function(n){return X4(n),n}});var Ru=at((xj,LM)=>{"use strict";var Y4=Rs();LM.exports=function(n,t,e){for(var o=e?n:n.iterator,s=n.next,c,h;!(c=Y4(s,o)).done;)if(h=t(c.value),h!==void 0)return h}});var lc=at((Ej,UM)=>{"use strict";var NM=mi(),$4=Ru(),OM=$s(),Z4=OM.Set,DM=OM.proto,J4=NM(DM.forEach),FM=NM(DM.keys),K4=FM(new Z4).next;UM.exports=function(n,t,e){return e?$4({iterator:FM(n),next:K4},t):J4(n,t)}});var zp=at((wj,zM)=>{"use strict";var BM=$s(),j4=lc(),Q4=BM.Set,tk=BM.add;zM.exports=function(n){var t=new Q4;return j4(n,function(e){tk(t,e)}),t}});var cc=at((Sj,GM)=>{"use strict";var ek=b0(),nk=$s();GM.exports=ek(nk.proto,"size","get")||function(n){return n.size}});var qM=at((Mj,kM)=>{"use strict";kM.exports=function(n){return{iterator:n,next:n.next,done:!1}}});var Lu=at((bj,$M)=>{"use strict";var HM=Nf(),XM=Sa(),VM=Rs(),rk=ml(),ik=qM(),WM="Invalid size",ok=RangeError,sk=TypeError,ak=Math.max,YM=function(n,t){this.set=n,this.size=ak(t,0),this.has=HM(n.has),this.keys=HM(n.keys)};YM.prototype={getIterator:function(){return ik(XM(VM(this.keys,this.set)))},includes:function(n){return VM(this.has,this.set,n)}};$M.exports=function(n){XM(n);var t=+n.size;if(t!==t)throw new sk(WM);var e=rk(t);if(e<0)throw new ok(WM);return new YM(n,e)}});var jM=at((Aj,KM)=>{"use strict";var uk=Iu(),JM=$s(),lk=zp(),ck=cc(),fk=Lu(),hk=lc(),pk=Ru(),dk=JM.has,ZM=JM.remove;KM.exports=function(t){var e=uk(this),o=fk(t),s=lk(e);return ck(e)<=o.size?hk(e,function(c){o.includes(c)&&ZM(s,c)}):pk(o.getIterator(),function(c){dk(e,c)&&ZM(s,c)}),s}});var Nu=at((Tj,tb)=>{"use strict";var gk=sc(),QM=function(n){return{size:n,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}};tb.exports=function(n){var t=gk("Set");try{new t()[n](QM(0));try{return new t()[n](QM(-1)),!1}catch(e){return!0}}catch(e){return!1}}});var eb=at(()=>{"use strict";var mk=Ls(),yk=jM(),vk=Nu();mk({target:"Set",proto:!0,real:!0,forced:!vk("difference")},{difference:yk})});var ib=at((Ij,rb)=>{"use strict";var _k=Iu(),k0=$s(),xk=cc(),Ek=Lu(),wk=lc(),Sk=Ru(),Mk=k0.Set,nb=k0.add,bk=k0.has;rb.exports=function(t){var e=_k(this),o=Ek(t),s=new Mk;return xk(e)>o.size?Sk(o.getIterator(),function(c){bk(e,c)&&nb(s,c)}):wk(e,function(c){o.includes(c)&&nb(s,c)}),s}});var ob=at(()=>{"use strict";var Ak=Ls(),Tk=gi(),Ck=ib(),Pk=Nu(),Ik=!Pk("intersection")||Tk(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});Ak({target:"Set",proto:!0,real:!0,forced:Ik},{intersection:Ck})});var q0=at((Nj,ab)=>{"use strict";var Rk=Rs(),sb=Sa(),Lk=cp();ab.exports=function(n,t,e){var o,s;sb(n);try{if(o=Lk(n,"return"),!o){if(t==="throw")throw e;return e}o=Rk(o,n)}catch(c){s=!0,o=c}if(t==="throw")throw e;if(s)throw o;return sb(o),e}});var lb=at((Oj,ub)=>{"use strict";var Nk=Iu(),Ok=$s().has,Dk=cc(),Fk=Lu(),Uk=lc(),Bk=Ru(),zk=q0();ub.exports=function(t){var e=Nk(this),o=Fk(t);if(Dk(e)<=o.size)return Uk(e,function(c){if(o.includes(c))return!1},!0)!==!1;var s=o.getIterator();return Bk(s,function(c){if(Ok(e,c))return zk(s,"normal",!1)})!==!1}});var cb=at(()=>{"use strict";var Gk=Ls(),kk=lb(),qk=Nu();Gk({target:"Set",proto:!0,real:!0,forced:!qk("isDisjointFrom")},{isDisjointFrom:kk})});var hb=at((Uj,fb)=>{"use strict";var Hk=Iu(),Vk=cc(),Wk=lc(),Xk=Lu();fb.exports=function(t){var e=Hk(this),o=Xk(t);return Vk(e)>o.size?!1:Wk(e,function(s){if(!o.includes(s))return!1},!0)!==!1}});var pb=at(()=>{"use strict";var Yk=Ls(),$k=hb(),Zk=Nu();Yk({target:"Set",proto:!0,real:!0,forced:!Zk("isSubsetOf")},{isSubsetOf:$k})});var gb=at((Gj,db)=>{"use strict";var Jk=Iu(),Kk=$s().has,jk=cc(),Qk=Lu(),tq=Ru(),eq=q0();db.exports=function(t){var e=Jk(this),o=Qk(t);if(jk(e)<o.size)return!1;var s=o.getIterator();return tq(s,function(c){if(!Kk(e,c))return eq(s,"normal",!1)})!==!1}});var mb=at(()=>{"use strict";var nq=Ls(),rq=gb(),iq=Nu();nq({target:"Set",proto:!0,real:!0,forced:!iq("isSupersetOf")},{isSupersetOf:rq})});var vb=at((Hj,yb)=>{"use strict";var oq=Iu(),H0=$s(),sq=zp(),aq=Lu(),uq=Ru(),lq=H0.add,cq=H0.has,fq=H0.remove;yb.exports=function(t){var e=oq(this),o=aq(t).getIterator(),s=sq(e);return uq(o,function(c){cq(e,c)?fq(s,c):lq(s,c)}),s}});var _b=at(()=>{"use strict";var hq=Ls(),pq=vb(),dq=Nu();hq({target:"Set",proto:!0,real:!0,forced:!dq("symmetricDifference")},{symmetricDifference:pq})});var Eb=at((Xj,xb)=>{"use strict";var gq=Iu(),mq=$s().add,yq=zp(),vq=Lu(),_q=Ru();xb.exports=function(t){var e=gq(this),o=vq(t).getIterator(),s=yq(e);return _q(o,function(c){mq(s,c)}),s}});var wb=at(()=>{"use strict";var xq=Ls(),Eq=Eb(),wq=Nu();xq({target:"Set",proto:!0,real:!0,forced:!wq("union")},{union:Eq})});var Mb=at((Zj,Sb)=>{"use strict";var Sq=ec(),Mq=mi();Sb.exports=function(n){if(Sq(n)==="Function")return Mq(n)}});var Tb=at((Jj,Ab)=>{"use strict";var bb=Mb(),bq=Nf(),Aq=Rf(),Tq=bb(bb.bind);Ab.exports=function(n,t){return bq(n),t===void 0?n:Aq?Tq(n,t):function(){return n.apply(t,arguments)}}});var Ib=at((Kj,Pb)=>{"use strict";var Cq=Up(),Pq=Of(),Iq=B0(),Rq=Tb(),Cb=function(n,t,e,o,s,c,h,p){for(var g=s,m=0,_=h?Rq(h,p):!1,w,x;m<o;)m in e&&(w=_?_(e[m],m,t):e[m],c>0&&Cq(w)?(x=Pq(w),g=Cb(n,t,w,x,g,c-1)-1):(Iq(g+1),n[g]=w),g++),m++;return g};Pb.exports=Cb});var Fb=at((jj,Db)=>{"use strict";var Lq=mi(),Nq=gi(),Rb=Di(),Oq=I0(),Dq=sc(),Fq=m0(),Lb=function(){},Nb=Dq("Reflect","construct"),V0=/^\\s*(?:class|function)\\b/,Uq=Lq(V0.exec),Bq=!V0.test(Lb),qf=function(t){if(!Rb(t))return!1;try{return Nb(Lb,[],t),!0}catch(e){return!1}},Ob=function(t){if(!Rb(t))return!1;switch(Oq(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Bq||!!Uq(V0,Fq(t))}catch(e){return!0}};Ob.sham=!0;Db.exports=!Nb||Nq(function(){var n;return qf(qf.call)||!qf(Object)||!qf(function(){n=!0})||n})?Ob:qf});var Gb=at((Qj,zb)=>{"use strict";var Ub=Up(),zq=Fb(),Gq=Ea(),kq=Is(),qq=kq("species"),Bb=Array;zb.exports=function(n){var t;return Ub(n)&&(t=n.constructor,zq(t)&&(t===Bb||Ub(t.prototype))?t=void 0:Gq(t)&&(t=t[qq],t===null&&(t=void 0))),t===void 0?Bb:t}});var qb=at((tQ,kb)=>{"use strict";var Hq=Gb();kb.exports=function(n,t){return new(Hq(n))(t===0?0:t)}});var Hb=at(()=>{"use strict";var Vq=Ls(),Wq=Ib(),Xq=ic(),Yq=Of(),$q=ml(),Zq=qb();Vq({target:"Array",proto:!0},{flat:function(){var t=arguments.length?arguments[0]:void 0,e=Xq(this),o=Yq(e),s=Zq(e,0);return s.length=Wq(s,e,e,o,0,t===void 0?1:$q(t)),s}})});var Vb=at(()=>{"use strict";var Jq=a0();Jq("flat")});var Xb=at((oQ,Wb)=>{var W0=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(s=>(s.key===t&&Object.assign(s,{priority:o}),s)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};Wb.exports=W0});var Zb=at((sQ,$b)=>{function Yb(n,t){let e=new Map;for(let[o,s]of n)o!==t&&s instanceof Map?e.set(o,Yb(s,t)):o!==t&&e.set(o,s);return e}$b.exports=Yb});var jb=at((aQ,Kb)=>{function Kq(n){let t=Number(n);return!(isNaN(t)||t<=0)}function Jb(n){let t=new Map;return Object.keys(n).forEach(o=>{let s=n[o];if(s!==null&&typeof s=="object"&&!Array.isArray(s))return t.set(o,Jb(s));if(!Kq(s))throw new Error(\`Could not add node at key "\${o}", make sure it's a valid node\`,s);return t.set(o,Number(s))}),t}Kb.exports=Jb});var eA=at((uQ,tA)=>{function Qb(n){if(!(n instanceof Map))throw new Error(\`Invalid graph: Expected Map instead found \${typeof n}\`);n.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){Qb(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}tA.exports=Qb});var oA=at((lQ,iA)=>{var jq=Xb(),Qq=Zb(),nA=jb(),rA=eA(),X0=class{constructor(t){t instanceof Map?(rA(t),this.graph=t):t?this.graph=nA(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(rA(e),o=e):o=nA(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=Qq(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let s=new Set,c=new jq,h=new Map,p=[],g=0,m=[];if(o.avoid&&(m=[].concat(o.avoid)),m.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(m.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(c.set(t,0);!c.isEmpty();){let _=c.next();if(_.key===e){g=_.priority;let x=_.key;for(;h.has(x);)p.push(x),x=h.get(x);break}s.add(_.key),(this.graph.get(_.key)||new Map).forEach((x,b)=>{if(s.has(b)||m.includes(b))return null;if(!c.has(b))return h.set(b,_.key),c.set(b,_.priority+x);let P=c.get(b).priority,I=_.priority+x;return I<P?(h.set(b,_.key),c.set(b,I)):null})}return p.length?(o.trim?p.shift():p=p.concat([t]),o.reverse||(p=p.reverse()),o.cost?{path:p,cost:g}:p):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};iA.exports=X0});var Ld=at((EQ,jT)=>{"use strict";var KT=Object.getOwnPropertySymbols,h9=Object.prototype.hasOwnProperty,p9=Object.prototype.propertyIsEnumerable;function d9(n){if(n==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(n)}function g9(){try{if(!Object.assign)return!1;var n=new String("abc");if(n[5]="de",Object.getOwnPropertyNames(n)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(c){return t[c]});if(o.join("")!=="0123456789")return!1;var s={};return"abcdefghijklmnopqrst".split("").forEach(function(c){s[c]=c}),Object.keys(Object.assign({},s)).join("")==="abcdefghijklmnopqrst"}catch(c){return!1}}jT.exports=g9()?Object.assign:function(n,t){for(var e,o=d9(n),s,c=1;c<arguments.length;c++){e=Object(arguments[c]);for(var h in e)h9.call(e,h)&&(o[h]=e[h]);if(KT){s=KT(e);for(var p=0;p<s.length;p++)p9.call(e,s[p])&&(o[s[p]]=e[s[p]])}}return o}});var Ev=at((_v,xv)=>{(function(n,t){typeof _v=="object"&&typeof xv!="undefined"?xv.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self).RBush=t()})(_v,function(){"use strict";function n(S,E,R,T,F){(function W(X,q,D,xt,B){for(;xt>D;){if(xt-D>600){var j=xt-D+1,J=q-D+1,Dt=Math.log(j),Q=.5*Math.exp(2*Dt/3),At=.5*Math.sqrt(Dt*Q*(j-Q)/j)*(J-j/2<0?-1:1),Mt=Math.max(D,Math.floor(q-J*Q/j+At)),Rt=Math.min(xt,Math.floor(q+(j-J)*Q/j+At));W(X,q,Mt,Rt,B)}var pt=X[q],yt=D,K=xt;for(t(X,D,q),B(X[xt],pt)>0&&t(X,D,xt);yt<K;){for(t(X,yt,K),yt++,K--;B(X[yt],pt)<0;)yt++;for(;B(X[K],pt)>0;)K--}B(X[D],pt)===0?t(X,D,K):t(X,++K,xt),K<=q&&(D=K+1),q<=K&&(xt=K-1)}})(S,E,R||0,T||S.length-1,F||e)}function t(S,E,R){var T=S[E];S[E]=S[R],S[R]=T}function e(S,E){return S<E?-1:S>E?1:0}var o=function(S){S===void 0&&(S=9),this._maxEntries=Math.max(4,S),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(S,E,R){if(!R)return E.indexOf(S);for(var T=0;T<E.length;T++)if(R(S,E[T]))return T;return-1}function c(S,E){h(S,0,S.children.length,E,S)}function h(S,E,R,T,F){F||(F=P(null)),F.minX=1/0,F.minY=1/0,F.maxX=-1/0,F.maxY=-1/0;for(var W=E;W<R;W++){var X=S.children[W];p(F,S.leaf?T(X):X)}return F}function p(S,E){return S.minX=Math.min(S.minX,E.minX),S.minY=Math.min(S.minY,E.minY),S.maxX=Math.max(S.maxX,E.maxX),S.maxY=Math.max(S.maxY,E.maxY),S}function g(S,E){return S.minX-E.minX}function m(S,E){return S.minY-E.minY}function _(S){return(S.maxX-S.minX)*(S.maxY-S.minY)}function w(S){return S.maxX-S.minX+(S.maxY-S.minY)}function x(S,E){return S.minX<=E.minX&&S.minY<=E.minY&&E.maxX<=S.maxX&&E.maxY<=S.maxY}function b(S,E){return E.minX<=S.maxX&&E.minY<=S.maxY&&E.maxX>=S.minX&&E.maxY>=S.minY}function P(S){return{children:S,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function I(S,E,R,T,F){for(var W=[E,R];W.length;)if(!((R=W.pop())-(E=W.pop())<=T)){var X=E+Math.ceil((R-E)/T/2)*T;n(S,X,E,R,F),W.push(E,X,X,R)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(S){var E=this.data,R=[];if(!b(S,E))return R;for(var T=this.toBBox,F=[];E;){for(var W=0;W<E.children.length;W++){var X=E.children[W],q=E.leaf?T(X):X;b(S,q)&&(E.leaf?R.push(X):x(S,q)?this._all(X,R):F.push(X))}E=F.pop()}return R},o.prototype.collides=function(S){var E=this.data;if(!b(S,E))return!1;for(var R=[];E;){for(var T=0;T<E.children.length;T++){var F=E.children[T],W=E.leaf?this.toBBox(F):F;if(b(S,W)){if(E.leaf||x(S,W))return!0;R.push(F)}}E=R.pop()}return!1},o.prototype.load=function(S){if(!S||!S.length)return this;if(S.length<this._minEntries){for(var E=0;E<S.length;E++)this.insert(S[E]);return this}var R=this._build(S.slice(),0,S.length-1,0);if(this.data.children.length)if(this.data.height===R.height)this._splitRoot(this.data,R);else{if(this.data.height<R.height){var T=this.data;this.data=R,R=T}this._insert(R,this.data.height-R.height-1,!0)}else this.data=R;return this},o.prototype.insert=function(S){return S&&this._insert(S,this.data.height-1),this},o.prototype.clear=function(){return this.data=P([]),this},o.prototype.remove=function(S,E){if(!S)return this;for(var R,T,F,W=this.data,X=this.toBBox(S),q=[],D=[];W||q.length;){if(W||(W=q.pop(),T=q[q.length-1],R=D.pop(),F=!0),W.leaf){var xt=s(S,W.children,E);if(xt!==-1)return W.children.splice(xt,1),q.push(W),this._condense(q),this}F||W.leaf||!x(W,X)?T?(R++,W=T.children[R],F=!1):W=null:(q.push(W),D.push(R),R=0,T=W,W=W.children[0])}return this},o.prototype.toBBox=function(S){return S},o.prototype.compareMinX=function(S,E){return S.minX-E.minX},o.prototype.compareMinY=function(S,E){return S.minY-E.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(S){return this.data=S,this},o.prototype._all=function(S,E){for(var R=[];S;)S.leaf?E.push.apply(E,S.children):R.push.apply(R,S.children),S=R.pop();return E},o.prototype._build=function(S,E,R,T){var F,W=R-E+1,X=this._maxEntries;if(W<=X)return c(F=P(S.slice(E,R+1)),this.toBBox),F;T||(T=Math.ceil(Math.log(W)/Math.log(X)),X=Math.ceil(W/Math.pow(X,T-1))),(F=P([])).leaf=!1,F.height=T;var q=Math.ceil(W/X),D=q*Math.ceil(Math.sqrt(X));I(S,E,R,D,this.compareMinX);for(var xt=E;xt<=R;xt+=D){var B=Math.min(xt+D-1,R);I(S,xt,B,q,this.compareMinY);for(var j=xt;j<=B;j+=q){var J=Math.min(j+q-1,B);F.children.push(this._build(S,j,J,T-1))}}return c(F,this.toBBox),F},o.prototype._chooseSubtree=function(S,E,R,T){for(;T.push(E),!E.leaf&&T.length-1!==R;){for(var F=1/0,W=1/0,X=void 0,q=0;q<E.children.length;q++){var D=E.children[q],xt=_(D),B=(j=S,J=D,(Math.max(J.maxX,j.maxX)-Math.min(J.minX,j.minX))*(Math.max(J.maxY,j.maxY)-Math.min(J.minY,j.minY))-xt);B<W?(W=B,F=xt<F?xt:F,X=D):B===W&&xt<F&&(F=xt,X=D)}E=X||E.children[0]}var j,J;return E},o.prototype._insert=function(S,E,R){var T=R?S:this.toBBox(S),F=[],W=this._chooseSubtree(T,this.data,E,F);for(W.children.push(S),p(W,T);E>=0&&F[E].children.length>this._maxEntries;)this._split(F,E),E--;this._adjustParentBBoxes(T,F,E)},o.prototype._split=function(S,E){var R=S[E],T=R.children.length,F=this._minEntries;this._chooseSplitAxis(R,F,T);var W=this._chooseSplitIndex(R,F,T),X=P(R.children.splice(W,R.children.length-W));X.height=R.height,X.leaf=R.leaf,c(R,this.toBBox),c(X,this.toBBox),E?S[E-1].children.push(X):this._splitRoot(R,X)},o.prototype._splitRoot=function(S,E){this.data=P([S,E]),this.data.height=S.height+1,this.data.leaf=!1,c(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(S,E,R){for(var T,F,W,X,q,D,xt,B=1/0,j=1/0,J=E;J<=R-E;J++){var Dt=h(S,0,J,this.toBBox),Q=h(S,J,R,this.toBBox),At=(F=Dt,W=Q,X=void 0,q=void 0,D=void 0,xt=void 0,X=Math.max(F.minX,W.minX),q=Math.max(F.minY,W.minY),D=Math.min(F.maxX,W.maxX),xt=Math.min(F.maxY,W.maxY),Math.max(0,D-X)*Math.max(0,xt-q)),Mt=_(Dt)+_(Q);At<B?(B=At,T=J,j=Mt<j?Mt:j):At===B&&Mt<j&&(j=Mt,T=J)}return T||R-E},o.prototype._chooseSplitAxis=function(S,E,R){var T=S.leaf?this.compareMinX:g,F=S.leaf?this.compareMinY:m;this._allDistMargin(S,E,R,T)<this._allDistMargin(S,E,R,F)&&S.children.sort(T)},o.prototype._allDistMargin=function(S,E,R,T){S.children.sort(T);for(var F=this.toBBox,W=h(S,0,E,F),X=h(S,R-E,R,F),q=w(W)+w(X),D=E;D<R-E;D++){var xt=S.children[D];p(W,S.leaf?F(xt):xt),q+=w(W)}for(var B=R-E-1;B>=E;B--){var j=S.children[B];p(X,S.leaf?F(j):j),q+=w(X)}return q},o.prototype._adjustParentBBoxes=function(S,E,R){for(var T=R;T>=0;T--)p(E[T],S)},o.prototype._condense=function(S){for(var E=S.length-1,R=void 0;E>=0;E--)S[E].children.length===0?E>0?(R=S[E-1].children).splice(R.indexOf(S[E]),1):this.clear():c(S[E],this.toBBox)},o})});var QT=at((wv,Sv)=>{(function(n,t){typeof wv=="object"&&typeof Sv!="undefined"?Sv.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self,n.TinyQueue=t())})(wv,function(){"use strict";var n=function(o,s){if(o===void 0&&(o=[]),s===void 0&&(s=t),this.data=o,this.length=this.data.length,this.compare=s,this.length>0)for(var c=(this.length>>1)-1;c>=0;c--)this._down(c)};n.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},n.prototype.pop=function(){if(this.length!==0){var o=this.data[0],s=this.data.pop();return this.length--,this.length>0&&(this.data[0]=s,this._down(0)),o}},n.prototype.peek=function(){return this.data[0]},n.prototype._up=function(o){for(var s=this,c=s.data,h=s.compare,p=c[o];o>0;){var g=o-1>>1,m=c[g];if(h(p,m)>=0)break;c[o]=m,o=g}c[o]=p},n.prototype._down=function(o){for(var s=this,c=s.data,h=s.compare,p=this.length>>1,g=c[o];o<p;){var m=(o<<1)+1,_=c[m],w=m+1;if(w<this.length&&h(c[w],_)<0&&(m=w,_=c[w]),h(_,g)>=0)break;c[o]=_,o=m}c[o]=g};function t(e,o){return e<o?-1:e>o?1:0}return n})});var eC=at((TQ,tC)=>{tC.exports=function(t,e,o,s){var c=t[0],h=t[1],p=!1;o===void 0&&(o=0),s===void 0&&(s=e.length);for(var g=(s-o)/2,m=0,_=g-1;m<g;_=m++){var w=e[o+m*2+0],x=e[o+m*2+1],b=e[o+_*2+0],P=e[o+_*2+1],I=x>h!=P>h&&c<(b-w)*(h-x)/(P-x)+w;I&&(p=!p)}return p}});var rC=at((CQ,nC)=>{nC.exports=function(t,e,o,s){var c=t[0],h=t[1],p=!1;o===void 0&&(o=0),s===void 0&&(s=e.length);for(var g=s-o,m=0,_=g-1;m<g;_=m++){var w=e[m+o][0],x=e[m+o][1],b=e[_+o][0],P=e[_+o][1],I=x>h!=P>h&&c<(b-w)*(h-x)/(P-x)+w;I&&(p=!p)}return p}});var sC=at((PQ,Dd)=>{var iC=eC(),oC=rC();Dd.exports=function(t,e,o,s){return e.length>0&&Array.isArray(e[0])?oC(t,e,o,s):iC(t,e,o,s)};Dd.exports.nested=oC;Dd.exports.flat=iC});var uC=at((Fd,aC)=>{(function(n,t){typeof Fd=="object"&&typeof aC!="undefined"?t(Fd):typeof define=="function"&&define.amd?define(["exports"],t):t((n=n||self).predicates={})})(Fd,function(n){"use strict";let e=33306690738754706e-32;function o(b,P,I,S,E){let R,T,F,W,X=P[0],q=S[0],D=0,xt=0;q>X==q>-X?(R=X,X=P[++D]):(R=q,q=S[++xt]);let B=0;if(D<b&&xt<I)for(q>X==q>-X?(F=R-((T=X+R)-X),X=P[++D]):(F=R-((T=q+R)-q),q=S[++xt]),R=T,F!==0&&(E[B++]=F);D<b&&xt<I;)q>X==q>-X?(F=R-((T=R+X)-(W=T-R))+(X-W),X=P[++D]):(F=R-((T=R+q)-(W=T-R))+(q-W),q=S[++xt]),R=T,F!==0&&(E[B++]=F);for(;D<b;)F=R-((T=R+X)-(W=T-R))+(X-W),X=P[++D],R=T,F!==0&&(E[B++]=F);for(;xt<I;)F=R-((T=R+q)-(W=T-R))+(q-W),q=S[++xt],R=T,F!==0&&(E[B++]=F);return R===0&&B!==0||(E[B++]=R),B}function s(b){return new Float64Array(b)}let c=33306690738754716e-32,h=22204460492503146e-32,p=11093356479670487e-47,g=s(4),m=s(8),_=s(12),w=s(16),x=s(4);n.orient2d=function(b,P,I,S,E,R){let T=(P-R)*(I-E),F=(b-E)*(S-R),W=T-F;if(T===0||F===0||T>0!=F>0)return W;let X=Math.abs(T+F);return Math.abs(W)>=c*X?W:-function(q,D,xt,B,j,J,Dt){let Q,At,Mt,Rt,pt,yt,K,Bt,Gt,ae,ut,Ut,jt,ce,te,$t,qt,xe,ft=q-j,We=xt-j,ee=D-J,ge=B-J;pt=(te=(Bt=ft-(K=(yt=134217729*ft)-(yt-ft)))*(ae=ge-(Gt=(yt=134217729*ge)-(yt-ge)))-((ce=ft*ge)-K*Gt-Bt*Gt-K*ae))-(ut=te-(qt=(Bt=ee-(K=(yt=134217729*ee)-(yt-ee)))*(ae=We-(Gt=(yt=134217729*We)-(yt-We)))-(($t=ee*We)-K*Gt-Bt*Gt-K*ae))),g[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),g[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,g[2]=Ut-(xe-pt)+(ut-pt),g[3]=xe;let fe=function(tt,z){let Pt=z[0];for(let Ot=1;Ot<tt;Ot++)Pt+=z[Ot];return Pt}(4,g),Te=h*Dt;if(fe>=Te||-fe>=Te||(Q=q-(ft+(pt=q-ft))+(pt-j),Mt=xt-(We+(pt=xt-We))+(pt-j),At=D-(ee+(pt=D-ee))+(pt-J),Rt=B-(ge+(pt=B-ge))+(pt-J),Q===0&&At===0&&Mt===0&&Rt===0)||(Te=p*Dt+e*Math.abs(fe),(fe+=ft*Rt+ge*Q-(ee*Mt+We*At))>=Te||-fe>=Te))return fe;pt=(te=(Bt=Q-(K=(yt=134217729*Q)-(yt-Q)))*(ae=ge-(Gt=(yt=134217729*ge)-(yt-ge)))-((ce=Q*ge)-K*Gt-Bt*Gt-K*ae))-(ut=te-(qt=(Bt=At-(K=(yt=134217729*At)-(yt-At)))*(ae=We-(Gt=(yt=134217729*We)-(yt-We)))-(($t=At*We)-K*Gt-Bt*Gt-K*ae))),x[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),x[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,x[2]=Ut-(xe-pt)+(ut-pt),x[3]=xe;let be=o(4,g,4,x,m);pt=(te=(Bt=ft-(K=(yt=134217729*ft)-(yt-ft)))*(ae=Rt-(Gt=(yt=134217729*Rt)-(yt-Rt)))-((ce=ft*Rt)-K*Gt-Bt*Gt-K*ae))-(ut=te-(qt=(Bt=ee-(K=(yt=134217729*ee)-(yt-ee)))*(ae=Mt-(Gt=(yt=134217729*Mt)-(yt-Mt)))-(($t=ee*Mt)-K*Gt-Bt*Gt-K*ae))),x[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),x[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,x[2]=Ut-(xe-pt)+(ut-pt),x[3]=xe;let Wt=o(be,m,4,x,_);pt=(te=(Bt=Q-(K=(yt=134217729*Q)-(yt-Q)))*(ae=Rt-(Gt=(yt=134217729*Rt)-(yt-Rt)))-((ce=Q*Rt)-K*Gt-Bt*Gt-K*ae))-(ut=te-(qt=(Bt=At-(K=(yt=134217729*At)-(yt-At)))*(ae=Mt-(Gt=(yt=134217729*Mt)-(yt-Mt)))-(($t=At*Mt)-K*Gt-Bt*Gt-K*ae))),x[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),x[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,x[2]=Ut-(xe-pt)+(ut-pt),x[3]=xe;let Me=o(Wt,_,4,x,w);return w[Me-1]}(b,P,I,S,E,R,X)},n.orient2dfast=function(b,P,I,S,E,R){return(P-R)*(I-E)-(b-E)*(S-R)},Object.defineProperty(n,"__esModule",{value:!0})})});var dC=at((IQ,Tv)=>{"use strict";var lC=Ev(),Bd=QT(),y9=sC(),v9=uC().orient2d;Bd.default&&(Bd=Bd.default);Tv.exports=pC;Tv.exports.default=pC;function pC(n,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=S9(n),s=new lC(16);s.toBBox=function(R){return{minX:R[0],minY:R[1],maxX:R[0],maxY:R[1]}},s.compareMinX=function(R,T){return R[0]-T[0]},s.compareMinY=function(R,T){return R[1]-T[1]},s.load(n);for(var c=[],h=0,p;h<o.length;h++){var g=o[h];s.remove(g),p=hC(g,p),c.push(p)}var m=new lC(16);for(h=0;h<c.length;h++)m.insert(Mv(c[h]));for(var _=t*t,w=e*e;c.length;){var x=c.shift(),b=x.p,P=x.next.p,I=bv(b,P);if(!(I<w)){var S=I/_;g=_9(s,x.prev.p,b,P,x.next.next.p,S,m),g&&Math.min(bv(g,b),bv(g,P))<=S&&(c.push(x),c.push(hC(g,x)),s.remove(g),m.remove(x),m.insert(Mv(x)),m.insert(Mv(x.next)))}}x=p;var E=[];do E.push(x.p),x=x.next;while(x!==p);return E.push(x.p),E}function _9(n,t,e,o,s,c,h){for(var p=new Bd([],x9),g=n.data;g;){for(var m=0;m<g.children.length;m++){var _=g.children[m],w=g.leaf?Av(_,e,o):E9(e,o,_);w>c||p.push({node:_,dist:w})}for(;p.length&&!p.peek().node.children;){var x=p.pop(),b=x.node,P=Av(b,t,e),I=Av(b,o,s);if(x.dist<P&&x.dist<I&&fC(e,b,h)&&fC(o,b,h))return b}g=p.pop(),g&&(g=g.node)}return null}function x9(n,t){return n.dist-t.dist}function E9(n,t,e){if(cC(n,e)||cC(t,e))return 0;var o=Ud(n[0],n[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var s=Ud(n[0],n[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(s===0)return 0;var c=Ud(n[0],n[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(c===0)return 0;var h=Ud(n[0],n[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return h===0?0:Math.min(o,s,c,h)}function cC(n,t){return n[0]>=t.minX&&n[0]<=t.maxX&&n[1]>=t.minY&&n[1]<=t.maxY}function fC(n,t,e){for(var o=Math.min(n[0],t[0]),s=Math.min(n[1],t[1]),c=Math.max(n[0],t[0]),h=Math.max(n[1],t[1]),p=e.search({minX:o,minY:s,maxX:c,maxY:h}),g=0;g<p.length;g++)if(w9(p[g].p,p[g].next.p,n,t))return!1;return!0}function kc(n,t,e){return v9(n[0],n[1],t[0],t[1],e[0],e[1])}function w9(n,t,e,o){return n!==o&&t!==e&&kc(n,t,e)>0!=kc(n,t,o)>0&&kc(e,o,n)>0!=kc(e,o,t)>0}function Mv(n){var t=n.p,e=n.next.p;return n.minX=Math.min(t[0],e[0]),n.minY=Math.min(t[1],e[1]),n.maxX=Math.max(t[0],e[0]),n.maxY=Math.max(t[1],e[1]),n}function S9(n){for(var t=n[0],e=n[0],o=n[0],s=n[0],c=0;c<n.length;c++){var h=n[c];h[0]<t[0]&&(t=h),h[0]>o[0]&&(o=h),h[1]<e[1]&&(e=h),h[1]>s[1]&&(s=h)}var p=[t,e,o,s],g=p.slice();for(c=0;c<n.length;c++)y9(n[c],p)||g.push(n[c]);return b9(g)}function hC(n,t){var e={p:n,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function bv(n,t){var e=n[0]-t[0],o=n[1]-t[1];return e*e+o*o}function Av(n,t,e){var o=t[0],s=t[1],c=e[0]-o,h=e[1]-s;if(c!==0||h!==0){var p=((n[0]-o)*c+(n[1]-s)*h)/(c*c+h*h);p>1?(o=e[0],s=e[1]):p>0&&(o+=c*p,s+=h*p)}return c=n[0]-o,h=n[1]-s,c*c+h*h}function Ud(n,t,e,o,s,c,h,p){var g=e-n,m=o-t,_=h-s,w=p-c,x=n-s,b=t-c,P=g*g+m*m,I=g*_+m*w,S=_*_+w*w,E=g*x+m*b,R=_*x+w*b,T=P*S-I*I,F,W,X,q,D=T,xt=T;T===0?(W=0,D=1,q=R,xt=S):(W=I*R-S*E,q=P*R-I*E,W<0?(W=0,q=R,xt=S):W>D&&(W=D,q=R+I,xt=S)),q<0?(q=0,-E<0?W=0:-E>P?W=D:(W=-E,D=P)):q>xt&&(q=xt,-E+I<0?W=0:-E+I>P?W=D:(W=-E+I,D=P)),F=W===0?0:W/D,X=q===0?0:q/xt;var B=(1-F)*n+F*e,j=(1-F)*t+F*o,J=(1-X)*s+X*h,Dt=(1-X)*c+X*p,Q=J-B,At=Dt-j;return Q*Q+At*At}function M9(n,t){return n[0]===t[0]?n[1]-t[1]:n[0]-t[0]}function b9(n){n.sort(M9);for(var t=[],e=0;e<n.length;e++){for(;t.length>=2&&kc(t[t.length-2],t[t.length-1],n[e])<=0;)t.pop();t.push(n[e])}for(var o=[],s=n.length-1;s>=0;s--){for(;o.length>=2&&kc(o[o.length-2],o[o.length-1],n[s])<=0;)o.pop();o.push(n[s])}return o.pop(),t.pop(),t.concat(o)}});var xC=at((Pv,Iv)=>{(function(n,t){typeof Pv=="object"&&typeof Iv!="undefined"?Iv.exports=t():typeof define=="function"&&define.amd?define(t):n.quickselect=t()})(Pv,function(){"use strict";function n(s,c,h,p,g){t(s,c,h||0,p||s.length-1,g||o)}function t(s,c,h,p,g){for(;p>h;){if(p-h>600){var m=p-h+1,_=c-h+1,w=Math.log(m),x=.5*Math.exp(2*w/3),b=.5*Math.sqrt(w*x*(m-x)/m)*(_-m/2<0?-1:1),P=Math.max(h,Math.floor(c-_*x/m+b)),I=Math.min(p,Math.floor(c+(m-_)*x/m+b));t(s,c,P,I,g)}var S=s[c],E=h,R=p;for(e(s,h,c),g(s[p],S)>0&&e(s,h,p);E<R;){for(e(s,E,R),E++,R--;g(s[E],S)<0;)E++;for(;g(s[R],S)>0;)R--}g(s[h],S)===0?e(s,h,R):(R++,e(s,R,p)),R<=c&&(h=R+1),c<=R&&(p=R-1)}}function e(s,c,h){var p=s[c];s[c]=s[h],s[h]=p}function o(s,c){return s<c?-1:s>c?1:0}return n})});var Ov=at((int,Nv)=>{"use strict";Nv.exports=rh;Nv.exports.default=rh;var B9=xC();function rh(n,t){if(!(this instanceof rh))return new rh(n,t);this._maxEntries=Math.max(4,n||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}rh.prototype={all:function(){return this._all(this.data,[])},search:function(n){var t=this.data,e=[],o=this.toBBox;if(!Gd(n,t))return e;for(var s=[],c,h,p,g;t;){for(c=0,h=t.children.length;c<h;c++)p=t.children[c],g=t.leaf?o(p):p,Gd(n,g)&&(t.leaf?e.push(p):Lv(n,g)?this._all(p,e):s.push(p));t=s.pop()}return e},collides:function(n){var t=this.data,e=this.toBBox;if(!Gd(n,t))return!1;for(var o=[],s,c,h,p;t;){for(s=0,c=t.children.length;s<c;s++)if(h=t.children[s],p=t.leaf?e(h):h,Gd(n,p)){if(t.leaf||Lv(n,p))return!0;o.push(h)}t=o.pop()}return!1},load:function(n){if(!(n&&n.length))return this;if(n.length<this._minEntries){for(var t=0,e=n.length;t<e;t++)this.insert(n[t]);return this}var o=this._build(n.slice(),0,n.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var s=this.data;this.data=o,o=s}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(n){return n&&this._insert(n,this.data.height-1),this},clear:function(){return this.data=Vc([]),this},remove:function(n,t){if(!n)return this;for(var e=this.data,o=this.toBBox(n),s=[],c=[],h,p,g,m;e||s.length;){if(e||(e=s.pop(),p=s[s.length-1],h=c.pop(),m=!0),e.leaf&&(g=z9(n,e.children,t),g!==-1))return e.children.splice(g,1),s.push(e),this._condense(s),this;!m&&!e.leaf&&Lv(e,o)?(s.push(e),c.push(h),h=0,p=e,e=e.children[0]):p?(h++,e=p.children[h],m=!1):e=null}return this},toBBox:function(n){return n},compareMinX:EC,compareMinY:wC,toJSON:function(){return this.data},fromJSON:function(n){return this.data=n,this},_all:function(n,t){for(var e=[];n;)n.leaf?t.push.apply(t,n.children):e.push.apply(e,n.children),n=e.pop();return t},_build:function(n,t,e,o){var s=e-t+1,c=this._maxEntries,h;if(s<=c)return h=Vc(n.slice(t,e+1)),Hc(h,this.toBBox),h;o||(o=Math.ceil(Math.log(s)/Math.log(c)),c=Math.ceil(s/Math.pow(c,o-1))),h=Vc([]),h.leaf=!1,h.height=o;var p=Math.ceil(s/c),g=p*Math.ceil(Math.sqrt(c)),m,_,w,x;for(SC(n,t,e,g,this.compareMinX),m=t;m<=e;m+=g)for(w=Math.min(m+g-1,e),SC(n,m,w,p,this.compareMinY),_=m;_<=w;_+=p)x=Math.min(_+p-1,w),h.children.push(this._build(n,_,x,o-1));return Hc(h,this.toBBox),h},_chooseSubtree:function(n,t,e,o){for(var s,c,h,p,g,m,_,w;o.push(t),!(t.leaf||o.length-1===e);){for(_=w=1/0,s=0,c=t.children.length;s<c;s++)h=t.children[s],g=Rv(h),m=G9(n,h)-g,m<w?(w=m,_=g<_?g:_,p=h):m===w&&g<_&&(_=g,p=h);t=p||t.children[0]}return t},_insert:function(n,t,e){var o=this.toBBox,s=e?n:o(n),c=[],h=this._chooseSubtree(s,this.data,t,c);for(h.children.push(n),nh(h,s);t>=0&&c[t].children.length>this._maxEntries;)this._split(c,t),t--;this._adjustParentBBoxes(s,c,t)},_split:function(n,t){var e=n[t],o=e.children.length,s=this._minEntries;this._chooseSplitAxis(e,s,o);var c=this._chooseSplitIndex(e,s,o),h=Vc(e.children.splice(c,e.children.length-c));h.height=e.height,h.leaf=e.leaf,Hc(e,this.toBBox),Hc(h,this.toBBox),t?n[t-1].children.push(h):this._splitRoot(e,h)},_splitRoot:function(n,t){this.data=Vc([n,t]),this.data.height=n.height+1,this.data.leaf=!1,Hc(this.data,this.toBBox)},_chooseSplitIndex:function(n,t,e){var o,s,c,h,p,g,m,_;for(g=m=1/0,o=t;o<=e-t;o++)s=eh(n,0,o,this.toBBox),c=eh(n,o,e,this.toBBox),h=k9(s,c),p=Rv(s)+Rv(c),h<g?(g=h,_=o,m=p<m?p:m):h===g&&p<m&&(m=p,_=o);return _},_chooseSplitAxis:function(n,t,e){var o=n.leaf?this.compareMinX:EC,s=n.leaf?this.compareMinY:wC,c=this._allDistMargin(n,t,e,o),h=this._allDistMargin(n,t,e,s);c<h&&n.children.sort(o)},_allDistMargin:function(n,t,e,o){n.children.sort(o);var s=this.toBBox,c=eh(n,0,t,s),h=eh(n,e-t,e,s),p=zd(c)+zd(h),g,m;for(g=t;g<e-t;g++)m=n.children[g],nh(c,n.leaf?s(m):m),p+=zd(c);for(g=e-t-1;g>=t;g--)m=n.children[g],nh(h,n.leaf?s(m):m),p+=zd(h);return p},_adjustParentBBoxes:function(n,t,e){for(var o=e;o>=0;o--)nh(t[o],n)},_condense:function(n){for(var t=n.length-1,e;t>=0;t--)n[t].children.length===0?t>0?(e=n[t-1].children,e.splice(e.indexOf(n[t]),1)):this.clear():Hc(n[t],this.toBBox)},_initFormat:function(n){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(n[0])),this.compareMinY=new Function("a","b",t.join(n[1])),this.toBBox=new Function("a","return {minX: a"+n[0]+", minY: a"+n[1]+", maxX: a"+n[2]+", maxY: a"+n[3]+"};")}};function z9(n,t,e){if(!e)return t.indexOf(n);for(var o=0;o<t.length;o++)if(e(n,t[o]))return o;return-1}function Hc(n,t){eh(n,0,n.children.length,t,n)}function eh(n,t,e,o,s){s||(s=Vc(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(var c=t,h;c<e;c++)h=n.children[c],nh(s,n.leaf?o(h):h);return s}function nh(n,t){return n.minX=Math.min(n.minX,t.minX),n.minY=Math.min(n.minY,t.minY),n.maxX=Math.max(n.maxX,t.maxX),n.maxY=Math.max(n.maxY,t.maxY),n}function EC(n,t){return n.minX-t.minX}function wC(n,t){return n.minY-t.minY}function Rv(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function zd(n){return n.maxX-n.minX+(n.maxY-n.minY)}function G9(n,t){return(Math.max(t.maxX,n.maxX)-Math.min(t.minX,n.minX))*(Math.max(t.maxY,n.maxY)-Math.min(t.minY,n.minY))}function k9(n,t){var e=Math.max(n.minX,t.minX),o=Math.max(n.minY,t.minY),s=Math.min(n.maxX,t.maxX),c=Math.min(n.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,c-o)}function Lv(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function Gd(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function Vc(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function SC(n,t,e,o,s){for(var c=[t,e],h;c.length;)e=c.pop(),t=c.pop(),!(e-t<=o)&&(h=t+Math.ceil((e-t)/o/2)*o,B9(n,h,t,e,s),c.push(t,h,h,e))}});var PC=at((yrt,Gv)=>{"use strict";Gv.exports=Vd;Gv.exports.default=Vd;function Vd(n,t,e){e=e||2;var o=t&&t.length,s=o?t[0]*e:n.length,c=AC(n,0,s,e,!0),h=[];if(!c||c.next===c.prev)return h;var p,g,m,_,w,x,b;if(o&&(c=K9(n,t,c,e)),n.length>80*e){p=m=n[0],g=_=n[1];for(var P=e;P<s;P+=e)w=n[P],x=n[P+1],w<p&&(p=w),x<g&&(g=x),w>m&&(m=w),x>_&&(_=x);b=Math.max(m-p,_-g),b=b!==0?32767/b:0}return sh(c,h,e,p,g,b,0),h}function AC(n,t,e,o,s){var c,h;if(s===zv(n,t,e,o)>0)for(c=t;c<e;c+=o)h=bC(c,n[c],n[c+1],h);else for(c=e-o;c>=t;c-=o)h=bC(c,n[c],n[c+1],h);return h&&Wd(h,h.next)&&(uh(h),h=h.next),h}function Dl(n,t){if(!n)return n;t||(t=n);var e=n,o;do if(o=!1,!e.steiner&&(Wd(e,e.next)||qr(e.prev,e,e.next)===0)){if(uh(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function sh(n,t,e,o,s,c,h){if(n){!h&&c&&nX(n,o,s,c);for(var p=n,g,m;n.prev!==n.next;){if(g=n.prev,m=n.next,c?$9(n,o,s,c):Y9(n)){t.push(g.i/e|0),t.push(n.i/e|0),t.push(m.i/e|0),uh(n),n=m.next,p=m.next;continue}if(n=m,n===p){h?h===1?(n=Z9(Dl(n),t,e),sh(n,t,e,o,s,c,2)):h===2&&J9(n,t,e,o,s,c):sh(Dl(n),t,e,o,s,c,1);break}}}}function Y9(n){var t=n.prev,e=n,o=n.next;if(qr(t,e,o)>=0)return!1;for(var s=t.x,c=e.x,h=o.x,p=t.y,g=e.y,m=o.y,_=s<c?s<h?s:h:c<h?c:h,w=p<g?p<m?p:m:g<m?g:m,x=s>c?s>h?s:h:c>h?c:h,b=p>g?p>m?p:m:g>m?g:m,P=o.next;P!==t;){if(P.x>=_&&P.x<=x&&P.y>=w&&P.y<=b&&Yc(s,p,c,g,h,m,P.x,P.y)&&qr(P.prev,P,P.next)>=0)return!1;P=P.next}return!0}function $9(n,t,e,o){var s=n.prev,c=n,h=n.next;if(qr(s,c,h)>=0)return!1;for(var p=s.x,g=c.x,m=h.x,_=s.y,w=c.y,x=h.y,b=p<g?p<m?p:m:g<m?g:m,P=_<w?_<x?_:x:w<x?w:x,I=p>g?p>m?p:m:g>m?g:m,S=_>w?_>x?_:x:w>x?w:x,E=Uv(b,P,t,e,o),R=Uv(I,S,t,e,o),T=n.prevZ,F=n.nextZ;T&&T.z>=E&&F&&F.z<=R;){if(T.x>=b&&T.x<=I&&T.y>=P&&T.y<=S&&T!==s&&T!==h&&Yc(p,_,g,w,m,x,T.x,T.y)&&qr(T.prev,T,T.next)>=0||(T=T.prevZ,F.x>=b&&F.x<=I&&F.y>=P&&F.y<=S&&F!==s&&F!==h&&Yc(p,_,g,w,m,x,F.x,F.y)&&qr(F.prev,F,F.next)>=0))return!1;F=F.nextZ}for(;T&&T.z>=E;){if(T.x>=b&&T.x<=I&&T.y>=P&&T.y<=S&&T!==s&&T!==h&&Yc(p,_,g,w,m,x,T.x,T.y)&&qr(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;F&&F.z<=R;){if(F.x>=b&&F.x<=I&&F.y>=P&&F.y<=S&&F!==s&&F!==h&&Yc(p,_,g,w,m,x,F.x,F.y)&&qr(F.prev,F,F.next)>=0)return!1;F=F.nextZ}return!0}function Z9(n,t,e){var o=n;do{var s=o.prev,c=o.next.next;!Wd(s,c)&&TC(s,o,o.next,c)&&ah(s,c)&&ah(c,s)&&(t.push(s.i/e|0),t.push(o.i/e|0),t.push(c.i/e|0),uh(o),uh(o.next),o=n=c),o=o.next}while(o!==n);return Dl(o)}function J9(n,t,e,o,s,c){var h=n;do{for(var p=h.next.next;p!==h.prev;){if(h.i!==p.i&&oX(h,p)){var g=CC(h,p);h=Dl(h,h.next),g=Dl(g,g.next),sh(h,t,e,o,s,c,0),sh(g,t,e,o,s,c,0);return}p=p.next}h=h.next}while(h!==n)}function K9(n,t,e,o){var s=[],c,h,p,g,m;for(c=0,h=t.length;c<h;c++)p=t[c]*o,g=c<h-1?t[c+1]*o:n.length,m=AC(n,p,g,o,!1),m===m.next&&(m.steiner=!0),s.push(iX(m));for(s.sort(j9),c=0;c<s.length;c++)e=Q9(s[c],e);return e}function j9(n,t){return n.x-t.x}function Q9(n,t){var e=tX(n,t);if(!e)return t;var o=CC(e,n);return Dl(o,o.next),Dl(e,e.next)}function tX(n,t){var e=t,o=n.x,s=n.y,c=-1/0,h;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var p=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(p<=o&&p>c&&(c=p,h=e.x<e.next.x?e:e.next,p===o))return h}e=e.next}while(e!==t);if(!h)return null;var g=h,m=h.x,_=h.y,w=1/0,x;e=h;do o>=e.x&&e.x>=m&&o!==e.x&&Yc(s<_?o:c,s,m,_,s<_?c:o,s,e.x,e.y)&&(x=Math.abs(s-e.y)/(o-e.x),ah(e,n)&&(x<w||x===w&&(e.x>h.x||e.x===h.x&&eX(h,e)))&&(h=e,w=x)),e=e.next;while(e!==g);return h}function eX(n,t){return qr(n.prev,n,t.prev)<0&&qr(t.next,n,n.next)<0}function nX(n,t,e,o){var s=n;do s.z===0&&(s.z=Uv(s.x,s.y,t,e,o)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,rX(s)}function rX(n){var t,e,o,s,c,h,p,g,m=1;do{for(e=n,n=null,c=null,h=0;e;){for(h++,o=e,p=0,t=0;t<m&&(p++,o=o.nextZ,!!o);t++);for(g=m;p>0||g>0&&o;)p!==0&&(g===0||!o||e.z<=o.z)?(s=e,e=e.nextZ,p--):(s=o,o=o.nextZ,g--),c?c.nextZ=s:n=s,s.prevZ=c,c=s;e=o}c.nextZ=null,m*=2}while(h>1);return n}function Uv(n,t,e,o,s){return n=(n-e)*s|0,t=(t-o)*s|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,n|t<<1}function iX(n){var t=n,e=n;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==n);return e}function Yc(n,t,e,o,s,c,h,p){return(s-h)*(t-p)>=(n-h)*(c-p)&&(n-h)*(o-p)>=(e-h)*(t-p)&&(e-h)*(c-p)>=(s-h)*(o-p)}function oX(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!sX(n,t)&&(ah(n,t)&&ah(t,n)&&aX(n,t)&&(qr(n.prev,n,t.prev)||qr(n,t.prev,t))||Wd(n,t)&&qr(n.prev,n,n.next)>0&&qr(t.prev,t,t.next)>0)}function qr(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function Wd(n,t){return n.x===t.x&&n.y===t.y}function TC(n,t,e,o){var s=Hd(qr(n,t,e)),c=Hd(qr(n,t,o)),h=Hd(qr(e,o,n)),p=Hd(qr(e,o,t));return!!(s!==c&&h!==p||s===0&&qd(n,e,t)||c===0&&qd(n,o,t)||h===0&&qd(e,n,o)||p===0&&qd(e,t,o))}function qd(n,t,e){return t.x<=Math.max(n.x,e.x)&&t.x>=Math.min(n.x,e.x)&&t.y<=Math.max(n.y,e.y)&&t.y>=Math.min(n.y,e.y)}function Hd(n){return n>0?1:n<0?-1:0}function sX(n,t){var e=n;do{if(e.i!==n.i&&e.next.i!==n.i&&e.i!==t.i&&e.next.i!==t.i&&TC(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function ah(n,t){return qr(n.prev,n,n.next)<0?qr(n,t,n.next)>=0&&qr(n,n.prev,t)>=0:qr(n,t,n.prev)<0||qr(n,n.next,t)<0}function aX(n,t){var e=n,o=!1,s=(n.x+t.x)/2,c=(n.y+t.y)/2;do e.y>c!=e.next.y>c&&e.next.y!==e.y&&s<(e.next.x-e.x)*(c-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==n);return o}function CC(n,t){var e=new Bv(n.i,n.x,n.y),o=new Bv(t.i,t.x,t.y),s=n.next,c=t.prev;return n.next=t,t.prev=n,e.next=s,s.prev=e,o.next=e,e.prev=o,c.next=o,o.prev=c,o}function bC(n,t,e,o){var s=new Bv(n,t,e);return o?(s.next=o.next,s.prev=o,o.next.prev=s,o.next=s):(s.prev=s,s.next=s),s}function uh(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Bv(n,t,e){this.i=n,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Vd.deviation=function(n,t,e,o){var s=t&&t.length,c=s?t[0]*e:n.length,h=Math.abs(zv(n,0,c,e));if(s)for(var p=0,g=t.length;p<g;p++){var m=t[p]*e,_=p<g-1?t[p+1]*e:n.length;h-=Math.abs(zv(n,m,_,e))}var w=0;for(p=0;p<o.length;p+=3){var x=o[p]*e,b=o[p+1]*e,P=o[p+2]*e;w+=Math.abs((n[x]-n[P])*(n[b+1]-n[x+1])-(n[x]-n[b])*(n[P+1]-n[x+1]))}return h===0&&w===0?0:Math.abs((w-h)/h)};function zv(n,t,e,o){for(var s=0,c=t,h=e-o;c<e;c+=o)s+=(n[h]-n[c])*(n[c+1]+n[h+1]),h=c;return s}Vd.flatten=function(n){for(var t=n[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,s=0;s<n.length;s++){for(var c=0;c<n[s].length;c++)for(var h=0;h<t;h++)e.vertices.push(n[s][c][h]);s>0&&(o+=n[s-1].length,e.holes.push(o))}return e}});var Wv=at(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.earthRadius=63710088e-1;Oe.factors={centimeters:Oe.earthRadius*100,centimetres:Oe.earthRadius*100,degrees:Oe.earthRadius/111325,feet:Oe.earthRadius*3.28084,inches:Oe.earthRadius*39.37,kilometers:Oe.earthRadius/1e3,kilometres:Oe.earthRadius/1e3,meters:Oe.earthRadius,metres:Oe.earthRadius,miles:Oe.earthRadius/1609.344,millimeters:Oe.earthRadius*1e3,millimetres:Oe.earthRadius*1e3,nauticalmiles:Oe.earthRadius/1852,radians:1,yards:Oe.earthRadius*1.0936};Oe.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Oe.earthRadius,yards:1.0936133};Oe.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Ju(n,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=n,o}Oe.feature=Ju;function lX(n,t,e){switch(e===void 0&&(e={}),n){case"Point":return kv(t).geometry;case"LineString":return Hv(t).geometry;case"Polygon":return qv(t).geometry;case"MultiPoint":return RC(t).geometry;case"MultiLineString":return IC(t).geometry;case"MultiPolygon":return LC(t).geometry;default:throw new Error(n+" is invalid")}}Oe.geometry=lX;function kv(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Xd(n[0])||!Xd(n[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:n};return Ju(o,t,e)}Oe.point=kv;function cX(n,t,e){return e===void 0&&(e={}),Yd(n.map(function(o){return kv(o,t)}),e)}Oe.points=cX;function qv(n,t,e){e===void 0&&(e={});for(var o=0,s=n;o<s.length;o++){var c=s[o];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<c[c.length-1].length;h++)if(c[c.length-1][h]!==c[0][h])throw new Error("First and last Position are not equivalent.")}var p={type:"Polygon",coordinates:n};return Ju(p,t,e)}Oe.polygon=qv;function fX(n,t,e){return e===void 0&&(e={}),Yd(n.map(function(o){return qv(o,t)}),e)}Oe.polygons=fX;function Hv(n,t,e){if(e===void 0&&(e={}),n.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:n};return Ju(o,t,e)}Oe.lineString=Hv;function hX(n,t,e){return e===void 0&&(e={}),Yd(n.map(function(o){return Hv(o,t)}),e)}Oe.lineStrings=hX;function Yd(n,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=n,e}Oe.featureCollection=Yd;function IC(n,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:n};return Ju(o,t,e)}Oe.multiLineString=IC;function RC(n,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:n};return Ju(o,t,e)}Oe.multiPoint=RC;function LC(n,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:n};return Ju(o,t,e)}Oe.multiPolygon=LC;function pX(n,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:n};return Ju(o,t,e)}Oe.geometryCollection=pX;function dX(n,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(n*e)/e}Oe.round=dX;function NC(n,t){t===void 0&&(t="kilometers");var e=Oe.factors[t];if(!e)throw new Error(t+" units is invalid");return n*e}Oe.radiansToLength=NC;function Vv(n,t){t===void 0&&(t="kilometers");var e=Oe.factors[t];if(!e)throw new Error(t+" units is invalid");return n/e}Oe.lengthToRadians=Vv;function gX(n,t){return OC(Vv(n,t))}Oe.lengthToDegrees=gX;function mX(n){var t=n%360;return t<0&&(t+=360),t}Oe.bearingToAzimuth=mX;function OC(n){var t=n%(2*Math.PI);return t*180/Math.PI}Oe.radiansToDegrees=OC;function yX(n){var t=n%360;return t*Math.PI/180}Oe.degreesToRadians=yX;function vX(n,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("length must be a positive number");return NC(Vv(n,t),e)}Oe.convertLength=vX;function _X(n,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("area must be a positive number");var o=Oe.areaFactors[t];if(!o)throw new Error("invalid original units");var s=Oe.areaFactors[e];if(!s)throw new Error("invalid final units");return n/o*s}Oe.convertArea=_X;function Xd(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}Oe.isNumber=Xd;function xX(n){return!!n&&n.constructor===Object}Oe.isObject=xX;function EX(n){if(!n)throw new Error("bbox is required");if(!Array.isArray(n))throw new Error("bbox must be an Array");if(n.length!==4&&n.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");n.forEach(function(t){if(!Xd(t))throw new Error("bbox must only contain numbers")})}Oe.validateBBox=EX;function wX(n){if(!n)throw new Error("id is required");if(["string","number"].indexOf(typeof n)===-1)throw new Error("id must be a number or a string")}Oe.validateId=wX});var Yv=at(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});var uo=Wv();function lh(n,t,e){if(n!==null)for(var o,s,c,h,p,g,m,_=0,w=0,x,b=n.type,P=b==="FeatureCollection",I=b==="Feature",S=P?n.features.length:1,E=0;E<S;E++){m=P?n.features[E].geometry:I?n.geometry:n,x=m?m.type==="GeometryCollection":!1,p=x?m.geometries.length:1;for(var R=0;R<p;R++){var T=0,F=0;if(h=x?m.geometries[R]:m,h!==null){g=h.coordinates;var W=h.type;switch(_=e&&(W==="Polygon"||W==="MultiPolygon")?1:0,W){case null:break;case"Point":if(t(g,w,E,T,F)===!1)return!1;w++,T++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],w,E,T,F)===!1)return!1;w++,W==="MultiPoint"&&T++}W==="LineString"&&T++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(s=0;s<g[o].length-_;s++){if(t(g[o][s],w,E,T,F)===!1)return!1;w++}W==="MultiLineString"&&T++,W==="Polygon"&&F++}W==="Polygon"&&T++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(F=0,s=0;s<g[o].length;s++){for(c=0;c<g[o][s].length-_;c++){if(t(g[o][s][c],w,E,T,F)===!1)return!1;w++}F++}T++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(lh(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function SX(n,t,e,o){var s=e;return lh(n,function(c,h,p,g,m){h===0&&e===void 0?s=c:s=t(s,c,h,p,g,m)},o),s}function DC(n,t){var e;switch(n.type){case"FeatureCollection":for(e=0;e<n.features.length&&t(n.features[e].properties,e)!==!1;e++);break;case"Feature":t(n.properties,0);break}}function MX(n,t,e){var o=e;return DC(n,function(s,c){c===0&&e===void 0?o=s:o=t(o,s,c)}),o}function FC(n,t){if(n.type==="Feature")t(n,0);else if(n.type==="FeatureCollection")for(var e=0;e<n.features.length&&t(n.features[e],e)!==!1;e++);}function bX(n,t,e){var o=e;return FC(n,function(s,c){c===0&&e===void 0?o=s:o=t(o,s,c)}),o}function AX(n){var t=[];return lh(n,function(e){t.push(e)}),t}function Xv(n,t){var e,o,s,c,h,p,g,m,_,w,x=0,b=n.type==="FeatureCollection",P=n.type==="Feature",I=b?n.features.length:1;for(e=0;e<I;e++){for(p=b?n.features[e].geometry:P?n.geometry:n,m=b?n.features[e].properties:P?n.properties:{},_=b?n.features[e].bbox:P?n.bbox:void 0,w=b?n.features[e].id:P?n.id:void 0,g=p?p.type==="GeometryCollection":!1,h=g?p.geometries.length:1,s=0;s<h;s++){if(c=g?p.geometries[s]:p,c===null){if(t(null,x,m,_,w)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(c,x,m,_,w)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<c.geometries.length;o++)if(t(c.geometries[o],x,m,_,w)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}x++}}function TX(n,t,e){var o=e;return Xv(n,function(s,c,h,p,g){c===0&&e===void 0?o=s:o=t(o,s,c,h,p,g)}),o}function $d(n,t){Xv(n,function(e,o,s,c,h){var p=e===null?null:e.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return t(uo.feature(e,s,{bbox:c,id:h}),o,0)===!1?!1:void 0}var g;switch(p){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var m=0;m<e.coordinates.length;m++){var _=e.coordinates[m],w={type:g,coordinates:_};if(t(uo.feature(w,s),o,m)===!1)return!1}})}function CX(n,t,e){var o=e;return $d(n,function(s,c,h){c===0&&h===0&&e===void 0?o=s:o=t(o,s,c,h)}),o}function UC(n,t){$d(n,function(e,o,s){var c=0;if(e.geometry){var h=e.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var p,g=0,m=0,_=0;if(lh(e,function(w,x,b,P,I){if(p===void 0||o>g||P>m||I>_){p=w,g=o,m=P,_=I,c=0;return}var S=uo.lineString([p,w],e.properties);if(t(S,o,s,I,c)===!1)return!1;c++,p=w})===!1)return!1}}})}function PX(n,t,e){var o=e,s=!1;return UC(n,function(c,h,p,g,m){s===!1&&e===void 0?o=c:o=t(o,c,h,p,g,m),s=!0}),o}function BC(n,t){if(!n)throw new Error("geojson is required");$d(n,function(e,o,s){if(e.geometry!==null){var c=e.geometry.type,h=e.geometry.coordinates;switch(c){case"LineString":if(t(e,o,s,0,0)===!1)return!1;break;case"Polygon":for(var p=0;p<h.length;p++)if(t(uo.lineString(h[p],e.properties),o,s,p)===!1)return!1;break}}})}function IX(n,t,e){var o=e;return BC(n,function(s,c,h,p){c===0&&e===void 0?o=s:o=t(o,s,c,h,p)}),o}function RX(n,t){if(t=t||{},!uo.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,s=t.geometryIndex||0,c=t.segmentIndex||0,h=t.properties,p;switch(n.type){case"FeatureCollection":e<0&&(e=n.features.length+e),h=h||n.features[e].properties,p=n.features[e].geometry;break;case"Feature":h=h||n.properties,p=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=n;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var g=p.coordinates;switch(p.type){case"Point":case"MultiPoint":return null;case"LineString":return c<0&&(c=g.length+c-1),uo.lineString([g[c],g[c+1]],h,t);case"Polygon":return s<0&&(s=g.length+s),c<0&&(c=g[s].length+c-1),uo.lineString([g[s][c],g[s][c+1]],h,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c-1),uo.lineString([g[o][c],g[o][c+1]],h,t);case"MultiPolygon":return o<0&&(o=g.length+o),s<0&&(s=g[o].length+s),c<0&&(c=g[o][s].length-c-1),uo.lineString([g[o][s][c],g[o][s][c+1]],h,t)}throw new Error("geojson is invalid")}function LX(n,t){if(t=t||{},!uo.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,s=t.geometryIndex||0,c=t.coordIndex||0,h=t.properties,p;switch(n.type){case"FeatureCollection":e<0&&(e=n.features.length+e),h=h||n.features[e].properties,p=n.features[e].geometry;break;case"Feature":h=h||n.properties,p=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=n;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var g=p.coordinates;switch(p.type){case"Point":return uo.point(g,h,t);case"MultiPoint":return o<0&&(o=g.length+o),uo.point(g[o],h,t);case"LineString":return c<0&&(c=g.length+c),uo.point(g[c],h,t);case"Polygon":return s<0&&(s=g.length+s),c<0&&(c=g[s].length+c),uo.point(g[s][c],h,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c),uo.point(g[o][c],h,t);case"MultiPolygon":return o<0&&(o=g.length+o),s<0&&(s=g[o].length+s),c<0&&(c=g[o][s].length-c),uo.point(g[o][s][c],h,t)}throw new Error("geojson is invalid")}Ei.coordAll=AX;Ei.coordEach=lh;Ei.coordReduce=SX;Ei.featureEach=FC;Ei.featureReduce=bX;Ei.findPoint=LX;Ei.findSegment=RX;Ei.flattenEach=$d;Ei.flattenReduce=CX;Ei.geomEach=Xv;Ei.geomReduce=TX;Ei.lineEach=BC;Ei.lineReduce=IX;Ei.propEach=DC;Ei.propReduce=MX;Ei.segmentEach=UC;Ei.segmentReduce=PX});var zC=at(Zv=>{"use strict";Object.defineProperty(Zv,"__esModule",{value:!0});var NX=Yv();function $v(n){var t=[1/0,1/0,-1/0,-1/0];return NX.coordEach(n,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}$v.default=$v;Zv.default=$v});var Zd=at((Nrt,Jv)=>{var Pa=Ev(),kC=Wv(),qC=Yv(),$c=zC().default,OX=qC.featureEach,Rrt=qC.coordEach,Lrt=kC.polygon,GC=kC.featureCollection;function HC(n){var t=new Pa(n);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:$c(e),Pa.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:$c(s),o.push(s)}):OX(e,function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:$c(s),o.push(s)}),Pa.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:$c(e),Pa.prototype.remove.call(this,e,o)},t.clear=function(){return Pa.prototype.clear.call(this)},t.search=function(e){var o=Pa.prototype.search.call(this,this.toBBox(e));return GC(o)},t.collides=function(e){return Pa.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=Pa.prototype.all.call(this);return GC(e)},t.toJSON=function(){return Pa.prototype.toJSON.call(this)},t.fromJSON=function(e){return Pa.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=$c(e);else if(e.type==="FeatureCollection")o=$c(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Jv.exports=HC;Jv.exports.default=HC});var n_=at((qot,QC)=>{"use strict";var jC=Object.prototype.toString;QC.exports=function(t){var e=jC.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&jC.call(t.callee)==="[object Function]"),o}});var uP=at((Hot,aP)=>{"use strict";var sP;Object.keys||(hh=Object.prototype.hasOwnProperty,r_=Object.prototype.toString,tP=n_(),i_=Object.prototype.propertyIsEnumerable,eP=!i_.call({toString:null},"toString"),nP=i_.call(function(){},"prototype"),ph=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],tg=function(n){var t=n.constructor;return t&&t.prototype===n},rP={$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},iP=function(){if(typeof window=="undefined")return!1;for(var n in window)try{if(!rP["$"+n]&&hh.call(window,n)&&window[n]!==null&&typeof window[n]=="object")try{tg(window[n])}catch(t){return!0}}catch(t){return!0}return!1}(),oP=function(n){if(typeof window=="undefined"||!iP)return tg(n);try{return tg(n)}catch(t){return!1}},sP=function(t){var e=t!==null&&typeof t=="object",o=r_.call(t)==="[object Function]",s=tP(t),c=e&&r_.call(t)==="[object String]",h=[];if(!e&&!o&&!s)throw new TypeError("Object.keys called on a non-object");var p=nP&&o;if(c&&t.length>0&&!hh.call(t,0))for(var g=0;g<t.length;++g)h.push(String(g));if(s&&t.length>0)for(var m=0;m<t.length;++m)h.push(String(m));else for(var _ in t)!(p&&_==="prototype")&&hh.call(t,_)&&h.push(String(_));if(eP)for(var w=oP(t),x=0;x<ph.length;++x)!(w&&ph[x]==="constructor")&&hh.call(t,ph[x])&&h.push(ph[x]);return h});var hh,r_,tP,i_,eP,nP,ph,tg,rP,iP,oP;aP.exports=sP});var o_=at((Vot,fP)=>{"use strict";var VX=Array.prototype.slice,WX=n_(),lP=Object.keys,eg=lP?function(t){return lP(t)}:uP(),cP=Object.keys;eg.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 WX(o)?cP(VX.call(o)):cP(o)})}else Object.keys=eg;return Object.keys||eg};fP.exports=eg});var s_=at((Wot,hP)=>{"use strict";hP.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(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 h=Object.getOwnPropertyDescriptor(t,e);if(h.value!==s||h.enumerable!==!0)return!1}return!0}});var ng=at((Xot,pP)=>{"use strict";var XX=s_();pP.exports=function(){return XX()&&!!Symbol.toStringTag}});var gP=at((Yot,dP)=>{"use strict";dP.exports=Error});var yP=at(($ot,mP)=>{"use strict";mP.exports=EvalError});var _P=at((Zot,vP)=>{"use strict";vP.exports=RangeError});var EP=at((Jot,xP)=>{"use strict";xP.exports=ReferenceError});var a_=at((Kot,wP)=>{"use strict";wP.exports=SyntaxError});var Fl=at((jot,SP)=>{"use strict";SP.exports=TypeError});var bP=at((Qot,MP)=>{"use strict";MP.exports=URIError});var CP=at((tst,TP)=>{"use strict";var AP=typeof Symbol!="undefined"&&Symbol,YX=s_();TP.exports=function(){return typeof AP!="function"||typeof Symbol!="function"||typeof AP("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:YX()}});var IP=at((est,PP)=>{"use strict";var u_={__proto__:null,foo:{}},$X=Object;PP.exports=function(){return{__proto__:u_}.foo===u_.foo&&!(u_ instanceof $X)}});var NP=at((nst,LP)=>{"use strict";var ZX="Function.prototype.bind called on incompatible ",JX=Object.prototype.toString,KX=Math.max,jX="[object Function]",RP=function(t,e){for(var o=[],s=0;s<t.length;s+=1)o[s]=t[s];for(var c=0;c<e.length;c+=1)o[c+t.length]=e[c];return o},QX=function(t,e){for(var o=[],s=e||0,c=0;s<t.length;s+=1,c+=1)o[c]=t[s];return o},t7=function(n,t){for(var e="",o=0;o<n.length;o+=1)e+=n[o],o+1<n.length&&(e+=t);return e};LP.exports=function(t){var e=this;if(typeof e!="function"||JX.apply(e)!==jX)throw new TypeError(ZX+e);for(var o=QX(arguments,1),s,c=function(){if(this instanceof s){var _=e.apply(this,RP(o,arguments));return Object(_)===_?_:this}return e.apply(t,RP(o,arguments))},h=KX(0,e.length-o.length),p=[],g=0;g<h;g++)p[g]="$"+g;if(s=Function("binder","return function ("+t7(p,",")+"){ return binder.apply(this,arguments); }")(c),e.prototype){var m=function(){};m.prototype=e.prototype,s.prototype=new m,m.prototype=null}return s}});var rg=at((rst,OP)=>{"use strict";var e7=NP();OP.exports=Function.prototype.bind||e7});var FP=at((ist,DP)=>{"use strict";var n7=Function.prototype.call,r7=Object.prototype.hasOwnProperty,i7=rg();DP.exports=i7.call(n7,r7)});var Qc=at((ost,kP)=>{"use strict";var Vn,o7=gP(),s7=yP(),a7=_P(),u7=EP(),jc=a_(),Kc=Fl(),l7=bP(),GP=Function,l_=function(n){try{return GP('"use strict"; return ('+n+").constructor;")()}catch(t){}},Ul=Object.getOwnPropertyDescriptor;if(Ul)try{Ul({},"")}catch(n){Ul=null}var c_=function(){throw new Kc},c7=Ul?function(){try{return arguments.callee,c_}catch(n){try{return Ul(arguments,"callee").get}catch(t){return c_}}}():c_,Zc=CP()(),f7=IP()(),ki=Object.getPrototypeOf||(f7?function(n){return n.__proto__}:null),Jc={},h7=typeof Uint8Array=="undefined"||!ki?Vn:ki(Uint8Array),Bl={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?Vn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Vn:ArrayBuffer,"%ArrayIteratorPrototype%":Zc&&ki?ki([][Symbol.iterator]()):Vn,"%AsyncFromSyncIteratorPrototype%":Vn,"%AsyncFunction%":Jc,"%AsyncGenerator%":Jc,"%AsyncGeneratorFunction%":Jc,"%AsyncIteratorPrototype%":Jc,"%Atomics%":typeof Atomics=="undefined"?Vn:Atomics,"%BigInt%":typeof BigInt=="undefined"?Vn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Vn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Vn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Vn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o7,"%eval%":eval,"%EvalError%":s7,"%Float32Array%":typeof Float32Array=="undefined"?Vn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Vn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Vn:FinalizationRegistry,"%Function%":GP,"%GeneratorFunction%":Jc,"%Int8Array%":typeof Int8Array=="undefined"?Vn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Vn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Vn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Zc&&ki?ki(ki([][Symbol.iterator]())):Vn,"%JSON%":typeof JSON=="object"?JSON:Vn,"%Map%":typeof Map=="undefined"?Vn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Zc||!ki?Vn:ki(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Vn:Promise,"%Proxy%":typeof Proxy=="undefined"?Vn:Proxy,"%RangeError%":a7,"%ReferenceError%":u7,"%Reflect%":typeof Reflect=="undefined"?Vn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Vn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Zc||!ki?Vn:ki(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Vn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Zc&&ki?ki(""[Symbol.iterator]()):Vn,"%Symbol%":Zc?Symbol:Vn,"%SyntaxError%":jc,"%ThrowTypeError%":c7,"%TypedArray%":h7,"%TypeError%":Kc,"%Uint8Array%":typeof Uint8Array=="undefined"?Vn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Vn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Vn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Vn:Uint32Array,"%URIError%":l7,"%WeakMap%":typeof WeakMap=="undefined"?Vn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Vn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Vn:WeakSet};if(ki)try{null.error}catch(n){UP=ki(ki(n)),Bl["%Error.prototype%"]=UP}var UP,p7=function n(t){var e;if(t==="%AsyncFunction%")e=l_("async function () {}");else if(t==="%GeneratorFunction%")e=l_("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=l_("async function* () {}");else if(t==="%AsyncGenerator%"){var o=n("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=n("%AsyncGenerator%");s&&ki&&(e=ki(s.prototype))}return Bl[t]=e,e},BP={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},dh=rg(),ig=FP(),d7=dh.call(Function.call,Array.prototype.concat),g7=dh.call(Function.apply,Array.prototype.splice),zP=dh.call(Function.call,String.prototype.replace),og=dh.call(Function.call,String.prototype.slice),m7=dh.call(Function.call,RegExp.prototype.exec),y7=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,v7=/\\\\(\\\\)?/g,_7=function(t){var e=og(t,0,1),o=og(t,-1);if(e==="%"&&o!=="%")throw new jc("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new jc("invalid intrinsic syntax, expected opening \`%\`");var s=[];return zP(t,y7,function(c,h,p,g){s[s.length]=p?zP(g,v7,"$1"):h||c}),s},x7=function(t,e){var o=t,s;if(ig(BP,o)&&(s=BP[o],o="%"+s[0]+"%"),ig(Bl,o)){var c=Bl[o];if(c===Jc&&(c=p7(o)),typeof c=="undefined"&&!e)throw new Kc("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:o,value:c}}throw new jc("intrinsic "+t+" does not exist!")};kP.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Kc("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Kc('"allowMissing" argument must be a boolean');if(m7(/^%?[^%]*%?$/,t)===null)throw new jc("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=_7(t),s=o.length>0?o[0]:"",c=x7("%"+s+"%",e),h=c.name,p=c.value,g=!1,m=c.alias;m&&(s=m[0],g7(o,d7([0,1],m)));for(var _=1,w=!0;_<o.length;_+=1){var x=o[_],b=og(x,0,1),P=og(x,-1);if((b==='"'||b==="'"||b==="\`"||P==='"'||P==="'"||P==="\`")&&b!==P)throw new jc("property names with quotes must have matching quotes");if((x==="constructor"||!w)&&(g=!0),s+="."+x,h="%"+s+"%",ig(Bl,h))p=Bl[h];else if(p!=null){if(!(x in p)){if(!e)throw new Kc("base intrinsic for "+t+" exists, but the property is not available.");return}if(Ul&&_+1>=o.length){var I=Ul(p,x);w=!!I,w&&"get"in I&&!("originalValue"in I.get)?p=I.get:p=p[x]}else w=ig(p,x),p=p[x];w&&!g&&(Bl[h]=p)}}return p}});var ag=at((sst,qP)=>{"use strict";var E7=Qc(),sg=E7("%Object.defineProperty%",!0)||!1;if(sg)try{sg({},"a",{value:1})}catch(n){sg=!1}qP.exports=sg});var f_=at((ast,HP)=>{"use strict";var w7=Qc(),ug=w7("%Object.getOwnPropertyDescriptor%",!0);if(ug)try{ug([],"length")}catch(n){ug=null}HP.exports=ug});var lg=at((ust,XP)=>{"use strict";var VP=ag(),S7=a_(),tf=Fl(),WP=f_();XP.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new tf("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new tf("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new tf("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new tf("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new tf("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new tf("\`loose\`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,g=!!WP&&WP(t,e);if(VP)VP(t,e,{configurable:h===null&&g?g.configurable:!h,enumerable:s===null&&g?g.enumerable:!s,value:o,writable:c===null&&g?g.writable:!c});else if(p||!s&&!c&&!h)t[e]=o;else throw new S7("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var cg=at((lst,$P)=>{"use strict";var h_=ag(),YP=function(){return!!h_};YP.hasArrayLengthDefineBug=function(){if(!h_)return null;try{return h_([],"length",{value:1}).length!==1}catch(t){return!0}};$P.exports=YP});var QP=at((cst,jP)=>{"use strict";var M7=Qc(),ZP=lg(),b7=cg()(),JP=f_(),KP=Fl(),A7=M7("%Math.floor%");jP.exports=function(t,e){if(typeof t!="function")throw new KP("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||A7(e)!==e)throw new KP("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],s=!0,c=!0;if("length"in t&&JP){var h=JP(t,"length");h&&!h.configurable&&(s=!1),h&&!h.writable&&(c=!1)}return(s||c||!o)&&(b7?ZP(t,"length",e,!0,!0):ZP(t,"length",e)),t}});var pg=at((fst,fg)=>{"use strict";var p_=rg(),hg=Qc(),T7=QP(),C7=Fl(),nI=hg("%Function.prototype.apply%"),rI=hg("%Function.prototype.call%"),iI=hg("%Reflect.apply%",!0)||p_.call(rI,nI),tI=ag(),P7=hg("%Math.max%");fg.exports=function(t){if(typeof t!="function")throw new C7("a function is required");var e=iI(p_,rI,arguments);return T7(e,1+P7(0,t.length-(arguments.length-1)),!0)};var eI=function(){return iI(p_,nI,arguments)};tI?tI(fg.exports,"apply",{value:eI}):fg.exports.apply=eI});var d_=at((hst,aI)=>{"use strict";var oI=Qc(),sI=pg(),I7=sI(oI("String.prototype.indexOf"));aI.exports=function(t,e){var o=oI(t,!!e);return typeof o=="function"&&I7(t,".prototype.")>-1?sI(o):o}});var cI=at((pst,lI)=>{"use strict";var R7=ng()(),L7=d_(),g_=L7("Object.prototype.toString"),dg=function(t){return R7&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:g_(t)==="[object Arguments]"},uI=function(t){return dg(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&g_(t)!=="[object Array]"&&g_(t.callee)==="[object Function]"},N7=function(){return dg(arguments)}();dg.isLegacyArguments=uI;lI.exports=N7?dg:uI});var ef=at((dst,dI)=>{"use strict";var O7=o_(),D7=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",F7=Object.prototype.toString,U7=Array.prototype.concat,fI=lg(),B7=function(n){return typeof n=="function"&&F7.call(n)==="[object Function]"},hI=cg()(),z7=function(n,t,e,o){if(t in n){if(o===!0){if(n[t]===e)return}else if(!B7(o)||!o())return}hI?fI(n,t,e,!0):fI(n,t,e)},pI=function(n,t){var e=arguments.length>2?arguments[2]:{},o=O7(t);D7&&(o=U7.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s<o.length;s+=1)z7(n,o[s],t[o[s]],e[o[s]])};pI.supportsDescriptors=!!hI;dI.exports=pI});var m_=at((gst,mI)=>{"use strict";var gI=function(n){return n!==n};mI.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||gI(t)&&gI(e))}});var y_=at((mst,yI)=>{"use strict";var G7=m_();yI.exports=function(){return typeof Object.is=="function"?Object.is:G7}});var _I=at((yst,vI)=>{"use strict";var k7=y_(),q7=ef();vI.exports=function(){var t=k7();return q7(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var SI=at((vst,wI)=>{"use strict";var H7=ef(),V7=pg(),W7=m_(),xI=y_(),X7=_I(),EI=V7(xI(),Object);H7(EI,{getPolyfill:xI,implementation:W7,shim:X7});wI.exports=EI});var CI=at((_st,TI)=>{"use strict";var v_=d_(),MI=ng()(),bI,AI,__,x_;MI&&(bI=v_("Object.prototype.hasOwnProperty"),AI=v_("RegExp.prototype.exec"),__={},gg=function(){throw __},x_={toString:gg,valueOf:gg},typeof Symbol.toPrimitive=="symbol"&&(x_[Symbol.toPrimitive]=gg));var gg,Y7=v_("Object.prototype.toString"),$7=Object.getOwnPropertyDescriptor,Z7="[object RegExp]";TI.exports=MI?function(t){if(!t||typeof t!="object")return!1;var e=$7(t,"lastIndex"),o=e&&bI(e,"value");if(!o)return!1;try{AI(t,x_)}catch(s){return s===__}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:Y7(t)===Z7}});var II=at((xst,PI)=>{"use strict";var mh=function(){return typeof function(){}.name=="string"},gh=Object.getOwnPropertyDescriptor;if(gh)try{gh([],"length")}catch(n){gh=null}mh.functionsHaveConfigurableNames=function(){if(!mh()||!gh)return!1;var t=gh(function(){},"name");return!!t&&!!t.configurable};var J7=Function.prototype.bind;mh.boundFunctionsHaveNames=function(){return mh()&&typeof J7=="function"&&function(){}.bind().name!==""};PI.exports=mh});var NI=at((Est,LI)=>{"use strict";var RI=lg(),K7=cg()(),j7=II().functionsHaveConfigurableNames(),Q7=Fl();LI.exports=function(t,e){if(typeof t!="function")throw new Q7("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||j7)&&(K7?RI(t,"name",e,!0,!0):RI(t,"name",e)),t}});var E_=at((wst,OI)=>{"use strict";var tY=NI(),eY=Fl(),nY=Object;OI.exports=tY(function(){if(this==null||this!==nY(this))throw new eY("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 w_=at((Sst,DI)=>{"use strict";var rY=E_(),iY=ef().supportsDescriptors,oY=Object.getOwnPropertyDescriptor;DI.exports=function(){if(iY&&/a/mig.flags==="gim"){var t=oY(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),t.get.call(o),e==="dy")return t.get}}return rY}});var BI=at((Mst,UI)=>{"use strict";var sY=ef().supportsDescriptors,aY=w_(),uY=Object.getOwnPropertyDescriptor,lY=Object.defineProperty,cY=TypeError,FI=Object.getPrototypeOf,fY=/a/;UI.exports=function(){if(!sY||!FI)throw new cY("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=aY(),e=FI(fY),o=uY(e,"flags");return(!o||o.get!==t)&&lY(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var qI=at((bst,kI)=>{"use strict";var hY=ef(),pY=pg(),dY=E_(),zI=w_(),gY=BI(),GI=pY(zI());hY(GI,{getPolyfill:zI,implementation:dY,shim:gY});kI.exports=GI});var VI=at((Ast,HI)=>{"use strict";var mY=Date.prototype.getDay,yY=function(t){try{return mY.call(t),!0}catch(e){return!1}},vY=Object.prototype.toString,_Y="[object Date]",xY=ng()();HI.exports=function(t){return typeof t!="object"||t===null?!1:xY?yY(t):vY.call(t)===_Y}});var S_=at((Tst,eR)=>{var WI=o_(),XI=cI(),YI=SI(),$I=CI(),ZI=qI(),JI=VI(),KI=Date.prototype.getTime;function tR(n,t,e){var o=e||{};return(o.strict?YI(n,t):n===t)?!0:!n||!t||typeof n!="object"&&typeof t!="object"?o.strict?YI(n,t):n==t:EY(n,t,o)}function jI(n){return n==null}function QI(n){return!(!n||typeof n!="object"||typeof n.length!="number"||typeof n.copy!="function"||typeof n.slice!="function"||n.length>0&&typeof n[0]!="number")}function EY(n,t,e){var o,s;if(typeof n!=typeof t||jI(n)||jI(t)||n.prototype!==t.prototype||XI(n)!==XI(t))return!1;var c=$I(n),h=$I(t);if(c!==h)return!1;if(c||h)return n.source===t.source&&ZI(n)===ZI(t);if(JI(n)&&JI(t))return KI.call(n)===KI.call(t);var p=QI(n),g=QI(t);if(p!==g)return!1;if(p||g){if(n.length!==t.length)return!1;for(o=0;o<n.length;o++)if(n[o]!==t[o])return!1;return!0}if(typeof n!=typeof t)return!1;try{var m=WI(n),_=WI(t)}catch(w){return!1}if(m.length!==_.length)return!1;for(m.sort(),_.sort(),o=m.length-1;o>=0;o--)if(m[o]!=_[o])return!1;for(o=m.length-1;o>=0;o--)if(s=m[o],!tR(n[s],t[s],e))return!1;return!0}eR.exports=tR});var D_=at((Nut,uR)=>{var f$=S_(),Ia=function(n){this.precision=n&&n.precision?n.precision:17,this.direction=n&&n.direction?n.direction:!1,this.pseudoNode=n&&n.pseudoNode?n.pseudoNode:!1,this.objectComparator=n&&n.objectComparator?n.objectComparator:h$};Ia.prototype.compare=function(n,t){if(n.type!==t.type||!aR(n,t))return!1;switch(n.type){case"Point":return this.compareCoord(n.coordinates,t.coordinates);case"LineString":return this.compareLine(n.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(n,t);case"Feature":return this.compareFeature(n,t);default:if(n.type.indexOf("Multi")===0){var e=this,o=sR(n),s=sR(t);return o.every(function(c){return this.some(function(h){return e.compare(c,h)})},s)}}return!1};function sR(n){return n.coordinates.map(function(t){return{type:n.type.replace("Multi",""),coordinates:t}})}function aR(n,t){return n.hasOwnProperty("coordinates")?n.coordinates.length===t.coordinates.length:n.length===t.length}Ia.prototype.compareCoord=function(n,t){if(n.length!==t.length)return!1;for(var e=0;e<n.length;e++)if(n[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};Ia.prototype.compareLine=function(n,t,e,o){if(!aR(n,t))return!1;var s=this.pseudoNode?n:this.removePseudo(n),c=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(s[0],c[0])&&(c=this.fixStartIndex(c,s),!c))){var h=this.compareCoord(s[e],c[e]);return this.direction||h?this.comparePath(s,c):this.compareCoord(s[e],c[c.length-(1+e)])?this.comparePath(s.slice().reverse(),c):!1}};Ia.prototype.fixStartIndex=function(n,t){for(var e,o=-1,s=0;s<n.length;s++)if(this.compareCoord(n[s],t[0])){o=s;break}return o>=0&&(e=[].concat(n.slice(o,n.length),n.slice(1,o+1))),e};Ia.prototype.comparePath=function(n,t){var e=this;return n.every(function(o,s){return e.compareCoord(o,this[s])},t)};Ia.prototype.comparePolygon=function(n,t){if(this.compareLine(n.coordinates[0],t.coordinates[0],1,!0)){var e=n.coordinates.slice(1,n.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),s=this;return e.every(function(c){return this.some(function(h){return s.compareLine(c,h,1,!0)})},o)}else return!1};Ia.prototype.compareFeature=function(n,t){return n.id!==t.id||!this.objectComparator(n.properties,t.properties)||!this.compareBBox(n,t)?!1:this.compare(n.geometry,t.geometry)};Ia.prototype.compareBBox=function(n,t){return!!(!n.bbox&&!t.bbox||n.bbox&&t.bbox&&this.compareCoord(n.bbox,t.bbox))};Ia.prototype.removePseudo=function(n){return n};function h$(n,t){return f$(n,t,{strict:!0})}uR.exports=Ia});var lR=at((Wut,vg)=>{function ju(n,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(n,t,e,o)}ju.prototype.run=function(n,t,e,o){this._init(n,t,e,o);for(var s=0;s<this._datasetLength;s++)if(this._visited[s]!==1){this._visited[s]=1;var c=this._regionQuery(s);if(c.length<this.minPts)this.noise.push(s);else{var h=this.clusters.length;this.clusters.push([]),this._addToCluster(s,h),this._expandCluster(h,c)}}return this.clusters};ju.prototype._init=function(n,t,e,o){if(n){if(!(n instanceof Array))throw Error("Dataset must be of type array, "+typeof n+" given");this.dataset=n,this.clusters=[],this.noise=[],this._datasetLength=n.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};ju.prototype._expandCluster=function(n,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var s=this._regionQuery(o);s.length>=this.minPts&&(t=this._mergeArrays(t,s))}this._assigned[o]!==1&&this._addToCluster(o,n)}};ju.prototype._addToCluster=function(n,t){this.clusters[t].push(n),this._assigned[n]=1};ju.prototype._regionQuery=function(n){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[n],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};ju.prototype._mergeArrays=function(n,t){for(var e=t.length,o=0;o<e;o++){var s=t[o];n.indexOf(s)<0&&n.push(s)}return n};ju.prototype._euclideanDistance=function(n,t){for(var e=0,o=Math.min(n.length,t.length);o--;)e+=(n[o]-t[o])*(n[o]-t[o]);return Math.sqrt(e)};typeof vg!="undefined"&&vg.exports&&(vg.exports=ju)});var cR=at((Xut,_g)=>{function Qu(n,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(n,t,e)}Qu.prototype.init=function(n,t,e){this.assignments=[],this.centroids=[],typeof n!="undefined"&&(this.dataset=n),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};Qu.prototype.run=function(n,t){this.init(n,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var s=!0;s;){s=this.assign();for(var c=0;c<this.k;c++){for(var h=new Array(_),p=0,g=0;g<_;g++)h[g]=0;for(var m=0;m<e;m++){var _=this.dataset[m].length;if(c===this.assignments[m]){for(var g=0;g<_;g++)h[g]+=this.dataset[m][g];p++}}if(p>0){for(var g=0;g<_;g++)h[g]/=p;this.centroids[c]=h}else this.centroids[c]=this.randomCentroid(),s=!0}}return this.getClusters()};Qu.prototype.randomCentroid=function(){var n=this.dataset.length-1,t,e;do e=Math.round(Math.random()*n),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};Qu.prototype.assign=function(){for(var n=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,n=!0);return n};Qu.prototype.getClusters=function(){for(var n=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof n[t]=="undefined"&&(n[t]=[]),n[t].push(e);return n};Qu.prototype.argmin=function(n,t,e){for(var o=Number.MAX_VALUE,s=0,c=t.length,h,p=0;p<c;p++)h=e(n,t[p]),h<o&&(o=h,s=p);return s};Qu.prototype.distance=function(n,t){for(var e=0,o=Math.min(n.length,t.length);o--;){var s=n[o]-t[o];e+=s*s}return Math.sqrt(e)};typeof _g!="undefined"&&_g.exports&&(_g.exports=Qu)});var F_=at((Yut,xg)=>{function Ra(n,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(n,t,e)}Ra.prototype.insert=function(n,t){for(var e=this._queue.length,o=e;o--;){var s=this._priorities[o];this._sorting==="desc"?t>s&&(e=o):t<s&&(e=o)}this._insertAt(n,t,e)};Ra.prototype.remove=function(n){for(var t=this._queue.length;t--;){var e=this._queue[t];if(n===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};Ra.prototype.forEach=function(n){this._queue.forEach(n)};Ra.prototype.getElements=function(){return this._queue};Ra.prototype.getElementPriority=function(n){return this._priorities[n]};Ra.prototype.getPriorities=function(){return this._priorities};Ra.prototype.getElementsWithPriorities=function(){for(var n=[],t=0,e=this._queue.length;t<e;t++)n.push([this._queue[t],this._priorities[t]]);return n};Ra.prototype._init=function(n,t,e){if(n&&t){if(this._queue=[],this._priorities=[],n.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<n.length;o++)this.insert(n[o],t[o])}e&&(this._sorting=e)};Ra.prototype._insertAt=function(n,t,e){this._queue.length===e?(this._queue.push(n),this._priorities.push(t)):(this._queue.splice(e,0,n),this._priorities.splice(e,0,t))};typeof xg!="undefined"&&xg.exports&&(xg.exports=Ra)});var hR=at(($ut,rf)=>{typeof rf!="undefined"&&rf.exports&&(fR=F_());var fR;function hu(n,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(n,t,e,o)}hu.prototype.run=function(n,t,e,o){this._init(n,t,e,o);for(var s=0,c=this.dataset.length;s<c;s++)if(this._processed[s]!==1){this._processed[s]=1,this.clusters.push([s]);var h=this.clusters.length-1;this._orderedList.push(s);var p=new fR(null,null,"asc"),g=this._regionQuery(s);this._distanceToCore(s)!==void 0&&(this._updateQueue(s,g,p),this._expandCluster(h,p))}return this.clusters};hu.prototype.getReachabilityPlot=function(){for(var n=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],s=this._reachability[o];n.push([o,s])}return n};hu.prototype._init=function(n,t,e,o){if(n){if(!(n instanceof Array))throw Error("Dataset must be of type array, "+typeof n+" given");this.dataset=n,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};hu.prototype._updateQueue=function(n,t,e){var o=this;this._coreDistance=this._distanceToCore(n),t.forEach(function(s){if(o._processed[s]===void 0){var c=o.distance(o.dataset[n],o.dataset[s]),h=Math.max(o._coreDistance,c);o._reachability[s]===void 0?(o._reachability[s]=h,e.insert(s,h)):h<o._reachability[s]&&(o._reachability[s]=h,e.remove(s),e.insert(s,h))}})};hu.prototype._expandCluster=function(n,t){for(var e=t.getElements(),o=0,s=e.length;o<s;o++){var c=e[o];if(this._processed[c]===void 0){var h=this._regionQuery(c);this._processed[c]=1,this.clusters[n].push(c),this._orderedList.push(c),this._distanceToCore(c)!==void 0&&(this._updateQueue(c,h,t),this._expandCluster(n,t))}}};hu.prototype._distanceToCore=function(n){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(n,e);if(o.length>=this.minPts)return e}};hu.prototype._regionQuery=function(n,t){t=t||this.epsilon;for(var e=[],o=0,s=this.dataset.length;o<s;o++)this.distance(this.dataset[n],this.dataset[o])<t&&e.push(o);return e};hu.prototype._euclideanDistance=function(n,t){for(var e=0,o=Math.min(n.length,t.length);o--;)e+=(n[o]-t[o])*(n[o]-t[o]);return Math.sqrt(e)};typeof rf!="undefined"&&rf.exports&&(rf.exports=hu)});var pR=at((Zut,Eg)=>{typeof Eg!="undefined"&&Eg.exports&&(Eg.exports={DBSCAN:lR(),KMEANS:cR(),OPTICS:hR(),PriorityQueue:F_()})});var U_=at((elt,gR)=>{"use strict";gR.exports={eudist:function(t,e,o){for(var s=t.length,c=0,h=0;h<s;h++){var p=(t[h]||0)-(e[h]||0);c+=p*p}return o?Math.sqrt(c):c},mandist:function(t,e,o){for(var s=t.length,c=0,h=0;h<s;h++)c+=Math.abs((t[h]||0)-(e[h]||0));return o?Math.sqrt(c):c},dist:function(t,e,o){var s=Math.abs(t-e);return o?s:s*s}}});var vR=at((nlt,yR)=>{"use strict";var mR=U_(),v$=mR.eudist,_$=mR.dist;yR.exports={kmrand:function(t,e){for(var o={},s=[],c=e<<2,h=t.length,p=t[0].length>0;s.length<e&&c-- >0;){var g=t[Math.floor(Math.random()*h)],m=p?g.join("_"):""+g;o[m]||(o[m]=!0,s.push(g))}if(s.length<e)throw new Error("Error initializating clusters");return s},kmpp:function(t,e){var o=t[0].length?v$:_$,s=[],c=t.length,h=t[0].length>0,p={},g=t[Math.floor(Math.random()*c)],m=h?g.join("_"):""+g;for(s.push(g),p[m]=!0;s.length<e;){for(var _=[],w=s.length,x=0,b=[],P=0;P<c;P++){for(var I=1/0,S=0;S<w;S++){var E=o(t[P],s[S]);E<=I&&(I=E)}_[P]=I}for(var R=0;R<c;R++)x+=_[R];for(var T=0;T<c;T++)b[T]={i:T,v:t[T],pr:_[T]/x,cs:0};b.sort(function(q,D){return q.pr-D.pr}),b[0].cs=b[0].pr;for(var F=1;F<c;F++)b[F].cs=b[F-1].cs+b[F].pr;for(var W=Math.random(),X=0;X<c-1&&b[X++].cs<W;);s.push(b[X-1].v)}return s}}});var SR=at((olt,wR)=>{"use strict";var B_=U_(),ER=vR(),x$=B_.eudist,rlt=B_.mandist,ilt=B_.dist,E$=ER.kmrand,w$=ER.kmpp,_R=1e4;function xR(n,t,e){e=e||[];for(var o=0;o<n;o++)e[o]=t;return e}function S$(n,t,e,o){var s=[],c=[],h=[],p=[],g=!1,m=o||_R,_=n.length,w=n[0].length,x=w>0,b=[];if(e)e=="kmrand"?s=E$(n,t):e=="kmpp"?s=w$(n,t):s=e;else for(var P={};s.length<t;){var I=Math.floor(Math.random()*_);P[I]||(P[I]=!0,s.push(n[I]))}do{xR(t,0,b);for(var S=0;S<_;S++){for(var E=1/0,R=0,T=0;T<t;T++){var p=x?x$(n[S],s[T]):Math.abs(n[S]-s[T]);p<=E&&(E=p,R=T)}h[S]=R,b[R]++}for(var F=[],c=[],W=0,X=0;X<t;X++)F[X]=x?xR(w,0,F[X]):0,c[X]=s[X];if(x){for(var q=0;q<t;q++)s[q]=[];for(var D=0;D<_;D++)for(var xt=h[D],B=F[xt],j=n[D],J=0;J<w;J++)B[J]+=j[J];g=!0;for(var Dt=0;Dt<t;Dt++){for(var Q=s[Dt],At=F[Dt],Mt=c[Dt],Rt=b[Dt],pt=0;pt<w;pt++)Q[pt]=At[pt]/Rt||0;if(g){for(var yt=0;yt<w;yt++)if(Mt[yt]!=Q[yt]){g=!1;break}}}}else{for(var K=0;K<_;K++){var Bt=h[K];F[Bt]+=n[K]}for(var Gt=0;Gt<t;Gt++)s[Gt]=F[Gt]/b[Gt]||0;g=!0;for(var ae=0;ae<t;ae++)if(c[ae]!=s[ae]){g=!1;break}}g=g||--m<=0}while(!g);return{it:_R-m,k:t,idxs:h,centroids:s}}wR.exports=S$});var lf=at((V_,W_)=>{(function(n,t){typeof V_=="object"&&typeof W_!="undefined"?W_.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n.polygonClipping=t())})(V_,function(){"use strict";function n(rt,C){var N={label:0,sent:function(){if(V[0]&1)throw V[1];return V[1]},trys:[],ops:[]},k,$,V,ht;return ht={next:st(0),throw:st(1),return:st(2)},typeof Symbol=="function"&&(ht[Symbol.iterator]=function(){return this}),ht;function st(Et){return function(G){return wt([Et,G])}}function wt(Et){if(k)throw new TypeError("Generator is already executing.");for(;N;)try{if(k=1,$&&(V=Et[0]&2?$.return:Et[0]?$.throw||((V=$.return)&&V.call($),0):$.next)&&!(V=V.call($,Et[1])).done)return V;switch($=0,V&&(Et=[Et[0]&2,V.value]),Et[0]){case 0:case 1:V=Et;break;case 4:return N.label++,{value:Et[1],done:!1};case 5:N.label++,$=Et[1],Et=[0];continue;case 7:Et=N.ops.pop(),N.trys.pop();continue;default:if(V=N.trys,!(V=V.length>0&&V[V.length-1])&&(Et[0]===6||Et[0]===2)){N=0;continue}if(Et[0]===3&&(!V||Et[1]>V[0]&&Et[1]<V[3])){N.label=Et[1];break}if(Et[0]===6&&N.label<V[1]){N.label=V[1],V=Et;break}if(V&&N.label<V[2]){N.label=V[2],N.ops.push(Et);break}V[2]&&N.ops.pop(),N.trys.pop();continue}Et=C.call(rt,N)}catch(G){Et=[6,G],$=0}finally{k=V=0}if(Et[0]&5)throw Et[1];return{value:Et[0]?Et[1]:void 0,done:!0}}}var t=function(){function rt(C,N){this.next=null,this.key=C,this.data=N,this.left=null,this.right=null}return rt}();function e(rt,C){return rt>C?1:rt<C?-1:0}function o(rt,C,N){for(var k=new t(null,null),$=k,V=k;;){var ht=N(rt,C.key);if(ht<0){if(C.left===null)break;if(N(rt,C.left.key)<0){var st=C.left;if(C.left=st.right,st.right=C,C=st,C.left===null)break}V.left=C,V=C,C=C.left}else if(ht>0){if(C.right===null)break;if(N(rt,C.right.key)>0){var st=C.right;if(C.right=st.left,st.left=C,C=st,C.right===null)break}$.right=C,$=C,C=C.right}else break}return $.right=C.left,V.left=C.right,C.left=k.right,C.right=k.left,C}function s(rt,C,N,k){var $=new t(rt,C);if(N===null)return $.left=$.right=null,$;N=o(rt,N,k);var V=k(rt,N.key);return V<0?($.left=N.left,$.right=N,N.left=null):V>=0&&($.right=N.right,$.left=N,N.right=null),$}function c(rt,C,N){var k=null,$=null;if(C){C=o(rt,C,N);var V=N(C.key,rt);V===0?(k=C.left,$=C.right):V<0?($=C.right,C.right=null,k=C):(k=C.left,C.left=null,$=C)}return{left:k,right:$}}function h(rt,C,N){return C===null?rt:(rt===null||(C=o(rt.key,C,N),C.left=rt),C)}function p(rt,C,N,k,$){if(rt){k(""+C+(N?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+$(rt)+\`
117
117
  \`);var V=C+(N?" ":"\\u2502 ");rt.left&&p(rt.left,V,!1,k,$),rt.right&&p(rt.right,V,!0,k,$)}}var g=function(){function rt(C){C===void 0&&(C=e),this._root=null,this._size=0,this._comparator=C}return rt.prototype.insert=function(C,N){return this._size++,this._root=s(C,N,this._root,this._comparator)},rt.prototype.add=function(C,N){var k=new t(C,N);this._root===null&&(k.left=k.right=null,this._size++,this._root=k);var $=this._comparator,V=o(C,this._root,$),ht=$(C,V.key);return ht===0?this._root=V:(ht<0?(k.left=V.left,k.right=V,V.left=null):ht>0&&(k.right=V.right,k.left=V,V.right=null),this._size++,this._root=k),this._root},rt.prototype.remove=function(C){this._root=this._remove(C,this._root,this._comparator)},rt.prototype._remove=function(C,N,k){var $;if(N===null)return null;N=o(C,N,k);var V=k(C,N.key);return V===0?(N.left===null?$=N.right:($=o(C,N.left,k),$.right=N.right),this._size--,$):N},rt.prototype.pop=function(){var C=this._root;if(C){for(;C.left;)C=C.left;return this._root=o(C.key,this._root,this._comparator),this._root=this._remove(C.key,this._root,this._comparator),{key:C.key,data:C.data}}return null},rt.prototype.findStatic=function(C){for(var N=this._root,k=this._comparator;N;){var $=k(C,N.key);if($===0)return N;$<0?N=N.left:N=N.right}return null},rt.prototype.find=function(C){return this._root&&(this._root=o(C,this._root,this._comparator),this._comparator(C,this._root.key)!==0)?null:this._root},rt.prototype.contains=function(C){for(var N=this._root,k=this._comparator;N;){var $=k(C,N.key);if($===0)return!0;$<0?N=N.left:N=N.right}return!1},rt.prototype.forEach=function(C,N){for(var k=this._root,$=[],V=!1;!V;)k!==null?($.push(k),k=k.left):$.length!==0?(k=$.pop(),C.call(N,k),k=k.right):V=!0;return this},rt.prototype.range=function(C,N,k,$){for(var V=[],ht=this._comparator,st=this._root,wt;V.length!==0||st;)if(st)V.push(st),st=st.left;else{if(st=V.pop(),wt=ht(st.key,N),wt>0)break;if(ht(st.key,C)>=0&&k.call($,st))return this;st=st.right}return this},rt.prototype.keys=function(){var C=[];return this.forEach(function(N){var k=N.key;return C.push(k)}),C},rt.prototype.values=function(){var C=[];return this.forEach(function(N){var k=N.data;return C.push(k)}),C},rt.prototype.min=function(){return this._root?this.minNode(this._root).key:null},rt.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},rt.prototype.minNode=function(C){if(C===void 0&&(C=this._root),C)for(;C.left;)C=C.left;return C},rt.prototype.maxNode=function(C){if(C===void 0&&(C=this._root),C)for(;C.right;)C=C.right;return C},rt.prototype.at=function(C){for(var N=this._root,k=!1,$=0,V=[];!k;)if(N)V.push(N),N=N.left;else if(V.length>0){if(N=V.pop(),$===C)return N;$++,N=N.right}else k=!0;return null},rt.prototype.next=function(C){var N=this._root,k=null;if(C.right){for(k=C.right;k.left;)k=k.left;return k}for(var $=this._comparator;N;){var V=$(C.key,N.key);if(V===0)break;V<0?(k=N,N=N.left):N=N.right}return k},rt.prototype.prev=function(C){var N=this._root,k=null;if(C.left!==null){for(k=C.left;k.right;)k=k.right;return k}for(var $=this._comparator;N;){var V=$(C.key,N.key);if(V===0)break;V<0?N=N.left:(k=N,N=N.right)}return k},rt.prototype.clear=function(){return this._root=null,this._size=0,this},rt.prototype.toList=function(){return w(this._root)},rt.prototype.load=function(C,N,k){N===void 0&&(N=[]),k===void 0&&(k=!1);var $=C.length,V=this._comparator;if(k&&P(C,N,0,$-1,V),this._root===null)this._root=m(C,N,0,$),this._size=$;else{var ht=b(this.toList(),_(C,N),V);$=this._size+$,this._root=x({head:ht},0,$)}return this},rt.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(rt.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(rt.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),rt.prototype.toString=function(C){C===void 0&&(C=function(k){return String(k.key)});var N=[];return p(this._root,"",!0,function(k){return N.push(k)},C),N.join("")},rt.prototype.update=function(C,N,k){var $=this._comparator,V=c(C,this._root,$),ht=V.left,st=V.right;$(C,N)<0?st=s(N,k,st,$):ht=s(N,k,ht,$),this._root=h(ht,st,$)},rt.prototype.split=function(C){return c(C,this._root,this._comparator)},rt.prototype[Symbol.iterator]=function(){var C,N,k;return n(this,function($){switch($.label){case 0:C=this._root,N=[],k=!1,$.label=1;case 1:return k?[3,6]:C===null?[3,2]:(N.push(C),C=C.left,[3,5]);case 2:return N.length===0?[3,4]:(C=N.pop(),[4,C]);case 3:return $.sent(),C=C.right,[3,5];case 4:k=!0,$.label=5;case 5:return[3,1];case 6:return[2]}})},rt}();function m(rt,C,N,k){var $=k-N;if($>0){var V=N+Math.floor($/2),ht=rt[V],st=C[V],wt=new t(ht,st);return wt.left=m(rt,C,N,V),wt.right=m(rt,C,V+1,k),wt}return null}function _(rt,C){for(var N=new t(null,null),k=N,$=0;$<rt.length;$++)k=k.next=new t(rt[$],C[$]);return k.next=null,N.next}function w(rt){for(var C=rt,N=[],k=!1,$=new t(null,null),V=$;!k;)C?(N.push(C),C=C.left):N.length>0?(C=V=V.next=N.pop(),C=C.right):k=!0;return V.next=null,$.next}function x(rt,C,N){var k=N-C;if(k>0){var $=C+Math.floor(k/2),V=x(rt,C,$),ht=rt.head;return ht.left=V,rt.head=rt.head.next,ht.right=x(rt,$+1,N),ht}return null}function b(rt,C,N){for(var k=new t(null,null),$=k,V=rt,ht=C;V!==null&&ht!==null;)N(V.key,ht.key)<0?($.next=V,V=V.next):($.next=ht,ht=ht.next),$=$.next;return V!==null?$.next=V:ht!==null&&($.next=ht),k.next}function P(rt,C,N,k,$){if(!(N>=k)){for(var V=rt[N+k>>1],ht=N-1,st=k+1;;){do ht++;while($(rt[ht],V)<0);do st--;while($(rt[st],V)>0);if(ht>=st)break;var wt=rt[ht];rt[ht]=rt[st],rt[st]=wt,wt=C[ht],C[ht]=C[st],C[st]=wt}P(rt,C,N,st,$),P(rt,C,st+1,k,$)}}let I=(rt,C)=>rt.ll.x<=C.x&&C.x<=rt.ur.x&&rt.ll.y<=C.y&&C.y<=rt.ur.y,S=(rt,C)=>{if(C.ur.x<rt.ll.x||rt.ur.x<C.ll.x||C.ur.y<rt.ll.y||rt.ur.y<C.ll.y)return null;let N=rt.ll.x<C.ll.x?C.ll.x:rt.ll.x,k=rt.ur.x<C.ur.x?rt.ur.x:C.ur.x,$=rt.ll.y<C.ll.y?C.ll.y:rt.ll.y,V=rt.ur.y<C.ur.y?rt.ur.y:C.ur.y;return{ll:{x:N,y:$},ur:{x:k,y:V}}},E=Number.EPSILON;E===void 0&&(E=Math.pow(2,-52));let R=E*E,T=(rt,C)=>{if(-E<rt&&rt<E&&-E<C&&C<E)return 0;let N=rt-C;return N*N<R*rt*C?0:rt<C?-1:1};class F{constructor(){this.reset()}reset(){this.xRounder=new W,this.yRounder=new W}round(C,N){return{x:this.xRounder.round(C),y:this.yRounder.round(N)}}}class W{constructor(){this.tree=new g,this.round(0)}round(C){let N=this.tree.add(C),k=this.tree.prev(N);if(k!==null&&T(N.key,k.key)===0)return this.tree.remove(C),k.key;let $=this.tree.next(N);return $!==null&&T(N.key,$.key)===0?(this.tree.remove(C),$.key):C}}let X=new F,q=11102230246251565e-32,D=134217729,xt=(3+8*q)*q;function B(rt,C,N,k,$){let V,ht,st,wt,Et=C[0],G=k[0],ot=0,et=0;G>Et==G>-Et?(V=Et,Et=C[++ot]):(V=G,G=k[++et]);let lt=0;if(ot<rt&&et<N)for(G>Et==G>-Et?(ht=Et+V,st=V-(ht-Et),Et=C[++ot]):(ht=G+V,st=V-(ht-G),G=k[++et]),V=ht,st!==0&&($[lt++]=st);ot<rt&&et<N;)G>Et==G>-Et?(ht=V+Et,wt=ht-V,st=V-(ht-wt)+(Et-wt),Et=C[++ot]):(ht=V+G,wt=ht-V,st=V-(ht-wt)+(G-wt),G=k[++et]),V=ht,st!==0&&($[lt++]=st);for(;ot<rt;)ht=V+Et,wt=ht-V,st=V-(ht-wt)+(Et-wt),Et=C[++ot],V=ht,st!==0&&($[lt++]=st);for(;et<N;)ht=V+G,wt=ht-V,st=V-(ht-wt)+(G-wt),G=k[++et],V=ht,st!==0&&($[lt++]=st);return(V!==0||lt===0)&&($[lt++]=V),lt}function j(rt,C){let N=C[0];for(let k=1;k<rt;k++)N+=C[k];return N}function J(rt){return new Float64Array(rt)}let Dt=(3+16*q)*q,Q=(2+12*q)*q,At=(9+64*q)*q*q,Mt=J(4),Rt=J(8),pt=J(12),yt=J(16),K=J(4);function Bt(rt,C,N,k,$,V,ht){let st,wt,Et,G,ot,et,lt,Ft,Kt,me,ve,qe,Ue,Xe,Ke,Er,Zr,er,Ie=rt-$,nr=N-$,pr=C-V,ar=k-V;Xe=Ie*ar,et=D*Ie,lt=et-(et-Ie),Ft=Ie-lt,et=D*ar,Kt=et-(et-ar),me=ar-Kt,Ke=Ft*me-(Xe-lt*Kt-Ft*Kt-lt*me),Er=pr*nr,et=D*pr,lt=et-(et-pr),Ft=pr-lt,et=D*nr,Kt=et-(et-nr),me=nr-Kt,Zr=Ft*me-(Er-lt*Kt-Ft*Kt-lt*me),ve=Ke-Zr,ot=Ke-ve,Mt[0]=Ke-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,Mt[1]=Ue-(ve+ot)+(ot-Er),er=qe+ve,ot=er-qe,Mt[2]=qe-(er-ot)+(ve-ot),Mt[3]=er;let jn=j(4,Mt),Si=Q*ht;if(jn>=Si||-jn>=Si||(ot=rt-Ie,st=rt-(Ie+ot)+(ot-$),ot=N-nr,Et=N-(nr+ot)+(ot-$),ot=C-pr,wt=C-(pr+ot)+(ot-V),ot=k-ar,G=k-(ar+ot)+(ot-V),st===0&&wt===0&&Et===0&&G===0)||(Si=At*ht+xt*Math.abs(jn),jn+=Ie*G+ar*st-(pr*Et+nr*wt),jn>=Si||-jn>=Si))return jn;Xe=st*ar,et=D*st,lt=et-(et-st),Ft=st-lt,et=D*ar,Kt=et-(et-ar),me=ar-Kt,Ke=Ft*me-(Xe-lt*Kt-Ft*Kt-lt*me),Er=wt*nr,et=D*wt,lt=et-(et-wt),Ft=wt-lt,et=D*nr,Kt=et-(et-nr),me=nr-Kt,Zr=Ft*me-(Er-lt*Kt-Ft*Kt-lt*me),ve=Ke-Zr,ot=Ke-ve,K[0]=Ke-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,K[1]=Ue-(ve+ot)+(ot-Er),er=qe+ve,ot=er-qe,K[2]=qe-(er-ot)+(ve-ot),K[3]=er;let ii=B(4,Mt,4,K,Rt);Xe=Ie*G,et=D*Ie,lt=et-(et-Ie),Ft=Ie-lt,et=D*G,Kt=et-(et-G),me=G-Kt,Ke=Ft*me-(Xe-lt*Kt-Ft*Kt-lt*me),Er=pr*Et,et=D*pr,lt=et-(et-pr),Ft=pr-lt,et=D*Et,Kt=et-(et-Et),me=Et-Kt,Zr=Ft*me-(Er-lt*Kt-Ft*Kt-lt*me),ve=Ke-Zr,ot=Ke-ve,K[0]=Ke-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,K[1]=Ue-(ve+ot)+(ot-Er),er=qe+ve,ot=er-qe,K[2]=qe-(er-ot)+(ve-ot),K[3]=er;let Z=B(ii,Rt,4,K,pt);Xe=st*G,et=D*st,lt=et-(et-st),Ft=st-lt,et=D*G,Kt=et-(et-G),me=G-Kt,Ke=Ft*me-(Xe-lt*Kt-Ft*Kt-lt*me),Er=wt*Et,et=D*wt,lt=et-(et-wt),Ft=wt-lt,et=D*Et,Kt=et-(et-Et),me=Et-Kt,Zr=Ft*me-(Er-lt*Kt-Ft*Kt-lt*me),ve=Ke-Zr,ot=Ke-ve,K[0]=Ke-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,K[1]=Ue-(ve+ot)+(ot-Er),er=qe+ve,ot=er-qe,K[2]=qe-(er-ot)+(ve-ot),K[3]=er;let mt=B(Z,pt,4,K,yt);return yt[mt-1]}function Gt(rt,C,N,k,$,V){let ht=(C-V)*(N-$),st=(rt-$)*(k-V),wt=ht-st,Et=Math.abs(ht+st);return Math.abs(wt)>=Dt*Et?wt:-Bt(rt,C,N,k,$,V,Et)}let ae=(rt,C)=>rt.x*C.y-rt.y*C.x,ut=(rt,C)=>rt.x*C.x+rt.y*C.y,Ut=(rt,C,N)=>{let k=Gt(rt.x,rt.y,C.x,C.y,N.x,N.y);return k>0?-1:k<0?1:0},jt=rt=>Math.sqrt(ut(rt,rt)),ce=(rt,C,N)=>{let k={x:C.x-rt.x,y:C.y-rt.y},$={x:N.x-rt.x,y:N.y-rt.y};return ae($,k)/jt($)/jt(k)},te=(rt,C,N)=>{let k={x:C.x-rt.x,y:C.y-rt.y},$={x:N.x-rt.x,y:N.y-rt.y};return ut($,k)/jt($)/jt(k)},$t=(rt,C,N)=>C.y===0?null:{x:rt.x+C.x/C.y*(N-rt.y),y:N},qt=(rt,C,N)=>C.x===0?null:{x:N,y:rt.y+C.y/C.x*(N-rt.x)},xe=(rt,C,N,k)=>{if(C.x===0)return qt(N,k,rt.x);if(k.x===0)return qt(rt,C,N.x);if(C.y===0)return $t(N,k,rt.y);if(k.y===0)return $t(rt,C,N.y);let $=ae(C,k);if($==0)return null;let V={x:N.x-rt.x,y:N.y-rt.y},ht=ae(V,C)/$,st=ae(V,k)/$,wt=rt.x+st*C.x,Et=N.x+ht*k.x,G=rt.y+st*C.y,ot=N.y+ht*k.y,et=(wt+Et)/2,lt=(G+ot)/2;return{x:et,y:lt}};class ft{static compare(C,N){let k=ft.comparePoints(C.point,N.point);return k!==0?k:(C.point!==N.point&&C.link(N),C.isLeft!==N.isLeft?C.isLeft?1:-1:ee.compare(C.segment,N.segment))}static comparePoints(C,N){return C.x<N.x?-1:C.x>N.x?1:C.y<N.y?-1:C.y>N.y?1:0}constructor(C,N){C.events===void 0?C.events=[this]:C.events.push(this),this.point=C,this.isLeft=N}link(C){if(C.point===this.point)throw new Error("Tried to link already linked events");let N=C.point.events;for(let k=0,$=N.length;k<$;k++){let V=N[k];this.point.events.push(V),V.point=this.point}this.checkForConsuming()}checkForConsuming(){let C=this.point.events.length;for(let N=0;N<C;N++){let k=this.point.events[N];if(k.segment.consumedBy===void 0)for(let $=N+1;$<C;$++){let V=this.point.events[$];V.consumedBy===void 0&&k.otherSE.point.events===V.otherSE.point.events&&k.segment.consume(V.segment)}}}getAvailableLinkedEvents(){let C=[];for(let N=0,k=this.point.events.length;N<k;N++){let $=this.point.events[N];$!==this&&!$.segment.ringOut&&$.segment.isInResult()&&C.push($)}return C}getLeftmostComparator(C){let N=new Map,k=$=>{let V=$.otherSE;N.set($,{sine:ce(this.point,C.point,V.point),cosine:te(this.point,C.point,V.point)})};return($,V)=>{N.has($)||k($),N.has(V)||k(V);let{sine:ht,cosine:st}=N.get($),{sine:wt,cosine:Et}=N.get(V);return ht>=0&&wt>=0?st<Et?1:st>Et?-1:0:ht<0&&wt<0?st<Et?-1:st>Et?1:0:wt<ht?-1:wt>ht?1:0}}}let We=0;class ee{static compare(C,N){let k=C.leftSE.point.x,$=N.leftSE.point.x,V=C.rightSE.point.x,ht=N.rightSE.point.x;if(ht<k)return 1;if(V<$)return-1;let st=C.leftSE.point.y,wt=N.leftSE.point.y,Et=C.rightSE.point.y,G=N.rightSE.point.y;if(k<$){if(wt<st&&wt<Et)return 1;if(wt>st&&wt>Et)return-1;let ot=C.comparePoint(N.leftSE.point);if(ot<0)return 1;if(ot>0)return-1;let et=N.comparePoint(C.rightSE.point);return et!==0?et:-1}if(k>$){if(st<wt&&st<G)return-1;if(st>wt&&st>G)return 1;let ot=N.comparePoint(C.leftSE.point);if(ot!==0)return ot;let et=C.comparePoint(N.rightSE.point);return et<0?1:et>0?-1:1}if(st<wt)return-1;if(st>wt)return 1;if(V<ht){let ot=N.comparePoint(C.rightSE.point);if(ot!==0)return ot}if(V>ht){let ot=C.comparePoint(N.rightSE.point);if(ot<0)return 1;if(ot>0)return-1}if(V!==ht){let ot=Et-st,et=V-k,lt=G-wt,Ft=ht-$;if(ot>et&&lt<Ft)return 1;if(ot<et&&lt>Ft)return-1}return V>ht?1:V<ht||Et<G?-1:Et>G?1:C.id<N.id?-1:C.id>N.id?1:0}constructor(C,N,k,$){this.id=++We,this.leftSE=C,C.segment=this,C.otherSE=N,this.rightSE=N,N.segment=this,N.otherSE=C,this.rings=k,this.windings=$}static fromRing(C,N,k){let $,V,ht,st=ft.comparePoints(C,N);if(st<0)$=C,V=N,ht=1;else if(st>0)$=N,V=C,ht=-1;else throw new Error(\`Tried to create degenerate segment at [\${C.x}, \${C.y}]\`);let wt=new ft($,!0),Et=new ft(V,!1);return new ee(wt,Et,[k],[ht])}replaceRightSE(C){this.rightSE=C,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let C=this.leftSE.point.y,N=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:C<N?C:N},ur:{x:this.rightSE.point.x,y:C>N?C:N}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(C){return C.x===this.leftSE.point.x&&C.y===this.leftSE.point.y||C.x===this.rightSE.point.x&&C.y===this.rightSE.point.y}comparePoint(C){if(this.isAnEndpoint(C))return 0;let N=this.leftSE.point,k=this.rightSE.point,$=this.vector();if(N.x===k.x)return C.x===N.x?0:C.x<N.x?1:-1;let V=(C.y-N.y)/$.y,ht=N.x+V*$.x;if(C.x===ht)return 0;let st=(C.x-N.x)/$.x,wt=N.y+st*$.y;return C.y===wt?0:C.y<wt?-1:1}getIntersection(C){let N=this.bbox(),k=C.bbox(),$=S(N,k);if($===null)return null;let V=this.leftSE.point,ht=this.rightSE.point,st=C.leftSE.point,wt=C.rightSE.point,Et=I(N,st)&&this.comparePoint(st)===0,G=I(k,V)&&C.comparePoint(V)===0,ot=I(N,wt)&&this.comparePoint(wt)===0,et=I(k,ht)&&C.comparePoint(ht)===0;if(G&&Et)return et&&!ot?ht:!et&&ot?wt:null;if(G)return ot&&V.x===wt.x&&V.y===wt.y?null:V;if(Et)return et&&ht.x===st.x&&ht.y===st.y?null:st;if(et&&ot)return null;if(et)return ht;if(ot)return wt;let lt=xe(V,this.vector(),st,C.vector());return lt===null||!I($,lt)?null:X.round(lt.x,lt.y)}split(C){let N=[],k=C.events!==void 0,$=new ft(C,!0),V=new ft(C,!1),ht=this.rightSE;this.replaceRightSE(V),N.push(V),N.push($);let st=new ee($,ht,this.rings.slice(),this.windings.slice());return ft.comparePoints(st.leftSE.point,st.rightSE.point)>0&&st.swapEvents(),ft.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),k&&($.checkForConsuming(),V.checkForConsuming()),N}swapEvents(){let C=this.rightSE;this.rightSE=this.leftSE,this.leftSE=C,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let N=0,k=this.windings.length;N<k;N++)this.windings[N]*=-1}consume(C){let N=this,k=C;for(;N.consumedBy;)N=N.consumedBy;for(;k.consumedBy;)k=k.consumedBy;let $=ee.compare(N,k);if($!==0){if($>0){let V=N;N=k,k=V}if(N.prev===k){let V=N;N=k,k=V}for(let V=0,ht=k.rings.length;V<ht;V++){let st=k.rings[V],wt=k.windings[V],Et=N.rings.indexOf(st);Et===-1?(N.rings.push(st),N.windings.push(wt)):N.windings[Et]+=wt}k.rings=null,k.windings=null,k.consumedBy=N,k.leftSE.consumedBy=N.leftSE,k.rightSE.consumedBy=N.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let C=this.prev.consumedBy||this.prev;this._beforeState=C.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let C=this.beforeState();this._afterState={rings:C.rings.slice(0),windings:C.windings.slice(0),multiPolys:[]};let N=this._afterState.rings,k=this._afterState.windings,$=this._afterState.multiPolys;for(let st=0,wt=this.rings.length;st<wt;st++){let Et=this.rings[st],G=this.windings[st],ot=N.indexOf(Et);ot===-1?(N.push(Et),k.push(G)):k[ot]+=G}let V=[],ht=[];for(let st=0,wt=N.length;st<wt;st++){if(k[st]===0)continue;let Et=N[st],G=Et.poly;if(ht.indexOf(G)===-1)if(Et.isExterior)V.push(G);else{ht.indexOf(G)===-1&&ht.push(G);let ot=V.indexOf(Et.poly);ot!==-1&&V.splice(ot,1)}}for(let st=0,wt=V.length;st<wt;st++){let Et=V[st].multiPoly;$.indexOf(Et)===-1&&$.push(Et)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let C=this.beforeState().multiPolys,N=this.afterState().multiPolys;switch(dt.type){case"union":{let k=C.length===0,$=N.length===0;this._isInResult=k!==$;break}case"intersection":{let k,$;C.length<N.length?(k=C.length,$=N.length):(k=N.length,$=C.length),this._isInResult=$===dt.numMultiPolys&&k<$;break}case"xor":{let k=Math.abs(C.length-N.length);this._isInResult=k%2===1;break}case"difference":{let k=$=>$.length===1&&$[0].isSubject;this._isInResult=k(C)!==k(N);break}default:throw new Error(\`Unrecognized operation type found \${dt.type}\`)}return this._isInResult}}class ge{constructor(C,N,k){if(!Array.isArray(C)||C.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=N,this.isExterior=k,this.segments=[],typeof C[0][0]!="number"||typeof C[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let $=X.round(C[0][0],C[0][1]);this.bbox={ll:{x:$.x,y:$.y},ur:{x:$.x,y:$.y}};let V=$;for(let ht=1,st=C.length;ht<st;ht++){if(typeof C[ht][0]!="number"||typeof C[ht][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let wt=X.round(C[ht][0],C[ht][1]);wt.x===V.x&&wt.y===V.y||(this.segments.push(ee.fromRing(V,wt,this)),wt.x<this.bbox.ll.x&&(this.bbox.ll.x=wt.x),wt.y<this.bbox.ll.y&&(this.bbox.ll.y=wt.y),wt.x>this.bbox.ur.x&&(this.bbox.ur.x=wt.x),wt.y>this.bbox.ur.y&&(this.bbox.ur.y=wt.y),V=wt)}($.x!==V.x||$.y!==V.y)&&this.segments.push(ee.fromRing(V,$,this))}getSweepEvents(){let C=[];for(let N=0,k=this.segments.length;N<k;N++){let $=this.segments[N];C.push($.leftSE),C.push($.rightSE)}return C}}class fe{constructor(C,N){if(!Array.isArray(C))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new ge(C[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let k=1,$=C.length;k<$;k++){let V=new ge(C[k],this,!1);V.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=V.bbox.ll.x),V.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=V.bbox.ll.y),V.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=V.bbox.ur.x),V.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=V.bbox.ur.y),this.interiorRings.push(V)}this.multiPoly=N}getSweepEvents(){let C=this.exteriorRing.getSweepEvents();for(let N=0,k=this.interiorRings.length;N<k;N++){let $=this.interiorRings[N].getSweepEvents();for(let V=0,ht=$.length;V<ht;V++)C.push($[V])}return C}}class Te{constructor(C,N){if(!Array.isArray(C))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof C[0][0][0]=="number"&&(C=[C])}catch(k){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let k=0,$=C.length;k<$;k++){let V=new fe(C[k],this);V.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=V.bbox.ll.x),V.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=V.bbox.ll.y),V.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=V.bbox.ur.x),V.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=V.bbox.ur.y),this.polys.push(V)}this.isSubject=N}getSweepEvents(){let C=[];for(let N=0,k=this.polys.length;N<k;N++){let $=this.polys[N].getSweepEvents();for(let V=0,ht=$.length;V<ht;V++)C.push($[V])}return C}}class be{static factory(C){let N=[];for(let k=0,$=C.length;k<$;k++){let V=C[k];if(!V.isInResult()||V.ringOut)continue;let ht=null,st=V.leftSE,wt=V.rightSE,Et=[st],G=st.point,ot=[];for(;ht=st,st=wt,Et.push(st),st.point!==G;)for(;;){let et=st.getAvailableLinkedEvents();if(et.length===0){let Kt=Et[0].point,me=Et[Et.length-1].point;throw new Error(\`Unable to complete output ring starting at [\${Kt.x}, \${Kt.y}]. Last matching segment found ends at [\${me.x}, \${me.y}].\`)}if(et.length===1){wt=et[0].otherSE;break}let lt=null;for(let Kt=0,me=ot.length;Kt<me;Kt++)if(ot[Kt].point===st.point){lt=Kt;break}if(lt!==null){let Kt=ot.splice(lt)[0],me=Et.splice(Kt.index);me.unshift(me[0].otherSE),N.push(new be(me.reverse()));continue}ot.push({index:Et.length,point:st.point});let Ft=st.getLeftmostComparator(ht);wt=et.sort(Ft)[0].otherSE;break}N.push(new be(Et))}return N}constructor(C){this.events=C;for(let N=0,k=C.length;N<k;N++)C[N].segment.ringOut=this;this.poly=null}getGeom(){let C=this.events[0].point,N=[C];for(let Et=1,G=this.events.length-1;Et<G;Et++){let ot=this.events[Et].point,et=this.events[Et+1].point;Ut(ot,C,et)!==0&&(N.push(ot),C=ot)}if(N.length===1)return null;let k=N[0],$=N[1];Ut(k,C,$)===0&&N.shift(),N.push(N[0]);let V=this.isExteriorRing()?1:-1,ht=this.isExteriorRing()?0:N.length-1,st=this.isExteriorRing()?N.length:-1,wt=[];for(let Et=ht;Et!=st;Et+=V)wt.push([N[Et].x,N[Et].y]);return wt}isExteriorRing(){if(this._isExteriorRing===void 0){let C=this.enclosingRing();this._isExteriorRing=C?!C.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let C=this.events[0];for(let $=1,V=this.events.length;$<V;$++){let ht=this.events[$];ft.compare(C,ht)>0&&(C=ht)}let N=C.segment.prevInResult(),k=N?N.prevInResult():null;for(;;){if(!N)return null;if(!k)return N.ringOut;if(k.ringOut!==N.ringOut)return k.ringOut.enclosingRing()!==N.ringOut?N.ringOut:N.ringOut.enclosingRing();N=k.prevInResult(),k=N?N.prevInResult():null}}}class Wt{constructor(C){this.exteriorRing=C,C.poly=this,this.interiorRings=[]}addInterior(C){this.interiorRings.push(C),C.poly=this}getGeom(){let C=[this.exteriorRing.getGeom()];if(C[0]===null)return null;for(let N=0,k=this.interiorRings.length;N<k;N++){let $=this.interiorRings[N].getGeom();$!==null&&C.push($)}return C}}class Me{constructor(C){this.rings=C,this.polys=this._composePolys(C)}getGeom(){let C=[];for(let N=0,k=this.polys.length;N<k;N++){let $=this.polys[N].getGeom();$!==null&&C.push($)}return C}_composePolys(C){let N=[];for(let k=0,$=C.length;k<$;k++){let V=C[k];if(!V.poly)if(V.isExteriorRing())N.push(new Wt(V));else{let ht=V.enclosingRing();ht.poly||N.push(new Wt(ht)),ht.poly.addInterior(V)}}return N}}class tt{constructor(C){let N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ee.compare;this.queue=C,this.tree=new g(N),this.segments=[]}process(C){let N=C.segment,k=[];if(C.consumedBy)return C.isLeft?this.queue.remove(C.otherSE):this.tree.remove(N),k;let $=C.isLeft?this.tree.add(N):this.tree.find(N);if(!$)throw new Error(\`Unable to find segment #\${N.id} [\${N.leftSE.point.x}, \${N.leftSE.point.y}] -> [\${N.rightSE.point.x}, \${N.rightSE.point.y}] in SweepLine tree.\`);let V=$,ht=$,st,wt;for(;st===void 0;)V=this.tree.prev(V),V===null?st=null:V.key.consumedBy===void 0&&(st=V.key);for(;wt===void 0;)ht=this.tree.next(ht),ht===null?wt=null:ht.key.consumedBy===void 0&&(wt=ht.key);if(C.isLeft){let Et=null;if(st){let ot=st.getIntersection(N);if(ot!==null&&(N.isAnEndpoint(ot)||(Et=ot),!st.isAnEndpoint(ot))){let et=this._splitSafely(st,ot);for(let lt=0,Ft=et.length;lt<Ft;lt++)k.push(et[lt])}}let G=null;if(wt){let ot=wt.getIntersection(N);if(ot!==null&&(N.isAnEndpoint(ot)||(G=ot),!wt.isAnEndpoint(ot))){let et=this._splitSafely(wt,ot);for(let lt=0,Ft=et.length;lt<Ft;lt++)k.push(et[lt])}}if(Et!==null||G!==null){let ot=null;Et===null?ot=G:G===null?ot=Et:ot=ft.comparePoints(Et,G)<=0?Et:G,this.queue.remove(N.rightSE),k.push(N.rightSE);let et=N.split(ot);for(let lt=0,Ft=et.length;lt<Ft;lt++)k.push(et[lt])}k.length>0?(this.tree.remove(N),k.push(C)):(this.segments.push(N),N.prev=st)}else{if(st&&wt){let Et=st.getIntersection(wt);if(Et!==null){if(!st.isAnEndpoint(Et)){let G=this._splitSafely(st,Et);for(let ot=0,et=G.length;ot<et;ot++)k.push(G[ot])}if(!wt.isAnEndpoint(Et)){let G=this._splitSafely(wt,Et);for(let ot=0,et=G.length;ot<et;ot++)k.push(G[ot])}}}this.tree.remove(N)}return k}_splitSafely(C,N){this.tree.remove(C);let k=C.rightSE;this.queue.remove(k);let $=C.split(N);return $.push(k),C.consumedBy===void 0&&this.tree.add(C),$}}let z=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Pt=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Ot{run(C,N,k){dt.type=C,X.reset();let $=[new Te(N,!0)];for(let ot=0,et=k.length;ot<et;ot++)$.push(new Te(k[ot],!1));if(dt.numMultiPolys=$.length,dt.type==="difference"){let ot=$[0],et=1;for(;et<$.length;)S($[et].bbox,ot.bbox)!==null?et++:$.splice(et,1)}if(dt.type==="intersection")for(let ot=0,et=$.length;ot<et;ot++){let lt=$[ot];for(let Ft=ot+1,Kt=$.length;Ft<Kt;Ft++)if(S(lt.bbox,$[Ft].bbox)===null)return[]}let V=new g(ft.compare);for(let ot=0,et=$.length;ot<et;ot++){let lt=$[ot].getSweepEvents();for(let Ft=0,Kt=lt.length;Ft<Kt;Ft++)if(V.insert(lt[Ft]),V.size>z)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let ht=new tt(V),st=V.size,wt=V.pop();for(;wt;){let ot=wt.key;if(V.size===st){let lt=ot.segment;throw new Error(\`Unable to pop() \${ot.isLeft?"left":"right"} SweepEvent [\${ot.point.x}, \${ot.point.y}] from segment #\${lt.id} [\${lt.leftSE.point.x}, \${lt.leftSE.point.y}] -> [\${lt.rightSE.point.x}, \${lt.rightSE.point.y}] from queue.\`)}if(V.size>z)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(ht.segments.length>Pt)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let et=ht.process(ot);for(let lt=0,Ft=et.length;lt<Ft;lt++){let Kt=et[lt];Kt.consumedBy===void 0&&V.insert(Kt)}st=V.size,wt=V.pop()}X.reset();let Et=be.factory(ht.segments);return new Me(Et).getGeom()}}let dt=new Ot;var ne={union:function(rt){for(var C=arguments.length,N=new Array(C>1?C-1:0),k=1;k<C;k++)N[k-1]=arguments[k];return dt.run("union",rt,N)},intersection:function(rt){for(var C=arguments.length,N=new Array(C>1?C-1:0),k=1;k<C;k++)N[k-1]=arguments[k];return dt.run("intersection",rt,N)},xor:function(rt){for(var C=arguments.length,N=new Array(C>1?C-1:0),k=1;k<C;k++)N[k-1]=arguments[k];return dt.run("xor",rt,N)},difference:function(rt){for(var C=arguments.length,N=new Array(C>1?C-1:0),k=1;k<C;k++)N[k-1]=arguments[k];return dt.run("difference",rt,N)}};return ne})});var qR=at((bg,kR)=>{(function(n,t){typeof bg=="object"&&typeof kR!="undefined"?t(bg):typeof define=="function"&&define.amd?define(["exports"],t):t(n.jsts={})})(bg,function(n){"use strict";function t(){}function e(r){this.message=r||""}function o(r){this.message=r||""}function s(r){this.message=r||""}function c(){}function h(r){return r===null?Ke:r.color}function p(r){return r===null?null:r.parent}function g(r,i){r!==null&&(r.color=i)}function m(r){return r===null?null:r.left}function _(r){return r===null?null:r.right}function w(){this.root_=null,this.size_=0}function x(){}function b(){this.array_=[],arguments[0]instanceof st&&this.addAll(arguments[0])}function P(){}function I(r){this.message=r||""}function S(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(r){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),a=Math.max(Math.min(i.length,9007199254740991),0)||0,l=1 in arguments&&parseInt(Number(arguments[1]),10)||0;l=l<0?Math.max(a+l,0):Math.min(l,a);var d=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:a;for(d=d<0?Math.max(a+arguments[2],0):Math.min(d,a);l<d;)i[l]=r,++l;return i},writable:!0}),Number.isFinite=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},Number.isInteger=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(r){return r!=r},Math.trunc=Math.trunc||function(r){return r<0?Math.ceil(r):Math.floor(r)};var E=function(){};E.prototype.interfaces_=function(){return[]},E.prototype.getClass=function(){return E},E.prototype.equalsWithTolerance=function(r,i,a){return Math.abs(r-i)<=a};var R=function(r){function i(a){r.call(this,a),this.name="IllegalArgumentException",this.message=a,this.stack=new r().stack}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i}(Error),T=function(){},F={MAX_VALUE:{configurable:!0}};T.isNaN=function(r){return Number.isNaN(r)},T.doubleToLongBits=function(r){return r},T.longBitsToDouble=function(r){return r},T.isInfinite=function(r){return!Number.isFinite(r)},F.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(T,F);var W=function(){},X=function(){},q=function(){},D=function r(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=r.NULL_ORDINATE;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.z=i.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=r.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},xt={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};D.prototype.setOrdinate=function(r,i){switch(r){case D.X:this.x=i;break;case D.Y:this.y=i;break;case D.Z:this.z=i;break;default:throw new R("Invalid ordinate index: "+r)}},D.prototype.equals2D=function(){if(arguments.length===1){var r=arguments[0];return this.x===r.x&&this.y===r.y}if(arguments.length===2){var i=arguments[0],a=arguments[1];return!!E.equalsWithTolerance(this.x,i.x,a)&&!!E.equalsWithTolerance(this.y,i.y,a)}},D.prototype.getOrdinate=function(r){switch(r){case D.X:return this.x;case D.Y:return this.y;case D.Z:return this.z}throw new R("Invalid ordinate index: "+r)},D.prototype.equals3D=function(r){return this.x===r.x&&this.y===r.y&&(this.z===r.z||T.isNaN(this.z))&&T.isNaN(r.z)},D.prototype.equals=function(r){return r instanceof D&&this.equals2D(r)},D.prototype.equalInZ=function(r,i){return E.equalsWithTolerance(this.z,r.z,i)},D.prototype.compareTo=function(r){var i=r;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0},D.prototype.clone=function(){},D.prototype.copy=function(){return new D(this)},D.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},D.prototype.distance3D=function(r){var i=this.x-r.x,a=this.y-r.y,l=this.z-r.z;return Math.sqrt(i*i+a*a+l*l)},D.prototype.distance=function(r){var i=this.x-r.x,a=this.y-r.y;return Math.sqrt(i*i+a*a)},D.prototype.hashCode=function(){var r=17;return r=37*r+D.hashCode(this.x),r=37*r+D.hashCode(this.y)},D.prototype.setCoordinate=function(r){this.x=r.x,this.y=r.y,this.z=r.z},D.prototype.interfaces_=function(){return[W,X,t]},D.prototype.getClass=function(){return D},D.hashCode=function(){if(arguments.length===1){var r=arguments[0],i=T.doubleToLongBits(r);return Math.trunc((i^i)>>>32)}},xt.DimensionalComparator.get=function(){return B},xt.serialVersionUID.get=function(){return 6683108902428367e3},xt.NULL_ORDINATE.get=function(){return T.NaN},xt.X.get=function(){return 0},xt.Y.get=function(){return 1},xt.Z.get=function(){return 2},Object.defineProperties(D,xt);var B=function(r){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var i=arguments[0];if(i!==2&&i!==3)throw new R("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};B.prototype.compare=function(r,i){var a=r,l=i,d=B.compare(a.x,l.x);if(d!==0)return d;var v=B.compare(a.y,l.y);return v!==0?v:this._dimensionsToTest<=2?0:B.compare(a.z,l.z)},B.prototype.interfaces_=function(){return[q]},B.prototype.getClass=function(){return B},B.compare=function(r,i){return r<i?-1:r>i?1:T.isNaN(r)?T.isNaN(i)?0:-1:T.isNaN(i)?1:0};var j=function(){};j.prototype.create=function(){},j.prototype.interfaces_=function(){return[]},j.prototype.getClass=function(){return j};var J=function(){},Dt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};J.prototype.interfaces_=function(){return[]},J.prototype.getClass=function(){return J},J.toLocationSymbol=function(r){switch(r){case J.EXTERIOR:return"e";case J.BOUNDARY:return"b";case J.INTERIOR:return"i";case J.NONE:return"-"}throw new R("Unknown location value: "+r)},Dt.INTERIOR.get=function(){return 0},Dt.BOUNDARY.get=function(){return 1},Dt.EXTERIOR.get=function(){return 2},Dt.NONE.get=function(){return-1},Object.defineProperties(J,Dt);var Q=function(r,i){return r.interfaces_&&r.interfaces_().indexOf(i)>-1},At=function(){},Mt={LOG_10:{configurable:!0}};At.prototype.interfaces_=function(){return[]},At.prototype.getClass=function(){return At},At.log10=function(r){var i=Math.log(r);return T.isInfinite(i)||T.isNaN(i)?i:i/At.LOG_10},At.min=function(r,i,a,l){var d=r;return i<d&&(d=i),a<d&&(d=a),l<d&&(d=l),d},At.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1],a=arguments[2];return r<i?i:r>a?a:r}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var l=arguments[0],d=arguments[1],v=arguments[2];return l<d?d:l>v?v:l}},At.wrap=function(r,i){return r<0?i- -r%i:r%i},At.max=function(){if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2],l=r;return i>l&&(l=i),a>l&&(l=a),l}if(arguments.length===4){var d=arguments[0],v=arguments[1],M=arguments[2],L=arguments[3],H=d;return v>H&&(H=v),M>H&&(H=M),L>H&&(H=L),H}},At.average=function(r,i){return(r+i)/2},Mt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(At,Mt);var Rt=function(r){this.str=r};Rt.prototype.append=function(r){this.str+=r},Rt.prototype.setCharAt=function(r,i){this.str=this.str.substr(0,r)+i+this.str.substr(r+1)},Rt.prototype.toString=function(r){return this.str};var pt=function(r){this.value=r};pt.prototype.intValue=function(){return this.value},pt.prototype.compareTo=function(r){return this.value<r?-1:this.value>r?1:0},pt.isNaN=function(r){return Number.isNaN(r)};var yt=function(){};yt.isWhitespace=function(r){return r<=32&&r>=0||r===127},yt.toUpperCase=function(r){return r.toUpperCase()};var K=function r(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var i=arguments[0];this.init(i)}else if(arguments[0]instanceof r){var a=arguments[0];this.init(a)}else if(typeof arguments[0]=="string"){var l=arguments[0];r.call(this,r.parse(l))}}else if(arguments.length===2){var d=arguments[0],v=arguments[1];this.init(d,v)}},Bt={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};K.prototype.le=function(r){return(this._hi<r._hi||this._hi===r._hi)&&this._lo<=r._lo},K.prototype.extractSignificantDigits=function(r,i){var a=this.abs(),l=K.magnitude(a._hi),d=K.TEN.pow(l);(a=a.divide(d)).gt(K.TEN)?(a=a.divide(K.TEN),l+=1):a.lt(K.ONE)&&(a=a.multiply(K.TEN),l-=1);for(var v=l+1,M=new Rt,L=K.MAX_PRINT_DIGITS-1,H=0;H<=L;H++){r&&H===v&&M.append(".");var it=Math.trunc(a._hi);if(it<0)break;var bt=!1,Tt=0;it>9?(bt=!0,Tt="9"):Tt="0"+it,M.append(Tt),a=a.subtract(K.valueOf(it)).multiply(K.TEN),bt&&a.selfAdd(K.TEN);var Jt=!0,Qt=K.magnitude(a._hi);if(Qt<0&&Math.abs(Qt)>=L-H&&(Jt=!1),!Jt)break}return i[0]=l,M.toString()},K.prototype.sqr=function(){return this.multiply(this)},K.prototype.doubleValue=function(){return this._hi+this._lo},K.prototype.subtract=function(){if(arguments[0]instanceof K){var r=arguments[0];return this.add(r.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},K.prototype.equals=function(){if(arguments.length===1){var r=arguments[0];return this._hi===r._hi&&this._lo===r._lo}},K.prototype.isZero=function(){return this._hi===0&&this._lo===0},K.prototype.selfSubtract=function(){if(arguments[0]instanceof K){var r=arguments[0];return this.isNaN()?this:this.selfAdd(-r._hi,-r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}},K.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},K.prototype.min=function(r){return this.le(r)?this:r},K.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof K){var r=arguments[0];return this.selfDivide(r._hi,r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1],d=null,v=null,M=null,L=null,H=null,it=null,bt=null,Tt=null;return H=this._hi/a,it=K.SPLIT*H,d=it-H,Tt=K.SPLIT*a,d=it-d,v=H-d,M=Tt-a,bt=H*a,M=Tt-M,L=a-M,Tt=d*M-bt+d*L+v*M+v*L,it=(this._hi-bt-Tt+this._lo-H*l)/a,Tt=H+it,this._hi=Tt,this._lo=H-Tt+it,this}},K.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},K.prototype.divide=function(){if(arguments[0]instanceof K){var r=arguments[0],i=null,a=null,l=null,d=null,v=null,M=null,L=null,H=null;return a=(v=this._hi/r._hi)-(i=(M=K.SPLIT*v)-(i=M-v)),H=i*(l=(H=K.SPLIT*r._hi)-(l=H-r._hi))-(L=v*r._hi)+i*(d=r._hi-l)+a*l+a*d,M=(this._hi-L-H+this._lo-v*r._lo)/r._hi,new K(H=v+M,v-H+M)}if(typeof arguments[0]=="number"){var it=arguments[0];return T.isNaN(it)?K.createNaN():K.copy(this).selfDivide(it,0)}},K.prototype.ge=function(r){return(this._hi>r._hi||this._hi===r._hi)&&this._lo>=r._lo},K.prototype.pow=function(r){if(r===0)return K.valueOf(1);var i=new K(this),a=K.valueOf(1),l=Math.abs(r);if(l>1)for(;l>0;)l%2==1&&a.selfMultiply(i),(l/=2)>0&&(i=i.sqr());else a=i;return r<0?a.reciprocal():a},K.prototype.ceil=function(){if(this.isNaN())return K.NaN;var r=Math.ceil(this._hi),i=0;return r===this._hi&&(i=Math.ceil(this._lo)),new K(r,i)},K.prototype.compareTo=function(r){var i=r;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0},K.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},K.prototype.setValue=function(){if(arguments[0]instanceof K){var r=arguments[0];return this.init(r),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},K.prototype.max=function(r){return this.ge(r)?this:r},K.prototype.sqrt=function(){if(this.isZero())return K.valueOf(0);if(this.isNegative())return K.NaN;var r=1/Math.sqrt(this._hi),i=this._hi*r,a=K.valueOf(i),l=this.subtract(a.sqr())._hi*(.5*r);return a.add(l)},K.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof K){var r=arguments[0];return this.selfAdd(r._hi,r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],a=null,l=null,d=null,v=null,M=null,L=null;return d=this._hi+i,M=d-this._hi,v=d-M,v=i-M+(this._hi-v),L=v+this._lo,a=d+L,l=L+(d-a),this._hi=a+l,this._lo=l+(a-this._hi),this}}else if(arguments.length===2){var H=arguments[0],it=arguments[1],bt=null,Tt=null,Jt=null,Qt=null,le=null,Ee=null,On=null;Qt=this._hi+H,Tt=this._lo+it,le=Qt-(Ee=Qt-this._hi),Jt=Tt-(On=Tt-this._lo);var Jn=(bt=Qt+(Ee=(le=H-Ee+(this._hi-le))+Tt))+(Ee=(Jt=it-On+(this._lo-Jt))+(Ee+(Qt-bt))),ci=Ee+(bt-Jn);return this._hi=Jn,this._lo=ci,this}},K.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof K){var r=arguments[0];return this.selfMultiply(r._hi,r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1],d=null,v=null,M=null,L=null,H=null,it=null;d=(H=K.SPLIT*this._hi)-this._hi,it=K.SPLIT*a,d=H-d,v=this._hi-d,M=it-a;var bt=(H=this._hi*a)+(it=d*(M=it-M)-H+d*(L=a-M)+v*M+v*L+(this._hi*l+this._lo*a)),Tt=it+(d=H-bt);return this._hi=bt,this._lo=Tt,this}},K.prototype.selfSqr=function(){return this.selfMultiply(this)},K.prototype.floor=function(){if(this.isNaN())return K.NaN;var r=Math.floor(this._hi),i=0;return r===this._hi&&(i=Math.floor(this._lo)),new K(r,i)},K.prototype.negate=function(){return this.isNaN()?this:new K(-this._hi,-this._lo)},K.prototype.clone=function(){},K.prototype.multiply=function(){if(arguments[0]instanceof K){var r=arguments[0];return r.isNaN()?K.createNaN():K.copy(this).selfMultiply(r)}if(typeof arguments[0]=="number"){var i=arguments[0];return T.isNaN(i)?K.createNaN():K.copy(this).selfMultiply(i,0)}},K.prototype.isNaN=function(){return T.isNaN(this._hi)},K.prototype.intValue=function(){return Math.trunc(this._hi)},K.prototype.toString=function(){var r=K.magnitude(this._hi);return r>=-3&&r<=20?this.toStandardNotation():this.toSciNotation()},K.prototype.toStandardNotation=function(){var r=this.getSpecialNumberString();if(r!==null)return r;var i=new Array(1).fill(null),a=this.extractSignificantDigits(!0,i),l=i[0]+1,d=a;if(a.charAt(0)===".")d="0"+a;else if(l<0)d="0."+K.stringOfChar("0",-l)+a;else if(a.indexOf(".")===-1){var v=l-a.length;d=a+K.stringOfChar("0",v)+".0"}return this.isNegative()?"-"+d:d},K.prototype.reciprocal=function(){var r=null,i=null,a=null,l=null,d=null,v=null,M=null,L=null;i=(d=1/this._hi)-(r=(v=K.SPLIT*d)-(r=v-d)),a=(L=K.SPLIT*this._hi)-this._hi;var H=d+(v=(1-(M=d*this._hi)-(L=r*(a=L-a)-M+r*(l=this._hi-a)+i*a+i*l)-d*this._lo)/this._hi);return new K(H,d-H+v)},K.prototype.toSciNotation=function(){if(this.isZero())return K.SCI_NOT_ZERO;var r=this.getSpecialNumberString();if(r!==null)return r;var i=new Array(1).fill(null),a=this.extractSignificantDigits(!1,i),l=K.SCI_NOT_EXPONENT_CHAR+i[0];if(a.charAt(0)==="0")throw new Error("Found leading zero: "+a);var d="";a.length>1&&(d=a.substring(1));var v=a.charAt(0)+"."+d;return this.isNegative()?"-"+v+l:v+l},K.prototype.abs=function(){return this.isNaN()?K.NaN:this.isNegative()?this.negate():new K(this)},K.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},K.prototype.lt=function(r){return(this._hi<r._hi||this._hi===r._hi)&&this._lo<r._lo},K.prototype.add=function(){if(arguments[0]instanceof K){var r=arguments[0];return K.copy(this).selfAdd(r)}if(typeof arguments[0]=="number"){var i=arguments[0];return K.copy(this).selfAdd(i)}},K.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var r=arguments[0];this._hi=r,this._lo=0}else if(arguments[0]instanceof K){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this._hi=a,this._lo=l}},K.prototype.gt=function(r){return(this._hi>r._hi||this._hi===r._hi)&&this._lo>r._lo},K.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},K.prototype.trunc=function(){return this.isNaN()?K.NaN:this.isPositive()?this.floor():this.ceil()},K.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},K.prototype.interfaces_=function(){return[t,W,X]},K.prototype.getClass=function(){return K},K.sqr=function(r){return K.valueOf(r).selfMultiply(r)},K.valueOf=function(){if(typeof arguments[0]=="string"){var r=arguments[0];return K.parse(r)}if(typeof arguments[0]=="number"){var i=arguments[0];return new K(i)}},K.sqrt=function(r){return K.valueOf(r).sqrt()},K.parse=function(r){for(var i=0,a=r.length;yt.isWhitespace(r.charAt(i));)i++;var l=!1;if(i<a){var d=r.charAt(i);d!=="-"&&d!=="+"||(i++,d==="-"&&(l=!0))}for(var v=new K,M=0,L=0,H=0;!(i>=a);){var it=r.charAt(i);if(i++,yt.isDigit(it)){var bt=it-"0";v.selfMultiply(K.TEN),v.selfAdd(bt),M++}else{if(it!=="."){if(it==="e"||it==="E"){var Tt=r.substring(i);try{H=pt.parseInt(Tt)}catch(On){throw On instanceof Error?new Error("Invalid exponent "+Tt+" in string "+r):On}break}throw new Error("Unexpected character '"+it+"' at position "+i+" in string "+r)}L=M}}var Jt=v,Qt=M-L-H;if(Qt===0)Jt=v;else if(Qt>0){var le=K.TEN.pow(Qt);Jt=v.divide(le)}else if(Qt<0){var Ee=K.TEN.pow(-Qt);Jt=v.multiply(Ee)}return l?Jt.negate():Jt},K.createNaN=function(){return new K(T.NaN,T.NaN)},K.copy=function(r){return new K(r)},K.magnitude=function(r){var i=Math.abs(r),a=Math.log(i)/Math.log(10),l=Math.trunc(Math.floor(a));return 10*Math.pow(10,l)<=i&&(l+=1),l},K.stringOfChar=function(r,i){for(var a=new Rt,l=0;l<i;l++)a.append(r);return a.toString()},Bt.PI.get=function(){return new K(3.141592653589793,12246467991473532e-32)},Bt.TWO_PI.get=function(){return new K(6.283185307179586,24492935982947064e-32)},Bt.PI_2.get=function(){return new K(1.5707963267948966,6123233995736766e-32)},Bt.E.get=function(){return new K(2.718281828459045,14456468917292502e-32)},Bt.NaN.get=function(){return new K(T.NaN,T.NaN)},Bt.EPS.get=function(){return 123259516440783e-46},Bt.SPLIT.get=function(){return 134217729},Bt.MAX_PRINT_DIGITS.get=function(){return 32},Bt.TEN.get=function(){return K.valueOf(10)},Bt.ONE.get=function(){return K.valueOf(1)},Bt.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},Bt.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(K,Bt);var Gt=function(){},ae={DP_SAFE_EPSILON:{configurable:!0}};Gt.prototype.interfaces_=function(){return[]},Gt.prototype.getClass=function(){return Gt},Gt.orientationIndex=function(r,i,a){var l=Gt.orientationIndexFilter(r,i,a);if(l<=1)return l;var d=K.valueOf(i.x).selfAdd(-r.x),v=K.valueOf(i.y).selfAdd(-r.y),M=K.valueOf(a.x).selfAdd(-i.x),L=K.valueOf(a.y).selfAdd(-i.y);return d.selfMultiply(L).selfSubtract(v.selfMultiply(M)).signum()},Gt.signOfDet2x2=function(r,i,a,l){return r.multiply(l).selfSubtract(i.multiply(a)).signum()},Gt.intersection=function(r,i,a,l){var d=K.valueOf(l.y).selfSubtract(a.y).selfMultiply(K.valueOf(i.x).selfSubtract(r.x)),v=K.valueOf(l.x).selfSubtract(a.x).selfMultiply(K.valueOf(i.y).selfSubtract(r.y)),M=d.subtract(v),L=K.valueOf(l.x).selfSubtract(a.x).selfMultiply(K.valueOf(r.y).selfSubtract(a.y)),H=K.valueOf(l.y).selfSubtract(a.y).selfMultiply(K.valueOf(r.x).selfSubtract(a.x)),it=L.subtract(H).selfDivide(M).doubleValue(),bt=K.valueOf(r.x).selfAdd(K.valueOf(i.x).selfSubtract(r.x).selfMultiply(it)).doubleValue(),Tt=K.valueOf(i.x).selfSubtract(r.x).selfMultiply(K.valueOf(r.y).selfSubtract(a.y)),Jt=K.valueOf(i.y).selfSubtract(r.y).selfMultiply(K.valueOf(r.x).selfSubtract(a.x)),Qt=Tt.subtract(Jt).selfDivide(M).doubleValue(),le=K.valueOf(a.y).selfAdd(K.valueOf(l.y).selfSubtract(a.y).selfMultiply(Qt)).doubleValue();return new D(bt,le)},Gt.orientationIndexFilter=function(r,i,a){var l=null,d=(r.x-a.x)*(i.y-a.y),v=(r.y-a.y)*(i.x-a.x),M=d-v;if(d>0){if(v<=0)return Gt.signum(M);l=d+v}else{if(!(d<0)||v>=0)return Gt.signum(M);l=-d-v}var L=Gt.DP_SAFE_EPSILON*l;return M>=L||-M>=L?Gt.signum(M):2},Gt.signum=function(r){return r>0?1:r<0?-1:0},ae.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Gt,ae);var ut=function(){},Ut={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Ut.X.get=function(){return 0},Ut.Y.get=function(){return 1},Ut.Z.get=function(){return 2},Ut.M.get=function(){return 3},ut.prototype.setOrdinate=function(r,i,a){},ut.prototype.size=function(){},ut.prototype.getOrdinate=function(r,i){},ut.prototype.getCoordinate=function(){},ut.prototype.getCoordinateCopy=function(r){},ut.prototype.getDimension=function(){},ut.prototype.getX=function(r){},ut.prototype.clone=function(){},ut.prototype.expandEnvelope=function(r){},ut.prototype.copy=function(){},ut.prototype.getY=function(r){},ut.prototype.toCoordinateArray=function(){},ut.prototype.interfaces_=function(){return[X]},ut.prototype.getClass=function(){return ut},Object.defineProperties(ut,Ut);var jt=function(){},ce=function(r){function i(){r.call(this,"Projective point not representable on the Cartesian plane.")}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(jt),te=function(){};te.arraycopy=function(r,i,a,l,d){for(var v=0,M=i;M<i+d;M++)a[l+v]=r[M],v++},te.getProperty=function(r){return{"line.separator":\`
@@ -7742,4 +7742,4 @@ void main() {
7742
7742
 
7743
7743
  }\`,fm=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,o){if(this.texture===null){let a=new Vi,l=t.properties.get(a);l.__webglTexture=e.texture,(e.depthNear!=o.depthNear||e.depthFar!=o.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=a}}render(t,e){if(this.texture!==null){if(this.mesh===null){let o=e.cameras[0].viewport,a=new Ao({extensions:{fragDepth:!0},vertexShader:gF,fragmentShader:yF,uniforms:{depthColor:{value:this.texture},depthWidth:{value:o.z},depthHeight:{value:o.w}}});this.mesh=new fo(new Pf(20,20),a)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},hm=class extends Rs{constructor(t,e){super();let o=this,a=null,l=1,h=null,f="local-floor",p=1,d=null,g=null,x=null,v=null,S=null,b=null,T=new fm,_=e.getContextAttributes(),y=null,A=null,M=[],L=[],G=new un,z=null,F=new Ri;F.layers.enable(1),F.viewport=new Br;let I=new Ri;I.layers.enable(2),I.viewport=new Br;let ut=[F,I],R=new cm;R.layers.enable(1),R.layers.enable(2);let W=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(tt){let wt=M[tt];return wt===void 0&&(wt=new Ml,M[tt]=wt),wt.getTargetRaySpace()},this.getControllerGrip=function(tt){let wt=M[tt];return wt===void 0&&(wt=new Ml,M[tt]=wt),wt.getGripSpace()},this.getHand=function(tt){let wt=M[tt];return wt===void 0&&(wt=new Ml,M[tt]=wt),wt.getHandSpace()};function St(tt){let wt=L.indexOf(tt.inputSource);if(wt===-1)return;let Bt=M[wt];Bt!==void 0&&(Bt.update(tt.inputSource,tt.frame,d||h),Bt.dispatchEvent({type:tt.type,data:tt.inputSource}))}function X(){a.removeEventListener("select",St),a.removeEventListener("selectstart",St),a.removeEventListener("selectend",St),a.removeEventListener("squeeze",St),a.removeEventListener("squeezestart",St),a.removeEventListener("squeezeend",St),a.removeEventListener("end",X),a.removeEventListener("inputsourceschange",mt);for(let tt=0;tt<M.length;tt++){let wt=L[tt];wt!==null&&(L[tt]=null,M[tt].disconnect(wt))}W=null,V=null,T.reset(),t.setRenderTarget(y),S=null,v=null,x=null,a=null,A=null,Yt.stop(),o.isPresenting=!1,t.setPixelRatio(z),t.setSize(G.width,G.height,!1),o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(tt){l=tt,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(tt){f=tt,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||h},this.setReferenceSpace=function(tt){d=tt},this.getBaseLayer=function(){return v!==null?v:S},this.getBinding=function(){return x},this.getFrame=function(){return b},this.getSession=function(){return a},this.setSession=function(tt){return oc(this,null,function*(){if(a=tt,a!==null){if(y=t.getRenderTarget(),a.addEventListener("select",St),a.addEventListener("selectstart",St),a.addEventListener("selectend",St),a.addEventListener("squeeze",St),a.addEventListener("squeezestart",St),a.addEventListener("squeezeend",St),a.addEventListener("end",X),a.addEventListener("inputsourceschange",mt),_.xrCompatible!==!0&&(yield e.makeXRCompatible()),z=t.getPixelRatio(),t.getSize(G),a.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let wt={antialias:a.renderState.layers===void 0?_.antialias:!0,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:l};S=new XRWebGLLayer(a,e,wt),a.updateRenderState({baseLayer:S}),t.setPixelRatio(1),t.setSize(S.framebufferWidth,S.framebufferHeight,!1),A=new ss(S.framebufferWidth,S.framebufferHeight,{format:co,type:Ps,colorSpace:t.outputColorSpace,stencilBuffer:_.stencil})}else{let wt=null,Bt=null,$t=null;_.depth&&($t=_.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,wt=_.stencil?yu:ha,Bt=_.stencil?fa:Ts);let Ut={colorFormat:e.RGBA8,depthFormat:$t,scaleFactor:l};x=new XRWebGLBinding(a,e),v=x.createProjectionLayer(Ut),a.updateRenderState({layers:[v]}),t.setPixelRatio(1),t.setSize(v.textureWidth,v.textureHeight,!1),A=new ss(v.textureWidth,v.textureHeight,{format:co,type:Ps,depthTexture:new Rf(v.textureWidth,v.textureHeight,Bt,void 0,void 0,void 0,void 0,void 0,void 0,wt),stencilBuffer:_.stencil,colorSpace:t.outputColorSpace,samples:_.antialias?4:0});let Dt=t.properties.get(A);Dt.__ignoreDepthValues=v.ignoreDepthValues}A.isXRRenderTarget=!0,this.setFoveation(p),d=null,h=yield a.requestReferenceSpace(f),Yt.setContext(a),Yt.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(a!==null)return a.environmentBlendMode};function mt(tt){for(let wt=0;wt<tt.removed.length;wt++){let Bt=tt.removed[wt],$t=L.indexOf(Bt);$t>=0&&(L[$t]=null,M[$t].disconnect(Bt))}for(let wt=0;wt<tt.added.length;wt++){let Bt=tt.added[wt],$t=L.indexOf(Bt);if($t===-1){for(let Dt=0;Dt<M.length;Dt++)if(Dt>=L.length){L.push(Bt),$t=Dt;break}else if(L[Dt]===null){L[Dt]=Bt,$t=Dt;break}if($t===-1)break}let Ut=M[$t];Ut&&Ut.connect(Bt)}}let dt=new xt,vt=new xt;function rt(tt,wt,Bt){dt.setFromMatrixPosition(wt.matrixWorld),vt.setFromMatrixPosition(Bt.matrixWorld);let $t=dt.distanceTo(vt),Ut=wt.projectionMatrix.elements,Dt=Bt.projectionMatrix.elements,At=Ut[14]/(Ut[10]-1),te=Ut[14]/(Ut[10]+1),nt=(Ut[9]+1)/Ut[5],on=(Ut[9]-1)/Ut[5],zt=(Ut[8]-1)/Ut[0],ne=(Dt[8]+1)/Dt[0],Wt=At*zt,ie=At*ne,ce=$t/(-zt+ne),Lt=ce*-zt;wt.matrixWorld.decompose(tt.position,tt.quaternion,tt.scale),tt.translateX(Lt),tt.translateZ(ce),tt.matrixWorld.compose(tt.position,tt.quaternion,tt.scale),tt.matrixWorldInverse.copy(tt.matrixWorld).invert();let se=At+ce,Y=te+ce,N=Wt-Lt,_t=ie+($t-Lt),Et=nt*te/Y*se,it=on*te/Y*se;tt.projectionMatrix.makePerspective(N,_t,Et,it,se,Y),tt.projectionMatrixInverse.copy(tt.projectionMatrix).invert()}function lt(tt,wt){wt===null?tt.matrixWorld.copy(tt.matrix):tt.matrixWorld.multiplyMatrices(wt.matrixWorld,tt.matrix),tt.matrixWorldInverse.copy(tt.matrixWorld).invert()}this.updateCamera=function(tt){if(a===null)return;T.texture!==null&&(tt.near=T.depthNear,tt.far=T.depthFar),R.near=I.near=F.near=tt.near,R.far=I.far=F.far=tt.far,(W!==R.near||V!==R.far)&&(a.updateRenderState({depthNear:R.near,depthFar:R.far}),W=R.near,V=R.far,F.near=W,F.far=V,I.near=W,I.far=V,F.updateProjectionMatrix(),I.updateProjectionMatrix(),tt.updateProjectionMatrix());let wt=tt.parent,Bt=R.cameras;lt(R,wt);for(let $t=0;$t<Bt.length;$t++)lt(Bt[$t],wt);Bt.length===2?rt(R,F,I):R.projectionMatrix.copy(F.projectionMatrix),H(tt,R,wt)};function H(tt,wt,Bt){Bt===null?tt.matrix.copy(wt.matrixWorld):(tt.matrix.copy(Bt.matrixWorld),tt.matrix.invert(),tt.matrix.multiply(wt.matrixWorld)),tt.matrix.decompose(tt.position,tt.quaternion,tt.scale),tt.updateMatrixWorld(!0),tt.projectionMatrix.copy(wt.projectionMatrix),tt.projectionMatrixInverse.copy(wt.projectionMatrixInverse),tt.isPerspectiveCamera&&(tt.fov=$d*2*Math.atan(1/tt.projectionMatrix.elements[5]),tt.zoom=1)}this.getCamera=function(){return R},this.getFoveation=function(){if(!(v===null&&S===null))return p},this.setFoveation=function(tt){p=tt,v!==null&&(v.fixedFoveation=tt),S!==null&&S.fixedFoveation!==void 0&&(S.fixedFoveation=tt)},this.hasDepthSensing=function(){return T.texture!==null};let bt=null;function Tt(tt,wt){if(g=wt.getViewerPose(d||h),b=wt,g!==null){let Bt=g.views;S!==null&&(t.setRenderTargetFramebuffer(A,S.framebuffer),t.setRenderTarget(A));let $t=!1;Bt.length!==R.cameras.length&&(R.cameras.length=0,$t=!0);for(let Dt=0;Dt<Bt.length;Dt++){let At=Bt[Dt],te=null;if(S!==null)te=S.getViewport(At);else{let on=x.getViewSubImage(v,At);te=on.viewport,Dt===0&&(t.setRenderTargetTextures(A,on.colorTexture,v.ignoreDepthValues?void 0:on.depthStencilTexture),t.setRenderTarget(A))}let nt=ut[Dt];nt===void 0&&(nt=new Ri,nt.layers.enable(Dt),nt.viewport=new Br,ut[Dt]=nt),nt.matrix.fromArray(At.transform.matrix),nt.matrix.decompose(nt.position,nt.quaternion,nt.scale),nt.projectionMatrix.fromArray(At.projectionMatrix),nt.projectionMatrixInverse.copy(nt.projectionMatrix).invert(),nt.viewport.set(te.x,te.y,te.width,te.height),Dt===0&&(R.matrix.copy(nt.matrix),R.matrix.decompose(R.position,R.quaternion,R.scale)),$t===!0&&R.cameras.push(nt)}let Ut=a.enabledFeatures;if(Ut&&Ut.includes("depth-sensing")){let Dt=x.getDepthInformation(Bt[0]);Dt&&Dt.isValid&&Dt.texture&&T.init(t,Dt,a.renderState)}}for(let Bt=0;Bt<M.length;Bt++){let $t=L[Bt],Ut=M[Bt];$t!==null&&Ut!==void 0&&Ut.update($t,wt,d||h)}T.render(t,R),bt&&bt(tt,wt),wt.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:wt}),b=null}let Yt=new FE;Yt.setAnimationLoop(Tt),this.setAnimationLoop=function(tt){bt=tt},this.dispose=function(){}}},sa=new da,vF=new Tr;function _F(r,t){function e(_,y){_.matrixAutoUpdate===!0&&_.updateMatrix(),y.value.copy(_.matrix)}function o(_,y){y.color.getRGB(_.fogColor.value,DE(r)),y.isFog?(_.fogNear.value=y.near,_.fogFar.value=y.far):y.isFogExp2&&(_.fogDensity.value=y.density)}function a(_,y,A,M,L){y.isMeshBasicMaterial||y.isMeshLambertMaterial?l(_,y):y.isMeshToonMaterial?(l(_,y),x(_,y)):y.isMeshPhongMaterial?(l(_,y),g(_,y)):y.isMeshStandardMaterial?(l(_,y),v(_,y),y.isMeshPhysicalMaterial&&S(_,y,L)):y.isMeshMatcapMaterial?(l(_,y),b(_,y)):y.isMeshDepthMaterial?l(_,y):y.isMeshDistanceMaterial?(l(_,y),T(_,y)):y.isMeshNormalMaterial?l(_,y):y.isLineBasicMaterial?(h(_,y),y.isLineDashedMaterial&&f(_,y)):y.isPointsMaterial?p(_,y,A,M):y.isSpriteMaterial?d(_,y):y.isShadowMaterial?(_.color.value.copy(y.color),_.opacity.value=y.opacity):y.isShaderMaterial&&(y.uniformsNeedUpdate=!1)}function l(_,y){_.opacity.value=y.opacity,y.color&&_.diffuse.value.copy(y.color),y.emissive&&_.emissive.value.copy(y.emissive).multiplyScalar(y.emissiveIntensity),y.map&&(_.map.value=y.map,e(y.map,_.mapTransform)),y.alphaMap&&(_.alphaMap.value=y.alphaMap,e(y.alphaMap,_.alphaMapTransform)),y.bumpMap&&(_.bumpMap.value=y.bumpMap,e(y.bumpMap,_.bumpMapTransform),_.bumpScale.value=y.bumpScale,y.side===xi&&(_.bumpScale.value*=-1)),y.normalMap&&(_.normalMap.value=y.normalMap,e(y.normalMap,_.normalMapTransform),_.normalScale.value.copy(y.normalScale),y.side===xi&&_.normalScale.value.negate()),y.displacementMap&&(_.displacementMap.value=y.displacementMap,e(y.displacementMap,_.displacementMapTransform),_.displacementScale.value=y.displacementScale,_.displacementBias.value=y.displacementBias),y.emissiveMap&&(_.emissiveMap.value=y.emissiveMap,e(y.emissiveMap,_.emissiveMapTransform)),y.specularMap&&(_.specularMap.value=y.specularMap,e(y.specularMap,_.specularMapTransform)),y.alphaTest>0&&(_.alphaTest.value=y.alphaTest);let A=t.get(y),M=A.envMap,L=A.envMapRotation;if(M&&(_.envMap.value=M,sa.copy(L),sa.x*=-1,sa.y*=-1,sa.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(sa.y*=-1,sa.z*=-1),_.envMapRotation.value.setFromMatrix4(vF.makeRotationFromEuler(sa)),_.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=y.reflectivity,_.ior.value=y.ior,_.refractionRatio.value=y.refractionRatio),y.lightMap){_.lightMap.value=y.lightMap;let G=r._useLegacyLights===!0?Math.PI:1;_.lightMapIntensity.value=y.lightMapIntensity*G,e(y.lightMap,_.lightMapTransform)}y.aoMap&&(_.aoMap.value=y.aoMap,_.aoMapIntensity.value=y.aoMapIntensity,e(y.aoMap,_.aoMapTransform))}function h(_,y){_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,y.map&&(_.map.value=y.map,e(y.map,_.mapTransform))}function f(_,y){_.dashSize.value=y.dashSize,_.totalSize.value=y.dashSize+y.gapSize,_.scale.value=y.scale}function p(_,y,A,M){_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,_.size.value=y.size*A,_.scale.value=M*.5,y.map&&(_.map.value=y.map,e(y.map,_.uvTransform)),y.alphaMap&&(_.alphaMap.value=y.alphaMap,e(y.alphaMap,_.alphaMapTransform)),y.alphaTest>0&&(_.alphaTest.value=y.alphaTest)}function d(_,y){_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,_.rotation.value=y.rotation,y.map&&(_.map.value=y.map,e(y.map,_.mapTransform)),y.alphaMap&&(_.alphaMap.value=y.alphaMap,e(y.alphaMap,_.alphaMapTransform)),y.alphaTest>0&&(_.alphaTest.value=y.alphaTest)}function g(_,y){_.specular.value.copy(y.specular),_.shininess.value=Math.max(y.shininess,1e-4)}function x(_,y){y.gradientMap&&(_.gradientMap.value=y.gradientMap)}function v(_,y){_.metalness.value=y.metalness,y.metalnessMap&&(_.metalnessMap.value=y.metalnessMap,e(y.metalnessMap,_.metalnessMapTransform)),_.roughness.value=y.roughness,y.roughnessMap&&(_.roughnessMap.value=y.roughnessMap,e(y.roughnessMap,_.roughnessMapTransform)),t.get(y).envMap&&(_.envMapIntensity.value=y.envMapIntensity)}function S(_,y,A){_.ior.value=y.ior,y.sheen>0&&(_.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),_.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(_.sheenColorMap.value=y.sheenColorMap,e(y.sheenColorMap,_.sheenColorMapTransform)),y.sheenRoughnessMap&&(_.sheenRoughnessMap.value=y.sheenRoughnessMap,e(y.sheenRoughnessMap,_.sheenRoughnessMapTransform))),y.clearcoat>0&&(_.clearcoat.value=y.clearcoat,_.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(_.clearcoatMap.value=y.clearcoatMap,e(y.clearcoatMap,_.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,e(y.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(_.clearcoatNormalMap.value=y.clearcoatNormalMap,e(y.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===xi&&_.clearcoatNormalScale.value.negate())),y.iridescence>0&&(_.iridescence.value=y.iridescence,_.iridescenceIOR.value=y.iridescenceIOR,_.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(_.iridescenceMap.value=y.iridescenceMap,e(y.iridescenceMap,_.iridescenceMapTransform)),y.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=y.iridescenceThicknessMap,e(y.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),y.transmission>0&&(_.transmission.value=y.transmission,_.transmissionSamplerMap.value=A.texture,_.transmissionSamplerSize.value.set(A.width,A.height),y.transmissionMap&&(_.transmissionMap.value=y.transmissionMap,e(y.transmissionMap,_.transmissionMapTransform)),_.thickness.value=y.thickness,y.thicknessMap&&(_.thicknessMap.value=y.thicknessMap,e(y.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=y.attenuationDistance,_.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(_.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(_.anisotropyMap.value=y.anisotropyMap,e(y.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=y.specularIntensity,_.specularColor.value.copy(y.specularColor),y.specularColorMap&&(_.specularColorMap.value=y.specularColorMap,e(y.specularColorMap,_.specularColorMapTransform)),y.specularIntensityMap&&(_.specularIntensityMap.value=y.specularIntensityMap,e(y.specularIntensityMap,_.specularIntensityMapTransform))}function b(_,y){y.matcap&&(_.matcap.value=y.matcap)}function T(_,y){let A=t.get(y).light;_.referencePosition.value.setFromMatrixPosition(A.matrixWorld),_.nearDistance.value=A.shadow.camera.near,_.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:a}}function xF(r,t,e,o){let a={},l={},h=[],f=e.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function p(A,M){let L=M.program;o.uniformBlockBinding(A,L)}function d(A,M){let L=a[A.id];L===void 0&&(b(A),L=g(A),a[A.id]=L,A.addEventListener("dispose",_));let G=M.program;o.updateUBOMapping(A,G);let z=t.render.frame;l[A.id]!==z&&(v(A),l[A.id]=z)}function g(A){let M=x();A.__bindingPointIndex=M;let L=r.createBuffer(),G=A.__size,z=A.usage;return r.bindBuffer(r.UNIFORM_BUFFER,L),r.bufferData(r.UNIFORM_BUFFER,G,z),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,M,L),L}function x(){for(let A=0;A<f;A++)if(h.indexOf(A)===-1)return h.push(A),A;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function v(A){let M=a[A.id],L=A.uniforms,G=A.__cache;r.bindBuffer(r.UNIFORM_BUFFER,M);for(let z=0,F=L.length;z<F;z++){let I=Array.isArray(L[z])?L[z]:[L[z]];for(let ut=0,R=I.length;ut<R;ut++){let W=I[ut];if(S(W,z,ut,G)===!0){let V=W.__offset,St=Array.isArray(W.value)?W.value:[W.value],X=0;for(let mt=0;mt<St.length;mt++){let dt=St[mt],vt=T(dt);typeof dt=="number"||typeof dt=="boolean"?(W.__data[0]=dt,r.bufferSubData(r.UNIFORM_BUFFER,V+X,W.__data)):dt.isMatrix3?(W.__data[0]=dt.elements[0],W.__data[1]=dt.elements[1],W.__data[2]=dt.elements[2],W.__data[3]=0,W.__data[4]=dt.elements[3],W.__data[5]=dt.elements[4],W.__data[6]=dt.elements[5],W.__data[7]=0,W.__data[8]=dt.elements[6],W.__data[9]=dt.elements[7],W.__data[10]=dt.elements[8],W.__data[11]=0):(dt.toArray(W.__data,X),X+=vt.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,V,W.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function S(A,M,L,G){let z=A.value,F=M+"_"+L;if(G[F]===void 0)return typeof z=="number"||typeof z=="boolean"?G[F]=z:G[F]=z.clone(),!0;{let I=G[F];if(typeof z=="number"||typeof z=="boolean"){if(I!==z)return G[F]=z,!0}else if(I.equals(z)===!1)return I.copy(z),!0}return!1}function b(A){let M=A.uniforms,L=0,G=16;for(let F=0,I=M.length;F<I;F++){let ut=Array.isArray(M[F])?M[F]:[M[F]];for(let R=0,W=ut.length;R<W;R++){let V=ut[R],St=Array.isArray(V.value)?V.value:[V.value];for(let X=0,mt=St.length;X<mt;X++){let dt=St[X],vt=T(dt),rt=L%G;rt!==0&&G-rt<vt.boundary&&(L+=G-rt),V.__data=new Float32Array(vt.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=L,L+=vt.storage}}}let z=L%G;return z>0&&(L+=G-z),A.__size=L,A.__cache={},this}function T(A){let M={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(M.boundary=4,M.storage=4):A.isVector2?(M.boundary=8,M.storage=8):A.isVector3||A.isColor?(M.boundary=16,M.storage=12):A.isVector4?(M.boundary=16,M.storage=16):A.isMatrix3?(M.boundary=48,M.storage=48):A.isMatrix4?(M.boundary=64,M.storage=64):A.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",A),M}function _(A){let M=A.target;M.removeEventListener("dispose",_);let L=h.indexOf(M.__bindingPointIndex);h.splice(L,1),r.deleteBuffer(a[M.id]),delete a[M.id],delete l[M.id]}function y(){for(let A in a)r.deleteBuffer(a[A]);h=[],a={},l={}}return{bind:p,update:d,dispose:y}}var pm=class{constructor(t={}){let{canvas:e=MN(),context:o=null,depth:a=!0,stencil:l=!0,alpha:h=!1,antialias:f=!1,premultipliedAlpha:p=!0,preserveDrawingBuffer:d=!1,powerPreference:g="default",failIfMajorPerformanceCaveat:x=!1}=t;this.isWebGLRenderer=!0;let v;o!==null?v=o.getContextAttributes().alpha:v=h;let S=new Uint32Array(4),b=new Int32Array(4),T=null,_=null,y=[],A=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=wo,this._useLegacyLights=!1,this.toneMapping=Cs,this.toneMappingExposure=1;let M=this,L=!1,G=0,z=0,F=null,I=-1,ut=null,R=new Br,W=new Br,V=null,St=new En(0),X=0,mt=e.width,dt=e.height,vt=1,rt=null,lt=null,H=new Br(0,0,mt,dt),bt=new Br(0,0,mt,dt),Tt=!1,Yt=new Cf,tt=!1,wt=!1,Bt=null,$t=new Tr,Ut=new un,Dt=new xt,At={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function te(){return F===null?vt:1}let nt=o;function on(q,ot){for(let yt=0;yt<q.length;yt++){let ht=q[yt],at=e.getContext(ht,ot);if(at!==null)return at}return null}try{let q={alpha:!0,depth:a,stencil:l,antialias:f,premultipliedAlpha:p,preserveDrawingBuffer:d,powerPreference:g,failIfMajorPerformanceCaveat:x};if("setAttribute"in e&&e.setAttribute("data-engine",\`three.js r\${bm}\`),e.addEventListener("webglcontextlost",ct,!1),e.addEventListener("webglcontextrestored",O,!1),e.addEventListener("webglcontextcreationerror",K,!1),nt===null){let ot=["webgl2","webgl","experimental-webgl"];if(M.isWebGL1Renderer===!0&&ot.shift(),nt=on(ot,q),nt===null)throw on(ot)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&nt instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),nt.getShaderPrecisionFormat===void 0&&(nt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(q){throw console.error("THREE.WebGLRenderer: "+q.message),q}let zt,ne,Wt,ie,ce,Lt,se,Y,N,_t,Et,it,Pt,ue,Ct,Ot,qt,J,w,P,D,k,B,et;function j(){zt=new FD(nt),ne=new ID(nt,zt,t),zt.init(ne),k=new dF(nt,zt,ne),Wt=new hF(nt,zt,ne),ie=new zD(nt),ce=new tF,Lt=new pF(nt,zt,Wt,ce,ne,k,ie),se=new LD(M),Y=new DD(M),N=new WN(nt,ne),B=new CD(nt,zt,N,ne),_t=new UD(nt,N,ie,B),Et=new VD(nt,_t,N,ie),w=new qD(nt,ne,Lt),Ot=new RD(ce),it=new Q3(M,se,Y,zt,ne,B,Ot),Pt=new _F(M,ce),ue=new nF,Ct=new uF(zt,ne),J=new AD(M,se,Y,Wt,Et,v,p),qt=new fF(M,Et,ne),et=new xF(nt,ie,ne,Wt),P=new PD(nt,zt,ie,ne),D=new BD(nt,zt,ie,ne),ie.programs=it.programs,M.capabilities=ne,M.extensions=zt,M.properties=ce,M.renderLists=ue,M.shadowMap=qt,M.state=Wt,M.info=ie}j();let ft=new hm(M,nt);this.xr=ft,this.getContext=function(){return nt},this.getContextAttributes=function(){return nt.getContextAttributes()},this.forceContextLoss=function(){let q=zt.get("WEBGL_lose_context");q&&q.loseContext()},this.forceContextRestore=function(){let q=zt.get("WEBGL_lose_context");q&&q.restoreContext()},this.getPixelRatio=function(){return vt},this.setPixelRatio=function(q){q!==void 0&&(vt=q,this.setSize(mt,dt,!1))},this.getSize=function(q){return q.set(mt,dt)},this.setSize=function(q,ot,yt=!0){if(ft.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}mt=q,dt=ot,e.width=Math.floor(q*vt),e.height=Math.floor(ot*vt),yt===!0&&(e.style.width=q+"px",e.style.height=ot+"px"),this.setViewport(0,0,q,ot)},this.getDrawingBufferSize=function(q){return q.set(mt*vt,dt*vt).floor()},this.setDrawingBufferSize=function(q,ot,yt){mt=q,dt=ot,vt=yt,e.width=Math.floor(q*yt),e.height=Math.floor(ot*yt),this.setViewport(0,0,q,ot)},this.getCurrentViewport=function(q){return q.copy(R)},this.getViewport=function(q){return q.copy(H)},this.setViewport=function(q,ot,yt,ht){q.isVector4?H.set(q.x,q.y,q.z,q.w):H.set(q,ot,yt,ht),Wt.viewport(R.copy(H).multiplyScalar(vt).round())},this.getScissor=function(q){return q.copy(bt)},this.setScissor=function(q,ot,yt,ht){q.isVector4?bt.set(q.x,q.y,q.z,q.w):bt.set(q,ot,yt,ht),Wt.scissor(W.copy(bt).multiplyScalar(vt).round())},this.getScissorTest=function(){return Tt},this.setScissorTest=function(q){Wt.setScissorTest(Tt=q)},this.setOpaqueSort=function(q){rt=q},this.setTransparentSort=function(q){lt=q},this.getClearColor=function(q){return q.copy(J.getClearColor())},this.setClearColor=function(){J.setClearColor.apply(J,arguments)},this.getClearAlpha=function(){return J.getClearAlpha()},this.setClearAlpha=function(){J.setClearAlpha.apply(J,arguments)},this.clear=function(q=!0,ot=!0,yt=!0){let ht=0;if(q){let at=!1;if(F!==null){let Ht=F.texture.format;at=Ht===IE||Ht===PE||Ht===CE}if(at){let Ht=F.texture.type,Xt=Ht===Ps||Ht===Ts||Ht===Tm||Ht===fa||Ht===TE||Ht===AE,re=J.getClearColor(),Zt=J.getClearAlpha(),me=re.r,oe=re.g,ae=re.b;Xt?(S[0]=me,S[1]=oe,S[2]=ae,S[3]=Zt,nt.clearBufferuiv(nt.COLOR,0,S)):(b[0]=me,b[1]=oe,b[2]=ae,b[3]=Zt,nt.clearBufferiv(nt.COLOR,0,b))}else ht|=nt.COLOR_BUFFER_BIT}ot&&(ht|=nt.DEPTH_BUFFER_BIT),yt&&(ht|=nt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),nt.clear(ht)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",ct,!1),e.removeEventListener("webglcontextrestored",O,!1),e.removeEventListener("webglcontextcreationerror",K,!1),ue.dispose(),Ct.dispose(),ce.dispose(),se.dispose(),Y.dispose(),Et.dispose(),B.dispose(),et.dispose(),it.dispose(),ft.dispose(),ft.removeEventListener("sessionstart",xe),ft.removeEventListener("sessionend",de),Bt&&(Bt.dispose(),Bt=null),Se.stop()};function ct(q){q.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),L=!0}function O(){console.log("THREE.WebGLRenderer: Context Restored."),L=!1;let q=ie.autoReset,ot=qt.enabled,yt=qt.autoUpdate,ht=qt.needsUpdate,at=qt.type;j(),ie.autoReset=q,qt.enabled=ot,qt.autoUpdate=yt,qt.needsUpdate=ht,qt.type=at}function K(q){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",q.statusMessage)}function $(q){let ot=q.target;ot.removeEventListener("dispose",$),Q(ot)}function Q(q){Mt(q),ce.remove(q)}function Mt(q){let ot=ce.get(q).programs;ot!==void 0&&(ot.forEach(function(yt){it.releaseProgram(yt)}),q.isShaderMaterial&&it.releaseShaderCache(q))}this.renderBufferDirect=function(q,ot,yt,ht,at,Ht){ot===null&&(ot=At);let Xt=at.isMesh&&at.matrixWorld.determinant()<0,re=xn(q,ot,yt,ht,at);Wt.setMaterial(ht,Xt);let Zt=yt.index,me=1;if(ht.wireframe===!0){if(Zt=_t.getWireframeAttribute(yt),Zt===void 0)return;me=2}let oe=yt.drawRange,ae=yt.attributes.position,sn=oe.start*me,gr=(oe.start+oe.count)*me;Ht!==null&&(sn=Math.max(sn,Ht.start*me),gr=Math.min(gr,(Ht.start+Ht.count)*me)),Zt!==null?(sn=Math.max(sn,0),gr=Math.min(gr,Zt.count)):ae!=null&&(sn=Math.max(sn,0),gr=Math.min(gr,ae.count));let Un=gr-sn;if(Un<0||Un===1/0)return;B.setup(at,ht,re,yt,Zt);let Qr,Sn=P;if(Zt!==null&&(Qr=N.get(Zt),Sn=D,Sn.setIndex(Qr)),at.isMesh)ht.wireframe===!0?(Wt.setLineWidth(ht.wireframeLinewidth*te()),Sn.setMode(nt.LINES)):Sn.setMode(nt.TRIANGLES);else if(at.isLine){let jt=ht.linewidth;jt===void 0&&(jt=1),Wt.setLineWidth(jt*te()),at.isLineSegments?Sn.setMode(nt.LINES):at.isLineLoop?Sn.setMode(nt.LINE_LOOP):Sn.setMode(nt.LINE_STRIP)}else at.isPoints?Sn.setMode(nt.POINTS):at.isSprite&&Sn.setMode(nt.TRIANGLES);if(at.isBatchedMesh)Sn.renderMultiDraw(at._multiDrawStarts,at._multiDrawCounts,at._multiDrawCount);else if(at.isInstancedMesh)Sn.renderInstances(sn,Un,at.count);else if(yt.isInstancedBufferGeometry){let jt=yt._maxInstanceCount!==void 0?yt._maxInstanceCount:1/0,Aa=Math.min(yt.instanceCount,jt);Sn.renderInstances(sn,Un,Aa)}else Sn.render(sn,Un)};function Nt(q,ot,yt){q.transparent===!0&&q.side===ns&&q.forceSinglePass===!1?(q.side=xi,q.needsUpdate=!0,_n(q,ot,yt),q.side=Is,q.needsUpdate=!0,_n(q,ot,yt),q.side=ns):_n(q,ot,yt)}this.compile=function(q,ot,yt=null){yt===null&&(yt=q),_=Ct.get(yt),_.init(),A.push(_),yt.traverseVisible(function(at){at.isLight&&at.layers.test(ot.layers)&&(_.pushLight(at),at.castShadow&&_.pushShadow(at))}),q!==yt&&q.traverseVisible(function(at){at.isLight&&at.layers.test(ot.layers)&&(_.pushLight(at),at.castShadow&&_.pushShadow(at))}),_.setupLights(M._useLegacyLights);let ht=new Set;return q.traverse(function(at){let Ht=at.material;if(Ht)if(Array.isArray(Ht))for(let Xt=0;Xt<Ht.length;Xt++){let re=Ht[Xt];Nt(re,yt,at),ht.add(re)}else Nt(Ht,yt,at),ht.add(Ht)}),A.pop(),_=null,ht},this.compileAsync=function(q,ot,yt=null){let ht=this.compile(q,ot,yt);return new Promise(at=>{function Ht(){if(ht.forEach(function(Xt){ce.get(Xt).currentProgram.isReady()&&ht.delete(Xt)}),ht.size===0){at(q);return}setTimeout(Ht,10)}zt.get("KHR_parallel_shader_compile")!==null?Ht():setTimeout(Ht,10)})};let Jt=null;function Kt(q){Jt&&Jt(q)}function xe(){Se.stop()}function de(){Se.start()}let Se=new FE;Se.setAnimationLoop(Kt),typeof self!="undefined"&&Se.setContext(self),this.setAnimationLoop=function(q){Jt=q,ft.setAnimationLoop(q),q===null?Se.stop():Se.start()},ft.addEventListener("sessionstart",xe),ft.addEventListener("sessionend",de),this.render=function(q,ot){if(ot!==void 0&&ot.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),ot.parent===null&&ot.matrixWorldAutoUpdate===!0&&ot.updateMatrixWorld(),ft.enabled===!0&&ft.isPresenting===!0&&(ft.cameraAutoUpdate===!0&&ft.updateCamera(ot),ot=ft.getCamera()),q.isScene===!0&&q.onBeforeRender(M,q,ot,F),_=Ct.get(q,A.length),_.init(),A.push(_),$t.multiplyMatrices(ot.projectionMatrix,ot.matrixWorldInverse),Yt.setFromProjectionMatrix($t),wt=this.localClippingEnabled,tt=Ot.init(this.clippingPlanes,wt),T=ue.get(q,y.length),T.init(),y.push(T),Me(q,ot,0,M.sortObjects),T.finish(),M.sortObjects===!0&&T.sort(rt,lt),this.info.render.frame++,tt===!0&&Ot.beginShadows();let yt=_.state.shadowsArray;if(qt.render(yt,q,ot),tt===!0&&Ot.endShadows(),this.info.autoReset===!0&&this.info.reset(),(ft.enabled===!1||ft.isPresenting===!1||ft.hasDepthSensing()===!1)&&J.render(T,q),_.setupLights(M._useLegacyLights),ot.isArrayCamera){let ht=ot.cameras;for(let at=0,Ht=ht.length;at<Ht;at++){let Xt=ht[at];Nn(T,q,Xt,Xt.viewport)}}else Nn(T,q,ot);F!==null&&(Lt.updateMultisampleRenderTarget(F),Lt.updateRenderTargetMipmap(F)),q.isScene===!0&&q.onAfterRender(M,q,ot),B.resetDefaultState(),I=-1,ut=null,A.pop(),A.length>0?_=A[A.length-1]:_=null,y.pop(),y.length>0?T=y[y.length-1]:T=null};function Me(q,ot,yt,ht){if(q.visible===!1)return;if(q.layers.test(ot.layers)){if(q.isGroup)yt=q.renderOrder;else if(q.isLOD)q.autoUpdate===!0&&q.update(ot);else if(q.isLight)_.pushLight(q),q.castShadow&&_.pushShadow(q);else if(q.isSprite){if(!q.frustumCulled||Yt.intersectsSprite(q)){ht&&Dt.setFromMatrixPosition(q.matrixWorld).applyMatrix4($t);let Xt=Et.update(q),re=q.material;re.visible&&T.push(q,Xt,re,yt,Dt.z,null)}}else if((q.isMesh||q.isLine||q.isPoints)&&(!q.frustumCulled||Yt.intersectsObject(q))){let Xt=Et.update(q),re=q.material;if(ht&&(q.boundingSphere!==void 0?(q.boundingSphere===null&&q.computeBoundingSphere(),Dt.copy(q.boundingSphere.center)):(Xt.boundingSphere===null&&Xt.computeBoundingSphere(),Dt.copy(Xt.boundingSphere.center)),Dt.applyMatrix4(q.matrixWorld).applyMatrix4($t)),Array.isArray(re)){let Zt=Xt.groups;for(let me=0,oe=Zt.length;me<oe;me++){let ae=Zt[me],sn=re[ae.materialIndex];sn&&sn.visible&&T.push(q,Xt,sn,yt,Dt.z,ae)}}else re.visible&&T.push(q,Xt,re,yt,Dt.z,null)}}let Ht=q.children;for(let Xt=0,re=Ht.length;Xt<re;Xt++)Me(Ht[Xt],ot,yt,ht)}function Nn(q,ot,yt,ht){let at=q.opaque,Ht=q.transmissive,Xt=q.transparent;_.setupLightsView(yt),tt===!0&&Ot.setGlobalState(M.clippingPlanes,yt),Ht.length>0&&or(at,Ht,ot,yt),ht&&Wt.viewport(R.copy(ht)),at.length>0&&vn(at,ot,yt),Ht.length>0&&vn(Ht,ot,yt),Xt.length>0&&vn(Xt,ot,yt),Wt.buffers.depth.setTest(!0),Wt.buffers.depth.setMask(!0),Wt.buffers.color.setMask(!0),Wt.setPolygonOffset(!1)}function or(q,ot,yt,ht){if((yt.isScene===!0?yt.overrideMaterial:null)!==null)return;let Ht=ne.isWebGL2;Bt===null&&(Bt=new ss(1,1,{generateMipmaps:!0,type:zt.has("EXT_color_buffer_half_float")?wl:Ps,minFilter:ca,samples:Ht?4:0})),M.getDrawingBufferSize(Ut),Ht?Bt.setSize(Ut.x,Ut.y):Bt.setSize(Zd(Ut.x),Zd(Ut.y));let Xt=M.getRenderTarget();M.setRenderTarget(Bt),M.getClearColor(St),X=M.getClearAlpha(),X<1&&M.setClearColor(16777215,.5),M.clear();let re=M.toneMapping;M.toneMapping=Cs,vn(q,yt,ht),Lt.updateMultisampleRenderTarget(Bt),Lt.updateRenderTargetMipmap(Bt);let Zt=!1;for(let me=0,oe=ot.length;me<oe;me++){let ae=ot[me],sn=ae.object,gr=ae.geometry,Un=ae.material,Qr=ae.group;if(Un.side===ns&&sn.layers.test(ht.layers)){let Sn=Un.side;Un.side=xi,Un.needsUpdate=!0,le(sn,yt,ht,gr,Un,Qr),Un.side=Sn,Un.needsUpdate=!0,Zt=!0}}Zt===!0&&(Lt.updateMultisampleRenderTarget(Bt),Lt.updateRenderTargetMipmap(Bt)),M.setRenderTarget(Xt),M.setClearColor(St,X),M.toneMapping=re}function vn(q,ot,yt){let ht=ot.isScene===!0?ot.overrideMaterial:null;for(let at=0,Ht=q.length;at<Ht;at++){let Xt=q[at],re=Xt.object,Zt=Xt.geometry,me=ht===null?Xt.material:ht,oe=Xt.group;re.layers.test(yt.layers)&&le(re,ot,yt,Zt,me,oe)}}function le(q,ot,yt,ht,at,Ht){q.onBeforeRender(M,ot,yt,ht,at,Ht),q.modelViewMatrix.multiplyMatrices(yt.matrixWorldInverse,q.matrixWorld),q.normalMatrix.getNormalMatrix(q.modelViewMatrix),at.onBeforeRender(M,ot,yt,ht,q,Ht),at.transparent===!0&&at.side===ns&&at.forceSinglePass===!1?(at.side=xi,at.needsUpdate=!0,M.renderBufferDirect(yt,ot,ht,at,q,Ht),at.side=Is,at.needsUpdate=!0,M.renderBufferDirect(yt,ot,ht,at,q,Ht),at.side=ns):M.renderBufferDirect(yt,ot,ht,at,q,Ht),q.onAfterRender(M,ot,yt,ht,at,Ht)}function _n(q,ot,yt){ot.isScene!==!0&&(ot=At);let ht=ce.get(q),at=_.state.lights,Ht=_.state.shadowsArray,Xt=at.state.version,re=it.getParameters(q,at.state,Ht,ot,yt),Zt=it.getProgramCacheKey(re),me=ht.programs;ht.environment=q.isMeshStandardMaterial?ot.environment:null,ht.fog=ot.fog,ht.envMap=(q.isMeshStandardMaterial?Y:se).get(q.envMap||ht.environment),ht.envMapRotation=ht.environment!==null&&q.envMap===null?ot.environmentRotation:q.envMapRotation,me===void 0&&(q.addEventListener("dispose",$),me=new Map,ht.programs=me);let oe=me.get(Zt);if(oe!==void 0){if(ht.currentProgram===oe&&ht.lightsStateVersion===Xt)return Tn(q,re),oe}else re.uniforms=it.getUniforms(q),q.onBuild(yt,re,M),q.onBeforeCompile(re,M),oe=it.acquireProgram(re,Zt),me.set(Zt,oe),ht.uniforms=re.uniforms;let ae=ht.uniforms;return(!q.isShaderMaterial&&!q.isRawShaderMaterial||q.clipping===!0)&&(ae.clippingPlanes=Ot.uniform),Tn(q,re),ht.needsLights=mr(q),ht.lightsStateVersion=Xt,ht.needsLights&&(ae.ambientLightColor.value=at.state.ambient,ae.lightProbe.value=at.state.probe,ae.directionalLights.value=at.state.directional,ae.directionalLightShadows.value=at.state.directionalShadow,ae.spotLights.value=at.state.spot,ae.spotLightShadows.value=at.state.spotShadow,ae.rectAreaLights.value=at.state.rectArea,ae.ltc_1.value=at.state.rectAreaLTC1,ae.ltc_2.value=at.state.rectAreaLTC2,ae.pointLights.value=at.state.point,ae.pointLightShadows.value=at.state.pointShadow,ae.hemisphereLights.value=at.state.hemi,ae.directionalShadowMap.value=at.state.directionalShadowMap,ae.directionalShadowMatrix.value=at.state.directionalShadowMatrix,ae.spotShadowMap.value=at.state.spotShadowMap,ae.spotLightMatrix.value=at.state.spotLightMatrix,ae.spotLightMap.value=at.state.spotLightMap,ae.pointShadowMap.value=at.state.pointShadowMap,ae.pointShadowMatrix.value=at.state.pointShadowMatrix),ht.currentProgram=oe,ht.uniformsList=null,oe}function Pn(q){if(q.uniformsList===null){let ot=q.currentProgram.getUniforms();q.uniformsList=du.seqWithValue(ot.seq,q.uniforms)}return q.uniformsList}function Tn(q,ot){let yt=ce.get(q);yt.outputColorSpace=ot.outputColorSpace,yt.batching=ot.batching,yt.instancing=ot.instancing,yt.instancingColor=ot.instancingColor,yt.instancingMorph=ot.instancingMorph,yt.skinning=ot.skinning,yt.morphTargets=ot.morphTargets,yt.morphNormals=ot.morphNormals,yt.morphColors=ot.morphColors,yt.morphTargetsCount=ot.morphTargetsCount,yt.numClippingPlanes=ot.numClippingPlanes,yt.numIntersection=ot.numClipIntersection,yt.vertexAlphas=ot.vertexAlphas,yt.vertexTangents=ot.vertexTangents,yt.toneMapping=ot.toneMapping}function xn(q,ot,yt,ht,at){ot.isScene!==!0&&(ot=At),Lt.resetTextureUnits();let Ht=ot.fog,Xt=ht.isMeshStandardMaterial?ot.environment:null,re=F===null?M.outputColorSpace:F.isXRRenderTarget===!0?F.texture.colorSpace:Ns,Zt=(ht.isMeshStandardMaterial?Y:se).get(ht.envMap||Xt),me=ht.vertexColors===!0&&!!yt.attributes.color&&yt.attributes.color.itemSize===4,oe=!!yt.attributes.tangent&&(!!ht.normalMap||ht.anisotropy>0),ae=!!yt.morphAttributes.position,sn=!!yt.morphAttributes.normal,gr=!!yt.morphAttributes.color,Un=Cs;ht.toneMapped&&(F===null||F.isXRRenderTarget===!0)&&(Un=M.toneMapping);let Qr=yt.morphAttributes.position||yt.morphAttributes.normal||yt.morphAttributes.color,Sn=Qr!==void 0?Qr.length:0,jt=ce.get(ht),Aa=_.state.lights;if(tt===!0&&(wt===!0||q!==ut)){let ti=q===ut&&ht.id===I;Ot.setState(ht,q,ti)}let an=!1;ht.version===jt.__version?(jt.needsLights&&jt.lightsStateVersion!==Aa.state.version||jt.outputColorSpace!==re||at.isBatchedMesh&&jt.batching===!1||!at.isBatchedMesh&&jt.batching===!0||at.isInstancedMesh&&jt.instancing===!1||!at.isInstancedMesh&&jt.instancing===!0||at.isSkinnedMesh&&jt.skinning===!1||!at.isSkinnedMesh&&jt.skinning===!0||at.isInstancedMesh&&jt.instancingColor===!0&&at.instanceColor===null||at.isInstancedMesh&&jt.instancingColor===!1&&at.instanceColor!==null||at.isInstancedMesh&&jt.instancingMorph===!0&&at.morphTexture===null||at.isInstancedMesh&&jt.instancingMorph===!1&&at.morphTexture!==null||jt.envMap!==Zt||ht.fog===!0&&jt.fog!==Ht||jt.numClippingPlanes!==void 0&&(jt.numClippingPlanes!==Ot.numPlanes||jt.numIntersection!==Ot.numIntersection)||jt.vertexAlphas!==me||jt.vertexTangents!==oe||jt.morphTargets!==ae||jt.morphNormals!==sn||jt.morphColors!==gr||jt.toneMapping!==Un||ne.isWebGL2===!0&&jt.morphTargetsCount!==Sn)&&(an=!0):(an=!0,jt.__version=ht.version);let Wi=jt.currentProgram;an===!0&&(Wi=_n(ht,ot,at));let Xu=!1,ge=!1,qs=!1,Mn=Wi.getUniforms(),Xi=jt.uniforms;if(Wt.useProgram(Wi.program)&&(Xu=!0,ge=!0,qs=!0),ht.id!==I&&(I=ht.id,ge=!0),Xu||ut!==q){Mn.setValue(nt,"projectionMatrix",q.projectionMatrix),Mn.setValue(nt,"viewMatrix",q.matrixWorldInverse);let ti=Mn.map.cameraPosition;ti!==void 0&&ti.setValue(nt,Dt.setFromMatrixPosition(q.matrixWorld)),ne.logarithmicDepthBuffer&&Mn.setValue(nt,"logDepthBufFC",2/(Math.log(q.far+1)/Math.LN2)),(ht.isMeshPhongMaterial||ht.isMeshToonMaterial||ht.isMeshLambertMaterial||ht.isMeshBasicMaterial||ht.isMeshStandardMaterial||ht.isShaderMaterial)&&Mn.setValue(nt,"isOrthographic",q.isOrthographicCamera===!0),ut!==q&&(ut=q,ge=!0,qs=!0)}if(at.isSkinnedMesh){Mn.setOptional(nt,at,"bindMatrix"),Mn.setOptional(nt,at,"bindMatrixInverse");let ti=at.skeleton;ti&&(ne.floatVertexTextures?(ti.boneTexture===null&&ti.computeBoneTexture(),Mn.setValue(nt,"boneTexture",ti.boneTexture,Lt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}at.isBatchedMesh&&(Mn.setOptional(nt,at,"batchingTexture"),Mn.setValue(nt,"batchingTexture",at._matricesTexture,Lt));let pe=yt.morphAttributes;if((pe.position!==void 0||pe.normal!==void 0||pe.color!==void 0&&ne.isWebGL2===!0)&&w.update(at,yt,Wi),(ge||jt.receiveShadow!==at.receiveShadow)&&(jt.receiveShadow=at.receiveShadow,Mn.setValue(nt,"receiveShadow",at.receiveShadow)),ht.isMeshGouraudMaterial&&ht.envMap!==null&&(Xi.envMap.value=Zt,Xi.flipEnvMap.value=Zt.isCubeTexture&&Zt.isRenderTargetTexture===!1?-1:1),ge&&(Mn.setValue(nt,"toneMappingExposure",M.toneMappingExposure),jt.needsLights&&Vr(Xi,qs),Ht&&ht.fog===!0&&Pt.refreshFogUniforms(Xi,Ht),Pt.refreshMaterialUniforms(Xi,ht,vt,dt,Bt),du.upload(nt,Pn(jt),Xi,Lt)),ht.isShaderMaterial&&ht.uniformsNeedUpdate===!0&&(du.upload(nt,Pn(jt),Xi,Lt),ht.uniformsNeedUpdate=!1),ht.isSpriteMaterial&&Mn.setValue(nt,"center",at.center),Mn.setValue(nt,"modelViewMatrix",at.modelViewMatrix),Mn.setValue(nt,"normalMatrix",at.normalMatrix),Mn.setValue(nt,"modelMatrix",at.matrixWorld),ht.isShaderMaterial||ht.isRawShaderMaterial){let ti=ht.uniformsGroups;for(let Yu=0,Ca=ti.length;Yu<Ca;Yu++)if(ne.isWebGL2){let ei=ti[Yu];et.update(ei,Wi),et.bind(ei,Wi)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Wi}function Vr(q,ot){q.ambientLightColor.needsUpdate=ot,q.lightProbe.needsUpdate=ot,q.directionalLights.needsUpdate=ot,q.directionalLightShadows.needsUpdate=ot,q.pointLights.needsUpdate=ot,q.pointLightShadows.needsUpdate=ot,q.spotLights.needsUpdate=ot,q.spotLightShadows.needsUpdate=ot,q.rectAreaLights.needsUpdate=ot,q.hemisphereLights.needsUpdate=ot}function mr(q){return q.isMeshLambertMaterial||q.isMeshToonMaterial||q.isMeshPhongMaterial||q.isMeshStandardMaterial||q.isShadowMaterial||q.isShaderMaterial&&q.lights===!0}this.getActiveCubeFace=function(){return G},this.getActiveMipmapLevel=function(){return z},this.getRenderTarget=function(){return F},this.setRenderTargetTextures=function(q,ot,yt){ce.get(q.texture).__webglTexture=ot,ce.get(q.depthTexture).__webglTexture=yt;let ht=ce.get(q);ht.__hasExternalTextures=!0,ht.__autoAllocateDepthBuffer=yt===void 0,ht.__autoAllocateDepthBuffer||zt.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ht.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(q,ot){let yt=ce.get(q);yt.__webglFramebuffer=ot,yt.__useDefaultFramebuffer=ot===void 0},this.setRenderTarget=function(q,ot=0,yt=0){F=q,G=ot,z=yt;let ht=!0,at=null,Ht=!1,Xt=!1;if(q){let Zt=ce.get(q);Zt.__useDefaultFramebuffer!==void 0?(Wt.bindFramebuffer(nt.FRAMEBUFFER,null),ht=!1):Zt.__webglFramebuffer===void 0?Lt.setupRenderTarget(q):Zt.__hasExternalTextures&&Lt.rebindTextures(q,ce.get(q.texture).__webglTexture,ce.get(q.depthTexture).__webglTexture);let me=q.texture;(me.isData3DTexture||me.isDataArrayTexture||me.isCompressedArrayTexture)&&(Xt=!0);let oe=ce.get(q).__webglFramebuffer;q.isWebGLCubeRenderTarget?(Array.isArray(oe[ot])?at=oe[ot][yt]:at=oe[ot],Ht=!0):ne.isWebGL2&&q.samples>0&&Lt.useMultisampledRTT(q)===!1?at=ce.get(q).__webglMultisampledFramebuffer:Array.isArray(oe)?at=oe[yt]:at=oe,R.copy(q.viewport),W.copy(q.scissor),V=q.scissorTest}else R.copy(H).multiplyScalar(vt).floor(),W.copy(bt).multiplyScalar(vt).floor(),V=Tt;if(Wt.bindFramebuffer(nt.FRAMEBUFFER,at)&&ne.drawBuffers&&ht&&Wt.drawBuffers(q,at),Wt.viewport(R),Wt.scissor(W),Wt.setScissorTest(V),Ht){let Zt=ce.get(q.texture);nt.framebufferTexture2D(nt.FRAMEBUFFER,nt.COLOR_ATTACHMENT0,nt.TEXTURE_CUBE_MAP_POSITIVE_X+ot,Zt.__webglTexture,yt)}else if(Xt){let Zt=ce.get(q.texture),me=ot||0;nt.framebufferTextureLayer(nt.FRAMEBUFFER,nt.COLOR_ATTACHMENT0,Zt.__webglTexture,yt||0,me)}I=-1},this.readRenderTargetPixels=function(q,ot,yt,ht,at,Ht,Xt){if(!(q&&q.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let re=ce.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&Xt!==void 0&&(re=re[Xt]),re){Wt.bindFramebuffer(nt.FRAMEBUFFER,re);try{let Zt=q.texture,me=Zt.format,oe=Zt.type;if(me!==co&&k.convert(me)!==nt.getParameter(nt.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let ae=oe===wl&&(zt.has("EXT_color_buffer_half_float")||ne.isWebGL2&&zt.has("EXT_color_buffer_float"));if(oe!==Ps&&k.convert(oe)!==nt.getParameter(nt.IMPLEMENTATION_COLOR_READ_TYPE)&&!(oe===rs&&(ne.isWebGL2||zt.has("OES_texture_float")||zt.has("WEBGL_color_buffer_float")))&&!ae){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ot>=0&&ot<=q.width-ht&&yt>=0&&yt<=q.height-at&&nt.readPixels(ot,yt,ht,at,k.convert(me),k.convert(oe),Ht)}finally{let Zt=F!==null?ce.get(F).__webglFramebuffer:null;Wt.bindFramebuffer(nt.FRAMEBUFFER,Zt)}}},this.copyFramebufferToTexture=function(q,ot,yt=0){let ht=Math.pow(2,-yt),at=Math.floor(ot.image.width*ht),Ht=Math.floor(ot.image.height*ht);Lt.setTexture2D(ot,0),nt.copyTexSubImage2D(nt.TEXTURE_2D,yt,0,0,q.x,q.y,at,Ht),Wt.unbindTexture()},this.copyTextureToTexture=function(q,ot,yt,ht=0){let at=ot.image.width,Ht=ot.image.height,Xt=k.convert(yt.format),re=k.convert(yt.type);Lt.setTexture2D(yt,0),nt.pixelStorei(nt.UNPACK_FLIP_Y_WEBGL,yt.flipY),nt.pixelStorei(nt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,yt.premultiplyAlpha),nt.pixelStorei(nt.UNPACK_ALIGNMENT,yt.unpackAlignment),ot.isDataTexture?nt.texSubImage2D(nt.TEXTURE_2D,ht,q.x,q.y,at,Ht,Xt,re,ot.image.data):ot.isCompressedTexture?nt.compressedTexSubImage2D(nt.TEXTURE_2D,ht,q.x,q.y,ot.mipmaps[0].width,ot.mipmaps[0].height,Xt,ot.mipmaps[0].data):nt.texSubImage2D(nt.TEXTURE_2D,ht,q.x,q.y,Xt,re,ot.image),ht===0&&yt.generateMipmaps&&nt.generateMipmap(nt.TEXTURE_2D),Wt.unbindTexture()},this.copyTextureToTexture3D=function(q,ot,yt,ht,at=0){if(M.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Ht=Math.round(q.max.x-q.min.x),Xt=Math.round(q.max.y-q.min.y),re=q.max.z-q.min.z+1,Zt=k.convert(ht.format),me=k.convert(ht.type),oe;if(ht.isData3DTexture)Lt.setTexture3D(ht,0),oe=nt.TEXTURE_3D;else if(ht.isDataArrayTexture||ht.isCompressedArrayTexture)Lt.setTexture2DArray(ht,0),oe=nt.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}nt.pixelStorei(nt.UNPACK_FLIP_Y_WEBGL,ht.flipY),nt.pixelStorei(nt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ht.premultiplyAlpha),nt.pixelStorei(nt.UNPACK_ALIGNMENT,ht.unpackAlignment);let ae=nt.getParameter(nt.UNPACK_ROW_LENGTH),sn=nt.getParameter(nt.UNPACK_IMAGE_HEIGHT),gr=nt.getParameter(nt.UNPACK_SKIP_PIXELS),Un=nt.getParameter(nt.UNPACK_SKIP_ROWS),Qr=nt.getParameter(nt.UNPACK_SKIP_IMAGES),Sn=yt.isCompressedTexture?yt.mipmaps[at]:yt.image;nt.pixelStorei(nt.UNPACK_ROW_LENGTH,Sn.width),nt.pixelStorei(nt.UNPACK_IMAGE_HEIGHT,Sn.height),nt.pixelStorei(nt.UNPACK_SKIP_PIXELS,q.min.x),nt.pixelStorei(nt.UNPACK_SKIP_ROWS,q.min.y),nt.pixelStorei(nt.UNPACK_SKIP_IMAGES,q.min.z),yt.isDataTexture||yt.isData3DTexture?nt.texSubImage3D(oe,at,ot.x,ot.y,ot.z,Ht,Xt,re,Zt,me,Sn.data):ht.isCompressedArrayTexture?nt.compressedTexSubImage3D(oe,at,ot.x,ot.y,ot.z,Ht,Xt,re,Zt,Sn.data):nt.texSubImage3D(oe,at,ot.x,ot.y,ot.z,Ht,Xt,re,Zt,me,Sn),nt.pixelStorei(nt.UNPACK_ROW_LENGTH,ae),nt.pixelStorei(nt.UNPACK_IMAGE_HEIGHT,sn),nt.pixelStorei(nt.UNPACK_SKIP_PIXELS,gr),nt.pixelStorei(nt.UNPACK_SKIP_ROWS,Un),nt.pixelStorei(nt.UNPACK_SKIP_IMAGES,Qr),at===0&&ht.generateMipmaps&&nt.generateMipmap(oe),Wt.unbindTexture()},this.initTexture=function(q){q.isCubeTexture?Lt.setTextureCube(q,0):q.isData3DTexture?Lt.setTexture3D(q,0):q.isDataArrayTexture||q.isCompressedArrayTexture?Lt.setTexture2DArray(q,0):Lt.setTexture2D(q,0),Wt.unbindTexture()},this.resetState=function(){G=0,z=0,F=null,Wt.reset(),B.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return is}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Am?"display-p3":"srgb",e.unpackColorSpace=An.workingColorSpace===Nf?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}},dm=class extends pm{};dm.prototype.isWebGL1Renderer=!0;function cf(r,t,e){return!r||!e&&r.constructor===t?r:typeof t.BYTES_PER_ELEMENT=="number"?new t(r):Array.prototype.slice.call(r)}function EF(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}var xu=class{constructor(t,e,o,a){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=a!==void 0?a:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,a=e[o],l=e[o-1];n:{t:{let h;e:{r:if(!(t<a)){for(let f=o+2;;){if(a===void 0){if(t<l)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===f)break;if(l=a,a=e[++o],t<a)break t}h=e.length;break e}if(!(t>=l)){let f=e[1];t<f&&(o=2,l=f);for(let p=o-2;;){if(l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===p)break;if(a=l,l=e[--o-1],t>=l)break t}h=o,o=0;break e}break n}for(;o<h;){let f=o+h>>>1;t<e[f]?h=f:o=f+1}if(a=e[o],l=e[o-1],l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(a===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,l,a)}return this.interpolate_(o,l,t,a)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=t*a;for(let h=0;h!==a;++h)e[h]=o[l+h];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},mm=class extends xu{constructor(t,e,o,a){super(t,e,o,a),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:I1,endingEnd:I1}}intervalChanged_(t,e,o){let a=this.parameterPositions,l=t-2,h=t+1,f=a[l],p=a[h];if(f===void 0)switch(this.getSettings_().endingStart){case R1:l=t,f=2*e-o;break;case L1:l=a.length-2,f=e+a[l]-a[l+1];break;default:l=t,f=o}if(p===void 0)switch(this.getSettings_().endingEnd){case R1:h=t,p=2*o-e;break;case L1:h=1,p=o+a[1]-a[0];break;default:h=t-1,p=e}let d=(o-e)*.5,g=this.valueSize;this._weightPrev=d/(e-f),this._weightNext=d/(p-o),this._offsetPrev=l*g,this._offsetNext=h*g}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=this._offsetPrev,x=this._offsetNext,v=this._weightPrev,S=this._weightNext,b=(o-e)/(a-e),T=b*b,_=T*b,y=-v*_+2*v*T-v*b,A=(1+v)*_+(-1.5-2*v)*T+(-.5+v)*b+1,M=(-1-S)*_+(1.5+S)*T+.5*b,L=S*_-S*T;for(let G=0;G!==f;++G)l[G]=y*h[g+G]+A*h[d+G]+M*h[p+G]+L*h[x+G];return l}},gm=class extends xu{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=(o-e)/(a-e),x=1-g;for(let v=0;v!==f;++v)l[v]=h[d+v]*x+h[p+v]*g;return l}},ym=class extends xu{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t){return this.copySampleValue_(t-1)}},ho=class{constructor(t,e,o,a){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=cf(e,this.TimeBufferType),this.values=cf(o,this.ValueBufferType),this.setInterpolation(a||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,o;if(e.toJSON!==this.toJSON)o=e.toJSON(t);else{o={name:t.name,times:cf(t.times,Array),values:cf(t.values,Array)};let a=t.getInterpolation();a!==t.DefaultInterpolation&&(o.interpolation=a)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new ym(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new gm(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new mm(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case hf:e=this.InterpolantFactoryMethodDiscrete;break;case pf:e=this.InterpolantFactoryMethodLinear;break;case dd:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let o="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(o);return console.warn("THREE.KeyframeTrack:",o),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return hf;case this.InterpolantFactoryMethodLinear:return pf;case this.InterpolantFactoryMethodSmooth:return dd}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]*=t}return this}trim(t,e){let o=this.times,a=o.length,l=0,h=a-1;for(;l!==a&&o[l]<t;)++l;for(;h!==-1&&o[h]>e;)--h;if(++h,l!==0||h!==a){l>=h&&(h=Math.max(h,1),l=h-1);let f=this.getValueSize();this.times=o.slice(l,h),this.values=this.values.slice(l*f,h*f)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let o=this.times,a=this.values,l=o.length;l===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let h=null;for(let f=0;f!==l;f++){let p=o[f];if(typeof p=="number"&&isNaN(p)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,p),t=!1;break}if(h!==null&&h>p){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,p,h),t=!1;break}h=p}if(a!==void 0&&EF(a))for(let f=0,p=a.length;f!==p;++f){let d=a[f];if(isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,f,d),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),a=this.getInterpolation()===dd,l=t.length-1,h=1;for(let f=1;f<l;++f){let p=!1,d=t[f],g=t[f+1];if(d!==g&&(f!==1||d!==t[0]))if(a)p=!0;else{let x=f*o,v=x-o,S=x+o;for(let b=0;b!==o;++b){let T=e[x+b];if(T!==e[v+b]||T!==e[S+b]){p=!0;break}}}if(p){if(f!==h){t[h]=t[f];let x=f*o,v=h*o;for(let S=0;S!==o;++S)e[v+S]=e[x+S]}++h}}if(l>0){t[h]=t[l];for(let f=l*o,p=h*o,d=0;d!==o;++d)e[p+d]=e[f+d];++h}return h!==t.length?(this.times=t.slice(0,h),this.values=e.slice(0,h*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,a=new o(this.name,t,e);return a.createInterpolant=this.createInterpolant,a}};ho.prototype.TimeBufferType=Float32Array;ho.prototype.ValueBufferType=Float32Array;ho.prototype.DefaultInterpolation=pf;var ga=class extends ho{};ga.prototype.ValueTypeName="bool";ga.prototype.ValueBufferType=Array;ga.prototype.DefaultInterpolation=hf;ga.prototype.InterpolantFactoryMethodLinear=void 0;ga.prototype.InterpolantFactoryMethodSmooth=void 0;var vm=class extends ho{};vm.prototype.ValueTypeName="color";var _m=class extends ho{};_m.prototype.ValueTypeName="number";var xm=class extends xu{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=(o-e)/(a-e),d=t*f;for(let g=d+f;d!==g;d+=4)Ls.slerpFlat(l,0,h,d-f,h,d,p);return l}},Al=class extends ho{InterpolantFactoryMethodLinear(t){return new xm(this.times,this.values,this.getValueSize(),t)}};Al.prototype.ValueTypeName="quaternion";Al.prototype.DefaultInterpolation=pf;Al.prototype.InterpolantFactoryMethodSmooth=void 0;var ya=class extends ho{};ya.prototype.ValueTypeName="string";ya.prototype.ValueBufferType=Array;ya.prototype.DefaultInterpolation=hf;ya.prototype.InterpolantFactoryMethodLinear=void 0;ya.prototype.InterpolantFactoryMethodSmooth=void 0;var Em=class extends ho{};Em.prototype.ValueTypeName="vector";var Sm=class{constructor(t,e,o){let a=this,l=!1,h=0,f=0,p,d=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(g){f++,l===!1&&a.onStart!==void 0&&a.onStart(g,h,f),l=!0},this.itemEnd=function(g){h++,a.onProgress!==void 0&&a.onProgress(g,h,f),h===f&&(l=!1,a.onLoad!==void 0&&a.onLoad())},this.itemError=function(g){a.onError!==void 0&&a.onError(g)},this.resolveURL=function(g){return p?p(g):g},this.setURLModifier=function(g){return p=g,this},this.addHandler=function(g,x){return d.push(g,x),this},this.removeHandler=function(g){let x=d.indexOf(g);return x!==-1&&d.splice(x,2),this},this.getHandler=function(g){for(let x=0,v=d.length;x<v;x+=2){let S=d[x],b=d[x+1];if(S.global&&(S.lastIndex=0),S.test(g))return b}return null}}},SF=new Sm,Mm=class{constructor(t){this.manager=t!==void 0?t:SF,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(a,l){o.load(t,a,e,l)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};Mm.DEFAULT_MATERIAL_NAME="__DEFAULT";var Pm="\\\\[\\\\]\\\\.:\\\\/",MF=new RegExp("["+Pm+"]","g"),Im="[^"+Pm+"]",wF="[^"+Pm.replace("\\\\.","")+"]",bF=/((?:WC+[\\/:])*)/.source.replace("WC",Im),TF=/(WCOD+)?/.source.replace("WCOD",wF),AF=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Im),CF=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Im),PF=new RegExp("^"+bF+TF+AF+CF+"$"),IF=["material","materials","bones","map"],wm=class{constructor(t,e,o){let a=o||qn.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,a)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,a=this._bindings[o];a!==void 0&&a.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let a=this._targetGroup.nCachedObjects_,l=o.length;a!==l;++a)o[a].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].unbind()}},qn=class r{constructor(t,e,o){this.path=e,this.parsedPath=o||r.parseTrackName(e),this.node=r.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,o){return t&&t.isAnimationObjectGroup?new r.Composite(t,e,o):new r(t,e,o)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(MF,"")}static parseTrackName(t){let e=PF.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let o={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},a=o.nodeName&&o.nodeName.lastIndexOf(".");if(a!==void 0&&a!==-1){let l=o.nodeName.substring(a+1);IF.indexOf(l)!==-1&&(o.nodeName=o.nodeName.substring(0,a),o.objectName=l)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return o}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let o=t.skeleton.getBoneByName(e);if(o!==void 0)return o}if(t.children){let o=function(l){for(let h=0;h<l.length;h++){let f=l[h];if(f.name===e||f.uuid===e)return f;let p=o(f.children);if(p)return p}return null},a=o(t.children);if(a)return a}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)t[e++]=o[a]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,o=e.objectName,a=e.propertyName,l=e.propertyIndex;if(t||(t=r.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(o){let d=e.objectIndex;switch(o){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let g=0;g<t.length;g++)if(t[g].name===d){d=g;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[o]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[o]}if(d!==void 0){if(t[d]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[d]}}let h=t[a];if(h===void 0){let d=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+d+"."+a+" but it wasn't found.",t);return}let f=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?f=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(f=this.Versioning.MatrixWorldNeedsUpdate);let p=this.BindingType.Direct;if(l!==void 0){if(a==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[l]!==void 0&&(l=t.morphTargetDictionary[l])}p=this.BindingType.ArrayElement,this.resolvedProperty=h,this.propertyIndex=l}else h.fromArray!==void 0&&h.toArray!==void 0?(p=this.BindingType.HasFromToArray,this.resolvedProperty=h):Array.isArray(h)?(p=this.BindingType.EntireArray,this.resolvedProperty=h):this.propertyName=a;this.getValue=this.GetterByBindingType[p],this.setValue=this.SetterByBindingTypeAndVersioning[p][f]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};qn.Composite=wm;qn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};qn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};qn.prototype.GetterByBindingType=[qn.prototype._getValue_direct,qn.prototype._getValue_array,qn.prototype._getValue_arrayElement,qn.prototype._getValue_toArray];qn.prototype.SetterByBindingTypeAndVersioning=[[qn.prototype._setValue_direct,qn.prototype._setValue_direct_setNeedsUpdate,qn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[qn.prototype._setValue_array,qn.prototype._setValue_array_setNeedsUpdate,qn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[qn.prototype._setValue_arrayElement,qn.prototype._setValue_arrayElement_setNeedsUpdate,qn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[qn.prototype._setValue_fromArray,qn.prototype._setValue_fromArray_setNeedsUpdate,qn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Yq=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:bm}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=bm);var Ar=63710088e-1,Jq={centimeters:Ar*100,centimetres:Ar*100,degrees:Ar/111325,feet:Ar*3.28084,inches:Ar*39.37,kilometers:Ar/1e3,kilometres:Ar/1e3,meters:Ar,metres:Ar,miles:Ar/1609.344,millimeters:Ar*1e3,millimetres:Ar*1e3,nauticalmiles:Ar/1852,radians:1,yards:Ar*1.0936},Kq={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Ar,yards:1.0936133};function fi(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}function Ln(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Co(r[0])||!Co(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return fi(o,t,e)}function Vn(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<l[l.length-1].length;h++)if(l[l.length-1][h]!==l[0][h])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:r};return fi(f,t,e)}function Cr(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return fi(o,t,e)}function Rm(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return fi(o,t,e)}function Co(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function fr(r,t,e){if(r!==null)for(var o,a,l,h,f,p,d,g=0,x=0,v,S=r.type,b=S==="FeatureCollection",T=S==="Feature",_=b?r.features.length:1,y=0;y<_;y++){d=b?r.features[y].geometry:T?r.geometry:r,v=d?d.type==="GeometryCollection":!1,f=v?d.geometries.length:1;for(var A=0;A<f;A++){var M=0,L=0;if(h=v?d.geometries[A]:d,h!==null){p=h.coordinates;var G=h.type;switch(g=e&&(G==="Polygon"||G==="MultiPolygon")?1:0,G){case null:break;case"Point":if(t(p,x,y,M,L)===!1)return!1;x++,M++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],x,y,M,L)===!1)return!1;x++,G==="MultiPoint"&&M++}G==="LineString"&&M++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],x,y,M,L)===!1)return!1;x++}G==="MultiLineString"&&M++,G==="Polygon"&&L++}G==="Polygon"&&M++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(L=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],x,y,M,L)===!1)return!1;x++}L++}M++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(fr(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function qE(r,t,e,o){var a=e;return fr(r,function(l,h,f,p,d){h===0&&e===void 0?a=l:a=t(a,l,h,f,p,d)},o),a}function Os(r,t){var e,o,a,l,h,f,p,d,g,x,v=0,S=r.type==="FeatureCollection",b=r.type==="Feature",T=S?r.features.length:1;for(e=0;e<T;e++){for(f=S?r.features[e].geometry:b?r.geometry:r,d=S?r.features[e].properties:b?r.properties:{},g=S?r.features[e].bbox:b?r.bbox:void 0,x=S?r.features[e].id:b?r.id:void 0,p=f?f.type==="GeometryCollection":!1,h=p?f.geometries.length:1,a=0;a<h;a++){if(l=p?f.geometries[a]:f,l===null){if(t(null,v,d,g,x)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,v,d,g,x)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],v,d,g,x)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function Li(r,t){Os(r,function(e,o,a,l,h){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(fi(e,a,{bbox:l,id:h}),o,0)===!1?!1:void 0}var p;switch(f){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],x={type:p,coordinates:g};if(t(fi(x,a),o,d)===!1)return!1}})}function Lm(r){var t=[1/0,1/0,-1/0,-1/0];return fr(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Lm.default=Lm;var hi=Lm;function zr(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Nm(r,t,e){if(!r)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!r.geometry||r.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+r.geometry.type)}function Gr(r){return r.type==="Feature"?r.geometry:r}var BF=yn(Df(),1);var $F=yn(sS(),1);function Pr(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=zr(r),a=Gr(t),l=a.type,h=t.bbox,f=a.coordinates;if(h&&ZF(o,h)===!1)return!1;l==="Polygon"&&(f=[f]);for(var p=!1,d=0;d<f.length&&!p;d++)if(aS(o,f[d][0],e.ignoreBoundary)){for(var g=!1,x=1;x<f[d].length&&!g;)aS(o,f[d][x],!e.ignoreBoundary)&&(g=!0),x++;g||(p=!0)}return p}function aS(r,t,e){var o=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var a=0,l=t.length-1;a<t.length;l=a++){var h=t[a][0],f=t[a][1],p=t[l][0],d=t[l][1],g=r[1]*(h-p)+f*(p-r[0])+d*(r[0]-h)===0&&(h-r[0])*(p-r[0])<=0&&(f-r[1])*(d-r[1])<=0;if(g)return!e;var x=f>r[1]!=d>r[1]&&r[0]<(p-h)*(r[1]-f)/(d-f)+h;x&&(o=!o)}return o}function ZF(r,t){return t[0]<=r[0]&&t[1]<=r[1]&&t[2]>=r[0]&&t[3]>=r[1]}var cS=new ArrayBuffer(16),TH=new Float64Array(cS),AH=new Uint32Array(cS);var cU=yn(Zm(),1);var Q6=function(){function r(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(var e=0;e<this.length-1;e++){var o=this.points[e],a=this.points[e+1];this.centers.push({x:(o.x+a.x)/2,y:(o.y+a.y)/2,z:(o.z+a.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var l=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,h=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,f=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+f)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+f)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return r.prototype.cacheSteps=function(t){var e=[],o=this.pos(0);e.push(0);for(var a=0;a<this.duration;a+=10){var l=this.pos(a),h=Math.sqrt((l.x-o.x)*(l.x-o.x)+(l.y-o.y)*(l.y-o.y)+(l.z-o.z)*(l.z-o.z));h>t&&(e.push(a),o=l)}return e},r.prototype.vector=function(t){var e=this.pos(t+10),o=this.pos(t-10);return{angle:180*Math.atan2(e.y-o.y,e.x-o.x)/3.14,speed:Math.sqrt((o.x-e.x)*(o.x-e.x)+(o.y-e.y)*(o.y-e.y)+(o.z-e.z)*(o.z-e.z))}},r.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var o=e/this.duration;if(o>=1)return this.points[this.length-1];var a=Math.floor((this.points.length-1)*o),l=(this.length-1)*o-a;return fU(l,this.points[a],this.controls[a][1],this.controls[a+1][0],this.points[a+1])},r}();function fU(r,t,e,o,a){var l=hU(r),h={x:a.x*l[0]+o.x*l[1]+e.x*l[2]+t.x*l[3],y:a.y*l[0]+o.y*l[1]+e.y*l[2]+t.y*l[3],z:a.z*l[0]+o.z*l[1]+e.z*l[2]+t.z*l[3]};return h}function hU(r){var t=r*r,e=t*r;return[e,3*t*(1-r),3*r*(1-r)*(1-r),(1-r)*(1-r)*(1-r)]}function Ll(r,t){t===void 0&&(t={});var e=Number(r[0]),o=Number(r[1]),a=Number(r[2]),l=Number(r[3]);if(r.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var h=[e,o],f=[e,l],p=[a,l],d=[a,o];return Vn([[h,d,p,f,h]],t.properties,{bbox:r,id:t.id})}function pU(r){return Ll(hi(r))}var Jm=pU;var IU=yn(ES(),1);var rB=yn(jf(),1);var oB=yn(Df(),1);var uB=yn(Zm(),1);var zS=Math.PI/180,GS=180/Math.PI,zl=function(r,t){this.lon=r,this.lat=t,this.x=zS*r,this.y=zS*t};zl.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};zl.prototype.antipode=function(){var r=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new zl(t,r)};var kS=function(){this.coords=[],this.length=0};kS.prototype.move_to=function(r){this.length++,this.coords.push(r)};var gg=function(r){this.properties=r||{},this.geometries=[]};gg.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var r=[],t=0;t<this.geometries.length;t++)r.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:r},type:"Feature",properties:this.properties}};gg.prototype.wkt=function(){for(var r="",t="LINESTRING(",e=function(l){t+=l[0]+" "+l[1]+","},o=0;o<this.geometries.length;o++){if(this.geometries[o].coords.length===0)return"LINESTRING(empty)";var a=this.geometries[o].coords;a.forEach(e),r+=t.substring(0,t.length-1)+")"}return r};var qS=function(r,t,e){if(!r||r.x===void 0||r.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new zl(r.x,r.y),this.end=new zl(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,a=this.start.y-this.end.y,l=Math.pow(Math.sin(a/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(o/2),2);if(this.g=2*Math.asin(Math.sqrt(l)),this.g===Math.PI)throw new Error("it appears "+r.view()+" and "+t.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+r+" and "+t)};qS.prototype.interpolate=function(r){var t=Math.sin((1-r)*this.g)/Math.sin(this.g),e=Math.sin(r*this.g)/Math.sin(this.g),o=t*Math.cos(this.start.y)*Math.cos(this.start.x)+e*Math.cos(this.end.y)*Math.cos(this.end.x),a=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),l=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),h=GS*Math.atan2(l,Math.sqrt(Math.pow(o,2)+Math.pow(a,2))),f=GS*Math.atan2(a,o);return[f,h]};qS.prototype.Arc=function(r,t){var e=[];if(!r||r<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var o=1/(r-1),a=0;a<r;++a){var l=o*a,h=this.interpolate(l);e.push(h)}for(var f=!1,p=0,d=t&&t.offset?t.offset:10,g=180-d,x=-180+d,v=360-d,S=1;S<e.length;++S){var b=e[S-1][0],T=e[S][0],_=Math.abs(T-b);_>v&&(T>g&&b<x||b>g&&T<x)?f=!0:_>p&&(p=_)}var y=[];if(f&&p<d){var A=[];y.push(A);for(var M=0;M<e.length;++M){var L=parseFloat(e[M][0]);if(M>0&&Math.abs(L-e[M-1][0])>v){var G=parseFloat(e[M-1][0]),z=parseFloat(e[M-1][1]),F=parseFloat(e[M][0]),I=parseFloat(e[M][1]);if(G>-180&&G<x&&F===180&&M+1<e.length&&e[M-1][0]>-180&&e[M-1][0]<x){A.push([-180,e[M][1]]),M++,A.push([e[M][0],e[M][1]]);continue}else if(G>g&&G<180&&F===-180&&M+1<e.length&&e[M-1][0]>g&&e[M-1][0]<180){A.push([180,e[M][1]]),M++,A.push([e[M][0],e[M][1]]);continue}if(G<x&&F>g){var ut=G;G=F,F=ut;var R=z;z=I,I=R}if(G>g&&F<x&&(F+=360),G<=180&&F>=180&&G<F){var W=(180-G)/(F-G),V=W*I+(1-W)*z;A.push([e[M-1][0]>g?180:-180,V]),A=[],A.push([e[M-1][0]>g?-180:180,V]),y.push(A)}else A=[],y.push(A);A.push([L,e[M][1]])}else A.push([e[M][0],e[M][1]])}}else{var St=[];y.push(St);for(var X=0;X<e.length;++X)St.push([e[X][0],e[X][1]])}for(var mt=new gg(this.properties),dt=0;dt<y.length;++dt){var vt=new kS;mt.geometries.push(vt);for(var rt=y[dt],lt=0;lt<rt.length;++lt)vt.move_to(rt[lt])}return mt};var fB=yn(jf(),1);var Hz=yn(jf(),1);var Wz=yn(Bg(),1);var $z=yn(Df(),1);var we=[],be=[],Te=[],Ae=[],Ce=[],Pe=[],Ie=[],Re=[],Le=[],Ne=[],Oe=[],De=[],Fe=[],Ue=[],Be=[],ze=[],Ge=[],ke=[],qe=[],Ve=[],He=[],We=[],Xe=[],Ye=[];Ie[85]=Ne[85]=-1;Re[85]=Oe[85]=0;Le[85]=De[85]=1;qe[85]=We[85]=1;Ve[85]=Xe[85]=0;He[85]=Ye[85]=1;we[85]=Ae[85]=0;be[85]=Ce[85]=-1;Te[85]=Be[85]=0;ze[85]=Fe[85]=0;Ge[85]=Ue[85]=1;Pe[85]=ke[85]=1;We[1]=We[169]=0;Xe[1]=Xe[169]=-1;Ye[1]=Ye[169]=0;Fe[1]=Fe[169]=-1;Ue[1]=Ue[169]=0;Be[1]=Be[169]=0;Ne[4]=Ne[166]=0;Oe[4]=Oe[166]=-1;De[4]=De[166]=1;ze[4]=ze[166]=1;Ge[4]=Ge[166]=0;ke[4]=ke[166]=0;Ie[16]=Ie[154]=0;Re[16]=Re[154]=1;Le[16]=Le[154]=1;Ae[16]=Ae[154]=1;Ce[16]=Ce[154]=0;Pe[16]=Pe[154]=1;qe[64]=qe[106]=0;Ve[64]=Ve[106]=1;He[64]=He[106]=0;we[64]=we[106]=-1;be[64]=be[106]=0;Te[64]=Te[106]=1;qe[2]=qe[168]=0;Ve[2]=Ve[168]=-1;He[2]=He[168]=1;We[2]=We[168]=0;Xe[2]=Xe[168]=-1;Ye[2]=Ye[168]=0;Fe[2]=Fe[168]=-1;Ue[2]=Ue[168]=0;Be[2]=Be[168]=0;ze[2]=ze[168]=-1;Ge[2]=Ge[168]=0;ke[2]=ke[168]=1;Ie[8]=Ie[162]=0;Re[8]=Re[162]=-1;Le[8]=Le[162]=0;Ne[8]=Ne[162]=0;Oe[8]=Oe[162]=-1;De[8]=De[162]=1;Fe[8]=Fe[162]=1;Ue[8]=Ue[162]=0;Be[8]=Be[162]=1;ze[8]=ze[162]=1;Ge[8]=Ge[162]=0;ke[8]=ke[162]=0;Ie[32]=Ie[138]=0;Re[32]=Re[138]=1;Le[32]=Le[138]=1;Ne[32]=Ne[138]=0;Oe[32]=Oe[138]=1;De[32]=De[138]=0;we[32]=we[138]=1;be[32]=be[138]=0;Te[32]=Te[138]=0;Ae[32]=Ae[138]=1;Ce[32]=Ce[138]=0;Pe[32]=Pe[138]=1;We[128]=We[42]=0;Xe[128]=Xe[42]=1;Ye[128]=Ye[42]=1;qe[128]=qe[42]=0;Ve[128]=Ve[42]=1;He[128]=He[42]=0;we[128]=we[42]=-1;be[128]=be[42]=0;Te[128]=Te[42]=1;Ae[128]=Ae[42]=-1;Ce[128]=Ce[42]=0;Pe[128]=Pe[42]=0;Ne[5]=Ne[165]=-1;Oe[5]=Oe[165]=0;De[5]=De[165]=0;We[5]=We[165]=1;Xe[5]=Xe[165]=0;Ye[5]=Ye[165]=0;ze[20]=ze[150]=0;Ge[20]=Ge[150]=1;ke[20]=ke[150]=1;Ae[20]=Ae[150]=0;Ce[20]=Ce[150]=-1;Pe[20]=Pe[150]=1;Ie[80]=Ie[90]=-1;Re[80]=Re[90]=0;Le[80]=Le[90]=1;qe[80]=qe[90]=1;Ve[80]=Ve[90]=0;He[80]=He[90]=1;Fe[65]=Fe[105]=0;Ue[65]=Ue[105]=1;Be[65]=Be[105]=0;we[65]=we[105]=0;be[65]=be[105]=-1;Te[65]=Te[105]=0;Ie[160]=Ie[10]=-1;Re[160]=Re[10]=0;Le[160]=Le[10]=1;Ne[160]=Ne[10]=-1;Oe[160]=Oe[10]=0;De[160]=De[10]=0;We[160]=We[10]=1;Xe[160]=Xe[10]=0;Ye[160]=Ye[10]=0;qe[160]=qe[10]=1;Ve[160]=Ve[10]=0;He[160]=He[10]=1;ze[130]=ze[40]=0;Ge[130]=Ge[40]=1;ke[130]=ke[40]=1;Fe[130]=Fe[40]=0;Ue[130]=Ue[40]=1;Be[130]=Be[40]=0;we[130]=we[40]=0;be[130]=be[40]=-1;Te[130]=Te[40]=0;Ae[130]=Ae[40]=0;Ce[130]=Ce[40]=-1;Pe[130]=Pe[40]=1;Ne[37]=Ne[133]=0;Oe[37]=Oe[133]=1;De[37]=De[133]=1;We[37]=We[133]=0;Xe[37]=Xe[133]=1;Ye[37]=Ye[133]=0;we[37]=we[133]=-1;be[37]=be[133]=0;Te[37]=Te[133]=0;Ae[37]=Ae[133]=1;Ce[37]=Ce[133]=0;Pe[37]=Pe[133]=0;ze[148]=ze[22]=-1;Ge[148]=Ge[22]=0;ke[148]=ke[22]=0;We[148]=We[22]=0;Xe[148]=Xe[22]=-1;Ye[148]=Ye[22]=1;qe[148]=qe[22]=0;Ve[148]=Ve[22]=1;He[148]=He[22]=1;Ae[148]=Ae[22]=-1;Ce[148]=Ce[22]=0;Pe[148]=Pe[22]=1;Ie[82]=Ie[88]=0;Re[82]=Re[88]=-1;Le[82]=Le[88]=1;ze[82]=ze[88]=1;Ge[82]=Ge[88]=0;ke[82]=ke[88]=1;Fe[82]=Fe[88]=-1;Ue[82]=Ue[88]=0;Be[82]=Be[88]=1;qe[82]=qe[88]=0;Ve[82]=Ve[88]=-1;He[82]=He[88]=0;Ie[73]=Ie[97]=0;Re[73]=Re[97]=1;Le[73]=Le[97]=0;Ne[73]=Ne[97]=0;Oe[73]=Oe[97]=-1;De[73]=De[97]=0;Fe[73]=Fe[97]=1;Ue[73]=Ue[97]=0;Be[73]=Be[97]=0;we[73]=we[97]=1;be[73]=be[97]=0;Te[73]=Te[97]=1;Ie[145]=Ie[25]=0;Re[145]=Re[25]=-1;Le[145]=Le[25]=0;Fe[145]=Fe[25]=1;Ue[145]=Ue[25]=0;Be[145]=Be[25]=1;We[145]=We[25]=0;Xe[145]=Xe[25]=1;Ye[145]=Ye[25]=1;Ae[145]=Ae[25]=-1;Ce[145]=Ce[25]=0;Pe[145]=Pe[25]=0;Ne[70]=Ne[100]=0;Oe[70]=Oe[100]=1;De[70]=De[100]=0;ze[70]=ze[100]=-1;Ge[70]=Ge[100]=0;ke[70]=ke[100]=1;qe[70]=qe[100]=0;Ve[70]=Ve[100]=-1;He[70]=He[100]=1;we[70]=we[100]=1;be[70]=be[100]=0;Te[70]=Te[100]=0;Ne[101]=Ne[69]=0;Oe[101]=Oe[69]=1;De[101]=De[69]=0;we[101]=we[69]=1;be[101]=be[69]=0;Te[101]=Te[69]=0;We[149]=We[21]=0;Xe[149]=Xe[21]=1;Ye[149]=Ye[21]=1;Ae[149]=Ae[21]=-1;Ce[149]=Ce[21]=0;Pe[149]=Pe[21]=0;ze[86]=ze[84]=-1;Ge[86]=Ge[84]=0;ke[86]=ke[84]=1;qe[86]=qe[84]=0;Ve[86]=Ve[84]=-1;He[86]=He[84]=1;Ie[89]=Ie[81]=0;Re[89]=Re[81]=-1;Le[89]=Le[81]=0;Fe[89]=Fe[81]=1;Ue[89]=Ue[81]=0;Be[89]=Be[81]=1;Ie[96]=Ie[74]=0;Re[96]=Re[74]=1;Le[96]=Le[74]=0;Ne[96]=Ne[74]=-1;Oe[96]=Oe[74]=0;De[96]=De[74]=1;qe[96]=qe[74]=1;Ve[96]=Ve[74]=0;He[96]=He[74]=0;we[96]=we[74]=1;be[96]=be[74]=0;Te[96]=Te[74]=1;Ie[24]=Ie[146]=0;Re[24]=Re[146]=-1;Le[24]=Le[146]=1;ze[24]=ze[146]=1;Ge[24]=Ge[146]=0;ke[24]=ke[146]=1;Fe[24]=Fe[146]=0;Ue[24]=Ue[146]=1;Be[24]=Be[146]=1;Ae[24]=Ae[146]=0;Ce[24]=Ce[146]=-1;Pe[24]=Pe[146]=0;Ne[6]=Ne[164]=-1;Oe[6]=Oe[164]=0;De[6]=De[164]=1;ze[6]=ze[164]=-1;Ge[6]=Ge[164]=0;ke[6]=ke[164]=0;We[6]=We[164]=0;Xe[6]=Xe[164]=-1;Ye[6]=Ye[164]=1;qe[6]=qe[164]=1;Ve[6]=Ve[164]=0;He[6]=He[164]=0;Fe[129]=Fe[41]=0;Ue[129]=Ue[41]=1;Be[129]=Be[41]=1;We[129]=We[41]=0;Xe[129]=Xe[41]=1;Ye[129]=Ye[41]=0;we[129]=we[41]=-1;be[129]=be[41]=0;Te[129]=Te[41]=0;Ae[129]=Ae[41]=0;Ce[129]=Ce[41]=-1;Pe[129]=Pe[41]=0;ze[66]=ze[104]=0;Ge[66]=Ge[104]=1;ke[66]=ke[104]=0;Fe[66]=Fe[104]=-1;Ue[66]=Ue[104]=0;Be[66]=Be[104]=1;qe[66]=qe[104]=0;Ve[66]=Ve[104]=-1;He[66]=He[104]=0;we[66]=we[104]=0;be[66]=be[104]=-1;Te[66]=Te[104]=1;Ie[144]=Ie[26]=-1;Re[144]=Re[26]=0;Le[144]=Le[26]=0;We[144]=We[26]=1;Xe[144]=Xe[26]=0;Ye[144]=Ye[26]=1;qe[144]=qe[26]=0;Ve[144]=Ve[26]=1;He[144]=He[26]=1;Ae[144]=Ae[26]=-1;Ce[144]=Ce[26]=0;Pe[144]=Pe[26]=1;Ne[36]=Ne[134]=0;Oe[36]=Oe[134]=1;De[36]=De[134]=1;ze[36]=ze[134]=0;Ge[36]=Ge[134]=1;ke[36]=ke[134]=0;we[36]=we[134]=0;be[36]=be[134]=-1;Te[36]=Te[134]=1;Ae[36]=Ae[134]=1;Ce[36]=Ce[134]=0;Pe[36]=Pe[134]=0;Ie[9]=Ie[161]=-1;Re[9]=Re[161]=0;Le[9]=Le[161]=0;Ne[9]=Ne[161]=0;Oe[9]=Oe[161]=-1;De[9]=De[161]=0;Fe[9]=Fe[161]=1;Ue[9]=Ue[161]=0;Be[9]=Be[161]=0;We[9]=We[161]=1;Xe[9]=Xe[161]=0;Ye[9]=Ye[161]=1;Ie[136]=0;Re[136]=1;Le[136]=1;Ne[136]=0;Oe[136]=1;De[136]=0;ze[136]=-1;Ge[136]=0;ke[136]=1;Fe[136]=-1;Ue[136]=0;Be[136]=0;We[136]=0;Xe[136]=-1;Ye[136]=0;qe[136]=0;Ve[136]=-1;He[136]=1;we[136]=1;be[136]=0;Te[136]=0;Ae[136]=1;Ce[136]=0;Pe[136]=1;Ie[34]=0;Re[34]=-1;Le[34]=0;Ne[34]=0;Oe[34]=-1;De[34]=1;ze[34]=1;Ge[34]=0;ke[34]=0;Fe[34]=1;Ue[34]=0;Be[34]=1;We[34]=0;Xe[34]=1;Ye[34]=1;qe[34]=0;Ve[34]=1;He[34]=0;we[34]=-1;be[34]=0;Te[34]=1;Ae[34]=-1;Ce[34]=0;Pe[34]=0;Ie[35]=0;Re[35]=1;Le[35]=1;Ne[35]=0;Oe[35]=-1;De[35]=1;ze[35]=1;Ge[35]=0;ke[35]=0;Fe[35]=-1;Ue[35]=0;Be[35]=0;We[35]=0;Xe[35]=-1;Ye[35]=0;qe[35]=0;Ve[35]=1;He[35]=0;we[35]=-1;be[35]=0;Te[35]=1;Ae[35]=1;Ce[35]=0;Pe[35]=1;Ie[153]=0;Re[153]=1;Le[153]=1;Fe[153]=-1;Ue[153]=0;Be[153]=0;We[153]=0;Xe[153]=-1;Ye[153]=0;Ae[153]=1;Ce[153]=0;Pe[153]=1;Ne[102]=0;Oe[102]=-1;De[102]=1;ze[102]=1;Ge[102]=0;ke[102]=0;qe[102]=0;Ve[102]=1;He[102]=0;we[102]=-1;be[102]=0;Te[102]=1;Ie[155]=0;Re[155]=-1;Le[155]=0;Fe[155]=1;Ue[155]=0;Be[155]=1;We[155]=0;Xe[155]=1;Ye[155]=1;Ae[155]=-1;Ce[155]=0;Pe[155]=0;Ne[103]=0;Oe[103]=1;De[103]=0;ze[103]=-1;Ge[103]=0;ke[103]=1;qe[103]=0;Ve[103]=-1;He[103]=1;we[103]=1;be[103]=0;Te[103]=0;Ie[152]=0;Re[152]=1;Le[152]=1;ze[152]=-1;Ge[152]=0;ke[152]=1;Fe[152]=-1;Ue[152]=0;Be[152]=0;We[152]=0;Xe[152]=-1;Ye[152]=0;qe[152]=0;Ve[152]=-1;He[152]=1;Ae[152]=1;Ce[152]=0;Pe[152]=1;Ie[156]=0;Re[156]=-1;Le[156]=1;ze[156]=1;Ge[156]=0;ke[156]=1;Fe[156]=-1;Ue[156]=0;Be[156]=0;We[156]=0;Xe[156]=-1;Ye[156]=0;qe[156]=0;Ve[156]=1;He[156]=1;Ae[156]=-1;Ce[156]=0;Pe[156]=1;Ie[137]=0;Re[137]=1;Le[137]=1;Ne[137]=0;Oe[137]=1;De[137]=0;Fe[137]=-1;Ue[137]=0;Be[137]=0;We[137]=0;Xe[137]=-1;Ye[137]=0;we[137]=1;be[137]=0;Te[137]=0;Ae[137]=1;Ce[137]=0;Pe[137]=1;Ie[139]=0;Re[139]=1;Le[139]=1;Ne[139]=0;Oe[139]=-1;De[139]=0;Fe[139]=1;Ue[139]=0;Be[139]=0;We[139]=0;Xe[139]=1;Ye[139]=0;we[139]=-1;be[139]=0;Te[139]=0;Ae[139]=1;Ce[139]=0;Pe[139]=1;Ie[98]=0;Re[98]=-1;Le[98]=0;Ne[98]=0;Oe[98]=-1;De[98]=1;ze[98]=1;Ge[98]=0;ke[98]=0;Fe[98]=1;Ue[98]=0;Be[98]=1;qe[98]=0;Ve[98]=1;He[98]=0;we[98]=-1;be[98]=0;Te[98]=1;Ie[99]=0;Re[99]=1;Le[99]=0;Ne[99]=0;Oe[99]=-1;De[99]=1;ze[99]=1;Ge[99]=0;ke[99]=0;Fe[99]=-1;Ue[99]=0;Be[99]=1;qe[99]=0;Ve[99]=-1;He[99]=0;we[99]=1;be[99]=0;Te[99]=1;Ne[38]=0;Oe[38]=-1;De[38]=1;ze[38]=1;Ge[38]=0;ke[38]=0;We[38]=0;Xe[38]=1;Ye[38]=1;qe[38]=0;Ve[38]=1;He[38]=0;we[38]=-1;be[38]=0;Te[38]=1;Ae[38]=-1;Ce[38]=0;Pe[38]=0;Ne[39]=0;Oe[39]=1;De[39]=1;ze[39]=-1;Ge[39]=0;ke[39]=0;We[39]=0;Xe[39]=-1;Ye[39]=1;qe[39]=0;Ve[39]=1;He[39]=0;we[39]=-1;be[39]=0;Te[39]=1;Ae[39]=1;Ce[39]=0;Pe[39]=0;var zg=function(r){return[[r.bottomleft,0],[0,0],[0,r.leftbottom]]},Gg=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0]]},kg=function(r){return[[r.topright,1],[1,1],[1,r.righttop]]},qg=function(r){return[[0,r.lefttop],[0,1],[r.topleft,1]]},Vg=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop]]},Hg=function(r){return[[r.bottomright,0],[r.bottomleft,0],[1,r.righttop],[1,r.rightbottom]]},Wg=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.topleft,1],[r.topright,1]]},Xg=function(r){return[[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},Zz=function(r){return[[0,0],[0,r.leftbottom],[1,r.rightbottom],[1,0]]},Jz=function(r){return[[1,0],[r.bottomright,0],[r.topright,1],[1,1]]},Kz=function(r){return[[1,1],[1,r.righttop],[0,r.lefttop],[0,1]]},jz=function(r){return[[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},Qz=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.leftbottom],[0,r.lefttop]]},tG=function(r){return[[r.topleft,1],[r.topright,1],[r.bottomright,0],[r.bottomleft,0]]},eG=function(){return[[0,0],[0,1],[1,1],[1,0]]},nG=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,1],[r.topleft,1]]},rG=function(r){return[[r.topright,1],[1,1],[1,0],[0,0],[0,r.leftbottom]]},iG=function(r){return[[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[1,1]]},oG=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,1]]},sG=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.lefttop],[0,1],[r.topleft,1]]},aG=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[r.topright,1]]},uG=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop]]},lG=function(r){return[[r.topright,1],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1]]},cG=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},fG=function(r){return[[1,1],[1,r.righttop],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},hG=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[r.topleft,1],[r.topright,1]]},pG=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom]]},dG=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},mG=function(r){return[[1,1],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},gG=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1]]},yG=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},vG=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},_G=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},xG=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},EG=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},SG=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},MG=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},wG=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},bG=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},TG=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},Je=[],Ke=[],je=[],Qe=[],tn=[],en=[],nn=[],rn=[];Qe[1]=tn[1]=18;Qe[169]=tn[169]=18;je[4]=Ke[4]=12;je[166]=Ke[166]=12;Je[16]=rn[16]=4;Je[154]=rn[154]=4;en[64]=nn[64]=22;en[106]=nn[106]=22;je[2]=en[2]=17;Qe[2]=tn[2]=18;je[168]=en[168]=17;Qe[168]=tn[168]=18;Je[8]=Qe[8]=9;Ke[8]=je[8]=12;Je[162]=Qe[162]=9;Ke[162]=je[162]=12;Je[32]=rn[32]=4;Ke[32]=nn[32]=1;Je[138]=rn[138]=4;Ke[138]=nn[138]=1;tn[128]=rn[128]=21;en[128]=nn[128]=22;tn[42]=rn[42]=21;en[42]=nn[42]=22;Ke[5]=tn[5]=14;Ke[165]=tn[165]=14;je[20]=rn[20]=6;je[150]=rn[150]=6;Je[80]=en[80]=11;Je[90]=en[90]=11;Qe[65]=nn[65]=3;Qe[105]=nn[105]=3;Je[160]=en[160]=11;Ke[160]=tn[160]=14;Je[10]=en[10]=11;Ke[10]=tn[10]=14;je[130]=rn[130]=6;Qe[130]=nn[130]=3;je[40]=rn[40]=6;Qe[40]=nn[40]=3;Ke[101]=nn[101]=1;Ke[69]=nn[69]=1;tn[149]=rn[149]=21;tn[21]=rn[21]=21;je[86]=en[86]=17;je[84]=en[84]=17;Je[89]=Qe[89]=9;Je[81]=Qe[81]=9;Je[96]=nn[96]=0;Ke[96]=en[96]=15;Je[74]=nn[74]=0;Ke[74]=en[74]=15;Je[24]=je[24]=8;Qe[24]=rn[24]=7;Je[146]=je[146]=8;Qe[146]=rn[146]=7;Ke[6]=en[6]=15;je[6]=tn[6]=16;Ke[164]=en[164]=15;je[164]=tn[164]=16;Qe[129]=rn[129]=7;tn[129]=nn[129]=20;Qe[41]=rn[41]=7;tn[41]=nn[41]=20;je[66]=nn[66]=2;Qe[66]=en[66]=19;je[104]=nn[104]=2;Qe[104]=en[104]=19;Je[144]=tn[144]=10;en[144]=rn[144]=23;Je[26]=tn[26]=10;en[26]=rn[26]=23;Ke[36]=rn[36]=5;je[36]=nn[36]=2;Ke[134]=rn[134]=5;je[134]=nn[134]=2;Je[9]=tn[9]=10;Ke[9]=Qe[9]=13;Je[161]=tn[161]=10;Ke[161]=Qe[161]=13;Ke[37]=rn[37]=5;tn[37]=nn[37]=20;Ke[133]=rn[133]=5;tn[133]=nn[133]=20;je[148]=tn[148]=16;en[148]=rn[148]=23;je[22]=tn[22]=16;en[22]=rn[22]=23;Je[82]=je[82]=8;Qe[82]=en[82]=19;Je[88]=je[88]=8;Qe[88]=en[88]=19;Je[73]=nn[73]=0;Ke[73]=Qe[73]=13;Je[97]=nn[97]=0;Ke[97]=Qe[97]=13;Je[145]=Qe[145]=9;tn[145]=rn[145]=21;Je[25]=Qe[25]=9;tn[25]=rn[25]=21;Ke[70]=nn[70]=1;je[70]=en[70]=17;Ke[100]=nn[100]=1;je[100]=en[100]=17;Je[34]=Qe[34]=9;Ke[34]=je[34]=12;tn[34]=rn[34]=21;en[34]=nn[34]=22;Je[136]=rn[136]=4;Ke[136]=nn[136]=1;je[136]=en[136]=17;Qe[136]=tn[136]=18;Je[35]=rn[35]=4;Ke[35]=je[35]=12;Qe[35]=tn[35]=18;en[35]=nn[35]=22;Je[153]=rn[153]=4;Qe[153]=tn[153]=18;Ke[102]=je[102]=12;en[102]=nn[102]=22;Je[155]=Qe[155]=9;tn[155]=rn[155]=23;Ke[103]=nn[103]=1;je[103]=en[103]=17;Je[152]=rn[152]=4;je[152]=en[152]=17;Qe[152]=tn[152]=18;Je[156]=je[156]=8;Qe[156]=tn[156]=18;en[156]=rn[156]=23;Je[137]=rn[137]=4;Ke[137]=nn[137]=1;Qe[137]=tn[137]=18;Je[139]=rn[139]=4;Ke[139]=Qe[139]=13;tn[139]=nn[139]=20;Je[98]=Qe[98]=9;Ke[98]=je[98]=12;en[98]=nn[98]=22;Je[99]=nn[99]=0;Ke[99]=je[99]=12;Qe[99]=en[99]=19;Ke[38]=je[38]=12;tn[38]=rn[38]=21;en[38]=nn[38]=22;Ke[39]=rn[39]=5;je[39]=tn[39]=16;en[39]=nn[39]=22;var Gt=[];Gt[1]=Gt[169]=zg;Gt[4]=Gt[166]=Gg;Gt[16]=Gt[154]=kg;Gt[64]=Gt[106]=qg;Gt[168]=Gt[2]=Vg;Gt[162]=Gt[8]=Hg;Gt[138]=Gt[32]=Wg;Gt[42]=Gt[128]=Xg;Gt[5]=Gt[165]=Zz;Gt[20]=Gt[150]=Jz;Gt[80]=Gt[90]=Kz;Gt[65]=Gt[105]=jz;Gt[160]=Gt[10]=Qz;Gt[130]=Gt[40]=tG;Gt[85]=eG;Gt[101]=Gt[69]=nG;Gt[149]=Gt[21]=rG;Gt[86]=Gt[84]=iG;Gt[89]=Gt[81]=oG;Gt[96]=Gt[74]=sG;Gt[24]=Gt[146]=aG;Gt[6]=Gt[164]=uG;Gt[129]=Gt[41]=lG;Gt[66]=Gt[104]=cG;Gt[144]=Gt[26]=fG;Gt[36]=Gt[134]=hG;Gt[9]=Gt[161]=pG;Gt[37]=Gt[133]=dG;Gt[148]=Gt[22]=mG;Gt[82]=Gt[88]=gG;Gt[73]=Gt[97]=yG;Gt[145]=Gt[25]=vG;Gt[70]=Gt[100]=_G;Gt[34]=function(r){return[Xg(r),Hg(r)]};Gt[35]=xG;Gt[136]=function(r){return[Wg(r),Vg(r)]};Gt[153]=function(r){return[kg(r),zg(r)]};Gt[102]=function(r){return[Gg(r),qg(r)]};Gt[155]=EG;Gt[103]=SG;Gt[152]=function(r){return[kg(r),Vg(r)]};Gt[156]=MG;Gt[137]=function(r){return[Wg(r),zg(r)]};Gt[139]=wG;Gt[98]=function(r){return[Hg(r),qg(r)]};Gt[99]=bG;Gt[38]=function(r){return[Gg(r),Xg(r)]};Gt[39]=TG;function CG(r){return(r>0)-(r<0)||+r}function Uu(r,t,e){var o=t[0]-r[0],a=t[1]-r[1],l=e[0]-t[0],h=e[1]-t[1];return CG(o*h-l*a)}function $w(r,t){var e=r.geometry.coordinates[0].map(function(h){return h[0]}),o=r.geometry.coordinates[0].map(function(h){return h[1]}),a=t.geometry.coordinates[0].map(function(h){return h[0]}),l=t.geometry.coordinates[0].map(function(h){return h[1]});return Math.max.apply(null,e)===Math.max.apply(null,a)&&Math.max.apply(null,o)===Math.max.apply(null,l)&&Math.min.apply(null,e)===Math.min.apply(null,a)&&Math.min.apply(null,o)===Math.min.apply(null,l)}function Yg(r,t){return t.geometry.coordinates[0].every(function(e){return Pr(Ln(e),r)})}function Zw(r,t){return r[0]===t[0]&&r[1]===t[1]}var PG=function(){function r(t){this.id=r.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return r.buildId=function(t){return t.join(",")},r.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},r.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},r.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},r.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,o){var a=e.to,l=o.to;if(a.coordinates[0]-t.coordinates[0]>=0&&l.coordinates[0]-t.coordinates[0]<0)return 1;if(a.coordinates[0]-t.coordinates[0]<0&&l.coordinates[0]-t.coordinates[0]>=0)return-1;if(a.coordinates[0]-t.coordinates[0]===0&&l.coordinates[0]-t.coordinates[0]===0)return a.coordinates[1]-t.coordinates[1]>=0||l.coordinates[1]-t.coordinates[1]>=0?a.coordinates[1]-l.coordinates[1]:l.coordinates[1]-a.coordinates[1];var h=Uu(t.coordinates,a.coordinates,l.coordinates);if(h<0)return 1;if(h>0)return-1;var f=Math.pow(a.coordinates[0]-t.coordinates[0],2)+Math.pow(a.coordinates[1]-t.coordinates[1],2),p=Math.pow(l.coordinates[0]-t.coordinates[0],2)+Math.pow(l.coordinates[1]-t.coordinates[1],2);return f-p}),this.outerEdgesSorted=!0)},r.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},r.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},r.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},r}(),$g=PG;var IG=function(){function r(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return r.prototype.getSymetric=function(){return this.symetric||(this.symetric=new r(this.to,this.from),this.symetric.symetric=this),this.symetric},r.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},r.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},r.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},r.prototype.toLineString=function(){return Cr([this.from.coordinates,this.to.coordinates])},r.prototype.compareTo=function(t){return Uu(t.from.coordinates,t.to.coordinates,this.to.coordinates)},r}(),Jw=IG;var RG=function(){function r(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return r.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},r.prototype.get=function(t){return this.edges[t]},Object.defineProperty(r.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),r.prototype.forEach=function(t){this.edges.forEach(t)},r.prototype.map=function(t){return this.edges.map(t)},r.prototype.some=function(t){return this.edges.some(t)},r.prototype.isValid=function(){return!0},r.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(h,f,p){return f.from.coordinates[1]>t.edges[h].from.coordinates[1]&&(h=p),h},0),o=(e===0?this.length:e)-1,a=(e+1)%this.length,l=Uu(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[a].from.coordinates);return l===0?this.edges[o].from.coordinates[0]>this.edges[a].from.coordinates[0]:l>0},r.prototype.toMultiPoint=function(){return Rm(this.edges.map(function(t){return t.from.coordinates}))},r.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map(function(e){return e.from.coordinates});return t.push(this.edges[0].from.coordinates),this.polygon=Vn([t])},r.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Jm(this.toPolygon())},r.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),a,l;return e.forEach(function(h){var f=h.getEnvelope();if(l&&(a=l.getEnvelope()),!$w(f,o)&&Yg(f,o)){for(var p=t.map(function(b){return b.from.coordinates}),d=void 0,g=function(b){h.some(function(T){return Zw(b,T.from.coordinates)})||(d=b)},x=0,v=p;x<v.length;x++){var S=v[x];g(S)}d&&h.inside(Ln(d))&&(!l||Yg(a,f))&&(l=h)}}),l},r.prototype.inside=function(t){return Pr(t,this.toPolygon())},r}(),Zg=RG;function LG(r){if(!r)throw new Error("No geojson passed");if(r.type!=="FeatureCollection"&&r.type!=="GeometryCollection"&&r.type!=="MultiLineString"&&r.type!=="LineString"&&r.type!=="Feature")throw new Error("Invalid input type '"+r.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var qY=function(){function r(){this.edges=[],this.nodes={}}return r.fromGeoJson=function(t){LG(t);var e=new r;return Li(t,function(o){Nm(o,"LineString","Graph::fromGeoJson"),qE(o,function(a,l){if(a){var h=e.getNode(a),f=e.getNode(l);e.addEdge(h,f)}return l})}),e},r.prototype.getNode=function(t){var e=$g.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new $g(t)),o},r.prototype.addEdge=function(t,e){var o=new Jw(t,e),a=o.getSymetric();this.edges.push(o),this.edges.push(a)},r.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},r.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var o=t.getOuterEdges().map(function(a){return a.to});this.removeNode(t),o.forEach(function(a){return e._removeIfDangle(a)})}},r.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))})},r.prototype._computeNextCWEdges=function(t){var e=this;typeof t=="undefined"?Object.keys(this.nodes).forEach(function(o){return e._computeNextCWEdges(e.nodes[o])}):t.getOuterEdges().forEach(function(o,a){t.getOuterEdge((a===0?t.getOuterEdges().length:a)-1).symetric.next=o})},r.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),a,l,h=o.length-1;h>=0;--h){var f=o[h],p=f.symetric,d=void 0,g=void 0;f.label===e&&(d=f),p.label===e&&(g=p),!(!d||!g)&&(g&&(l=g),d&&(l&&(l.next=d,l=void 0),a||(a=d)))}l&&(l.next=a)},r.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var a=o;do a.label=e,a=a.next;while(!o.isEqual(a));e++}}),t},r.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(o){o.label=void 0}),this._findLabeledEdgeRings().forEach(function(o){t._findIntersectionNodes(o).forEach(function(a){t._computeNextCCWEdges(a,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},r.prototype._findIntersectionNodes=function(t){var e=[],o=t,a=function(){var l=0;o.from.getOuterEdges().forEach(function(h){h.label===t.label&&++l}),l>1&&e.push(o.from),o=o.next};do a();while(!t.isEqual(o));return e},r.prototype._findEdgeRing=function(t){var e=t,o=new Zg;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},r.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(o){return e.removeEdge(o)}),t.innerEdges.forEach(function(o){return e.removeEdge(o)}),delete this.nodes[t.id]},r.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},r}();var FG=yn(Jg(),1);var UG=yn(Jg(),1);var zG=yn(ob(),1);var XG=yn(mb(),1);function yb(r){for(var t=r,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function $G(){return new vb(function(r){return r.f})}var t0={search:function(r,t,e,o){r.cleanDirty(),o=o||{};var a=o.heuristic||t0.heuristics.manhattan,l=o.closest||!1,h=$G(),f=t;for(t.h=a(t,e),h.push(t);h.size()>0;){var p=h.pop();if(p===e)return yb(p);p.closed=!0;for(var d=r.neighbors(p),g=0,x=d.length;g<x;++g){var v=d[g];if(!(v.closed||v.isWall())){var S=p.g+v.getCost(p),b=v.visited;(!b||S<v.g)&&(v.visited=!0,v.parent=p,v.h=v.h||a(v,e),v.g=S,v.f=v.g+v.h,r.markDirty(v),l&&(v.h<f.h||v.h===f.h&&v.g<f.g)&&(f=v),b?h.rescoreElement(v):h.push(v))}}}return l?yb(f):[]},heuristics:{manhattan:function(r,t){var e=Math.abs(t.x-r.x),o=Math.abs(t.y-r.y);return e+o},diagonal:function(r,t){var e=1,o=Math.sqrt(2),a=Math.abs(t.x-r.x),l=Math.abs(t.y-r.y);return e*(a+l)+(o-2*e)*Math.min(a,l)}},cleanNode:function(r){r.f=0,r.g=0,r.h=0,r.visited=!1,r.closed=!1,r.parent=null}};function Wl(r,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<r.length;e++){this.grid[e]=[];for(var o=0,a=r[e];o<a.length;o++){var l=new bh(e,o,a[o]);this.grid[e][o]=l,this.nodes.push(l)}}this.init()}Wl.prototype.init=function(){this.dirtyNodes=[];for(var r=0;r<this.nodes.length;r++)t0.cleanNode(this.nodes[r])};Wl.prototype.cleanDirty=function(){for(var r=0;r<this.dirtyNodes.length;r++)t0.cleanNode(this.dirtyNodes[r]);this.dirtyNodes=[]};Wl.prototype.markDirty=function(r){this.dirtyNodes.push(r)};Wl.prototype.neighbors=function(r){var t=[],e=r.x,o=r.y,a=this.grid;return a[e-1]&&a[e-1][o]&&t.push(a[e-1][o]),a[e+1]&&a[e+1][o]&&t.push(a[e+1][o]),a[e]&&a[e][o-1]&&t.push(a[e][o-1]),a[e]&&a[e][o+1]&&t.push(a[e][o+1]),this.diagonal&&(a[e-1]&&a[e-1][o-1]&&t.push(a[e-1][o-1]),a[e+1]&&a[e+1][o-1]&&t.push(a[e+1][o-1]),a[e-1]&&a[e-1][o+1]&&t.push(a[e-1][o+1]),a[e+1]&&a[e+1][o+1]&&t.push(a[e+1][o+1])),t};Wl.prototype.toString=function(){for(var r=[],t=this.grid,e,o,a,l,h=0,f=t.length;h<f;h++){for(e=[],o=t[h],a=0,l=o.length;a<l;a++)e.push(o[a].weight);r.push(e.join(" "))}return r.join(\`
7744
7744
  \`)};function bh(r,t,e){this.x=r,this.y=t,this.weight=e}bh.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};bh.prototype.getCost=function(r){return r&&r.x!==this.x&&r.y!==this.y?this.weight*1.41421:this.weight};bh.prototype.isWall=function(){return this.weight===0};function vb(r){this.content=[],this.scoreFunction=r}vb.prototype={push:function(r){this.content.push(r),this.sinkDown(this.content.length-1)},pop:function(){var r=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),r},remove:function(r){var t=this.content.indexOf(r),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(r)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(r){this.sinkDown(this.content.indexOf(r))},sinkDown:function(r){for(var t=this.content[r];r>0;){var e=(r+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[r]=o,r=e;else break}},bubbleUp:function(r){for(var t=this.content.length,e=this.content[r],o=this.scoreFunction(e);;){var a=r+1<<1,l=a-1,h=null,f;if(l<t){var p=this.content[l];f=this.scoreFunction(p),f<o&&(h=l)}if(a<t){var d=this.content[a],g=this.scoreFunction(d);g<(h===null?o:f)&&(h=a)}if(h!==null)this.content[r]=this.content[h],this.content[h]=e,r=h;else break}}};function e0(){this._=null}function zu(r){r.U=r.C=r.L=r.R=r.P=r.N=null}e0.prototype={constructor:e0,insert:function(r,t){var e,o,a;if(r){if(t.P=r,t.N=r.N,r.N&&(r.N.P=t),r.N=t,r.R){for(r=r.R;r.L;)r=r.L;r.L=t}else r.R=t;e=r}else this._?(r=_b(this._),t.P=null,t.N=r,r.P=r.L=t,e=r):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,r=t;e&&e.C;)o=e.U,e===o.L?(a=o.R,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.R&&(Xl(this,e),r=e,e=r.U),e.C=!1,o.C=!0,Yl(this,o))):(a=o.L,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.L&&(Yl(this,e),r=e,e=r.U),e.C=!1,o.C=!0,Xl(this,o))),e=r.U;this._.C=!1},remove:function(r){r.N&&(r.N.P=r.P),r.P&&(r.P.N=r.N),r.N=r.P=null;var t=r.U,e,o=r.L,a=r.R,l,h;if(o?a?l=_b(a):l=o:l=a,t?t.L===r?t.L=l:t.R=l:this._=l,o&&a?(h=l.C,l.C=r.C,l.L=o,o.U=l,l!==a?(t=l.U,l.U=r.U,r=l.R,t.L=r,l.R=a,a.U=l):(l.U=t,t=l,r=l.R)):(h=r.C,r=l),r&&(r.U=t),!h){if(r&&r.C){r.C=!1;return}do{if(r===this._)break;if(r===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,Xl(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,Yl(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Xl(this,t),r=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,Yl(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,Xl(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,Yl(this,t),r=this._;break}e.C=!0,r=t,t=t.U}while(!r.C);r&&(r.C=!1)}}};function Xl(r,t){var e=t,o=t.R,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function Yl(r,t){var e=t,o=t.L,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function _b(r){for(;r.L;)r=r.L;return r}var n0=e0;function Gu(r,t,e,o){var a=[null,null],l=Rr.push(a)-1;return a.left=r,a.right=t,e&&$l(a,r,t,e),o&&$l(a,t,r,o),pi[r.index].halfedges.push(l),pi[t.index].halfedges.push(l),a}function ku(r,t,e){var o=[t,e];return o.left=r,o}function $l(r,t,e,o){!r[0]&&!r[1]?(r[0]=o,r.left=t,r.right=e):r.left===e?r[1]=o:r[0]=o}function ZG(r,t,e,o,a){var l=r[0],h=r[1],f=l[0],p=l[1],d=h[0],g=h[1],x=0,v=1,S=d-f,b=g-p,T;if(T=t-f,!(!S&&T>0)){if(T/=S,S<0){if(T<x)return;T<v&&(v=T)}else if(S>0){if(T>v)return;T>x&&(x=T)}if(T=o-f,!(!S&&T<0)){if(T/=S,S<0){if(T>v)return;T>x&&(x=T)}else if(S>0){if(T<x)return;T<v&&(v=T)}if(T=e-p,!(!b&&T>0)){if(T/=b,b<0){if(T<x)return;T<v&&(v=T)}else if(b>0){if(T>v)return;T>x&&(x=T)}if(T=a-p,!(!b&&T<0)){if(T/=b,b<0){if(T>v)return;T>x&&(x=T)}else if(b>0){if(T<x)return;T<v&&(v=T)}return!(x>0)&&!(v<1)||(x>0&&(r[0]=[f+x*S,p+x*b]),v<1&&(r[1]=[f+v*S,p+v*b])),!0}}}}}function JG(r,t,e,o,a){var l=r[1];if(l)return!0;var h=r[0],f=r.left,p=r.right,d=f[0],g=f[1],x=p[0],v=p[1],S=(d+x)/2,b=(g+v)/2,T,_;if(v===g){if(S<t||S>=o)return;if(d>x){if(!h)h=[S,e];else if(h[1]>=a)return;l=[S,a]}else{if(!h)h=[S,a];else if(h[1]<e)return;l=[S,e]}}else if(T=(d-x)/(v-g),_=b-T*S,T<-1||T>1)if(d>x){if(!h)h=[(e-_)/T,e];else if(h[1]>=a)return;l=[(a-_)/T,a]}else{if(!h)h=[(a-_)/T,a];else if(h[1]<e)return;l=[(e-_)/T,e]}else if(g<v){if(!h)h=[t,T*t+_];else if(h[0]>=o)return;l=[o,T*o+_]}else{if(!h)h=[o,T*o+_];else if(h[0]<t)return;l=[t,T*t+_]}return r[0]=h,r[1]=l,!0}function xb(r,t,e,o){for(var a=Rr.length,l;a--;)(!JG(l=Rr[a],r,t,e,o)||!ZG(l,r,t,e,o)||!(Math.abs(l[0][0]-l[1][0])>Cn||Math.abs(l[0][1]-l[1][1])>Cn))&&delete Rr[a]}function Eb(r){return pi[r.index]={site:r,halfedges:[]}}function KG(r,t){var e=r.site,o=t.left,a=t.right;return e===a&&(a=o,o=e),a?Math.atan2(a[1]-o[1],a[0]-o[0]):(e===o?(o=t[1],a=t[0]):(o=t[0],a=t[1]),Math.atan2(o[0]-a[0],a[1]-o[1]))}function r0(r,t){return t[+(t.left!==r.site)]}function jG(r,t){return t[+(t.left===r.site)]}function Sb(){for(var r=0,t=pi.length,e,o,a,l;r<t;++r)if((e=pi[r])&&(l=(o=e.halfedges).length)){var h=new Array(l),f=new Array(l);for(a=0;a<l;++a)h[a]=a,f[a]=KG(e,Rr[o[a]]);for(h.sort(function(p,d){return f[d]-f[p]}),a=0;a<l;++a)f[a]=o[h[a]];for(a=0;a<l;++a)o[a]=f[a]}}function Mb(r,t,e,o){var a=pi.length,l,h,f,p,d,g,x,v,S,b,T,_,y=!0;for(l=0;l<a;++l)if(h=pi[l]){for(f=h.site,d=h.halfedges,p=d.length;p--;)Rr[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)b=jG(h,Rr[d[p]]),T=b[0],_=b[1],x=r0(h,Rr[d[++p%g]]),v=x[0],S=x[1],(Math.abs(T-v)>Cn||Math.abs(_-S)>Cn)&&(d.splice(p,0,Rr.push(ku(f,b,Math.abs(T-r)<Cn&&o-_>Cn?[r,Math.abs(v-r)<Cn?S:o]:Math.abs(_-o)<Cn&&e-T>Cn?[Math.abs(S-o)<Cn?v:e,o]:Math.abs(T-e)<Cn&&_-t>Cn?[e,Math.abs(v-e)<Cn?S:t]:Math.abs(_-t)<Cn&&T-r>Cn?[Math.abs(S-t)<Cn?v:r,t]:null))-1),++g);g&&(y=!1)}if(y){var A,M,L,G=1/0;for(l=0,y=null;l<a;++l)(h=pi[l])&&(f=h.site,A=f[0]-r,M=f[1]-t,L=A*A+M*M,L<G&&(G=L,y=h));if(y){var z=[r,t],F=[r,o],I=[e,o],ut=[e,t];y.halfedges.push(Rr.push(ku(f=y.site,z,F))-1,Rr.push(ku(f,F,I))-1,Rr.push(ku(f,I,ut))-1,Rr.push(ku(f,ut,z))-1)}}for(l=0;l<a;++l)(h=pi[l])&&(h.halfedges.length||delete pi[l])}var wb=[],Th;function QG(){zu(this),this.x=this.y=this.arc=this.site=this.cy=null}function Sa(r){var t=r.P,e=r.N;if(!(!t||!e)){var o=t.site,a=r.site,l=e.site;if(o!==l){var h=a[0],f=a[1],p=o[0]-h,d=o[1]-f,g=l[0]-h,x=l[1]-f,v=2*(p*x-d*g);if(!(v>=-bb)){var S=p*p+d*d,b=g*g+x*x,T=(x*S-d*b)/v,_=(p*b-g*S)/v,y=wb.pop()||new QG;y.arc=r,y.site=a,y.x=T+h,y.y=(y.cy=_+f)+Math.sqrt(T*T+_*_),r.circle=y;for(var A=null,M=qu._;M;)if(y.y<M.y||y.y===M.y&&y.x<=M.x)if(M.L)M=M.L;else{A=M.P;break}else if(M.R)M=M.R;else{A=M;break}qu.insert(A,y),A||(Th=y)}}}}function Ma(r){var t=r.circle;t&&(t.P||(Th=t.N),qu.remove(t),wb.push(t),zu(t),r.circle=null)}var Ab=[];function tk(){zu(this),this.edge=this.site=this.circle=null}function Tb(r){var t=Ab.pop()||new tk;return t.site=r,t}function i0(r){Ma(r),wa.remove(r),Ab.push(r),zu(r)}function Cb(r){var t=r.circle,e=t.x,o=t.cy,a=[e,o],l=r.P,h=r.N,f=[r];i0(r);for(var p=l;p.circle&&Math.abs(e-p.circle.x)<Cn&&Math.abs(o-p.circle.cy)<Cn;)l=p.P,f.unshift(p),i0(p),p=l;f.unshift(p),Ma(p);for(var d=h;d.circle&&Math.abs(e-d.circle.x)<Cn&&Math.abs(o-d.circle.cy)<Cn;)h=d.N,f.push(d),i0(d),d=h;f.push(d),Ma(d);var g=f.length,x;for(x=1;x<g;++x)d=f[x],p=f[x-1],$l(d.edge,p.site,d.site,a);p=f[0],d=f[g-1],d.edge=Gu(p.site,d.site,null,a),Sa(p),Sa(d)}function Pb(r){for(var t=r[0],e=r[1],o,a,l,h,f=wa._;f;)if(l=Ib(f,e)-t,l>Cn)f=f.L;else if(h=t-ek(f,e),h>Cn){if(!f.R){o=f;break}f=f.R}else{l>-Cn?(o=f.P,a=f):h>-Cn?(o=f,a=f.N):o=a=f;break}Eb(r);var p=Tb(r);if(wa.insert(o,p),!(!o&&!a)){if(o===a){Ma(o),a=Tb(o.site),wa.insert(p,a),p.edge=a.edge=Gu(o.site,p.site),Sa(o),Sa(a);return}if(!a){p.edge=Gu(o.site,p.site);return}Ma(o),Ma(a);var d=o.site,g=d[0],x=d[1],v=r[0]-g,S=r[1]-x,b=a.site,T=b[0]-g,_=b[1]-x,y=2*(v*_-S*T),A=v*v+S*S,M=T*T+_*_,L=[(_*A-S*M)/y+g,(v*M-T*A)/y+x];$l(a.edge,d,b,L),p.edge=Gu(d,r,null,L),a.edge=Gu(r,b,null,L),Sa(o),Sa(a)}}function Ib(r,t){var e=r.site,o=e[0],a=e[1],l=a-t;if(!l)return o;var h=r.P;if(!h)return-1/0;e=h.site;var f=e[0],p=e[1],d=p-t;if(!d)return f;var g=f-o,x=1/l-1/d,v=g/d;return x?(-v+Math.sqrt(v*v-2*x*(g*g/(-2*d)-p+d/2+a-l/2)))/x+o:(o+f)/2}function ek(r,t){var e=r.N;if(e)return Ib(e,t);var o=r.site;return o[1]===t?o[0]:1/0}var Cn=1e-6,bb=1e-12,wa,pi,qu,Rr;function nk(r,t,e){return(r[0]-e[0])*(t[1]-r[1])-(r[0]-t[0])*(e[1]-r[1])}function rk(r,t){return t[1]-r[1]||t[0]-r[0]}function Ah(r,t){var e=r.sort(rk).pop(),o,a,l;for(Rr=[],pi=new Array(r.length),wa=new n0,qu=new n0;;)if(l=Th,e&&(!l||e[1]<l.y||e[1]===l.y&&e[0]<l.x))(e[0]!==o||e[1]!==a)&&(Pb(e),o=e[0],a=e[1]),e=r.pop();else if(l)Cb(l.arc);else break;if(Sb(),t){var h=+t[0][0],f=+t[0][1],p=+t[1][0],d=+t[1][1];xb(h,f,p,d),Mb(h,f,p,d)}this.edges=Rr,this.cells=pi,wa=qu=Rr=pi=null}Ah.prototype={constructor:Ah,polygons:function(){var r=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return r0(t,r[o])});return e.data=t.site.data,e})},triangles:function(){var r=[],t=this.edges;return this.cells.forEach(function(e,o){if(f=(l=e.halfedges).length)for(var a=e.site,l,h=-1,f,p,d=t[l[f-1]],g=d.left===a?d.right:d.left;++h<f;)p=g,d=t[l[h]],g=d.left===a?d.right:d.left,p&&g&&o<p.index&&o<g.index&&nk(a,p,g)<0&&r.push([a.data,p.data,g.data])}),r},links:function(){return this.edges.filter(function(r){return r.right}).map(function(r){return{source:r.left.data,target:r.right.data}})},find:function(r,t,e){for(var o=this,a,l=o._found||0,h=o.cells.length,f;!(f=o.cells[l]);)if(++l>=h)return null;var p=r-f.site[0],d=t-f.site[1],g=p*p+d*d;do f=o.cells[a=l],l=null,f.halfedges.forEach(function(x){var v=o.edges[x],S=v.left;if(!((S===f.site||!S)&&!(S=v.right))){var b=r-S[0],T=t-S[1],_=b*b+T*T;_<g&&(g=_,l=S.index)}});while(l!==null);return o._found=a,e==null||g<=e*e?f.site:null}};var fk=yn(Vu(),1);var _0=yn(Ob(),1);function Ei(){return new Ih}function Ih(){this.reset()}Ih.prototype={constructor:Ih,reset:function(){this.s=this.t=0},add:function(r){Db(Ph,r,this.t),Db(this,Ph.s,this.s),this.s?this.t+=Ph.t:this.s=Ph.t},valueOf:function(){return this.s}};var Ph=new Ih;function Db(r,t,e){var o=r.s=t+e,a=o-t,l=o-a;r.t=t-l+(e-a)}var mn=1e-6;var bn=Math.PI,dr=bn/2,Rh=bn/4,Lo=bn*2,ba=180/bn,Si=bn/180,$n=Math.abs,mo=Math.atan,Mi=Math.atan2,cn=Math.cos;var Lh=Math.exp;var Zl=Math.log;var Ee=Math.sin;var qr=Math.sqrt,Jl=Math.tan;function a0(r){return r>1?0:r<-1?bn:Math.acos(r)}function di(r){return r>1?dr:r<-1?-dr:Math.asin(r)}function go(){}var hk=Ei(),FJ=Ei();function Ta(r){var t=r[0],e=r[1],o=cn(e);return[o*cn(t),o*Ee(t),Ee(e)]}function Kl(r,t){return[r[1]*t[2]-r[2]*t[1],r[2]*t[0]-r[0]*t[2],r[0]*t[1]-r[1]*t[0]]}function jl(r){var t=qr(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}var XJ=Ei();function Ub(r,t){return[r>bn?r-Lo:r<-bn?r+Lo:r,t]}Ub.invert=Ub;function u0(){var r=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){r.push(t=[])},lineEnd:go,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function l0(r,t){return $n(r[0]-t[0])<mn&&$n(r[1]-t[1])<mn}function Nh(r,t,e,o){this.x=r,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function c0(r,t,e,o,a){var l=[],h=[],f,p;if(r.forEach(function(b){if(!((T=b.length-1)<=0)){var T,_=b[0],y=b[T],A;if(l0(_,y)){for(a.lineStart(),f=0;f<T;++f)a.point((_=b[f])[0],_[1]);a.lineEnd();return}l.push(A=new Nh(_,b,null,!0)),h.push(A.o=new Nh(_,null,A,!1)),l.push(A=new Nh(y,b,null,!1)),h.push(A.o=new Nh(y,null,A,!0))}}),!!l.length){for(h.sort(t),Bb(l),Bb(h),f=0,p=h.length;f<p;++f)h[f].e=e=!e;for(var d=l[0],g,x;;){for(var v=d,S=!0;v.v;)if((v=v.n)===d)return;g=v.z,a.lineStart();do{if(v.v=v.o.v=!0,v.e){if(S)for(f=0,p=g.length;f<p;++f)a.point((x=g[f])[0],x[1]);else o(v.x,v.n.x,1,a);v=v.n}else{if(S)for(g=v.p.z,f=g.length-1;f>=0;--f)a.point((x=g[f])[0],x[1]);else o(v.x,v.p.x,-1,a);v=v.p}v=v.o,g=v.z,S=!S}while(!v.v);a.lineEnd()}}}function Bb(r){if(t=r.length){for(var t,e=0,o=r[0],a;++e<t;)o.n=a=r[e],a.p=o,o=a;o.n=a=r[0],a.p=o}}function zs(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function f0(r){return r.length===1&&(r=mk(r)),{left:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)<0?o=l+1:a=l}return o},right:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)>0?a=l:o=l+1}return o}}}function mk(r){return function(t,e){return zs(r(t),e)}}var zb=f0(zs),gk=zb.right,yk=zb.left;var Gb=Array.prototype,_k=Gb.slice,xk=Gb.map;var BK=Math.sqrt(50),zK=Math.sqrt(10),GK=Math.sqrt(2);function Dh(r){for(var t=r.length,e,o=-1,a=0,l,h;++o<t;)a+=r[o].length;for(l=new Array(a);--t>=0;)for(h=r[t],e=h.length;--e>=0;)l[--a]=h[e];return l}var Ck=1e9,MQ=-Ck;var h0=Ei();function p0(r,t){var e=t[0],o=t[1],a=[Ee(e),-cn(e),0],l=0,h=0;h0.reset();for(var f=0,p=r.length;f<p;++f)if(g=(d=r[f]).length)for(var d,g,x=d[g-1],v=x[0],S=x[1]/2+Rh,b=Ee(S),T=cn(S),_=0;_<g;++_,v=A,b=L,T=G,x=y){var y=d[_],A=y[0],M=y[1]/2+Rh,L=Ee(M),G=cn(M),z=A-v,F=z>=0?1:-1,I=F*z,ut=I>bn,R=b*L;if(h0.add(Mi(R*F*Ee(I),T*G+R*cn(I))),l+=ut?z+F*Lo:z,ut^v>=e^A>=e){var W=Kl(Ta(x),Ta(y));jl(W);var V=Kl(a,W);jl(V);var St=(ut^z>=0?-1:1)*di(V[2]);(o>St||o===St&&(W[0]||W[1]))&&(h+=ut^z>=0?1:-1)}}return(l<-mn||l<mn&&h0<-mn)^h&1}var NQ=Ei();var jQ=Ei(),QQ=Ei();var Rk=1/0;var ntt=-Rk;function d0(r){this._context=r}d0.prototype={_radius:4.5,pointRadius:function(r){return this._radius=r,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._context.moveTo(r,t),this._point=1;break}case 1:{this._context.lineTo(r,t);break}default:{this._context.moveTo(r+this._radius,t),this._context.arc(r,t,this._radius,0,Lo);break}}},result:go};var htt=Ei();function m0(){this._string=[]}m0.prototype={_radius:4.5,_circle:Vb(4.5),pointRadius:function(r){return(r=+r)!==this._radius&&(this._radius=r,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._string.push("M",r,",",t),this._point=1;break}case 1:{this._string.push("L",r,",",t);break}default:{this._circle==null&&(this._circle=Vb(this._radius)),this._string.push("M",r,",",t,this._circle);break}}},result:function(){if(this._string.length){var r=this._string.join("");return this._string=[],r}else return null}};function Vb(r){return"m0,"+r+"a"+r+","+r+" 0 1,1 0,"+-2*r+"a"+r+","+r+" 0 1,1 0,"+2*r+"z"}function g0(r,t,e,o){return function(a,l){var h=t(l),f=a.invert(o[0],o[1]),p=u0(),d=t(p),g=!1,x,v,S,b={point:T,lineStart:y,lineEnd:A,polygonStart:function(){b.point=M,b.lineStart=L,b.lineEnd=G,v=[],x=[]},polygonEnd:function(){b.point=T,b.lineStart=y,b.lineEnd=A,v=Dh(v);var z=p0(x,f);v.length?(g||(l.polygonStart(),g=!0),c0(v,Ok,z,e,l)):z&&(g||(l.polygonStart(),g=!0),l.lineStart(),e(null,null,1,l),l.lineEnd()),g&&(l.polygonEnd(),g=!1),v=x=null},sphere:function(){l.polygonStart(),l.lineStart(),e(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function T(z,F){var I=a(z,F);r(z=I[0],F=I[1])&&l.point(z,F)}function _(z,F){var I=a(z,F);h.point(I[0],I[1])}function y(){b.point=_,h.lineStart()}function A(){b.point=T,h.lineEnd()}function M(z,F){S.push([z,F]);var I=a(z,F);d.point(I[0],I[1])}function L(){d.lineStart(),S=[]}function G(){M(S[0][0],S[0][1]),d.lineEnd();var z=d.clean(),F=p.result(),I,ut=F.length,R,W,V;if(S.pop(),x.push(S),S=null,!!ut){if(z&1){if(W=F[0],(R=W.length-1)>0){for(g||(l.polygonStart(),g=!0),l.lineStart(),I=0;I<R;++I)l.point((V=W[I])[0],V[1]);l.lineEnd()}return}ut>1&&z&2&&F.push(F.pop().concat(F.shift())),v.push(F.filter(Nk))}}return b}}function Nk(r){return r.length>1}function Ok(r,t){return((r=r.x)[0]<0?r[1]-dr-mn:dr-r[1])-((t=t.x)[0]<0?t[1]-dr-mn:dr-t[1])}var Dk=g0(function(){return!0},Fk,Bk,[-bn,-dr]);function Fk(r){var t=NaN,e=NaN,o=NaN,a;return{lineStart:function(){r.lineStart(),a=1},point:function(l,h){var f=l>0?bn:-bn,p=$n(l-t);$n(p-bn)<mn?(r.point(t,e=(e+h)/2>0?dr:-dr),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(f,e),r.point(l,e),a=0):o!==f&&p>=bn&&($n(t-o)<mn&&(t-=o*mn),$n(l-f)<mn&&(l-=f*mn),e=Uk(t,e,l,h),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(f,e),a=0),r.point(t=l,e=h),o=f},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-a}}}function Uk(r,t,e,o){var a,l,h=Ee(r-e);return $n(h)>mn?mo((Ee(t)*(l=cn(o))*Ee(e)-Ee(o)*(a=cn(t))*Ee(r))/(a*l*h)):(t+o)/2}function Bk(r,t,e,o){var a;if(r==null)a=e*dr,o.point(-bn,a),o.point(0,a),o.point(bn,a),o.point(bn,0),o.point(bn,-a),o.point(0,-a),o.point(-bn,-a),o.point(-bn,0),o.point(-bn,a);else if($n(r[0]-t[0])>mn){var l=r[0]<t[0]?bn:-bn;a=e*l/2,o.point(-l,a),o.point(0,a),o.point(l,a)}else o.point(t[0],t[1])}function Fh(r){return function(t){var e=new y0;for(var o in r)e[o]=r[o];return e.stream=t,e}}function y0(){}y0.prototype={constructor:y0,point:function(r,t){this.stream.point(r,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Qtt=cn(30*Si);var det=Fh({point:function(r,t){this.stream.point(r*Si,t*Si)}});function Uh(r){return function(t,e){var o=cn(t),a=cn(e),l=r(o*a);return[l*a*Ee(t),l*Ee(e)]}}function No(r){return function(t,e){var o=qr(t*t+e*e),a=r(o),l=Ee(a),h=cn(a);return[Mi(t*l,o*h),di(o&&e*l/o)]}}var Jb=Uh(function(r){return qr(2/(1+r))});Jb.invert=No(function(r){return 2*di(r/2)});var Kb=Uh(function(r){return(r=a0(r))&&r/Ee(r)});Kb.invert=No(function(r){return r});function v0(r,t){return[r,Zl(Jl((dr+t)/2))]}v0.invert=function(r,t){return[r,2*mo(Lh(t))-dr]};function Bh(r,t){return[r,t]}Bh.invert=Bh;function jb(r,t){var e=cn(t),o=cn(r)*e;return[e*Ee(r)/o,Ee(t)/o]}jb.invert=No(mo);function Qb(r,t){var e=t*t,o=e*e;return[r*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}Qb.invert=function(r,t){var e=t,o=25,a;do{var l=e*e,h=l*l;e-=a=(e*(1.007226+l*(.015085+h*(-.044475+.028874*l-.005916*h)))-t)/(1.007226+l*(.015085*3+h*(-.044475*7+.028874*9*l-.005916*11*h)))}while($n(a)>mn&&--o>0);return[r/(.8707+(l=e*e)*(-.131979+l*(-.013791+l*l*l*(.003971-.001529*l)))),e]};function tT(r,t){return[cn(t)*Ee(r),Ee(t)]}tT.invert=No(di);function eT(r,t){var e=cn(t),o=1+cn(r)*e;return[e*Ee(r)/o,Ee(t)/o]}eT.invert=No(function(r){return 2*mo(r)});function nT(r,t){return[Zl(Jl((dr+t)/2)),-r]}nT.invert=function(r,t){return[-t,2*mo(Lh(r))-dr]};var Hk=yn(Vu(),1);var Wk=yn(Vu(),1);var Yk=yn(Vu(),1);var $k=yn(Vu(),1);function ks(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}function x0(r){let t=0;for(let e=0;e<r.length-1;e++)t+=ks(r[e],r[e+1]);return t}function iT(r,t,e){let o=new un(t[0]-r[0],t[1]-r[1]),a=new un(t[0]-e[0],t[1]-e[1]),h=o.angleTo(a)*180/Math.PI,f=new un(t[0]-r[0],t[1]-r[1]);return new un(e[0]-r[0],e[1]-r[1]).cross(f)>0?h:-h}var Hi="___",zh=class{initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(o=>{let a=""+e.floor+Hi+o.id;if(this.pointMap.set(a,o),this.nodeMap.set(""+o.floor+Hi+o.nodeId,a),o.type==="straightLadder"){let l=this.straightLadderMap.get(o.name)||[];l.push(Ga({},o)),this.straightLadderMap.set(o.name,l)}if(o.type==="staircase"){let l=this.staircaseMap.get(o.name)||[];l.push(Ga({},o)),this.staircaseMap.set(o.name,l)}if(o.type==="escalator"){let l=this.escalatorMap.get(o.name)||{};o.escalatorDirection==="exit"?l.end={floor:o.floor,id:o.id}:l.start={floor:o.floor,id:o.id},this.escalatorMap.set(o.name,l)}if(o.type==="facility"){let l=this.facilityMap.get(o.targetId)||[];l.push(Ga({},o)),this.facilityMap.set(o.targetId,l)}}),e.lines.filter(o=>o.direction!=="no").forEach(o=>{var a,l;let h=""+e.floor+Hi+o.from,f=""+e.floor+Hi+o.to,p=(a=this.pointMap.get(h))==null?void 0:a.cds,d=(l=this.pointMap.get(f))==null?void 0:l.cds;if(p!=null&&p.length&&(d!=null&&d.length)){let g=ks(p,d);this.addLineItem(h,f,g),o.direction==="double"&&this.addLineItem(f,h,g)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(t,e,o,a){a===void 0&&(a=this.lineMap);let l=a.get(t)||new Map;l.set(e,o),a.set(t,l)}addFacilityToLineMap(t,e,o,a){[...this.straightLadderMap,...this.staircaseMap].forEach(l=>{let[h,f]=l;if(!(f.length<2))for(let g=0;g<f.length;g++){let x=""+f[g].floor+Hi+f[g].id;for(let v=0;v<f.length;v++)if(g!==v){var p,d;let S=""+f[v].floor+Hi+f[v].id,b=(p=this.pointMap.get(x))==null?void 0:p.cds,T=(d=this.pointMap.get(S))==null?void 0:d.cds;if(b!=null&&b.length&&(T!=null&&T.length))if(f[g].type==="straightLadder"){let _=e;this.addLineItem(x,S,_,a)}else{let _=o;this.addLineItem(x,S,_,a)}}}}),this.escalatorMap.forEach((l,h)=>{if(l.start&&l.end){var f,p;let d=""+l.start.floor+Hi+l.start.id,g=""+l.end.floor+Hi+l.end.id,x=(f=this.pointMap.get(d))==null?void 0:f.cds,v=(p=this.pointMap.get(g))==null?void 0:p.cds;if(x!=null&&x.length&&(v!=null&&v.length)){let S=t;this.addLineItem(d,g,S,a)}}})}initBaseRoute(){let t=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,t),this.baseRoute=new Oo.default(t)}initEscalatorRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new Oo.default(t)}initStraightLadderRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new Oo.default(t)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility?!0:this.checkStart(t)}transformStart(t){var e;if(t.nodeId){let o=this.nodeMap.get(""+t.floor+Hi+t.nodeId);if(o){let[a,l]=o.split(Hi);return{floor:a,id:l}}}if((e=t.coord)!=null&&e.length){let o=this.roadInfo.find(l=>l.floor===t.floor);if(!o)return null;let a=o.points.reduce((l,h)=>{let f=ks(t.coord,h.cds);return f<l.min&&(l.min=f,l.point=h),l},{min:1/0,point:o.points[0]});return{floor:a.point.floor,id:a.point.id}}return null}transformEnd(t){if(t.floor){let e=this.transformStart(t);if(e)return e}if(t.facility){let e=this.facilityMap.get(t.facility);if(e!=null&&e.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o){if(o===void 0&&(o=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let a=this.transformStart(t);if(!a)return"no-start";let l=this.transformEnd(e);if(!l)return"no-end";let h=this.getBasePath.bind(this);switch(o){case"escalator":h=this.getEscalatorPath.bind(this);break;case"straightLadder":h=this.getStraightLadderPath.bind(this);break;default:h=this.getBasePath.bind(this);break}if(l.id)return h(a,l);if(l.facility){let f=this.facilityMap.get(l.facility).filter(d=>l.floor?d.floor===l.floor:!0);if(!f.length)return null;let p=f.map(d=>h(a,{floor:d.floor,id:d.id})).filter(d=>!!d);return p.reduce((d,g)=>{let x=g.reduce((v,S)=>v+x0(S.points),0);return x<d.distance&&(d.distance=x,d.path=g),d},{distance:1/0,path:p[0]}).path}}getRoutePath(t,e,o){let a=""+t.floor+Hi+t.id,l=""+e.floor+Hi+e.id,h=o.path(a,l);if(!h)return null;let f=[];return h.map(p=>{let d=this.pointMap.get(p);if(d){var g;let{floor:x}=d;if(((g=f[f.length-1])==null?void 0:g.floor)===x){let v=f[f.length-1];v.points.push(d.cds),v.endType=d.type,v.destId=d.nodeId,v.distance=x0(v.points)}else f.push({floor:x,points:[d.cds],endType:d.type,destId:d.nodeId,distance:0})}}),f}getBasePath(t,e){return this.getRoutePath(t,e,this.baseRoute)}getEscalatorPath(t,e){return this.getRoutePath(t,e,this.escalatorRoute)}getStraightLadderPath(t,e){return this.getRoutePath(t,e,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new Oo.default,this.escalatorRoute=new Oo.default,this.straightLadderRoute=new Oo.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.staircaseMap=new Map,this.lineMap=new Map,this.baseRoute=new Oo.default,this.escalatorRoute=new Oo.default,this.straightLadderRoute=new Oo.default}};var Cat=yn(Dc(),1),Pat=yn(Fp(),1);var r4=yn(lT(),1);function i4(r,t,e){let o=iT(r,t,e);return 180-Math.abs(o)<15?"front":o>135?"right_front":o<-135?"left_front":o<=135&&o>=60?"right":o>=-135&&o<=-60?"left":o<60&&o>0?"right_back":o>-60&&o<0?"left_back":"front"}function cT(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let t=[{direction:"start",distance:ks(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let o=i4(r[e-2],r[e-1],r[e]);if(o==="front"){let a=t[t.length-1],l=ks(r[e-1],r[e]);a.distance+=l,e!==2&&a.points.push(r[e-1])}else t.push({direction:o,distance:ks(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}var Gat=yn(UT(),1),kat=yn(kc(),1);function BT(r){return r.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function zT(r){let t={};for(let o in r)o.startsWith("on")&&(t[BT(o.slice(2))]=r[o]);let e=o=>oc(this,null,function*(){let{data:a}=o;if(t[a.type])try{let l=yield t[a.type](a.data);self.postMessage({type:""+a.type+"_result",key:a.key,data:l})}catch(l){self.postMessage({type:""+a.type+"_result",key:a.key,error:l})}else self.postMessage({type:""+a.type+"_result",key:a.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var C0=new zh;zT({onSetRoadInfo(r){let{roadData:t}=r;C0.initRoute(t)},onGetPath(r){let{start:t,end:e,type:o}=r;return C0.getPath(t,e,o)},onGetDirectionPath(r){return cT(r)},onClear(){C0.clear()}});
7745
- `],{type:"text/javascript"}),t=URL.createObjectURL(i),e=new Worker(t);return URL.revokeObjectURL(t),e}var uc=class extends q1.EventDispatcher{setRoadData(t){return g(this,null,function*(){this.initRoadStatus=!1,this.dispatchEvent({type:"init-road-status",status:!1}),yield de(this.worker,"set_road_info",{roadData:t}),this.initRoadStatus=!0,this.dispatchEvent({type:"init-road-status",status:!0})})}getPath(t,e,n){return g(this,null,function*(){return n===void 0&&(n=""),new Promise((r,o)=>{let s=()=>{de(this.worker,"get_path",{start:t,end:e,type:n}).then(a=>{a?typeof a=="string"?o(a):r(a):o("no-path")})};if(this.initRoadStatus)s();else{let a=l=>{let{status:u}=l;u&&(this.removeEventListener("init-road-status",a),s())};this.addEventListener("init-road-status",a)}})})}getDirectionPath(t){return de(this.worker,"get_direction_path",t)}dispose(){return g(this,null,function*(){de(this.worker,"clear",""),this.worker.terminate()})}constructor(){super(),this.worker=lc(),this.initRoadStatus=!1}};var s8=f(I(),1),a8=f(We(),1),l8=f(Se(),1),u8=f(be(),1),h8=f(Ye(),1),c8=f(Ie(),1),p8=f(Xe(),1),d8=f(De(),1),f8=f(C(),1);var $1=require("three"),Ka=class extends Gt{setEnable(t){super.setEnable(t),yt(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:n,clientHeight:r}}}=this,o=D(this.startPoint,e,n,r),s=D(this.endPoint,e,n,r),a={x:Math.min(o.x,s.x),y:Math.min(o.y,s.y)},l={x:Math.max(o.x,s.x),y:Math.max(o.y,s.y)},u=this.searchMapInFrustum(a,l);this.dispatchEvent({type:"selected",list:u})}}searchMapInFrustum(t,e){var n;let{context:r}=this;return((n=r.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof tt&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:r,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let m=D(p,r,o,s);return Qe(m,e,n)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let a=t.mesh.geometry.boundingBox;if(!a)return!1;let{min:l,max:u}=a,h=D(l,r,o,s),c=D(u,r,o,s);return!(!Qe(h,e,n)||!Qe(c,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new $1.Frustum,this.onPointerDown=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=r=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o)},this.onPointerUp=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let r=this.getSvgCoordinate(this.startPoint),o=w({},r);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(r.x,o.x),y:Math.min(r.y,o.y)},a=Math.abs(o.x-r.x),l=Math.abs(o.y-r.y);yt(this.rect,s.x,s.y,a,l)}else yt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=He(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var h3={boxSelection:!1,elements:["graphic","poi"]},hc=class extends vt{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.options.boxSelection||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.bmap.context.control.enablePan,this.prevRotateStatus=this.bmap.context.control.enableRotate,this.bmap.context.control.enablePan=!1,this.bmap.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.bmap.context.control.enablePan=!!this.prevPanStatus,this.bmap.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],pois:[...this._poiList],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.bmap.context.container.addEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.addEventListener("pointerup",this.onPointerUp),this.bmap.context.container.addEventListener("pointerout",this.onPointerOut),this.bmap.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.bmap.context.container.removeEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.removeEventListener("pointerup",this.onPointerUp),this.bmap.context.container.removeEventListener("pointerout",this.onPointerOut),this.bmap.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent(),super.dispose()}constructor(t,e={}){super(t),this._list=new Set,this._poiList=new Set,this.downPoint=null,this.isMultipleSelect=!1,this.onPointerDown=n=>{this.downPoint={x:n.offsetX,y:n.offsetY}},this.onPointerUp=n=>{if(!this.downPoint)return;let{offsetX:r,offsetY:o}=n,{x:s,y:a}=this.downPoint;if(Math.sqrt((s-r)**2+(a-o)**2)>3)return;let l=new Set,u=[],h=[];if(this.options.elements.includes("graphic")){let{graphics:c}=this.bmap.context.getGraphicsByDeviceXy(r,o);c.map(p=>l.add(p.options.id)),u.push(...c)}if(this.options.elements.includes("poi")){let c=this.bmap.context.getPoisByDeviceXy(r,o);h.push(...c),c.forEach(p=>{if(!l.has(p.options.id)){var m;let y=((m=this.bmap.context.currentFloor)==null?void 0:m.graphicLayer.graphicMap.get(p.options.id))||null;y&&(l.add(p.options.id),u.push(y))}})}(!this.options.boxSelection||!(Rn?n.metaKey:n.ctrlKey))&&(this._list.clear(),this._poiList.clear()),u.forEach(c=>this._list.add(c)),h.forEach(c=>this._poiList.add(c)),this.selectEnd(),this.downPoint=null},this.onPointerOut=n=>{this.disableBoxSelection()},this.onKeyDown=n=>{Un(n.key)&&this.enableBoxSelection()},this.onKeyUp=n=>{Un(n.key)&&this.disableBoxSelection()},this.onBoxSelected=n=>{let{list:r}=n;this._list.clear(),this._poiList.clear(),r.forEach(o=>{if(this.options.elements.includes("graphic")&&this._list.add(o),this.options.elements.includes("poi")){let s=this.bmap.getPoiById(o.options.id);s&&this._poiList.add(s)}}),this.selectEnd()},this.options=w({},h3,e),this.boxSelection=new Ka(this.bmap.context),this.boxSelection.setEnable(!1),this.registryEvent()}};var A8=f(C(),1),xt=require("lodash");var tT=require("three");var J=function(i){return i.COMPASS="compass",i.DEVICE_MOTION="deviceMotion",i.ACCELERATION="acceleration",i.GPS="gps",i}({});var c3={time:1e3,elements:[J.COMPASS,J.DEVICE_MOTION,J.ACCELERATION,J.GPS]},Wo=class extends tT.EventDispatcher{start(){this.options.elements.some(t=>[J.DEVICE_MOTION,J.COMPASS].includes(t))&&this.listenDeviceOrientation(),this.options.elements.includes(J.ACCELERATION)&&this.listenAcceleration(),this.options.elements.includes(J.GPS)&&this.listenGps(),this.dispatchEvent({type:"start"}),this.dispatchTimer=this.timer.setInterval(()=>{this.dispatchEvent({type:"sensor-data",data:(0,xt.cloneDeep)(this.data)}),this.data=[]},this.options.time)}addDataItem(t){this.data.push(t),this.dispatchEvent({type:"add-data-item",item:t})}listenDeviceOrientation(){Wi?window.addEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.addEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0})}listenAcceleration(){window.addEventListener("devicemotion",this.handleAcceleration,!1)}listenGps(){this.gpsTimer=navigator.geolocation.watchPosition(t=>{this.addDataItem({type:J.GPS,timestamp:Date.now(),res:[t.coords.longitude,t.coords.latitude,t.coords.accuracy]})},t=>{console.log("\u83B7\u53D6gps\u5931\u8D25",t)},{enableHighAccuracy:!0})}checkSensor(){return g(this,null,function*(){return{deviceOrientation:yield this.checkDeviceOrientation()}})}checkDeviceOrientation(){return g(this,null,function*(){var t;if(!Wi)return!0;if(typeof window.DeviceOrientationEvent!="undefined"&&typeof((t=window.DeviceOrientationEvent)==null?void 0:t.requestPermission)=="function")try{var e;return(yield(e=window.DeviceOrientationEvent)==null?void 0:e.requestPermission())==="granted"}catch(n){return!1}return!1})}stop(){window.removeEventListener("devicemotion",this.handleAcceleration,!1),Wi?window.removeEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.removeEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0}),(0,xt.isNil)(this.gpsTimer)||navigator.geolocation.clearWatch(this.gpsTimer),this.dispatchTimer&&this.timer.clearInterval(this.dispatchTimer),this.data=[],this.dispatchEvent({type:"stop"})}constructor(t={}){super(),this.gpsTimer=null,this.data=[],this.timer=new nt,this.dispatchTimer=null,this.addAcceleration=(0,xt.throttle)(e=>{this.addDataItem(e)},20),this.deviceOrientationAbsHandler=(0,xt.throttle)(e=>{let n=Date.now(),{alpha:r,beta:o,gamma:s}=e;if((0,xt.isNil)(r)||(0,xt.isNil)(o)||(0,xt.isNil)(s))return;let a;Wi?a=e.webkitCompassHeading:a=360-r,this.options.elements.includes(J.DEVICE_MOTION)&&this.addDataItem({type:J.DEVICE_MOTION,timestamp:n,res:[r,o,s]}),this.options.elements.includes(J.COMPASS)&&this.addDataItem({type:J.COMPASS,timestamp:n,res:a})},200),this.handleAcceleration=e=>{let n=e.accelerationIncludingGravity;(0,xt.isNil)(n)||(0,xt.isNil)(n.x)||(0,xt.isNil)(n.y)||(0,xt.isNil)(n.z)||this.addAcceleration({type:J.ACCELERATION,timestamp:Date.now(),res:[n.x,n.y,n.z]})},this.options=w({},c3,t)}};var R8=f(I(),1),nT=require("three");var K8=f(C(),1);var Y8=f(C(),1),I8=f(I(),1);function _a(i,t){return 1/Math.sqrt(2*Math.PI*Math.pow(t,2))*Math.exp(-Math.pow(i,2)/(2*Math.pow(t,2)))}function So(i){return(i+360)%360}function eT(i,t){let n=6378137*i*Math.PI/180,r=6378137*Math.log(Math.tan(Math.PI/4+t*Math.PI/180/2));return{x:n,y:r}}function Gi(i,t,e,n){return Math.sqrt(Math.pow(Math.abs(i-e),2)+Math.pow(Math.abs(t-n),2))}var Oa=require("mathjs"),Ca=class{motionModelRotYaw(t){if(!(Math.abs(t)<.001)){this.last_yaw_compass=So(this.last_yaw_compass+t);for(let e=0;e<this.NumParticle;e++){let n=Math.random()*this.yaw_noise_sigma;this.particleX[2][e]=this.particleX[2][e]+t+n,this.particleX[2][e]=So(this.particleX[2][e])}}}motionModelStepLength(t,e){if(t===0)return;for(let r=0;r<this.NumParticle;r++){let o=Math.random()*this.step_noise_sigma;this.particleX[0][r]+=(.65+o)*Math.sin(-this.particleX[2][r]/180*Math.PI),this.particleX[1][r]+=(.65+o)*Math.cos(this.particleX[2][r]/180*Math.PI),e(this.particleX[0][r],this.particleX[1][r])||(this.particleWeight[0][r]*=this.unaccess_weight)}let n=this.particleWeight[0].reduce((r,o)=>r+o,0);this.particleWeight[0]=this.particleWeight[0].map(r=>r/n)}motionModelCompassYaw(t,e){if(e-this.last_compass_time>this.compass_update_interval){let n=360-t;n+=this.delta_yaw,n=So(n),Math.abs(n-this.last_yaw_compass)>60?this.compass_consecutive_offset_count++:this.compass_consecutive_offset_count=0;for(let o=0;o<this.NumParticle;o++){let s=Math.abs(this.particleX[2][o]-n);s>180&&(s=360-s),this.particleWeight[0][o]*=_a(s,this.sigmaCompass)}let r=this.particleWeight[0].reduce((o,s)=>o+s,0);this.particleWeight[0]=this.particleWeight[0].map(o=>o/r),this.setLastCompassTime(e)}}resampling(){if(1/this.particleWeight[0].reduce((e,n)=>e+n*n,0)<this.reSampNumParticle){let e=this.particleWeight[0].reduce((a,l,u)=>a.concat(a[u]+l),[0]),r=this.particleWeight[0].map(()=>1/this.NumParticle).map((a,l)=>a+Math.random()/this.NumParticle),o=[],s=0;for(let a=0;a<this.NumParticle;a++){for(;r[a]>e[s];)s++;o.push(s)}this.particleX=this.particleX.map((a,l)=>o.map(u=>a[u])),this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle)}}update(t,e){for(let r=0;r<this.NumParticle;r++){let o=Gi(this.particleX[0][r],this.particleX[1][r],t.x,t.y);this.particleWeight[0][r]=Math.max(1e-7,this.particleWeight[0][r]*_a(o,e))}let n=this.particleWeight[0].reduce((r,o)=>r+o,0);this.particleWeight[0]=this.particleWeight[0].map(r=>r/n)}updateCar(t,e){let n=t.x-this.xEst[0][0],r=t.y-this.xEst[1][0];for(let s=0;s<this.NumParticle;s++){let a=Gi(this.particleX[0][s],this.particleX[1][s],t.x,t.y);this.particleWeight[0][s]=Math.max(1e-7,this.particleWeight[0][s]*_a(a,e)),this.particleX[0][s]+=n,this.particleX[1][s]+=r}let o=this.particleWeight[0].reduce((s,a)=>s+a,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/o)}getPosInitFlag(){return this.particle_PosInitFlag}getYawInitFlag(){return this.particle_yawInitFlag}setPosInitFlag(t){this.particle_PosInitFlag=t}setYawInitFlag(t){this.particle_yawInitFlag=t}getResultX(){let t=(0,Oa.reshape)(this.particleWeight,[this.NumParticle,1]),e=(0,Oa.multiply)(this.particleX,t);return this.xEst=e,this.xEst[0][0]}getResultY(){return this.xEst[1][0]}getResultYaw(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0]));return this.particleX[2][t]}getEstConfidence(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0])),e=this.particleWeight[0].indexOf(Math.min(...this.particleWeight[0])),n=[this.particleX[0][t],this.particleX[1][t]],r=[this.particleX[0][e],this.particleX[1][e]],o=Gi(n[0],n[1],r[0],r[1]),s=o*.67;return console.log(o,s),s}getParticleNum(){return this.NumParticle}getParticleX(){return this.particleX}setLastCompassTime(t){this.last_compass_time=t}getLastCompassTime(){return this.last_compass_time}initParticlesByPos(t,e,n){if(!this.particle_PosInitFlag){this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle);let r=0;for(;r<this.NumParticle;){let s=(2*Math.random()-1)*this.initial_xy_uncertainty,a=(2*Math.random()-1)*this.initial_xy_uncertainty;n(t+s,e+a)||(this.particleWeight[0][r]*=this.unaccess_weight),this.particleX[0][r]=t+s,this.particleX[1][r]=e+a,r++}let o=this.particleWeight[0].reduce((s,a)=>s+a,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/o),this.particle_PosInitFlag=!0,this.xEst[0][0]=t,this.xEst[1][0]=e,this.xEst[2][0]=0}}initParticlesByCompass(t){console.log("Init compass: "+t);let e=360-t;e+=this.delta_yaw,e=So(e),console.log("Init Yaw: "+e);for(let n=0;n<this.NumParticle;n++){let r=(2*Math.random()-1)*this.initial_yaw_uncertainty;this.particleX[2][n]=e+r}this.particle_yawInitFlag=!0,this.xEst[2][0]=e,this.last_yaw_compass=e,this.compass_consecutive_offset_count=0}constructor(t){this.last_yaw_compass=0,this.compass_consecutive_offset_count=0,this.NumParticle=t.NumParticle,this.reSampNumParticle=t.reSampNumParticle,this.initial_xy_uncertainty=t.initial_xy_uncertainty,this.initial_yaw_uncertainty=t.initial_yaw_uncertainty,this.step_noise_sigma=t.step_noise_sigma,this.yaw_noise_sigma=t.yaw_noise_sigma,this.compass_update_interval=t.compass_update_interval,this.sigmaCompass=t.sigmaCompass,this.delta_yaw=t.delta_yaw,this.sigmaBeacon=t.sigmaBeacon,this.unaccess_weight=t.unaccess_weight,this.particle_PosInitFlag=!1,this.particle_yawInitFlag=!1,this.xEst=[[0],[0],[0]],this.particleX=Array.from({length:3},()=>Array(this.NumParticle).fill(0)),this.particleWeight=Array.from({length:1},()=>Array(this.NumParticle).fill(1/this.NumParticle)),this.last_compass_time=0}};var Z8=f(C(),1),v8=f(I(),1),Fa=class{init(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10+.5,this.max_valley=10-.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.65,this.last_rot=[0,0,0],this.delta_rot=[0,0,0],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0}reset(){this.init()}setInitPose(t){t===void 0&&(t=[0,0]),this.last_px=t[0],this.last_py=t[1],console.info("pdr init pos: "+this.last_px+", "+this.last_py)}setInitYaw(t){t===void 0&&(t=0),this.last_yaw=t}getPos(t,e,n){let r=0;return n.length===3&&(this.delta_yaw=this.getDeltaYawFromRot(t,n)),e.length===3&&(r=this.getStepLength(t,e)),r!==0&&(this.last_px+=this.delta_px,this.last_py+=this.delta_py),[this.last_px,this.last_py]}getDeltaPose(){return[this.delta_px,this.delta_py]}getStepLength(t,e){if(e.length<3)return console.warn("acc data less than 3"),0;let n=!1,r=Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2));if(this.accH_fifo.push(r),this.accH_time_fifo.push(t),this.imuFreUpdate(),this.accH_fifo.length<this.accH_fifo_len+1)n=!1;else{for(;this.accH_fifo.length>=this.accH_fifo_len+1;)this.accH_fifo.shift(),this.accH_time_fifo.shift();let o=this.PVStepDetec(),s=this.FFTStepDetec(),a=this.recheckState(),l=this.accH_time_fifo[Math.floor(this.accH_time_fifo.length*3/4)];Math.abs(this.abnor_start_time)<.001&&this.abnor_fft_detected?this.abnor_start_time=l:this.abnor_fft_detected||(this.abnor_start_time=0),o&&s&&a?(this.step_count+=1,this.last_step_time=l,n=!0):Math.abs(this.abnor_start_time)>.001&&this.abnor_peak_time-this.abnor_start_time>this.abnor_time_threshold&&this.step_count>1&&this.abnor_peak_time-this.last_step_time>1?(this.step_count+=1,this.last_step_time=l,n=!0):(l-this.last_step_time>2&&(this.state_count=0),n=!1)}if(n){let o=this.last_yaw/180*Math.PI;return this.delta_px=this.const_step_length*Math.cos(o),this.delta_py=this.const_step_length*Math.sin(o),this.const_step_length}else return 0}imuFreUpdate(){if(this.accH_time_fifo.length>2&&(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]<0||this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]>10||this.accH_time_fifo[this.accH_time_fifo.length-1]===this.accH_time_fifo[0])&&(console.warn("pdr reset last one time "+this.accH_time_fifo[this.accH_time_fifo.length-1]+" last two time "+this.accH_time_fifo[this.accH_time_fifo.length-2]),this.reset()),this.accH_fifo.length>9||this.fre<15){let t=(this.accH_fifo.length-1)/(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[0]);Math.abs(this.fre-t)>8&&(this.fre=Math.round((t-3)/10)*10,(this.fre<=10||this.fre>=100)&&(console.warn("Frequency Error "+this.fre),this.fre=100),console.debug("Frequency change to "+this.fre),this.accH_fifo_len=Math.floor(1*this.fre)+1)}}recheckState(){return!0}PVStepDetec(){let t=!1,e=this.accH_fifo.slice(Math.floor(this.accH_fifo_len/2)),n=this.accH_time_fifo.slice(Math.floor(this.accH_fifo_len/2)),r=e[Math.floor(e.length/2)],o=n[Math.floor(n.length/2)],s=Math.max(...e),a=Math.min(...e),l=!1,u=!1;return Math.abs(r-a)<.01&&r<this.max_valley&&this.valley_num<=this.peak_num&&(this.last_valley_time===0?u=!0:u=o-this.last_valley_time>this.min_step_time,u&&(this.last_valley_time=o,this.valley_num+=1)),Math.abs(r-s)<.01&&r>this.min_peak&&this.peak_num<=this.valley_num&&(this.last_peak_time===0?l=!0:l=o-this.last_peak_time>this.min_step_time,l&&(this.last_peak_time=o,this.peak_num+=1)),r===s&&r>this.min_peak&&(this.abnor_peak_time=o,this.abnor_peak_accH=r),this.peak_num===this.valley_num&&(l||u)&&(t=!0),t}FFTStepDetec(){return!0}getDeltaYawFromRot(t,e){if(e.length<3)return console.warn("rot data less than 3"),0;let n=[0,0,0];this.last_rot.length===3&&(n=e.map((a,l)=>a-this.last_rot[l]));for(let a=0;a<e.length;a++)n[a]<-180?n[a]+=360:n[a]>180&&(n[a]-=360);let r=.2;this.delta_rot.length===3?this.delta_rot=this.delta_rot.map((a,l)=>r*a+(1-r)*n[l]):this.delta_rot=n,this.last_rot=e,this.delta_yaw=this.delta_rot[0],this.last_yaw+=this.delta_yaw,this.last_yaw=this.limitYaw(this.last_yaw);let o=this.delta_rot.reduce((a,l)=>a+Math.abs(l),0);this.delta_rot_sum_fifo.push(o),this.delta_rot_sum_time_fifo.push(t),Math.abs(this.delta_rot_sum_time_fifo[this.delta_rot_sum_time_fifo.length-1]-this.delta_rot_sum_time_fifo[0])>1&&(this.delta_rot_sum_fifo.shift(),this.delta_rot_sum_time_fifo.shift()),this.delta_yaw_accum+=this.delta_yaw;let s=0;return Math.abs(this.delta_yaw_accum_timestamp-t)>this.delta_yaw_time_threshold?(s=this.delta_yaw_accum,this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=t,s):null}limitYaw(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}constructor(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10.5,this.max_valley=9.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_time_threshold=4,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.85,this.last_rot=[],this.delta_rot=[],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0}};var p3={using_gps:!0},za=class{pfFusionPDRiBeacon(t){let{type:e,timestamp:n,res:r}=t,o=!1;if(this.cacheSensorData.push(t),this.particleFilter.getPosInitFlag()&&this.particleFilter.getYawInitFlag()){if(e===J.ACCELERATION){let s=r,a=this.pdr.getStepLength(n/1e3,s);a!==0&&(this.particleFilter.motionModelStepLength(a,()=>!0),this.particleFilter.resampling(),this.position_count+=1,o=!0)}if(this.using_gps&&e===J.GPS&&(this.last_beacon_time===null||n-this.last_beacon_time>5e3)){let s=this.getGpsPosition(r);o=s!==null,s&&(this.particleFilter.update(s,this.gps_horizontalAccuracy),this.resetParticleFilterDist(s,"gps",r[2]),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0)}if(e===J.DEVICE_MOTION){let s=this.pdr.getDeltaYawFromRot(n/1e3,r);s!==null&&this.particleFilter.motionModelRotYaw(s)}e===J.COMPASS&&this.particleFilter.motionModelCompassYaw(r,n),this.last_pos_time&&n-this.last_pos_time>500&&(this.position_count+=1,o=!0)}else if(!this.particleFilter.getPosInitFlag()&&this.using_gps&&e===J.GPS){if(this.startTime&&Date.now()-this.startTime>3e3){let s=this.getGpsPosition(r);o=s!==null,console.log("gps_pos",s,r),s?(this.particleFilter.initParticlesByPos(s.x,s.y,()=>!0),this.last_pos_time=n,console.log("init Pos by gps success time "+n),this.cacheSensorData.length=0):console.log("init Pos by gps fail time "+n)}}else if(!this.particleFilter.getYawInitFlag()&&e===J.COMPASS){let s=r;this.particleFilter.initParticlesByCompass(s),this.particleFilter.setLastCompassTime(n),console.log("init yaw by compass success time "+n)}return o&&(this.last_pos_time=n),[o,this.particleFilter.getResultX(),this.particleFilter.getResultY()]}setBeaconPosition(t,e){if(this.last_beacon_time=e,this.particleFilter.getPosInitFlag())this.particleFilter.update(t,this.sigmaBeacon);else{this.particleFilter.initParticlesByPos(t.x,t.y,()=>!0);let n=this.cacheSensorData.filter(r=>r.timestamp>e);console.log("\u521D\u59CBsensorData",n),n.map(r=>this.pfFusionPDRiBeacon(r))}return this.resetParticleFilterDist(t),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0,[this.particleFilter.getResultX(),this.particleFilter.getResultY()]}getGpsPosition(t){return t[2]>this.gps_max_horizontalAccuracy?null:eT(t[0],t[1])}resetParticleFilterDist(t,e,n){let r=this.particleFilter.getResultX(),o=this.particleFilter.getResultY(),s=Gi(r,o,t.x,t.y);(e==="gps"?n&&s>n||s>this.GpsMaxEstimateErr:s>this.MaxEstimateErr)?(this.outTrustRegionNum+=1,this.outTrustRegionNum>=this.TrustNum&&(console.info("\u8D85\u51FA\u53EF\u4FE1\u533A\u57DF\uFF0C\u91CD\u7F6E\u7C92\u5B50\u8FC7\u6EE4\u5668\u5230: "+t.x+", "+t.y),this.particleFilter.setPosInitFlag(!1),this.particleFilter.setYawInitFlag(!1),this.outTrustRegionNum=0)):this.outTrustRegionNum=0}constructor(t){this.sigmaBeacon=5,this.gps_horizontalAccuracy=10,this.using_gps=!0,this.last_beacon_time=Date.now(),this.position_count=0,this.gps_max_horizontalAccuracy=20,this.MaxEstimateErr=5,this.GpsMaxEstimateErr=30,this.outTrustRegionNum=0,this.TrustNum=4,this.cacheSensorData=[],this.startTime=null;let e=w({},p3,t);this.using_gps=e.using_gps,this.particleFilter=new Ca({NumParticle:200,reSampNumParticle:.65,initial_xy_uncertainty:12,initial_yaw_uncertainty:100,step_noise_sigma:.5,yaw_noise_sigma:2,compass_update_interval:3e3,sigmaCompass:80,delta_yaw:2,sigmaBeacon:5,unaccess_weight:.7}),this.pdr=new Fa}};var cc=class extends nT.EventDispatcher{checkSensor(){return this.sensor.checkSensor()}start(){this.sensor.start(),this.pdr.startTime=Date.now(),this.sensor.addEventListener("add-data-item",t=>{let{item:e}=t;this.getPositionBySensorItem(e,!this._pause)})}pause(){this._pause=!0}continue(){this._pause=!1}getPositionBySensorItem(t,e){e===void 0&&(e=!0);let[n,r,o]=this.pdr.pfFusionPDRiBeacon(t);return n&&e&&this.dispatchEvent({type:"position",x:r,y:o,_type:t.type===J.GPS?"gps":"pdr"}),[n,r,o]}setBeaconPosition(t,e){let[n,r]=this.pdr.setBeaconPosition(t,e);this.dispatchEvent({type:"position",x:n,y:r,_type:"beacon"})}dispose(){this.sensor.stop()}constructor(t={}){super(),this._pause=!1,this.sensor=new Wo(t.sensor),this.pdr=new za(t.pdr||{})}};var iQ=f(I(),1),rQ=f(C(),1);var V8=f(I(),1),J8=f(C(),1),ut=require("three");var iT={texture_url:pa,lineWidth:8,color:16777215},Ra=class extends ut.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:r}}}}}=this,o=t.map(a=>{let[l,u,h]=a;return D(new ut.Vector3(l,u,h),e,n,r)}).map(a=>{let{x:l,y:u}=a;return[l,u]});return Ft(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new ut.Vector2(t,1)}loadTexture(t){return new Promise((e,n)=>{new ut.TextureLoader().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n]);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return g(this,null,function*(){let e=this.geometry=new Yt;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=ut.RepeatWrapping}let n=this.material=new si({useMap:!0,color:new ut.Color(this.config.color),transparent:!0,resolution:new ut.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:ut.NormalBlending,repeat:new ut.Vector2(this.getRepeat(),1)}),r=this.mesh=new ut.Mesh(e,n);return r.renderOrder=9,this.add(r),r})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=iT,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:r}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,r)}},this.config=Object.assign({},iT,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var rT=require("@tweenjs/tween.js");var et=require("three"),Ua=class extends et.Object3D{getBaseScale(t){let{clientSize:{width:e,height:n},camera:r}=this.bmap.context,o=new et.Box3().setFromObject(t),{max:s,min:a}=o,l=new et.Vector3(a.x,s.y,s.z),u=new et.Vector3(s.x,s.y,s.z),h=new et.Vector3(s.x,a.y,a.z),c=new et.Vector3(a.x,a.y,a.z),p=D(l,r,e,n),m=D(u,r,e,n),y=D(c,r,e,n),M=D(h,r,e,n),A=new et.Box2().setFromPoints([new et.Vector2(p.x,p.y),new et.Vector2(m.x,m.y),new et.Vector2(y.x,y.y),new et.Vector2(M.x,M.y)]).getSize(new et.Vector2),W=40/A.x,X=40/A.y,v=Math.min(W,X),Z=r.zoom;return v*Z}registryEvent(){this.bmap.context.addEventListener("update",this._update),this.bmap.context.addEventListener("control-zoom-change",this._onChangeZoom)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this._update),this.bmap.context.removeEventListener("control-zoom-change",this._onChangeZoom)}printGraph(t){console.group(" <"+t.type+"> "+t.name),t.children.forEach(e=>this.printGraph(e)),console.groupEnd()}setClips(t){this.clearClips(),t.length&&(this.mixer=new et.AnimationMixer(this.model.scene),t.forEach(e=>this.mixer.clipAction(e).play()))}startClips(){var t;this.setClips(((t=this.model)==null?void 0:t.animations)||[])}clearClips(){this.mixer&&(this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.mixer.getRoot()),this.mixer=null)}dispose(){this.unRegistryEvent(),this.clearClips(),this.clear(),this.model&&it(this.model.scene),this.bmap=null}constructor(t,e){super(),this.bmap=t,this.group=new et.Object3D,this.mixer=null,this.previewTime=0,this.basicScale=1,this._update=()=>{let n=Date.now();if(!this.previewTime)this.previewTime=n;else{var r;let o=n-this.previewTime;this.previewTime=n,(r=this.mixer)==null||r.update(o/1e3)}},this._onChangeZoom=n=>{let{zoom:r}=n;var o;let s=this.basicScale/r;(o=this.model)==null||o.scene.scale.set(s,s,s)},this.add(this.group),Dt.loadModel(e,!1).then(n=>{this.model=n;let r=this.getBaseScale(n.scene);this.basicScale=r;let o=this.bmap.context.camera.zoom;n.scene.scale.set(r/o,r/o,r/o),this.group.add(n.scene),this.setClips(n.animations),this.group.rotation.set(Math.PI/2,Math.PI,0),this.dispatchEvent({type:"loaded"})}),this.registryEvent()}};var bo=require("three"),oT=require("lodash");var pc=class extends vt{registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate)}pauseAnimation(){this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue()}clearTween(){this.tweenUtil.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate)}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.movedDistance=0,this.clearTween()),this.startModel&&(this.startModel.visible=!1),this.translatePath=null}addPath(t){this.paths=t;let e=t.map(n=>w({},n,{points:this.translatePoints(n.points)}));if(this.clearTween(),this.movedDistance=0,this.bmap.currentBuildGround)this.renderPath(e);else{let n=()=>{this.bmap.removeEventListener("center-change",n),this.renderPath(e)};this.bmap.addEventListener("center-change",n)}this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,n]=this.bmap.buildingCenter;return t.map(r=>[r[0]-e,r[1]-n])}renderPath(t){if(!t.length)return this.clearPath();let e=[];t.forEach((n,r,o)=>{let s=this.catmullRomCurve3(n.points),a=this.mulFloor.floors.find(l=>l.name===n.floor);if(e.push(...s.map(l=>{let[u,h]=l;return[u,h,a.position.z+a.groundMaxHeight]})),r!==o.length-1){let l=this.mulFloor.floors.find(u=>u.name===o[r+1].floor);e.push([...o[r+1].points[0],l.position.z])}}),this.cPath=e,this.animationPathOptions={cPathIndex:0},this.path?this.path.updatePoints(e):(this.path=new Ra(this),this.path.create(e),this.path.position.z=.5,this.bmap.context.scene.add(this.path)),this.startModel&&(this.startModel.position.set(e[0][0],e[0][1],e[0][2]),this.startModel.visible=!0),this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(t){return wr(t,!1,!0,.1,170,2.5)}getPathDirection(t,e){if(t.length<2)return null;let n=ve(t,e),r=t[n],o=t[n+1],s=new bo.Vector3(o[0]-r[0],o[1]-r[1],0).normalize(),a=new bo.Vector3(0,1,0).normalize(),l=s.angleTo(a),u=new bo.Vector3().crossVectors(a,s);return(Object.is(u.y,0)?-1:1)*l}startSimulation(t){return g(this,null,function*(){t===void 0&&(t=1);let{paths:e,movedDistance:n}=this;if(!e.length)return;let r=e.reduce((s,a)=>s+a.distance,0);if(!r||n>=r)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let o=r/t;return this.startModel.startClips(),new Promise(s=>{let a=this.simulationTween=new rT.Tween({distance:this.movedDistance},this.tweenUtil.group).to({distance:r},o*1e3).onUpdate(l=>{var u;this.movedDistance=l.distance;let h=l.distance,c=0;for(let A=0;A<e.length;A++)if(e[A].distance>=h){c=A;break}else h-=e[A].distance;let p=Gn(e[c].points,h);if(p===null)return;this.currentPathPosition=p;let m=this.translatePoints([p])[0],y=this.mulFloor.floors.find(A=>A.name===e[c].floor),M=y?y.position.z+y.groundMaxHeight:(u=this.startModel)==null?void 0:u.position.z;this.startModel&&this.startModel.position.set(m[0],m[1],M);let j=this.getPathDirection(e[c].points,p);(0,oT.isNil)(j)||this.startModel.setRotationFromAxisAngle(new bo.Vector3(0,0,1),j)}).onComplete(()=>{this.tweenUtil.remove(a),this.startModel.clearClips(),s(!0)}).start()})})}setStartPoiRotate(t){if(this.startPoi){let n=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(360-t-n)%360}}dispose(){super.dispose(),this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.startModel&&(this.bmap.context.scene.remove(this.startModel),this.startModel.dispose()),this.tweenUtil.dispose(),this.unRegistryEvent()}constructor(t,e){super(t),this.mulFloor=e,this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.pathTween=null,this.startPoi=null,this.movedDistance=0,this.tweenUtil=new qe,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onUpdate=()=>{this.tweenUtil.update()},this.startModel=new Ua(t,o1),this.startModel.visible=!1,this.bmap.context.scene.add(this.startModel),this.registryEvent()}};var Na=require("three");var dc=class extends vt{registryEvent(){this.clickHelper.addEventListener("click",this._click)}unRegistryEvent(){this.clickHelper.removeEventListener("click",this._click)}dispose(){this.unRegistryEvent(),this.clickHelper.dispose(),super.dispose(),this.mulFloors=null}constructor(t,e){super(t),this.mulFloors=e,this._click=n=>{let{e:r}=n;if(!this.mulFloors.showStatus)return;let o=new Na.Vector2,{offsetX:s,offsetY:a}=r,{clientSize:l}=this.bmap.context;o.x=s/l.width*2-1,o.y=a/l.height*-2+1;let u=new Na.Raycaster;u.setFromCamera(o,this.bmap.context.camera),u.ray.origin.sub(u.ray.direction.clone().multiplyScalar(1e4));let c=this.mulFloors.poiLayer.pois.map(m=>{if(!m.canSelect)return null;let y=u.intersectObjects(m.children,!0);return y.length?y[0]:null}).reduce((m,y)=>y&&(!m||y.distance<m.distance)?y:m,null),p=c==null?void 0:c.object;c&&c.object.isSprite&&(p=c.object.parent),p&&p instanceof st&&this.dispatchEvent({type:"select",pois:[p]})},this.clickHelper=new br(this.bmap.context.container),this.registryEvent()}};var IQ=f(sT(),1),XQ=f(aT(),1),DQ=f(C(),1),uT=require("three");var AQ=f(I(),1),TQ=f(C(),1),wQ=f(ws(),1),ki=require("three");function j3(i){let t=i.length,e=0,n=0,r=0,o=0;i.forEach(l=>{e+=l[0],n+=l[1],r+=l[0]*l[1],o+=l[0]*l[0]});let s=(t*r-e*n)/(t*o-e*e),a=(n-s*e)/t;return{m:s,b:a}}function g3(i,t,e){let n=e[0][0],r=e.slice(-1)[0][0],o=i*n+t,s=i*r+t;return{start:[n,o],end:[r,s]}}function Yo(i){if(i.length<2)return null;let t=i.filter((l,u)=>{let h=[...i];return h.splice(u,1),h.every(c=>c[0]!==l[0]&&c[1]!==l[1])});if(t.length<2)return null;let{m:e,b:n}=j3(t),{start:r,end:o}=g3(e,n,t),a=360-(new ki.Vector2().subVectors(new ki.Vector2(o[0],o[1]),new ki.Vector2(r[0],r[1])).angle()/Math.PI*180-90+360)%360;return Number.isNaN(a)?null:a}function A3(i){let t=[];for(let e=1;e<i.length;e++){let n=i[e-1],r=i[e],o=r.position[0]-n.position[0],s=r.position[1]-n.position[1],a=Math.sqrt(o**2+s**2),l=r.time-n.time;if(l>0){let u=a/l;console.log("speedDelta",n.type,r.type,Ga(u),a,l),t.push(u)}else t.push(0)}return t}function T3(i,t){let e=i[0],n=i.slice(-1)[0],r=U(n.position,e.position),o=n.time-e.time;return o<100||r<3?null:r/o}function Ga(i){return i*60*60}function Vi(i,t,e,n){let r=(e+90)%360*(Math.PI/180),o=t*n,s=new ki.Vector2(i[0],i[1]),a=Math.cos(r),l=Math.sin(r),u=new ki.Vector2(a,l);return s.add(u.normalize().multiplyScalar(o)),[s.x,s.y]}function w3(i){let t=[...i].sort((u,h)=>u-h),e=lT(t,25),n=lT(t,75),r=n-e,o=e-1.5*r,s=n+1.5*r,a=t.filter(u=>u>=o&&u<=s);return i.filter(u=>a.includes(u))}function lT(i,t){let e=t/100*(i.length-1),n=Math.floor(e),r=Math.ceil(e);if(n===r)return i[n];let o=e-n;return i[n]*(1-o)+i[r]*o}var ka=class{filter(t){let e=this.estimate,n=this.errorEstimate+this.processNoise,r=n/(n+this.measurementNoise);return this.estimate=e+r*(t-e),this.errorEstimate=(1-r)*n,this.estimate}constructor(t={}){this.estimate=0,this.errorEstimate=1,this.processNoise=.1,this.measurementNoise=1,this.measurementNoise=t.measurementNoise||1,this.processNoise=t.processNoise||.1,this.errorEstimate=t.errorEstimate||1}};var Io=require("lodash"),fc=class extends uT.EventDispatcher{setPathAngle(t){this.pathAngle=t,this.dispatchEvent({type:"change-compass",value:this.pathAngle}),(0,Io.isNil)(this.angle)&&(this.angle=t)}changeSpeed(){let t=this.history.filter(l=>["vision"].includes(l.type));if(t.length<2){this.speedFilter.filter(0),this.speed=0;return}let e=t[0],n=t.slice(-1)[0],r=U(n.position,e.position),o=n.time-e.time,s=o>0?r/o:0,a=this.speedFilter.filter(s);this.speed=a}changeAngle(t){t===void 0&&(t=this.visionHistory),t.length<2&&(this.angle=null);let e=Yo(t.map(n=>n.position));e!==null&&this.setAngle(e)}setAngle(t,e){e===void 0&&(e=!0),this.angle=t,e&&this.dispatchEvent({type:"change-position-compass",value:t})}setPosition(t,e,n){let r={position:t,time:e,clientTime:Date.now()-n,type:"vision"};if(this._setVisionHistoryForAngle(r),(0,Io.isNil)(this.angle)||!this.speed){this.addHistory(r);return}let o=this.history.findLastIndex(a=>a.type==="vision"),s=this.history[o];if(s){if(s.time>e)return;let a=Yo([this.history.slice(-1)[0].position,t]);if(a&&Math.abs(a-this.angle)<60){this.addHistory(r);return}let l=Vi(t,this.speed,360-this.pathAngle,n);U(l,this.history.slice(-1)[0].position)>10?this.visionExcessesCount++:this.visionExcessesCount=0,this.visionExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21\u89C6\u89C9\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528\u89C6\u89C9\u6821\u51C6"),this.addHistory(r),this.visionExcessesCount=0)}}resetPdrPosition(){let t=this.history.findLast(e=>e.type==="vision");if(t&&this.speed){let e=Vi(t.position,this.speed,360-this.pathAngle,Date.now()-t.clientTime);e&&this.history.push({position:e,time:Date.now(),clientTime:Date.now(),type:"pdr"})}}getLastVisionPdrPos(){let t=this.history.findLastIndex(n=>n.type==="vision");if(t!==-1){var e;return(e=this.history[t+1])!=null?e:this.history[t]}return null}_setVisionHistoryForAngle(t){if(!this.visionHistory.length){this.visionHistory.push(t);return}let e=Yo([this.visionHistory.slice(-1)[0].position,t.position]);if(e!==null&&(this.angle&&Math.abs(this.angle-e)>60?this.angleExcessesCount++:(this.angleExcessesCount=0,this.visionHistory.push(t))),this.angleExcessesCount>3)console.warn("\u8FDE\u7EED\u4E09\u6B21\u89D2\u5EA6\u6BD4\u8F83\u6B6A\uFF0C\u91CD\u65B0\u77EB\u6B63"),this.visionHistory=[t],this.angleExcessesCount=0;else{let n=U(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position);for(;n>5&&this.visionHistory.length>15;)this.visionHistory.shift(),n=U(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position)}this.changeAngle()}addHistory(t){this.history.push(t);let e=this.history.filter(a=>a.type==="vision"),n=e.length?Date.now()-e.slice(-1)[0].clientTime:0,r=U(this.history[0].position,this.history.slice(-1)[0].position),o=n>5e3?10:3,s=n>5e3?0:5;for(n>5e3&&console.warn("\u89C6\u89C9\u7ED3\u679C\u8D85\u51FA5s\u4E0D\u53EF\u7528\uFF0C\u5168\u90E8\u6E05\u7A7A");e.length>s&&r>o;)this.history.shift(),e=this.history.filter(a=>a.type==="vision"),r=U(this.history[0].position,this.history.slice(-1)[0].position);s===0?this.changeSpeed():t.type==="vision"&&this.changeSpeed(),this.changePosition(t.type)}setBeaconPosition(t,e,n){let r=Date.now()-n,o={position:t,time:e,clientTime:r,type:"beacon"},s=this.history.findLastIndex(h=>h.type!=="pdr"),a=this.history[s];if(!a){this.addHistory(o);return}if((0,Io.isNil)(this.pathAngle)||!this.speed){this.addHistory(o);return}if(a&&a.time>e)return;let l=Vi(t,this.speed,360-this.pathAngle,n);U(l,this.history.slice(-1)[0].position)>5?this.beaconExcessesCount++:this.beaconExcessesCount=0,this.beaconExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21beacon\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528beacon\u6821\u51C6"),this.addHistory(o),this.beaconExcessesCount=0)}startPositionTimer(){this.positionTimer&&this.timer.clearInterval(this.positionTimer),this.positionTimer=this.timer.setInterval(()=>{this.changePosition()},20)}changePosition(t){t===void 0&&(t="pdr");let e=this.getPosition(t);e.success&&(this.history.push({position:e.pos,time:Date.now(),clientTime:Date.now(),type:"pdr"}),this.speed?this.dispatchEvent({type:"change-pos",value:w({},e)}):this.dispatchEvent({type:"change-pos",value:e}))}getPosition(t){if(this.history.length===0)return{success:!1,pos:[0,0],compass:null,speed:0};let e=this.history.slice(-1)[0];if(this.history.length<2)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};if((0,Io.isNil)(this.pathAngle)||!this.speed)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};let n=e.clientTime,r=Date.now()-n;return{success:!0,pos:this.pathAngle?Vi(e.position,this.speed,360-this.pathAngle,r):e.position,compass:this.pathAngle,speed:Ga(this.speed)}}dispose(){this.timer.dispose()}constructor(){super(),this.history=[],this.visionHistory=[],this.speed=0,this.angle=null,this.timer=new nt,this.positionTimer=null,this.speedFilter=new ka,this.visionExcessesCount=0,this.beaconExcessesCount=0,this.angleExcessesCount=0,this.pathAngle=0,this.startPositionTimer()}};function mc(i,t){return g(this,null,function*(){let{brand:e,project:n}=i,{apiDomain:r,apiPath:{floorRange:o},apiInfo:s}=t,a=""+r+o+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n;return yield fetch(a,s).then(u=>u.json()).then(u=>u.data).then(u=>{let h=(u||[])[0];return h&&(h.info=JSON.parse(h.info)),h})})}function yc(i,t){return g(this,null,function*(){let{brand:e,project:n,floor:r,ts:o,resource_type_list:s}=i,{apiDomain:a,apiPath:{floorGraphic:l},apiInfo:u}=t,h=""+a+l+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+r+"&ts="+o+"&resource_type_list="+s;return yield fetch(h,u).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(m=>m.info=JSON.parse(m.info)),p||[]))})}function W3(i,t){return g(this,null,function*(){let{project:e,floor:n}=i,{apiDomain:r,apiInfo:o}=t,s=r+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+n;return yield fetch(s,o).then(l=>l.json()).then(l=>l.data).then(l=>JSON.parse(l[0].streetInfo||"{}")).then(l=>l.fileId?S3(l.fileId,t):null)})}function S3(i,t){return g(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+i,n).then(r=>r.arrayBuffer()).then(r=>{let s=new TextDecoder("utf-8").decode(r);return s?JSON.parse(s):null})})}var VQ=f(I(),1);var ge;function hT(i,t){return i===void 0&&(i="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(ge)return e({db:ge,type:"success"});let r=indexedDB.open(i,t);r.onupgradeneeded=function(o){ge=o.target.result,console.log("onupgradeneeded"),e({db:ge,type:"onupgradeneeded"})},r.onsuccess=o=>{ge=o.target.result,e({db:ge,type:"success"})},r.onerror=o=>{n(o)}})}function Pc(i,t,e){return e===void 0&&(e=ge),new Promise((n,r)=>{e||r("\u6CA1\u6709db");let s=e.transaction([i],"readonly").objectStore(i).get(t);s.onsuccess=()=>{s.result?n(s.result.value):n(null)},s.onerror=a=>{console.log("[getVersionByKey]",a),n(null)}})}function cT(i,t,e,n){return n===void 0&&(n=ge),new Promise((r,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>g(this,null,function*(){let l=yield Pc(i,t),u=n.transaction([i],"readwrite").objectStore(i),h=l!==null?u.put({key:t,value:e}):u.add({key:t,value:e});h.onsuccess=function(c){s(c)},h.onerror=function(c){a(c)}}))))}function ai(i,t){t===void 0&&(t=ge),t&&(t.objectStoreNames.contains(i)||t.createObjectStore(i,{keyPath:"key"}))}function pT(i){i===void 0&&(i=ge),i==null||i.close(),ge=null}var Ja=require("three");var zQ=f(C(),1),RQ=f(I(),1);function dT(i,t,e){switch(i.l_type){case"graph":return b3(i,t);case"wall":return Y3(i,t);case"lane":return I3(i,t);case"texture2d":case"texture3d":return X3(i,t);case"glb":return D3(i,t);case"store":return Z3(i,t);case"facility":return v3(i,t);case"parkingSpace":return x3(i,t,e);case"text":return E3(i,t)}}function b3(i,t){let e=t.userData.center;At(i.elements,e);let n=[];i.elements.forEach(o=>{o.group==="ground"?t.createGround(o):n.push(o)});let r=n.reduce((o,s)=>{let{fillColor:a,fillOpacity:l,strokeColor:u,strokeOpacity:h,height:c,airHeight:p}=s,m=a.toLowerCase()+"-"+l+"-"+u.toLowerCase()+"-"+h+"-"+c+"-"+p;return h===0&&(m=a.toLowerCase()+"-"+l+"-"+c+"-"+p),o[m]?o[m].push(s):o[m]=[s],o},{});Object.values(r).forEach(o=>{let s=new ii(t.context,o);t.mergeGraphicLayer.add(s)})}function Y3(i,t){let e=t.userData.center;At(i.elements,e);let n=i.elements.reduce((r,o)=>{let{fillColor:s,fillOpacity:a,strokeColor:l,strokeOpacity:u,height:h}=o,c=s.toLowerCase()+"-"+a+"-"+l.toLowerCase()+"-"+u+"-"+h;return u===0&&(c=s.toLowerCase()+"-"+a+"-"+h),r[c]?r[c].push(o):r[c]=[o],r},{});Object.values(n).forEach(r=>{let o=new Po(t.context,r);t.wallLayer.add(o)})}function I3(i,t){let e=t.userData.center;At(i.elements,e);let n=i.elements.reduce((r,o)=>{let{fillColor:s,fillOpacity:a,strokeColor:l,strokeOpacity:u}=o,h=s.toLowerCase()+"-"+a+"-"+l.toLowerCase()+"-"+u;return u===0&&(h=s.toLowerCase()+"-"+a),r[h]?r[h].push(o):r[h]=[o],r},{});Object.values(n).forEach(r=>{let o=new jo(t.context,r);t.laneLayer.add(o)})}function X3(i,t){let e=t.userData.center;if(At(i.elements,e),i.elements.length){let n=new ni(t.context,i.elements);t.textureLayer.add(n)}}function D3(i,t){let e=t.userData.center;At(i.elements,e),i.elements.forEach(n=>{let r=new Mo(t.context,w({},n,{url:n.secondUrl,rotate:n.secondRotate,width:n.secondWidth,center_x:n.center_coord_x,center_y:n.center_coord_y}));t.glbModelLayer.add(r)})}function Z3(i,t){let e=t.userData.center;At(i.elements,e),i.elements.map(n=>{let r=t.addGraphic(n);t.userData.graphics.push(r),t.userData.graphicMap.set(n.id,r);try{let o=new st(t.context,{id:n.id,icon:n.poi_info.icon,text:n.poi_info.showName||n.store_name||n.poi_info.text,position:{x:n.center_coord_x,y:n.center_coord_y,z:n.airHeight+n.height},icon_size:[24,24],level:n.poi_info.level||0});t.poiLayer2.pushPoi(o),o&&(o.userData.type="store",o.userData.data=n,o.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,n)}})}function v3(i,t){let e=t.userData.center;At(i.elements,e),i.elements.map(n=>{let r=t.addGraphic(n);if(t.userData.graphics.push(r),t.userData.graphicMap.set(n.id,r),n.poi_info){let o=new st(t.context,{id:n.id,icon:n.poi_info.icon,text:n.poi_info.showName||n.store_name||n.poi_info.text,position:{x:n.center_coord_x,y:n.center_coord_y,z:n.airHeight+n.height},icon_size:[24,24],level:n.poi_info.level||0});t.poiLayer2.pushPoi(o),o.userData.type="facility",o.userData.data=n,o.userData.floor=t.name}else console.log("\u6DFB\u52A0facility\u5931\u8D25\u6CA1\u6709poi_info",n)})}function x3(i,t,e){let n=t.userData.center;At(i.elements,n),t.parkingSpaceLayer.createParkings(i.elements,e.mergeParkingSpace),i.elements.forEach(r=>{if(r.texts[0]){let o=new st(t.context,{id:r.id,text:r.texts[0],position:{x:r.center_coord_x,y:r.center_coord_y,z:r.airHeight+r.height}});o&&(o.userData.type="parkingSpace",o.userData.data=r,o.userData.floor=t.name),t.poiLayer2.pushPoi(o)}}),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function E3(i,t){let e=t.userData.center;At(i.elements,e);let n=new go(t.context,i.elements.map(r=>w({},r,{center_x:r.center_coord_x,center_y:r.center_coord_y})));t.textTextureLayer.add(n)}var Mc="map_version",jc="route_version",gc="facility_version",Ac="map_data",Va="road_network_data",Tc="facility_data",K3={mergeParkingSpace:!0},wc=class extends Ja.EventDispatcher{initDb(){return g(this,null,function*(){try{let{db:t,type:e}=yield hT("aibee_map",2);e==="onupgradeneeded"&&(ai(Mc),ai(jc),ai(gc),ai(Ac),ai(Va),ai(Tc)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t){return g(this,null,function*(){if(Array.isArray(t))this.floors=t;else{let e=yield fetch(t).then(n=>n.json());e.code==="0"&&(this.floors=e.data.list)}})}setCacheData(t,e,n){return this.initDbPromise.then(()=>cT(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>Pc(t,""+e,this.db))}getFloorCacheKey(t){return""+t.floor_id}getFloorData(t){return g(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return g(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}getFloorJsonDataByFloorInfo(t){return g(this,null,function*(){let e=this.getFloorCacheKey(t);console.time("zstd_json");let n=yield fetch(t.map_url).then(r=>r.json());return n.floor=t.floor,console.timeEnd("zstd_json"),this.setCacheData(Ac,e,n),this.setCacheData(Mc,e,t.version_id),n})}getFloorJsonData(t){return g(this,null,function*(){let e=this.floors.find(r=>r.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(Mc,n))===e.version_id){let o=yield this.getCacheData(Ac,n);if(o)return o}return this.getFloorJsonDataByFloorInfo(e)}catch(r){return console.log("[get floor data error]",r),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return g(this,null,function*(){return(yield Promise.all(this.floors.map(e=>g(this,null,function*(){let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(jc,n))===e.version_id){let s=yield this.getCacheData(Va,n);if(s)return s}let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Va,n,o),this.setCacheData(jc,n,e.version_id),o}catch(r){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Va,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return g(this,null,function*(){let t=this.floors.reduce((r,o)=>r.updated_at>o.updated_at?r:o,this.floors[0]);if(!t)return null;let e=this.getFloorCacheKey(t),n=()=>g(this,null,function*(){let r=yield fetch(t.entry_infra_url).then(o=>o.json());return r&&(this.setCacheData(Tc,e,r),this.setCacheData(gc,e,t.version_id)),r});try{if((yield this.getCacheData(gc,e))===t.version_id){let o=yield this.getCacheData(Tc,e);if(o)return o}return n()}catch(r){return console.log("[get facility error]",r),n()}})}getOtherDataByFreeTime(){return g(this,null,function*(){})}getMulFloorsData(t){return g(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return g(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e){return g(this,null,function*(){return e=this.getFloorBaseLayer(t,e),yield this.getFloorContentLayer(t,e),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new Ja.Vector3),r=Math.max(n.x,n.y,n.z);e.userData.height=r/4+t.floorHeight}switchFloor(t){return g(this,null,function*(){return new Promise(e=>{let n={run:()=>this._switchFloor(t),meta:{type:"switchFloor"}},r=this.taskQueue.replaceByMetaType(n),o=s=>{let{task:a,res:l}=s;a.tid===r&&(this.taskQueue.removeEventListener("active-task-end",o),e(l))};this.taskQueue.addEventListener("active-task-end",o)})})}_switchFloor(t){return g(this,null,function*(){var e;let n=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)n=l;else return null}let r=new Nt(this.bmap.context),o=this.floors.find(l=>l.floor===n.floor);var s;let a=(s=o==null?void 0:o.map_angle)!=null?s:0;return this.bmap.dispatchEvent({type:Pt.SWITCH_FLOOR_BEFORE,data:{curFloor:r,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:r,graphics:[]}}),this.bmap.context.control.setAzimuthalAngle(a/180*Math.PI,!0),this.getFloorBaseLayer(n,r),this.changeFloorBox(n,r),this.bmap.buildingCenter=r.userData.center,this.bmap.currentBuildGround=(e=r.userData.data.layers.find(l=>l.l_type==="range"))==null?void 0:e.elements[0],this.bmap.context.switchFloor(r),this.bmap.initialFloorCamera(),yield Ms(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:r,graphics:[]}}),yield this.getFloorContentLayer(n,r),this.changeFloorBox(n,r),this.bmap.initialFloorCamera(),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:r,graphics:r.graphicLayer.children}}),this.bmap.dispatchEvent({type:Pt.SWITCH_FLOOR_AFTER,data:{curFloor:r,graphics:r.graphicLayer.children}}),r})}getFloorBaseLayer(t,e){e||(e=new Nt(this.bmap.context));let n=[0,0];return t.layers.forEach(r=>{switch(r.l_type){case"range":let o=r.elements[0];n=[o.center_x,o.center_y];break;case"ground":At(r.elements,n);let s=r.elements.map(a=>new tt(this.bmap.context,a));e.addGrounds(s);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return g(this,null,function*(){e||(e=new Nt(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let r=0;r<t.layers.length;r++){let o=t.layers[r];["range","ground"].includes(o.l_type)||(dT(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>16&&(yield Ms(),n=Date.now()))}return e})}clear(){return g(this,null,function*(){var t;pT((t=this.db)!=null?t:void 0)})}dispose(){this.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new Vn,this.options=w({},K3,e),this.initDbPromise=this.initDb()}};var t5=f(I(),1);var Wc=class{load(t){return g(this,null,function*(){let e=Nn(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),yc(t,this.bmap.config)]),r=Nn({floor:t.floor,ts:t.ts});At(n.map(s=>s.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(r)||0),n.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let o=this.floorDataLengthMap.get(r)||0;return this.floorDataLengthMap.set(r,o+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return g(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,r=e.userData.graphicMap||new Map,{ground:o,markGraphic:s,graphic:a}=this.bmap.config;for(let l=0;l<t.length;l++){let u=t[l];u.info.group==="ground"?(u.info.fillColor=o.color,u.info.fillOpacity=o.opacity,u.info.height=o.height,u.info.stroke=o.stroke,u.info.strokeColor=o.strokeColor,u.info.strokeOpacity=o.strokeOpacity):u.info.userData.mark?(u.info.height=s.height,u.info.fillColor=s.color,u.info.fillOpacity=s.opacity,u.info.stroke=s.stroke,u.info.strokeColor=s.strokeColor,u.info.strokeOpacity=s.strokeOpacity):(u.info.fillOpacity=a.fillOpacity,this.bmap.config.initTransToMark&&(u.info.height=s.height,u.info.fillColor=s.color,u.info.stroke=s.stroke,u.info.strokeColor=s.strokeColor,u.info.strokeOpacity=s.strokeOpacity))}for(let l of t){if(l.info.group==="ground")e.createGround(l.info);else{let u=e.addGraphic(l.info);u.userData.data=l,n.set(l.legacy_id,u)}r.set(l.element_uuid,l)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=r,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(Pt.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(Pt.SWITCH_FLOOR_AFTER,{curFloor:e,graphics:e.graphicLayer.children})):this.bmap.switchFloorByFloor(e)}filterData(t,e){let n=e.userData.graphicMap||new Map;return t.filter(r=>!n.has(r.element_uuid))}switchFloorByStoreData(t,e){return g(this,null,function*(){let n=yield this.load(w({},t,{resource_type_list:"6"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}switchFloorByOtherData(t,e){return g(this,null,function*(){let n=yield this.load(w({},t,{resource_type_list:"1,2,3,4"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}loadBuildGround(t){return g(this,null,function*(){let{brand:e,project:n}=t,r=yield this.loadBuildingGround({brand:e,project:n});return this.bmap.currentBuildGround=r,this.bmap.changeBuildingCenter(r,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return g(this,null,function*(){let{brand:e,project:n}=t,r=Nn({brand:e,project:n});if(this.buildingGroundMap.has(r))return this.buildingGroundMap.get(r);let o=mc({brand:e,project:n},this.bmap.config).then(s=>(this.buildingGroundMap.set(r,s),s));return this.buildingGroundMap.set(r,o),o})}switchFloor(t){return g(this,null,function*(){let e=new Nt(this.bmap.context);e.userData.graphicMap=new Map,e.name=t.floor;try{yield Promise.all([this.switchFloorByStoreData(t,e),this.switchFloorByOtherData(t,e)])}catch(n){console.log(n)}return e})}dispose(){this.cacheData.clear(),this.floorDataLengthMap.clear(),this.buildingGroundMap.clear()}constructor(t){this.bmap=t,this.cacheData=new Map,this.floorDataLengthMap=new Map,this.buildingGroundMap=new Map,this.externalStreetMap=new Map}};
7745
+ `],{type:"text/javascript"}),t=URL.createObjectURL(i),e=new Worker(t);return URL.revokeObjectURL(t),e}var uc=class extends q1.EventDispatcher{setRoadData(t){return g(this,null,function*(){this.initRoadStatus=!1,this.dispatchEvent({type:"init-road-status",status:!1}),yield de(this.worker,"set_road_info",{roadData:t}),this.initRoadStatus=!0,this.dispatchEvent({type:"init-road-status",status:!0})})}getPath(t,e,n){return g(this,null,function*(){return n===void 0&&(n=""),new Promise((r,o)=>{let s=()=>{de(this.worker,"get_path",{start:t,end:e,type:n}).then(a=>{a?typeof a=="string"?o(a):r(a):o("no-path")})};if(this.initRoadStatus)s();else{let a=l=>{let{status:u}=l;u&&(this.removeEventListener("init-road-status",a),s())};this.addEventListener("init-road-status",a)}})})}getDirectionPath(t){return de(this.worker,"get_direction_path",t)}dispose(){return g(this,null,function*(){de(this.worker,"clear",""),this.worker.terminate()})}constructor(){super(),this.worker=lc(),this.initRoadStatus=!1}};var s8=f(I(),1),a8=f(We(),1),l8=f(Se(),1),u8=f(be(),1),h8=f(Ye(),1),c8=f(Ie(),1),p8=f(Xe(),1),d8=f(De(),1),f8=f(C(),1);var $1=require("three"),Ka=class extends Gt{setEnable(t){super.setEnable(t),yt(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:n,clientHeight:r}}}=this,o=D(this.startPoint,e,n,r),s=D(this.endPoint,e,n,r),a={x:Math.min(o.x,s.x),y:Math.min(o.y,s.y)},l={x:Math.max(o.x,s.x),y:Math.max(o.y,s.y)},u=this.searchMapInFrustum(a,l);this.dispatchEvent({type:"selected",list:u})}}searchMapInFrustum(t,e){var n;let{context:r}=this;return((n=r.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof tt&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:r,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let m=D(p,r,o,s);return Qe(m,e,n)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let a=t.mesh.geometry.boundingBox;if(!a)return!1;let{min:l,max:u}=a,h=D(l,r,o,s),c=D(u,r,o,s);return!(!Qe(h,e,n)||!Qe(c,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new $1.Frustum,this.onPointerDown=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=r=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o)},this.onPointerUp=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let r=this.getSvgCoordinate(this.startPoint),o=w({},r);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(r.x,o.x),y:Math.min(r.y,o.y)},a=Math.abs(o.x-r.x),l=Math.abs(o.y-r.y);yt(this.rect,s.x,s.y,a,l)}else yt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=He(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var h3={boxSelection:!1,elements:["graphic","poi"]},hc=class extends vt{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.options.boxSelection||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.bmap.context.control.enablePan,this.prevRotateStatus=this.bmap.context.control.enableRotate,this.bmap.context.control.enablePan=!1,this.bmap.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.bmap.context.control.enablePan=!!this.prevPanStatus,this.bmap.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],pois:[...this._poiList],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.bmap.context.container.addEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.addEventListener("pointerup",this.onPointerUp),this.bmap.context.container.addEventListener("pointerout",this.onPointerOut),this.bmap.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.bmap.context.container.removeEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.removeEventListener("pointerup",this.onPointerUp),this.bmap.context.container.removeEventListener("pointerout",this.onPointerOut),this.bmap.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent(),super.dispose()}constructor(t,e={}){super(t),this._list=new Set,this._poiList=new Set,this.downPoint=null,this.isMultipleSelect=!1,this.onPointerDown=n=>{this.downPoint={x:n.offsetX,y:n.offsetY}},this.onPointerUp=n=>{if(!this.downPoint)return;let{offsetX:r,offsetY:o}=n,{x:s,y:a}=this.downPoint;if(Math.sqrt((s-r)**2+(a-o)**2)>3)return;let l=new Set,u=[],h=[];if(this.options.elements.includes("graphic")){let{graphics:c}=this.bmap.context.getGraphicsByDeviceXy(r,o);c.map(p=>l.add(p.options.id)),u.push(...c)}if(this.options.elements.includes("poi")){let c=this.bmap.context.getPoisByDeviceXy(r,o);h.push(...c),c.forEach(p=>{if(!l.has(p.options.id)){var m;let y=((m=this.bmap.context.currentFloor)==null?void 0:m.graphicLayer.graphicMap.get(p.options.id))||null;y&&(l.add(p.options.id),u.push(y))}})}(!this.options.boxSelection||!(Rn?n.metaKey:n.ctrlKey))&&(this._list.clear(),this._poiList.clear()),u.forEach(c=>this._list.add(c)),h.forEach(c=>this._poiList.add(c)),this.selectEnd(),this.downPoint=null},this.onPointerOut=n=>{this.disableBoxSelection()},this.onKeyDown=n=>{Un(n.key)&&this.enableBoxSelection()},this.onKeyUp=n=>{Un(n.key)&&this.disableBoxSelection()},this.onBoxSelected=n=>{let{list:r}=n;this._list.clear(),this._poiList.clear(),r.forEach(o=>{if(this.options.elements.includes("graphic")&&this._list.add(o),this.options.elements.includes("poi")){let s=this.bmap.getPoiById(o.options.id);s&&this._poiList.add(s)}}),this.selectEnd()},this.options=w({},h3,e),this.boxSelection=new Ka(this.bmap.context),this.boxSelection.setEnable(!1),this.registryEvent()}};var A8=f(C(),1),xt=require("lodash");var tT=require("three");var J=function(i){return i.COMPASS="compass",i.DEVICE_MOTION="deviceMotion",i.ACCELERATION="acceleration",i.GPS="gps",i}({});var c3={time:1e3,elements:[J.COMPASS,J.DEVICE_MOTION,J.ACCELERATION,J.GPS]},Wo=class extends tT.EventDispatcher{start(){this.options.elements.some(t=>[J.DEVICE_MOTION,J.COMPASS].includes(t))&&this.listenDeviceOrientation(),this.options.elements.includes(J.ACCELERATION)&&this.listenAcceleration(),this.options.elements.includes(J.GPS)&&this.listenGps(),this.dispatchEvent({type:"start"}),this.dispatchTimer=this.timer.setInterval(()=>{this.dispatchEvent({type:"sensor-data",data:(0,xt.cloneDeep)(this.data)}),this.data=[]},this.options.time)}addDataItem(t){this.data.push(t),this.dispatchEvent({type:"add-data-item",item:t})}listenDeviceOrientation(){Wi?window.addEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.addEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0})}listenAcceleration(){window.addEventListener("devicemotion",this.handleAcceleration,!1)}listenGps(){this.gpsTimer=navigator.geolocation.watchPosition(t=>{this.addDataItem({type:J.GPS,timestamp:Date.now(),res:[t.coords.longitude,t.coords.latitude,t.coords.accuracy]})},t=>{console.log("\u83B7\u53D6gps\u5931\u8D25",t)},{enableHighAccuracy:!0})}checkSensor(){return g(this,null,function*(){return{deviceOrientation:yield this.checkDeviceOrientation()}})}checkDeviceOrientation(){return g(this,null,function*(){var t;if(!Wi)return!0;if(typeof window.DeviceOrientationEvent!="undefined"&&typeof((t=window.DeviceOrientationEvent)==null?void 0:t.requestPermission)=="function")try{var e;return(yield(e=window.DeviceOrientationEvent)==null?void 0:e.requestPermission())==="granted"}catch(n){return!1}return!1})}stop(){window.removeEventListener("devicemotion",this.handleAcceleration,!1),Wi?window.removeEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.removeEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0}),(0,xt.isNil)(this.gpsTimer)||navigator.geolocation.clearWatch(this.gpsTimer),this.dispatchTimer&&this.timer.clearInterval(this.dispatchTimer),this.data=[],this.dispatchEvent({type:"stop"})}constructor(t={}){super(),this.gpsTimer=null,this.data=[],this.timer=new nt,this.dispatchTimer=null,this.addAcceleration=(0,xt.throttle)(e=>{this.addDataItem(e)},20),this.deviceOrientationAbsHandler=(0,xt.throttle)(e=>{let n=Date.now(),{alpha:r,beta:o,gamma:s}=e;if((0,xt.isNil)(r)||(0,xt.isNil)(o)||(0,xt.isNil)(s))return;let a;Wi?a=e.webkitCompassHeading:a=360-r,this.options.elements.includes(J.DEVICE_MOTION)&&this.addDataItem({type:J.DEVICE_MOTION,timestamp:n,res:[r,o,s]}),this.options.elements.includes(J.COMPASS)&&this.addDataItem({type:J.COMPASS,timestamp:n,res:a})},200),this.handleAcceleration=e=>{let n=e.accelerationIncludingGravity;(0,xt.isNil)(n)||(0,xt.isNil)(n.x)||(0,xt.isNil)(n.y)||(0,xt.isNil)(n.z)||this.addAcceleration({type:J.ACCELERATION,timestamp:Date.now(),res:[n.x,n.y,n.z]})},this.options=w({},c3,t)}};var R8=f(I(),1),nT=require("three");var K8=f(C(),1);var Y8=f(C(),1),I8=f(I(),1);function _a(i,t){return 1/Math.sqrt(2*Math.PI*Math.pow(t,2))*Math.exp(-Math.pow(i,2)/(2*Math.pow(t,2)))}function So(i){return(i+360)%360}function eT(i,t){let n=6378137*i*Math.PI/180,r=6378137*Math.log(Math.tan(Math.PI/4+t*Math.PI/180/2));return{x:n,y:r}}function Gi(i,t,e,n){return Math.sqrt(Math.pow(Math.abs(i-e),2)+Math.pow(Math.abs(t-n),2))}var Oa=require("mathjs"),Ca=class{motionModelRotYaw(t){if(!(Math.abs(t)<.001)){this.last_yaw_compass=So(this.last_yaw_compass+t);for(let e=0;e<this.NumParticle;e++){let n=Math.random()*this.yaw_noise_sigma;this.particleX[2][e]=this.particleX[2][e]+t+n,this.particleX[2][e]=So(this.particleX[2][e])}}}motionModelStepLength(t,e){if(t===0)return;for(let r=0;r<this.NumParticle;r++){let o=Math.random()*this.step_noise_sigma;this.particleX[0][r]+=(.65+o)*Math.sin(-this.particleX[2][r]/180*Math.PI),this.particleX[1][r]+=(.65+o)*Math.cos(this.particleX[2][r]/180*Math.PI),e(this.particleX[0][r],this.particleX[1][r])||(this.particleWeight[0][r]*=this.unaccess_weight)}let n=this.particleWeight[0].reduce((r,o)=>r+o,0);this.particleWeight[0]=this.particleWeight[0].map(r=>r/n)}motionModelCompassYaw(t,e){if(e-this.last_compass_time>this.compass_update_interval){let n=360-t;n+=this.delta_yaw,n=So(n),Math.abs(n-this.last_yaw_compass)>60?this.compass_consecutive_offset_count++:this.compass_consecutive_offset_count=0;for(let o=0;o<this.NumParticle;o++){let s=Math.abs(this.particleX[2][o]-n);s>180&&(s=360-s),this.particleWeight[0][o]*=_a(s,this.sigmaCompass)}let r=this.particleWeight[0].reduce((o,s)=>o+s,0);this.particleWeight[0]=this.particleWeight[0].map(o=>o/r),this.setLastCompassTime(e)}}resampling(){if(1/this.particleWeight[0].reduce((e,n)=>e+n*n,0)<this.reSampNumParticle){let e=this.particleWeight[0].reduce((a,l,u)=>a.concat(a[u]+l),[0]),r=this.particleWeight[0].map(()=>1/this.NumParticle).map((a,l)=>a+Math.random()/this.NumParticle),o=[],s=0;for(let a=0;a<this.NumParticle;a++){for(;r[a]>e[s];)s++;o.push(s)}this.particleX=this.particleX.map((a,l)=>o.map(u=>a[u])),this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle)}}update(t,e){for(let r=0;r<this.NumParticle;r++){let o=Gi(this.particleX[0][r],this.particleX[1][r],t.x,t.y);this.particleWeight[0][r]=Math.max(1e-7,this.particleWeight[0][r]*_a(o,e))}let n=this.particleWeight[0].reduce((r,o)=>r+o,0);this.particleWeight[0]=this.particleWeight[0].map(r=>r/n)}updateCar(t,e){let n=t.x-this.xEst[0][0],r=t.y-this.xEst[1][0];for(let s=0;s<this.NumParticle;s++){let a=Gi(this.particleX[0][s],this.particleX[1][s],t.x,t.y);this.particleWeight[0][s]=Math.max(1e-7,this.particleWeight[0][s]*_a(a,e)),this.particleX[0][s]+=n,this.particleX[1][s]+=r}let o=this.particleWeight[0].reduce((s,a)=>s+a,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/o)}getPosInitFlag(){return this.particle_PosInitFlag}getYawInitFlag(){return this.particle_yawInitFlag}setPosInitFlag(t){this.particle_PosInitFlag=t}setYawInitFlag(t){this.particle_yawInitFlag=t}getResultX(){let t=(0,Oa.reshape)(this.particleWeight,[this.NumParticle,1]),e=(0,Oa.multiply)(this.particleX,t);return this.xEst=e,this.xEst[0][0]}getResultY(){return this.xEst[1][0]}getResultYaw(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0]));return this.particleX[2][t]}getEstConfidence(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0])),e=this.particleWeight[0].indexOf(Math.min(...this.particleWeight[0])),n=[this.particleX[0][t],this.particleX[1][t]],r=[this.particleX[0][e],this.particleX[1][e]],o=Gi(n[0],n[1],r[0],r[1]),s=o*.67;return console.log(o,s),s}getParticleNum(){return this.NumParticle}getParticleX(){return this.particleX}setLastCompassTime(t){this.last_compass_time=t}getLastCompassTime(){return this.last_compass_time}initParticlesByPos(t,e,n){if(!this.particle_PosInitFlag){this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle);let r=0;for(;r<this.NumParticle;){let s=(2*Math.random()-1)*this.initial_xy_uncertainty,a=(2*Math.random()-1)*this.initial_xy_uncertainty;n(t+s,e+a)||(this.particleWeight[0][r]*=this.unaccess_weight),this.particleX[0][r]=t+s,this.particleX[1][r]=e+a,r++}let o=this.particleWeight[0].reduce((s,a)=>s+a,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/o),this.particle_PosInitFlag=!0,this.xEst[0][0]=t,this.xEst[1][0]=e,this.xEst[2][0]=0}}initParticlesByCompass(t){console.log("Init compass: "+t);let e=360-t;e+=this.delta_yaw,e=So(e),console.log("Init Yaw: "+e);for(let n=0;n<this.NumParticle;n++){let r=(2*Math.random()-1)*this.initial_yaw_uncertainty;this.particleX[2][n]=e+r}this.particle_yawInitFlag=!0,this.xEst[2][0]=e,this.last_yaw_compass=e,this.compass_consecutive_offset_count=0}constructor(t){this.last_yaw_compass=0,this.compass_consecutive_offset_count=0,this.NumParticle=t.NumParticle,this.reSampNumParticle=t.reSampNumParticle,this.initial_xy_uncertainty=t.initial_xy_uncertainty,this.initial_yaw_uncertainty=t.initial_yaw_uncertainty,this.step_noise_sigma=t.step_noise_sigma,this.yaw_noise_sigma=t.yaw_noise_sigma,this.compass_update_interval=t.compass_update_interval,this.sigmaCompass=t.sigmaCompass,this.delta_yaw=t.delta_yaw,this.sigmaBeacon=t.sigmaBeacon,this.unaccess_weight=t.unaccess_weight,this.particle_PosInitFlag=!1,this.particle_yawInitFlag=!1,this.xEst=[[0],[0],[0]],this.particleX=Array.from({length:3},()=>Array(this.NumParticle).fill(0)),this.particleWeight=Array.from({length:1},()=>Array(this.NumParticle).fill(1/this.NumParticle)),this.last_compass_time=0}};var Z8=f(C(),1),v8=f(I(),1),Fa=class{init(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10+.5,this.max_valley=10-.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.65,this.last_rot=[0,0,0],this.delta_rot=[0,0,0],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0}reset(){this.init()}setInitPose(t){t===void 0&&(t=[0,0]),this.last_px=t[0],this.last_py=t[1],console.info("pdr init pos: "+this.last_px+", "+this.last_py)}setInitYaw(t){t===void 0&&(t=0),this.last_yaw=t}getPos(t,e,n){let r=0;return n.length===3&&(this.delta_yaw=this.getDeltaYawFromRot(t,n)),e.length===3&&(r=this.getStepLength(t,e)),r!==0&&(this.last_px+=this.delta_px,this.last_py+=this.delta_py),[this.last_px,this.last_py]}getDeltaPose(){return[this.delta_px,this.delta_py]}getStepLength(t,e){if(e.length<3)return console.warn("acc data less than 3"),0;let n=!1,r=Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2));if(this.accH_fifo.push(r),this.accH_time_fifo.push(t),this.imuFreUpdate(),this.accH_fifo.length<this.accH_fifo_len+1)n=!1;else{for(;this.accH_fifo.length>=this.accH_fifo_len+1;)this.accH_fifo.shift(),this.accH_time_fifo.shift();let o=this.PVStepDetec(),s=this.FFTStepDetec(),a=this.recheckState(),l=this.accH_time_fifo[Math.floor(this.accH_time_fifo.length*3/4)];Math.abs(this.abnor_start_time)<.001&&this.abnor_fft_detected?this.abnor_start_time=l:this.abnor_fft_detected||(this.abnor_start_time=0),o&&s&&a?(this.step_count+=1,this.last_step_time=l,n=!0):Math.abs(this.abnor_start_time)>.001&&this.abnor_peak_time-this.abnor_start_time>this.abnor_time_threshold&&this.step_count>1&&this.abnor_peak_time-this.last_step_time>1?(this.step_count+=1,this.last_step_time=l,n=!0):(l-this.last_step_time>2&&(this.state_count=0),n=!1)}if(n){let o=this.last_yaw/180*Math.PI;return this.delta_px=this.const_step_length*Math.cos(o),this.delta_py=this.const_step_length*Math.sin(o),this.const_step_length}else return 0}imuFreUpdate(){if(this.accH_time_fifo.length>2&&(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]<0||this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]>10||this.accH_time_fifo[this.accH_time_fifo.length-1]===this.accH_time_fifo[0])&&(console.warn("pdr reset last one time "+this.accH_time_fifo[this.accH_time_fifo.length-1]+" last two time "+this.accH_time_fifo[this.accH_time_fifo.length-2]),this.reset()),this.accH_fifo.length>9||this.fre<15){let t=(this.accH_fifo.length-1)/(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[0]);Math.abs(this.fre-t)>8&&(this.fre=Math.round((t-3)/10)*10,(this.fre<=10||this.fre>=100)&&(console.warn("Frequency Error "+this.fre),this.fre=100),console.debug("Frequency change to "+this.fre),this.accH_fifo_len=Math.floor(1*this.fre)+1)}}recheckState(){return!0}PVStepDetec(){let t=!1,e=this.accH_fifo.slice(Math.floor(this.accH_fifo_len/2)),n=this.accH_time_fifo.slice(Math.floor(this.accH_fifo_len/2)),r=e[Math.floor(e.length/2)],o=n[Math.floor(n.length/2)],s=Math.max(...e),a=Math.min(...e),l=!1,u=!1;return Math.abs(r-a)<.01&&r<this.max_valley&&this.valley_num<=this.peak_num&&(this.last_valley_time===0?u=!0:u=o-this.last_valley_time>this.min_step_time,u&&(this.last_valley_time=o,this.valley_num+=1)),Math.abs(r-s)<.01&&r>this.min_peak&&this.peak_num<=this.valley_num&&(this.last_peak_time===0?l=!0:l=o-this.last_peak_time>this.min_step_time,l&&(this.last_peak_time=o,this.peak_num+=1)),r===s&&r>this.min_peak&&(this.abnor_peak_time=o,this.abnor_peak_accH=r),this.peak_num===this.valley_num&&(l||u)&&(t=!0),t}FFTStepDetec(){return!0}getDeltaYawFromRot(t,e){if(e.length<3)return console.warn("rot data less than 3"),0;let n=[0,0,0];this.last_rot.length===3&&(n=e.map((a,l)=>a-this.last_rot[l]));for(let a=0;a<e.length;a++)n[a]<-180?n[a]+=360:n[a]>180&&(n[a]-=360);let r=.2;this.delta_rot.length===3?this.delta_rot=this.delta_rot.map((a,l)=>r*a+(1-r)*n[l]):this.delta_rot=n,this.last_rot=e,this.delta_yaw=this.delta_rot[0],this.last_yaw+=this.delta_yaw,this.last_yaw=this.limitYaw(this.last_yaw);let o=this.delta_rot.reduce((a,l)=>a+Math.abs(l),0);this.delta_rot_sum_fifo.push(o),this.delta_rot_sum_time_fifo.push(t),Math.abs(this.delta_rot_sum_time_fifo[this.delta_rot_sum_time_fifo.length-1]-this.delta_rot_sum_time_fifo[0])>1&&(this.delta_rot_sum_fifo.shift(),this.delta_rot_sum_time_fifo.shift()),this.delta_yaw_accum+=this.delta_yaw;let s=0;return Math.abs(this.delta_yaw_accum_timestamp-t)>this.delta_yaw_time_threshold?(s=this.delta_yaw_accum,this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=t,s):null}limitYaw(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}constructor(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10.5,this.max_valley=9.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_time_threshold=4,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.85,this.last_rot=[],this.delta_rot=[],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0}};var p3={using_gps:!0},za=class{pfFusionPDRiBeacon(t){let{type:e,timestamp:n,res:r}=t,o=!1;if(this.cacheSensorData.push(t),this.particleFilter.getPosInitFlag()&&this.particleFilter.getYawInitFlag()){if(e===J.ACCELERATION){let s=r,a=this.pdr.getStepLength(n/1e3,s);a!==0&&(this.particleFilter.motionModelStepLength(a,()=>!0),this.particleFilter.resampling(),this.position_count+=1,o=!0)}if(this.using_gps&&e===J.GPS&&(this.last_beacon_time===null||n-this.last_beacon_time>5e3)){let s=this.getGpsPosition(r);o=s!==null,s&&(this.particleFilter.update(s,this.gps_horizontalAccuracy),this.resetParticleFilterDist(s,"gps",r[2]),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0)}if(e===J.DEVICE_MOTION){let s=this.pdr.getDeltaYawFromRot(n/1e3,r);s!==null&&this.particleFilter.motionModelRotYaw(s)}e===J.COMPASS&&this.particleFilter.motionModelCompassYaw(r,n),this.last_pos_time&&n-this.last_pos_time>500&&(this.position_count+=1,o=!0)}else if(!this.particleFilter.getPosInitFlag()&&this.using_gps&&e===J.GPS){if(this.startTime&&Date.now()-this.startTime>3e3){let s=this.getGpsPosition(r);o=s!==null,console.log("gps_pos",s,r),s?(this.particleFilter.initParticlesByPos(s.x,s.y,()=>!0),this.last_pos_time=n,console.log("init Pos by gps success time "+n),this.cacheSensorData.length=0):console.log("init Pos by gps fail time "+n)}}else if(!this.particleFilter.getYawInitFlag()&&e===J.COMPASS){let s=r;this.particleFilter.initParticlesByCompass(s),this.particleFilter.setLastCompassTime(n),console.log("init yaw by compass success time "+n)}return o&&(this.last_pos_time=n),[o,this.particleFilter.getResultX(),this.particleFilter.getResultY()]}setBeaconPosition(t,e){if(this.last_beacon_time=e,this.particleFilter.getPosInitFlag())this.particleFilter.update(t,this.sigmaBeacon);else{this.particleFilter.initParticlesByPos(t.x,t.y,()=>!0);let n=this.cacheSensorData.filter(r=>r.timestamp>e);console.log("\u521D\u59CBsensorData",n),n.map(r=>this.pfFusionPDRiBeacon(r))}return this.resetParticleFilterDist(t),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0,[this.particleFilter.getResultX(),this.particleFilter.getResultY()]}getGpsPosition(t){return t[2]>this.gps_max_horizontalAccuracy?null:eT(t[0],t[1])}resetParticleFilterDist(t,e,n){let r=this.particleFilter.getResultX(),o=this.particleFilter.getResultY(),s=Gi(r,o,t.x,t.y);(e==="gps"?n&&s>n||s>this.GpsMaxEstimateErr:s>this.MaxEstimateErr)?(this.outTrustRegionNum+=1,this.outTrustRegionNum>=this.TrustNum&&(console.info("\u8D85\u51FA\u53EF\u4FE1\u533A\u57DF\uFF0C\u91CD\u7F6E\u7C92\u5B50\u8FC7\u6EE4\u5668\u5230: "+t.x+", "+t.y),this.particleFilter.setPosInitFlag(!1),this.particleFilter.setYawInitFlag(!1),this.outTrustRegionNum=0)):this.outTrustRegionNum=0}constructor(t){this.sigmaBeacon=5,this.gps_horizontalAccuracy=10,this.using_gps=!0,this.last_beacon_time=Date.now(),this.position_count=0,this.gps_max_horizontalAccuracy=20,this.MaxEstimateErr=5,this.GpsMaxEstimateErr=30,this.outTrustRegionNum=0,this.TrustNum=4,this.cacheSensorData=[],this.startTime=null;let e=w({},p3,t);this.using_gps=e.using_gps,this.particleFilter=new Ca({NumParticle:200,reSampNumParticle:.65,initial_xy_uncertainty:12,initial_yaw_uncertainty:100,step_noise_sigma:.5,yaw_noise_sigma:2,compass_update_interval:3e3,sigmaCompass:80,delta_yaw:2,sigmaBeacon:5,unaccess_weight:.7}),this.pdr=new Fa}};var cc=class extends nT.EventDispatcher{checkSensor(){return this.sensor.checkSensor()}start(){this.sensor.start(),this.pdr.startTime=Date.now(),this.sensor.addEventListener("add-data-item",t=>{let{item:e}=t;this.getPositionBySensorItem(e,!this._pause)})}pause(){this._pause=!0}continue(){this._pause=!1}getPositionBySensorItem(t,e){e===void 0&&(e=!0);let[n,r,o]=this.pdr.pfFusionPDRiBeacon(t);return n&&e&&this.dispatchEvent({type:"position",x:r,y:o,_type:t.type===J.GPS?"gps":"pdr"}),[n,r,o]}setBeaconPosition(t,e){let[n,r]=this.pdr.setBeaconPosition(t,e);this.dispatchEvent({type:"position",x:n,y:r,_type:"beacon"})}dispose(){this.sensor.stop()}constructor(t={}){super(),this._pause=!1,this.sensor=new Wo(t.sensor),this.pdr=new za(t.pdr||{})}};var iQ=f(I(),1),rQ=f(C(),1);var V8=f(I(),1),J8=f(C(),1),ut=require("three");var iT={texture_url:pa,lineWidth:8,color:16777215},Ra=class extends ut.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:r}}}}}=this,o=t.map(a=>{let[l,u,h]=a;return D(new ut.Vector3(l,u,h),e,n,r)}).map(a=>{let{x:l,y:u}=a;return[l,u]});return Ft(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new ut.Vector2(t,1)}loadTexture(t){return new Promise((e,n)=>{new ut.TextureLoader().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n]);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return g(this,null,function*(){let e=this.geometry=new Yt;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=ut.RepeatWrapping}let n=this.material=new si({useMap:!0,color:new ut.Color(this.config.color),transparent:!0,resolution:new ut.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:ut.NormalBlending,repeat:new ut.Vector2(this.getRepeat(),1)}),r=this.mesh=new ut.Mesh(e,n);return r.renderOrder=9,this.add(r),r})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=iT,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:r}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,r)}},this.config=Object.assign({},iT,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var rT=require("@tweenjs/tween.js");var et=require("three"),Ua=class extends et.Object3D{getBaseScale(t){let{clientSize:{width:e,height:n},camera:r}=this.bmap.context,o=new et.Box3().setFromObject(t),{max:s,min:a}=o,l=new et.Vector3(a.x,s.y,s.z),u=new et.Vector3(s.x,s.y,s.z),h=new et.Vector3(s.x,a.y,a.z),c=new et.Vector3(a.x,a.y,a.z),p=D(l,r,e,n),m=D(u,r,e,n),y=D(c,r,e,n),M=D(h,r,e,n),A=new et.Box2().setFromPoints([new et.Vector2(p.x,p.y),new et.Vector2(m.x,m.y),new et.Vector2(y.x,y.y),new et.Vector2(M.x,M.y)]).getSize(new et.Vector2),W=40/A.x,X=40/A.y,v=Math.min(W,X),Z=r.zoom;return v*Z}registryEvent(){this.bmap.context.addEventListener("update",this._update),this.bmap.context.addEventListener("control-zoom-change",this._onChangeZoom)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this._update),this.bmap.context.removeEventListener("control-zoom-change",this._onChangeZoom)}printGraph(t){console.group(" <"+t.type+"> "+t.name),t.children.forEach(e=>this.printGraph(e)),console.groupEnd()}setClips(t){this.clearClips(),t.length&&(this.mixer=new et.AnimationMixer(this.model.scene),t.forEach(e=>this.mixer.clipAction(e).play()))}startClips(){var t;this.setClips(((t=this.model)==null?void 0:t.animations)||[])}clearClips(){this.mixer&&(this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.mixer.getRoot()),this.mixer=null)}dispose(){this.unRegistryEvent(),this.clearClips(),this.clear(),this.model&&it(this.model.scene),this.bmap=null}constructor(t,e){super(),this.bmap=t,this.group=new et.Object3D,this.mixer=null,this.previewTime=0,this.basicScale=1,this._update=()=>{let n=Date.now();if(!this.previewTime)this.previewTime=n;else{var r;let o=n-this.previewTime;this.previewTime=n,(r=this.mixer)==null||r.update(o/1e3)}},this._onChangeZoom=n=>{let{zoom:r}=n;var o;let s=this.basicScale/r;(o=this.model)==null||o.scene.scale.set(s,s,s)},this.add(this.group),Dt.loadModel(e,!1).then(n=>{this.model=n;let r=this.getBaseScale(n.scene);this.basicScale=r;let o=this.bmap.context.camera.zoom;n.scene.scale.set(r/o,r/o,r/o),this.group.add(n.scene),this.setClips(n.animations),this.group.rotation.set(Math.PI/2,Math.PI,0),this.dispatchEvent({type:"loaded"})}),this.registryEvent()}};var bo=require("three"),oT=require("lodash");var pc=class extends vt{registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate)}pauseAnimation(){this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue()}clearTween(){this.tweenUtil.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate)}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.movedDistance=0,this.clearTween()),this.startModel&&(this.startModel.visible=!1),this.translatePath=null}addPath(t){this.paths=t;let e=t.map(n=>w({},n,{points:this.translatePoints(n.points)}));if(this.clearTween(),this.movedDistance=0,this.bmap.currentBuildGround)this.renderPath(e);else{let n=()=>{this.bmap.removeEventListener("center-change",n),this.renderPath(e)};this.bmap.addEventListener("center-change",n)}this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,n]=this.bmap.buildingCenter;return t.map(r=>[r[0]-e,r[1]-n])}renderPath(t){if(!t.length)return this.clearPath();let e=[];t.forEach((n,r,o)=>{let s=this.catmullRomCurve3(n.points),a=this.mulFloor.floors.find(l=>l.name===n.floor);if(e.push(...s.map(l=>{let[u,h]=l;return[u,h,a.position.z+a.groundMaxHeight]})),r!==o.length-1){let l=this.mulFloor.floors.find(u=>u.name===o[r+1].floor);e.push([...o[r+1].points[0],l.position.z])}}),this.cPath=e,this.animationPathOptions={cPathIndex:0},this.path?this.path.updatePoints(e):(this.path=new Ra(this),this.path.create(e),this.path.position.z=.5,this.bmap.context.scene.add(this.path)),this.startModel&&(this.startModel.position.set(e[0][0],e[0][1],e[0][2]),this.startModel.visible=!0),this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(t){return wr(t,!1,!0,.1,170,2.5)}getPathDirection(t,e){if(t.length<2)return null;let n=ve(t,e),r=t[n],o=t[n+1],s=new bo.Vector3(o[0]-r[0],o[1]-r[1],0).normalize(),a=new bo.Vector3(0,1,0).normalize(),l=s.angleTo(a),u=new bo.Vector3().crossVectors(a,s);return(Object.is(u.y,0)?-1:1)*l}startSimulation(t){return g(this,null,function*(){t===void 0&&(t=1);let{paths:e,movedDistance:n}=this;if(!e.length)return;let r=e.reduce((s,a)=>s+a.distance,0);if(!r||n>=r)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let o=r/t;return this.startModel.startClips(),new Promise(s=>{let a=this.simulationTween=new rT.Tween({distance:this.movedDistance},this.tweenUtil.group).to({distance:r},o*1e3).onUpdate(l=>{var u;this.movedDistance=l.distance;let h=l.distance,c=0;for(let A=0;A<e.length;A++)if(e[A].distance>=h){c=A;break}else h-=e[A].distance;let p=Gn(e[c].points,h);if(p===null)return;this.currentPathPosition=p;let m=this.translatePoints([p])[0],y=this.mulFloor.floors.find(A=>A.name===e[c].floor),M=y?y.position.z+y.groundMaxHeight:(u=this.startModel)==null?void 0:u.position.z;this.startModel&&this.startModel.position.set(m[0],m[1],M);let j=this.getPathDirection(e[c].points,p);(0,oT.isNil)(j)||this.startModel.setRotationFromAxisAngle(new bo.Vector3(0,0,1),j)}).onComplete(()=>{this.tweenUtil.remove(a),this.startModel.clearClips(),s(!0)}).start()})})}setStartPoiRotate(t){if(this.startPoi){let n=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(360-t-n)%360}}dispose(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.startModel&&(this.bmap.context.scene.remove(this.startModel),this.startModel.dispose()),this.tweenUtil.dispose(),this.unRegistryEvent(),super.dispose()}constructor(t,e){super(t),this.mulFloor=e,this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.pathTween=null,this.startPoi=null,this.movedDistance=0,this.tweenUtil=new qe,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onUpdate=()=>{this.tweenUtil.update()},this.startModel=new Ua(t,o1),this.startModel.visible=!1,this.bmap.context.scene.add(this.startModel),this.registryEvent()}};var Na=require("three");var dc=class extends vt{registryEvent(){this.clickHelper.addEventListener("click",this._click)}unRegistryEvent(){this.clickHelper.removeEventListener("click",this._click)}dispose(){this.unRegistryEvent(),this.clickHelper.dispose(),this.mulFloors=null,super.dispose()}constructor(t,e){super(t),this.mulFloors=e,this._click=n=>{let{e:r}=n;if(!this.mulFloors.showStatus)return;let o=new Na.Vector2,{offsetX:s,offsetY:a}=r,{clientSize:l}=this.bmap.context;o.x=s/l.width*2-1,o.y=a/l.height*-2+1;let u=new Na.Raycaster;u.setFromCamera(o,this.bmap.context.camera),u.ray.origin.sub(u.ray.direction.clone().multiplyScalar(1e4));let c=this.mulFloors.poiLayer.pois.map(m=>{if(!m.canSelect)return null;let y=u.intersectObjects(m.children,!0);return y.length?y[0]:null}).reduce((m,y)=>y&&(!m||y.distance<m.distance)?y:m,null),p=c==null?void 0:c.object;c&&c.object.isSprite&&(p=c.object.parent),p&&p instanceof st&&this.dispatchEvent({type:"select",pois:[p]})},this.clickHelper=new br(this.bmap.context.container),this.registryEvent()}};var IQ=f(sT(),1),XQ=f(aT(),1),DQ=f(C(),1),uT=require("three");var AQ=f(I(),1),TQ=f(C(),1),wQ=f(ws(),1),ki=require("three");function j3(i){let t=i.length,e=0,n=0,r=0,o=0;i.forEach(l=>{e+=l[0],n+=l[1],r+=l[0]*l[1],o+=l[0]*l[0]});let s=(t*r-e*n)/(t*o-e*e),a=(n-s*e)/t;return{m:s,b:a}}function g3(i,t,e){let n=e[0][0],r=e.slice(-1)[0][0],o=i*n+t,s=i*r+t;return{start:[n,o],end:[r,s]}}function Yo(i){if(i.length<2)return null;let t=i.filter((l,u)=>{let h=[...i];return h.splice(u,1),h.every(c=>c[0]!==l[0]&&c[1]!==l[1])});if(t.length<2)return null;let{m:e,b:n}=j3(t),{start:r,end:o}=g3(e,n,t),a=360-(new ki.Vector2().subVectors(new ki.Vector2(o[0],o[1]),new ki.Vector2(r[0],r[1])).angle()/Math.PI*180-90+360)%360;return Number.isNaN(a)?null:a}function A3(i){let t=[];for(let e=1;e<i.length;e++){let n=i[e-1],r=i[e],o=r.position[0]-n.position[0],s=r.position[1]-n.position[1],a=Math.sqrt(o**2+s**2),l=r.time-n.time;if(l>0){let u=a/l;console.log("speedDelta",n.type,r.type,Ga(u),a,l),t.push(u)}else t.push(0)}return t}function T3(i,t){let e=i[0],n=i.slice(-1)[0],r=U(n.position,e.position),o=n.time-e.time;return o<100||r<3?null:r/o}function Ga(i){return i*60*60}function Vi(i,t,e,n){let r=(e+90)%360*(Math.PI/180),o=t*n,s=new ki.Vector2(i[0],i[1]),a=Math.cos(r),l=Math.sin(r),u=new ki.Vector2(a,l);return s.add(u.normalize().multiplyScalar(o)),[s.x,s.y]}function w3(i){let t=[...i].sort((u,h)=>u-h),e=lT(t,25),n=lT(t,75),r=n-e,o=e-1.5*r,s=n+1.5*r,a=t.filter(u=>u>=o&&u<=s);return i.filter(u=>a.includes(u))}function lT(i,t){let e=t/100*(i.length-1),n=Math.floor(e),r=Math.ceil(e);if(n===r)return i[n];let o=e-n;return i[n]*(1-o)+i[r]*o}var ka=class{filter(t){let e=this.estimate,n=this.errorEstimate+this.processNoise,r=n/(n+this.measurementNoise);return this.estimate=e+r*(t-e),this.errorEstimate=(1-r)*n,this.estimate}constructor(t={}){this.estimate=0,this.errorEstimate=1,this.processNoise=.1,this.measurementNoise=1,this.measurementNoise=t.measurementNoise||1,this.processNoise=t.processNoise||.1,this.errorEstimate=t.errorEstimate||1}};var Io=require("lodash"),fc=class extends uT.EventDispatcher{setPathAngle(t){this.pathAngle=t,this.dispatchEvent({type:"change-compass",value:this.pathAngle}),(0,Io.isNil)(this.angle)&&(this.angle=t)}changeSpeed(){let t=this.history.filter(l=>["vision"].includes(l.type));if(t.length<2){this.speedFilter.filter(0),this.speed=0;return}let e=t[0],n=t.slice(-1)[0],r=U(n.position,e.position),o=n.time-e.time,s=o>0?r/o:0,a=this.speedFilter.filter(s);this.speed=a}changeAngle(t){t===void 0&&(t=this.visionHistory),t.length<2&&(this.angle=null);let e=Yo(t.map(n=>n.position));e!==null&&this.setAngle(e)}setAngle(t,e){e===void 0&&(e=!0),this.angle=t,e&&this.dispatchEvent({type:"change-position-compass",value:t})}setPosition(t,e,n){let r={position:t,time:e,clientTime:Date.now()-n,type:"vision"};if(this._setVisionHistoryForAngle(r),(0,Io.isNil)(this.angle)||!this.speed){this.addHistory(r);return}let o=this.history.findLastIndex(a=>a.type==="vision"),s=this.history[o];if(s){if(s.time>e)return;let a=Yo([this.history.slice(-1)[0].position,t]);if(a&&Math.abs(a-this.angle)<60){this.addHistory(r);return}let l=Vi(t,this.speed,360-this.pathAngle,n);U(l,this.history.slice(-1)[0].position)>10?this.visionExcessesCount++:this.visionExcessesCount=0,this.visionExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21\u89C6\u89C9\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528\u89C6\u89C9\u6821\u51C6"),this.addHistory(r),this.visionExcessesCount=0)}}resetPdrPosition(){let t=this.history.findLast(e=>e.type==="vision");if(t&&this.speed){let e=Vi(t.position,this.speed,360-this.pathAngle,Date.now()-t.clientTime);e&&this.history.push({position:e,time:Date.now(),clientTime:Date.now(),type:"pdr"})}}getLastVisionPdrPos(){let t=this.history.findLastIndex(n=>n.type==="vision");if(t!==-1){var e;return(e=this.history[t+1])!=null?e:this.history[t]}return null}_setVisionHistoryForAngle(t){if(!this.visionHistory.length){this.visionHistory.push(t);return}let e=Yo([this.visionHistory.slice(-1)[0].position,t.position]);if(e!==null&&(this.angle&&Math.abs(this.angle-e)>60?this.angleExcessesCount++:(this.angleExcessesCount=0,this.visionHistory.push(t))),this.angleExcessesCount>3)console.warn("\u8FDE\u7EED\u4E09\u6B21\u89D2\u5EA6\u6BD4\u8F83\u6B6A\uFF0C\u91CD\u65B0\u77EB\u6B63"),this.visionHistory=[t],this.angleExcessesCount=0;else{let n=U(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position);for(;n>5&&this.visionHistory.length>15;)this.visionHistory.shift(),n=U(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position)}this.changeAngle()}addHistory(t){this.history.push(t);let e=this.history.filter(a=>a.type==="vision"),n=e.length?Date.now()-e.slice(-1)[0].clientTime:0,r=U(this.history[0].position,this.history.slice(-1)[0].position),o=n>5e3?10:3,s=n>5e3?0:5;for(n>5e3&&console.warn("\u89C6\u89C9\u7ED3\u679C\u8D85\u51FA5s\u4E0D\u53EF\u7528\uFF0C\u5168\u90E8\u6E05\u7A7A");e.length>s&&r>o;)this.history.shift(),e=this.history.filter(a=>a.type==="vision"),r=U(this.history[0].position,this.history.slice(-1)[0].position);s===0?this.changeSpeed():t.type==="vision"&&this.changeSpeed(),this.changePosition(t.type)}setBeaconPosition(t,e,n){let r=Date.now()-n,o={position:t,time:e,clientTime:r,type:"beacon"},s=this.history.findLastIndex(h=>h.type!=="pdr"),a=this.history[s];if(!a){this.addHistory(o);return}if((0,Io.isNil)(this.pathAngle)||!this.speed){this.addHistory(o);return}if(a&&a.time>e)return;let l=Vi(t,this.speed,360-this.pathAngle,n);U(l,this.history.slice(-1)[0].position)>5?this.beaconExcessesCount++:this.beaconExcessesCount=0,this.beaconExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21beacon\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528beacon\u6821\u51C6"),this.addHistory(o),this.beaconExcessesCount=0)}startPositionTimer(){this.positionTimer&&this.timer.clearInterval(this.positionTimer),this.positionTimer=this.timer.setInterval(()=>{this.changePosition()},20)}changePosition(t){t===void 0&&(t="pdr");let e=this.getPosition(t);e.success&&(this.history.push({position:e.pos,time:Date.now(),clientTime:Date.now(),type:"pdr"}),this.speed?this.dispatchEvent({type:"change-pos",value:w({},e)}):this.dispatchEvent({type:"change-pos",value:e}))}getPosition(t){if(this.history.length===0)return{success:!1,pos:[0,0],compass:null,speed:0};let e=this.history.slice(-1)[0];if(this.history.length<2)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};if((0,Io.isNil)(this.pathAngle)||!this.speed)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};let n=e.clientTime,r=Date.now()-n;return{success:!0,pos:this.pathAngle?Vi(e.position,this.speed,360-this.pathAngle,r):e.position,compass:this.pathAngle,speed:Ga(this.speed)}}dispose(){this.timer.dispose()}constructor(){super(),this.history=[],this.visionHistory=[],this.speed=0,this.angle=null,this.timer=new nt,this.positionTimer=null,this.speedFilter=new ka,this.visionExcessesCount=0,this.beaconExcessesCount=0,this.angleExcessesCount=0,this.pathAngle=0,this.startPositionTimer()}};function mc(i,t){return g(this,null,function*(){let{brand:e,project:n}=i,{apiDomain:r,apiPath:{floorRange:o},apiInfo:s}=t,a=""+r+o+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n;return yield fetch(a,s).then(u=>u.json()).then(u=>u.data).then(u=>{let h=(u||[])[0];return h&&(h.info=JSON.parse(h.info)),h})})}function yc(i,t){return g(this,null,function*(){let{brand:e,project:n,floor:r,ts:o,resource_type_list:s}=i,{apiDomain:a,apiPath:{floorGraphic:l},apiInfo:u}=t,h=""+a+l+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+r+"&ts="+o+"&resource_type_list="+s;return yield fetch(h,u).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(m=>m.info=JSON.parse(m.info)),p||[]))})}function W3(i,t){return g(this,null,function*(){let{project:e,floor:n}=i,{apiDomain:r,apiInfo:o}=t,s=r+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+n;return yield fetch(s,o).then(l=>l.json()).then(l=>l.data).then(l=>JSON.parse(l[0].streetInfo||"{}")).then(l=>l.fileId?S3(l.fileId,t):null)})}function S3(i,t){return g(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+i,n).then(r=>r.arrayBuffer()).then(r=>{let s=new TextDecoder("utf-8").decode(r);return s?JSON.parse(s):null})})}var VQ=f(I(),1);var ge;function hT(i,t){return i===void 0&&(i="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(ge)return e({db:ge,type:"success"});let r=indexedDB.open(i,t);r.onupgradeneeded=function(o){ge=o.target.result,console.log("onupgradeneeded"),e({db:ge,type:"onupgradeneeded"})},r.onsuccess=o=>{ge=o.target.result,e({db:ge,type:"success"})},r.onerror=o=>{n(o)}})}function Pc(i,t,e){return e===void 0&&(e=ge),new Promise((n,r)=>{e||r("\u6CA1\u6709db");let s=e.transaction([i],"readonly").objectStore(i).get(t);s.onsuccess=()=>{s.result?n(s.result.value):n(null)},s.onerror=a=>{console.log("[getVersionByKey]",a),n(null)}})}function cT(i,t,e,n){return n===void 0&&(n=ge),new Promise((r,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>g(this,null,function*(){let l=yield Pc(i,t),u=n.transaction([i],"readwrite").objectStore(i),h=l!==null?u.put({key:t,value:e}):u.add({key:t,value:e});h.onsuccess=function(c){s(c)},h.onerror=function(c){a(c)}}))))}function ai(i,t){t===void 0&&(t=ge),t&&(t.objectStoreNames.contains(i)||t.createObjectStore(i,{keyPath:"key"}))}function pT(i){i===void 0&&(i=ge),i==null||i.close(),ge=null}var Ja=require("three");var zQ=f(C(),1),RQ=f(I(),1);function dT(i,t,e){switch(i.l_type){case"graph":return b3(i,t);case"wall":return Y3(i,t);case"lane":return I3(i,t);case"texture2d":case"texture3d":return X3(i,t);case"glb":return D3(i,t);case"store":return Z3(i,t);case"facility":return v3(i,t);case"parkingSpace":return x3(i,t,e);case"text":return E3(i,t)}}function b3(i,t){let e=t.userData.center;At(i.elements,e);let n=[];i.elements.forEach(o=>{o.group==="ground"?t.createGround(o):n.push(o)});let r=n.reduce((o,s)=>{let{fillColor:a,fillOpacity:l,strokeColor:u,strokeOpacity:h,height:c,airHeight:p}=s,m=a.toLowerCase()+"-"+l+"-"+u.toLowerCase()+"-"+h+"-"+c+"-"+p;return h===0&&(m=a.toLowerCase()+"-"+l+"-"+c+"-"+p),o[m]?o[m].push(s):o[m]=[s],o},{});Object.values(r).forEach(o=>{let s=new ii(t.context,o);t.mergeGraphicLayer.add(s)})}function Y3(i,t){let e=t.userData.center;At(i.elements,e);let n=i.elements.reduce((r,o)=>{let{fillColor:s,fillOpacity:a,strokeColor:l,strokeOpacity:u,height:h}=o,c=s.toLowerCase()+"-"+a+"-"+l.toLowerCase()+"-"+u+"-"+h;return u===0&&(c=s.toLowerCase()+"-"+a+"-"+h),r[c]?r[c].push(o):r[c]=[o],r},{});Object.values(n).forEach(r=>{let o=new Po(t.context,r);t.wallLayer.add(o)})}function I3(i,t){let e=t.userData.center;At(i.elements,e);let n=i.elements.reduce((r,o)=>{let{fillColor:s,fillOpacity:a,strokeColor:l,strokeOpacity:u}=o,h=s.toLowerCase()+"-"+a+"-"+l.toLowerCase()+"-"+u;return u===0&&(h=s.toLowerCase()+"-"+a),r[h]?r[h].push(o):r[h]=[o],r},{});Object.values(n).forEach(r=>{let o=new jo(t.context,r);t.laneLayer.add(o)})}function X3(i,t){let e=t.userData.center;if(At(i.elements,e),i.elements.length){let n=new ni(t.context,i.elements);t.textureLayer.add(n)}}function D3(i,t){let e=t.userData.center;At(i.elements,e),i.elements.forEach(n=>{let r=new Mo(t.context,w({},n,{url:n.secondUrl,rotate:n.secondRotate,width:n.secondWidth,center_x:n.center_coord_x,center_y:n.center_coord_y}));t.glbModelLayer.add(r)})}function Z3(i,t){let e=t.userData.center;At(i.elements,e),i.elements.map(n=>{let r=t.addGraphic(n);t.userData.graphics.push(r),t.userData.graphicMap.set(n.id,r);try{let o=new st(t.context,{id:n.id,icon:n.poi_info.icon,text:n.poi_info.showName||n.store_name||n.poi_info.text,position:{x:n.center_coord_x,y:n.center_coord_y,z:n.airHeight+n.height},icon_size:[24,24],level:n.poi_info.level||0});t.poiLayer2.pushPoi(o),o&&(o.userData.type="store",o.userData.data=n,o.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,n)}})}function v3(i,t){let e=t.userData.center;At(i.elements,e),i.elements.map(n=>{let r=t.addGraphic(n);if(t.userData.graphics.push(r),t.userData.graphicMap.set(n.id,r),n.poi_info){let o=new st(t.context,{id:n.id,icon:n.poi_info.icon,text:n.poi_info.showName||n.store_name||n.poi_info.text,position:{x:n.center_coord_x,y:n.center_coord_y,z:n.airHeight+n.height},icon_size:[24,24],level:n.poi_info.level||0});t.poiLayer2.pushPoi(o),o.userData.type="facility",o.userData.data=n,o.userData.floor=t.name}else console.log("\u6DFB\u52A0facility\u5931\u8D25\u6CA1\u6709poi_info",n)})}function x3(i,t,e){let n=t.userData.center;At(i.elements,n),t.parkingSpaceLayer.createParkings(i.elements,e.mergeParkingSpace),i.elements.forEach(r=>{if(r.texts[0]){let o=new st(t.context,{id:r.id,text:r.texts[0],position:{x:r.center_coord_x,y:r.center_coord_y,z:r.airHeight+r.height}});o&&(o.userData.type="parkingSpace",o.userData.data=r,o.userData.floor=t.name),t.poiLayer2.pushPoi(o)}}),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function E3(i,t){let e=t.userData.center;At(i.elements,e);let n=new go(t.context,i.elements.map(r=>w({},r,{center_x:r.center_coord_x,center_y:r.center_coord_y})));t.textTextureLayer.add(n)}var Mc="map_version",jc="route_version",gc="facility_version",Ac="map_data",Va="road_network_data",Tc="facility_data",K3={mergeParkingSpace:!0},wc=class extends Ja.EventDispatcher{initDb(){return g(this,null,function*(){try{let{db:t,type:e}=yield hT("aibee_map",2);e==="onupgradeneeded"&&(ai(Mc),ai(jc),ai(gc),ai(Ac),ai(Va),ai(Tc)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t){return g(this,null,function*(){if(Array.isArray(t))this.floors=t;else{let e=yield fetch(t).then(n=>n.json());e.code==="0"&&(this.floors=e.data.list)}})}setCacheData(t,e,n){return this.initDbPromise.then(()=>cT(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>Pc(t,""+e,this.db))}getFloorCacheKey(t){return""+t.floor_id}getFloorData(t){return g(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return g(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}getFloorJsonDataByFloorInfo(t){return g(this,null,function*(){let e=this.getFloorCacheKey(t);console.time("zstd_json");let n=yield fetch(t.map_url).then(r=>r.json());return n.floor=t.floor,console.timeEnd("zstd_json"),this.setCacheData(Ac,e,n),this.setCacheData(Mc,e,t.version_id),n})}getFloorJsonData(t){return g(this,null,function*(){let e=this.floors.find(r=>r.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(Mc,n))===e.version_id){let o=yield this.getCacheData(Ac,n);if(o)return o}return this.getFloorJsonDataByFloorInfo(e)}catch(r){return console.log("[get floor data error]",r),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return g(this,null,function*(){return(yield Promise.all(this.floors.map(e=>g(this,null,function*(){let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(jc,n))===e.version_id){let s=yield this.getCacheData(Va,n);if(s)return s}let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Va,n,o),this.setCacheData(jc,n,e.version_id),o}catch(r){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Va,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return g(this,null,function*(){let t=this.floors.reduce((r,o)=>r.updated_at>o.updated_at?r:o,this.floors[0]);if(!t)return null;let e=this.getFloorCacheKey(t),n=()=>g(this,null,function*(){let r=yield fetch(t.entry_infra_url).then(o=>o.json());return r&&(this.setCacheData(Tc,e,r),this.setCacheData(gc,e,t.version_id)),r});try{if((yield this.getCacheData(gc,e))===t.version_id){let o=yield this.getCacheData(Tc,e);if(o)return o}return n()}catch(r){return console.log("[get facility error]",r),n()}})}getOtherDataByFreeTime(){return g(this,null,function*(){})}getMulFloorsData(t){return g(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return g(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e){return g(this,null,function*(){return e=this.getFloorBaseLayer(t,e),yield this.getFloorContentLayer(t,e),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new Ja.Vector3),r=Math.max(n.x,n.y,n.z);e.userData.height=r/4+t.floorHeight}switchFloor(t){return g(this,null,function*(){return new Promise(e=>{let n={run:()=>this._switchFloor(t),meta:{type:"switchFloor"}},r=this.taskQueue.replaceByMetaType(n),o=s=>{let{task:a,res:l}=s;a.tid===r&&(this.taskQueue.removeEventListener("active-task-end",o),e(l))};this.taskQueue.addEventListener("active-task-end",o)})})}_switchFloor(t){return g(this,null,function*(){var e;let n=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)n=l;else return null}let r=new Nt(this.bmap.context),o=this.floors.find(l=>l.floor===n.floor);var s;let a=(s=o==null?void 0:o.map_angle)!=null?s:0;return this.bmap.dispatchEvent({type:Pt.SWITCH_FLOOR_BEFORE,data:{curFloor:r,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:r,graphics:[]}}),this.bmap.context.control.setAzimuthalAngle(a/180*Math.PI,!0),this.getFloorBaseLayer(n,r),this.changeFloorBox(n,r),this.bmap.buildingCenter=r.userData.center,this.bmap.currentBuildGround=(e=r.userData.data.layers.find(l=>l.l_type==="range"))==null?void 0:e.elements[0],this.bmap.context.switchFloor(r),this.bmap.initialFloorCamera(),yield Ms(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:r,graphics:[]}}),yield this.getFloorContentLayer(n,r),this.changeFloorBox(n,r),this.bmap.initialFloorCamera(),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:r,graphics:r.graphicLayer.children}}),this.bmap.dispatchEvent({type:Pt.SWITCH_FLOOR_AFTER,data:{curFloor:r,graphics:r.graphicLayer.children}}),r})}getFloorBaseLayer(t,e){e||(e=new Nt(this.bmap.context));let n=[0,0];return t.layers.forEach(r=>{switch(r.l_type){case"range":let o=r.elements[0];n=[o.center_x,o.center_y];break;case"ground":At(r.elements,n);let s=r.elements.map(a=>new tt(this.bmap.context,a));e.addGrounds(s);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return g(this,null,function*(){e||(e=new Nt(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let r=0;r<t.layers.length;r++){let o=t.layers[r];["range","ground"].includes(o.l_type)||(dT(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>16&&(yield Ms(),n=Date.now()))}return e})}clear(){return g(this,null,function*(){var t;pT((t=this.db)!=null?t:void 0)})}dispose(){this.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new Vn,this.options=w({},K3,e),this.initDbPromise=this.initDb()}};var t5=f(I(),1);var Wc=class{load(t){return g(this,null,function*(){let e=Nn(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),yc(t,this.bmap.config)]),r=Nn({floor:t.floor,ts:t.ts});At(n.map(s=>s.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(r)||0),n.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let o=this.floorDataLengthMap.get(r)||0;return this.floorDataLengthMap.set(r,o+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return g(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,r=e.userData.graphicMap||new Map,{ground:o,markGraphic:s,graphic:a}=this.bmap.config;for(let l=0;l<t.length;l++){let u=t[l];u.info.group==="ground"?(u.info.fillColor=o.color,u.info.fillOpacity=o.opacity,u.info.height=o.height,u.info.stroke=o.stroke,u.info.strokeColor=o.strokeColor,u.info.strokeOpacity=o.strokeOpacity):u.info.userData.mark?(u.info.height=s.height,u.info.fillColor=s.color,u.info.fillOpacity=s.opacity,u.info.stroke=s.stroke,u.info.strokeColor=s.strokeColor,u.info.strokeOpacity=s.strokeOpacity):(u.info.fillOpacity=a.fillOpacity,this.bmap.config.initTransToMark&&(u.info.height=s.height,u.info.fillColor=s.color,u.info.stroke=s.stroke,u.info.strokeColor=s.strokeColor,u.info.strokeOpacity=s.strokeOpacity))}for(let l of t){if(l.info.group==="ground")e.createGround(l.info);else{let u=e.addGraphic(l.info);u.userData.data=l,n.set(l.legacy_id,u)}r.set(l.element_uuid,l)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=r,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(Pt.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(Pt.SWITCH_FLOOR_AFTER,{curFloor:e,graphics:e.graphicLayer.children})):this.bmap.switchFloorByFloor(e)}filterData(t,e){let n=e.userData.graphicMap||new Map;return t.filter(r=>!n.has(r.element_uuid))}switchFloorByStoreData(t,e){return g(this,null,function*(){let n=yield this.load(w({},t,{resource_type_list:"6"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}switchFloorByOtherData(t,e){return g(this,null,function*(){let n=yield this.load(w({},t,{resource_type_list:"1,2,3,4"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}loadBuildGround(t){return g(this,null,function*(){let{brand:e,project:n}=t,r=yield this.loadBuildingGround({brand:e,project:n});return this.bmap.currentBuildGround=r,this.bmap.changeBuildingCenter(r,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return g(this,null,function*(){let{brand:e,project:n}=t,r=Nn({brand:e,project:n});if(this.buildingGroundMap.has(r))return this.buildingGroundMap.get(r);let o=mc({brand:e,project:n},this.bmap.config).then(s=>(this.buildingGroundMap.set(r,s),s));return this.buildingGroundMap.set(r,o),o})}switchFloor(t){return g(this,null,function*(){let e=new Nt(this.bmap.context);e.userData.graphicMap=new Map,e.name=t.floor;try{yield Promise.all([this.switchFloorByStoreData(t,e),this.switchFloorByOtherData(t,e)])}catch(n){console.log(n)}return e})}dispose(){this.cacheData.clear(),this.floorDataLengthMap.clear(),this.buildingGroundMap.clear()}constructor(t){this.bmap=t,this.cacheData=new Map,this.floorDataLengthMap=new Map,this.buildingGroundMap=new Map,this.externalStreetMap=new Map}};