@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
  `,g=function(D,at,R){at=at||1024;let B=D.pos,bt=-1,Q=0,vt="",Mt=String.fromCharCode.apply(null,new Uint16Array(D.subarray(B,B+128)));for(;0>(bt=Mt.indexOf(m))&&Q<at&&B<D.byteLength;)vt+=Mt,Q+=Mt.length,B+=128,Mt+=String.fromCharCode.apply(null,new Uint16Array(D.subarray(B,B+128)));return-1<bt?(R!==!1&&(D.pos+=Q+bt+1),vt+Mt.slice(0,bt)):!1},P=function(D){let at=/^#\?(\S+)/,R=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,L=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,B=/^\s*FORMAT=(\S+)\s*$/,bt=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,Q={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0},vt,Mt;for((D.pos>=D.byteLength||!(vt=g(D)))&&u(1,"no header found"),(Mt=vt.match(at))||u(3,"bad initial token"),Q.valid|=1,Q.programtype=Mt[1],Q.string+=vt+`
8105
8105
  `;vt=g(D),vt!==!1;){if(Q.string+=vt+`
8106
8106
  `,vt.charAt(0)==="#"){Q.comments+=vt+`
8107
- `;continue}if((Mt=vt.match(R))&&(Q.gamma=parseFloat(Mt[1])),(Mt=vt.match(L))&&(Q.exposure=parseFloat(Mt[1])),(Mt=vt.match(B))&&(Q.valid|=2,Q.format=Mt[1]),(Mt=vt.match(bt))&&(Q.valid|=4,Q.height=parseInt(Mt[1],10),Q.width=parseInt(Mt[2],10)),Q.valid&2&&Q.valid&4)break}return Q.valid&2||u(3,"missing format specifier"),Q.valid&4||u(3,"missing image size specifier"),Q},v=function(D,at,R){let L=at;if(L<8||L>32767||D[0]!==2||D[1]!==2||D[2]&128)return new Uint8Array(D);L!==(D[2]<<8|D[3])&&u(3,"wrong scanline width");let B=new Uint8Array(4*at*R);B.length||u(4,"unable to allocate buffer space");let bt=0,Q=0,vt=4*L,Mt=new Uint8Array(4),Wt=new Uint8Array(vt),mt=R;for(;mt>0&&Q<D.byteLength;){Q+4>D.byteLength&&u(1),Mt[0]=D[Q++],Mt[1]=D[Q++],Mt[2]=D[Q++],Mt[3]=D[Q++],(Mt[0]!=2||Mt[1]!=2||(Mt[2]<<8|Mt[3])!=L)&&u(3,"bad rgbe scanline format");let Pt=0,tt;for(;Pt<vt&&Q<D.byteLength;){tt=D[Q++];let Ut=tt>128;if(Ut&&(tt-=128),(tt===0||Pt+tt>vt)&&u(3,"bad scanline data"),Ut){let ce=D[Q++];for(let pt=0;pt<tt;pt++)Wt[Pt++]=ce}else Wt.set(D.subarray(Q,Q+tt),Pt),Pt+=tt,Q+=tt}let Gt=L;for(let Ut=0;Ut<Gt;Ut++){let ce=0;B[bt]=Wt[Ut+ce],ce+=L,B[bt+1]=Wt[Ut+ce],ce+=L,B[bt+2]=Wt[Ut+ce],ce+=L,B[bt+3]=Wt[Ut+ce],bt+=4}mt--}return B},S=function(D,at,R,L){let B=D[at+3],bt=Math.pow(2,B-128)/255;R[L+0]=D[at+0]*bt,R[L+1]=D[at+1]*bt,R[L+2]=D[at+2]*bt,R[L+3]=1},b=function(D,at,R,L){let B=D[at+3],bt=Math.pow(2,B-128)/255;R[L+0]=km.toHalfFloat(Math.min(D[at+0]*bt,65504)),R[L+1]=km.toHalfFloat(Math.min(D[at+1]*bt,65504)),R[L+2]=km.toHalfFloat(Math.min(D[at+2]*bt,65504)),R[L+3]=km.toHalfFloat(1)},_=new Uint8Array(t);_.pos=0;let A=P(_),E=A.width,x=A.height,C=v(_.subarray(_.pos),E,x),N,F,Y;switch(this.type){case js:Y=C.length/4;let D=new Float32Array(Y*4);for(let R=0;R<Y;R++)S(C,R*4,D,R*4);N=D,F=js;break;case yl:Y=C.length/4;let at=new Uint16Array(Y*4);for(let R=0;R<Y;R++)b(C,R*4,at,R*4);N=at,F=yl;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:E,height:x,data:N,header:A.string,gamma:A.gamma,exposure:A.exposure,type:F}}setDataType(t){return this.type=t,this}load(t,e,n,i){function o(u,l){switch(u.type){case js:case yl:u.colorSpace=bi,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 G1=class extends GM{constructor(){super(),new L1().load(yV,t=>{t.mapping=Cm,this.environment=t;let e=new Fe;e.makeRotationX(Math.PI/2),this.environmentRotation=new su().setFromRotationMatrix(e)})}};var k1=class extends Ac{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 Wy=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 k1(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new z1(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 N1(this)}getRatio(t,e){t===void 0&&(t=new U(0,0,0)),e===void 0&&(e=new U(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 Df&&(e.color=new Se(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 At;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new Cf;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:p,height:m}}=this,g=this.control.getPolarAngle();i&&this.setPolarAngle(0,0);let P=new $e().setFromObject(t);this.setPolarAngle(g,0);let{max:v,min:S}=P,b=new U(S.x,v.y,v.z),_=new U(v.x,v.y,v.z),A=new U(v.x,S.y,S.z),E=new U(S.x,S.y,S.z),x=tn(b,this.camera,p,m),C=tn(_,this.camera,p,m),N=tn(E,this.camera,p,m),F=tn(A,this.camera,p,m),D=new _l().setFromPoints([new At(x.x,x.y),new At(C.x,C.y),new At(N.x,N.y),new At(F.x,F.y)]).getSize(new At),at=(p-u-c)/D.x,R=(m-o-l)/D.y,L=Math.min(at,R),B=new U((v.x+S.x)/2,(v.y+S.y)/2,(v.z+S.z)/2),bt=L*this.camera.zoom,Q=this.camera.clone();Q.zoom=bt,Q.updateMatrix();let vt=(p-D.x*L)/2,Mt=(m-D.y*L)/2,Wt=(u-c)/2,mt=(o-l)/2;if(Wt){let Pt=new U;Pt.setFromMatrixColumn(Q.matrix,0),Pt.normalize(),Pt.multiplyScalar(Wt/bt),B.add(Pt)}if(mt){let Pt=new U;Pt.setFromMatrixColumn(Q.matrix,1),Pt.normalize(),Pt.multiplyScalar(mt/bt),B.add(Pt)}return{zoom:L*this.camera.zoom,center:B}}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 kt(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 G1,this.renderer=new K1,this.lights=JT(),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 Ey(this),this.hoverHelper=new Iy(this),this.resizeClientSize(),this.registryEvent()}};var GV=et(Ys(),1),kV={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 fI(r){return(0,GV.merge)({},kV,r)}var eB=et(Ys(),1);var Fee=et(Ke(),1);var Qu;function VV(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(Qu)return e({db:Qu,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){Qu=o.target.result,console.log("onupgradeneeded"),e({db:Qu,type:"onupgradeneeded"})},i.onsuccess=o=>{Qu=o.target.result,e({db:Qu,type:"success"})},i.onerror=o=>{n(o)}})}function dI(r,t,e){return e===void 0&&(e=Qu),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 BV(r,t,e,n){return n===void 0&&(n=Qu),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((u,l)=>kt(this,null,function*(){let c=yield dI(r,t),p=n.transaction([r],"readwrite").objectStore(r),m=c!==null?p.put({key:t,value:e}):p.add({key:t,value:e});m.onsuccess=function(g){u(g)},m.onerror=function(g){l(g)}}))))}function wp(r,t){t===void 0&&(t=Qu),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function JV(r){r===void 0&&(r=Qu),r==null||r.close(),Qu=null}var Dee=et(cr(),1),Cee=et(Ke(),1);function V1(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 B1(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 HV(r,t,e){switch(r.l_type){case"graph":return WTt(r,t);case"wall":return DTt(r,t);case"lane":return CTt(r,t);case"texture2d":case"texture3d":return YTt(r,t);case"glb":return RTt(r,t);case"store":return XTt(r,t);case"facility":return NTt(r,t);case"parkingSpace":return FTt(r,t,e);case"text":return zTt(r,t)}}function QV(r,t,e,n){switch(r.l_type){case"store":return OTt(r,t,e,n);case"facility":return ZTt(r,t,e,n);case"parkingSpace":return UTt(r,t,n)}}function WTt(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:u,strokeColor:l,strokeOpacity:c,height:p,airHeight:m}=i,g=o.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c+"-"+p+"-"+m;return c===0&&(g=o.toLowerCase()+"-"+u+"-"+p+"-"+m),n[g]?n[g].push(i):n[g]=[i],n},{});Object.values(e).forEach(n=>{let i=new Sp(t.context,n);t.mergeGraphicLayer.add(i)})}function DTt(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:u,strokeColor:l,strokeOpacity:c,height:p}=i,m=o.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c+"-"+p;return c===0&&(m=o.toLowerCase()+"-"+u+"-"+p),n[m]?n[m].push(i):n[m]=[i],n},{});Object.values(e).forEach(n=>{let i=new wy(t.context,n);t.wallLayer.add(i)})}function CTt(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:u,strokeColor:l,strokeOpacity:c}=i,p=o.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c;return c===0&&(p=o.toLowerCase()+"-"+u),n[p]?n[p].push(i):n[p]=[i],n},{});Object.values(e).forEach(n=>{let i=new xy(t.context,n);t.laneLayer.add(i)})}function YTt(r,t){if(r.elements.length){let e=new Ap(t.context,r.elements);t.textureLayer.add(e)}}function RTt(r,t){r.elements.forEach(e=>{let n=new by(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 XTt(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 OTt(r,t,e,n){r.elements.map(i=>{try{let o=V1(i,e),u=new qi(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 NTt(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 ZTt(r,t,e,n){r.elements.filter(o=>o.poi_info).map(o=>{try{let u=B1(o,e),l=new qi(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 FTt(r,t,e){t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function UTt(r,t,e){return kt(this,null,function*(){let n=r.elements.filter(u=>u.texts[0]),i=n.map(u=>u.texts[0]),o=yield fo.lazyGetTextureByTexts(i,{height:64});n.forEach(u=>{try{let l=u.texts[0],c=new qi(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 zTt(r,t){let e=new jy(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 qV="map_version",$V="route_version",tB="facility_version",mI="map_data",J1="road_network_data",gI="facility_data",KTt={mergeParkingSpace:!0},bp=class extends qo{initDb(){return kt(this,null,function*(){try{let{db:t,type:e}=yield VV("aibee_map",2);e==="onupgradeneeded"&&(wp(qV),wp($V),wp(tB),wp(mI),wp(J1),wp(gI)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return kt(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(()=>BV(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>dI(t,""+e,this.db))}getFloorCacheKey(t){return t.floor_id+"_"+t.version_id}getFloorData(t){return kt(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return kt(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=V1(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=B1(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return kt(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>kt(this,null,function*(){let i=this.getFloorCacheKey(t),o=yield fetch(t.map_url).then(u=>u.json());o.floor=t.floor,this.setCacheData(mI,i,o),this.setCacheData(qV,i,t.version_id),n(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return kt(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(mI,n);return i||this.getFloorJsonDataByFloorInfo(e)}catch(i){return console.log("[get floor data error]",i),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return kt(this,null,function*(){return(yield Promise.all(this.floors.map(e=>kt(this,null,function*(){let n=this.getFloorCacheKey(e);try{let i=yield this.getCacheData(J1,n);if(i)return i;let o=yield fetch(e.route_url).then(u=>u.json());return this.setCacheData(J1,n,o),this.setCacheData($V,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(u=>u.json());return this.setCacheData(J1,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return kt(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=()=>kt(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(gI,e,i),this.setCacheData(tB,e,t.version_id)),i});try{let i=yield this.getCacheData(gI,e);return i||n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return kt(this,null,function*(){for(let t=0;t<this.floors.length;t++){let e=this.floors[t];this.getFloorJsonData(e.floor)}})}getMulFloorsData(t){return kt(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return kt(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return kt(this,null,function*(){return e=this.getFloorBaseLayer(t,e),n=ue({},this.placeConfig,n),t.layers.forEach(i=>{["range","ground"].includes(i.l_type)||hp(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 U),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t,e){return kt(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:p}=l;c.tid===o&&(this.taskQueue.removeEventListener("active-task-end",u),n(p))};this.taskQueue.addEventListener("active-task-end",u)})})}_switchFloor(t,e){return kt(this,null,function*(){var n;let i=t;if(typeof t=="string"){let p=yield this.getFloorJsonData(t);if(p)i=p;else return null}e=ue({},this.placeConfig,e);let o=new Oa(this.bmap.context);o.userData.data=t;let u=this.floors.find(p=>p.floor===i.floor);var l;let c=(l=u==null?void 0:u.map_angle)!=null?l:0;return this.bmap.dispatchEvent({type:Ho.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 Se(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(p=>p.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(p=>{["range","ground"].includes(p.l_type)||hp(p.elements,o.userData.center)}),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:o,graphics:[]}}),this.bmap.dispatchEvent({type:Ho.SWITCH_FLOOR_GROUND,data:{curFloor:o}}),yield wg(),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 sx(2),yield this.getFloorPoi(i,o,e),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:o,graphics:o.graphicLayer.children}}),this.bmap.dispatchEvent({type:Ho.SWITCH_FLOOR_AFTER,data:{curFloor:o,graphics:o.graphicLayer.children}}),o})}getFloorBaseLayer(t,e){e||(e=new Oa(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":hp(i.elements,n);let u=i.elements.map(l=>new Qi(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 kt(this,null,function*(){e||(e=new Oa(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)||(HV(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield wg(),n=Date.now()))}return e})}getFloorPoi(t,e,n){return kt(this,null,function*(){n===void 0&&(n=this.placeConfig);let i=Date.now();yield Promise.all(t.layers.map(u=>QV(u,e,this.locale,n))),console.log("poi time",Date.now()-i);let o=Date.now();wg().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return kt(this,null,function*(){var t;JV((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 fp,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=ue({},KTt,e),this.placeConfig=ue({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var qee=et(Ke(),1);function yI(r,t){return kt(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(p=>p.json()).then(p=>p.data).then(p=>{let m=(p||[])[0];return m&&(m.info=JSON.parse(m.info)),m})})}function MI(r,t){return kt(this,null,function*(){let{brand:e,project:n,floor:i,ts:o,resource_type_list:u}=r,{apiDomain:l,apiPath:{floorGraphic:c},apiInfo:p}=t,m=""+l+c+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+i+"&ts="+o+"&resource_type_list="+u;return yield fetch(m,p).then(P=>P.json()).then(P=>P.data).then(P=>((P||[]).map(v=>v.info=JSON.parse(v.info)),P||[]))})}function LTt(r,t){return kt(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?GTt(c.fileId,t):null)})}function GTt(r,t){return kt(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 PI=class{load(t){return kt(this,null,function*(){let e=up(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),MI(t,this.bmap.config)]),i=up({floor:t.floor,ts:t.ts});hp(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 kt(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 p=t[c];p.info.group==="ground"?(p.info.fillColor=o.color,p.info.fillOpacity=o.opacity,p.info.height=o.height,p.info.stroke=o.stroke,p.info.strokeColor=o.strokeColor,p.info.strokeOpacity=o.strokeOpacity):p.info.userData.mark?(p.info.height=u.height,p.info.fillColor=u.color,p.info.fillOpacity=u.opacity,p.info.stroke=u.stroke,p.info.strokeColor=u.strokeColor,p.info.strokeOpacity=u.strokeOpacity):(p.info.fillOpacity=l.fillOpacity,this.bmap.config.initTransToMark&&(p.info.height=u.height,p.info.fillColor=u.color,p.info.stroke=u.stroke,p.info.strokeColor=u.strokeColor,p.info.strokeOpacity=u.strokeOpacity))}for(let c of t){if(c.info.group==="ground")e.createGround(c.info);else{let p=e.addGraphic(c.info);p.userData.data=c,n.set(c.legacy_id,p)}i.set(c.element_uuid,c)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=i,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(Ho.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(Ho.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 kt(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 kt(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 kt(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 kt(this,null,function*(){let{brand:e,project:n}=t,i=up({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=yI({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 kt(this,null,function*(){let e=new Oa(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 kTt=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),H1=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?_g(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 kt(this,null,function*(){return this.loader||(this.loader=new bp(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(Ho.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(Ho.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 Qi))||[]}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 U;l.setFromMatrixColumn(u.matrix,1),l.normalize(),l.multiplyScalar(i/u.zoom),o.add(l)}if(n){let l=new U;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 kt(this,null,function*(){return e===void 0&&(e=500),Ya(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,m=tn(o,c,u,l).x-u/2,g=new U;g.setFromMatrixColumn(this.context.camera.matrix,0),g.normalize(),g.multiplyScalar(m/this.context.camera.zoom),i.add(g),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 kt(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 kt(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Sy(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 Ty(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=_g(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,fo.dispose(),$o.dispose(),Lc.dispose(),ha.dispose(),ni.dispose(),Hu.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=fI(e),this.context=new Wy(t,this.config),this.debounceResize=(0,eB.debounce)(this.resize,5),this.registryEvent()}};var vne=et(Ke(),1);var pa=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 vI=class extends pa{fetchEquipment(){return kt(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(Ho.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(Ho.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var Ere=et(bg(),1),Ire=et(hu(),1),Wre=et(Ke(),1),Dre=et(pI(),1);var Lne=et(Ke(),1),Gne=et(cr(),1);var wne=et(fE(),1),bne=et(Lg(),1),xne=et(Gg(),1),jne=et(Vg(),1),Ene=et(Bg(),1),Ine=et(Jg(),1),Wne=et(Qg(),1),Dne=et(qg(),1),Cne=et($g(),1),Yne=et(ty(),1),Rne=et(ey(),1),Xne=et(ny(),1),One=et(ry(),1),Nne=et(oy(),1),Zne=et(sy(),1),Fne=et(cr(),1),Une=et(nI(),1);var Za=class extends gr{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 Fe,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 U)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 VTt(r,t){var e=new Fe,n=new ra,i=new io,o=new U,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 U,c=new U,p=new U,m=this instanceof ia?2:1,g=u.index,P=u.attributes;if(g!==null)for(var v=g.array,S=P.position.array,b=P.width.array,_=0,A=v.length-1;_<A;_+=m){var E=v[_],x=v[_+1];l.fromArray(S,E*3),c.fromArray(S,x*3);var C=b[Math.floor(_/3)]!==void 0?b[Math.floor(_/3)]:1,N=r.params.Line.threshold+this.material.lineWidth*C/2,F=N*N,Y=n.distanceSqToSegment(l,c,o,p);if(!(Y>F)){o.applyMatrix4(this.matrixWorld);var D=r.ray.origin.distanceTo(o);D<r.near||D>r.far||(t.push({distance:D,point:p.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this}),_=A)}}}}Za.prototype.raycast=VTt;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 U(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new U(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 _I(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;_I(t,0,e,0,i),_I(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,_I(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};Ne.meshline_vert=["",Ne.logdepthbuf_pars_vertex,Ne.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;","",Ne.logdepthbuf_vertex,Ne.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",Ne.fog_vertex,"}"].join(`
8107
+ `;continue}if((Mt=vt.match(R))&&(Q.gamma=parseFloat(Mt[1])),(Mt=vt.match(L))&&(Q.exposure=parseFloat(Mt[1])),(Mt=vt.match(B))&&(Q.valid|=2,Q.format=Mt[1]),(Mt=vt.match(bt))&&(Q.valid|=4,Q.height=parseInt(Mt[1],10),Q.width=parseInt(Mt[2],10)),Q.valid&2&&Q.valid&4)break}return Q.valid&2||u(3,"missing format specifier"),Q.valid&4||u(3,"missing image size specifier"),Q},v=function(D,at,R){let L=at;if(L<8||L>32767||D[0]!==2||D[1]!==2||D[2]&128)return new Uint8Array(D);L!==(D[2]<<8|D[3])&&u(3,"wrong scanline width");let B=new Uint8Array(4*at*R);B.length||u(4,"unable to allocate buffer space");let bt=0,Q=0,vt=4*L,Mt=new Uint8Array(4),Wt=new Uint8Array(vt),mt=R;for(;mt>0&&Q<D.byteLength;){Q+4>D.byteLength&&u(1),Mt[0]=D[Q++],Mt[1]=D[Q++],Mt[2]=D[Q++],Mt[3]=D[Q++],(Mt[0]!=2||Mt[1]!=2||(Mt[2]<<8|Mt[3])!=L)&&u(3,"bad rgbe scanline format");let Pt=0,tt;for(;Pt<vt&&Q<D.byteLength;){tt=D[Q++];let Ut=tt>128;if(Ut&&(tt-=128),(tt===0||Pt+tt>vt)&&u(3,"bad scanline data"),Ut){let ce=D[Q++];for(let pt=0;pt<tt;pt++)Wt[Pt++]=ce}else Wt.set(D.subarray(Q,Q+tt),Pt),Pt+=tt,Q+=tt}let Gt=L;for(let Ut=0;Ut<Gt;Ut++){let ce=0;B[bt]=Wt[Ut+ce],ce+=L,B[bt+1]=Wt[Ut+ce],ce+=L,B[bt+2]=Wt[Ut+ce],ce+=L,B[bt+3]=Wt[Ut+ce],bt+=4}mt--}return B},S=function(D,at,R,L){let B=D[at+3],bt=Math.pow(2,B-128)/255;R[L+0]=D[at+0]*bt,R[L+1]=D[at+1]*bt,R[L+2]=D[at+2]*bt,R[L+3]=1},b=function(D,at,R,L){let B=D[at+3],bt=Math.pow(2,B-128)/255;R[L+0]=km.toHalfFloat(Math.min(D[at+0]*bt,65504)),R[L+1]=km.toHalfFloat(Math.min(D[at+1]*bt,65504)),R[L+2]=km.toHalfFloat(Math.min(D[at+2]*bt,65504)),R[L+3]=km.toHalfFloat(1)},_=new Uint8Array(t);_.pos=0;let A=P(_),E=A.width,x=A.height,C=v(_.subarray(_.pos),E,x),N,F,Y;switch(this.type){case js:Y=C.length/4;let D=new Float32Array(Y*4);for(let R=0;R<Y;R++)S(C,R*4,D,R*4);N=D,F=js;break;case yl:Y=C.length/4;let at=new Uint16Array(Y*4);for(let R=0;R<Y;R++)b(C,R*4,at,R*4);N=at,F=yl;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:E,height:x,data:N,header:A.string,gamma:A.gamma,exposure:A.exposure,type:F}}setDataType(t){return this.type=t,this}load(t,e,n,i){function o(u,l){switch(u.type){case js:case yl:u.colorSpace=bi,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 G1=class extends GM{constructor(){super(),new L1().load(yV,t=>{t.mapping=Cm,this.environment=t;let e=new Fe;e.makeRotationX(Math.PI/2),this.environmentRotation=new su().setFromRotationMatrix(e)})}};var k1=class extends Ac{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 Wy=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 k1(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new z1(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 N1(this)}getRatio(t,e){t===void 0&&(t=new U(0,0,0)),e===void 0&&(e=new U(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 Df&&(e.color=new Se(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 At;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new Cf;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:p,height:m}}=this,g=this.control.getPolarAngle();i&&this.setPolarAngle(0,0);let P=new $e().setFromObject(t);this.setPolarAngle(g,0);let{max:v,min:S}=P,b=new U(S.x,v.y,v.z),_=new U(v.x,v.y,v.z),A=new U(v.x,S.y,S.z),E=new U(S.x,S.y,S.z),x=tn(b,this.camera,p,m),C=tn(_,this.camera,p,m),N=tn(E,this.camera,p,m),F=tn(A,this.camera,p,m),D=new _l().setFromPoints([new At(x.x,x.y),new At(C.x,C.y),new At(N.x,N.y),new At(F.x,F.y)]).getSize(new At),at=(p-u-c)/D.x,R=(m-o-l)/D.y,L=Math.min(at,R),B=new U((v.x+S.x)/2,(v.y+S.y)/2,(v.z+S.z)/2),bt=L*this.camera.zoom,Q=this.camera.clone();Q.zoom=bt,Q.updateMatrix();let vt=(p-D.x*L)/2,Mt=(m-D.y*L)/2,Wt=(u-c)/2,mt=(o-l)/2;if(Wt){let Pt=new U;Pt.setFromMatrixColumn(Q.matrix,0),Pt.normalize(),Pt.multiplyScalar(Wt/bt),B.add(Pt)}if(mt){let Pt=new U;Pt.setFromMatrixColumn(Q.matrix,1),Pt.normalize(),Pt.multiplyScalar(mt/bt),B.add(Pt)}return{zoom:L*this.camera.zoom,center:B}}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 kt(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 G1,this.renderer=new K1,this.lights=JT(),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 Ey(this),this.hoverHelper=new Iy(this),this.resizeClientSize(),this.registryEvent()}};var GV=et(Ys(),1),kV={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 fI(r){return(0,GV.merge)({},kV,r)}var eB=et(Ys(),1);var Fee=et(Ke(),1);var Qu;function VV(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(Qu)return e({db:Qu,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){Qu=o.target.result,console.log("onupgradeneeded"),e({db:Qu,type:"onupgradeneeded"})},i.onsuccess=o=>{Qu=o.target.result,e({db:Qu,type:"success"})},i.onerror=o=>{n(o)}})}function dI(r,t,e){return e===void 0&&(e=Qu),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 BV(r,t,e,n){return n===void 0&&(n=Qu),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((u,l)=>kt(this,null,function*(){let c=yield dI(r,t),p=n.transaction([r],"readwrite").objectStore(r),m=c!==null?p.put({key:t,value:e}):p.add({key:t,value:e});m.onsuccess=function(g){u(g)},m.onerror=function(g){l(g)}}))))}function wp(r,t){t===void 0&&(t=Qu),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function JV(r){r===void 0&&(r=Qu),r==null||r.close(),Qu=null}var Dee=et(cr(),1),Cee=et(Ke(),1);function V1(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 B1(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 HV(r,t,e){switch(r.l_type){case"graph":return WTt(r,t);case"wall":return DTt(r,t);case"lane":return CTt(r,t);case"texture2d":case"texture3d":return YTt(r,t);case"glb":return RTt(r,t);case"store":return XTt(r,t);case"facility":return NTt(r,t);case"parkingSpace":return FTt(r,t,e);case"text":return zTt(r,t)}}function QV(r,t,e,n){switch(r.l_type){case"store":return OTt(r,t,e,n);case"facility":return ZTt(r,t,e,n);case"parkingSpace":return UTt(r,t,n)}}function WTt(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:u,strokeColor:l,strokeOpacity:c,height:p,airHeight:m}=i,g=o.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c+"-"+p+"-"+m;return c===0&&(g=o.toLowerCase()+"-"+u+"-"+p+"-"+m),n[g]?n[g].push(i):n[g]=[i],n},{});Object.values(e).forEach(n=>{let i=new Sp(t.context,n);t.mergeGraphicLayer.add(i)})}function DTt(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:u,strokeColor:l,strokeOpacity:c,height:p}=i,m=o.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c+"-"+p;return c===0&&(m=o.toLowerCase()+"-"+u+"-"+p),n[m]?n[m].push(i):n[m]=[i],n},{});Object.values(e).forEach(n=>{let i=new wy(t.context,n);t.wallLayer.add(i)})}function CTt(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:u,strokeColor:l,strokeOpacity:c}=i,p=o.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c;return c===0&&(p=o.toLowerCase()+"-"+u),n[p]?n[p].push(i):n[p]=[i],n},{});Object.values(e).forEach(n=>{let i=new xy(t.context,n);t.laneLayer.add(i)})}function YTt(r,t){if(r.elements.length){let e=new Ap(t.context,r.elements);t.textureLayer.add(e)}}function RTt(r,t){r.elements.forEach(e=>{let n=new by(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 XTt(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 OTt(r,t,e,n){r.elements.map(i=>{try{let o=V1(i,e),u=new qi(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 NTt(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 ZTt(r,t,e,n){r.elements.filter(o=>o.poi_info).map(o=>{try{let u=B1(o,e),l=new qi(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 FTt(r,t,e){t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function UTt(r,t,e){return kt(this,null,function*(){let n=r.elements.filter(u=>u.texts[0]),i=n.map(u=>u.texts[0]),o=yield fo.lazyGetTextureByTexts(i,{height:64});n.forEach(u=>{try{let l=u.texts[0],c=new qi(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 zTt(r,t){let e=new jy(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 qV="map_version",$V="route_version",tB="facility_version",mI="map_data",J1="road_network_data",gI="facility_data",KTt={mergeParkingSpace:!0},bp=class extends qo{initDb(){return kt(this,null,function*(){try{let{db:t,type:e}=yield VV("aibee_map",2);e==="onupgradeneeded"&&(wp(qV),wp($V),wp(tB),wp(mI),wp(J1),wp(gI)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return kt(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(()=>BV(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>dI(t,""+e,this.db))}getFloorCacheKey(t){return t.floor_id+"_"+t.version_id}getFloorData(t){return kt(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return kt(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=V1(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=B1(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return kt(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>kt(this,null,function*(){let i=this.getFloorCacheKey(t),o=yield fetch(t.map_url).then(u=>u.json());o.floor=t.floor,this.setCacheData(mI,i,o),this.setCacheData(qV,i,t.version_id),n(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return kt(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(mI,n);return i||this.getFloorJsonDataByFloorInfo(e)}catch(i){return console.log("[get floor data error]",i),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return kt(this,null,function*(){return(yield Promise.all(this.floors.map(e=>kt(this,null,function*(){let n=this.getFloorCacheKey(e);try{let i=yield this.getCacheData(J1,n);if(i)return i;let o=yield fetch(e.route_url).then(u=>u.json());return this.setCacheData(J1,n,o),this.setCacheData($V,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(u=>u.json());return this.setCacheData(J1,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return kt(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=()=>kt(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(gI,e,i),this.setCacheData(tB,e,t.version_id)),i});try{let i=yield this.getCacheData(gI,e);return i||n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return kt(this,null,function*(){for(let t=0;t<this.floors.length;t++){let e=this.floors[t];this.getFloorJsonData(e.floor)}})}getMulFloorsData(t){return kt(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return kt(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return kt(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)||hp(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 U),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t,e){return kt(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:p}=l;c.tid===o&&(this.taskQueue.removeEventListener("active-task-end",u),n(p))};this.taskQueue.addEventListener("active-task-end",u)})})}_switchFloor(t,e){return kt(this,null,function*(){var n;let i=t;if(typeof t=="string"){let m=yield this.getFloorJsonData(t);if(m)i=m;else return null}let o=ue({},this.placeConfig,e),u=new Oa(this.bmap.context);u.userData.data=t;let l=this.floors.find(m=>m.floor===i.floor);var c;let p=(c=l==null?void 0:l.map_angle)!=null?c:0;return this.bmap.dispatchEvent({type:Ho.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 Se(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(m=>m.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(u),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(p/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),i.layers.forEach(m=>{["range","ground"].includes(m.l_type)||hp(m.elements,u.userData.center)}),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:u,graphics:[]}}),this.bmap.dispatchEvent({type:Ho.SWITCH_FLOOR_GROUND,data:{curFloor:u}}),yield wg(),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 sx(2),yield this.getFloorPoi(i,u,o),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:u,graphics:u.graphicLayer.children}}),this.bmap.dispatchEvent({type:Ho.SWITCH_FLOOR_AFTER,data:{curFloor:u,graphics:u.graphicLayer.children}}),u})}getFloorBaseLayer(t,e){e||(e=new Oa(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":hp(i.elements,n);let u=i.elements.map(l=>new Qi(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 kt(this,null,function*(){e||(e=new Oa(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)||(HV(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield wg(),n=Date.now()))}return e})}getFloorPoi(t,e,n){return kt(this,null,function*(){n===void 0&&(n=this.placeConfig);let i=Date.now();yield Promise.all(t.layers.map(u=>QV(u,e,this.locale,n))),console.log("poi time",Date.now()-i);let o=Date.now();wg().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return kt(this,null,function*(){var t;JV((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 fp,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=ue({},KTt,e),this.placeConfig=ue({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var qee=et(Ke(),1);function yI(r,t){return kt(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(p=>p.json()).then(p=>p.data).then(p=>{let m=(p||[])[0];return m&&(m.info=JSON.parse(m.info)),m})})}function MI(r,t){return kt(this,null,function*(){let{brand:e,project:n,floor:i,ts:o,resource_type_list:u}=r,{apiDomain:l,apiPath:{floorGraphic:c},apiInfo:p}=t,m=""+l+c+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+i+"&ts="+o+"&resource_type_list="+u;return yield fetch(m,p).then(P=>P.json()).then(P=>P.data).then(P=>((P||[]).map(v=>v.info=JSON.parse(v.info)),P||[]))})}function LTt(r,t){return kt(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?GTt(c.fileId,t):null)})}function GTt(r,t){return kt(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 PI=class{load(t){return kt(this,null,function*(){let e=up(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),MI(t,this.bmap.config)]),i=up({floor:t.floor,ts:t.ts});hp(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 kt(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 p=t[c];p.info.group==="ground"?(p.info.fillColor=o.color,p.info.fillOpacity=o.opacity,p.info.height=o.height,p.info.stroke=o.stroke,p.info.strokeColor=o.strokeColor,p.info.strokeOpacity=o.strokeOpacity):p.info.userData.mark?(p.info.height=u.height,p.info.fillColor=u.color,p.info.fillOpacity=u.opacity,p.info.stroke=u.stroke,p.info.strokeColor=u.strokeColor,p.info.strokeOpacity=u.strokeOpacity):(p.info.fillOpacity=l.fillOpacity,this.bmap.config.initTransToMark&&(p.info.height=u.height,p.info.fillColor=u.color,p.info.stroke=u.stroke,p.info.strokeColor=u.strokeColor,p.info.strokeOpacity=u.strokeOpacity))}for(let c of t){if(c.info.group==="ground")e.createGround(c.info);else{let p=e.addGraphic(c.info);p.userData.data=c,n.set(c.legacy_id,p)}i.set(c.element_uuid,c)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=i,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(Ho.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(Ho.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 kt(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 kt(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 kt(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 kt(this,null,function*(){let{brand:e,project:n}=t,i=up({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=yI({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 kt(this,null,function*(){let e=new Oa(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 kTt=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),H1=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?_g(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 kt(this,null,function*(){return this.loader||(this.loader=new bp(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(Ho.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(Ho.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 Qi))||[]}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 U;l.setFromMatrixColumn(u.matrix,1),l.normalize(),l.multiplyScalar(i/u.zoom),o.add(l)}if(n){let l=new U;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 kt(this,null,function*(){return e===void 0&&(e=500),Ya(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,m=tn(o,c,u,l).x-u/2,g=new U;g.setFromMatrixColumn(this.context.camera.matrix,0),g.normalize(),g.multiplyScalar(m/this.context.camera.zoom),i.add(g),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 kt(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 kt(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Sy(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 Ty(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=_g(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,fo.dispose(),$o.dispose(),Lc.dispose(),ha.dispose(),ni.dispose(),Hu.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=fI(e),this.context=new Wy(t,this.config),this.debounceResize=(0,eB.debounce)(this.resize,5),this.registryEvent()}};var vne=et(Ke(),1);var pa=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 vI=class extends pa{fetchEquipment(){return kt(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(Ho.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(Ho.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var Ere=et(bg(),1),Ire=et(hu(),1),Wre=et(Ke(),1),Dre=et(pI(),1);var Lne=et(Ke(),1),Gne=et(cr(),1);var wne=et(fE(),1),bne=et(Lg(),1),xne=et(Gg(),1),jne=et(Vg(),1),Ene=et(Bg(),1),Ine=et(Jg(),1),Wne=et(Qg(),1),Dne=et(qg(),1),Cne=et($g(),1),Yne=et(ty(),1),Rne=et(ey(),1),Xne=et(ny(),1),One=et(ry(),1),Nne=et(oy(),1),Zne=et(sy(),1),Fne=et(cr(),1),Une=et(nI(),1);var Za=class extends gr{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 Fe,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 U)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 VTt(r,t){var e=new Fe,n=new ra,i=new io,o=new U,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 U,c=new U,p=new U,m=this instanceof ia?2:1,g=u.index,P=u.attributes;if(g!==null)for(var v=g.array,S=P.position.array,b=P.width.array,_=0,A=v.length-1;_<A;_+=m){var E=v[_],x=v[_+1];l.fromArray(S,E*3),c.fromArray(S,x*3);var C=b[Math.floor(_/3)]!==void 0?b[Math.floor(_/3)]:1,N=r.params.Line.threshold+this.material.lineWidth*C/2,F=N*N,Y=n.distanceSqToSegment(l,c,o,p);if(!(Y>F)){o.applyMatrix4(this.matrixWorld);var D=r.ray.origin.distanceTo(o);D<r.near||D>r.far||(t.push({distance:D,point:p.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this}),_=A)}}}}Za.prototype.raycast=VTt;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 U(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new U(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 _I(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;_I(t,0,e,0,i),_I(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,_I(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};Ne.meshline_vert=["",Ne.logdepthbuf_pars_vertex,Ne.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;","",Ne.logdepthbuf_vertex,Ne.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",Ne.fog_vertex,"}"].join(`
8108
8108
  `);Ne.meshline_frag=["",Ne.fog_pars_fragment,Ne.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() {","",Ne.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);","",Ne.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
8109
8109
  `);var Dy=class extends gi{constructor(t){super({uniforms:Object.assign({},pe.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new Se(16777215)},opacity:{value:1},resolution:{value:new At(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 At(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:Ne.meshline_vert,fragmentShader:Ne.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)}};Dy.prototype.copy=function(r){return gi.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 nB={texture_url:j1,lineWidth:10,color:16777215},Q1=class extends Ye{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,p]=l;return tn(new U(c,p,0),e,n,i)}).map(l=>{let{x:c,y:p}=l;return[c,p]});return Cs(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new At(t,1)}loadTexture(t){return new Promise((e,n)=>{new vl().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 kt(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 Dy({useMap:!0,color:new Se(this.config.color),transparent:!0,resolution:new At(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:ml,repeat:new At(this.getRepeat(),1)}),i=this.mesh=new fn(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=nB,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({},nB,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var $ne=et(D1(),1),tre=et(Ke(),1),ere=et(cr(),1);var rB=et(Ys(),1);var BTt={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},q1=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,p=this.paths[this.routeIndex].floor,m=this.getCurRouteRemainDistance();if(i){let _=Xl(n,i);c=c.slice(_+1),c.unshift(i)}let g=[{floor:o==null?void 0:o.floor,points:c},...u.slice(l+1)],{distance:P,closestPoint:v,index:S,i:b}=g.reduce((_,A,E)=>{if(A.floor!==t)return _;let{distance:x,closestPoint:C,index:N}=A.points.reduce((F,Y,D,at)=>{if(!at[D+1])return ue({},F,{distance:F.distance===1/0?Rr(Y,e):F.distance});let{distance:R,closestPoint:L}=_x(e,Y,at[D+1]);if(p===t){let B=[e,...at.slice(D+1)],bt=Cs(B);if(m-bt>10)return F}return R<F.distance?{distance:R,closestPoint:L,index:D}:F},{distance:1/0,closestPoint:A.points[0],index:0});return x<_.distance?{distance:x,closestPoint:C,index:E,i:N}:_},{distance:1/0,closestPoint:c[0],index:0,i:0});return{distance:P,closestPoint:v,routeIndex:S+l,pointIndex:S===0?b+this.pointIndex:b}}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 kt(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,rB.throttle)(p=>{let m=lp(i,p.distance);m&&(e.push({floor:t.floor,pos:m}),this.toPosition(t.floor,m))},100),c=this.simulationTween=new Ra({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 Cs(i)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[...t.slice(0,e+1),n];return Cs(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=Zl.FRONT,c=(o==null||(t=o.pointInfos[u])==null?void 0:t.crossName)||"",p=0,m=0,g=0;for(;l===Zl.FRONT&&u<=n.length;){let S=n[u],b=n[u+1],_=n[u+2];if(!S||!b)l=Zl.END;else if(p+=Rr(S,b),!_)l=Zl.END;else{l=Rv(S,b,_),m=Ag(S,b,_),g=(new At(_[0]-b[0],_[1]-b[1]).angle()*180/Math.PI-90+360)%360;var P;c=(P=o==null?void 0:o.pointInfos[u+1].crossName)!=null?P:"",u+=1}}if(n[u]&&(p=Rr(i,n[u])),l===Zl.END&&p<=this.options.directionEmitThreshold)return{dir:l,distance:p,crossName:c,angle:m,nextAngle:g};let v=this.getCurRouteToStartDistance();return e===0&&v<=5?{dir:Zl.START,distance:p,crossName:c,angle:m,nextAngle:g}:(p>=this.options.directionEmitThreshold&&(l=Zl.FRONT),{dir:l,distance:p,crossName:c,angle:m,nextAngle:g})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(n=>{let i=Yr(n.cds),o=wr(this.position);return Hi(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=Zl.END);let{imageUrl:p}=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:p}}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 R0,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({},BTt,e),this.roadData=n,this.registryEvent()}};var ure=et(o1(),1),lre=et(Lg(),1),cre=et(Gg(),1),hre=et(Vg(),1),pre=et(Bg(),1),fre=et(Jg(),1),dre=et(Qg(),1),mre=et(qg(),1),gre=et($g(),1),yre=et(ty(),1),Mre=et(ey(),1),Pre=et(ny(),1),vre=et(ry(),1),_re=et(oy(),1),Are=et(sy(),1),Sre=et(Xj(),1),Tre=et(Ke(),1);var z0=class r extends qi{addDebug(){r.canvas.style.cssText=`
8110
8110
  position: fixed;