@aibee/crc-bmap 0.9.1 → 0.9.2

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.
@@ -8104,7 +8104,7 @@ void main() {
8104
8104
  `,m=function(L,at,D){at=at||1024;let j=L.pos,Tt=-1,$=0,xt="",_t=String.fromCharCode.apply(null,new Uint16Array(L.subarray(j,j+128)));for(;0>(Tt=_t.indexOf(g))&&$<at&&j<L.byteLength;)xt+=_t,$+=_t.length,j+=128,_t+=String.fromCharCode.apply(null,new Uint16Array(L.subarray(j,j+128)));return-1<Tt?(D!==!1&&(L.pos+=$+Tt+1),xt+_t.slice(0,Tt)):!1},y=function(L){let at=/^#\?(\S+)/,D=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,W=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,j=/^\s*FORMAT=(\S+)\s*$/,Tt=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,$={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0},xt,_t;for((L.pos>=L.byteLength||!(xt=m(L)))&&u(1,"no header found"),(_t=xt.match(at))||u(3,"bad initial token"),$.valid|=1,$.programtype=_t[1],$.string+=xt+`
8105
8105
  `;xt=m(L),xt!==!1;){if($.string+=xt+`
8106
8106
  `,xt.charAt(0)==="#"){$.comments+=xt+`
8107
- `;continue}if((_t=xt.match(D))&&($.gamma=parseFloat(_t[1])),(_t=xt.match(W))&&($.exposure=parseFloat(_t[1])),(_t=xt.match(j))&&($.valid|=2,$.format=_t[1]),(_t=xt.match(Tt))&&($.valid|=4,$.height=parseInt(_t[1],10),$.width=parseInt(_t[2],10)),$.valid&2&&$.valid&4)break}return $.valid&2||u(3,"missing format specifier"),$.valid&4||u(3,"missing image size specifier"),$},x=function(L,at,D){let W=at;if(W<8||W>32767||L[0]!==2||L[1]!==2||L[2]&128)return new Uint8Array(L);W!==(L[2]<<8|L[3])&&u(3,"wrong scanline width");let j=new Uint8Array(4*at*D);j.length||u(4,"unable to allocate buffer space");let Tt=0,$=0,xt=4*W,_t=new Uint8Array(4),It=new Uint8Array(xt),gt=D;for(;gt>0&&$<L.byteLength;){$+4>L.byteLength&&u(1),_t[0]=L[$++],_t[1]=L[$++],_t[2]=L[$++],_t[3]=L[$++],(_t[0]!=2||_t[1]!=2||(_t[2]<<8|_t[3])!=W)&&u(3,"bad rgbe scanline format");let yt=0,tt;for(;yt<xt&&$<L.byteLength;){tt=L[$++];let kt=tt>128;if(kt&&(tt-=128),(tt===0||yt+tt>xt)&&u(3,"bad scanline data"),kt){let ce=L[$++];for(let ft=0;ft<tt;ft++)It[yt++]=ce}else It.set(L.subarray($,$+tt),yt),yt+=tt,$+=tt}let qt=W;for(let kt=0;kt<qt;kt++){let ce=0;j[Tt]=It[kt+ce],ce+=W,j[Tt+1]=It[kt+ce],ce+=W,j[Tt+2]=It[kt+ce],ce+=W,j[Tt+3]=It[kt+ce],Tt+=4}gt--}return j},b=function(L,at,D,W){let j=L[at+3],Tt=Math.pow(2,j-128)/255;D[W+0]=L[at+0]*Tt,D[W+1]=L[at+1]*Tt,D[W+2]=L[at+2]*Tt,D[W+3]=1},T=function(L,at,D,W){let j=L[at+3],Tt=Math.pow(2,j-128)/255;D[W+0]=Vg.toHalfFloat(Math.min(L[at+0]*Tt,65504)),D[W+1]=Vg.toHalfFloat(Math.min(L[at+1]*Tt,65504)),D[W+2]=Vg.toHalfFloat(Math.min(L[at+2]*Tt,65504)),D[W+3]=Vg.toHalfFloat(1)},E=new Uint8Array(t);E.pos=0;let S=y(E),R=S.width,A=S.height,N=x(E.subarray(E.pos),R,A),B,G,O;switch(this.type){case Cs:O=N.length/4;let L=new Float32Array(O*4);for(let D=0;D<O;D++)b(N,D*4,L,D*4);B=L,G=Cs;break;case ml:O=N.length/4;let at=new Uint16Array(O*4);for(let D=0;D<O;D++)T(N,D*4,at,D*4);B=at,G=ml;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:R,height:A,data:B,header:S.string,gamma:S.gamma,exposure:S.exposure,type:G}}setDataType(t){return this.type=t,this}load(t,e,n,i){function o(u,l){switch(u.type){case Cs:case ml:u.colorSpace=Ti,u.minFilter=sn,u.magFilter=sn,u.generateMipmaps=!1,u.flipY=!0;break}e&&e(u,l)}return super.load(t,o,n,i)}};var H1=class extends Vy{constructor(){super(),new V1().load(KX,t=>{t.mapping=Rg,this.environment=t;let e=new Ge;e.makeRotationX(Math.PI/2),this.environmentRotation=new su().setFromRotationMatrix(e)})}};var W1=class extends x0{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 Cv=class extends ln{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 W1(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new G1(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 U1(this)}getRatio(t,e){t===void 0&&(t=new k(0,0,0)),e===void 0&&(e=new k(100,0,0));let{clientWidth:n,clientHeight:i}=this.container,o=tn(t,this.camera,n,i),u=tn(e,this.camera,n,i);return Math.ceil(Math.sqrt((u.x-o.x)**2+(u.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof Cp&&(e.color=new be(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 St;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new Rp;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),u=(i=this.currentFloor)==null?void 0:i.poiLayer2.getPoiByDeviceXy(t,e);return(o||[]).concat(u||[])}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,u,l,c]=e,{clientSize:{width:f,height:g}}=this,m=this.control.getPolarAngle();i&&this.setPolarAngle(0,0);let y=new Qe().setFromObject(t);this.setPolarAngle(m,0);let{max:x,min:b}=y,T=new k(b.x,x.y,x.z),E=new k(x.x,x.y,x.z),S=new k(x.x,b.y,b.z),R=new k(b.x,b.y,b.z),A=tn(T,this.camera,f,g),N=tn(E,this.camera,f,g),B=tn(R,this.camera,f,g),G=tn(S,this.camera,f,g),L=new xl().setFromPoints([new St(A.x,A.y),new St(N.x,N.y),new St(B.x,B.y),new St(G.x,G.y)]).getSize(new St),at=(f-u-c)/L.x,D=(g-o-l)/L.y,W=Math.min(at,D),j=new k((x.x+b.x)/2,(x.y+b.y)/2,(x.z+b.z)/2),Tt=W*this.camera.zoom,$=this.camera.clone();$.zoom=Tt,$.updateMatrix();let xt=(f-L.x*W)/2,_t=(g-L.y*W)/2,It=(u-c)/2,gt=(o-l)/2;if(It){let yt=new k;yt.setFromMatrixColumn($.matrix,0),yt.normalize(),yt.multiplyScalar(It/Tt),j.add(yt)}if(gt){let yt=new k;yt.setFromMatrixColumn($.matrix,1),yt.normalize(),yt.multiplyScalar(gt/Tt),j.add(yt)}return{zoom:W*this.camera.zoom,center:j}}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:u}=this.getFitCameraToObjectZoom(t,e,n,i);return this.setZoom(o,u,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 jt(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()),zi(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new H1,this.renderer=new k1,this.lights=G3(),this.clientSize={width:0,height:0,x:0,y:0},this.renderRf=0,this.basicZoom=1,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:u,clientHeight:l}=n;u=Math.max(1,u),l=Math.max(1,l),i.left=-u/2,i.right=u/2,i.top=l/2,i.bottom=-l/2,i.updateProjectionMatrix(),o.setSize(u,l),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:u,height:l})},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 u=this.getPoisByDeviceXy(n.offsetX,n.offsetY);u.length&&this.dispatchEvent({type:"poi-click",pois:u})},this.onPointerover=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),u=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:i,pois:u,position:o})},this.onPointermove=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),u=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:i,pois:u,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 Tv(this),this.hoverHelper=new Av(this),this.resizeClientSize(),this.registryEvent()}};var bY=et(Os(),1),MY={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},loaderPlaceConfig:{textFontSize:14}};function hC(r){return(0,bY.merge)({},MY,r)}var NY=et(Os(),1);var jte=et(Xe(),1);var Zu;function wY(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(Zu)return e({db:Zu,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){Zu=o.target.result,console.log("onupgradeneeded"),e({db:Zu,type:"onupgradeneeded"})},i.onsuccess=o=>{Zu=o.target.result,e({db:Zu,type:"success"})},i.onerror=o=>{n(o)}})}function fC(r,t,e){return e===void 0&&(e=Zu),new Promise((n,i)=>{e||i("\u6CA1\u6709db");let u=e.transaction([r],"readonly").objectStore(r).get(t);u.onsuccess=()=>{u.result?n(u.result.value):n(null)},u.onerror=l=>{console.log("[getVersionByKey]",l),n(null)}})}function TY(r,t,e,n){return n===void 0&&(n=Zu),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((u,l)=>jt(this,null,function*(){let c=yield fC(r,t),f=n.transaction([r],"readwrite").objectStore(r),g=c!==null?f.put({key:t,value:e}):f.add({key:t,value:e});g.onsuccess=function(m){u(m)},g.onerror=function(m){l(m)}}))))}function Mf(r,t){t===void 0&&(t=Zu),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function AY(r){r===void 0&&(r=Zu),r==null||r.close(),Zu=null}var Gte=et(cr(),1),kte=et(Xe(),1);function q1(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 X1(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 CY(r,t,e){switch(r.l_type){case"graph":return o3t(r,t);case"wall":return s3t(r,t);case"lane":return a3t(r,t);case"texture2d":case"texture3d":return u3t(r,t);case"glb":return l3t(r,t);case"store":return c3t(r,t);case"facility":return f3t(r,t);case"parkingSpace":return d3t(r,t,e);case"text":return m3t(r,t)}}function RY(r,t,e,n){switch(r.l_type){case"store":return h3t(r,t,e,n);case"facility":return p3t(r,t,e,n);case"parkingSpace":return g3t(r,t,n)}}function o3t(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:u,strokeColor:l,strokeOpacity:c,height:f,airHeight:g}=i,m=o.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c+"-"+f+"-"+g;return c===0&&(m=o.toLowerCase()+"-"+u+"-"+f+"-"+g),n[m]?n[m].push(i):n[m]=[i],n},{});Object.values(e).forEach(n=>{let i=new Sf(t.context,n);t.mergeGraphicLayer.add(i)})}function s3t(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:u,strokeColor:l,strokeOpacity:c,height:f}=i,g=o.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c+"-"+f;return c===0&&(g=o.toLowerCase()+"-"+u+"-"+f),n[g]?n[g].push(i):n[g]=[i],n},{});Object.values(e).forEach(n=>{let i=new Sv(t.context,n);t.wallLayer.add(i)})}function a3t(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:u,strokeColor:l,strokeOpacity:c}=i,f=o.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c;return c===0&&(f=o.toLowerCase()+"-"+u),n[f]?n[f].push(i):n[f]=[i],n},{});Object.values(e).forEach(n=>{let i=new Mv(t.context,n);t.laneLayer.add(i)})}function u3t(r,t){if(r.elements.length){let e=new Ef(t.context,r.elements);t.textureLayer.add(e)}}function l3t(r,t){r.elements.forEach(e=>{let n=new bv(t.context,ue({},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 c3t(r,t){r.elements.map(e=>{let n=t.addGraphic(ue({},e,{dashed:!1}));t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function h3t(r,t,e,n){r.elements.map(i=>{try{let o=q1(i,e),u=new Ji(t.context,{id:i.id,icon:i.poi_info.showImageUrl||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.showStoreName,maxWeight:i.poi_info.maxWeight||25,minWeight:i.poi_info.minWeight||1,text_font_size:n.textFontSize});t.poiLayer2.pushPoi(u),u&&(u.userData.type="store",u.userData.data=i,u.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,i)}})}function f3t(r,t){r.elements.map(e=>{let n=t.addGraphic(ue({},e,{dashed:!1}));t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function p3t(r,t,e,n){r.elements.filter(o=>o.poi_info).map(o=>{try{let u=X1(o,e),l=new Ji(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:u,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.showFacilityName,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1,text_font_size:n.textFontSize});t.poiLayer2.pushPoi(l),l.userData.type="facility",l.userData.data=o,l.userData.floor=t.name}catch(u){console.log("\u6DFB\u52A0facility\u5931\u8D25",u,o)}})}function d3t(r,t,e){t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function g3t(r,t,e){return jt(this,null,function*(){let n=r.elements.filter(u=>u.texts[0]),i=n.map(u=>u.texts[0]),o=yield po.lazyGetTextureByTexts(i,{height:64});n.forEach(u=>{try{let l=u.texts[0],c=new Ji(t.context,{id:u.id,text:l,position:{x:u.center_coord_x,y:u.center_coord_y,z:u.airHeight+u.height},text_texture:o[l].texture,text_texture_width:o[l].width,text_texture_height:o[l].height,text_texture_offset_x:o[l].x,text_texture_offset_y:o[l].y,text_font_size:e.textFontSize});c&&(c.userData.type="parkingSpace",c.userData.data=u,c.userData.floor=t.name),t.poiLayer2.pushPoi(c)}catch(l){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",l,u)}}),Object.values(o).forEach(u=>{u.texture.dispose()})})}function m3t(r,t){let e=new wv(t.context,r.elements.map(n=>ue({},n,{center_x:n.center_coord_x,center_y:n.center_coord_y})));t.textTextureLayer.add(e)}var PY="map_version",IY="route_version",LY="facility_version",pC="map_data",Y1="road_network_data",dC="facility_data",v3t={mergeParkingSpace:!0},Rv=class extends Jo{initDb(){return jt(this,null,function*(){try{let{db:t,type:e}=yield wY("aibee_map",2);e==="onupgradeneeded"&&(Mf(PY),Mf(IY),Mf(LY),Mf(pC),Mf(Y1),Mf(dC)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return jt(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=ue({},this.placeConfig,e));else{let n=yield fetch(t).then(i=>i.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=ue({},this.placeConfig,JSON.parse(n.data.config||"{}")))}this.getOtherDataByFreeTime()})}setCacheData(t,e,n){return this.initDbPromise.then(()=>TY(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>fC(t,""+e,this.db))}getFloorCacheKey(t){return t.floor_id+"_"+t.version_id}getFloorData(t){return jt(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return jt(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=q1(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=X1(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return jt(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>jt(this,null,function*(){let i=this.getFloorCacheKey(t),o=yield fetch(t.map_url).then(u=>u.json());o.floor=t.floor,this.setCacheData(pC,i,o),this.setCacheData(PY,i,t.version_id),n(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return jt(this,null,function*(){let e=this.floors.find(i=>i.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{let i=yield this.getCacheData(pC,n);return i||this.getFloorJsonDataByFloorInfo(e)}catch(i){return console.log("[get floor data error]",i),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return jt(this,null,function*(){return(yield Promise.all(this.floors.map(e=>jt(this,null,function*(){let n=this.getFloorCacheKey(e);try{let i=yield this.getCacheData(Y1,n);if(i)return i;let o=yield fetch(e.route_url).then(u=>u.json());return this.setCacheData(Y1,n,o),this.setCacheData(IY,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(u=>u.json());return this.setCacheData(Y1,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return jt(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=()=>jt(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(dC,e,i),this.setCacheData(LY,e,t.version_id)),i});try{let i=yield this.getCacheData(dC,e);return i||n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return jt(this,null,function*(){for(let t=0;t<this.floors.length;t++){let e=this.floors[t];this.getFloorJsonData(e.floor)}})}getMulFloorsData(t){return jt(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return jt(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return jt(this,null,function*(){return e=this.getFloorBaseLayer(t,e),n=ue({},this.placeConfig,n),t.layers.forEach(i=>{["range","ground"].includes(i.l_type)||hf(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 k),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t,e){return jt(this,null,function*(){return new Promise(n=>{let i={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(i),u=l=>{let{task:c,res:f}=l;c.tid===o&&(this.taskQueue.removeEventListener("active-task-end",u),n(f))};this.taskQueue.addEventListener("active-task-end",u)})})}_switchFloor(t,e){return jt(this,null,function*(){var n;let i=t;if(typeof t=="string"){let f=yield this.getFloorJsonData(t);if(f)i=f;else return null}e=ue({},this.placeConfig,e);let o=new Fa(this.bmap.context);o.userData.data=t;let u=this.floors.find(f=>f.floor===i.floor);var l;let c=(l=u==null?void 0:u.map_angle)!=null?l:0;return this.bmap.dispatchEvent({type:Zo.SWITCH_FLOOR_BEFORE,data:{curFloor:o,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:o,graphics:[],floorData:i}}),this.bmap.context.scene.background=new be(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(f=>f.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(o),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(c/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),i.layers.forEach(f=>{["range","ground"].includes(f.l_type)||hf(f.elements,o.userData.center)}),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:o,graphics:[]}}),this.bmap.dispatchEvent({type:Zo.SWITCH_FLOOR_GROUND,data:{curFloor:o}}),yield Em(),yield this.getFloorContentLayer(i,o),this.changeFloorBox(i,o),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:o,graphics:[]}}),yield $M(2),yield this.getFloorPoi(i,o,e),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:o,graphics:o.graphicLayer.children}}),this.bmap.dispatchEvent({type:Zo.SWITCH_FLOOR_AFTER,data:{curFloor:o,graphics:o.graphicLayer.children}}),o})}getFloorBaseLayer(t,e){e||(e=new Fa(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":hf(i.elements,n);let u=i.elements.map(l=>new $i(this.bmap.context,ue({},l,{dashed:!1})));e.addGrounds(u);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return jt(this,null,function*(){e||(e=new Fa(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)||(CY(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield Em(),n=Date.now()))}return e})}getFloorPoi(t,e,n){return jt(this,null,function*(){n===void 0&&(n=this.placeConfig);let i=Date.now();yield Promise.all(t.layers.map(u=>RY(u,e,this.locale,n))),console.log("poi time",Date.now()-i);let o=Date.now();Em().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return jt(this,null,function*(){var t;AY((t=this.db)!=null?t:void 0)})}dispose(){super.dispose(),this.clear(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new pf,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=ue({},v3t,e),this.placeConfig=ue({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var see=et(Xe(),1);function gC(r,t){return jt(this,null,function*(){let{brand:e,project:n}=r,{apiDomain:i,apiPath:{floorRange:o},apiInfo:u}=t,l=""+i+o+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n;return yield fetch(l,u).then(f=>f.json()).then(f=>f.data).then(f=>{let g=(f||[])[0];return g&&(g.info=JSON.parse(g.info)),g})})}function mC(r,t){return jt(this,null,function*(){let{brand:e,project:n,floor:i,ts:o,resource_type_list:u}=r,{apiDomain:l,apiPath:{floorGraphic:c},apiInfo:f}=t,g=""+l+c+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+i+"&ts="+o+"&resource_type_list="+u;return yield fetch(g,f).then(y=>y.json()).then(y=>y.data).then(y=>((y||[]).map(x=>x.info=JSON.parse(x.info)),y||[]))})}function _3t(r,t){return jt(this,null,function*(){let{project:e,floor:n}=r,{apiDomain:i,apiInfo:o}=t,u=i+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+n;return yield fetch(u,o).then(c=>c.json()).then(c=>c.data).then(c=>JSON.parse(c[0].streetInfo||"{}")).then(c=>c.fileId?y3t(c.fileId,t):null)})}function y3t(r,t){return jt(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 u=new TextDecoder("utf-8").decode(i);return u?JSON.parse(u):null})})}var vC=class{load(t){return jt(this,null,function*(){let e=uf(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),mC(t,this.bmap.config)]),i=uf({floor:t.floor,ts:t.ts});hf(n.map(u=>u.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(i)||0),n.forEach(u=>u.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 jt(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:u,graphic:l}=this.bmap.config;for(let c=0;c<t.length;c++){let f=t[c];f.info.group==="ground"?(f.info.fillColor=o.color,f.info.fillOpacity=o.opacity,f.info.height=o.height,f.info.stroke=o.stroke,f.info.strokeColor=o.strokeColor,f.info.strokeOpacity=o.strokeOpacity):f.info.userData.mark?(f.info.height=u.height,f.info.fillColor=u.color,f.info.fillOpacity=u.opacity,f.info.stroke=u.stroke,f.info.strokeColor=u.strokeColor,f.info.strokeOpacity=u.strokeOpacity):(f.info.fillOpacity=l.fillOpacity,this.bmap.config.initTransToMark&&(f.info.height=u.height,f.info.fillColor=u.color,f.info.stroke=u.stroke,f.info.strokeColor=u.strokeColor,f.info.strokeOpacity=u.strokeOpacity))}for(let c of t){if(c.info.group==="ground")e.createGround(c.info);else{let f=e.addGraphic(c.info);f.userData.data=c,n.set(c.legacy_id,f)}i.set(c.element_uuid,c)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=i,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(Zo.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(Zo.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 jt(this,null,function*(){let n=yield this.load(ue({},t,{resource_type_list:"6"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}switchFloorByOtherData(t,e){return jt(this,null,function*(){let n=yield this.load(ue({},t,{resource_type_list:"1,2,3,4"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}loadBuildGround(t){return jt(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 jt(this,null,function*(){let{brand:e,project:n}=t,i=uf({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=gC({brand:e,project:n},this.bmap.config).then(u=>(this.buildingGroundMap.set(i,u),u));return this.buildingGroundMap.set(i,o),o})}switchFloor(t){return jt(this,null,function*(){let e=new Fa(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 x3t=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),_C=class extends ln{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?vm(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 jt(this,null,function*(){return this.loader||(this.loader=new Rv(this),this.loader.placeConfig=ue({},this.loader.placeConfig,this.config.loaderPlaceConfig),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(Zo.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(Zo.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(ue({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(i){let{facilityAngle:o=0,facilityXScale:u=1,facilityYScale:l=1}=t.options.userData;i.rotateZ((180-o)/180*Math.PI),i.scale.set(u,l,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 $i))||[]}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,u=(n==null?void 0:n[1])||i.y;return console.log(o,u,n,i),this.context.currentFloor.addPoi(ue({},e,{position:{x:o,y:u,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:u}}=this;if(u.updateMatrix(),i){let l=new k;l.setFromMatrixColumn(u.matrix,1),l.normalize(),l.multiplyScalar(i/u.zoom),o.add(l)}if(n){let l=new k;l.setFromMatrixColumn(u.matrix,0),l.normalize(),l.multiplyScalar(n/u.zoom),o.add(l)}return this.context.setCameraPosition(o,e)}translateElementToCenterX(t,e){return jt(this,null,function*(){return e===void 0&&(e=500),Oa(new Promise(n=>{let i=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:u,height:l},camera:c}=this.context,g=tn(o,c,u,l).x-u/2,m=new k;m.setFromMatrixColumn(this.context.camera.matrix,0),m.normalize(),m.multiplyScalar(g/this.context.camera.zoom),i.add(m),this.context.setCameraPosition(i,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:i}=this.container;return tn(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 jt(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 jt(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new xv(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 Ev(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=vm(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,po.dispose(),Qo.dispose(),H0.dispose(),ha.dispose(),ni.dispose(),Ku.dispose(),this.debounceResize=null}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new ei,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*30,this.basicZoom=i,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=hC(e),this.context=new Cv(t,this.config),this.debounceResize=(0,NY.debounce)(this.resize,5),this.registryEvent()}};var Cee=et(Xe(),1);var fa=class extends ln{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 yC=class extends fa{fetchEquipment(){return jt(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(u=>[u.equipment_id,u]))}),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(Zo.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(Zo.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var Fne=et(Sm(),1),Bne=et(hu(),1),zne=et(Xe(),1),Gne=et(cC(),1);var Jee=et(Xe(),1),Qee=et(cr(),1);var Nee=et(hA(),1),Oee=et(Gm(),1),Dee=et(km(),1),Uee=et(Hm(),1),Fee=et(Wm(),1),Bee=et(qm(),1),zee=et(Ym(),1),Gee=et(jm(),1),kee=et(Km(),1),Vee=et(Zm(),1),Hee=et($m(),1),Wee=et(Jm(),1),qee=et(Qm(),1),Xee=et(ev(),1),Yee=et(nv(),1),jee=et(cr(),1),Kee=et(tC(),1);var za=class extends mr{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 Ge,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)}}})}};za.prototype.setMatrixWorld=function(r){this.matrixWorld=r};za.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};za.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 k)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 E3t(r,t){var e=new Ge,n=new ra,i=new io,o=new k,u=this.geometry;if(u.boundingSphere||u.computeBoundingSphere(),i.copy(u.boundingSphere),i.applyMatrix4(this.matrixWorld),r.ray.intersectSphere(i,o)!==!1){e.copy(this.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(e);var l=new k,c=new k,f=new k,g=this instanceof ia?2:1,m=u.index,y=u.attributes;if(m!==null)for(var x=m.array,b=y.position.array,T=y.width.array,E=0,S=x.length-1;E<S;E+=g){var R=x[E],A=x[E+1];l.fromArray(b,R*3),c.fromArray(b,A*3);var N=T[Math.floor(E/3)]!==void 0?T[Math.floor(E/3)]:1,B=r.params.Line.threshold+this.material.lineWidth*N/2,G=B*B,O=n.distanceSqToSegment(l,c,o,f);if(!(O>G)){o.applyMatrix4(this.matrixWorld);var L=r.ray.origin.distanceTo(o);L<r.near||L>r.far||(t.push({distance:L,point:f.clone().applyMatrix4(this.matrixWorld),index:E,face:null,faceIndex:null,object:this}),E=S)}}}}za.prototype.raycast=E3t;za.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]};za.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};za.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=new k(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new k(this.positions[n+6],this.positions[n+7],this.positions[n+8]),u=i.distanceTo(o);t+=u}return t};za.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 u=this.getDistance(i)/e;this.uvs.push(u,0),this.uvs.push(u,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 hr(new Float32Array(this.positions),3),previous:new hr(new Float32Array(this.previous),3),next:new hr(new Float32Array(this.next),3),side:new hr(new Float32Array(this.side),1),width:new hr(new Float32Array(this.width),1),uv:new hr(new Float32Array(this.uvs),2),index:new hr(new Uint16Array(this.indices_array),1),counters:new hr(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 xC(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}za.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;xC(t,0,e,0,i),xC(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,xC(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};Be.meshline_vert=["",Be.logdepthbuf_pars_vertex,Be.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;","",Be.logdepthbuf_vertex,Be.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",Be.fog_vertex,"}"].join(`
8107
+ `;continue}if((_t=xt.match(D))&&($.gamma=parseFloat(_t[1])),(_t=xt.match(W))&&($.exposure=parseFloat(_t[1])),(_t=xt.match(j))&&($.valid|=2,$.format=_t[1]),(_t=xt.match(Tt))&&($.valid|=4,$.height=parseInt(_t[1],10),$.width=parseInt(_t[2],10)),$.valid&2&&$.valid&4)break}return $.valid&2||u(3,"missing format specifier"),$.valid&4||u(3,"missing image size specifier"),$},x=function(L,at,D){let W=at;if(W<8||W>32767||L[0]!==2||L[1]!==2||L[2]&128)return new Uint8Array(L);W!==(L[2]<<8|L[3])&&u(3,"wrong scanline width");let j=new Uint8Array(4*at*D);j.length||u(4,"unable to allocate buffer space");let Tt=0,$=0,xt=4*W,_t=new Uint8Array(4),It=new Uint8Array(xt),gt=D;for(;gt>0&&$<L.byteLength;){$+4>L.byteLength&&u(1),_t[0]=L[$++],_t[1]=L[$++],_t[2]=L[$++],_t[3]=L[$++],(_t[0]!=2||_t[1]!=2||(_t[2]<<8|_t[3])!=W)&&u(3,"bad rgbe scanline format");let yt=0,tt;for(;yt<xt&&$<L.byteLength;){tt=L[$++];let kt=tt>128;if(kt&&(tt-=128),(tt===0||yt+tt>xt)&&u(3,"bad scanline data"),kt){let ce=L[$++];for(let ft=0;ft<tt;ft++)It[yt++]=ce}else It.set(L.subarray($,$+tt),yt),yt+=tt,$+=tt}let qt=W;for(let kt=0;kt<qt;kt++){let ce=0;j[Tt]=It[kt+ce],ce+=W,j[Tt+1]=It[kt+ce],ce+=W,j[Tt+2]=It[kt+ce],ce+=W,j[Tt+3]=It[kt+ce],Tt+=4}gt--}return j},b=function(L,at,D,W){let j=L[at+3],Tt=Math.pow(2,j-128)/255;D[W+0]=L[at+0]*Tt,D[W+1]=L[at+1]*Tt,D[W+2]=L[at+2]*Tt,D[W+3]=1},T=function(L,at,D,W){let j=L[at+3],Tt=Math.pow(2,j-128)/255;D[W+0]=Vg.toHalfFloat(Math.min(L[at+0]*Tt,65504)),D[W+1]=Vg.toHalfFloat(Math.min(L[at+1]*Tt,65504)),D[W+2]=Vg.toHalfFloat(Math.min(L[at+2]*Tt,65504)),D[W+3]=Vg.toHalfFloat(1)},E=new Uint8Array(t);E.pos=0;let S=y(E),R=S.width,A=S.height,N=x(E.subarray(E.pos),R,A),B,G,O;switch(this.type){case Cs:O=N.length/4;let L=new Float32Array(O*4);for(let D=0;D<O;D++)b(N,D*4,L,D*4);B=L,G=Cs;break;case ml:O=N.length/4;let at=new Uint16Array(O*4);for(let D=0;D<O;D++)T(N,D*4,at,D*4);B=at,G=ml;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:R,height:A,data:B,header:S.string,gamma:S.gamma,exposure:S.exposure,type:G}}setDataType(t){return this.type=t,this}load(t,e,n,i){function o(u,l){switch(u.type){case Cs:case ml:u.colorSpace=Ti,u.minFilter=sn,u.magFilter=sn,u.generateMipmaps=!1,u.flipY=!0;break}e&&e(u,l)}return super.load(t,o,n,i)}};var H1=class extends Vy{constructor(){super(),new V1().load(KX,t=>{t.mapping=Rg,this.environment=t;let e=new Ge;e.makeRotationX(Math.PI/2),this.environmentRotation=new su().setFromRotationMatrix(e)})}};var W1=class extends x0{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 Cv=class extends ln{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 W1(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new G1(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 U1(this)}getRatio(t,e){t===void 0&&(t=new k(0,0,0)),e===void 0&&(e=new k(100,0,0));let{clientWidth:n,clientHeight:i}=this.container,o=tn(t,this.camera,n,i),u=tn(e,this.camera,n,i);return Math.ceil(Math.sqrt((u.x-o.x)**2+(u.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof Cp&&(e.color=new be(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 St;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new Rp;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),u=(i=this.currentFloor)==null?void 0:i.poiLayer2.getPoiByDeviceXy(t,e);return(o||[]).concat(u||[])}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,u,l,c]=e,{clientSize:{width:f,height:g}}=this,m=this.control.getPolarAngle();i&&this.setPolarAngle(0,0);let y=new Qe().setFromObject(t);this.setPolarAngle(m,0);let{max:x,min:b}=y,T=new k(b.x,x.y,x.z),E=new k(x.x,x.y,x.z),S=new k(x.x,b.y,b.z),R=new k(b.x,b.y,b.z),A=tn(T,this.camera,f,g),N=tn(E,this.camera,f,g),B=tn(R,this.camera,f,g),G=tn(S,this.camera,f,g),L=new xl().setFromPoints([new St(A.x,A.y),new St(N.x,N.y),new St(B.x,B.y),new St(G.x,G.y)]).getSize(new St),at=(f-u-c)/L.x,D=(g-o-l)/L.y,W=Math.min(at,D),j=new k((x.x+b.x)/2,(x.y+b.y)/2,(x.z+b.z)/2),Tt=W*this.camera.zoom,$=this.camera.clone();$.zoom=Tt,$.updateMatrix();let xt=(f-L.x*W)/2,_t=(g-L.y*W)/2,It=(u-c)/2,gt=(o-l)/2;if(It){let yt=new k;yt.setFromMatrixColumn($.matrix,0),yt.normalize(),yt.multiplyScalar(It/Tt),j.add(yt)}if(gt){let yt=new k;yt.setFromMatrixColumn($.matrix,1),yt.normalize(),yt.multiplyScalar(gt/Tt),j.add(yt)}return{zoom:W*this.camera.zoom,center:j}}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:u}=this.getFitCameraToObjectZoom(t,e,n,i);return this.setZoom(o,u,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 jt(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()),zi(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new H1,this.renderer=new k1,this.lights=G3(),this.clientSize={width:0,height:0,x:0,y:0},this.renderRf=0,this.basicZoom=1,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:u,clientHeight:l}=n;u=Math.max(1,u),l=Math.max(1,l),i.left=-u/2,i.right=u/2,i.top=l/2,i.bottom=-l/2,i.updateProjectionMatrix(),o.setSize(u,l),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:u,height:l})},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 u=this.getPoisByDeviceXy(n.offsetX,n.offsetY);u.length&&this.dispatchEvent({type:"poi-click",pois:u})},this.onPointerover=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),u=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:i,pois:u,position:o})},this.onPointermove=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),u=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:i,pois:u,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 Tv(this),this.hoverHelper=new Av(this),this.resizeClientSize(),this.registryEvent()}};var bY=et(Os(),1),MY={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},loaderPlaceConfig:{textFontSize:14}};function hC(r){return(0,bY.merge)({},MY,r)}var NY=et(Os(),1);var jte=et(Xe(),1);var Zu;function wY(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(Zu)return e({db:Zu,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){Zu=o.target.result,console.log("onupgradeneeded"),e({db:Zu,type:"onupgradeneeded"})},i.onsuccess=o=>{Zu=o.target.result,e({db:Zu,type:"success"})},i.onerror=o=>{n(o)}})}function fC(r,t,e){return e===void 0&&(e=Zu),new Promise((n,i)=>{e||i("\u6CA1\u6709db");let u=e.transaction([r],"readonly").objectStore(r).get(t);u.onsuccess=()=>{u.result?n(u.result.value):n(null)},u.onerror=l=>{console.log("[getVersionByKey]",l),n(null)}})}function TY(r,t,e,n){return n===void 0&&(n=Zu),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((u,l)=>jt(this,null,function*(){let c=yield fC(r,t),f=n.transaction([r],"readwrite").objectStore(r),g=c!==null?f.put({key:t,value:e}):f.add({key:t,value:e});g.onsuccess=function(m){u(m)},g.onerror=function(m){l(m)}}))))}function Mf(r,t){t===void 0&&(t=Zu),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function AY(r){r===void 0&&(r=Zu),r==null||r.close(),Zu=null}var Gte=et(cr(),1),kte=et(Xe(),1);function q1(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 X1(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 CY(r,t,e){switch(r.l_type){case"graph":return o3t(r,t);case"wall":return s3t(r,t);case"lane":return a3t(r,t);case"texture2d":case"texture3d":return u3t(r,t);case"glb":return l3t(r,t);case"store":return c3t(r,t);case"facility":return f3t(r,t);case"parkingSpace":return d3t(r,t,e);case"text":return m3t(r,t)}}function RY(r,t,e,n){switch(r.l_type){case"store":return h3t(r,t,e,n);case"facility":return p3t(r,t,e,n);case"parkingSpace":return g3t(r,t,n)}}function o3t(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:u,strokeColor:l,strokeOpacity:c,height:f,airHeight:g}=i,m=o.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c+"-"+f+"-"+g;return c===0&&(m=o.toLowerCase()+"-"+u+"-"+f+"-"+g),n[m]?n[m].push(i):n[m]=[i],n},{});Object.values(e).forEach(n=>{let i=new Sf(t.context,n);t.mergeGraphicLayer.add(i)})}function s3t(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:u,strokeColor:l,strokeOpacity:c,height:f}=i,g=o.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c+"-"+f;return c===0&&(g=o.toLowerCase()+"-"+u+"-"+f),n[g]?n[g].push(i):n[g]=[i],n},{});Object.values(e).forEach(n=>{let i=new Sv(t.context,n);t.wallLayer.add(i)})}function a3t(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:u,strokeColor:l,strokeOpacity:c}=i,f=o.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c;return c===0&&(f=o.toLowerCase()+"-"+u),n[f]?n[f].push(i):n[f]=[i],n},{});Object.values(e).forEach(n=>{let i=new Mv(t.context,n);t.laneLayer.add(i)})}function u3t(r,t){if(r.elements.length){let e=new Ef(t.context,r.elements);t.textureLayer.add(e)}}function l3t(r,t){r.elements.forEach(e=>{let n=new bv(t.context,ue({},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 c3t(r,t){r.elements.map(e=>{let n=t.addGraphic(ue({},e,{dashed:!1}));t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function h3t(r,t,e,n){r.elements.map(i=>{try{let o=q1(i,e),u=new Ji(t.context,{id:i.id,icon:i.poi_info.showImageUrl||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.showStoreName,maxWeight:i.poi_info.maxWeight||25,minWeight:i.poi_info.minWeight||1,text_font_size:n.textFontSize});t.poiLayer2.pushPoi(u),u&&(u.userData.type="store",u.userData.data=i,u.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,i)}})}function f3t(r,t){r.elements.map(e=>{let n=t.addGraphic(ue({},e,{dashed:!1}));t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function p3t(r,t,e,n){r.elements.filter(o=>o.poi_info).map(o=>{try{let u=X1(o,e),l=new Ji(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:u,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.showFacilityName,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1,text_font_size:n.textFontSize});t.poiLayer2.pushPoi(l),l.userData.type="facility",l.userData.data=o,l.userData.floor=t.name}catch(u){console.log("\u6DFB\u52A0facility\u5931\u8D25",u,o)}})}function d3t(r,t,e){t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function g3t(r,t,e){return jt(this,null,function*(){let n=r.elements.filter(u=>u.texts[0]),i=n.map(u=>u.texts[0]),o=yield po.lazyGetTextureByTexts(i,{height:64});n.forEach(u=>{try{let l=u.texts[0],c=new Ji(t.context,{id:u.id,text:l,position:{x:u.center_coord_x,y:u.center_coord_y,z:u.airHeight+u.height},text_texture:o[l].texture,text_texture_width:o[l].width,text_texture_height:o[l].height,text_texture_offset_x:o[l].x,text_texture_offset_y:o[l].y,text_font_size:e.textFontSize});c&&(c.userData.type="parkingSpace",c.userData.data=u,c.userData.floor=t.name),t.poiLayer2.pushPoi(c)}catch(l){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",l,u)}}),Object.values(o).forEach(u=>{u.texture.dispose()})})}function m3t(r,t){let e=new wv(t.context,r.elements.map(n=>ue({},n,{center_x:n.center_coord_x,center_y:n.center_coord_y})));t.textTextureLayer.add(e)}var PY="map_version",IY="route_version",LY="facility_version",pC="map_data",Y1="road_network_data",dC="facility_data",v3t={mergeParkingSpace:!0},Rv=class extends Jo{initDb(){return jt(this,null,function*(){try{let{db:t,type:e}=yield wY("aibee_map",2);e==="onupgradeneeded"&&(Mf(PY),Mf(IY),Mf(LY),Mf(pC),Mf(Y1),Mf(dC)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return jt(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=ue({},this.placeConfig,e));else{let n=yield fetch(t).then(i=>i.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=ue({},this.placeConfig,JSON.parse(n.data.config||"{}")))}this.getOtherDataByFreeTime()})}setCacheData(t,e,n){return this.initDbPromise.then(()=>TY(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>fC(t,""+e,this.db))}getFloorCacheKey(t){return t.floor_id+"_"+t.version_id}getFloorData(t){return jt(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return jt(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=q1(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=X1(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return jt(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>jt(this,null,function*(){let i=this.getFloorCacheKey(t),o=yield fetch(t.map_url).then(u=>u.json());o.floor=t.floor,this.setCacheData(pC,i,o),this.setCacheData(PY,i,t.version_id),n(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return jt(this,null,function*(){let e=this.floors.find(i=>i.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{let i=yield this.getCacheData(pC,n);return i||this.getFloorJsonDataByFloorInfo(e)}catch(i){return console.log("[get floor data error]",i),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return jt(this,null,function*(){return(yield Promise.all(this.floors.map(e=>jt(this,null,function*(){let n=this.getFloorCacheKey(e);try{let i=yield this.getCacheData(Y1,n);if(i)return i;let o=yield fetch(e.route_url).then(u=>u.json());return this.setCacheData(Y1,n,o),this.setCacheData(IY,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(u=>u.json());return this.setCacheData(Y1,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return jt(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=()=>jt(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(dC,e,i),this.setCacheData(LY,e,t.version_id)),i});try{let i=yield this.getCacheData(dC,e);return i||n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return jt(this,null,function*(){for(let t=0;t<this.floors.length;t++){let e=this.floors[t];this.getFloorJsonData(e.floor)}})}getMulFloorsData(t){return jt(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return jt(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return jt(this,null,function*(){e=this.getFloorBaseLayer(t,e);let i=ue({},this.placeConfig,n);return t.layers.forEach(o=>{["range","ground"].includes(o.l_type)||hf(o.elements,e.userData.center)}),yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,i),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new k),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t,e){return jt(this,null,function*(){return new Promise(n=>{let i={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(i),u=l=>{let{task:c,res:f}=l;c.tid===o&&(this.taskQueue.removeEventListener("active-task-end",u),n(f))};this.taskQueue.addEventListener("active-task-end",u)})})}_switchFloor(t,e){return jt(this,null,function*(){var n;let i=t;if(typeof t=="string"){let g=yield this.getFloorJsonData(t);if(g)i=g;else return null}let o=ue({},this.placeConfig,e),u=new Fa(this.bmap.context);u.userData.data=t;let l=this.floors.find(g=>g.floor===i.floor);var c;let f=(c=l==null?void 0:l.map_angle)!=null?c:0;return this.bmap.dispatchEvent({type:Zo.SWITCH_FLOOR_BEFORE,data:{curFloor:u,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:u,graphics:[],floorData:i}}),this.bmap.context.scene.background=new be(o.backgroundColor),this.getFloorBaseLayer(i,u),this.changeFloorBox(i,u),this.bmap.buildingCenter=u.userData.center,this.bmap.currentBuildGround=(n=u.userData.data.layers.find(g=>g.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(u),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(f/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),i.layers.forEach(g=>{["range","ground"].includes(g.l_type)||hf(g.elements,u.userData.center)}),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:u,graphics:[]}}),this.bmap.dispatchEvent({type:Zo.SWITCH_FLOOR_GROUND,data:{curFloor:u}}),yield Em(),yield this.getFloorContentLayer(i,u),this.changeFloorBox(i,u),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:u,graphics:[]}}),yield $M(2),yield this.getFloorPoi(i,u,o),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:u,graphics:u.graphicLayer.children}}),this.bmap.dispatchEvent({type:Zo.SWITCH_FLOOR_AFTER,data:{curFloor:u,graphics:u.graphicLayer.children}}),u})}getFloorBaseLayer(t,e){e||(e=new Fa(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":hf(i.elements,n);let u=i.elements.map(l=>new $i(this.bmap.context,ue({},l,{dashed:!1})));e.addGrounds(u);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return jt(this,null,function*(){e||(e=new Fa(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)||(CY(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield Em(),n=Date.now()))}return e})}getFloorPoi(t,e,n){return jt(this,null,function*(){n===void 0&&(n=this.placeConfig);let i=Date.now();yield Promise.all(t.layers.map(u=>RY(u,e,this.locale,n))),console.log("poi time",Date.now()-i);let o=Date.now();Em().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return jt(this,null,function*(){var t;AY((t=this.db)!=null?t:void 0)})}dispose(){super.dispose(),this.clear(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new pf,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=ue({},v3t,e),this.placeConfig=ue({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var see=et(Xe(),1);function gC(r,t){return jt(this,null,function*(){let{brand:e,project:n}=r,{apiDomain:i,apiPath:{floorRange:o},apiInfo:u}=t,l=""+i+o+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n;return yield fetch(l,u).then(f=>f.json()).then(f=>f.data).then(f=>{let g=(f||[])[0];return g&&(g.info=JSON.parse(g.info)),g})})}function mC(r,t){return jt(this,null,function*(){let{brand:e,project:n,floor:i,ts:o,resource_type_list:u}=r,{apiDomain:l,apiPath:{floorGraphic:c},apiInfo:f}=t,g=""+l+c+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+i+"&ts="+o+"&resource_type_list="+u;return yield fetch(g,f).then(y=>y.json()).then(y=>y.data).then(y=>((y||[]).map(x=>x.info=JSON.parse(x.info)),y||[]))})}function _3t(r,t){return jt(this,null,function*(){let{project:e,floor:n}=r,{apiDomain:i,apiInfo:o}=t,u=i+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+n;return yield fetch(u,o).then(c=>c.json()).then(c=>c.data).then(c=>JSON.parse(c[0].streetInfo||"{}")).then(c=>c.fileId?y3t(c.fileId,t):null)})}function y3t(r,t){return jt(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 u=new TextDecoder("utf-8").decode(i);return u?JSON.parse(u):null})})}var vC=class{load(t){return jt(this,null,function*(){let e=uf(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),mC(t,this.bmap.config)]),i=uf({floor:t.floor,ts:t.ts});hf(n.map(u=>u.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(i)||0),n.forEach(u=>u.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 jt(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:u,graphic:l}=this.bmap.config;for(let c=0;c<t.length;c++){let f=t[c];f.info.group==="ground"?(f.info.fillColor=o.color,f.info.fillOpacity=o.opacity,f.info.height=o.height,f.info.stroke=o.stroke,f.info.strokeColor=o.strokeColor,f.info.strokeOpacity=o.strokeOpacity):f.info.userData.mark?(f.info.height=u.height,f.info.fillColor=u.color,f.info.fillOpacity=u.opacity,f.info.stroke=u.stroke,f.info.strokeColor=u.strokeColor,f.info.strokeOpacity=u.strokeOpacity):(f.info.fillOpacity=l.fillOpacity,this.bmap.config.initTransToMark&&(f.info.height=u.height,f.info.fillColor=u.color,f.info.stroke=u.stroke,f.info.strokeColor=u.strokeColor,f.info.strokeOpacity=u.strokeOpacity))}for(let c of t){if(c.info.group==="ground")e.createGround(c.info);else{let f=e.addGraphic(c.info);f.userData.data=c,n.set(c.legacy_id,f)}i.set(c.element_uuid,c)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=i,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(Zo.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(Zo.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 jt(this,null,function*(){let n=yield this.load(ue({},t,{resource_type_list:"6"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}switchFloorByOtherData(t,e){return jt(this,null,function*(){let n=yield this.load(ue({},t,{resource_type_list:"1,2,3,4"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}loadBuildGround(t){return jt(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 jt(this,null,function*(){let{brand:e,project:n}=t,i=uf({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=gC({brand:e,project:n},this.bmap.config).then(u=>(this.buildingGroundMap.set(i,u),u));return this.buildingGroundMap.set(i,o),o})}switchFloor(t){return jt(this,null,function*(){let e=new Fa(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 x3t=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),_C=class extends ln{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?vm(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 jt(this,null,function*(){return this.loader||(this.loader=new Rv(this),this.loader.placeConfig=ue({},this.loader.placeConfig,this.config.loaderPlaceConfig),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(Zo.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(Zo.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(ue({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(i){let{facilityAngle:o=0,facilityXScale:u=1,facilityYScale:l=1}=t.options.userData;i.rotateZ((180-o)/180*Math.PI),i.scale.set(u,l,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 $i))||[]}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,u=(n==null?void 0:n[1])||i.y;return console.log(o,u,n,i),this.context.currentFloor.addPoi(ue({},e,{position:{x:o,y:u,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:u}}=this;if(u.updateMatrix(),i){let l=new k;l.setFromMatrixColumn(u.matrix,1),l.normalize(),l.multiplyScalar(i/u.zoom),o.add(l)}if(n){let l=new k;l.setFromMatrixColumn(u.matrix,0),l.normalize(),l.multiplyScalar(n/u.zoom),o.add(l)}return this.context.setCameraPosition(o,e)}translateElementToCenterX(t,e){return jt(this,null,function*(){return e===void 0&&(e=500),Oa(new Promise(n=>{let i=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:u,height:l},camera:c}=this.context,g=tn(o,c,u,l).x-u/2,m=new k;m.setFromMatrixColumn(this.context.camera.matrix,0),m.normalize(),m.multiplyScalar(g/this.context.camera.zoom),i.add(m),this.context.setCameraPosition(i,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:i}=this.container;return tn(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 jt(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 jt(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new xv(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 Ev(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=vm(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,po.dispose(),Qo.dispose(),H0.dispose(),ha.dispose(),ni.dispose(),Ku.dispose(),this.debounceResize=null}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new ei,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*30,this.basicZoom=i,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=hC(e),this.context=new Cv(t,this.config),this.debounceResize=(0,NY.debounce)(this.resize,5),this.registryEvent()}};var Cee=et(Xe(),1);var fa=class extends ln{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 yC=class extends fa{fetchEquipment(){return jt(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(u=>[u.equipment_id,u]))}),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(Zo.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(Zo.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var Fne=et(Sm(),1),Bne=et(hu(),1),zne=et(Xe(),1),Gne=et(cC(),1);var Jee=et(Xe(),1),Qee=et(cr(),1);var Nee=et(hA(),1),Oee=et(Gm(),1),Dee=et(km(),1),Uee=et(Hm(),1),Fee=et(Wm(),1),Bee=et(qm(),1),zee=et(Ym(),1),Gee=et(jm(),1),kee=et(Km(),1),Vee=et(Zm(),1),Hee=et($m(),1),Wee=et(Jm(),1),qee=et(Qm(),1),Xee=et(ev(),1),Yee=et(nv(),1),jee=et(cr(),1),Kee=et(tC(),1);var za=class extends mr{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 Ge,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)}}})}};za.prototype.setMatrixWorld=function(r){this.matrixWorld=r};za.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};za.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 k)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 E3t(r,t){var e=new Ge,n=new ra,i=new io,o=new k,u=this.geometry;if(u.boundingSphere||u.computeBoundingSphere(),i.copy(u.boundingSphere),i.applyMatrix4(this.matrixWorld),r.ray.intersectSphere(i,o)!==!1){e.copy(this.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(e);var l=new k,c=new k,f=new k,g=this instanceof ia?2:1,m=u.index,y=u.attributes;if(m!==null)for(var x=m.array,b=y.position.array,T=y.width.array,E=0,S=x.length-1;E<S;E+=g){var R=x[E],A=x[E+1];l.fromArray(b,R*3),c.fromArray(b,A*3);var N=T[Math.floor(E/3)]!==void 0?T[Math.floor(E/3)]:1,B=r.params.Line.threshold+this.material.lineWidth*N/2,G=B*B,O=n.distanceSqToSegment(l,c,o,f);if(!(O>G)){o.applyMatrix4(this.matrixWorld);var L=r.ray.origin.distanceTo(o);L<r.near||L>r.far||(t.push({distance:L,point:f.clone().applyMatrix4(this.matrixWorld),index:E,face:null,faceIndex:null,object:this}),E=S)}}}}za.prototype.raycast=E3t;za.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]};za.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};za.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=new k(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new k(this.positions[n+6],this.positions[n+7],this.positions[n+8]),u=i.distanceTo(o);t+=u}return t};za.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 u=this.getDistance(i)/e;this.uvs.push(u,0),this.uvs.push(u,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 hr(new Float32Array(this.positions),3),previous:new hr(new Float32Array(this.previous),3),next:new hr(new Float32Array(this.next),3),side:new hr(new Float32Array(this.side),1),width:new hr(new Float32Array(this.width),1),uv:new hr(new Float32Array(this.uvs),2),index:new hr(new Uint16Array(this.indices_array),1),counters:new hr(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 xC(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}za.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;xC(t,0,e,0,i),xC(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,xC(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};Be.meshline_vert=["",Be.logdepthbuf_pars_vertex,Be.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;","",Be.logdepthbuf_vertex,Be.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",Be.fog_vertex,"}"].join(`
8108
8108
  `);Be.meshline_frag=["",Be.fog_pars_fragment,Be.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() {","",Be.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);","",Be.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
8109
8109
  `);var Pv=class extends mi{constructor(t){super({uniforms:Object.assign({},fe.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new be(16777215)},opacity:{value:1},resolution:{value:new St(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 St(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:Be.meshline_vert,fragmentShader:Be.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)}};Pv.prototype.copy=function(r){return mi.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 OY={texture_url:T1,lineWidth:10,color:16777215},j1=class extends Oe{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(l=>{let[c,f]=l;return tn(new k(c,f,0),e,n,i)}).map(l=>{let{x:c,y:f}=l;return[c,f]});return Ns(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new St(t,1)}loadTexture(t){return new Promise((e,n)=>{new yl().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 jt(this,null,function*(){let e=this.geometry=new za;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=na}let n=this.material=new Pv({useMap:!0,color:new be(this.config.color),transparent:!0,resolution:new St(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:dl,repeat:new St(this.getRepeat(),1)}),i=this.mesh=new pn(e,n);return i.renderOrder=99999,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=OY,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({},OY,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var ane=et(P1(),1),une=et(Xe(),1),lne=et(cr(),1);var DY=et(Os(),1);var S3t={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},K1=class extends ln{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:u,routeIndex:l}=this;if(!n.length)return null;let c=n,f=this.paths[this.routeIndex].floor,g=this.getCurRouteRemainDistance();if(i){let E=Dl(n,i);c=c.slice(E+1),c.unshift(i)}let m=[{floor:o==null?void 0:o.floor,points:c},...u.slice(l+1)],{distance:y,closestPoint:x,index:b,i:T}=m.reduce((E,S,R)=>{if(S.floor!==t)return E;let{distance:A,closestPoint:N,index:B}=S.points.reduce((G,O,L,at)=>{if(!at[L+1])return ue({},G,{distance:G.distance===1/0?Dr(O,e):G.distance});let{distance:D,closestPoint:W}=_w(e,O,at[L+1]);if(f===t){let j=[e,...at.slice(L+1)],Tt=Ns(j);if(g-Tt>10)return G}return D<G.distance?{distance:D,closestPoint:W,index:L}:G},{distance:1/0,closestPoint:S.points[0],index:0});return A<E.distance?{distance:A,closestPoint:N,index:R,i:B}:E},{distance:1/0,closestPoint:c[0],index:0,i:0});return{distance:y,closestPoint:x,routeIndex:b+l,pointIndex:b===0?T+this.pointIndex:T}}toPosition(t,e){let n=this.adsorb(t,e);if(!n)return;let{distance:i,closestPoint:o,routeIndex:u,pointIndex:l}=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=u,this.pointIndex=l,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 jt(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(),u=o/this.options.simulationSpeed,l=this.throttleUpdatePosition=(0,DY.throttle)(f=>{let g=lf(i,f.distance);g&&(e.push({floor:t.floor,pos:g}),this.toPosition(t.floor,g))},100),c=this.simulationTween=new Da({distance:0},this.tweenUtil.group).to({distance:o},u*1e3).onUpdate(l).onComplete(()=>{this.tweenUtil.remove(c),l.flush(),l.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 Ns(i)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[...t.slice(0,e+1),n];return Ns(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,u=e,l=Bl.FRONT,c=(o==null||(t=o.pointInfos[u])==null?void 0:t.crossName)||"",f=0,g=0,m=0;for(;l===Bl.FRONT&&u<=n.length;){let b=n[u],T=n[u+1],E=n[u+2];if(!b||!T)l=Bl.END;else if(f+=Dr(b,T),!E)l=Bl.END;else{l=Nx(b,T,E),g=_m(b,T,E),m=(new St(E[0]-T[0],E[1]-T[1]).angle()*180/Math.PI-90+360)%360;var y;c=(y=o==null?void 0:o.pointInfos[u+1].crossName)!=null?y:"",u+=1}}if(n[u]&&(f=Dr(i,n[u])),l===Bl.END&&f<=this.options.directionEmitThreshold)return{dir:l,distance:f,crossName:c,angle:g,nextAngle:m};let x=this.getCurRouteToStartDistance();return e===0&&x<=5?{dir:Bl.START,distance:f,crossName:c,angle:g,nextAngle:m}:(f>=this.options.directionEmitThreshold&&(l=Bl.FRONT),{dir:l,distance:f,crossName:c,angle:g,nextAngle:m})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(n=>{let i=Or(n.cds),o=wr(this.position);return Zi(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:u,angle:l,nextAngle:c}=n;e<=10&&(i=Bl.END);let{imageUrl:f}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:o,dir:i,angle:l,nextAngle:c,pos:this.position,routeIndex:this.routeIndex,crossName:u,offset:this.offset,reset:this.reset,imageUrl:f}}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 ei,this.resetTimer=null,this.tweenUtil=new Oc,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({},S3t,e),this.roadData=n,this.registryEvent()}};var mne=et(r1(),1),vne=et(Gm(),1),_ne=et(km(),1),yne=et(Hm(),1),xne=et(Wm(),1),Ene=et(qm(),1),Sne=et(Ym(),1),bne=et(jm(),1),Mne=et(Km(),1),wne=et(Zm(),1),Tne=et($m(),1),Ane=et(Jm(),1),Cne=et(Qm(),1),Rne=et(ev(),1),Pne=et(nv(),1),Ine=et(OT(),1),Lne=et(Xe(),1);var kc=class r extends Ji{addDebug(){r.canvas.style.cssText=`
8110
8110
  position: fixed;