@aibee/crc-bmap 0.8.97 → 0.8.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +1 -1
- package/lib/index.esm.min.js +1 -1
- package/lib/index.js +1 -1
- package/lib/index.online.esm.min.js +1 -1
- package/lib/platform/wrapper.cjs +1 -1
- package/lib/platform/wrapper.esm.min.js +1 -1
- package/lib/platform/wrapper.js +1 -1
- package/lib/platform/wrapper.online.esm.min.js +1 -1
- package/lib/src/elements/merge-graphic.d.ts +4 -4
- package/lib/src/elements/merge-graphic.js +3 -3
- package/package.json +1 -1
|
@@ -3908,7 +3908,7 @@ void main() {
|
|
|
3908
3908
|
gl_FragColor = vec4(uColor2, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
|
|
3909
3909
|
}
|
|
3910
3910
|
}
|
|
3911
|
-
`,n=-1/0,i=this.geometry.getAttribute("position");if(i)for(let s=0;s<i.count;s++){let a=i.getZ(s);a>n&&(n=a)}let o=new zR({uniforms:{maxZ:{value:n},uColor:{value:new h1(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new h1(Ze(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=V.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 FR(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:i}=n.geometry;for(let o=0;o<i.length;o++){let s=i[o];for(let a=0;a<s.length;a++){let u=s[a],l=a+1===s.length?s[0]:s[a+1];t.push(new c1(u[0],u[1],e)),t.push(new c1(l[0],l[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new KR().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new NR(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=>T({},Ic,n)),this.init()}};var HH=d(_(),1);import{Box2 as Dc,Object3D as UR,Sprite as p1,SpriteMaterial as f1,Vector2 as ia}from"three";import{isNil as Ki}from"lodash";var GR={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,hide_text:!1},nt=class extends UR{get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?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.hasText?this.options.text_font_size*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:n,text_texture_offset_x:i,text_texture_offset_y:o}=this.options;return!Ki(t)&&!Ki(e)&&!Ki(n)&&!Ki(i)&&!Ki(o)}get deltaZ(){return!this.options.icon&&this.hasText?.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=>A(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.initSize(),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 A(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>A(this,null,function*(){let e;if(this.options.icon_border){let{icon:i,icon_size:o,icon_border:s}=this.options;e=yield ut.getUrlTextureBorder(i,o[0]-s.width*2,s)}else e=yield ut.getTextureByUrl(this.options.icon);let n=new p1(new f1({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.hasText){let t;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:i,text_texture_height:o,text_texture_offset_x:s,text_texture_offset_y:a}=this.options;t=this.options.text_texture.clone(),t.uuid=n.uuid,t.offset.set(s/t.image.width,1-(o+a)/t.image.height),t.repeat.set(i/t.image.width,o/t.image.height),this.textAspect=i/o}else t=tt.getTextureByText(this.options.text),this.textAspect=t.image.width/t.image.height;let e=new p1(new f1({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,i=0,{icon:o}=this.options;o?this.hasText?(n=0,i=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,i=0):this.hasText?(i=.5,n=0):(n=0,i=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,i)}init(){return A(this,null,function*(){yield Promise.all([this.initIcon(),new Promise(t=>{this.initText(),t(!0)})]),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,i=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 Dc(new ia(i-s,o-this.iconHeight),new ia(i+s,o)),u=this.textWidth/2,l=new Dc(new ia(i-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new ia(i+u,o-this.iconHeight-this.durIconAndText));return this.box=l.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 Dc,this._initIconPromise=null,this._initScale=n=>{let{zoom:i}=n;if(this.spriteText){let s=this.textHeight/i;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]/i,this.options.icon_size[1]/i,.1)}this.resetZ()},this.options=Hn(T({},GR,e),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};import{DoubleSide as kR,Matrix4 as d1,Mesh as VR,MeshBasicMaterial as LR,Object3D as JR,PlaneGeometry as BR}from"three";import{mergeGeometries as HR}from"three/examples/jsm/utils/BufferGeometryUtils";var QR={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},oa=class extends JR{init(){return A(this,null,function*(){let t=this.options.map(s=>tt.getTextureByText(s.texts[0],{fillStyle:P0(s.fillColor,s.fillOpacity),strokeStyle:P0(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"bold 54px sans-serif"})),e=t.map((s,a)=>{let u=this.options[a],{width:l,height:c}=s.image,h=l/c,p=u.secondHeight*h,f=new BR(p,u.secondHeight),g=new d1().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new d1().makeRotationZ(u.secondRotate));return f.applyMatrix4(g),f}),n=HR(e,!0);e.forEach(s=>s.dispose());let i=t.map(s=>{let a=new LR({map:s,alphaTest:1,side:kR});return s.needsUpdate=!0,a}),o=new VR(n,i);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=>T({},QR,n)),this.init()}};import{Object3D as qR}from"three";import{Line2 as $R}from"three/examples/jsm/lines/Line2";import{LineGeometry as t9}from"three/examples/jsm/lines/LineGeometry";import{LineMaterial as e9}from"three/examples/jsm/lines/LineMaterial";var Ni=class extends qR{registryEvent(){this.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.context.removeEventListener("resize",this.onResize)}setPosition(t,e){this.lineGeometry.setPositions([t.x,t.y,t.z,e.x,e.y,e.z]),this.line||this.createLine()}createLine(){this.line=new $R(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&q(this.line),this.lineGeometry=null,this.lineMaterial=null,this.clear(),(t=this.line)==null||t.clear(),this.line=null}constructor(t,e,n){super(),this.context=t,this.lineGeometry=new t9,this.lineMaterial=new e9({color:0,transparent:!0,depthTest:!1,linewidth:2}),this.line=null,this.onResize=()=>{let{width:i,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(i,o)},this.onResize(),this.registryEvent(),e&&n&&this.setPosition(e,n)}};import{Frustum as n9}from"three";var sa=class extends Bt{setEnable(t){super.setEnable(t),dt(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:n,clientHeight:i}}}=this,o=x(this.startPoint,e,n,i),s=x(this.endPoint,e,n,i),a={x:Math.min(o.x,s.x),y:Math.min(o.y,s.y)},u={x:Math.max(o.x,s.x),y:Math.max(o.y,s.y)},l=this.searchMapInFrustum(a,u);this.dispatchEvent({type:"selected",list:l})}}searchMapInFrustum(t,e){var n;let{context:i}=this;return((n=i.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof et&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:i,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let f=x(p,i,o,s);return nn(f,e,n)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let a=t.mesh.geometry.boundingBox;if(!a)return!1;let{min:u,max:l}=a,c=x(u,i,o,s),h=x(l,i,o,s);return!(!nn(c,e,n)||!nn(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new n9,this.onPointerDown=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=i=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o)},this.onPointerUp=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let i=this.getSvgCoordinate(this.startPoint),o=T({},i);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(i.x,o.x),y:Math.min(i.y,o.y)},a=Math.abs(o.x-i.x),u=Math.abs(o.y-i.y);dt(this.rect,s.x,s.y,a,u)}else dt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=rn(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var aa=class extends r9{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:i}=e,{x:o,y:s}=this.downPoint;if(Math.sqrt((o-n)**2+(s-i)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(n,i),u=new Set(a.map(c=>c.options.id));this.context.getPoisByDeviceXy(n,i).forEach(c=>{if(!u.has(c.options.id)){var h;let p=((h=this.context.currentFloor)==null?void 0:h.graphicLayer.graphicMap.get(c.options.id))||null;p&&p.options.geometry.type==="point"&&(a.push(p),u.add(c.options.id))}}),(qn?e.metaKey:e.ctrlKey)||this._list.clear(),a.forEach(c=>this._list.add(c)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{$n(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{$n(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:n}=e;this._list.clear(),n.forEach(i=>{this._list.add(i)}),this.selectEnd()},this.boxSelection=new sa(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var C5=d(me(),1),X5=d(ge(),1),Z5=d(ye(),1),O5=d(Me(),1),R5=d(Pe(),1),F5=d(Ae(),1),K5=d(je(),1),N5=d(_(),1);import{EventDispatcher as i9,Vector2 as o9}from"three";var ua=class extends i9{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 G,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:n,pois:i,e:o}=e,s=i.map(c=>{var h;return(h=this.context.currentFloor)==null?void 0:h.graphicLayer.graphicMap.get(c.options.id)}).filter(c=>c&&c.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,u=new Set;if(s.length){let c,h=1e4;s.forEach(p=>{let f=i.find(g=>g.options.id===p.options.id);if(f instanceof Cn){let{x:g,y}=f.clientPos,P=Math.sqrt((g-o.offsetX)**2+(y-o.offsetY)**2);P<h&&(h=P,c=p)}else if(f instanceof nt){let{x:g,y}=f.box.getCenter(new o9),P=Math.sqrt((g-o.offsetX)**2+(y-o.offsetY)**2);P<h&&(h=P,c=p)}}),u.add(c)}u.size||n.forEach(c=>u.add(c)),u.forEach(c=>{if(this.graphicTimerMap.get(c)||this.curGraphics.has(c))return;let h=this.timer.setTimeout(()=>{this.curGraphics.add(c),this.graphicTimerMap.delete(c),this.timer.clearTimeout(h),this.handleHoverGraphicsChange()},a);this.graphicTimerMap.set(c,h)}),this.graphicTimerMap.forEach((c,h)=>{u.has(h)||(this.timer.clearTimeout(c),this.graphicTimerMap.delete(h))});let l=this.curGraphics.size;this.curGraphics.forEach(c=>{u.has(c)||this.curGraphics.delete(c)}),l!==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 V5=d(_(),1);import{Box3 as s9,Vector3 as la}from"three";var ca=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(P=>P instanceof Jt).length)return null;let e=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:s,max:a}=e,u=x(s,n,i,o),l=x(a,n,i,o),c=x(new la(s.x,a.y,a.z),n,i,o),h=x(new la(a.x,s.y,s.z),n,i,o),p=Math.min(u.x,l.x,c.x,h.x),f=Math.max(u.x,l.x,c.x,h.x),g=Math.min(u.y,l.y,c.y,h.y),y=Math.max(u.y,l.y,c.y,h.y);return{left:p,right:f,top:g,bottom:y}}checkDistanceToScreenEdge(t){let{left:e,right:n,top:i,bottom:o}=t,{width:s,height:a}=this.context.clientSize,[u,l,c,h]=this.context.config.cameraBound.padding,p=n>=h,f=s-e>=l,g=a-i>=c,y=o>=u;return p&&f&&g&&y}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new la,zoom:1,target:new la},this.enable=!0,this.box=new s9,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:n,right:i,top:o,bottom:s}=e;this.checkDistanceToScreenEdge({left:n,right:i,top:o,bottom:s})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var aQ=d(Zc(),1);import{Vector3 as I1}from"three";import{Tween as ma,Group as x9}from"@tweenjs/tween.js";var rQ=d(_(),1),iQ=d(X(),1);import{EventDispatcher as v9,MOUSE as Sr,Quaternion as x1,Spherical as pa,TOUCH as br,Vector2 as It,Vector3 as Ht,Plane as S9,Ray as b9,MathUtils as w9}from"three";var fa=new b9,W1=new S9,_9=Math.cos(70*w9.DEG2RAD),da=class extends v9{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 It,this.rotateLineEnd=new It,this.spherical=new pa,this.sphericalDelta=new pa,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Ht,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:Sr.PAN,MIDDLE:Sr.DOLLY,RIGHT:Sr.ROTATE},this.touches={ONE:br.PAN,TWO:br.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(M){M.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=M},this.stopListenToKeyEvents=function(){var M;(M=this._domElementKeyEvents)==null||M.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=i.NONE},this.update=function(){let M=new Ht,v=new x1().setFromUnitVectors(t.up,new Ht(0,1,0)),K=v.clone().invert(),H=new Ht,bt=new x1,pe=new Ht,Qt=2*Math.PI;return function(Er){Er===void 0&&(Er=null);let xe=n.object.position;M.copy(xe).sub(n.target),M.applyQuaternion(v),a.setFromVector3(M),n.autoRotate&&o===i.NONE&&N(L(Er)),n.enableDamping?(a.theta+=u.theta*n.dampingFactor,a.phi+=u.phi*n.dampingFactor):(a.theta+=u.theta,a.phi+=u.phi);let We=n.minAzimuthAngle,Ie=n.maxAzimuthAngle;isFinite(We)&&isFinite(Ie)&&(We<-Math.PI?We+=Qt:We>Math.PI&&(We-=Qt),Ie<-Math.PI?Ie+=Qt:Ie>Math.PI&&(Ie-=Qt),We<=Ie?a.theta=Math.max(We,Math.min(Ie,a.theta)):a.theta=a.theta>(We+Ie)/2?Math.max(We,a.theta):Math.min(Ie,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),n.zoomToCursor&&Z||n.object.isOrthographicCamera?a.radius=St(a.radius):a.radius=St(a.radius*l),M.setFromSpherical(a),M.applyQuaternion(K),xe.copy(n.target).add(M),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),c.set(0,0,0));let Li=!1;if(n.zoomToCursor&&Z){let Yr=null;if(n.object.isPerspectiveCamera){let Dr=M.length();Yr=St(Dr*l);let Ji=Dr-Yr;n.object.position.addScaledVector(I,Ji),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let Dr=new Ht(W.x,W.y,0);Dr.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Li=!0;let Ji=new Ht(W.x,W.y,0);Ji.unproject(n.object),n.object.position.sub(Ji).add(Dr),n.object.updateMatrixWorld(),Yr=M.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Yr!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Yr).add(n.object.position):(fa.origin.copy(n.object.position),fa.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(fa.direction))<_9?t.lookAt(n.target):(W1.setFromNormalAndCoplanarPoint(n.object.up,n.target),fa.intersectPlane(W1,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Li=!0);return l=1,Z=!1,Li||H.distanceToSquared(n.object.position)>s||8*(1-bt.dot(n.object.quaternion))>s||pe.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),H.copy(n.object.position),bt.copy(n.object.quaternion),pe.copy(n.target),Li=!1,!0):!1}}();let n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=i.NONE,s=1e-6,a=new pa,u=new pa,l=1,c=new Ht,h=new It,p=new It,f=new It,g=new It,y=new It,P=new It,j=new It,S=new It,b=new It,I=new Ht,W=new It,Z=!1,w=[],E={};function L(M){return M!==null?2*Math.PI/60*n.autoRotateSpeed*M:2*Math.PI/60/60*n.autoRotateSpeed}function J(){return Math.pow(.95,n.zoomSpeed)}function N(M){u.theta-=M}function ht(M){u.phi-=M}let Pt=function(){let M=new Ht;return function(K,H){M.setFromMatrixColumn(H,0),M.multiplyScalar(-K),c.add(M)}}(),Yt=function(){let M=new Ht;return function(K,H){n.screenSpacePanning===!0?M.setFromMatrixColumn(H,1):(M.setFromMatrixColumn(H,0),M.crossVectors(n.object.up,M)),M.multiplyScalar(K),c.add(M)}}(),Dt=function(){let M=new Ht;return function(K,H){let bt=n.domElement;if(n.object.isPerspectiveCamera){let pe=n.object.position;M.copy(pe).sub(n.target);let Qt=M.length();Qt*=Math.tan(n.object.fov/2*Math.PI/180),Pt(2*K*Qt/bt.clientHeight,n.object.matrix),Yt(2*H*Qt/bt.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(Pt(K*(n.object.right-n.object.left)/n.object.zoom/bt.clientWidth,n.object.matrix),Yt(H*(n.object.top-n.object.bottom)/n.object.zoom/bt.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Rn(M){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=M:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Wr(M){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=M:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ir(M){if(!n.zoomToCursor)return;Z=!0;let v=n.domElement.getBoundingClientRect(),K=M.clientX-v.left,H=M.clientY-v.top,bt=v.width,pe=v.height;W.x=K/bt*2-1,W.y=-(H/pe)*2+1,I.set(W.x,W.y,1).unproject(n.object).sub(n.object.position).normalize()}function St(M){return Math.max(n.minDistance,Math.min(n.maxDistance,M))}function $c(M){h.set(M.clientX,M.clientY)}function hT(M){Ir(M),j.set(M.clientX,M.clientY)}function th(M){g.set(M.clientX,M.clientY)}function pT(M){p.set(M.clientX,M.clientY),f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let v=n.domElement;N(2*Math.PI*f.x/v.clientHeight),ht(2*Math.PI*f.y/v.clientHeight),h.copy(p),n.update()}function fT(M){S.set(M.clientX,M.clientY),b.subVectors(S,j),b.y>0?Rn(J()):b.y<0&&Wr(J()),j.copy(S),n.update()}function dT(M){y.set(M.clientX,M.clientY),P.subVectors(y,g).multiplyScalar(n.panSpeed),Dt(P.x,P.y),g.copy(y),n.update()}function mT(M){Ir(M),M.deltaY<0?Wr(J()):M.deltaY>0&&Rn(J()),n.update()}function gT(M){let v=!1;switch(M.code){case n.keys.UP:M.ctrlKey||M.metaKey||M.shiftKey?ht(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Dt(0,n.keyPanSpeed),v=!0;break;case n.keys.BOTTOM:M.ctrlKey||M.metaKey||M.shiftKey?ht(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Dt(0,-n.keyPanSpeed),v=!0;break;case n.keys.LEFT:M.ctrlKey||M.metaKey||M.shiftKey?N(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Dt(n.keyPanSpeed,0),v=!0;break;case n.keys.RIGHT:M.ctrlKey||M.metaKey||M.shiftKey?N(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Dt(-n.keyPanSpeed,0),v=!0;break}v&&(M.preventDefault(),n.update())}function eh(){if(w.length===1)h.set(w[0].pageX,w[0].pageY);else{let M=(w[0].pageX-w[0].pageY)/(w[1].pageX-w[1].pageY),v=w[0].pageY-M*w[0].pageX;n.rotateLineStart.set(M,v);let K=.5*(w[0].pageX+w[1].pageX),H=.5*(w[0].pageY+w[1].pageY);h.set(K,H)}}function nh(){if(w.length===1)g.set(w[0].pageX,w[0].pageY);else{let M=.5*(w[0].pageX+w[1].pageX),v=.5*(w[0].pageY+w[1].pageY);g.set(M,v)}}function rh(){let M=w[0].pageX-w[1].pageX,v=w[0].pageY-w[1].pageY,K=Math.sqrt(M*M+v*v);j.set(0,K)}function yT(){n.enableZoom&&rh(),n.enablePan&&nh()}function MT(){n.enableZoom&&rh(),n.enableRotate&&eh()}function ih(M){if(w.length==1)p.set(M.pageX,M.pageY);else{let K=za(M),H=.5*(M.pageX+K.x),bt=.5*(M.pageY+K.y);p.set(H,bt);let pe=(M.pageY-K.y)/(M.pageX-K.x),Qt=K.y-pe*K.x;if(n.rotateLineEnd.set(pe,Qt),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let Ua=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),Er=pe*Ua+Qt;if(Number.isFinite(Ua)&&Number.isFinite(Er)){let xe=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(xe)<.5&&(xe=-Math.sign(xe)*(Math.PI-Math.abs(xe))),Math.abs(xe)<.1&&(u.theta+=xe)}}n.rotateLineStart.copy(n.rotateLineEnd)}f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let v=n.domElement;ht(2*Math.PI*f.y/v.clientHeight),h.copy(p)}function oh(M){if(w.length===1)y.set(M.pageX,M.pageY);else{let v=za(M),K=.5*(M.pageX+v.x),H=.5*(M.pageY+v.y);y.set(K,H)}P.subVectors(y,g).multiplyScalar(n.panSpeed),Dt(P.x,P.y),g.copy(y)}function sh(M){let v=za(M),K=M.pageX-v.x,H=M.pageY-v.y,bt=Math.sqrt(K*K+H*H);S.set(0,bt),b.set(0,Math.pow(S.y/j.y,n.zoomSpeed)),Rn(b.y),j.copy(S)}function PT(M){n.enableZoom&&sh(M),n.enablePan&&oh(M)}function AT(M){n.enableZoom&&sh(M),n.enableRotate&&ih(M)}this.onPointerDown=function(v){n.enabled!==!1&&(w.length===0&&(n.domElement.setPointerCapture(v.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),bT(v),v.pointerType==="touch"?vT(v):jT(v))},this.onPointerMove=function(v){n.enabled!==!1&&(v.pointerType==="touch"?ST(v):TT(v))},this.onPointerUp=function(v){wT(v),w.length===0&&(n.domElement.releasePointerCapture(v.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=i.NONE};function jT(M){let v;switch(M.button){case 0:v=n.mouseButtons.LEFT;break;case 1:v=n.mouseButtons.MIDDLE;break;case 2:v=n.mouseButtons.RIGHT;break;default:v=-1}switch(v){case Sr.DOLLY:if(n.enableZoom===!1)return;hT(M),o=i.DOLLY;break;case Sr.ROTATE:if(M.ctrlKey||M.metaKey||M.shiftKey){if(n.enablePan===!1)return;th(M),o=i.PAN}else{if(n.enableRotate===!1)return;$c(M),o=i.ROTATE}break;case Sr.PAN:if(M.ctrlKey||M.metaKey||M.shiftKey){if(n.enableRotate===!1)return;$c(M),o=i.ROTATE}else{if(n.enablePan===!1)return;th(M),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function TT(M){switch(o){case i.ROTATE:if(n.enableRotate===!1)return;pT(M);break;case i.DOLLY:if(n.enableZoom===!1)return;fT(M);break;case i.PAN:if(n.enablePan===!1)return;dT(M);break}}this.onMouseWheel=function(v){n.enabled===!1||n.enableZoom===!1||o!==i.NONE||(v.preventDefault(),n.dispatchEvent({type:"start"}),mT(v),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(v){n.enabled===!1||n.enablePan===!1||gT(v)};function vT(M){switch(ah(M),w.length){case 1:switch(n.touches.ONE){case br.ROTATE:if(n.enableRotate===!1)return;eh(),o=i.TOUCH_ROTATE;break;case br.PAN:if(n.enablePan===!1)return;nh(),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(n.touches.TWO){case br.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;yT(),o=i.TOUCH_DOLLY_PAN;break;case br.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;MT(),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function ST(M){switch(ah(M),o){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;ih(M),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;oh(M),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;PT(M),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;AT(M),n.update();break;default:o=i.NONE}}this.onContextMenu=function(v){n.enabled!==!1&&v.preventDefault()};function bT(M){w.push(M)}function wT(M){delete E[M.pointerId];for(let v=0;v<w.length;v++)if(w[v].pointerId==M.pointerId){w.splice(v,1);return}}function ah(M){let v=E[M.pointerId];v===void 0&&(v=new It,E[M.pointerId]=v),v.set(M.pageX,M.pageY)}function za(M){let v=M.pointerId===w[0].pointerId?w[1]:w[0];return E[v.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 ga=class extends da{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:i}=this,o=n===i;(e||t<=n&&t>=i)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=n,this.minPolarAngle=i)}setPolarAngleByDuration(t,e,n){return A(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):Rt(new Promise(i=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new ma(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:n,minAzimuthAngle:i}=this,o=n===i;(e||t<=n&&t>=i)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=n,this.minAzimuthAngle=i)}setAzimuthalAngleDuration(t,e,n){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setAzimuthalAngle(t,e):Rt(new Promise(i=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new ma(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}getCameraLookAt(){return new I1().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return A(this,null,function*(){let n=this.target.clone(),i=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(i)),this.target.copy(t.clone()),this.update();return}return Rt(new Promise(o=>{let s=new ma(n,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(n.clone().sub(i)),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:i,maxZoom:o}=this;(n||t>=i&&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,i){return A(this,null,function*(){n===void 0&&(n=!1),i===void 0&&(i=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return i?Rt(new Promise(s=>{let a=new ma(o,this.tweenGroup).to({zoom:t,target:e},i).onUpdate(()=>{this.setZoom(o.zoom,o.target,n)}).onComplete(()=>{this.tweenGroup.remove(a),this.enabled=!0,s(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500).finally(()=>{this.enabled=!0}):this.setZoom(t,e,n)})}setTargetByOffset(t,e){if(e===void 0&&(e=this.target.clone()),this.camera.updateMatrix(),t){let n=new I1;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 x9,this.offsetY=0,this.onChange=()=>{let i=this.camera.zoom;i!==this.prevCameraZoom&&(this.prevCameraZoom=i,this.dispatchEvent({type:"change-zoom",zoom:i}))},this.tweenUpdate=()=>{this.tweenGroup.update()},this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=e.zoom,this.registryEvent()}};import{EventDispatcher as W9,PCFSoftShadowMap as I9,WebGLRenderer as E9}from"three";var ya=class extends E9{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(T({antialias:!0,alpha:!0},t)),this.event=new W9,this.enable=!0,this.timer=new G,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=I9}};import{Euler as Y9,Matrix4 as D9,Scene as C9,EquirectangularReflectionMapping as X9}from"three";import{RGBELoader as Z9}from"three/examples/jsm/loaders/RGBELoader.js";var Ma=class extends C9{constructor(){super(),new Z9().load(Qj,t=>{t.mapping=X9,this.environment=t;let e=new D9;e.makeRotationX(Math.PI/2),this.environmentRotation=new Y9().setFromRotationMatrix(e)})}};import{OrthographicCamera as O9}from"three";var Pa=class extends O9{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 Aa=class extends R9{resizeClientSize(){let{x:t,y:e,width:n,height:i}=this.container.getBoundingClientRect();this.clientSize={width:n||this.container.clientWidth,height:i||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new Pa(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new ga(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 ca(this)}getRatio(t,e){t===void 0&&(t=new ke(0,0,0)),e===void 0&&(e=new ke(100,0,0));let{clientWidth:n,clientHeight:i}=this.container,o=x(t,this.camera,n,i),s=x(e,this.camera,n,i);return Math.ceil(Math.sqrt((s.x-o.x)**2+(s.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof U9&&(e.color=new z9(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 i=new wr;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new K9;return o.setFromCamera(i,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,i;let o=(n=this.currentFloor)==null?void 0:n.poiLayer.getPoiByDeviceXy(t,e),s=(i=this.currentFloor)==null?void 0:i.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,i){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),i===void 0&&(i=!0);let[o,s,a,u]=e,{clientSize:{width:l,height:c}}=this,h=this.control.getPolarAngle();i&&this.setPolarAngle(0,0);let p=new N9().setFromObject(t);this.setPolarAngle(h,0);let{max:f,min:g}=p,y=new ke(g.x,f.y,f.z),P=new ke(f.x,f.y,f.z),j=new ke(f.x,g.y,g.z),S=new ke(g.x,g.y,g.z),b=x(y,this.camera,l,c),I=x(P,this.camera,l,c),W=x(S,this.camera,l,c),Z=x(j,this.camera,l,c),E=new F9().setFromPoints([new wr(b.x,b.y),new wr(I.x,I.y),new wr(W.x,W.y),new wr(Z.x,Z.y)]).getSize(new wr),L=(l-s-u)/E.x,J=(c-o-a)/E.y,N=Math.min(L,J),ht=new ke((f.x+g.x)/2,(f.y+g.y)/2,(f.z+g.z)/2),Pt=N*this.camera.zoom,Yt=this.camera.clone();Yt.zoom=Pt,Yt.updateMatrix();let Dt=(l-E.x*N)/2,Rn=(c-E.y*N)/2,Wr=(s-u)/2,Ir=(o-a)/2;if(Wr){let St=new ke;St.setFromMatrixColumn(Yt.matrix,0),St.normalize(),St.multiplyScalar(Wr/Pt),ht.add(St)}if(Ir){let St=new ke;St.setFromMatrixColumn(Yt.matrix,1),St.normalize(),St.multiplyScalar(Ir/Pt),ht.add(St)}return{zoom:N*this.camera.zoom,center:ht}}fitCameraToObject(t,e,n,i){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),i===void 0&&(i=!0);let{zoom:o,center:s}=this.getFitCameraToObjectZoom(t,e,n,i);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 A(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()),q(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new Ma,this.renderer=new ya,this.lights=km(),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:i}=n;this.dispatchEvent({type:"control-zoom-change",zoom:i})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:n,camera:i,renderer:o}=this,{clientWidth:s,clientHeight:a}=n;s=Math.max(1,s),a=Math.max(1,a),i.left=-s/2,i.right=s/2,i.top=a/2,i.bottom=-a/2,i.updateProjectionMatrix(),o.setSize(s,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:s,height:a})},this.onClick=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY);i.length&&this.dispatchEvent({type:"graphic-click",graphics:i,position:o});let s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);s.length&&this.dispatchEvent({type:"poi-click",pois:s})},this.onPointerover=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:i,pois:s,position:o})},this.onPointermove=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:i,pois:s,position:o})},this.onPointerleave=n=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=n=>{let{graphics:i,isMultipleSelect:o}=n;this.dispatchEvent({type:"select-graphic",graphics:i,isMultipleSelect:o})},this.onHoverChange=n=>{let{graphics:i}=n;this.dispatchEvent({type:"hover",graphics:i})},this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new aa(this),this.hoverHelper=new ua(this),this.resizeClientSize(),this.registryEvent()}};import{merge as G9}from"lodash";var k9={placeId:0,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",loadPlaceInfo:"https://screen.aibee.cn/ai-map/map/get-floor-map"},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 E1(r){return G9({},k9,r)}import{debounce as cF}from"lodash";var HQ=d(_(),1);var ce;function Y1(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(ce)return e({db:ce,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){ce=o.target.result,console.log("onupgradeneeded"),e({db:ce,type:"onupgradeneeded"})},i.onsuccess=o=>{ce=o.target.result,e({db:ce,type:"success"})},i.onerror=o=>{n(o)}})}function Oc(r,t,e){return e===void 0&&(e=ce),new Promise((n,i)=>{e||i("\u6CA1\u6709db");let s=e.transaction([r],"readonly").objectStore(r).get(t);s.onsuccess=()=>{s.result?n(s.result.value):n(null)},s.onerror=a=>{console.log("[getVersionByKey]",a),n(null)}})}function D1(r,t,e,n){return n===void 0&&(n=ce),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>A(this,null,function*(){let u=yield Oc(r,t),l=n.transaction([r],"readwrite").objectStore(r),c=u!==null?l.put({key:t,value:e}):l.add({key:t,value:e});c.onsuccess=function(h){s(h)},c.onerror=function(h){a(h)}}))))}function Xn(r,t){t===void 0&&(t=ce),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function C1(r){r===void 0&&(r=ce),r==null||r.close(),ce=null}import{Vector3 as iF,EventDispatcher as oF,Color as sF}from"three";var zQ=d(X(),1),UQ=d(_(),1);function ja(r,t){let e=r.poi_info.showName||r.store_name||r.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=r.store_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var i;return((i=r.store_info_ext)==null?void 0:i.traditional_name)||e}}function Ta(r,t){let e=r.poi_info.showName||r.store_name||r.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=r.infra_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var i;return((i=r.infra_info_ext)==null?void 0:i.traditional_name)||e}}function X1(r,t,e){switch(r.l_type){case"graph":return V9(r,t);case"wall":return L9(r,t);case"lane":return J9(r,t);case"texture2d":case"texture3d":return B9(r,t);case"glb":return H9(r,t);case"store":return Q9(r,t);case"facility":return $9(r,t);case"parkingSpace":return eF(r,t,e);case"text":return rF(r,t)}}function Z1(r,t,e,n){switch(r.l_type){case"store":return q9(r,t,e,n.showStoreName);case"facility":return tF(r,t,e,n.showFacilityName);case"parkingSpace":return nF(r,t)}}function V9(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l,airHeight:c}=i,h=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l+"-"+c;return u===0&&(h=o.toLowerCase()+"-"+s+"-"+l+"-"+c),n[h]?n[h].push(i):n[h]=[i],n},{});Object.values(e).forEach(n=>{let i=new vr(t.context,n);t.mergeGraphicLayer.add(i)})}function L9(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l}=i,c=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l;return u===0&&(c=o.toLowerCase()+"-"+s+"-"+l),n[c]?n[c].push(i):n[c]=[i],n},{});Object.values(e).forEach(n=>{let i=new ea(t.context,n);t.wallLayer.add(i)})}function J9(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u}=i,l=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u;return u===0&&(l=o.toLowerCase()+"-"+s),n[l]?n[l].push(i):n[l]=[i],n},{});Object.values(e).forEach(n=>{let i=new ra(t.context,n);t.laneLayer.add(i)})}function B9(r,t){if(r.elements.length){let e=new Tr(t.context,r.elements);t.textureLayer.add(e)}}function H9(r,t){r.elements.forEach(e=>{let n=new na(t.context,T({},e,{url:e.secondUrl,rotate:e.secondRotate,width:e.secondWidth,center_x:e.center_coord_x,center_y:e.center_coord_y}));t.glbModelLayer.add(n)})}function Q9(r,t){r.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function q9(r,t,e,n){r.elements.map(i=>{try{let o=ja(i,e),s=new nt(t.context,{id:i.id,icon:i.poi_info.icon,text:o,position:{x:i.center_coord_x,y:i.center_coord_y,z:i.airHeight+i.height},icon_size:[24,24],level:i.poi_info.level||0,hide_text:!n});t.poiLayer2.pushPoi(s),s&&(s.userData.type="store",s.userData.data=i,s.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,i)}})}function $9(r,t){r.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function tF(r,t,e,n){r.elements.filter(o=>o.poi_info).map(o=>{try{let s=Ta(o,e),a=new nt(t.context,{id:o.id,icon:o.poi_info.icon,text:s,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},icon_size:[24,24],level:o.poi_info.level||0,hide_text:!n});t.poiLayer2.pushPoi(a),a.userData.type="facility",a.userData.data=o,a.userData.floor=t.name}catch(s){console.log("\u6DFB\u52A0facility\u5931\u8D25",s,o)}})}function eF(r,t,e){t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function nF(r,t){return A(this,null,function*(){let e=r.elements.filter(o=>o.texts[0]),n=e.map(o=>o.texts[0]),i=yield tt.lazyGetTextureByTexts(n);e.forEach(o=>{try{let s=o.texts[0],a=new nt(t.context,{id:o.id,text:s,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},text_texture:i[s].texture,text_texture_width:i[s].width,text_texture_height:i[s].height,text_texture_offset_x:i[s].x,text_texture_offset_y:i[s].y});a&&(a.userData.type="parkingSpace",a.userData.data=o,a.userData.floor=t.name),t.poiLayer2.pushPoi(a)}catch(s){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",s,o)}}),Object.values(i).forEach(o=>{o.texture.dispose()})})}function rF(r,t){let e=new oa(t.context,r.elements.map(n=>T({},n,{center_x:n.center_coord_x,center_y:n.center_coord_y})));t.textTextureLayer.add(e)}var Rc="map_version",Fc="route_version",Kc="facility_version",Nc="map_data",va="road_network_data",zc="facility_data",aF={mergeParkingSpace:!0},_r=class extends oF{initDb(){return A(this,null,function*(){try{let{db:t,type:e}=yield Y1("aibee_map",2);e==="onupgradeneeded"&&(Xn(Rc),Xn(Fc),Xn(Kc),Xn(Nc),Xn(va),Xn(zc)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return A(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=T({},this.placeConfig,e));else{let n=yield fetch(t).then(i=>i.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=T({},this.placeConfig,JSON.parse(n.data.config||"{}")))}})}setCacheData(t,e,n){return this.initDbPromise.then(()=>D1(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>Oc(t,""+e,this.db))}getFloorCacheKey(t){return""+t.floor_id}getFloorData(t){return A(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return A(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}setLocale(t){this.locale=t,this.bmap.context.currentFloor&&this.bmap.context.currentFloor.poiLayer2.pois.forEach(e=>{e.userData.type==="store"&&(e.options.text=ja(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=Ta(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return A(this,null,function*(){let e=this.getFloorCacheKey(t);console.time("zstd_json");let n=yield fetch(t.map_url).then(i=>i.json());return n.floor=t.floor,console.timeEnd("zstd_json"),this.setCacheData(Nc,e,n),this.setCacheData(Rc,e,t.version_id),n})}getFloorJsonData(t){return A(this,null,function*(){let e=this.floors.find(i=>i.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(Rc,n))===e.version_id){let o=yield this.getCacheData(Nc,n);if(o)return o}return this.getFloorJsonDataByFloorInfo(e)}catch(i){return console.log("[get floor data error]",i),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return A(this,null,function*(){return(yield Promise.all(this.floors.map(e=>A(this,null,function*(){let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(Fc,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(Fc,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(va,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return A(this,null,function*(){let t=this.floors.reduce((i,o)=>i.updated_at>o.updated_at?i:o,this.floors[0]);if(!t)return null;let e=this.getFloorCacheKey(t),n=()=>A(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(zc,e,i),this.setCacheData(Kc,e,t.version_id)),i});try{if((yield this.getCacheData(Kc,e))===t.version_id){let o=yield this.getCacheData(zc,e);if(o)return o}return n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return A(this,null,function*(){})}getMulFloorsData(t){return A(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return A(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return A(this,null,function*(){return e=this.getFloorBaseLayer(t,e),n=T({},this.placeConfig,n),t.layers.forEach(i=>{["range","ground"].includes(i.l_type)||rr(i.elements,e.userData.center)}),yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,n),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new iF),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t,e){return A(this,null,function*(){return new Promise(n=>{let i={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(i),s=a=>{let{task:u,res:l}=a;u.tid===o&&(this.taskQueue.removeEventListener("active-task-end",s),n(l))};this.taskQueue.addEventListener("active-task-end",s)})})}_switchFloor(t,e){return A(this,null,function*(){var n;let i=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)i=l;else return null}e=T({},this.placeConfig,e);let o=new Jt(this.bmap.context);o.userData.data=t;let s=this.floors.find(l=>l.floor===i.floor);var a;let u=(a=s==null?void 0:s.map_angle)!=null?a:0;return this.bmap.dispatchEvent({type:ct.SWITCH_FLOOR_BEFORE,data:{curFloor:o,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:o,graphics:[],floorData:i}}),this.bmap.context.control.setAzimuthalAngle(u/180*Math.PI,!0),this.bmap.context.scene.background=new sF(e.backgroundColor),this.getFloorBaseLayer(i,o),this.changeFloorBox(i,o),this.bmap.buildingCenter=o.userData.center,this.bmap.currentBuildGround=(n=o.userData.data.layers.find(l=>l.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(o),this.bmap.initialFloorCamera(),this.bmap.context.cameraBound.updateBox(),i.layers.forEach(l=>{["range","ground"].includes(l.l_type)||rr(l.elements,o.userData.center)}),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:o,graphics:[]}}),this.bmap.dispatchEvent({type:ct.SWITCH_FLOOR_GROUND,data:{curFloor:o}}),yield Go(),yield this.getFloorContentLayer(i,o),this.changeFloorBox(i,o),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:o,graphics:[]}}),yield Og(2),yield this.getFloorPoi(i,o,e),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:o,graphics:o.graphicLayer.children}}),this.bmap.dispatchEvent({type:ct.SWITCH_FLOOR_AFTER,data:{curFloor:o,graphics:o.graphicLayer.children}}),o})}getFloorBaseLayer(t,e){e||(e=new Jt(this.bmap.context));let n=[0,0];return t.layers.forEach(i=>{switch(i.l_type){case"range":let o=i.elements[0];n=[o.center_x,o.center_y];break;case"ground":rr(i.elements,n);let s=i.elements.map(a=>new et(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 A(this,null,function*(){e||(e=new Jt(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let i=0;i<t.layers.length;i++){let o=t.layers[i];["range","ground"].includes(o.l_type)||(X1(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield Go(),n=Date.now()))}return e})}getFloorPoi(t,e,n){return A(this,null,function*(){n===void 0&&(n=this.placeConfig);let i=Date.now();yield Promise.all(t.layers.map(s=>Z1(s,e,this.locale,n))),console.log("poi time",Date.now()-i);let o=Date.now();Go().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return A(this,null,function*(){var t;C1((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 ir,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0},this.options=T({},aF,e),this.initDbPromise=this.initDb()}};var lq=d(_(),1);function O1(r,t){return A(this,null,function*(){let{brand:e,project:n}=r,{apiDomain:i,apiPath:{floorRange:o},apiInfo:s}=t,a=""+i+o+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n;return yield fetch(a,s).then(l=>l.json()).then(l=>l.data).then(l=>{let c=(l||[])[0];return c&&(c.info=JSON.parse(c.info)),c})})}function R1(r,t){return A(this,null,function*(){let{brand:e,project:n,floor:i,ts:o,resource_type_list:s}=r,{apiDomain:a,apiPath:{floorGraphic:u},apiInfo:l}=t,c=""+a+u+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+i+"&ts="+o+"&resource_type_list="+s;return yield fetch(c,l).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(f=>f.info=JSON.parse(f.info)),p||[]))})}function oq(r,t){return A(this,null,function*(){let{project:e,floor:n}=r,{apiDomain:i,apiInfo:o}=t,s=i+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+n;return yield fetch(s,o).then(u=>u.json()).then(u=>u.data).then(u=>JSON.parse(u[0].streetInfo||"{}")).then(u=>u.fileId?uF(u.fileId,t):null)})}function uF(r,t){return A(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+r,n).then(i=>i.arrayBuffer()).then(i=>{let s=new TextDecoder("utf-8").decode(i);return s?JSON.parse(s):null})})}var F1=class{load(t){return A(this,null,function*(){let e=tr(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),R1(t,this.bmap.config)]),i=tr({floor:t.floor,ts:t.ts});rr(n.map(s=>s.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(i)||0),n.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let o=this.floorDataLengthMap.get(i)||0;return this.floorDataLengthMap.set(i,o+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return A(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,i=e.userData.graphicMap||new Map,{ground:o,markGraphic:s,graphic:a}=this.bmap.config;for(let u=0;u<t.length;u++){let l=t[u];l.info.group==="ground"?(l.info.fillColor=o.color,l.info.fillOpacity=o.opacity,l.info.height=o.height,l.info.stroke=o.stroke,l.info.strokeColor=o.strokeColor,l.info.strokeOpacity=o.strokeOpacity):l.info.userData.mark?(l.info.height=s.height,l.info.fillColor=s.color,l.info.fillOpacity=s.opacity,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity):(l.info.fillOpacity=a.fillOpacity,this.bmap.config.initTransToMark&&(l.info.height=s.height,l.info.fillColor=s.color,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity))}for(let u of t){if(u.info.group==="ground")e.createGround(u.info);else{let l=e.addGraphic(u.info);l.userData.data=u,n.set(u.legacy_id,l)}i.set(u.element_uuid,u)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=i,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(ct.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(ct.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(i=>!n.has(i.element_uuid))}switchFloorByStoreData(t,e){return A(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"6"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}switchFloorByOtherData(t,e){return A(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"1,2,3,4"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}loadBuildGround(t){return A(this,null,function*(){let{brand:e,project:n}=t,i=yield this.loadBuildingGround({brand:e,project:n});return this.bmap.currentBuildGround=i,this.bmap.changeBuildingCenter(i,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return A(this,null,function*(){let{brand:e,project:n}=t,i=tr({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=O1({brand:e,project:n},this.bmap.config).then(s=>(this.buildingGroundMap.set(i,s),s));return this.buildingGroundMap.set(i,o),o})}switchFloor(t){return A(this,null,function*(){let e=new Jt(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}};var xq=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),Sa=class extends lF{changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?Ro(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:i,brand:n})}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor(t){return A(this,null,function*(){return this.loader||(this.loader=new _r(this),yield this.loader.load(this.config.apiPath.loadPlaceInfo+"?place_id="+this.config.placeId+"&env=prod")),this.loader.switchFloor(t)})}switchFloorByFloor(t,e){e===void 0&&(e=t.graphicLayer.children),this.triggerHooks(ct.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(ct.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 i=(n=this.context.currentFloor)==null?void 0:n.addModel(T({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(i){let{facilityAngle:o=0,facilityXScale:s=1,facilityYScale:a=1}=t.options.userData;i.rotateZ((180-o)/180*Math.PI),i.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 et))||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let n=t.options.center,i=t.getCenter(),o=(n==null?void 0:n[0])||i.x,s=(n==null?void 0:n[1])||i.y;return console.log(o,s,n,i),this.context.currentFloor.addPoi(T({},e,{position:{x:o,y:s,z:i.z+t.options.height/2}}))}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,n,i){e===void 0&&(e=500),n===void 0&&(n=0),i===void 0&&(i=0);let o=t.getPosition().clone(),{context:{camera:s}}=this;if(s.updateMatrix(),i){let a=new Uc;a.setFromMatrixColumn(s.matrix,1),a.normalize(),a.multiplyScalar(i/s.zoom),o.add(a)}if(n){let a=new Uc;a.setFromMatrixColumn(s.matrix,0),a.normalize(),a.multiplyScalar(n/s.zoom),o.add(a)}return this.context.setCameraPosition(o,e)}translateElementToCenterX(t,e){return A(this,null,function*(){return e===void 0&&(e=500),Rt(new Promise(n=>{let i=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:s,height:a},camera:u}=this.context,c=x(o,u,s,a).x-s/2,h=new Uc;h.setFromMatrixColumn(this.context.camera.matrix,0),h.normalize(),h.multiplyScalar(c/this.context.camera.zoom),i.add(h),this.context.setCameraPosition(i,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:i}=this.container;return x(e,this.context.camera,n,i)}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 A(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 A(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new $s(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",i=>{let{distance:o}=i;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 ta(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",i=>{let{area:o}=i;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=Ro(this.currentBuildGround.info.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=n[0],o[1]-=n[1]})});else{let[i,o]=t.geometry.cds;t.geometry.coords=[i-n[0],o-n[1]]}}return(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.loader&&(this.loader.dispose(),this.loader=null),this.unRegistryEvent(),this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.plugins=[],this.context.dispose(),this.context=null,this.container=null,tt.dispose(),ut.dispose(),an.dispose(),Tt.dispose(),V.dispose(),le.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 G,this.plugins=[],this.loader=null,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 i=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=i,this.context.control.minPolarAngle=i}if(this.azimuthalKeys.includes(n.code)){let i=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=i,this.context.control.minAzimuthAngle=i}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),i=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(this.config.defaultPadding,0)||1;this.context.camera.zoom=i,this.context.control.minZoom=o,this.context.control.maxZoom=o*25,this.basicZoom=i,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=E1(e),this.context=new Aa(t,this.config),this.debounceResize=cF(this.resize,5),this.registryEvent()}};var Dq=d(_(),1);import{EventDispatcher as hF}from"three";var vt=class extends hF{dispose(){let t=this.bmap.plugins.findIndex(e=>e===this);t!==-1&&this.bmap.plugins.splice(t,1),this.bmap=null}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var K1=class extends vt{fetchEquipment(){return A(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,i=""+t+e;yield fetch(i,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)),i=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});i&&(i.userData.data=n,i.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(ct.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(ct.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var U$=d(ei(),1),G$=d(ne(),1),k$=d(_(),1),V$=d(Zc(),1);var r$=d(_(),1),i$=d(X(),1);import{Mesh as PF,Object3D as AF,TextureLoader as jF,Color as TF,Vector2 as kc,Vector3 as vF,NormalBlending as SF,RepeatWrapping as bF}from"three";var Rq=d(Ol(),1),Fq=d(pi(),1),Kq=d(fi(),1),Nq=d(mi(),1),zq=d(gi(),1),Uq=d(yi(),1),Gq=d(Pi(),1),kq=d(Ai(),1),Vq=d(ji(),1),Lq=d(Ti(),1),Jq=d(vi(),1),Bq=d(Si(),1),Hq=d(bi(),1),Qq=d(_i(),1),qq=d(xi(),1),$q=d(X(),1),t$=d(wc(),1);import{BufferGeometry as pF,Matrix4 as z1,Vector3 as Zn,Ray as fF,Sphere as dF,LineSegments as mF,BufferAttribute as Mn,ShaderChunk as Et,ShaderMaterial as U1,UniformsLib as gF,Color as yF,Vector2 as N1}from"three";var Mt=class extends pF{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 z1,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)}}})}};Mt.prototype.setMatrixWorld=function(r){this.matrixWorld=r};Mt.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};Mt.prototype.setPoints=function(r,t){if(!(r instanceof Float32Array)&&!(r instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=r,this.widthCallback=t,this.positions=[],this.counters=[],r.length&&r[0]instanceof Zn)for(var e=0;e<r.length;e++){var n=r[e],i=e/r.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(i),this.counters.push(i)}else for(var e=0;e<r.length;e+=3){var i=e/r.length;this.positions.push(r[e],r[e+1],r[e+2]),this.positions.push(r[e],r[e+1],r[e+2]),this.counters.push(i),this.counters.push(i)}this.process()};function MF(r,t){var e=new z1,n=new fF,i=new dF,o=new Zn,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(this.matrixWorld),r.ray.intersectSphere(i,o)!==!1){e.copy(this.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(e);var a=new Zn,u=new Zn,l=new Zn,c=this instanceof mF?2:1,h=s.index,p=s.attributes;if(h!==null)for(var f=h.array,g=p.position.array,y=p.width.array,P=0,j=f.length-1;P<j;P+=c){var S=f[P],b=f[P+1];a.fromArray(g,S*3),u.fromArray(g,b*3);var I=y[Math.floor(P/3)]!==void 0?y[Math.floor(P/3)]:1,W=r.params.Line.threshold+this.material.lineWidth*I/2,Z=W*W,w=n.distanceSqToSegment(a,u,o,l);if(!(w>Z)){o.applyMatrix4(this.matrixWorld);var E=r.ray.origin.distanceTo(o);E<r.near||E>r.far||(t.push({distance:E,point:l.clone().applyMatrix4(this.matrixWorld),index:P,face:null,faceIndex:null,object:this}),P=j)}}}}Mt.prototype.raycast=MF;Mt.prototype.compareV3=function(r,t){var e=r*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]};Mt.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};Mt.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=new Zn(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new Zn(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=i.distanceTo(o);t+=s}return t};Mt.prototype.process=function(){var r=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(r-1);var n;this.compareV3(0,r-1)?n=this.copyV3(r-2):n=this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(var i=0;i<r;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(i/(r-1)):t=1,this.width.push(t),this.width.push(t),i===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(i===r-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(i)/e;this.uvs.push(s,0),this.uvs.push(s,1)}if(i<r-1){n=this.copyV3(i),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var o=i*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}i>0&&(n=this.copyV3(i),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(r-1,0)?n=this.copyV3(1):n=this.copyV3(r-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new Mn(new Float32Array(this.positions),3),previous:new Mn(new Float32Array(this.previous),3),next:new Mn(new Float32Array(this.next),3),side:new Mn(new Float32Array(this.side),1),width:new Mn(new Float32Array(this.width),1),uv:new Mn(new Float32Array(this.uvs),2),index:new Mn(new Uint16Array(this.indices_array),1),counters:new Mn(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 Gc(r,t,e,n,i){var o;if(r=r.subarray||r.slice?r:r.buffer,e=e.subarray||e.slice?e:e.buffer,r=t?r.subarray?r.subarray(t,i&&t+i):r.slice(t,i&&t+i):r,e.set)e.set(r,n);else for(o=0;o<r.length;o++)e[o+n]=r[o];return e}Mt.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;Gc(t,0,e,0,i),Gc(t,6,t,0,i-6),t[i-6]=r.x,t[i-5]=r.y,t[i-4]=r.z,t[i-3]=r.x,t[i-2]=r.y,t[i-1]=r.z,Gc(t,6,n,0,i-6),n[i-6]=r.x,n[i-5]=r.y,n[i-4]=r.z,n[i-3]=r.x,n[i-2]=r.y,n[i-1]=r.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};Et.meshline_vert=["",Et.logdepthbuf_pars_vertex,Et.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;","",Et.logdepthbuf_vertex,Et.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",Et.fog_vertex,"}"].join(`
|
|
3911
|
+
`,n=-1/0,i=this.geometry.getAttribute("position");if(i)for(let s=0;s<i.count;s++){let a=i.getZ(s);a>n&&(n=a)}let o=new zR({uniforms:{maxZ:{value:n},uColor:{value:new h1(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new h1(Ze(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=V.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 FR(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:i}=n.geometry;for(let o=0;o<i.length;o++){let s=i[o];for(let a=0;a<s.length;a++){let u=s[a],l=a+1===s.length?s[0]:s[a+1];t.push(new c1(u[0],u[1],e)),t.push(new c1(l[0],l[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new KR().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new NR(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t,e,n;(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.line)==null||n.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>T({},Ic,n)),this.init()}};var HH=d(_(),1);import{Box2 as Dc,Object3D as UR,Sprite as p1,SpriteMaterial as f1,Vector2 as ia}from"three";import{isNil as Ki}from"lodash";var GR={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,hide_text:!1},nt=class extends UR{get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?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.hasText?this.options.text_font_size*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:n,text_texture_offset_x:i,text_texture_offset_y:o}=this.options;return!Ki(t)&&!Ki(e)&&!Ki(n)&&!Ki(i)&&!Ki(o)}get deltaZ(){return!this.options.icon&&this.hasText?.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=>A(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.initSize(),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 A(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>A(this,null,function*(){let e;if(this.options.icon_border){let{icon:i,icon_size:o,icon_border:s}=this.options;e=yield ut.getUrlTextureBorder(i,o[0]-s.width*2,s)}else e=yield ut.getTextureByUrl(this.options.icon);let n=new p1(new f1({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.hasText){let t;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:i,text_texture_height:o,text_texture_offset_x:s,text_texture_offset_y:a}=this.options;t=this.options.text_texture.clone(),t.uuid=n.uuid,t.offset.set(s/t.image.width,1-(o+a)/t.image.height),t.repeat.set(i/t.image.width,o/t.image.height),this.textAspect=i/o}else t=tt.getTextureByText(this.options.text),this.textAspect=t.image.width/t.image.height;let e=new p1(new f1({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,i=0,{icon:o}=this.options;o?this.hasText?(n=0,i=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,i=0):this.hasText?(i=.5,n=0):(n=0,i=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,i)}init(){return A(this,null,function*(){yield Promise.all([this.initIcon(),new Promise(t=>{this.initText(),t(!0)})]),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,i=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 Dc(new ia(i-s,o-this.iconHeight),new ia(i+s,o)),u=this.textWidth/2,l=new Dc(new ia(i-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new ia(i+u,o-this.iconHeight-this.durIconAndText));return this.box=l.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 Dc,this._initIconPromise=null,this._initScale=n=>{let{zoom:i}=n;if(this.spriteText){let s=this.textHeight/i;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]/i,this.options.icon_size[1]/i,.1)}this.resetZ()},this.options=Hn(T({},GR,e),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};import{DoubleSide as kR,Matrix4 as d1,Mesh as VR,MeshBasicMaterial as LR,Object3D as JR,PlaneGeometry as BR}from"three";import{mergeGeometries as HR}from"three/examples/jsm/utils/BufferGeometryUtils";var QR={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},oa=class extends JR{init(){return A(this,null,function*(){let t=this.options.map(s=>tt.getTextureByText(s.texts[0],{fillStyle:P0(s.fillColor,s.fillOpacity),strokeStyle:P0(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"bold 54px sans-serif"})),e=t.map((s,a)=>{let u=this.options[a],{width:l,height:c}=s.image,h=l/c,p=u.secondHeight*h,f=new BR(p,u.secondHeight),g=new d1().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new d1().makeRotationZ(u.secondRotate));return f.applyMatrix4(g),f}),n=HR(e,!0);e.forEach(s=>s.dispose());let i=t.map(s=>{let a=new LR({map:s,alphaTest:1,side:kR});return s.needsUpdate=!0,a}),o=new VR(n,i);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=>T({},QR,n)),this.init()}};import{Object3D as qR}from"three";import{Line2 as $R}from"three/examples/jsm/lines/Line2";import{LineGeometry as t9}from"three/examples/jsm/lines/LineGeometry";import{LineMaterial as e9}from"three/examples/jsm/lines/LineMaterial";var Ni=class extends qR{registryEvent(){this.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.context.removeEventListener("resize",this.onResize)}setPosition(t,e){this.lineGeometry.setPositions([t.x,t.y,t.z,e.x,e.y,e.z]),this.line||this.createLine()}createLine(){this.line=new $R(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&q(this.line),this.lineGeometry=null,this.lineMaterial=null,this.clear(),(t=this.line)==null||t.clear(),this.line=null}constructor(t,e,n){super(),this.context=t,this.lineGeometry=new t9,this.lineMaterial=new e9({color:0,transparent:!0,depthTest:!1,linewidth:2}),this.line=null,this.onResize=()=>{let{width:i,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(i,o)},this.onResize(),this.registryEvent(),e&&n&&this.setPosition(e,n)}};import{Frustum as n9}from"three";var sa=class extends Bt{setEnable(t){super.setEnable(t),dt(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:n,clientHeight:i}}}=this,o=x(this.startPoint,e,n,i),s=x(this.endPoint,e,n,i),a={x:Math.min(o.x,s.x),y:Math.min(o.y,s.y)},u={x:Math.max(o.x,s.x),y:Math.max(o.y,s.y)},l=this.searchMapInFrustum(a,u);this.dispatchEvent({type:"selected",list:l})}}searchMapInFrustum(t,e){var n;let{context:i}=this;return((n=i.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof et&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:i,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let f=x(p,i,o,s);return nn(f,e,n)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let a=t.mesh.geometry.boundingBox;if(!a)return!1;let{min:u,max:l}=a,c=x(u,i,o,s),h=x(l,i,o,s);return!(!nn(c,e,n)||!nn(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new n9,this.onPointerDown=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=i=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o)},this.onPointerUp=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let i=this.getSvgCoordinate(this.startPoint),o=T({},i);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(i.x,o.x),y:Math.min(i.y,o.y)},a=Math.abs(o.x-i.x),u=Math.abs(o.y-i.y);dt(this.rect,s.x,s.y,a,u)}else dt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=rn(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var aa=class extends r9{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:i}=e,{x:o,y:s}=this.downPoint;if(Math.sqrt((o-n)**2+(s-i)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(n,i),u=new Set(a.map(c=>c.options.id));this.context.getPoisByDeviceXy(n,i).forEach(c=>{if(!u.has(c.options.id)){var h;let p=((h=this.context.currentFloor)==null?void 0:h.graphicLayer.graphicMap.get(c.options.id))||null;p&&p.options.geometry.type==="point"&&(a.push(p),u.add(c.options.id))}}),(qn?e.metaKey:e.ctrlKey)||this._list.clear(),a.forEach(c=>this._list.add(c)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{$n(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{$n(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:n}=e;this._list.clear(),n.forEach(i=>{this._list.add(i)}),this.selectEnd()},this.boxSelection=new sa(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var C5=d(me(),1),X5=d(ge(),1),Z5=d(ye(),1),O5=d(Me(),1),R5=d(Pe(),1),F5=d(Ae(),1),K5=d(je(),1),N5=d(_(),1);import{EventDispatcher as i9,Vector2 as o9}from"three";var ua=class extends i9{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 G,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:n,pois:i,e:o}=e,s=i.map(c=>{var h;return(h=this.context.currentFloor)==null?void 0:h.graphicLayer.graphicMap.get(c.options.id)}).filter(c=>c&&c.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,u=new Set;if(s.length){let c,h=1e4;s.forEach(p=>{let f=i.find(g=>g.options.id===p.options.id);if(f instanceof Cn){let{x:g,y}=f.clientPos,P=Math.sqrt((g-o.offsetX)**2+(y-o.offsetY)**2);P<h&&(h=P,c=p)}else if(f instanceof nt){let{x:g,y}=f.box.getCenter(new o9),P=Math.sqrt((g-o.offsetX)**2+(y-o.offsetY)**2);P<h&&(h=P,c=p)}}),u.add(c)}u.size||n.forEach(c=>u.add(c)),u.forEach(c=>{if(this.graphicTimerMap.get(c)||this.curGraphics.has(c))return;let h=this.timer.setTimeout(()=>{this.curGraphics.add(c),this.graphicTimerMap.delete(c),this.timer.clearTimeout(h),this.handleHoverGraphicsChange()},a);this.graphicTimerMap.set(c,h)}),this.graphicTimerMap.forEach((c,h)=>{u.has(h)||(this.timer.clearTimeout(c),this.graphicTimerMap.delete(h))});let l=this.curGraphics.size;this.curGraphics.forEach(c=>{u.has(c)||this.curGraphics.delete(c)}),l!==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 V5=d(_(),1);import{Box3 as s9,Vector3 as la}from"three";var ca=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(P=>P instanceof Jt).length)return null;let e=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:s,max:a}=e,u=x(s,n,i,o),l=x(a,n,i,o),c=x(new la(s.x,a.y,a.z),n,i,o),h=x(new la(a.x,s.y,s.z),n,i,o),p=Math.min(u.x,l.x,c.x,h.x),f=Math.max(u.x,l.x,c.x,h.x),g=Math.min(u.y,l.y,c.y,h.y),y=Math.max(u.y,l.y,c.y,h.y);return{left:p,right:f,top:g,bottom:y}}checkDistanceToScreenEdge(t){let{left:e,right:n,top:i,bottom:o}=t,{width:s,height:a}=this.context.clientSize,[u,l,c,h]=this.context.config.cameraBound.padding,p=n>=h,f=s-e>=l,g=a-i>=c,y=o>=u;return p&&f&&g&&y}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new la,zoom:1,target:new la},this.enable=!0,this.box=new s9,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:n,right:i,top:o,bottom:s}=e;this.checkDistanceToScreenEdge({left:n,right:i,top:o,bottom:s})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var aQ=d(Zc(),1);import{Vector3 as I1}from"three";import{Tween as ma,Group as x9}from"@tweenjs/tween.js";var rQ=d(_(),1),iQ=d(X(),1);import{EventDispatcher as v9,MOUSE as Sr,Quaternion as x1,Spherical as pa,TOUCH as br,Vector2 as It,Vector3 as Ht,Plane as S9,Ray as b9,MathUtils as w9}from"three";var fa=new b9,W1=new S9,_9=Math.cos(70*w9.DEG2RAD),da=class extends v9{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 It,this.rotateLineEnd=new It,this.spherical=new pa,this.sphericalDelta=new pa,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Ht,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:Sr.PAN,MIDDLE:Sr.DOLLY,RIGHT:Sr.ROTATE},this.touches={ONE:br.PAN,TWO:br.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(M){M.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=M},this.stopListenToKeyEvents=function(){var M;(M=this._domElementKeyEvents)==null||M.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=i.NONE},this.update=function(){let M=new Ht,v=new x1().setFromUnitVectors(t.up,new Ht(0,1,0)),K=v.clone().invert(),H=new Ht,bt=new x1,pe=new Ht,Qt=2*Math.PI;return function(Er){Er===void 0&&(Er=null);let xe=n.object.position;M.copy(xe).sub(n.target),M.applyQuaternion(v),a.setFromVector3(M),n.autoRotate&&o===i.NONE&&N(L(Er)),n.enableDamping?(a.theta+=u.theta*n.dampingFactor,a.phi+=u.phi*n.dampingFactor):(a.theta+=u.theta,a.phi+=u.phi);let We=n.minAzimuthAngle,Ie=n.maxAzimuthAngle;isFinite(We)&&isFinite(Ie)&&(We<-Math.PI?We+=Qt:We>Math.PI&&(We-=Qt),Ie<-Math.PI?Ie+=Qt:Ie>Math.PI&&(Ie-=Qt),We<=Ie?a.theta=Math.max(We,Math.min(Ie,a.theta)):a.theta=a.theta>(We+Ie)/2?Math.max(We,a.theta):Math.min(Ie,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),n.zoomToCursor&&Z||n.object.isOrthographicCamera?a.radius=St(a.radius):a.radius=St(a.radius*l),M.setFromSpherical(a),M.applyQuaternion(K),xe.copy(n.target).add(M),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),c.set(0,0,0));let Li=!1;if(n.zoomToCursor&&Z){let Yr=null;if(n.object.isPerspectiveCamera){let Dr=M.length();Yr=St(Dr*l);let Ji=Dr-Yr;n.object.position.addScaledVector(I,Ji),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let Dr=new Ht(W.x,W.y,0);Dr.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Li=!0;let Ji=new Ht(W.x,W.y,0);Ji.unproject(n.object),n.object.position.sub(Ji).add(Dr),n.object.updateMatrixWorld(),Yr=M.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Yr!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Yr).add(n.object.position):(fa.origin.copy(n.object.position),fa.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(fa.direction))<_9?t.lookAt(n.target):(W1.setFromNormalAndCoplanarPoint(n.object.up,n.target),fa.intersectPlane(W1,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Li=!0);return l=1,Z=!1,Li||H.distanceToSquared(n.object.position)>s||8*(1-bt.dot(n.object.quaternion))>s||pe.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),H.copy(n.object.position),bt.copy(n.object.quaternion),pe.copy(n.target),Li=!1,!0):!1}}();let n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=i.NONE,s=1e-6,a=new pa,u=new pa,l=1,c=new Ht,h=new It,p=new It,f=new It,g=new It,y=new It,P=new It,j=new It,S=new It,b=new It,I=new Ht,W=new It,Z=!1,w=[],E={};function L(M){return M!==null?2*Math.PI/60*n.autoRotateSpeed*M:2*Math.PI/60/60*n.autoRotateSpeed}function J(){return Math.pow(.95,n.zoomSpeed)}function N(M){u.theta-=M}function ht(M){u.phi-=M}let Pt=function(){let M=new Ht;return function(K,H){M.setFromMatrixColumn(H,0),M.multiplyScalar(-K),c.add(M)}}(),Yt=function(){let M=new Ht;return function(K,H){n.screenSpacePanning===!0?M.setFromMatrixColumn(H,1):(M.setFromMatrixColumn(H,0),M.crossVectors(n.object.up,M)),M.multiplyScalar(K),c.add(M)}}(),Dt=function(){let M=new Ht;return function(K,H){let bt=n.domElement;if(n.object.isPerspectiveCamera){let pe=n.object.position;M.copy(pe).sub(n.target);let Qt=M.length();Qt*=Math.tan(n.object.fov/2*Math.PI/180),Pt(2*K*Qt/bt.clientHeight,n.object.matrix),Yt(2*H*Qt/bt.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(Pt(K*(n.object.right-n.object.left)/n.object.zoom/bt.clientWidth,n.object.matrix),Yt(H*(n.object.top-n.object.bottom)/n.object.zoom/bt.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Rn(M){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=M:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Wr(M){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=M:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ir(M){if(!n.zoomToCursor)return;Z=!0;let v=n.domElement.getBoundingClientRect(),K=M.clientX-v.left,H=M.clientY-v.top,bt=v.width,pe=v.height;W.x=K/bt*2-1,W.y=-(H/pe)*2+1,I.set(W.x,W.y,1).unproject(n.object).sub(n.object.position).normalize()}function St(M){return Math.max(n.minDistance,Math.min(n.maxDistance,M))}function $c(M){h.set(M.clientX,M.clientY)}function hT(M){Ir(M),j.set(M.clientX,M.clientY)}function th(M){g.set(M.clientX,M.clientY)}function pT(M){p.set(M.clientX,M.clientY),f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let v=n.domElement;N(2*Math.PI*f.x/v.clientHeight),ht(2*Math.PI*f.y/v.clientHeight),h.copy(p),n.update()}function fT(M){S.set(M.clientX,M.clientY),b.subVectors(S,j),b.y>0?Rn(J()):b.y<0&&Wr(J()),j.copy(S),n.update()}function dT(M){y.set(M.clientX,M.clientY),P.subVectors(y,g).multiplyScalar(n.panSpeed),Dt(P.x,P.y),g.copy(y),n.update()}function mT(M){Ir(M),M.deltaY<0?Wr(J()):M.deltaY>0&&Rn(J()),n.update()}function gT(M){let v=!1;switch(M.code){case n.keys.UP:M.ctrlKey||M.metaKey||M.shiftKey?ht(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Dt(0,n.keyPanSpeed),v=!0;break;case n.keys.BOTTOM:M.ctrlKey||M.metaKey||M.shiftKey?ht(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Dt(0,-n.keyPanSpeed),v=!0;break;case n.keys.LEFT:M.ctrlKey||M.metaKey||M.shiftKey?N(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Dt(n.keyPanSpeed,0),v=!0;break;case n.keys.RIGHT:M.ctrlKey||M.metaKey||M.shiftKey?N(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Dt(-n.keyPanSpeed,0),v=!0;break}v&&(M.preventDefault(),n.update())}function eh(){if(w.length===1)h.set(w[0].pageX,w[0].pageY);else{let M=(w[0].pageX-w[0].pageY)/(w[1].pageX-w[1].pageY),v=w[0].pageY-M*w[0].pageX;n.rotateLineStart.set(M,v);let K=.5*(w[0].pageX+w[1].pageX),H=.5*(w[0].pageY+w[1].pageY);h.set(K,H)}}function nh(){if(w.length===1)g.set(w[0].pageX,w[0].pageY);else{let M=.5*(w[0].pageX+w[1].pageX),v=.5*(w[0].pageY+w[1].pageY);g.set(M,v)}}function rh(){let M=w[0].pageX-w[1].pageX,v=w[0].pageY-w[1].pageY,K=Math.sqrt(M*M+v*v);j.set(0,K)}function yT(){n.enableZoom&&rh(),n.enablePan&&nh()}function MT(){n.enableZoom&&rh(),n.enableRotate&&eh()}function ih(M){if(w.length==1)p.set(M.pageX,M.pageY);else{let K=za(M),H=.5*(M.pageX+K.x),bt=.5*(M.pageY+K.y);p.set(H,bt);let pe=(M.pageY-K.y)/(M.pageX-K.x),Qt=K.y-pe*K.x;if(n.rotateLineEnd.set(pe,Qt),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let Ua=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),Er=pe*Ua+Qt;if(Number.isFinite(Ua)&&Number.isFinite(Er)){let xe=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(xe)<.5&&(xe=-Math.sign(xe)*(Math.PI-Math.abs(xe))),Math.abs(xe)<.1&&(u.theta+=xe)}}n.rotateLineStart.copy(n.rotateLineEnd)}f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let v=n.domElement;ht(2*Math.PI*f.y/v.clientHeight),h.copy(p)}function oh(M){if(w.length===1)y.set(M.pageX,M.pageY);else{let v=za(M),K=.5*(M.pageX+v.x),H=.5*(M.pageY+v.y);y.set(K,H)}P.subVectors(y,g).multiplyScalar(n.panSpeed),Dt(P.x,P.y),g.copy(y)}function sh(M){let v=za(M),K=M.pageX-v.x,H=M.pageY-v.y,bt=Math.sqrt(K*K+H*H);S.set(0,bt),b.set(0,Math.pow(S.y/j.y,n.zoomSpeed)),Rn(b.y),j.copy(S)}function PT(M){n.enableZoom&&sh(M),n.enablePan&&oh(M)}function AT(M){n.enableZoom&&sh(M),n.enableRotate&&ih(M)}this.onPointerDown=function(v){n.enabled!==!1&&(w.length===0&&(n.domElement.setPointerCapture(v.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),bT(v),v.pointerType==="touch"?vT(v):jT(v))},this.onPointerMove=function(v){n.enabled!==!1&&(v.pointerType==="touch"?ST(v):TT(v))},this.onPointerUp=function(v){wT(v),w.length===0&&(n.domElement.releasePointerCapture(v.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=i.NONE};function jT(M){let v;switch(M.button){case 0:v=n.mouseButtons.LEFT;break;case 1:v=n.mouseButtons.MIDDLE;break;case 2:v=n.mouseButtons.RIGHT;break;default:v=-1}switch(v){case Sr.DOLLY:if(n.enableZoom===!1)return;hT(M),o=i.DOLLY;break;case Sr.ROTATE:if(M.ctrlKey||M.metaKey||M.shiftKey){if(n.enablePan===!1)return;th(M),o=i.PAN}else{if(n.enableRotate===!1)return;$c(M),o=i.ROTATE}break;case Sr.PAN:if(M.ctrlKey||M.metaKey||M.shiftKey){if(n.enableRotate===!1)return;$c(M),o=i.ROTATE}else{if(n.enablePan===!1)return;th(M),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function TT(M){switch(o){case i.ROTATE:if(n.enableRotate===!1)return;pT(M);break;case i.DOLLY:if(n.enableZoom===!1)return;fT(M);break;case i.PAN:if(n.enablePan===!1)return;dT(M);break}}this.onMouseWheel=function(v){n.enabled===!1||n.enableZoom===!1||o!==i.NONE||(v.preventDefault(),n.dispatchEvent({type:"start"}),mT(v),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(v){n.enabled===!1||n.enablePan===!1||gT(v)};function vT(M){switch(ah(M),w.length){case 1:switch(n.touches.ONE){case br.ROTATE:if(n.enableRotate===!1)return;eh(),o=i.TOUCH_ROTATE;break;case br.PAN:if(n.enablePan===!1)return;nh(),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(n.touches.TWO){case br.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;yT(),o=i.TOUCH_DOLLY_PAN;break;case br.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;MT(),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function ST(M){switch(ah(M),o){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;ih(M),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;oh(M),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;PT(M),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;AT(M),n.update();break;default:o=i.NONE}}this.onContextMenu=function(v){n.enabled!==!1&&v.preventDefault()};function bT(M){w.push(M)}function wT(M){delete E[M.pointerId];for(let v=0;v<w.length;v++)if(w[v].pointerId==M.pointerId){w.splice(v,1);return}}function ah(M){let v=E[M.pointerId];v===void 0&&(v=new It,E[M.pointerId]=v),v.set(M.pageX,M.pageY)}function za(M){let v=M.pointerId===w[0].pointerId?w[1]:w[0];return E[v.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 ga=class extends da{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:i}=this,o=n===i;(e||t<=n&&t>=i)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=n,this.minPolarAngle=i)}setPolarAngleByDuration(t,e,n){return A(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):Rt(new Promise(i=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new ma(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:n,minAzimuthAngle:i}=this,o=n===i;(e||t<=n&&t>=i)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=n,this.minAzimuthAngle=i)}setAzimuthalAngleDuration(t,e,n){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setAzimuthalAngle(t,e):Rt(new Promise(i=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new ma(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}getCameraLookAt(){return new I1().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return A(this,null,function*(){let n=this.target.clone(),i=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(i)),this.target.copy(t.clone()),this.update();return}return Rt(new Promise(o=>{let s=new ma(n,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(n.clone().sub(i)),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:i,maxZoom:o}=this;(n||t>=i&&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,i){return A(this,null,function*(){n===void 0&&(n=!1),i===void 0&&(i=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return i?Rt(new Promise(s=>{let a=new ma(o,this.tweenGroup).to({zoom:t,target:e},i).onUpdate(()=>{this.setZoom(o.zoom,o.target,n)}).onComplete(()=>{this.tweenGroup.remove(a),this.enabled=!0,s(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500).finally(()=>{this.enabled=!0}):this.setZoom(t,e,n)})}setTargetByOffset(t,e){if(e===void 0&&(e=this.target.clone()),this.camera.updateMatrix(),t){let n=new I1;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 x9,this.offsetY=0,this.onChange=()=>{let i=this.camera.zoom;i!==this.prevCameraZoom&&(this.prevCameraZoom=i,this.dispatchEvent({type:"change-zoom",zoom:i}))},this.tweenUpdate=()=>{this.tweenGroup.update()},this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=e.zoom,this.registryEvent()}};import{EventDispatcher as W9,PCFSoftShadowMap as I9,WebGLRenderer as E9}from"three";var ya=class extends E9{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(T({antialias:!0,alpha:!0},t)),this.event=new W9,this.enable=!0,this.timer=new G,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=I9}};import{Euler as Y9,Matrix4 as D9,Scene as C9,EquirectangularReflectionMapping as X9}from"three";import{RGBELoader as Z9}from"three/examples/jsm/loaders/RGBELoader.js";var Ma=class extends C9{constructor(){super(),new Z9().load(Qj,t=>{t.mapping=X9,this.environment=t;let e=new D9;e.makeRotationX(Math.PI/2),this.environmentRotation=new Y9().setFromRotationMatrix(e)})}};import{OrthographicCamera as O9}from"three";var Pa=class extends O9{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 Aa=class extends R9{resizeClientSize(){let{x:t,y:e,width:n,height:i}=this.container.getBoundingClientRect();this.clientSize={width:n||this.container.clientWidth,height:i||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new Pa(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new ga(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 ca(this)}getRatio(t,e){t===void 0&&(t=new ke(0,0,0)),e===void 0&&(e=new ke(100,0,0));let{clientWidth:n,clientHeight:i}=this.container,o=x(t,this.camera,n,i),s=x(e,this.camera,n,i);return Math.ceil(Math.sqrt((s.x-o.x)**2+(s.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof U9&&(e.color=new z9(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 i=new wr;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new K9;return o.setFromCamera(i,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,i;let o=(n=this.currentFloor)==null?void 0:n.poiLayer.getPoiByDeviceXy(t,e),s=(i=this.currentFloor)==null?void 0:i.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,i){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),i===void 0&&(i=!0);let[o,s,a,u]=e,{clientSize:{width:l,height:c}}=this,h=this.control.getPolarAngle();i&&this.setPolarAngle(0,0);let p=new N9().setFromObject(t);this.setPolarAngle(h,0);let{max:f,min:g}=p,y=new ke(g.x,f.y,f.z),P=new ke(f.x,f.y,f.z),j=new ke(f.x,g.y,g.z),S=new ke(g.x,g.y,g.z),b=x(y,this.camera,l,c),I=x(P,this.camera,l,c),W=x(S,this.camera,l,c),Z=x(j,this.camera,l,c),E=new F9().setFromPoints([new wr(b.x,b.y),new wr(I.x,I.y),new wr(W.x,W.y),new wr(Z.x,Z.y)]).getSize(new wr),L=(l-s-u)/E.x,J=(c-o-a)/E.y,N=Math.min(L,J),ht=new ke((f.x+g.x)/2,(f.y+g.y)/2,(f.z+g.z)/2),Pt=N*this.camera.zoom,Yt=this.camera.clone();Yt.zoom=Pt,Yt.updateMatrix();let Dt=(l-E.x*N)/2,Rn=(c-E.y*N)/2,Wr=(s-u)/2,Ir=(o-a)/2;if(Wr){let St=new ke;St.setFromMatrixColumn(Yt.matrix,0),St.normalize(),St.multiplyScalar(Wr/Pt),ht.add(St)}if(Ir){let St=new ke;St.setFromMatrixColumn(Yt.matrix,1),St.normalize(),St.multiplyScalar(Ir/Pt),ht.add(St)}return{zoom:N*this.camera.zoom,center:ht}}fitCameraToObject(t,e,n,i){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),i===void 0&&(i=!0);let{zoom:o,center:s}=this.getFitCameraToObjectZoom(t,e,n,i);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 A(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()),q(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new Ma,this.renderer=new ya,this.lights=km(),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:i}=n;this.dispatchEvent({type:"control-zoom-change",zoom:i})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:n,camera:i,renderer:o}=this,{clientWidth:s,clientHeight:a}=n;s=Math.max(1,s),a=Math.max(1,a),i.left=-s/2,i.right=s/2,i.top=a/2,i.bottom=-a/2,i.updateProjectionMatrix(),o.setSize(s,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:s,height:a})},this.onClick=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY);i.length&&this.dispatchEvent({type:"graphic-click",graphics:i,position:o});let s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);s.length&&this.dispatchEvent({type:"poi-click",pois:s})},this.onPointerover=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:i,pois:s,position:o})},this.onPointermove=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:i,pois:s,position:o})},this.onPointerleave=n=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=n=>{let{graphics:i,isMultipleSelect:o}=n;this.dispatchEvent({type:"select-graphic",graphics:i,isMultipleSelect:o})},this.onHoverChange=n=>{let{graphics:i}=n;this.dispatchEvent({type:"hover",graphics:i})},this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new aa(this),this.hoverHelper=new ua(this),this.resizeClientSize(),this.registryEvent()}};import{merge as G9}from"lodash";var k9={placeId:0,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",loadPlaceInfo:"https://screen.aibee.cn/ai-map/map/get-floor-map"},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 E1(r){return G9({},k9,r)}import{debounce as cF}from"lodash";var HQ=d(_(),1);var ce;function Y1(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(ce)return e({db:ce,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){ce=o.target.result,console.log("onupgradeneeded"),e({db:ce,type:"onupgradeneeded"})},i.onsuccess=o=>{ce=o.target.result,e({db:ce,type:"success"})},i.onerror=o=>{n(o)}})}function Oc(r,t,e){return e===void 0&&(e=ce),new Promise((n,i)=>{e||i("\u6CA1\u6709db");let s=e.transaction([r],"readonly").objectStore(r).get(t);s.onsuccess=()=>{s.result?n(s.result.value):n(null)},s.onerror=a=>{console.log("[getVersionByKey]",a),n(null)}})}function D1(r,t,e,n){return n===void 0&&(n=ce),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>A(this,null,function*(){let u=yield Oc(r,t),l=n.transaction([r],"readwrite").objectStore(r),c=u!==null?l.put({key:t,value:e}):l.add({key:t,value:e});c.onsuccess=function(h){s(h)},c.onerror=function(h){a(h)}}))))}function Xn(r,t){t===void 0&&(t=ce),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function C1(r){r===void 0&&(r=ce),r==null||r.close(),ce=null}import{Vector3 as iF,EventDispatcher as oF,Color as sF}from"three";var zQ=d(X(),1),UQ=d(_(),1);function ja(r,t){let e=r.poi_info.showName||r.store_name||r.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=r.store_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var i;return((i=r.store_info_ext)==null?void 0:i.traditional_name)||e}}function Ta(r,t){let e=r.poi_info.showName||r.store_name||r.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=r.infra_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var i;return((i=r.infra_info_ext)==null?void 0:i.traditional_name)||e}}function X1(r,t,e){switch(r.l_type){case"graph":return V9(r,t);case"wall":return L9(r,t);case"lane":return J9(r,t);case"texture2d":case"texture3d":return B9(r,t);case"glb":return H9(r,t);case"store":return Q9(r,t);case"facility":return $9(r,t);case"parkingSpace":return eF(r,t,e);case"text":return rF(r,t)}}function Z1(r,t,e,n){switch(r.l_type){case"store":return q9(r,t,e,n.showStoreName);case"facility":return tF(r,t,e,n.showFacilityName);case"parkingSpace":return nF(r,t)}}function V9(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l,airHeight:c}=i,h=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l+"-"+c;return u===0&&(h=o.toLowerCase()+"-"+s+"-"+l+"-"+c),n[h]?n[h].push(i):n[h]=[i],n},{});Object.values(e).forEach(n=>{let i=new vr(t.context,n);t.mergeGraphicLayer.add(i)})}function L9(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l}=i,c=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l;return u===0&&(c=o.toLowerCase()+"-"+s+"-"+l),n[c]?n[c].push(i):n[c]=[i],n},{});Object.values(e).forEach(n=>{let i=new ea(t.context,n);t.wallLayer.add(i)})}function J9(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u}=i,l=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u;return u===0&&(l=o.toLowerCase()+"-"+s),n[l]?n[l].push(i):n[l]=[i],n},{});Object.values(e).forEach(n=>{let i=new ra(t.context,n);t.laneLayer.add(i)})}function B9(r,t){if(r.elements.length){let e=new Tr(t.context,r.elements);t.textureLayer.add(e)}}function H9(r,t){r.elements.forEach(e=>{let n=new na(t.context,T({},e,{url:e.secondUrl,rotate:e.secondRotate,width:e.secondWidth,center_x:e.center_coord_x,center_y:e.center_coord_y}));t.glbModelLayer.add(n)})}function Q9(r,t){r.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function q9(r,t,e,n){r.elements.map(i=>{try{let o=ja(i,e),s=new nt(t.context,{id:i.id,icon:i.poi_info.icon,text:o,position:{x:i.center_coord_x,y:i.center_coord_y,z:i.airHeight+i.height},icon_size:[24,24],level:i.poi_info.level||0,hide_text:!n});t.poiLayer2.pushPoi(s),s&&(s.userData.type="store",s.userData.data=i,s.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,i)}})}function $9(r,t){r.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function tF(r,t,e,n){r.elements.filter(o=>o.poi_info).map(o=>{try{let s=Ta(o,e),a=new nt(t.context,{id:o.id,icon:o.poi_info.icon,text:s,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},icon_size:[24,24],level:o.poi_info.level||0,hide_text:!n});t.poiLayer2.pushPoi(a),a.userData.type="facility",a.userData.data=o,a.userData.floor=t.name}catch(s){console.log("\u6DFB\u52A0facility\u5931\u8D25",s,o)}})}function eF(r,t,e){t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function nF(r,t){return A(this,null,function*(){let e=r.elements.filter(o=>o.texts[0]),n=e.map(o=>o.texts[0]),i=yield tt.lazyGetTextureByTexts(n);e.forEach(o=>{try{let s=o.texts[0],a=new nt(t.context,{id:o.id,text:s,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},text_texture:i[s].texture,text_texture_width:i[s].width,text_texture_height:i[s].height,text_texture_offset_x:i[s].x,text_texture_offset_y:i[s].y});a&&(a.userData.type="parkingSpace",a.userData.data=o,a.userData.floor=t.name),t.poiLayer2.pushPoi(a)}catch(s){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",s,o)}}),Object.values(i).forEach(o=>{o.texture.dispose()})})}function rF(r,t){let e=new oa(t.context,r.elements.map(n=>T({},n,{center_x:n.center_coord_x,center_y:n.center_coord_y})));t.textTextureLayer.add(e)}var Rc="map_version",Fc="route_version",Kc="facility_version",Nc="map_data",va="road_network_data",zc="facility_data",aF={mergeParkingSpace:!0},_r=class extends oF{initDb(){return A(this,null,function*(){try{let{db:t,type:e}=yield Y1("aibee_map",2);e==="onupgradeneeded"&&(Xn(Rc),Xn(Fc),Xn(Kc),Xn(Nc),Xn(va),Xn(zc)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return A(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=T({},this.placeConfig,e));else{let n=yield fetch(t).then(i=>i.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=T({},this.placeConfig,JSON.parse(n.data.config||"{}")))}})}setCacheData(t,e,n){return this.initDbPromise.then(()=>D1(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>Oc(t,""+e,this.db))}getFloorCacheKey(t){return""+t.floor_id}getFloorData(t){return A(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return A(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}setLocale(t){this.locale=t,this.bmap.context.currentFloor&&this.bmap.context.currentFloor.poiLayer2.pois.forEach(e=>{e.userData.type==="store"&&(e.options.text=ja(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=Ta(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return A(this,null,function*(){let e=this.getFloorCacheKey(t);console.time("zstd_json");let n=yield fetch(t.map_url).then(i=>i.json());return n.floor=t.floor,console.timeEnd("zstd_json"),this.setCacheData(Nc,e,n),this.setCacheData(Rc,e,t.version_id),n})}getFloorJsonData(t){return A(this,null,function*(){let e=this.floors.find(i=>i.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(Rc,n))===e.version_id){let o=yield this.getCacheData(Nc,n);if(o)return o}return this.getFloorJsonDataByFloorInfo(e)}catch(i){return console.log("[get floor data error]",i),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return A(this,null,function*(){return(yield Promise.all(this.floors.map(e=>A(this,null,function*(){let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(Fc,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(Fc,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(va,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return A(this,null,function*(){let t=this.floors.reduce((i,o)=>i.updated_at>o.updated_at?i:o,this.floors[0]);if(!t)return null;let e=this.getFloorCacheKey(t),n=()=>A(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(zc,e,i),this.setCacheData(Kc,e,t.version_id)),i});try{if((yield this.getCacheData(Kc,e))===t.version_id){let o=yield this.getCacheData(zc,e);if(o)return o}return n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return A(this,null,function*(){})}getMulFloorsData(t){return A(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return A(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return A(this,null,function*(){return e=this.getFloorBaseLayer(t,e),n=T({},this.placeConfig,n),t.layers.forEach(i=>{["range","ground"].includes(i.l_type)||rr(i.elements,e.userData.center)}),yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,n),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new iF),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t,e){return A(this,null,function*(){return new Promise(n=>{let i={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(i),s=a=>{let{task:u,res:l}=a;u.tid===o&&(this.taskQueue.removeEventListener("active-task-end",s),n(l))};this.taskQueue.addEventListener("active-task-end",s)})})}_switchFloor(t,e){return A(this,null,function*(){var n;let i=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)i=l;else return null}e=T({},this.placeConfig,e);let o=new Jt(this.bmap.context);o.userData.data=t;let s=this.floors.find(l=>l.floor===i.floor);var a;let u=(a=s==null?void 0:s.map_angle)!=null?a:0;return this.bmap.dispatchEvent({type:ct.SWITCH_FLOOR_BEFORE,data:{curFloor:o,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:o,graphics:[],floorData:i}}),this.bmap.context.control.setAzimuthalAngle(u/180*Math.PI,!0),this.bmap.context.scene.background=new sF(e.backgroundColor),this.getFloorBaseLayer(i,o),this.changeFloorBox(i,o),this.bmap.buildingCenter=o.userData.center,this.bmap.currentBuildGround=(n=o.userData.data.layers.find(l=>l.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(o),this.bmap.initialFloorCamera(),this.bmap.context.cameraBound.updateBox(),i.layers.forEach(l=>{["range","ground"].includes(l.l_type)||rr(l.elements,o.userData.center)}),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:o,graphics:[]}}),this.bmap.dispatchEvent({type:ct.SWITCH_FLOOR_GROUND,data:{curFloor:o}}),yield Go(),yield this.getFloorContentLayer(i,o),this.changeFloorBox(i,o),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:o,graphics:[]}}),yield Og(2),yield this.getFloorPoi(i,o,e),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:o,graphics:o.graphicLayer.children}}),this.bmap.dispatchEvent({type:ct.SWITCH_FLOOR_AFTER,data:{curFloor:o,graphics:o.graphicLayer.children}}),o})}getFloorBaseLayer(t,e){e||(e=new Jt(this.bmap.context));let n=[0,0];return t.layers.forEach(i=>{switch(i.l_type){case"range":let o=i.elements[0];n=[o.center_x,o.center_y];break;case"ground":rr(i.elements,n);let s=i.elements.map(a=>new et(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 A(this,null,function*(){e||(e=new Jt(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let i=0;i<t.layers.length;i++){let o=t.layers[i];["range","ground"].includes(o.l_type)||(X1(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield Go(),n=Date.now()))}return e})}getFloorPoi(t,e,n){return A(this,null,function*(){n===void 0&&(n=this.placeConfig);let i=Date.now();yield Promise.all(t.layers.map(s=>Z1(s,e,this.locale,n))),console.log("poi time",Date.now()-i);let o=Date.now();Go().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return A(this,null,function*(){var t;C1((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 ir,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0},this.options=T({},aF,e),this.initDbPromise=this.initDb()}};var lq=d(_(),1);function O1(r,t){return A(this,null,function*(){let{brand:e,project:n}=r,{apiDomain:i,apiPath:{floorRange:o},apiInfo:s}=t,a=""+i+o+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n;return yield fetch(a,s).then(l=>l.json()).then(l=>l.data).then(l=>{let c=(l||[])[0];return c&&(c.info=JSON.parse(c.info)),c})})}function R1(r,t){return A(this,null,function*(){let{brand:e,project:n,floor:i,ts:o,resource_type_list:s}=r,{apiDomain:a,apiPath:{floorGraphic:u},apiInfo:l}=t,c=""+a+u+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+i+"&ts="+o+"&resource_type_list="+s;return yield fetch(c,l).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(f=>f.info=JSON.parse(f.info)),p||[]))})}function oq(r,t){return A(this,null,function*(){let{project:e,floor:n}=r,{apiDomain:i,apiInfo:o}=t,s=i+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+n;return yield fetch(s,o).then(u=>u.json()).then(u=>u.data).then(u=>JSON.parse(u[0].streetInfo||"{}")).then(u=>u.fileId?uF(u.fileId,t):null)})}function uF(r,t){return A(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+r,n).then(i=>i.arrayBuffer()).then(i=>{let s=new TextDecoder("utf-8").decode(i);return s?JSON.parse(s):null})})}var F1=class{load(t){return A(this,null,function*(){let e=tr(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),R1(t,this.bmap.config)]),i=tr({floor:t.floor,ts:t.ts});rr(n.map(s=>s.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(i)||0),n.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let o=this.floorDataLengthMap.get(i)||0;return this.floorDataLengthMap.set(i,o+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return A(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,i=e.userData.graphicMap||new Map,{ground:o,markGraphic:s,graphic:a}=this.bmap.config;for(let u=0;u<t.length;u++){let l=t[u];l.info.group==="ground"?(l.info.fillColor=o.color,l.info.fillOpacity=o.opacity,l.info.height=o.height,l.info.stroke=o.stroke,l.info.strokeColor=o.strokeColor,l.info.strokeOpacity=o.strokeOpacity):l.info.userData.mark?(l.info.height=s.height,l.info.fillColor=s.color,l.info.fillOpacity=s.opacity,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity):(l.info.fillOpacity=a.fillOpacity,this.bmap.config.initTransToMark&&(l.info.height=s.height,l.info.fillColor=s.color,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity))}for(let u of t){if(u.info.group==="ground")e.createGround(u.info);else{let l=e.addGraphic(u.info);l.userData.data=u,n.set(u.legacy_id,l)}i.set(u.element_uuid,u)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=i,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(ct.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(ct.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(i=>!n.has(i.element_uuid))}switchFloorByStoreData(t,e){return A(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"6"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}switchFloorByOtherData(t,e){return A(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"1,2,3,4"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}loadBuildGround(t){return A(this,null,function*(){let{brand:e,project:n}=t,i=yield this.loadBuildingGround({brand:e,project:n});return this.bmap.currentBuildGround=i,this.bmap.changeBuildingCenter(i,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return A(this,null,function*(){let{brand:e,project:n}=t,i=tr({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=O1({brand:e,project:n},this.bmap.config).then(s=>(this.buildingGroundMap.set(i,s),s));return this.buildingGroundMap.set(i,o),o})}switchFloor(t){return A(this,null,function*(){let e=new Jt(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}};var xq=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),Sa=class extends lF{changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?Ro(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:i,brand:n})}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor(t){return A(this,null,function*(){return this.loader||(this.loader=new _r(this),yield this.loader.load(this.config.apiPath.loadPlaceInfo+"?place_id="+this.config.placeId+"&env=prod")),this.loader.switchFloor(t)})}switchFloorByFloor(t,e){e===void 0&&(e=t.graphicLayer.children),this.triggerHooks(ct.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(ct.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 i=(n=this.context.currentFloor)==null?void 0:n.addModel(T({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(i){let{facilityAngle:o=0,facilityXScale:s=1,facilityYScale:a=1}=t.options.userData;i.rotateZ((180-o)/180*Math.PI),i.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 et))||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let n=t.options.center,i=t.getCenter(),o=(n==null?void 0:n[0])||i.x,s=(n==null?void 0:n[1])||i.y;return console.log(o,s,n,i),this.context.currentFloor.addPoi(T({},e,{position:{x:o,y:s,z:i.z+t.options.height/2}}))}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,n,i){e===void 0&&(e=500),n===void 0&&(n=0),i===void 0&&(i=0);let o=t.getPosition().clone(),{context:{camera:s}}=this;if(s.updateMatrix(),i){let a=new Uc;a.setFromMatrixColumn(s.matrix,1),a.normalize(),a.multiplyScalar(i/s.zoom),o.add(a)}if(n){let a=new Uc;a.setFromMatrixColumn(s.matrix,0),a.normalize(),a.multiplyScalar(n/s.zoom),o.add(a)}return this.context.setCameraPosition(o,e)}translateElementToCenterX(t,e){return A(this,null,function*(){return e===void 0&&(e=500),Rt(new Promise(n=>{let i=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:s,height:a},camera:u}=this.context,c=x(o,u,s,a).x-s/2,h=new Uc;h.setFromMatrixColumn(this.context.camera.matrix,0),h.normalize(),h.multiplyScalar(c/this.context.camera.zoom),i.add(h),this.context.setCameraPosition(i,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:i}=this.container;return x(e,this.context.camera,n,i)}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 A(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 A(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new $s(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",i=>{let{distance:o}=i;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 ta(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",i=>{let{area:o}=i;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=Ro(this.currentBuildGround.info.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=n[0],o[1]-=n[1]})});else{let[i,o]=t.geometry.cds;t.geometry.coords=[i-n[0],o-n[1]]}}return(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.loader&&(this.loader.dispose(),this.loader=null),this.unRegistryEvent(),this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.plugins=[],this.context.dispose(),this.context=null,this.container=null,tt.dispose(),ut.dispose(),an.dispose(),Tt.dispose(),V.dispose(),le.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 G,this.plugins=[],this.loader=null,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 i=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=i,this.context.control.minPolarAngle=i}if(this.azimuthalKeys.includes(n.code)){let i=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=i,this.context.control.minAzimuthAngle=i}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),i=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(this.config.defaultPadding,0)||1;this.context.camera.zoom=i,this.context.control.minZoom=o,this.context.control.maxZoom=o*25,this.basicZoom=i,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=E1(e),this.context=new Aa(t,this.config),this.debounceResize=cF(this.resize,5),this.registryEvent()}};var Dq=d(_(),1);import{EventDispatcher as hF}from"three";var vt=class extends hF{dispose(){let t=this.bmap.plugins.findIndex(e=>e===this);t!==-1&&this.bmap.plugins.splice(t,1),this.bmap=null}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var K1=class extends vt{fetchEquipment(){return A(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,i=""+t+e;yield fetch(i,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)),i=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});i&&(i.userData.data=n,i.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(ct.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(ct.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var U$=d(ei(),1),G$=d(ne(),1),k$=d(_(),1),V$=d(Zc(),1);var r$=d(_(),1),i$=d(X(),1);import{Mesh as PF,Object3D as AF,TextureLoader as jF,Color as TF,Vector2 as kc,Vector3 as vF,NormalBlending as SF,RepeatWrapping as bF}from"three";var Rq=d(Ol(),1),Fq=d(pi(),1),Kq=d(fi(),1),Nq=d(mi(),1),zq=d(gi(),1),Uq=d(yi(),1),Gq=d(Pi(),1),kq=d(Ai(),1),Vq=d(ji(),1),Lq=d(Ti(),1),Jq=d(vi(),1),Bq=d(Si(),1),Hq=d(bi(),1),Qq=d(_i(),1),qq=d(xi(),1),$q=d(X(),1),t$=d(wc(),1);import{BufferGeometry as pF,Matrix4 as z1,Vector3 as Zn,Ray as fF,Sphere as dF,LineSegments as mF,BufferAttribute as Mn,ShaderChunk as Et,ShaderMaterial as U1,UniformsLib as gF,Color as yF,Vector2 as N1}from"three";var Mt=class extends pF{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 z1,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)}}})}};Mt.prototype.setMatrixWorld=function(r){this.matrixWorld=r};Mt.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};Mt.prototype.setPoints=function(r,t){if(!(r instanceof Float32Array)&&!(r instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=r,this.widthCallback=t,this.positions=[],this.counters=[],r.length&&r[0]instanceof Zn)for(var e=0;e<r.length;e++){var n=r[e],i=e/r.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(i),this.counters.push(i)}else for(var e=0;e<r.length;e+=3){var i=e/r.length;this.positions.push(r[e],r[e+1],r[e+2]),this.positions.push(r[e],r[e+1],r[e+2]),this.counters.push(i),this.counters.push(i)}this.process()};function MF(r,t){var e=new z1,n=new fF,i=new dF,o=new Zn,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(this.matrixWorld),r.ray.intersectSphere(i,o)!==!1){e.copy(this.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(e);var a=new Zn,u=new Zn,l=new Zn,c=this instanceof mF?2:1,h=s.index,p=s.attributes;if(h!==null)for(var f=h.array,g=p.position.array,y=p.width.array,P=0,j=f.length-1;P<j;P+=c){var S=f[P],b=f[P+1];a.fromArray(g,S*3),u.fromArray(g,b*3);var I=y[Math.floor(P/3)]!==void 0?y[Math.floor(P/3)]:1,W=r.params.Line.threshold+this.material.lineWidth*I/2,Z=W*W,w=n.distanceSqToSegment(a,u,o,l);if(!(w>Z)){o.applyMatrix4(this.matrixWorld);var E=r.ray.origin.distanceTo(o);E<r.near||E>r.far||(t.push({distance:E,point:l.clone().applyMatrix4(this.matrixWorld),index:P,face:null,faceIndex:null,object:this}),P=j)}}}}Mt.prototype.raycast=MF;Mt.prototype.compareV3=function(r,t){var e=r*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]};Mt.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};Mt.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=new Zn(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new Zn(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=i.distanceTo(o);t+=s}return t};Mt.prototype.process=function(){var r=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(r-1);var n;this.compareV3(0,r-1)?n=this.copyV3(r-2):n=this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(var i=0;i<r;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(i/(r-1)):t=1,this.width.push(t),this.width.push(t),i===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(i===r-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(i)/e;this.uvs.push(s,0),this.uvs.push(s,1)}if(i<r-1){n=this.copyV3(i),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var o=i*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}i>0&&(n=this.copyV3(i),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(r-1,0)?n=this.copyV3(1):n=this.copyV3(r-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new Mn(new Float32Array(this.positions),3),previous:new Mn(new Float32Array(this.previous),3),next:new Mn(new Float32Array(this.next),3),side:new Mn(new Float32Array(this.side),1),width:new Mn(new Float32Array(this.width),1),uv:new Mn(new Float32Array(this.uvs),2),index:new Mn(new Uint16Array(this.indices_array),1),counters:new Mn(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 Gc(r,t,e,n,i){var o;if(r=r.subarray||r.slice?r:r.buffer,e=e.subarray||e.slice?e:e.buffer,r=t?r.subarray?r.subarray(t,i&&t+i):r.slice(t,i&&t+i):r,e.set)e.set(r,n);else for(o=0;o<r.length;o++)e[o+n]=r[o];return e}Mt.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;Gc(t,0,e,0,i),Gc(t,6,t,0,i-6),t[i-6]=r.x,t[i-5]=r.y,t[i-4]=r.z,t[i-3]=r.x,t[i-2]=r.y,t[i-1]=r.z,Gc(t,6,n,0,i-6),n[i-6]=r.x,n[i-5]=r.y,n[i-4]=r.z,n[i-3]=r.x,n[i-2]=r.y,n[i-1]=r.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};Et.meshline_vert=["",Et.logdepthbuf_pars_vertex,Et.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;","",Et.logdepthbuf_vertex,Et.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",Et.fog_vertex,"}"].join(`
|
|
3912
3912
|
`);Et.meshline_frag=["",Et.fog_pars_fragment,Et.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() {","",Et.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);","",Et.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
|
|
3913
3913
|
`);var On=class extends U1{constructor(t){super({uniforms:Object.assign({},gF.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new yF(16777215)},opacity:{value:1},resolution:{value:new N1(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 N1(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:Et.meshline_vert,fragmentShader:Et.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)}};On.prototype.copy=function(r){return U1.prototype.copy.call(this,r),this.lineWidth=r.lineWidth,this.map=r.map,this.useMap=r.useMap,this.alphaMap=r.alphaMap,this.useAlphaMap=r.useAlphaMap,this.color.copy(r.color),this.opacity=r.opacity,this.resolution.copy(r.resolution),this.sizeAttenuation=r.sizeAttenuation,this.dashArray.copy(r.dashArray),this.dashOffset.copy(r.dashOffset),this.dashRatio.copy(r.dashRatio),this.useDash=r.useDash,this.visibility=r.visibility,this.alphaTest=r.alphaTest,this.repeat.copy(r.repeat),this};var G1={texture_url:Ns,lineWidth:10,color:16777215},ba=class extends AF{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:i}}}}}=this,o=t.map(a=>{let[u,l]=a;return x(new vF(u,l,0),e,n,i)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return xt(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new kc(t,1)}loadTexture(t){return new Promise((e,n)=>{new jF().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 A(this,null,function*(){let e=this.geometry=new Mt;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=bF}let n=this.material=new On({useMap:!0,color:new TF(this.config.color),transparent:!0,resolution:new kc(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:SF,repeat:new kc(this.getRepeat(),1)}),i=this.mesh=new PF(e,n);return i.renderOrder=100009,this.add(i),i})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=G1,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:i}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,i)}},this.config=Object.assign({},G1,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};import{Tween as Vc,Easing as OF}from"@tweenjs/tween.js";import{Vector2 as RF,Vector3 as he}from"three";var p$=d(Js(),1),f$=d(_(),1),d$=d(X(),1);import{EventDispatcher as wF,Vector2 as _F}from"three";import{Tween as xF}from"@tweenjs/tween.js";import{throttle as WF}from"lodash";import{booleanPointInPolygon as IF,point as EF,polygon as YF}from"@turf/turf";var DF={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},wa=class extends wF{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)}setRoadData(t){this.roadData=t}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null),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:i,curRoutePath:o,paths:s,routeIndex:a}=this;if(!n.length)return null;let u=n,l=this.paths[this.routeIndex].floor,c=this.getCurRouteRemainDistance();if(i){let P=Xe(n,i);u=u.slice(P+1),u.unshift(i)}let h=[{floor:o==null?void 0:o.floor,points:u},...s.slice(a+1)],{distance:p,closestPoint:f,index:g,i:y}=h.reduce((P,j,S)=>{if(j.floor!==t)return P;let{distance:b,closestPoint:I,index:W}=j.points.reduce((Z,w,E,L)=>{if(!L[E+1])return T({},Z,{distance:Z.distance===1/0?F(w,e):Z.distance});let{distance:J,closestPoint:N}=T2(e,w,L[E+1]);if(l===t){let ht=[e,...L.slice(E+1)],Pt=xt(ht);if(c-Pt>10)return Z}return J<Z.distance?{distance:J,closestPoint:N,index:E}:Z},{distance:1/0,closestPoint:j.points[0],index:0});return b<P.distance?{distance:b,closestPoint:I,index:S,i:W}:P},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:p,closestPoint:f,routeIndex:g+a,pointIndex:g===0?y+this.pointIndex:y}}toPosition(t,e){let n=this.adsorb(t,e);if(!n)return;let{distance:i,closestPoint:o,routeIndex:s,pointIndex:a}=n;i>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 A(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let i=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),s=o/this.options.simulationSpeed,a=this.throttleUpdatePosition=WF(l=>{let c=er(i,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new xF({distance:0},this.tweenUtil.group).to({distance:o},s*1e3).onUpdate(a).onComplete(()=>{this.tweenUtil.remove(u),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 i=[n,...t.slice(e+1)];return xt(i)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[...t.slice(0,e+1),n];return xt(i)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((i,o)=>i+o.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:n,position:i,curRoutePath:o}=this,s=e,a=Oe.FRONT,u=(o==null||(t=o.pointInfos[s])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;a===Oe.FRONT&&s<=n.length;){let g=n[s],y=n[s+1],P=n[s+2];if(!g||!y)a=Oe.END;else if(l+=F(g,y),!P)a=Oe.END;else{a=j0(g,y,P),c=Fo(g,y,P),h=(new _F(P[0]-y[0],P[1]-y[1]).angle()*180/Math.PI-90+360)%360;var p;u=(p=o==null?void 0:o.pointInfos[s+1].crossName)!=null?p:"",s+=1}}if(n[s]&&(l=F(i,n[s])),a===Oe.END&&l<=this.options.directionEmitThreshold)return{dir:a,distance:l,crossName:u,angle:c,nextAngle:h};let f=this.getCurRouteToStartDistance();return e===0&&f<=5?{dir:Oe.START,distance:l,crossName:u,angle:c,nextAngle:h}:(l>=this.options.directionEmitThreshold&&(a=Oe.FRONT),{dir:a,distance:l,crossName:u,angle:c,nextAngle:h})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(n=>{let i=YF(n.cds),o=EF(this.position);return IF(o,i)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),n=this.getNextDirDistance();if(!n)return null;let{dir:i,distance:o,crossName:s,angle:a,nextAngle:u}=n;e<=10&&(i=Oe.END);let{imageUrl:l}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:o,dir:i,angle:a,nextAngle:u,pos:this.position,routeIndex:this.routeIndex,crossName:s,offset:this.offset,reset:this.reset,imageUrl:l}}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 G,this.resetTimer=null,this.tweenUtil=new un,this.paused=!1,this.onAddPaths=i=>{let{paths:o}=i;this.paths=o,this.resetStatus(o),this.simulationTween&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},DF,e),this.roadData=n,this.registryEvent()}};var T$=d(Ps(),1),v$=d(pi(),1),S$=d(fi(),1),b$=d(mi(),1),w$=d(gi(),1),_$=d(yi(),1),x$=d(Pi(),1),W$=d(Ai(),1),I$=d(ji(),1),E$=d(Ti(),1),Y$=d(vi(),1),D$=d(Si(),1),C$=d(bi(),1),X$=d(_i(),1),Z$=d(xi(),1),O$=d(Xl(),1),R$=d(_(),1);import{DataTexture as CF,LinearFilter as k1,RGBAFormat as V1,Sprite as XF,SpriteMaterial as ZF}from"three";var Ve=class r extends nt{addDebug(){r.canvas.style.cssText=`
|
|
3914
3914
|
position: fixed;
|