@aibee/crc-bmap 0.14.7 → 0.14.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +11 -11
- package/lib/index.esm.min.js +11 -11
- package/lib/meta.json +21 -6
- package/lib/src/loader/AibeeLoader/index.d.ts +1 -1
- package/lib/src/plugins/nav-path/nav-path.d.ts +9 -4
- package/lib/src/utils/road2.d.ts +3 -2
- package/lib/worker/{path.worker-C7N3AIZ3.js → path.worker-Q34IHRMK.js} +175 -175
- package/lib/worker/{recommend.worker-SNFR5ZXU.js → recommend.worker-2H6IQKNB.js} +174 -174
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Ia=Object.create;var Si=Object.defineProperty;var Ra=Object.getOwnPropertyDescriptor;var Ga=Object.getOwnPropertyNames,Gn=Object.getOwnPropertySymbols,Fa=Object.getPrototypeOf,Fn=Object.prototype.hasOwnProperty,za=Object.prototype.propertyIsEnumerable;var yo=(a,t,e)=>t in a?Si(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,Ei=(a,t)=>{for(var e in t||(t={}))Fn.call(t,e)&&yo(a,e,t[e]);if(Gn)for(var e of Gn(t))za.call(t,e)&&yo(a,e,t[e]);return a};var Be=(a,t)=>()=>(t||a((t={exports:{}}).exports,t),t.exports),Ba=(a,t)=>{for(var e in t)Si(a,e,{get:t[e],enumerable:!0})},zn=(a,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ga(t))!Fn.call(a,s)&&s!==e&&Si(a,s,{get:()=>t[s],enumerable:!(i=Ra(t,s))||i.enumerable});return a};var vo=(a,t,e)=>(e=a!=null?Ia(Fa(a)):{},zn(t||!a||!a.__esModule?Si(e,"default",{value:a,enumerable:!0}):e,a)),Wa=a=>zn(Si({},"__esModule",{value:!0}),a);var rt=(a,t,e)=>yo(a,typeof t!="symbol"?t+"":t,e);var f=(a,t,e)=>new Promise((i,s)=>{var o=h=>{try{r(e.next(h))}catch(c){s(c)}},n=h=>{try{r(e.throw(h))}catch(c){s(c)}},r=h=>h.done?i(h.value):Promise.resolve(h.value).then(o,n);r((e=e.apply(a,t)).next())});var Wn=Be((ol,Bn)=>{Bn.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}});var Nn=Be((nl,Hn)=>{var Un=Wn();Hn.exports=function(a,t){Array.isArray(t)||(t=[]),a.length>0&&t.push(Un([0,0],a[0]));for(var e=0;e<a.length-1;e++){var i=a[e],s=a[e+1],o=i[0],n=i[1],r=s[0],h=s[1],c=[.75*o+.25*r,.75*n+.25*h],l=[.25*o+.75*r,.25*n+.75*h];t.push(c),t.push(l)}return a.length>1&&t.push(Un([0,0],a[a.length-1])),t}});var Xn=Be((ll,Kn)=>{var Ao=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let i=Number(e);if(isNaN(i))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(s=>(s.key===t&&Object.assign(s,{priority:i}),s)):(this.keys.add(t),this.queue.push({key:t,priority:i})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};Kn.exports=Ao});var $n=Be((pl,qn)=>{function Yn(a,t){let e=new Map;for(let[i,s]of a)i!==t&&s instanceof Map?e.set(i,Yn(s,t)):i!==t&&e.set(i,s);return e}qn.exports=Yn});var tr=Be((dl,Qn)=>{function Ja(a){let t=Number(a);return!(isNaN(t)||t<=0)}function Jn(a){let t=new Map;return Object.keys(a).forEach(i=>{let s=a[i];if(s!==null&&typeof s=="object"&&!Array.isArray(s))return t.set(i,Jn(s));if(!Ja(s))throw new Error(`Could not add node at key "${i}", make sure it's a valid node`,s);return t.set(i,Number(s))}),t}Qn.exports=Jn});var sr=Be((ul,ir)=>{function er(a){if(!(a instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof a}`);a.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){er(t);return}if(typeof t!="number"||t<=0)throw new Error(`Values must be numbers greater than 0. Found value ${t} at ${e}`)})}ir.exports=er});var Io=Be((ml,rr)=>{var Qa=Xn(),th=$n(),or=tr(),nr=sr(),Oo=class{constructor(t){t instanceof Map?(nr(t),this.graph=t):t?this.graph=or(t):this.graph=new Map}addNode(t,e){let i;return e instanceof Map?(nr(e),i=e):i=or(e),this.graph.set(t,i),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=th(this.graph,t),this}path(t,e,i={}){if(!this.graph.size)return i.cost?{path:null,cost:0}:null;let s=new Set,o=new Qa,n=new Map,r=[],h=0,c=[];if(i.avoid&&(c=[].concat(i.avoid)),c.includes(t))throw new Error(`Starting node (${t}) cannot be avoided`);if(c.includes(e))throw new Error(`Ending node (${e}) cannot be avoided`);for(o.set(t,0);!o.isEmpty();){let l=o.next();if(l.key===e){h=l.priority;let d=l.key;for(;n.has(d);)r.push(d),d=n.get(d);break}s.add(l.key),(this.graph.get(l.key)||new Map).forEach((d,u)=>{if(s.has(u)||c.includes(u))return null;if(!o.has(u))return n.set(u,l.key),o.set(u,l.priority+d);let m=o.get(u).priority,v=l.priority+d;return v<m?(n.set(u,l.key),o.set(u,v)):null})}return r.length?(i.trim?r.shift():r=r.concat([t]),i.reverse||(r=r.reverse()),i.cost?{path:r,cost:h}:r):i.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};rr.exports=Oo});var lc={};Ba(lc,{AibeeLoader:()=>qe,BMap:()=>hn,BMapSelect:()=>gn,BaseSvg:()=>Wt,CarInertialPosition:()=>Ms,ClickHelper:()=>Oi,Context:()=>ps,ContextCamera:()=>ls,ContextScene:()=>cs,Control:()=>as,CrLoader:()=>an,CrNavPath:()=>fn,Equipment:()=>cn,EventDispatcher:()=>st,Events:()=>Co,Floor:()=>se,GlbModel:()=>Xo,Graphic:()=>lt,GraphicLayer:()=>Wi,GroundTexture:()=>Ae,Heatmap:()=>Cn,HeatmapElement:()=>Yi,HighlightPoi:()=>Sn,HooksName:()=>yt,HoverHelper:()=>ns,InstancedGraphic:()=>Xe,InstancedModel:()=>ji,InstancedParkingSpace:()=>ii,InstancedWall:()=>ss,KalmanFilter:()=>Ri,Lane:()=>Qi,Layer:()=>q,LineElement:()=>ai,MapTypePolar:()=>Zh,MergeAttributeGraphic:()=>ri,MergeAttributeGroundTexture:()=>Oe,MergeAttributeLane:()=>is,MergeAttributeWall:()=>es,MergeGraphic:()=>Yo,MergedAttributeGraphicLine:()=>Ie,MergedGraphicLayer:()=>Ki,MergedModelLayer:()=>Zi,Model:()=>Bi,MulFloorNavigation:()=>yn,MulFloorSelect:()=>vn,MulFloors:()=>dn,NavPath:()=>fs,Navigation:()=>pn,Overlay:()=>Ke,ParkingLayer:()=>Ni,ParkingType:()=>jh,PathDirection:()=>de,PdrPosition:()=>vs,Poi:()=>De,Poi2:()=>tt,PoiLayer:()=>Ui,PoiLayer2:()=>Hi,Position:()=>Pn,RENDER_VERSION:()=>di,RecommendParkingSpace:()=>wn,Renderer:()=>hs,RoadNetwork:()=>Ro,RoadNetwork2:()=>Go,SENSOR_TYPE:()=>F,SatelliteTile:()=>Ln,SelectBox:()=>Ko,Selection:()=>os,Sensor:()=>gs,Shadow:()=>zi,Socket:()=>xi,SortByDistance:()=>En,SvgLine:()=>qi,SvgPolygon:()=>$i,TaskQueue:()=>Ve,TextTexture:()=>ts,TileLayer:()=>Re,TileLoader:()=>Xi,Timer:()=>j,TweenUtil:()=>Pe,UA:()=>Eo,UseMyPosition:()=>bn,Wall:()=>Ji,WorkerPool:()=>Ii,addAlphaToHexColor:()=>Va,calc_angle:()=>We,calc_direction:()=>Es,calculateInstantaneousSpeed:()=>ic,calculateLineDirection:()=>xs,convertToSnakeCase:()=>Fo,createCircle:()=>Qe,createLine:()=>ki,createRect:()=>_e,createSvg:()=>Po,createSvgElement:()=>Ti,createThreeBox:()=>sh,createThreeLine:()=>ih,darkenColor:()=>le,defaultConfig:()=>na,defaultGraphicOptions:()=>ge,defaultOptions:()=>Ns,defaultTextTextureOptions:()=>Zr,deviceToVector3:()=>Ua,dispose:()=>I,distancePointToSegment:()=>ko,generatorKeyByObj:()=>Te,getAngle:()=>jn,getBorderPoints:()=>ks,getCenter:()=>Ci,getConfig:()=>tn,getDirectPath:()=>$a,getDirectionByAngle:()=>Ls,getDistanceByPathPos:()=>Do,getLength:()=>O,getLongestSideDir:()=>Ha,getMinEdgeSquare:()=>Na,getPathLength:()=>Et,getPointEdgeIndex:()=>ce,getPosByPathDistance:()=>Ze,hasChinese:()=>Mo,hexToRgb:()=>Ss,initDirectionalLight:()=>wo,initLight:()=>xo,initShape:()=>Li,instancedGeometiesAttributes:()=>nh,isAndroid:()=>Ka,isContain:()=>Me,isControl:()=>Ne,isIphone:()=>pe,isMac:()=>He,isPointInPolygon:()=>_o,isRectangle:()=>rh,loadBuildingGround:()=>nn,loadExternalStreet:()=>Hh,loadGraphics:()=>rn,mergeGraphicGeometries:()=>oh,mergeGraphicLineGeometries:()=>mr,moveOnRoute:()=>qa,predictFuturePosition:()=>vi,predictFutureSpeed:()=>sc,proxyOptions:()=>Ue,removeOutliers:()=>oc,removeWeightPath:()=>Vn,setCirclePosition:()=>Ce,setLineStartEnd:()=>Vt,setRectPosition:()=>bt,simplifyPath:()=>Di,sleepByRf:()=>So,sleepOnePromise:()=>bo,sleepOneRf:()=>bs,smoothPath:()=>To,splitStrByBracket:()=>zo,strToNumber:()=>ja,timeoutPromise:()=>Ft,toWebWorker:()=>eh,transformGraphicData:()=>Ai,transformSpeed:()=>uo,translatePosToCenter:()=>je,triggerWorker:()=>Z,vector3ToDevice:()=>D,xhrGet:()=>Xa});module.exports=Wa(lc);function w(){return w=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},w.apply(this,arguments)}var C0=require("core-js/modules/es.array.push.js"),T0=require("core-js/modules/web.dom-collections.iterator.js"),k0=require("core-js/modules/es.json.stringify.js"),Nt=require("three");var Fx=require("core-js/modules/web.dom-collections.iterator.js");var uc=require("core-js/modules/es.set.difference.v2.js"),mc=require("core-js/modules/es.set.intersection.v2.js"),fc=require("core-js/modules/es.set.is-disjoint-from.v2.js"),gc=require("core-js/modules/es.set.is-subset-of.v2.js"),yc=require("core-js/modules/es.set.is-superset-of.v2.js"),vc=require("core-js/modules/es.set.symmetric-difference.v2.js"),xc=require("core-js/modules/es.set.union.v2.js"),wc=require("core-js/modules/web.dom-collections.iterator.js"),j=class{requestAnimationFrame(t){let e=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(e),t()});return this.tasks.requestAnimation.add(e),e}cancelAnimationFrame(t){this.tasks.requestAnimation.delete(t),window.cancelAnimationFrame(t)}setTimeout(t,e){let i=window.setTimeout(()=>{this.tasks.timeout.delete(i),t()},e);return this.tasks.timeout.add(i),i}clearTimeout(t){this.tasks.timeout.delete(t),window.clearTimeout(t)}setInterval(t,e){let i=window.setInterval(()=>{t()},e);return this.tasks.interval.add(i),i}clearInterval(t){this.tasks.interval.delete(t),window.clearInterval(t)}requestIdleCallback(t,e){let i=window.requestIdleCallback(s=>{this.tasks.requestIdleCallback.delete(i),t(s)},e);return this.tasks.requestIdleCallback.add(i),i}cancelIdleCallback(t){this.tasks.requestIdleCallback.delete(t),window.cancelIdleCallback(t)}dispose(){this.tasks.requestAnimation.forEach(t=>{window.cancelAnimationFrame(t)}),this.tasks.requestAnimation.clear(),this.tasks.requestIdleCallback.forEach(t=>{window.cancelIdleCallback(t)}),this.tasks.requestIdleCallback.clear(),this.tasks.timeout.forEach(t=>{window.clearTimeout(t)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(t=>{window.clearInterval(t)}),this.tasks.interval.clear()}constructor(){this.tasks={requestAnimation:new Set,requestIdleCallback:new Set,timeout:new Set,interval:new Set}}};var _c=require("core-js/modules/web.dom-collections.iterator.js"),Pc=require("core-js/modules/es.array.push.js"),Gt=require("three");function xo(){let a=new Gt.Group,t=new Gt.AmbientLight(16777215,.3);return a.add(t),a}function Li(a,t){t===void 0&&(t=[]);let e=new Gt.Shape(a.map(i=>new Gt.Vector2(...i)));return t.length&&t.forEach(i=>{var s=new Gt.Path(i.map(o=>new Gt.Vector2(...o)));e.holes.push(s)}),e}function wo(a,t){a===void 0&&(a=16777215),t===void 0&&(t=1);let e=new Gt.DirectionalLight(a,t);return e.castShadow=!0,e.shadow.radius=8,e.shadow.bias=-.001,e.shadow.mapSize.set(256,256),e.shadow.camera.left=-200,e.shadow.camera.right=200,e.shadow.camera.top=200,e.shadow.camera.bottom=-200,e}function I(a,t){if(t&&a.children&&a.children.length&&a.children.forEach(e=>{I(e,t)}),a.isMesh){let e=a;e.geometry&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(i=>{i.dispose()}):e.material.dispose())}a.isLight&&(a.dispose==null||a.dispose.call(a))}var Ec=require("core-js/modules/es.regexp.exec.js");function Mo(a){return/[\u4E00-\u9FA5]+/g.test(a)}var Cc=require("core-js/modules/web.dom-collections.iterator.js"),at=require("three"),Je=require("@turf/turf");function D(a,t,e,i){let s=a.clone().project(t),o=e/2,n=i/2,r=Math.round(s.x*o+o),h=Math.round(-s.y*n+n);return{x:r,y:h}}function Ua(a,t,e,i,s){if(!s)return null;e=Math.min(1,e),i=Math.min(1,i);let o=a/e*2-1,n=1-t/i*2;return new at.Vector3(o,n,0).unproject(s)}function Ci(a){let t=(0,Je.featureCollection)(a.map(i=>(0,Je.point)(i)));return(0,Je.center)(t).geometry.coordinates}function Me(a,t,e){return a.x>=t.x&&a.x<=e.x&&a.y>=t.y&&a.y<=e.y}function Ha(a){let t=0,e=new at.Vector3;for(let i=1;i<a.length;i++){let s=new at.Vector3(a[i-1][0],a[i-1][1],0),o=new at.Vector3(a[i][0],a[i][1],0),n=o.distanceTo(s);n>t&&(t=n,e=o.clone().sub(s).normalize())}return e}function O(a,t){return Math.sqrt((t[0]-a[0])**2+(t[1]-a[1])**2)}function Et(a){let t=0;for(let e=0;e<a.length-1;e++)t+=O(a[e],a[e+1]);return t}function We(a,t,e){let i=new at.Vector2(t[0]-a[0],t[1]-a[1]),s=new at.Vector2(t[0]-e[0],t[1]-e[1]),n=i.angleTo(s)*180/Math.PI,r=new at.Vector2(t[0]-a[0],t[1]-a[1]);return new at.Vector2(e[0]-a[0],e[1]-a[1]).cross(r)>0?n:-n}function Na(a,t){let e=Math.min(O(a[0][0],a[0][1]),O(a[0][2],a[0][1]))-1;t||(t=Ci(a[0]));let i=Za(t,e),s=new at.Vector2(a[0][0][0],a[0][0][1]),o=new at.Vector2(a[0][1][0],a[0][1][1]),n=new at.Vector2(a[0][2][0],a[0][2][1]),h=(s.distanceTo(o)>o.distanceTo(n)?o.clone().sub(s):n.clone().sub(o)).angleTo(new at.Vector2(0,1)),c=new at.Matrix3;return c.multiply(new at.Matrix3().translate(t[0],t[1])).multiply(new at.Matrix3().rotate(h)).multiply(new at.Matrix3().translate(-t[0],-t[1])),[i.map(l=>{let p=new at.Vector2(l[0],l[1]).applyMatrix3(c);return[p.x,p.y]})]}function Za(a,t){let e=t/2;return[[a[0]-e,a[1]+e],[a[0]+e,a[1]+e],[a[0]+e,a[1]-e],[a[0]-e,a[1]-e],[a[0]-e,a[1]+e]]}function ce(a,t){let e=0,i=1/0,[s,o]=t;for(let n=0;n<a.length-1;n++){let[r,h]=a[n],[c,l]=a[n+1],p=Math.min(r,c)<=s&&s<=Math.max(r,c),d=Math.min(h,l)<=o&&o<=Math.max(h,l);if(p&&d){let u=Math.abs((c-r)*(o-h)-(l-h)*(s-r));u<i&&(i=u,e=n)}}return e}function _o(a,t){let e=a[0],i=a[1],s=!1;for(let o=0,n=t.length-1;o<t.length;n=o++){let r=t[o][0],h=t[o][1],c=t[n][0],l=t[n][1];h>i!=l>i&&e<(c-r)*(i-h)/(l-h)+r&&(s=!s)}return s}var kc=require("core-js/modules/es.reflect.to-string-tag.js");function Ue(a,t){return new Proxy(a,{get:(e,i,s)=>Reflect.get(e,i,s),set:(e,i,s,o)=>{let n=Reflect.get(e,i,o),r=Reflect.set(e,i,s,o);return n!==s&&t.dispatchEvent({type:"change-"+i,value:s}),r}})}var Ac=require("core-js/modules/web.dom-collections.iterator.js"),Oc=require("core-js/modules/es.error.cause.js");function Ft(a,t){return Promise.race([a,new Promise((e,i)=>{setTimeout(()=>i(new Error("Promise timeout")),t)})])}function Ti(a){return document.createElementNS("http://www.w3.org/2000/svg",a)}function Po(a,t){let e=Ti("svg");return e.setAttribute("width",a),e.setAttribute("height",t),e.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",e}function Qe(a,t){a===void 0&&(a="2");let e=Ti("circle");return e.setAttribute("r",a),e.setAttribute("fill",t),e}function ki(a){let t=Ti("line");return t.setAttribute("stroke",a),t}function _e(a,t){let e=Ti("rect");return e.setAttribute("stroke",a),e.setAttribute("fill",t),e}function Ce(a,t,e){a.setAttribute("cx",""+t),a.setAttribute("cy",""+e)}function Vt(a,t,e){t&&(a.setAttribute("x1",""+t.x),a.setAttribute("y1",""+t.y)),e&&(a.setAttribute("x2",""+e.x),a.setAttribute("y2",""+e.y))}function bt(a,t,e,i,s){a.setAttribute("x",""+t),a.setAttribute("y",""+e),a.setAttribute("width",""+i),a.setAttribute("height",""+s)}function bo(){return Promise.resolve()}function bs(){return new Promise(a=>{requestAnimationFrame(a)})}function So(a){return a===void 0&&(a=1),new Promise(t=>{function e(){a<=0?t(!0):(a--,window.requestAnimationFrame(e))}window.requestAnimationFrame(e)})}var Fc=require("core-js/modules/es.string.replace.js"),zc=require("core-js/modules/es.regexp.exec.js"),Bc=require("core-js/modules/es.string.trim.js");function ja(a){return parseInt(a.replace("#","0x"),16)}function Va(a,t){let e=parseInt(a.substring(1,3),16),i=parseInt(a.substring(3,5),16),s=parseInt(a.substring(5,7),16),o=Math.round(e*t),n=Math.round(i*t),r=Math.round(s*t);return"#"+(1<<24|o<<16|n<<8|r).toString(16).slice(1)}function le(a,t){t===void 0&&(t=.85);let e,i,s;if(a.startsWith("#"))e=parseInt(a.substring(1,3),16),i=parseInt(a.substring(3,5),16),s=parseInt(a.substring(5,7),16);else{let n=a.slice(4,-1).split(",");e=parseInt(n[0].trim()),i=parseInt(n[1].trim()),s=parseInt(n[2].trim())}return e=Math.min(Math.floor(e*t),255),i=Math.min(Math.floor(i*t),255),s=Math.min(Math.floor(s*t),255),"#"+((1<<24)+(e<<16)+(i<<8)+s).toString(16).slice(1)}function Ss(a,t){a=a.replace(/^#/,"");let e=parseInt(a.substring(0,2),16),i=parseInt(a.substring(2,4),16),s=parseInt(a.substring(4,6),16);return t!==void 0?"rgba("+e+", "+i+", "+s+", "+t+")":"rgb("+e+", "+i+", "+s+")"}var Uc=require("core-js/modules/es.regexp.exec.js"),He=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,Eo=(navigator.userAgent||"").toLocaleLowerCase(),pe=/ios|iphone/i.test(Eo),Ka=/android|adr|linux/gi.test(Eo);function Ne(a){return He?a==="Meta":a==="Control"}var jc=require("core-js/modules/es.set.difference.v2.js"),Vc=require("core-js/modules/es.set.intersection.v2.js"),Kc=require("core-js/modules/es.set.is-disjoint-from.v2.js"),Xc=require("core-js/modules/es.set.is-subset-of.v2.js"),Yc=require("core-js/modules/es.set.is-superset-of.v2.js"),qc=require("core-js/modules/es.set.symmetric-difference.v2.js"),$c=require("core-js/modules/es.set.union.v2.js"),Jc=require("core-js/modules/web.dom-collections.iterator.js"),Lo="__once__",Co=class{on(t,e){if(typeof e!="function")return;let i=this.events.get(t);return i?i.add(e):this.events.set(t,new Set([e]))}once(t,e){if(typeof e!="function")return;let i=""+Lo+t,s=this.events.get(i);return s?s.add(e):this.events.set(i,new Set([e]))}off(t,e){let i=this.events.get(t),s=this.events.get(""+Lo+t);!i&&!s||(e===void 0&&(i==null||i.clear(),s==null||s.clear()),i!=null&&i.has(e)&&i.delete(e),s!=null&&s.has(e)&&s.delete(e))}offAll(){this.events.clear()}emit(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];let o=this.events.get(t),n=this.events.get(""+Lo+t);!o&&!n||(o==null||o.forEach(r=>{typeof r=="function"&&r(...i)}),n==null||n.forEach(r=>{typeof r=="function"&&r(...i)}),n==null||n.clear())}constructor(){this.events=new Map}};var yt=function(a){return a.SWITCH_FLOOR_BEFORE="switch_floor_before",a.SWITCH_FLOOR_GROUND="switch_floor_ground",a.SWITCH_FLOOR_AFTER="switch_floor_after",a}({});var el=require("core-js/modules/es.array.sort.js");function Te(a){return Object.keys(a).sort().map(t=>t+"="+a[t]).join("&")}function Xa(a,t){return new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",a,!0),Object.keys(t.headers||{}).forEach(o=>{s.setRequestHeader(o,t.headers[o])}),t.responseType&&(s.responseType=t.responseType),s.onload=()=>{if(s.status>=200&&s.status<300)if(t.responseType==="arraybuffer")e(s.response);else try{let o=JSON.parse(s.responseText);e(o)}catch(o){i(o)}else i(s.statusText)},s.onerror=()=>{i(s.statusText)},s.send()})}var rl=require("core-js/modules/web.dom-collections.iterator.js"),al=require("core-js/modules/es.array.push.js"),ti=require("three"),Zn=vo(Nn(),1);function jn(a,t){let e=a.clone().normalize(),i=t.clone().normalize();return Math.acos(e.dot(i))}function Ya(a){let t=0;return a.reduce((e,i)=>{let[s,o]=e,[n,r]=i;return t+=Math.sqrt((n-s)**2+(r-o)**2),[n,r]}),t/a.length}function To(a,t){if(t===void 0&&(t=.25),Ya(a)<t)return a;let e=(0,Zn.default)(a);return To(e,t)}function Di(a,t,e,i,s,o){t===void 0&&(t=!1),e===void 0&&(e=!0),i===void 0&&(i=5),s===void 0&&(s=150),o===void 0&&(o=3);let n=[],r=!t;if(n.push(a[0]),a.length<2)return n;for(let c=0;c<a.length-2;c+=1){let l=a[c],p=a[c+1],d=a[c+2],u=new ti.Vector2(l[0]-p[0],l[1]-p[1]),m=new ti.Vector2(d[0]-p[0],d[1]-p[1]),v=jn(u,m)/Math.PI*180,g=u.length()+m.length();(!r||v<s&&g>.01||g>i)&&(n.push(a[c+1]),r=!0)}if(n.push(a[a.length-1]),!e)return n;let h=[];h.push(n[0]);for(let c=0;c<n.length-2;c+=1){let l=new ti.Vector2(n[c][0],n[c][1]),p=new ti.Vector2(n[c+1][0],n[c+1][1]),d=new ti.Vector2(n[c+2][0],n[c+2][1]),u=l.distanceTo(p)/2,m=d.distanceTo(p)/2,v=p.clone(),g=p.clone();v.add(l.clone().sub(p).normalize().multiplyScalar(u>o?o/2:u)),g.add(d.clone().sub(p).normalize().multiplyScalar(m>o?o/2:m));let x=[[v.x,v.y],[p.x,p.y],[g.x,g.y]];h.push(...To(x,o/25))}return h.push(n[n.length-1]),Vn(h)}function Vn(a){if(a.length<=1)return a;let t=[],e;return a.forEach(i=>{let[s,o]=i;e?s===e[0]&&o===e[1]||(e=[s,o],t.push([s,o])):(e=[s,o],t.push([s,o]))}),t}function ko(a,t,e){let i=Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2);if(i===0)return{distance:Math.sqrt((a[0]-t[0])**2+(a[1]-t[1])**2),closestPoint:t.slice(0)};let s=Math.max(0,Math.min(1,((a[0]-t[0])*(e[0]-t[0])+(a[1]-t[1])*(e[1]-t[1]))/i**2)),o=[t[0]+s*(e[0]-t[0]),t[1]+s*(e[1]-t[1])];return{distance:Math.sqrt((a[0]-o[0])**2+(a[1]-o[1])**2),closestPoint:o}}function qa(a,t,e){let[i,s]=a,[o,n]=t,r=Math.sqrt(Math.pow(o-i,2)+Math.pow(n-s,2));if(r===0||r<e)return[...t];let h=e/r,c=i+(o-i)*h,l=s+(n-s)*h;return[c,l]}var de=function(a){return a.START="start",a.END="end",a.FRONT="front",a.RIGHT="right",a.LEFT="left",a.RIGHT_FRONT="right_front",a.LEFT_FRONT="left_front",a.RIGHT_BACK="right_back",a.LEFT_BACK="left_back",a}({});function Es(a,t,e){let i=We(a,t,e);return Ls(i)}function Ls(a){return 180-Math.abs(a)<15?"front":a>135?"right_front":a<-135?"left_front":a<=135&&a>=60?"right":a>=-135&&a<=-60?"left":a<60&&a>0?"right_back":a>-60&&a<0?"left_back":"front"}function $a(a){if(!a.length)return[];if(a.length===1)return[{direction:"start",distance:0,points:a}];let t=[{direction:"start",distance:O(a[0],a[1]),points:[a[0],a[1]]}];for(let e=2;e<a.length;e++){let i=Es(a[e-2],a[e-1],a[e]);if(i==="front"){let s=t[t.length-1],o=O(a[e-1],a[e]);s.distance+=o,e!==2&&s.points.push(a[e-1])}else t.push({direction:i,distance:O(a[e-1],a[e]),points:[a[e-1],a[e]]})}return t.push({direction:"end",distance:0,points:[a[a.length-1]]}),t}function Do(a,t){if(a.length<2)return-1;let e=0;for(let i=1;i<a.length;i++){let s=a[i-1],o=a[i],n=[t[0]-s[0],t[1]-s[1]],r=[o[0]-s[0],o[1]-s[1]],h=Math.min(o[0],s[0])<=t[0]&&t[0]<=Math.max(o[0],s[0]),c=Math.min(o[1],s[1])<=t[1]&&t[1]<=Math.max(o[1],s[1]);if(h&&c){let l=n[0]*r[1]-n[1]*r[0];if(Math.abs(l)<1e-6){let p=Math.sqrt((t[0]-s[0])**2+(t[1]-s[1])**2);return e+p}}e+=Math.sqrt((o[0]-s[0])**2+(o[1]-s[1])**2)}return-1}function Ze(a,t){if(a.length<2){var e;return(e=a[0])!=null?e:null}let i=0;for(let s=1;s<a.length;s++){let o=a[s-1],n=a[s],r=Math.sqrt((n[0]-o[0])**2+(n[1]-o[1])**2);if(i+=r,i>=t){let h=(t-(i-r))/r,c=o[0]+(n[0]-o[0])*h,l=o[1]+(n[1]-o[1])*h;return[c,l]}}return null}var gl=require("core-js/modules/es.array.push.js"),yl=require("core-js/modules/web.dom-collections.iterator.js"),vl=require("core-js/modules/es.regexp.exec.js"),ue=vo(Io(),1);var Kt="___",Ro=class{initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(i=>{let s=""+e.floor+Kt+i.id;if(this.pointMap.set(s,i),this.nodeMap.set(""+i.floor+Kt+i.nodeId,s),i.type==="straightLadder"){let o=this.straightLadderMap.get(i.name)||[];o.push(w({},i)),this.straightLadderMap.set(i.name,o)}if(i.type==="staircase"){let o=this.staircaseMap.get(i.name)||[];o.push(w({},i)),this.staircaseMap.set(i.name,o)}if(i.type==="escalator"){let o=this.escalatorMap.get(i.name)||{};i.escalatorDirection==="exit"?o.end={floor:i.floor,id:i.id}:o.start={floor:i.floor,id:i.id},this.escalatorMap.set(i.name,o)}if(i.type==="facility"){let o=this.facilityMap.get(i.targetId)||[];o.push(w({},i)),this.facilityMap.set(i.targetId,o)}}),e.lines.filter(i=>i.direction!=="no").forEach(i=>{var s,o;let n=""+e.floor+Kt+i.from,r=""+e.floor+Kt+i.to,h=(s=this.pointMap.get(n))==null?void 0:s.cds,c=(o=this.pointMap.get(r))==null?void 0:o.cds;if(h!=null&&h.length&&(c!=null&&c.length)){let l=O(h,c);this.addLineItem(n,r,l),i.direction==="double"&&this.addLineItem(r,n,l)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(t,e,i,s){s===void 0&&(s=this.lineMap);let o=s.get(t)||new Map;o.set(e,i),s.set(t,o)}addFacilityToLineMap(t,e,i,s){[...this.straightLadderMap,...this.staircaseMap].forEach(o=>{let[n,r]=o;if(!(r.length<2))for(let l=0;l<r.length;l++){let p=""+r[l].floor+Kt+r[l].id;for(let d=0;d<r.length;d++)if(l!==d){var h,c;let u=""+r[d].floor+Kt+r[d].id,m=(h=this.pointMap.get(p))==null?void 0:h.cds,v=(c=this.pointMap.get(u))==null?void 0:c.cds;if(m!=null&&m.length&&(v!=null&&v.length))if(r[l].type==="straightLadder"){let g=e;this.addLineItem(p,u,g,s)}else{let g=i;this.addLineItem(p,u,g,s)}}}}),this.escalatorMap.forEach((o,n)=>{if(o.start&&o.end){var r,h;let c=""+o.start.floor+Kt+o.start.id,l=""+o.end.floor+Kt+o.end.id,p=(r=this.pointMap.get(c))==null?void 0:r.cds,d=(h=this.pointMap.get(l))==null?void 0:h.cds;if(p!=null&&p.length&&(d!=null&&d.length)){let u=t;this.addLineItem(c,l,u,s)}}})}initBaseRoute(){let t=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,t),this.baseRoute=new ue.default(t)}initEscalatorRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new ue.default(t)}initStraightLadderRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new ue.default(t)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility?!0:this.checkStart(t)}transformStart(t){var e;if(t.nodeId){let i=this.nodeMap.get(""+t.floor+Kt+t.nodeId);if(i){let[s,o]=i.split(Kt);return{floor:s,id:o}}}if((e=t.coord)!=null&&e.length){let i=this.roadInfo.find(o=>o.floor===t.floor);if(!i)return null;let s=i.points.reduce((o,n)=>{let r=O(t.coord,n.cds);return r<o.min&&(o.min=r,o.point=n),o},{min:1/0,point:i.points[0]});return{floor:s.point.floor,id:s.point.id}}return null}transformEnd(t){if(t.floor){let e=this.transformStart(t);if(e)return e}if(t.facility){let e=this.facilityMap.get(t.facility);if(e!=null&&e.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,i){if(i===void 0&&(i=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let s=this.transformStart(t);if(!s)return"no-start";let o=this.transformEnd(e);if(!o)return"no-end";let n=this.getBasePath.bind(this);switch(i){case"escalator":n=this.getEscalatorPath.bind(this);break;case"straightLadder":n=this.getStraightLadderPath.bind(this);break;default:n=this.getBasePath.bind(this);break}if(o.id)return n(s,o);if(o.facility){let r=this.facilityMap.get(o.facility).filter(c=>o.floor?c.floor===o.floor:!0);if(!r.length)return null;let h=r.map(c=>n(s,{floor:c.floor,id:c.id})).filter(c=>!!c);return h.reduce((c,l)=>{let p=l.reduce((d,u)=>d+Et(u.points),0);return p<c.distance&&(c.distance=p,c.path=l),c},{distance:1/0,path:h[0]}).path}}getRoutePath(t,e,i){let s=""+t.floor+Kt+t.id,o=""+e.floor+Kt+e.id,n=i.path(s,o);if(!n)return null;let r=[];return n.map(h=>{let c=this.pointMap.get(h);if(c){var l;let{floor:p}=c;if(((l=r[r.length-1])==null?void 0:l.floor)===p){let d=r[r.length-1];d.points.push(c.cds),d.endType=c.type,d.destId=c.nodeId,d.distance=Et(d.points)}else r.push({floor:p,points:[c.cds],endType:c.type,destId:c.nodeId,distance:0})}}),r}getBasePath(t,e){return this.getRoutePath(t,e,this.baseRoute)}getEscalatorPath(t,e){return this.getRoutePath(t,e,this.escalatorRoute)}getStraightLadderPath(t,e){return this.getRoutePath(t,e,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new ue.default,this.escalatorRoute=new ue.default,this.straightLadderRoute=new ue.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.staircaseMap=new Map,this.lineMap=new Map,this.baseRoute=new ue.default,this.escalatorRoute=new ue.default,this.straightLadderRoute=new ue.default}};var _l=require("core-js/modules/web.dom-collections.iterator.js"),Pl=require("core-js/modules/es.regexp.exec.js"),bl=require("core-js/modules/es.array.push.js"),Sl=require("core-js/modules/es.set.difference.v2.js"),El=require("core-js/modules/es.set.intersection.v2.js"),Ll=require("core-js/modules/es.set.is-disjoint-from.v2.js"),Cl=require("core-js/modules/es.set.is-subset-of.v2.js"),Tl=require("core-js/modules/es.set.is-superset-of.v2.js"),kl=require("core-js/modules/es.set.symmetric-difference.v2.js"),Dl=require("core-js/modules/es.set.union.v2.js"),Al=require("core-js/modules/es.array.flat.js"),Ol=require("core-js/modules/es.array.unscopables.flat.js"),vt=vo(Io(),1);var Dt=require("lodash"),Cs=require("three"),A="___",Go=class{setLiftPriority(t){this.lift_priority=t}isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let i=[];try{i=JSON.parse(e.entry_end_floor)}catch(o){i=[]}let s=[];try{s=JSON.parse(e.entry_start_floor)}catch(o){s=[]}return w({},e,{entry_start_floor:s,entry_end_floor:i})})}getParkingSpaceInfo(t,e){let i=""+t+A+e;var s;return(s=this.parkingMap.get(i))!=null?s:null}getNodeInfo(t,e){let i=""+t+A+e,s=this.nodeMap.get(i);if(!(s!=null&&s.length))return null;let o=this.pointMap.get(s[0]);return o!=null?o:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let i=new Date,s=i.getHours()*60+i.getMinutes();t.length&&(t.forEach(o=>{let n=(o.points||[]).filter(r=>!(0,Dt.isNil)(r.passWeight)&&r.passWeight!==1&&!(0,Dt.isNil)(r.coverageArea)&&r.coverageArea!==0);(o.points||[]).filter(r=>r.openStatus!==!1).filter(r=>{if(!r.startTime||!r.endTime)return!0;let[h,c]=r.startTime.split(":").map(m=>+m),[l,p]=r.endTime.split(":").map(m=>+m),d=h*60+c,u=l*60+p;return s>=d&&s<=u}).forEach(r=>{r.floor=o.floor;let h=""+o.floor+A+r.id,c=""+o.floor+A+r.nodeId,l=this.nodeMap.get(c)||[];if(l.push(""+o.floor+A+(r.relatedId||r.id)),this.nodeMap.set(""+o.floor+A+r.nodeId,l),this.pointMap.set(h,r),this.isFacilityByType(r.type)){let p=this.facilities.find(d=>d.id===+r.targetId);if(p){switch(p.entry_infra_type){case"straightLadder":if(p.entry_end_floor.find(g=>g.floor===o.floor)&&p.entry_start_floor.find(g=>g.floor===o.floor)){let g=this.straightLadderMap.get(r.targetId)||[];g.push(w({},r)),this.straightLadderMap.set(r.targetId,g)}break;case"staircase":if(p.entry_end_floor.find(g=>g.floor===o.floor)&&p.entry_start_floor.find(g=>g.floor===o.floor)){let g=this.staircaseMap.get(r.targetId)||[];g.push(w({},r)),this.staircaseMap.set(r.targetId,g)}break;case"escalator":let u=this.escalatorMap.get(r.targetId)||[];if(p.entry_start_floor.find(g=>g.floor===o.floor)){let g=u.find(x=>{var M;return((M=x.end)==null?void 0:M.floor)!==o.floor&&!x.start});g?g.start=r:u.push({start:r})}if(p.entry_end_floor.find(g=>g.floor===o.floor)){let g=u.find(x=>{var M;return((M=x.start)==null?void 0:M.floor)!==o.floor&&!x.end});g?g.end=r:u.push({end:r})}this.escalatorMap.set(r.targetId,u);break;case"ramp":let m=this.rampMap.get(r.targetId)||[];if(p.entry_start_floor.find(g=>g.floor===o.floor)){let g=m.find(x=>{var M;return((M=x.end)==null?void 0:M.floor)!==o.floor&&!x.start});g?g.start=r:m.push({start:r})}if(p.entry_end_floor.find(g=>g.floor===o.floor)){let g=m.find(x=>{var M;return((M=x.start)==null?void 0:M.floor)!==o.floor&&!x.end});g?g.end=r:m.push({end:r})}this.rampMap.set(r.targetId,m);break;case"connectionPoint":let v=this.connectionPointMap.get(r.targetId)||[];if(p.entry_start_floor.find(g=>g.floor===o.floor)){let g=v.find(x=>{var M;return((M=x.end)==null?void 0:M.floor)!==o.floor&&!x.start});g?g.start=r:v.push({start:r})}if(p.entry_end_floor.find(g=>g.floor===o.floor)){let g=v.find(x=>{var M;return((M=x.start)==null?void 0:M.floor)!==o.floor&&!x.end});g?g.end=r:v.push({end:r})}this.connectionPointMap.set(r.targetId,v);break}let d=this.facilityMap.get(r.targetId)||[];d.push(w({},r)),this.facilityMap.set(r.targetId,d)}}r.type==="parkingSpace"&&r.name.split(/[,,]/).forEach(d=>{this.parkingMap.set(""+o.floor+A+d,r)})}),(o.lines||[]).filter(r=>r.to!==r.from).forEach(r=>{let h=""+o.floor+A+r.from,c=""+o.floor+A+r.to,l=this.pointMap.get(h),p=this.pointMap.get(c);if(!l||!p)return;let d=l.cds,u=p.cds,m=O(d,u);if(n.forEach(v=>{(v.id===r.from||v.id===r.to)&&(m=m/v.passWeight);let g=O(d,v.cds)<=v.coverageArea,x=O(u,v.cds)<=v.coverageArea;(g||x)&&(m=m/v.passWeight)}),!l.permission&&!p.permission){switch(this.addLineItem(h,c,m),this.addLineItem(c,h,m),r.direction){case"double":this.addLineItem(h,c,m,this.forwardLineMap),this.addLineItem(c,h,m,this.forwardLineMap);break;case"single":this.addLineItem(h,c,m,this.forwardLineMap);break;case"back":this.addLineItem(c,h,m,this.forwardLineMap);break}(l.type==="parkingSpace"||p.type==="parkingSpace")&&r.direction==="noDir"&&(this.addLineItem(h,c,m,this.forwardLineMap),this.addLineItem(c,h,m,this.forwardLineMap))}else l.permission&&(this.setPermissionLine(h,c,l.permission,m,""),this.setPermissionLine(c,h,l.permission,m,"")),p.permission&&p.permission!==l.permission&&(this.setPermissionLine(h,c,p.permission,m,""),this.setPermissionLine(c,h,p.permission,m,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,i,s,o){this.getPermissionMap(i).add({fromKey:t,toKey:e,distance:s,type:o})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let i=0;i<t.length;i++){let s=""+t[i].floor+A+t[i].id,o=this.pointMap.get(s);if(o){for(let n=0;n<t.length;n++)if(i!==n){let r=""+t[n].floor+A+t[n].id,h=this.pointMap.get(r);if(!h)continue;o.permission&&this.setPermissionLine(s,r,o.permission,1,"straightLadder"),h.permission&&h.permission!==o.permission&&this.setPermissionLine(s,r,h.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let i=0;i<t.length;i++){let s=""+t[i].floor+A+t[i].id,o=this.pointMap.get(s);if(o){for(let n=0;n<t.length;n++)if(i!==n){let r=""+t[n].floor+A+t[n].id,h=this.pointMap.get(r);if(!h)continue;o.permission&&this.setPermissionLine(s,r,o.permission,1,"staircase"),h.permission&&h.permission!==o.permission&&this.setPermissionLine(s,r,h.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(i=>{if(i.start&&i.end){let s=""+i.start.floor+A+i.start.id,o=""+i.end.floor+A+i.end.id,n=this.pointMap.get(s),r=this.pointMap.get(o);n&&r&&(n.permission&&this.setPermissionLine(s,o,n.permission,1,"escalator"),r.permission&&r.permission!==n.permission&&this.setPermissionLine(s,o,r.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(i=>{if(i.start&&i.end){let s=""+i.start.floor+A+i.start.id,o=""+i.end.floor+A+i.end.id,n=this.pointMap.get(s),r=this.pointMap.get(o);n&&r&&(n.permission&&this.setPermissionLine(s,o,n.permission,10,"ramp"),r.permission&&r.permission!==n.permission&&this.setPermissionLine(s,o,r.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{t.forEach(i=>{if(i.start&&i.end){let s=""+i.start.floor+A+i.start.id,o=""+i.end.floor+A+i.end.id,n=this.pointMap.get(s),r=this.pointMap.get(o);n&&r&&(n.permission&&this.setPermissionLine(s,o,n.permission,1,"connectionPoint"),r.permission&&r.permission!==n.permission&&this.setPermissionLine(s,o,r.permission,1,"connectionPoint"))}})})}addPermissionLineToMap(t,e,i,s){this.getPermissionMap(t).forEach(n=>{e.includes(n.type)&&(n.type===""?this.addLineItem(n.fromKey,n.toKey,n.distance,i):this.addLineItem(n.fromKey,n.toKey,s.get(n.type),i))})}addLineItem(t,e,i,s){s===void 0&&(s=this.lineMap);let o=s.get(t)||new Map;o.set(e,i),s.set(t,o)}addFacilityToLineMap(t,e,i,s){[...this.straightLadderMap,...this.staircaseMap].forEach(o=>{let[n,r]=o;if(!(r.length<2))for(let h=0;h<r.length;h++){let c=""+r[h].floor+A+r[h].id,l=this.pointMap.get(c);if(!(!l||l.permission)){for(let p=0;p<r.length;p++)if(h!==p){let d=""+r[p].floor+A+r[p].id,u=this.pointMap.get(d);if(!u||u.permission)continue;if(r[h].type==="straightLadder"){let m=e;this.addLineItem(c,d,m,s)}else{let m=i;this.addLineItem(c,d,m,s)}}}}}),this.escalatorMap.forEach((o,n)=>{o.forEach(r=>{if(r.start&&r.end){let h=""+r.start.floor+A+r.start.id,c=""+r.end.floor+A+r.end.id,l=this.pointMap.get(h),p=this.pointMap.get(c);if(l&&p&&!l.permission&&!p.permission){let d=t;this.addLineItem(h,c,d,s)}}})}),this.connectionPointMap.forEach((o,n)=>{o.forEach(r=>{if(r.start&&r.end){let h=""+r.start.floor+A+r.start.id,c=""+r.end.floor+A+r.end.id,l=this.pointMap.get(h),p=this.pointMap.get(c);l&&p&&!l.permission&&!p.permission&&this.addLineItem(h,c,100,s)}})})}initBaseRoute(){let t=new Map((0,Dt.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100*this.lift_priority,3e4,t),this.baseRoute=new vt.default(t)}initEscalatorRoute(){let t=new Map((0,Dt.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(100,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new vt.default(t)}initStraightLadderRoute(){let t=new Map((0,Dt.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(3*e,300,3e4*e,t),this.straightLadderRoute=new vt.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(i=>{if(i.start&&i.end){let s=""+i.start.floor+A+i.start.id,o=""+i.end.floor+A+i.end.id,n=this.pointMap.get(s),r=this.pointMap.get(o);n&&r&&!n.permission&&!r.permission&&this.addLineItem(s,o,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{t.forEach(i=>{if(i.start&&i.end){let s=""+i.start.floor+A+i.start.id,o=""+i.end.floor+A+i.end.id,n=this.pointMap.get(s),r=this.pointMap.get(o);n&&r&&!n.permission&&!r.permission&&this.addLineItem(s,o,100,this.forwardLineMap)}})}),this.forwardRoute=new vt.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t,e,i){i===void 0&&(i={});var s;if(t.nodeId){let o=this.nodeMap.get(""+t.floor+A+t.nodeId);if(o!=null&&o.length)return o.map(n=>{let[r,h]=n.split(A);return{floor:r,id:h}})}if((s=t.coord)!=null&&s.length){let o=this.roadInfo.find(c=>c.floor===t.floor);if(!o)return null;let n=o.points.filter(c=>c.isStarted),r=o.points.filter(c=>{let l=""+c.floor+A+c.id;if(e==="forward"){if(!this.forwardLineMap.has(l)||i.adsorptionIntersection&&n.length&&!c.isStarted)return!1}else if(!this.lineMap.has(l))return!1;return!0});if(!r.length)return null;let h=r.reduce((c,l)=>{if(l.relatedId)return c;let p=O(t.coord,l.cds);return p<c.min&&(c.min=p,c.point=l),c},{min:1/0,point:r[0]});return[{floor:o.floor,id:h.point.id}]}return null}transformEnd(t,e){if(t.floor){if(t.parkingSpace){let s=this.parkingMap.get(""+t.floor+A+t.parkingSpace);if(s)return[{floor:t.floor,id:s.id}]}let i=this.transformStart(t,e);if(i)return i}if(t.facility){let s=this.facilities.filter(o=>+o.type_id==+t.facility).map(o=>o.id).map(o=>this.facilityMap.get(""+o)).flat(2);if(s!=null&&s.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,i,s,o,n){if(i===void 0&&(i=""),n===void 0&&(n={}),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let r=this.transformStart(t,i,n);if(!r)return"no-start";let h=this.transformEnd(e,i);if(!h)return"no-end";let c=[];if(Array.isArray(h))for(let d=0;d<r.length;d++){let u=r[d];for(let m=0;m<h.length;m++){let v=h[m];if(u.floor===v.floor&&u.id===v.id)return"near"}}else{c=this.facilities.filter(u=>+u.type_id==+e.facility).map(u=>u.id).map(u=>this.facilityMap.get(""+u)).flat(2).filter(u=>u).filter(u=>h.floor?u.floor===h.floor:!0);for(let u=0;u<r.length;u++){let m=r[u];for(let v=0;v<c.length;v++){let g=c[v];if(m.floor===g.floor&&m.id===g.id)return"near"}}}let l;switch(i){case"escalator":l=this.getEscalatorPath.bind(this);break;case"straightLadder":l=this.getStraightLadderPath.bind(this);break;case"forward":l=this.getForwardPath.bind(this);break;default:l=this.getBasePath.bind(this);break}let p=null;return r.forEach(d=>{if(Array.isArray(h))h.forEach(u=>{let m=l(d,u,s,o);m&&m&&(!p||m[0].consume<p[0].consume)&&(p=m)});else{if(!c.length)return null;let u=c.map(m=>l(d,{floor:m.floor,id:m.id},s,o)).filter(m=>!!m);p=u.reduce((m,v)=>{let g=v[0].consume;return g<m.distance&&(m.distance=g,m.path=v),m},{distance:1/0,path:u[0]}).path}}),p}getRoutePath(t,e,i){let s=""+t.floor+A+t.id,o=this.pointMap.get(s),n=""+e.floor+A+e.id,r=this.pointMap.get(n);if(!o||!r)return null;let h=""+o.floor+A+(o.relatedId||o.id),c=""+r.floor+A+(r.relatedId||r.id),l=i.path(h,c);if(!l)return null;let p=[],d=l.reduce((u,m,v,g)=>{if(v===0)return 0;let x=g[v-1],M=i.graph.get(x).get(m);return u+M},0);return l.map(u=>{let m=this.pointMap.get(u);if(m){var v;let{floor:g}=m,x=m.type;if(this.isFacilityByType(m.type)){let M=this.facilities.find(P=>P.id===+m.targetId);M&&(x=M.entry_infra_type)}if(((v=p[p.length-1])==null?void 0:v.floor)===g){let M=p[p.length-1];M.points.push(m.cds),M.pointInfos.push(m),M.endType=x,M.destId=m.nodeId,M.distance=Et(M.points)}else p.push({floor:g,points:[m.cds],pointInfos:[m],endType:x,destId:m.nodeId,distance:0,consume:d})}}),p}getBasePath(t,e,i){if(!i)return this.getRoutePath(t,e,this.baseRoute);let s=(0,Dt.cloneDeep)(this.baseRoute.graph),o=r=>{this.addPermissionLineToMap(r,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100*this.lift_priority],["staircase",3e4]]))};Array.isArray(i)?i.forEach(r=>{o(r)}):o(i);let n=new vt.default(s);return this.getRoutePath(t,e,n)}getEscalatorPath(t,e,i){if(!i)return this.getRoutePath(t,e,this.escalatorRoute);let s=(0,Dt.cloneDeep)(this.escalatorRoute.graph),o=1e4,n=h=>{this.addPermissionLineToMap(h,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",100],["connectionPoint",100],["straightLadder",this.lift_priority*o],["staircase",3e4*o]]))};Array.isArray(i)?i.forEach(h=>{n(h)}):n(i);let r=new vt.default(s);return this.getRoutePath(t,e,r)}getStraightLadderPath(t,e,i){if(!i)return this.getRoutePath(t,e,this.straightLadderRoute);let s=(0,Dt.cloneDeep)(this.straightLadderRoute.graph),o=1e4,n=h=>{this.addPermissionLineToMap(h,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",3*o],["connectionPoint",100],["straightLadder",300],["staircase",3e4*o]]))};Array.isArray(i)?i.forEach(h=>{n(h)}):n(i);let r=new vt.default(s);return this.getRoutePath(t,e,r)}getForwardPath(t,e,i,s){let o=new Map,n=u=>{let m=this.forwardRoute.graph.get(h);u.forEach(v=>{let g=m.get(v);(0,Dt.isNil)(g)||(o.set(v,g),m.delete(v))})},r=()=>{let u=this.forwardRoute.graph.get(h);o.forEach((m,v)=>{u.set(v,m)})},h=""+t.floor+A+t.id;if(!(0,Dt.isNil)(s)){let u=this.forwardLineMap.get(h),m=this.pointMap.get(h);if(m&&(u!=null&&u.size)&&u.size>1){let v=new Cs.Vector2(m.cds[0],m.cds[1]),g=new Map;u.forEach((M,P)=>{let C=this.pointMap.get(P);if(C){let S=new Cs.Vector2(C.cds[0],C.cds[1]),E=360-(new Cs.Vector2().subVectors(S,v).angle()/Math.PI*180-90+360)%360;g.set(P,E)}});let x=Array.from(g).filter(M=>{let[P,C]=M;return Math.abs(C-s)<=60}).map(M=>{let[P]=M;return P});if(x.length)x.forEach(M=>g.delete(M)),n([...g.keys()]);else{let M=Array.from(g).reduce((P,C)=>{let S=Math.abs(C[1]-s);return S<P.diff?{diff:S,key:C[0]}:P},{diff:1/0,key:""});g.delete(M.key),n([...g.keys()])}}}if(!i){let u=this.getRoutePath(t,e,this.forwardRoute);return r(),u||this.getRoutePath(t,e,this.forwardRoute)}let c=(0,Dt.cloneDeep)(this.forwardRoute.graph),l=u=>{this.addPermissionLineToMap(u,["","ramp"],c,new Map([["ramp",10]]))};Array.isArray(i)?i.forEach(u=>{l(u)}):l(i);let p=new vt.default(c),d=this.getRoutePath(t,e,p);if(r(),d)return d;{let u=(0,Dt.cloneDeep)(this.forwardRoute.graph);Array.isArray(i)?i.forEach(g=>{l(g)}):l(i);let m=new vt.default(u);return this.getRoutePath(t,e,m)}}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new vt.default,this.escalatorRoute=new vt.default,this.straightLadderRoute=new vt.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.baseRoute=new vt.default,this.escalatorRoute=new vt.default,this.straightLadderRoute=new vt.default,this.forwardLineMap=new Map,this.forwardRoute=new vt.default}};var Gl=require("core-js/modules/es.set.difference.v2.js"),Fl=require("core-js/modules/es.set.intersection.v2.js"),zl=require("core-js/modules/es.set.is-disjoint-from.v2.js"),Bl=require("core-js/modules/es.set.is-subset-of.v2.js"),Wl=require("core-js/modules/es.set.is-superset-of.v2.js"),Ul=require("core-js/modules/es.set.symmetric-difference.v2.js"),Hl=require("core-js/modules/es.set.union.v2.js"),Nl=require("core-js/modules/web.dom-collections.iterator.js"),ke=class{static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let t=this.createKey();for(;this.keySet.has(t);)t=this.createKey();return t}static removeKey(t){this.keySet.delete(t)}static dispose(){this.keySet.clear()}};ke.keySet=new Set;var jl=require("core-js/modules/es.string.replace.js"),Vl=require("core-js/modules/es.regexp.exec.js"),Kl=require("core-js/modules/es.array.push.js");function Fo(a){return a.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function zo(a){let t=[],e=/(\([^()]*\))|([^()]*)/g,i=0,s;for(;(s=e.exec(a))!==null;)s.index>i&&t.push(a.substring(i,s.index)),t.push(s[0]),i=s.index+s[0].length;return i<a.length&&t.push(a.substring(i)),t}function Z(a,t,e){return new Promise((i,s)=>{let o=ke.genUniqueKey(),n=r=>{let{data:h}=r;h.type===""+t+"_result"&&h.key===o&&(ke.removeKey(o),self.removeEventListener("message",n),h.error?s(h.error):i(h.data))};a.addEventListener("message",n),a.postMessage({type:t,key:o,data:e})})}function eh(a){let t={};for(let i in a)i.startsWith("on")&&(t[Fo(i.slice(2))]=a[i],t[i]=a[i]);let e=i=>f(this,null,function*(){let{data:s}=i;if(t[s.type])try{let o=yield t[s.type](s.data);if(o!=null&&o.$transfer&&Array.isArray(o.$transfer)){let n=o.$transfer;delete o.$transfer,self.postMessage({type:""+s.type+"_result",key:s.key,data:o},n)}else self.postMessage({type:""+s.type+"_result",key:s.key,data:o})}catch(o){self.postMessage({type:""+s.type+"_result",key:s.key,error:o})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var Xt=require("three");function ih(a,t){t===void 0&&(t=16711680);let e=new Xt.LineBasicMaterial({color:t}),i=new Xt.BufferGeometry().setFromPoints(a);return new Xt.Line(i,e)}function sh(a,t){t===void 0&&(t=16711680);let e=new Xt.MeshBasicMaterial({color:t,depthTest:!1,transparent:!0}),i=new Xt.BoxGeometry(1,1,1),s=new Xt.Mesh(i,e);return s.position.copy(a),s.renderOrder=100100,s}var tp=require("core-js/modules/es.json.stringify.js"),ep=require("core-js/modules/web.dom-collections.iterator.js");function Ai(a,t,e){e===void 0&&(e=0),a.forEach(i=>{if(i.geometry.coords=JSON.parse(JSON.stringify(i.geometry.cds)),i.geometry.type==="polygon"){var s;i.geometry.coords.map(o=>{Array.isArray(o)&&o.forEach(n=>{n[0]-=t[0],n[1]-=t[1]})}),i.geometry.otherCds&&(i.geometry.otherCoords=i.geometry.otherCds.map(o=>o.map(n=>je(n,t)))),(s=i.doors)!=null&&s.length&&i.doors.map(o=>{o.coord=je(o.coordinate,t)}),i.center&&(i.centerCoords=je(i.center,t))}else i.geometry.coords=je(i.geometry.cds,t),i.center&&(i.centerCoords=je(i.center,t));if(i.center_x&&i.center_y){let[o,n]=je([i.center_x,i.center_y],t);i.center_coord_x=o,i.center_coord_y=n}});for(let i=0;i<a.length;i++){let s=a[i];s.deltaHeight=1e-5*(e+i+1)}}function je(a,t){return[a[0]-t[0],a[1]-t[1]]}var sp=require("core-js/modules/es.set.difference.v2.js"),op=require("core-js/modules/es.set.intersection.v2.js"),np=require("core-js/modules/es.set.is-disjoint-from.v2.js"),rp=require("core-js/modules/es.set.is-subset-of.v2.js"),ap=require("core-js/modules/es.set.is-superset-of.v2.js"),hp=require("core-js/modules/es.set.symmetric-difference.v2.js"),cp=require("core-js/modules/es.set.union.v2.js"),lp=require("core-js/modules/web.dom-collections.iterator.js"),ar=require("@tweenjs/tween.js"),Pe=class{update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(t=>{this.tweenStore.add(t),t.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(t=>{t.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(t){this.group.remove(t)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(t=>t.stop()),this.group.removeAll()}dispose(){this.clear()}constructor(){this.pauseTween=!1,this.tweenStore=new Set,this.group=new ar.Group}};var hr=require("three"),Oi=class extends hr.EventDispatcher{registryEvent(){this.ctn.addEventListener("pointerdown",this._pointerDown),this.ctn.addEventListener("pointerup",this._pointerUp)}unRegistryEvent(){this.ctn.removeEventListener("pointerdown",this._pointerDown),this.ctn.removeEventListener("pointerup",this._pointerUp)}dispose(){this.unRegistryEvent()}constructor(t){super(),this.ctn=t,this._pointerDown=e=>{this.point={x:e.offsetX,y:e.offsetY}},this._pointerUp=e=>{if(!this.point)return;let{offsetX:i,offsetY:s}=e,{x:o,y:n}=this.point;Math.hypot(o-i+(n-s))>3||this.dispatchEvent({type:"click",e})},this.registryEvent()}};var mp=require("core-js/modules/web.dom-collections.iterator.js"),fp=require("core-js/modules/es.array.push.js"),gp=require("core-js/modules/es.string.replace.js"),yp=require("core-js/modules/es.regexp.exec.js"),cr=require("lodash"),lr=require("three");var Ve=class extends lr.EventDispatcher{_isEffectiveTask(t){return t&&typeof t.run=="function"}_getIndexByTid(t){return this._task.findIndex(e=>e.tid===t)}_createTask(t){return this._isEffectiveTask(t)?w({},t,{tid:++this._id,meta:t.meta||{}}):!1}get task(){return[...this._task]}getTasks(){return[...this._task]}add(t){if(this._isEffectiveTask(t)){let e=this._createTask(t);return this._task.push(e),this.started&&!this.activeTask&&this.start(),e.tid}return!1}replace(t,e){if(!this._isEffectiveTask(e))return console.warn("[TaskQueue] replace\u65B9\u6CD5\u4F20\u5165\u7684task\u53C2\u6570\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;let i=this._getIndexByTid(t);if(i===-1)return console.warn("[TaskQueue] \u6CA1\u6709\u627E\u5230id="+t+"\u7684\u4EFB\u52A1"),!1;let s=this._createTask(e);return this._task.splice(i,1,s),s.tid}replaceByMetaType(t){var e;let i=(e=t.meta)==null?void 0:e.type;if((0,cr.isNil)(i))return this.add(t);{let s=this._task.find(o=>o.meta.type===i);return s?this.replace(s.tid,t):this.add(t)}}remove(t){let e=this._getIndexByTid(t);return e===-1?(console.warn("[TaskQueue] remove\u65B9\u6CD5\u4F20\u5165\u7684id\uFF1A"+t+"\u627E\u4E0D\u5230\u5BF9\u5E94\u7684task"),!1):(this._task.splice(e,1),!0)}clear(){this._task.length=0}start(){this.started=!0,!this.activeTask&&this._task.length&&this.exec()}stop(){this.started=!1}exec(){return f(this,null,function*(){if(!this.started||!this._task.length)return!1;let t=this._task.shift();this.activeTask=t,this.dispatchEvent({type:"active-task-start",task:t});let e;try{e=yield t.run()}catch(i){console.warn("[task run err]",i,t)}return this.activeTask=null,this.dispatchEvent({type:"active-task-end",task:t,res:e}),this.exec()})}constructor(t=!0){super(),this._task=[],this.started=!1,this.activeTask=null,this._id=0,t&&this.start()}};var wp=require("core-js/modules/es.array.push.js"),pr=require("three"),Ii=class extends pr.EventDispatcher{getWorker(){return new Promise(t=>{let e=this.pool.find(s=>s.state==="leisure");if(e){e.state="used",t(e.worker);return}if(this.pool.length<this.max&&this.workerConstructor){let s=this.workerConstructor();this.pool.push({worker:s,state:"used"}),t(s);return}let i=()=>{let s=this.pool.find(o=>o.state==="leisure");s&&(this.removeEventListener("release",i),s.state="used",t(s.worker))};this.addEventListener("release",i)})}releaseWorker(t){let e=this.pool.find(i=>i.worker===t);e&&(e.state="leisure",this.dispatchEvent({type:"release",worker:t}))}dispose(){this._listeners={},this.pool.forEach(t=>{t.worker.terminate()}),this.pool=[]}constructor(t=10,e){super(),this.max=10,this.pool=[],this.max=t,this.workerConstructor=e}};var dr=require("three"),st=class extends dr.EventDispatcher{dispose(){this._listeners={}}};var Ri=class{filter(t){let e=this.estimate,i=this.errorEstimate+this.processNoise,s=i/(i+this.measurementNoise);return this.estimate=e+s*(t-e),this.errorEstimate=(1-s)*i,this.estimate}constructor(t={}){this.estimate=0,this.errorEstimate=1,this.processNoise=.1,this.measurementNoise=1,this.measurementNoise=t.measurementNoise||1,this.processNoise=t.processNoise||.1,this.errorEstimate=t.errorEstimate||1}};var bp=require("core-js/modules/es.typed-array.float32-array.js"),Sp=require("core-js/modules/es.typed-array.at.js"),Ep=require("core-js/modules/es.typed-array.fill.js"),Lp=require("core-js/modules/es.typed-array.find-last.js"),Cp=require("core-js/modules/es.typed-array.find-last-index.js"),Tp=require("core-js/modules/es.typed-array.set.js"),kp=require("core-js/modules/es.typed-array.sort.js"),Dp=require("core-js/modules/es.typed-array.to-reversed.js"),Ap=require("core-js/modules/es.typed-array.to-sorted.js"),Op=require("core-js/modules/es.typed-array.with.js"),Ip=require("core-js/modules/es.array-buffer.constructor.js"),Rp=require("core-js/modules/es.array-buffer.slice.js"),Gp=require("core-js/modules/es.array-buffer.detached.js"),Fp=require("core-js/modules/es.array-buffer.transfer.js"),zp=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Bp=require("core-js/modules/es.array.push.js"),Wp=require("core-js/modules/web.dom-collections.iterator.js"),V=require("three");var ur=require("three/examples/jsm/utils/BufferGeometryUtils.js");var Ts=require("@turf/turf");function oh(a,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let i=a.filter(r=>r.geometry.type==="polygon");if(!i.length)return null;let s=i.map(r=>{var h;let c=r.geometry.coords,l=Li(c[0],c.slice(1)),p=new V.ExtrudeGeometry(l,{steps:1,bevelEnabled:!1,depth:r.height,curveSegments:4});(h=r).deltaHeight||(h.deltaHeight=0),p.translate(0,0,r.airHeight+r.deltaHeight);let d=p.attributes.position.count,u=new Float32Array(d).fill(r.height+r.airHeight+r.deltaHeight);if(p.setAttribute("maxZ",new V.BufferAttribute(u,1)),p.setAttribute("opacity",new V.BufferAttribute(new Float32Array(d).fill(r.fillOpacity),1)),e){let g=new Float32Array(d).fill(r.airHeight+r.deltaHeight);p.setAttribute("minZ",new V.BufferAttribute(g,1))}let m=new V.Color(r.fillColor).convertLinearToSRGB(),v=new Float32Array(d*3);for(let g=0;g<d;g++)v[g*3]=m.r,v[g*3+1]=m.g,v[g*3+2]=m.b;return p.setAttribute("color",new V.BufferAttribute(v,3)),p}),o=(0,ur.mergeGeometries)(s);s.forEach(r=>r.dispose());let n={geometry:o};return o.dispose(),t&&(n.lineGeometry=mr(i)||void 0),n}function nh(a){let t=a.filter(h=>h.geometry.type==="polygon");if(!t.length)return null;let e=[],i=[],s=[],o=[],n=[],r=[];return t.map((h,c)=>{var l;(l=h).deltaHeight||(l.deltaHeight=0);let p=h.geometry.coords,d=O(p[0][0],p[0][1]),u=O(p[0][1],p[0][2]),m=p[0][1][0]-p[0][0][0],v=p[0][1][1]-p[0][0][1],g=Math.atan2(v,m),x=(0,Ts.center)((0,Ts.polygon)(p)),M=x.geometry.coordinates[0],P=x.geometry.coordinates[1],C=new V.Matrix4().compose(new V.Vector3(M,P,h.deltaHeight+h.airHeight+h.height/2),new V.Quaternion().setFromAxisAngle(new V.Vector3(0,0,1),g),new V.Vector3(d,u,h.height));e.push(...C.toArray()),i.push(...new V.Color(h.fillColor).convertLinearToSRGB().toArray());var S;s[c]=(S=h.fillOpacity)!=null?S:1;var G;o[c]=((G=h.deltaHeight)!=null?G:0)+h.airHeight+h.height,n[c]=h.id,r[c]=h.airHeight+h.deltaHeight}),{size:t.length,ids:n,matrixes:e,colors:i,opacities:s,maxZs:o,minZs:r}}function mr(a){let{points:t,colors:e,opacities:i}=ks(a);if(!t.length)return null;let s=new V.BufferGeometry().setFromPoints(t);return s.setAttribute("color",new V.BufferAttribute(new Float32Array(e),3)),s.setAttribute("opacity",new V.BufferAttribute(new Float32Array(i),1)),s}function ks(a){let t=[],e=[],i=[];return a.filter(s=>s.strokeOpacity>0).map(s=>{let o=s.height+(s.deltaHeight||0)+s.airHeight,{coords:n}=s.geometry,{strokeColor:r,strokeOpacity:h}=s,c=new V.Color(r).convertLinearToSRGB();for(let l=0;l<n.length;l++){let p=n[l];for(let d=0;d<p.length;d++){let u=p[d],m=d+1===p.length?p[0]:p[d+1];t.push(new V.Vector3(u[0],u[1],o)),t.push(new V.Vector3(m[0],m[1],o)),e.push(c.r,c.g,c.b),e.push(c.r,c.g,c.b),i.push(h),i.push(h)}}}),{points:t,colors:e,opacities:i}}function rh(a){if(a.length>1)return!1;let t=a[0];if(t.length!==5)return!1;let[e]=t,i=t[t.length-1];if(e[0]!==i[0]||e[1]!==i[1])return!1;let s=[Math.round(O(t[0],t[1])),Math.round(O(t[1],t[2])),Math.round(O(t[2],t[3])),Math.round(O(t[3],t[4]))];if(!(s[2]===s[0]&&s[3]===s[1]))return!1;let o=We(t[0],t[1],t[2]);return Math.abs(Math.abs(o)-90)<1}var z=require("three");var jv=require("core-js/modules/web.dom-collections.iterator.js"),Vv=require("core-js/modules/es.set.difference.v2.js"),Kv=require("core-js/modules/es.set.intersection.v2.js"),Xv=require("core-js/modules/es.set.is-disjoint-from.v2.js"),Yv=require("core-js/modules/es.set.is-subset-of.v2.js"),qv=require("core-js/modules/es.set.is-superset-of.v2.js"),$v=require("core-js/modules/es.set.symmetric-difference.v2.js"),Jv=require("core-js/modules/es.set.union.v2.js"),Qv=require("core-js/modules/es.array.push.js"),qr=require("three");var Nu=require("core-js/modules/web.dom-collections.iterator.js"),Zu=require("core-js/modules/es.array.push.js"),k=require("three");var Zp=require("core-js/modules/web.dom-collections.iterator.js"),gr=require("three/examples/jsm/lines/LineMaterial.js"),Y=require("three");function fr(a){return a.x+"-"+a.y+"-"+a.z}var T=class{static generateLineMaterialKey(t){let{color:e,opacity:i}=t;return e+"-"+i}static createLineMaterial(t){let{color:e,opacity:i,vertexColors:s}=t,o=this.generateLineMaterialKey({color:e,opacity:i,vertexColors:s});if(this.lineMaterialMap.has(o))return this.lineMaterialMap.get(o);let n=new Y.LineBasicMaterial({color:new Y.Color(e).convertLinearToSRGB(),transparent:!0,opacity:i,vertexColors:s!=null?s:!1});return this.lineMaterialMap.set(o,n),n}static createMeshStandardMaterial(t){let{color:e,opacity:i}=t,s=e+"-"+i;if(this.meshStandardMaterialMap.has(s))return this.meshStandardMaterialMap.get(s);let o=new Y.MeshStandardMaterial({color:new Y.Color(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:i,depthWrite:!0});return this.meshStandardMaterialMap.set(s,o),o}static createMeshBasicMaterial(t){let{color:e,opacity:i,vertexColors:s}=t,o=e+"-"+i+"-"+s;if(this.meshBasicMaterialMap.has(o))return this.meshBasicMaterialMap.get(o);let n=new Y.MeshBasicMaterial({color:e,transparent:!0,opacity:i,depthWrite:!0,vertexColors:s!=null?s:!1});return this.meshBasicMaterialMap.set(o,n),n}static createShaderMaterial(t){let{gradualColor:e,center:i,maxValue:s,opacity:o,direction:n,max:r,min:h}=t,c=e.toString()+"-"+fr(i)+"-"+s+"-"+o+"-"+fr(n);if(this.shaderMaterialMap.has(c))return this.shaderMaterialMap.get(c);let l=`
|
|
1
|
+
"use strict";var za=Object.create;var Si=Object.defineProperty;var Ba=Object.getOwnPropertyDescriptor;var Wa=Object.getOwnPropertyNames,zn=Object.getOwnPropertySymbols,Ua=Object.getPrototypeOf,Bn=Object.prototype.hasOwnProperty,Ha=Object.prototype.propertyIsEnumerable;var xo=(a,t,e)=>t in a?Si(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,Ei=(a,t)=>{for(var e in t||(t={}))Bn.call(t,e)&&xo(a,e,t[e]);if(zn)for(var e of zn(t))Ha.call(t,e)&&xo(a,e,t[e]);return a};var Be=(a,t)=>()=>(t||a((t={exports:{}}).exports,t),t.exports),Na=(a,t)=>{for(var e in t)Si(a,e,{get:t[e],enumerable:!0})},Wn=(a,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Wa(t))!Bn.call(a,s)&&s!==e&&Si(a,s,{get:()=>t[s],enumerable:!(i=Ba(t,s))||i.enumerable});return a};var wo=(a,t,e)=>(e=a!=null?za(Ua(a)):{},Wn(t||!a||!a.__esModule?Si(e,"default",{value:a,enumerable:!0}):e,a)),Za=a=>Wn(Si({},"__esModule",{value:!0}),a);var rt=(a,t,e)=>xo(a,typeof t!="symbol"?t+"":t,e);var f=(a,t,e)=>new Promise((i,s)=>{var o=h=>{try{r(e.next(h))}catch(c){s(c)}},n=h=>{try{r(e.throw(h))}catch(c){s(c)}},r=h=>h.done?i(h.value):Promise.resolve(h.value).then(o,n);r((e=e.apply(a,t)).next())});var Hn=Be((al,Un)=>{Un.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}});var jn=Be((hl,Zn)=>{var Nn=Hn();Zn.exports=function(a,t){Array.isArray(t)||(t=[]),a.length>0&&t.push(Nn([0,0],a[0]));for(var e=0;e<a.length-1;e++){var i=a[e],s=a[e+1],o=i[0],n=i[1],r=s[0],h=s[1],c=[.75*o+.25*r,.75*n+.25*h],l=[.25*o+.75*r,.25*n+.75*h];t.push(c),t.push(l)}return a.length>1&&t.push(Nn([0,0],a[a.length-1])),t}});var qn=Be((ul,Yn)=>{var Ro=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let i=Number(e);if(isNaN(i))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(s=>(s.key===t&&Object.assign(s,{priority:i}),s)):(this.keys.add(t),this.queue.push({key:t,priority:i})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};Yn.exports=Ro});var Qn=Be((ml,Jn)=>{function $n(a,t){let e=new Map;for(let[i,s]of a)i!==t&&s instanceof Map?e.set(i,$n(s,t)):i!==t&&e.set(i,s);return e}Jn.exports=$n});var ir=Be((fl,er)=>{function eh(a){let t=Number(a);return!(isNaN(t)||t<=0)}function tr(a){let t=new Map;return Object.keys(a).forEach(i=>{let s=a[i];if(s!==null&&typeof s=="object"&&!Array.isArray(s))return t.set(i,tr(s));if(!eh(s))throw new Error(`Could not add node at key "${i}", make sure it's a valid node`,s);return t.set(i,Number(s))}),t}er.exports=tr});var nr=Be((gl,or)=>{function sr(a){if(!(a instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof a}`);a.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){sr(t);return}if(typeof t!="number"||t<=0)throw new Error(`Values must be numbers greater than 0. Found value ${t} at ${e}`)})}or.exports=sr});var Fo=Be((yl,hr)=>{var ih=qn(),sh=Qn(),rr=ir(),ar=nr(),Go=class{constructor(t){t instanceof Map?(ar(t),this.graph=t):t?this.graph=rr(t):this.graph=new Map}addNode(t,e){let i;return e instanceof Map?(ar(e),i=e):i=rr(e),this.graph.set(t,i),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=sh(this.graph,t),this}path(t,e,i={}){if(!this.graph.size)return i.cost?{path:null,cost:0}:null;let s=new Set,o=new ih,n=new Map,r=[],h=0,c=[];if(i.avoid&&(c=[].concat(i.avoid)),c.includes(t))throw new Error(`Starting node (${t}) cannot be avoided`);if(c.includes(e))throw new Error(`Ending node (${e}) cannot be avoided`);for(o.set(t,0);!o.isEmpty();){let l=o.next();if(l.key===e){h=l.priority;let d=l.key;for(;n.has(d);)r.push(d),d=n.get(d);break}s.add(l.key),(this.graph.get(l.key)||new Map).forEach((d,u)=>{if(s.has(u)||c.includes(u))return null;if(!o.has(u))return n.set(u,l.key),o.set(u,l.priority+d);let m=o.get(u).priority,v=l.priority+d;return v<m?(n.set(u,l.key),o.set(u,v)):null})}return r.length?(i.trim?r.shift():r=r.concat([t]),i.reverse||(r=r.reverse()),i.cost?{path:r,cost:h}:r):i.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};hr.exports=Go});var uc={};Na(uc,{AibeeLoader:()=>qe,BMap:()=>ln,BMapSelect:()=>vn,BaseSvg:()=>Bt,CarInertialPosition:()=>Ps,ClickHelper:()=>Ri,Context:()=>us,ContextCamera:()=>ds,ContextScene:()=>ps,Control:()=>cs,CrLoader:()=>cn,CrNavPath:()=>yn,Equipment:()=>pn,EventDispatcher:()=>st,Events:()=>ko,Floor:()=>ie,GlbModel:()=>qo,Graphic:()=>lt,GraphicLayer:()=>Hi,GroundTexture:()=>Ae,Heatmap:()=>kn,HeatmapElement:()=>$i,HighlightPoi:()=>Ln,HooksName:()=>yt,HoverHelper:()=>as,InstancedGraphic:()=>Xe,InstancedModel:()=>Ki,InstancedParkingSpace:()=>ii,InstancedWall:()=>ns,KalmanFilter:()=>Fi,Lane:()=>es,Layer:()=>q,LineElement:()=>ai,MapTypePolar:()=>Kh,MergeAttributeGraphic:()=>ri,MergeAttributeGroundTexture:()=>Oe,MergeAttributeLane:()=>os,MergeAttributeWall:()=>ss,MergeGraphic:()=>$o,MergedAttributeGraphicLine:()=>Ie,MergedGraphicLayer:()=>Yi,MergedModelLayer:()=>Vi,Model:()=>Ui,MulFloorNavigation:()=>xn,MulFloorSelect:()=>wn,MulFloors:()=>mn,NavPath:()=>ys,Navigation:()=>un,Overlay:()=>Ke,ParkingLayer:()=>ji,ParkingType:()=>Xh,PathDirection:()=>pe,PdrPosition:()=>ws,Poi:()=>De,Poi2:()=>tt,PoiLayer:()=>Ni,PoiLayer2:()=>Zi,Position:()=>Sn,RENDER_VERSION:()=>di,RecommendParkingSpace:()=>_n,Renderer:()=>ls,RoadNetwork:()=>zo,RoadNetwork2:()=>Oi,SENSOR_TYPE:()=>F,SatelliteTile:()=>Tn,SelectBox:()=>Yo,Selection:()=>rs,Sensor:()=>vs,Shadow:()=>Wi,Socket:()=>xi,SortByDistance:()=>Cn,SvgLine:()=>Ji,SvgPolygon:()=>Qi,TaskQueue:()=>Ve,TextTexture:()=>is,TileLayer:()=>Re,TileLoader:()=>qi,Timer:()=>j,TweenUtil:()=>_e,UA:()=>Co,UseMyPosition:()=>En,Wall:()=>ts,WorkerPool:()=>Gi,addAlphaToHexColor:()=>qa,calc_angle:()=>We,calc_direction:()=>Cs,calculateInstantaneousSpeed:()=>nc,calculateLineDirection:()=>Ms,convertToSnakeCase:()=>Bo,createCircle:()=>Qe,createLine:()=>ki,createRect:()=>Me,createSvg:()=>So,createSvgElement:()=>Ti,createThreeBox:()=>rh,createThreeLine:()=>nh,darkenColor:()=>ce,defaultConfig:()=>aa,defaultGraphicOptions:()=>fe,defaultOptions:()=>js,defaultTextTextureOptions:()=>Vr,deviceToVector3:()=>ja,dispose:()=>I,distancePointToSegment:()=>Ao,generatorKeyByObj:()=>Ce,getAngle:()=>Kn,getBorderPoints:()=>As,getCenter:()=>Ci,getConfig:()=>sn,getDirectPath:()=>Oo,getDirectionByAngle:()=>Ts,getDistanceByPathPos:()=>Io,getLength:()=>O,getLongestSideDir:()=>Va,getMinEdgeSquare:()=>Ka,getPathLength:()=>Et,getPointEdgeIndex:()=>he,getPosByPathDistance:()=>Ze,hasChinese:()=>Po,hexToRgb:()=>Ls,initDirectionalLight:()=>_o,initLight:()=>Mo,initShape:()=>Li,instancedGeometiesAttributes:()=>hh,isAndroid:()=>$a,isContain:()=>we,isControl:()=>Ne,isIphone:()=>le,isMac:()=>He,isPointInPolygon:()=>bo,isRectangle:()=>ch,loadBuildingGround:()=>an,loadExternalStreet:()=>jh,loadGraphics:()=>hn,mergeGraphicGeometries:()=>ah,mergeGraphicLineGeometries:()=>gr,moveOnRoute:()=>th,predictFuturePosition:()=>vi,predictFutureSpeed:()=>rc,proxyOptions:()=>Ue,removeOutliers:()=>ac,removeWeightPath:()=>Xn,setCirclePosition:()=>Le,setLineStartEnd:()=>jt,setRectPosition:()=>bt,simplifyPath:()=>Di,sleepByRf:()=>Lo,sleepOnePromise:()=>Eo,sleepOneRf:()=>Es,smoothPath:()=>Do,splitStrByBracket:()=>Wo,strToNumber:()=>Ya,timeoutPromise:()=>Gt,toWebWorker:()=>oh,transformGraphicData:()=>Ii,transformSpeed:()=>fo,translatePosToCenter:()=>je,triggerWorker:()=>Z,vector3ToDevice:()=>D,xhrGet:()=>Ja});module.exports=Za(uc);function w(){return w=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},w.apply(this,arguments)}var D0=require("core-js/modules/es.array.push.js"),A0=require("core-js/modules/web.dom-collections.iterator.js"),O0=require("core-js/modules/es.json.stringify.js"),Ht=require("three");var Wx=require("core-js/modules/web.dom-collections.iterator.js");var gc=require("core-js/modules/es.set.difference.v2.js"),yc=require("core-js/modules/es.set.intersection.v2.js"),vc=require("core-js/modules/es.set.is-disjoint-from.v2.js"),xc=require("core-js/modules/es.set.is-subset-of.v2.js"),wc=require("core-js/modules/es.set.is-superset-of.v2.js"),Mc=require("core-js/modules/es.set.symmetric-difference.v2.js"),_c=require("core-js/modules/es.set.union.v2.js"),Pc=require("core-js/modules/web.dom-collections.iterator.js"),j=class{requestAnimationFrame(t){let e=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(e),t()});return this.tasks.requestAnimation.add(e),e}cancelAnimationFrame(t){this.tasks.requestAnimation.delete(t),window.cancelAnimationFrame(t)}setTimeout(t,e){let i=window.setTimeout(()=>{this.tasks.timeout.delete(i),t()},e);return this.tasks.timeout.add(i),i}clearTimeout(t){this.tasks.timeout.delete(t),window.clearTimeout(t)}setInterval(t,e){let i=window.setInterval(()=>{t()},e);return this.tasks.interval.add(i),i}clearInterval(t){this.tasks.interval.delete(t),window.clearInterval(t)}requestIdleCallback(t,e){let i=window.requestIdleCallback(s=>{this.tasks.requestIdleCallback.delete(i),t(s)},e);return this.tasks.requestIdleCallback.add(i),i}cancelIdleCallback(t){this.tasks.requestIdleCallback.delete(t),window.cancelIdleCallback(t)}dispose(){this.tasks.requestAnimation.forEach(t=>{window.cancelAnimationFrame(t)}),this.tasks.requestAnimation.clear(),this.tasks.requestIdleCallback.forEach(t=>{window.cancelIdleCallback(t)}),this.tasks.requestIdleCallback.clear(),this.tasks.timeout.forEach(t=>{window.clearTimeout(t)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(t=>{window.clearInterval(t)}),this.tasks.interval.clear()}constructor(){this.tasks={requestAnimation:new Set,requestIdleCallback:new Set,timeout:new Set,interval:new Set}}};var Sc=require("core-js/modules/web.dom-collections.iterator.js"),Ec=require("core-js/modules/es.array.push.js"),Rt=require("three");function Mo(){let a=new Rt.Group,t=new Rt.AmbientLight(16777215,.3);return a.add(t),a}function Li(a,t){t===void 0&&(t=[]);let e=new Rt.Shape(a.map(i=>new Rt.Vector2(...i)));return t.length&&t.forEach(i=>{var s=new Rt.Path(i.map(o=>new Rt.Vector2(...o)));e.holes.push(s)}),e}function _o(a,t){a===void 0&&(a=16777215),t===void 0&&(t=1);let e=new Rt.DirectionalLight(a,t);return e.castShadow=!0,e.shadow.radius=8,e.shadow.bias=-.001,e.shadow.mapSize.set(256,256),e.shadow.camera.left=-200,e.shadow.camera.right=200,e.shadow.camera.top=200,e.shadow.camera.bottom=-200,e}function I(a,t){if(t&&a.children&&a.children.length&&a.children.forEach(e=>{I(e,t)}),a.isMesh){let e=a;e.geometry&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(i=>{i.dispose()}):e.material.dispose())}a.isLight&&(a.dispose==null||a.dispose.call(a))}var Tc=require("core-js/modules/es.regexp.exec.js");function Po(a){return/[\u4E00-\u9FA5]+/g.test(a)}var Dc=require("core-js/modules/web.dom-collections.iterator.js"),at=require("three"),Je=require("@turf/turf");function D(a,t,e,i){let s=a.clone().project(t),o=e/2,n=i/2,r=Math.round(s.x*o+o),h=Math.round(-s.y*n+n);return{x:r,y:h}}function ja(a,t,e,i,s){if(!s)return null;e=Math.min(1,e),i=Math.min(1,i);let o=a/e*2-1,n=1-t/i*2;return new at.Vector3(o,n,0).unproject(s)}function Ci(a){let t=(0,Je.featureCollection)(a.map(i=>(0,Je.point)(i)));return(0,Je.center)(t).geometry.coordinates}function we(a,t,e){return a.x>=t.x&&a.x<=e.x&&a.y>=t.y&&a.y<=e.y}function Va(a){let t=0,e=new at.Vector3;for(let i=1;i<a.length;i++){let s=new at.Vector3(a[i-1][0],a[i-1][1],0),o=new at.Vector3(a[i][0],a[i][1],0),n=o.distanceTo(s);n>t&&(t=n,e=o.clone().sub(s).normalize())}return e}function O(a,t){return Math.sqrt((t[0]-a[0])**2+(t[1]-a[1])**2)}function Et(a){let t=0;for(let e=0;e<a.length-1;e++)t+=O(a[e],a[e+1]);return t}function We(a,t,e){let i=new at.Vector2(t[0]-a[0],t[1]-a[1]),s=new at.Vector2(t[0]-e[0],t[1]-e[1]),n=i.angleTo(s)*180/Math.PI,r=new at.Vector2(t[0]-a[0],t[1]-a[1]);return new at.Vector2(e[0]-a[0],e[1]-a[1]).cross(r)>0?n:-n}function Ka(a,t){let e=Math.min(O(a[0][0],a[0][1]),O(a[0][2],a[0][1]))-1;t||(t=Ci(a[0]));let i=Xa(t,e),s=new at.Vector2(a[0][0][0],a[0][0][1]),o=new at.Vector2(a[0][1][0],a[0][1][1]),n=new at.Vector2(a[0][2][0],a[0][2][1]),h=(s.distanceTo(o)>o.distanceTo(n)?o.clone().sub(s):n.clone().sub(o)).angleTo(new at.Vector2(0,1)),c=new at.Matrix3;return c.multiply(new at.Matrix3().translate(t[0],t[1])).multiply(new at.Matrix3().rotate(h)).multiply(new at.Matrix3().translate(-t[0],-t[1])),[i.map(l=>{let p=new at.Vector2(l[0],l[1]).applyMatrix3(c);return[p.x,p.y]})]}function Xa(a,t){let e=t/2;return[[a[0]-e,a[1]+e],[a[0]+e,a[1]+e],[a[0]+e,a[1]-e],[a[0]-e,a[1]-e],[a[0]-e,a[1]+e]]}function he(a,t){let e=0,i=1/0,[s,o]=t;for(let n=0;n<a.length-1;n++){let[r,h]=a[n],[c,l]=a[n+1],p=Math.min(r,c)<=s&&s<=Math.max(r,c),d=Math.min(h,l)<=o&&o<=Math.max(h,l);if(p&&d){let u=Math.abs((c-r)*(o-h)-(l-h)*(s-r));u<i&&(i=u,e=n)}}return e}function bo(a,t){let e=a[0],i=a[1],s=!1;for(let o=0,n=t.length-1;o<t.length;n=o++){let r=t[o][0],h=t[o][1],c=t[n][0],l=t[n][1];h>i!=l>i&&e<(c-r)*(i-h)/(l-h)+r&&(s=!s)}return s}var Oc=require("core-js/modules/es.reflect.to-string-tag.js");function Ue(a,t){return new Proxy(a,{get:(e,i,s)=>Reflect.get(e,i,s),set:(e,i,s,o)=>{let n=Reflect.get(e,i,o),r=Reflect.set(e,i,s,o);return n!==s&&t.dispatchEvent({type:"change-"+i,value:s}),r}})}var Rc=require("core-js/modules/web.dom-collections.iterator.js"),Gc=require("core-js/modules/es.error.cause.js");function Gt(a,t){return Promise.race([a,new Promise((e,i)=>{setTimeout(()=>i(new Error("Promise timeout")),t)})])}function Ti(a){return document.createElementNS("http://www.w3.org/2000/svg",a)}function So(a,t){let e=Ti("svg");return e.setAttribute("width",a),e.setAttribute("height",t),e.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",e}function Qe(a,t){a===void 0&&(a="2");let e=Ti("circle");return e.setAttribute("r",a),e.setAttribute("fill",t),e}function ki(a){let t=Ti("line");return t.setAttribute("stroke",a),t}function Me(a,t){let e=Ti("rect");return e.setAttribute("stroke",a),e.setAttribute("fill",t),e}function Le(a,t,e){a.setAttribute("cx",""+t),a.setAttribute("cy",""+e)}function jt(a,t,e){t&&(a.setAttribute("x1",""+t.x),a.setAttribute("y1",""+t.y)),e&&(a.setAttribute("x2",""+e.x),a.setAttribute("y2",""+e.y))}function bt(a,t,e,i,s){a.setAttribute("x",""+t),a.setAttribute("y",""+e),a.setAttribute("width",""+i),a.setAttribute("height",""+s)}function Eo(){return Promise.resolve()}function Es(){return new Promise(a=>{requestAnimationFrame(a)})}function Lo(a){return a===void 0&&(a=1),new Promise(t=>{function e(){a<=0?t(!0):(a--,window.requestAnimationFrame(e))}window.requestAnimationFrame(e)})}var Wc=require("core-js/modules/es.string.replace.js"),Uc=require("core-js/modules/es.regexp.exec.js"),Hc=require("core-js/modules/es.string.trim.js");function Ya(a){return parseInt(a.replace("#","0x"),16)}function qa(a,t){let e=parseInt(a.substring(1,3),16),i=parseInt(a.substring(3,5),16),s=parseInt(a.substring(5,7),16),o=Math.round(e*t),n=Math.round(i*t),r=Math.round(s*t);return"#"+(1<<24|o<<16|n<<8|r).toString(16).slice(1)}function ce(a,t){t===void 0&&(t=.85);let e,i,s;if(a.startsWith("#"))e=parseInt(a.substring(1,3),16),i=parseInt(a.substring(3,5),16),s=parseInt(a.substring(5,7),16);else{let n=a.slice(4,-1).split(",");e=parseInt(n[0].trim()),i=parseInt(n[1].trim()),s=parseInt(n[2].trim())}return e=Math.min(Math.floor(e*t),255),i=Math.min(Math.floor(i*t),255),s=Math.min(Math.floor(s*t),255),"#"+((1<<24)+(e<<16)+(i<<8)+s).toString(16).slice(1)}function Ls(a,t){a=a.replace(/^#/,"");let e=parseInt(a.substring(0,2),16),i=parseInt(a.substring(2,4),16),s=parseInt(a.substring(4,6),16);return t!==void 0?"rgba("+e+", "+i+", "+s+", "+t+")":"rgb("+e+", "+i+", "+s+")"}var Zc=require("core-js/modules/es.regexp.exec.js"),He=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,Co=(navigator.userAgent||"").toLocaleLowerCase(),le=/ios|iphone/i.test(Co),$a=/android|adr|linux/gi.test(Co);function Ne(a){return He?a==="Meta":a==="Control"}var Xc=require("core-js/modules/es.set.difference.v2.js"),Yc=require("core-js/modules/es.set.intersection.v2.js"),qc=require("core-js/modules/es.set.is-disjoint-from.v2.js"),$c=require("core-js/modules/es.set.is-subset-of.v2.js"),Jc=require("core-js/modules/es.set.is-superset-of.v2.js"),Qc=require("core-js/modules/es.set.symmetric-difference.v2.js"),tl=require("core-js/modules/es.set.union.v2.js"),el=require("core-js/modules/web.dom-collections.iterator.js"),To="__once__",ko=class{on(t,e){if(typeof e!="function")return;let i=this.events.get(t);return i?i.add(e):this.events.set(t,new Set([e]))}once(t,e){if(typeof e!="function")return;let i=""+To+t,s=this.events.get(i);return s?s.add(e):this.events.set(i,new Set([e]))}off(t,e){let i=this.events.get(t),s=this.events.get(""+To+t);!i&&!s||(e===void 0&&(i==null||i.clear(),s==null||s.clear()),i!=null&&i.has(e)&&i.delete(e),s!=null&&s.has(e)&&s.delete(e))}offAll(){this.events.clear()}emit(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];let o=this.events.get(t),n=this.events.get(""+To+t);!o&&!n||(o==null||o.forEach(r=>{typeof r=="function"&&r(...i)}),n==null||n.forEach(r=>{typeof r=="function"&&r(...i)}),n==null||n.clear())}constructor(){this.events=new Map}};var yt=function(a){return a.SWITCH_FLOOR_BEFORE="switch_floor_before",a.SWITCH_FLOOR_GROUND="switch_floor_ground",a.SWITCH_FLOOR_AFTER="switch_floor_after",a}({});var ol=require("core-js/modules/es.array.sort.js");function Ce(a){return Object.keys(a).sort().map(t=>t+"="+a[t]).join("&")}function Ja(a,t){return new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",a,!0),Object.keys(t.headers||{}).forEach(o=>{s.setRequestHeader(o,t.headers[o])}),t.responseType&&(s.responseType=t.responseType),s.onload=()=>{if(s.status>=200&&s.status<300)if(t.responseType==="arraybuffer")e(s.response);else try{let o=JSON.parse(s.responseText);e(o)}catch(o){i(o)}else i(s.statusText)},s.onerror=()=>{i(s.statusText)},s.send()})}var cl=require("core-js/modules/web.dom-collections.iterator.js"),ll=require("core-js/modules/es.array.push.js"),ti=require("three"),Vn=wo(jn(),1);function Kn(a,t){let e=a.clone().normalize(),i=t.clone().normalize();return Math.acos(e.dot(i))}function Qa(a){let t=0;return a.reduce((e,i)=>{let[s,o]=e,[n,r]=i;return t+=Math.sqrt((n-s)**2+(r-o)**2),[n,r]}),t/a.length}function Do(a,t){if(t===void 0&&(t=.25),Qa(a)<t)return a;let e=(0,Vn.default)(a);return Do(e,t)}function Di(a,t,e,i,s,o){t===void 0&&(t=!1),e===void 0&&(e=!0),i===void 0&&(i=5),s===void 0&&(s=150),o===void 0&&(o=3);let n=[],r=!t;if(n.push(a[0]),a.length<2)return n;for(let c=0;c<a.length-2;c+=1){let l=a[c],p=a[c+1],d=a[c+2],u=new ti.Vector2(l[0]-p[0],l[1]-p[1]),m=new ti.Vector2(d[0]-p[0],d[1]-p[1]),v=Kn(u,m)/Math.PI*180,g=u.length()+m.length();(!r||v<s&&g>.01||g>i)&&(n.push(a[c+1]),r=!0)}if(n.push(a[a.length-1]),!e)return n;let h=[];h.push(n[0]);for(let c=0;c<n.length-2;c+=1){let l=new ti.Vector2(n[c][0],n[c][1]),p=new ti.Vector2(n[c+1][0],n[c+1][1]),d=new ti.Vector2(n[c+2][0],n[c+2][1]),u=l.distanceTo(p)/2,m=d.distanceTo(p)/2,v=p.clone(),g=p.clone();v.add(l.clone().sub(p).normalize().multiplyScalar(u>o?o/2:u)),g.add(d.clone().sub(p).normalize().multiplyScalar(m>o?o/2:m));let x=[[v.x,v.y],[p.x,p.y],[g.x,g.y]];h.push(...Do(x,o/25))}return h.push(n[n.length-1]),Xn(h)}function Xn(a){if(a.length<=1)return a;let t=[],e;return a.forEach(i=>{let[s,o]=i;e?s===e[0]&&o===e[1]||(e=[s,o],t.push([s,o])):(e=[s,o],t.push([s,o]))}),t}function Ao(a,t,e){let i=Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2);if(i===0)return{distance:Math.sqrt((a[0]-t[0])**2+(a[1]-t[1])**2),closestPoint:t.slice(0)};let s=Math.max(0,Math.min(1,((a[0]-t[0])*(e[0]-t[0])+(a[1]-t[1])*(e[1]-t[1]))/i**2)),o=[t[0]+s*(e[0]-t[0]),t[1]+s*(e[1]-t[1])];return{distance:Math.sqrt((a[0]-o[0])**2+(a[1]-o[1])**2),closestPoint:o}}function th(a,t,e){let[i,s]=a,[o,n]=t,r=Math.sqrt(Math.pow(o-i,2)+Math.pow(n-s,2));if(r===0||r<e)return[...t];let h=e/r,c=i+(o-i)*h,l=s+(n-s)*h;return[c,l]}var pe=function(a){return a.START="start",a.END="end",a.FRONT="front",a.RIGHT="right",a.LEFT="left",a.RIGHT_FRONT="right_front",a.LEFT_FRONT="left_front",a.RIGHT_BACK="right_back",a.LEFT_BACK="left_back",a}({});function Cs(a,t,e){let i=We(a,t,e);return Ts(i)}function Ts(a){return 180-Math.abs(a)<15?"front":a>135?"right_front":a<-135?"left_front":a<=135&&a>=60?"right":a>=-135&&a<=-60?"left":a<60&&a>0?"right_back":a>-60&&a<0?"left_back":"front"}function Oo(a){if(!a.length)return[];if(a.length===1)return[{direction:"start",distance:0,points:a}];let t=[{direction:"start",distance:O(a[0],a[1]),points:[a[0],a[1]]}];for(let e=2;e<a.length;e++){let i=Cs(a[e-2],a[e-1],a[e]);if(i==="front"){let s=t[t.length-1],o=O(a[e-1],a[e]);s.distance+=o,e!==2&&s.points.push(a[e-1])}else t.push({direction:i,distance:O(a[e-1],a[e]),points:[a[e-1],a[e]]})}return t.push({direction:"end",distance:0,points:[a[a.length-1]]}),t}function Io(a,t){if(a.length<2)return-1;let e=0;for(let i=1;i<a.length;i++){let s=a[i-1],o=a[i],n=[t[0]-s[0],t[1]-s[1]],r=[o[0]-s[0],o[1]-s[1]],h=Math.min(o[0],s[0])<=t[0]&&t[0]<=Math.max(o[0],s[0]),c=Math.min(o[1],s[1])<=t[1]&&t[1]<=Math.max(o[1],s[1]);if(h&&c){let l=n[0]*r[1]-n[1]*r[0];if(Math.abs(l)<1e-6){let p=Math.sqrt((t[0]-s[0])**2+(t[1]-s[1])**2);return e+p}}e+=Math.sqrt((o[0]-s[0])**2+(o[1]-s[1])**2)}return-1}function Ze(a,t){if(a.length<2){var e;return(e=a[0])!=null?e:null}let i=0;for(let s=1;s<a.length;s++){let o=a[s-1],n=a[s],r=Math.sqrt((n[0]-o[0])**2+(n[1]-o[1])**2);if(i+=r,i>=t){let h=(t-(i-r))/r,c=o[0]+(n[0]-o[0])*h,l=o[1]+(n[1]-o[1])*h;return[c,l]}}return null}var xl=require("core-js/modules/es.array.push.js"),wl=require("core-js/modules/web.dom-collections.iterator.js"),Ml=require("core-js/modules/es.regexp.exec.js"),de=wo(Fo(),1);var Vt="___",zo=class{initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(i=>{let s=""+e.floor+Vt+i.id;if(this.pointMap.set(s,i),this.nodeMap.set(""+i.floor+Vt+i.nodeId,s),i.type==="straightLadder"){let o=this.straightLadderMap.get(i.name)||[];o.push(w({},i)),this.straightLadderMap.set(i.name,o)}if(i.type==="staircase"){let o=this.staircaseMap.get(i.name)||[];o.push(w({},i)),this.staircaseMap.set(i.name,o)}if(i.type==="escalator"){let o=this.escalatorMap.get(i.name)||{};i.escalatorDirection==="exit"?o.end={floor:i.floor,id:i.id}:o.start={floor:i.floor,id:i.id},this.escalatorMap.set(i.name,o)}if(i.type==="facility"){let o=this.facilityMap.get(i.targetId)||[];o.push(w({},i)),this.facilityMap.set(i.targetId,o)}}),e.lines.filter(i=>i.direction!=="no").forEach(i=>{var s,o;let n=""+e.floor+Vt+i.from,r=""+e.floor+Vt+i.to,h=(s=this.pointMap.get(n))==null?void 0:s.cds,c=(o=this.pointMap.get(r))==null?void 0:o.cds;if(h!=null&&h.length&&(c!=null&&c.length)){let l=O(h,c);this.addLineItem(n,r,l),i.direction==="double"&&this.addLineItem(r,n,l)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(t,e,i,s){s===void 0&&(s=this.lineMap);let o=s.get(t)||new Map;o.set(e,i),s.set(t,o)}addFacilityToLineMap(t,e,i,s){[...this.straightLadderMap,...this.staircaseMap].forEach(o=>{let[n,r]=o;if(!(r.length<2))for(let l=0;l<r.length;l++){let p=""+r[l].floor+Vt+r[l].id;for(let d=0;d<r.length;d++)if(l!==d){var h,c;let u=""+r[d].floor+Vt+r[d].id,m=(h=this.pointMap.get(p))==null?void 0:h.cds,v=(c=this.pointMap.get(u))==null?void 0:c.cds;if(m!=null&&m.length&&(v!=null&&v.length))if(r[l].type==="straightLadder"){let g=e;this.addLineItem(p,u,g,s)}else{let g=i;this.addLineItem(p,u,g,s)}}}}),this.escalatorMap.forEach((o,n)=>{if(o.start&&o.end){var r,h;let c=""+o.start.floor+Vt+o.start.id,l=""+o.end.floor+Vt+o.end.id,p=(r=this.pointMap.get(c))==null?void 0:r.cds,d=(h=this.pointMap.get(l))==null?void 0:h.cds;if(p!=null&&p.length&&(d!=null&&d.length)){let u=t;this.addLineItem(c,l,u,s)}}})}initBaseRoute(){let t=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,t),this.baseRoute=new de.default(t)}initEscalatorRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new de.default(t)}initStraightLadderRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new de.default(t)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility?!0:this.checkStart(t)}transformStart(t){var e;if(t.nodeId){let i=this.nodeMap.get(""+t.floor+Vt+t.nodeId);if(i){let[s,o]=i.split(Vt);return{floor:s,id:o}}}if((e=t.coord)!=null&&e.length){let i=this.roadInfo.find(o=>o.floor===t.floor);if(!i)return null;let s=i.points.reduce((o,n)=>{let r=O(t.coord,n.cds);return r<o.min&&(o.min=r,o.point=n),o},{min:1/0,point:i.points[0]});return{floor:s.point.floor,id:s.point.id}}return null}transformEnd(t){if(t.floor){let e=this.transformStart(t);if(e)return e}if(t.facility){let e=this.facilityMap.get(t.facility);if(e!=null&&e.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,i){if(i===void 0&&(i=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let s=this.transformStart(t);if(!s)return"no-start";let o=this.transformEnd(e);if(!o)return"no-end";let n=this.getBasePath.bind(this);switch(i){case"escalator":n=this.getEscalatorPath.bind(this);break;case"straightLadder":n=this.getStraightLadderPath.bind(this);break;default:n=this.getBasePath.bind(this);break}if(o.id)return n(s,o);if(o.facility){let r=this.facilityMap.get(o.facility).filter(c=>o.floor?c.floor===o.floor:!0);if(!r.length)return null;let h=r.map(c=>n(s,{floor:c.floor,id:c.id})).filter(c=>!!c);return h.reduce((c,l)=>{let p=l.reduce((d,u)=>d+Et(u.points),0);return p<c.distance&&(c.distance=p,c.path=l),c},{distance:1/0,path:h[0]}).path}}getRoutePath(t,e,i){let s=""+t.floor+Vt+t.id,o=""+e.floor+Vt+e.id,n=i.path(s,o);if(!n)return null;let r=[];return n.map(h=>{let c=this.pointMap.get(h);if(c){var l;let{floor:p}=c;if(((l=r[r.length-1])==null?void 0:l.floor)===p){let d=r[r.length-1];d.points.push(c.cds),d.endType=c.type,d.destId=c.nodeId,d.distance=Et(d.points)}else r.push({floor:p,points:[c.cds],endType:c.type,destId:c.nodeId,distance:0})}}),r}getBasePath(t,e){return this.getRoutePath(t,e,this.baseRoute)}getEscalatorPath(t,e){return this.getRoutePath(t,e,this.escalatorRoute)}getStraightLadderPath(t,e){return this.getRoutePath(t,e,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new de.default,this.escalatorRoute=new de.default,this.straightLadderRoute=new de.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.staircaseMap=new Map,this.lineMap=new Map,this.baseRoute=new de.default,this.escalatorRoute=new de.default,this.straightLadderRoute=new de.default}};var Sl=require("core-js/modules/web.dom-collections.iterator.js"),El=require("core-js/modules/es.regexp.exec.js"),Ll=require("core-js/modules/es.array.push.js"),Cl=require("core-js/modules/es.set.difference.v2.js"),Tl=require("core-js/modules/es.set.intersection.v2.js"),kl=require("core-js/modules/es.set.is-disjoint-from.v2.js"),Dl=require("core-js/modules/es.set.is-subset-of.v2.js"),Al=require("core-js/modules/es.set.is-superset-of.v2.js"),Ol=require("core-js/modules/es.set.symmetric-difference.v2.js"),Il=require("core-js/modules/es.set.union.v2.js"),Rl=require("core-js/modules/es.array.flat.js"),Gl=require("core-js/modules/es.array.unscopables.flat.js"),vt=wo(Fo(),1);var Ai=require("lodash"),ks=require("three"),A="___";function Te(a){let t=new Map;return a.forEach((e,i)=>{t.set(i,new Map(e))}),t}var Oi=class{setLiftPriority(t){this.lift_priority=t}isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let i=[];try{i=JSON.parse(e.entry_end_floor)}catch(o){i=[]}let s=[];try{s=JSON.parse(e.entry_start_floor)}catch(o){s=[]}return w({},e,{entry_start_floor:s,entry_end_floor:i})})}getParkingSpaceInfo(t,e){let i=""+t+A+e;var s;return(s=this.parkingMap.get(i))!=null?s:null}getNodeInfo(t,e){let i=""+t+A+e,s=this.nodeMap.get(i);if(!(s!=null&&s.length))return null;let o=this.pointMap.get(s[0]);return o!=null?o:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let i=new Date,s=i.getHours()*60+i.getMinutes();t.length&&(t.forEach(o=>{let n=(o.points||[]).filter(r=>!(0,Ai.isNil)(r.passWeight)&&r.passWeight!==1&&!(0,Ai.isNil)(r.coverageArea)&&r.coverageArea!==0);(o.points||[]).filter(r=>r.openStatus!==!1).filter(r=>{if(!r.startTime||!r.endTime)return!0;let[h,c]=r.startTime.split(":").map(m=>+m),[l,p]=r.endTime.split(":").map(m=>+m),d=h*60+c,u=l*60+p;return s>=d&&s<=u}).forEach(r=>{r.floor=o.floor;let h=""+o.floor+A+r.id,c=""+o.floor+A+r.nodeId,l=this.nodeMap.get(c)||[];if(l.push(""+o.floor+A+(r.relatedId||r.id)),this.nodeMap.set(""+o.floor+A+r.nodeId,l),this.pointMap.set(h,r),this.isFacilityByType(r.type)){let p=this.facilities.find(d=>d.id===+r.targetId);if(p){switch(p.entry_infra_type){case"straightLadder":if(p.entry_end_floor.find(g=>g.floor===o.floor)&&p.entry_start_floor.find(g=>g.floor===o.floor)){let g=this.straightLadderMap.get(r.targetId)||[];g.push(w({},r)),this.straightLadderMap.set(r.targetId,g)}break;case"staircase":if(p.entry_end_floor.find(g=>g.floor===o.floor)&&p.entry_start_floor.find(g=>g.floor===o.floor)){let g=this.staircaseMap.get(r.targetId)||[];g.push(w({},r)),this.staircaseMap.set(r.targetId,g)}break;case"escalator":let u=this.escalatorMap.get(r.targetId)||[];if(p.entry_start_floor.find(g=>g.floor===o.floor)){let g=u.find(x=>{var M;return((M=x.end)==null?void 0:M.floor)!==o.floor&&!x.start});g?g.start=r:u.push({start:r})}if(p.entry_end_floor.find(g=>g.floor===o.floor)){let g=u.find(x=>{var M;return((M=x.start)==null?void 0:M.floor)!==o.floor&&!x.end});g?g.end=r:u.push({end:r})}this.escalatorMap.set(r.targetId,u);break;case"ramp":let m=this.rampMap.get(r.targetId)||[];if(p.entry_start_floor.find(g=>g.floor===o.floor)){let g=m.find(x=>{var M;return((M=x.end)==null?void 0:M.floor)!==o.floor&&!x.start});g?g.start=r:m.push({start:r})}if(p.entry_end_floor.find(g=>g.floor===o.floor)){let g=m.find(x=>{var M;return((M=x.start)==null?void 0:M.floor)!==o.floor&&!x.end});g?g.end=r:m.push({end:r})}this.rampMap.set(r.targetId,m);break;case"connectionPoint":let v=this.connectionPointMap.get(r.targetId)||[];if(p.entry_start_floor.find(g=>g.floor===o.floor)){let g=v.find(x=>{var M;return((M=x.end)==null?void 0:M.floor)!==o.floor&&!x.start});g?g.start=r:v.push({start:r})}if(p.entry_end_floor.find(g=>g.floor===o.floor)){let g=v.find(x=>{var M;return((M=x.start)==null?void 0:M.floor)!==o.floor&&!x.end});g?g.end=r:v.push({end:r})}this.connectionPointMap.set(r.targetId,v);break}let d=this.facilityMap.get(r.targetId)||[];d.push(w({},r)),this.facilityMap.set(r.targetId,d)}}r.type==="parkingSpace"&&r.name.split(/[,,]/).forEach(d=>{this.parkingMap.set(""+o.floor+A+d,r)})}),(o.lines||[]).filter(r=>r.to!==r.from).forEach(r=>{let h=""+o.floor+A+r.from,c=""+o.floor+A+r.to,l=this.pointMap.get(h),p=this.pointMap.get(c);if(!l||!p)return;let d=l.cds,u=p.cds,m=O(d,u);if(n.forEach(v=>{(v.id===r.from||v.id===r.to)&&(m=m/v.passWeight);let g=O(d,v.cds)<=v.coverageArea,x=O(u,v.cds)<=v.coverageArea;(g||x)&&(m=m/v.passWeight)}),!l.permission&&!p.permission){switch(r.direction){case"single-people":this.addLineItem(h,c,m);break;case"back-people":this.addLineItem(c,h,m);break;default:this.addLineItem(h,c,m),this.addLineItem(c,h,m)}switch(r.direction){case"double":this.addLineItem(h,c,m,this.forwardLineMap),this.addLineItem(c,h,m,this.forwardLineMap);break;case"single":this.addLineItem(h,c,m,this.forwardLineMap);break;case"back":this.addLineItem(c,h,m,this.forwardLineMap);break}(l.type==="parkingSpace"||p.type==="parkingSpace")&&r.direction==="noDir"&&(this.addLineItem(h,c,m,this.forwardLineMap),this.addLineItem(c,h,m,this.forwardLineMap))}else l.permission&&this.setPermissionLine(h,c,l.permission,m,"",r.direction),p.permission&&p.permission!==l.permission&&this.setPermissionLine(h,c,p.permission,m,"",r.direction)})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,i,s,o,n){this.getPermissionMap(i).add({fromKey:t,toKey:e,distance:s,type:o,direction:n})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let i=0;i<t.length;i++){let s=""+t[i].floor+A+t[i].id,o=this.pointMap.get(s);if(o){for(let n=0;n<t.length;n++)if(i!==n){let r=""+t[n].floor+A+t[n].id,h=this.pointMap.get(r);if(!h)continue;o.permission&&this.setPermissionLine(s,r,o.permission,1,"straightLadder"),h.permission&&h.permission!==o.permission&&this.setPermissionLine(s,r,h.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let i=0;i<t.length;i++){let s=""+t[i].floor+A+t[i].id,o=this.pointMap.get(s);if(o){for(let n=0;n<t.length;n++)if(i!==n){let r=""+t[n].floor+A+t[n].id,h=this.pointMap.get(r);if(!h)continue;o.permission&&this.setPermissionLine(s,r,o.permission,1,"staircase"),h.permission&&h.permission!==o.permission&&this.setPermissionLine(s,r,h.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(i=>{if(i.start&&i.end){let s=""+i.start.floor+A+i.start.id,o=""+i.end.floor+A+i.end.id,n=this.pointMap.get(s),r=this.pointMap.get(o);n&&r&&(n.permission&&this.setPermissionLine(s,o,n.permission,1,"escalator"),r.permission&&r.permission!==n.permission&&this.setPermissionLine(s,o,r.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(i=>{if(i.start&&i.end){let s=""+i.start.floor+A+i.start.id,o=""+i.end.floor+A+i.end.id,n=this.pointMap.get(s),r=this.pointMap.get(o);n&&r&&(n.permission&&this.setPermissionLine(s,o,n.permission,10,"ramp"),r.permission&&r.permission!==n.permission&&this.setPermissionLine(s,o,r.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{t.forEach(i=>{if(i.start&&i.end){let s=""+i.start.floor+A+i.start.id,o=""+i.end.floor+A+i.end.id,n=this.pointMap.get(s),r=this.pointMap.get(o);n&&r&&(n.permission&&this.setPermissionLine(s,o,n.permission,1,"connectionPoint"),r.permission&&r.permission!==n.permission&&this.setPermissionLine(s,o,r.permission,1,"connectionPoint"))}})})}addPermissionLineToMap(t,e,i,s){this.getPermissionMap(t).forEach(n=>{if(e.includes(n.type))if(n.type==="")switch(n.direction){case"single":this.addLineItem(n.fromKey,n.toKey,n.distance,i);break;case"back":this.addLineItem(n.toKey,n.fromKey,n.distance,i);break;case"single-people":this.addLineItem(n.fromKey,n.toKey,n.distance,i);break;case"back-people":this.addLineItem(n.toKey,n.fromKey,n.distance,i);break;default:this.addLineItem(n.fromKey,n.toKey,n.distance,i),this.addLineItem(n.toKey,n.fromKey,n.distance,i);break}else this.addLineItem(n.fromKey,n.toKey,s.get(n.type),i)})}addLineItem(t,e,i,s){s===void 0&&(s=this.lineMap);let o=s.get(t)||new Map;o.set(e,i),s.set(t,o)}addFacilityToLineMap(t,e,i,s){[...this.straightLadderMap,...this.staircaseMap].forEach(o=>{let[n,r]=o;if(!(r.length<2))for(let h=0;h<r.length;h++){let c=""+r[h].floor+A+r[h].id,l=this.pointMap.get(c);if(!(!l||l.permission)){for(let p=0;p<r.length;p++)if(h!==p){let d=""+r[p].floor+A+r[p].id,u=this.pointMap.get(d);if(!u||u.permission)continue;if(r[h].type==="straightLadder"){let m=e;this.addLineItem(c,d,m,s)}else{let m=i;this.addLineItem(c,d,m,s)}}}}}),this.escalatorMap.forEach((o,n)=>{o.forEach(r=>{if(r.start&&r.end){let h=""+r.start.floor+A+r.start.id,c=""+r.end.floor+A+r.end.id,l=this.pointMap.get(h),p=this.pointMap.get(c);if(l&&p&&!l.permission&&!p.permission){let d=t;this.addLineItem(h,c,d,s)}}})}),this.connectionPointMap.forEach((o,n)=>{o.forEach(r=>{if(r.start&&r.end){let h=""+r.start.floor+A+r.start.id,c=""+r.end.floor+A+r.end.id,l=this.pointMap.get(h),p=this.pointMap.get(c);l&&p&&!l.permission&&!p.permission&&this.addLineItem(h,c,100,s)}})})}initBaseRoute(){let t=new Map(Te(this.lineMap));this.addFacilityToLineMap(100,100*this.lift_priority,3e4,t),this.baseRoute=new vt.default(t)}initEscalatorRoute(){let t=new Map(Te(this.lineMap)),e=1e4;this.addFacilityToLineMap(100,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new vt.default(t)}initStraightLadderRoute(){let t=new Map(Te(this.lineMap)),e=1e4;this.addFacilityToLineMap(3*e,300,3e4*e,t),this.straightLadderRoute=new vt.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(i=>{if(i.start&&i.end){let s=""+i.start.floor+A+i.start.id,o=""+i.end.floor+A+i.end.id,n=this.pointMap.get(s),r=this.pointMap.get(o);n&&r&&!n.permission&&!r.permission&&this.addLineItem(s,o,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{t.forEach(i=>{if(i.start&&i.end){let s=""+i.start.floor+A+i.start.id,o=""+i.end.floor+A+i.end.id,n=this.pointMap.get(s),r=this.pointMap.get(o);n&&r&&!n.permission&&!r.permission&&this.addLineItem(s,o,100,this.forwardLineMap)}})}),this.forwardRoute=new vt.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t,e,i){i===void 0&&(i={});var s;if(t.nodeId){let o=this.nodeMap.get(""+t.floor+A+t.nodeId);if(o!=null&&o.length)return o.map(n=>{let[r,h]=n.split(A);return{floor:r,id:h}})}if((s=t.coord)!=null&&s.length){let o=this.roadInfo.find(c=>c.floor===t.floor);if(!o)return null;let n=o.points.filter(c=>c.isStarted),r=o.points.filter(c=>{let l=""+c.floor+A+c.id;if(e==="forward"){if(!this.forwardLineMap.has(l)||i.adsorptionIntersection&&n.length&&!c.isStarted)return!1}else if(!this.lineMap.has(l))return!1;return!0});if(!r.length)return null;let h=r.reduce((c,l)=>{if(l.relatedId)return c;let p=O(t.coord,l.cds);return p<c.min&&(c.min=p,c.point=l),c},{min:1/0,point:r[0]});return[{floor:o.floor,id:h.point.id}]}return null}transformEnd(t,e){if(t.floor){if(t.parkingSpace){let s=this.parkingMap.get(""+t.floor+A+t.parkingSpace);if(s)return[{floor:t.floor,id:s.id}]}let i=this.transformStart(t,e);if(i)return i}if(t.facility){let s=this.facilities.filter(o=>+o.type_id==+t.facility).map(o=>o.id).map(o=>this.facilityMap.get(""+o)).flat(2);if(s!=null&&s.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,i,s,o,n){if(i===void 0&&(i=""),n===void 0&&(n={}),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let r=this.transformStart(t,i,n);if(!r)return"no-start";let h=this.transformEnd(e,i);if(!h)return"no-end";let c=[];if(Array.isArray(h))for(let d=0;d<r.length;d++){let u=r[d];for(let m=0;m<h.length;m++){let v=h[m];if(u.floor===v.floor&&u.id===v.id)return"near"}}else{c=this.facilities.filter(u=>+u.type_id==+e.facility).map(u=>u.id).map(u=>this.facilityMap.get(""+u)).flat(2).filter(u=>u).filter(u=>h.floor?u.floor===h.floor:!0);for(let u=0;u<r.length;u++){let m=r[u];for(let v=0;v<c.length;v++){let g=c[v];if(m.floor===g.floor&&m.id===g.id)return"near"}}}let l;switch(i){case"escalator":l=this.getEscalatorPath.bind(this);break;case"straightLadder":l=this.getStraightLadderPath.bind(this);break;case"forward":l=this.getForwardPath.bind(this);break;default:l=this.getBasePath.bind(this);break}let p=null;return r.forEach(d=>{if(Array.isArray(h))h.forEach(u=>{let m=l(d,u,s,o);m&&m&&(!p||m[0].consume<p[0].consume)&&(p=m)});else{if(!c.length)return null;let u=c.map(m=>l(d,{floor:m.floor,id:m.id},s,o)).filter(m=>!!m);p=u.reduce((m,v)=>{let g=v[0].consume;return g<m.distance&&(m.distance=g,m.path=v),m},{distance:1/0,path:u[0]}).path}}),p}getRoutePath(t,e,i){let s=""+t.floor+A+t.id,o=this.pointMap.get(s),n=""+e.floor+A+e.id,r=this.pointMap.get(n);if(!o||!r)return null;let h=""+o.floor+A+(o.relatedId||o.id),c=""+r.floor+A+(r.relatedId||r.id),l=i.path(h,c);if(!l)return null;let p=[],d=l.reduce((u,m,v,g)=>{if(v===0)return 0;let x=g[v-1],M=i.graph.get(x).get(m);return u+M},0);return l.map(u=>{let m=this.pointMap.get(u);if(m){var v;let{floor:g}=m,x=m.type;if(this.isFacilityByType(m.type)){let M=this.facilities.find(P=>P.id===+m.targetId);M&&(x=M.entry_infra_type)}if(((v=p[p.length-1])==null?void 0:v.floor)===g){let M=p[p.length-1];M.points.push(m.cds),M.pointInfos.push(m),M.endType=x,M.destId=m.nodeId,M.distance=Et(M.points)}else p.push({floor:g,points:[m.cds],pointInfos:[m],endType:x,destId:m.nodeId,distance:0,consume:d})}}),p}getBasePath(t,e,i){if(!i)return this.getRoutePath(t,e,this.baseRoute);let s=Te(this.baseRoute.graph),o=r=>{this.addPermissionLineToMap(r,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100*this.lift_priority],["staircase",3e4]]))};Array.isArray(i)?i.forEach(r=>{o(r)}):o(i);let n=new vt.default(s);return this.getRoutePath(t,e,n)}getEscalatorPath(t,e,i){if(!i)return this.getRoutePath(t,e,this.escalatorRoute);let s=Te(this.escalatorRoute.graph),o=1e4,n=h=>{this.addPermissionLineToMap(h,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",100],["connectionPoint",100],["straightLadder",this.lift_priority*o],["staircase",3e4*o]]))};Array.isArray(i)?i.forEach(h=>{n(h)}):n(i);let r=new vt.default(s);return this.getRoutePath(t,e,r)}getStraightLadderPath(t,e,i){if(!i)return this.getRoutePath(t,e,this.straightLadderRoute);let s=Te(this.straightLadderRoute.graph),o=1e4,n=h=>{this.addPermissionLineToMap(h,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",3*o],["connectionPoint",100],["straightLadder",300],["staircase",3e4*o]]))};Array.isArray(i)?i.forEach(h=>{n(h)}):n(i);let r=new vt.default(s);return this.getRoutePath(t,e,r)}getForwardPath(t,e,i,s){let o=new Map,n=u=>{let m=this.forwardRoute.graph.get(h);u.forEach(v=>{let g=m.get(v);(0,Ai.isNil)(g)||(o.set(v,g),m.delete(v))})},r=()=>{let u=this.forwardRoute.graph.get(h);o.forEach((m,v)=>{u.set(v,m)})},h=""+t.floor+A+t.id;if(!(0,Ai.isNil)(s)){let u=this.forwardLineMap.get(h),m=this.pointMap.get(h);if(m&&(u!=null&&u.size)&&u.size>1){let v=new ks.Vector2(m.cds[0],m.cds[1]),g=new Map;u.forEach((M,P)=>{let C=this.pointMap.get(P);if(C){let S=new ks.Vector2(C.cds[0],C.cds[1]),E=360-(new ks.Vector2().subVectors(S,v).angle()/Math.PI*180-90+360)%360;g.set(P,E)}});let x=Array.from(g).filter(M=>{let[P,C]=M;return Math.abs(C-s)<=60}).map(M=>{let[P]=M;return P});if(x.length)x.forEach(M=>g.delete(M)),n([...g.keys()]);else{let M=Array.from(g).reduce((P,C)=>{let S=Math.abs(C[1]-s);return S<P.diff?{diff:S,key:C[0]}:P},{diff:1/0,key:""});g.delete(M.key),n([...g.keys()])}}}if(!i){let u=this.getRoutePath(t,e,this.forwardRoute);return r(),u||this.getRoutePath(t,e,this.forwardRoute)}let c=Te(this.forwardRoute.graph),l=u=>{this.addPermissionLineToMap(u,["","ramp"],c,new Map([["ramp",10]]))};Array.isArray(i)?i.forEach(u=>{l(u)}):l(i);let p=new vt.default(c),d=this.getRoutePath(t,e,p);if(r(),d)return d;{let u=Te(this.forwardRoute.graph);Array.isArray(i)?i.forEach(g=>{l(g)}):l(i);let m=new vt.default(u);return this.getRoutePath(t,e,m)}}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new vt.default,this.escalatorRoute=new vt.default,this.straightLadderRoute=new vt.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.baseRoute=new vt.default,this.escalatorRoute=new vt.default,this.straightLadderRoute=new vt.default,this.forwardLineMap=new Map,this.forwardRoute=new vt.default}};var Bl=require("core-js/modules/es.set.difference.v2.js"),Wl=require("core-js/modules/es.set.intersection.v2.js"),Ul=require("core-js/modules/es.set.is-disjoint-from.v2.js"),Hl=require("core-js/modules/es.set.is-subset-of.v2.js"),Nl=require("core-js/modules/es.set.is-superset-of.v2.js"),Zl=require("core-js/modules/es.set.symmetric-difference.v2.js"),jl=require("core-js/modules/es.set.union.v2.js"),Vl=require("core-js/modules/web.dom-collections.iterator.js"),ke=class{static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let t=this.createKey();for(;this.keySet.has(t);)t=this.createKey();return t}static removeKey(t){this.keySet.delete(t)}static dispose(){this.keySet.clear()}};ke.keySet=new Set;var Xl=require("core-js/modules/es.string.replace.js"),Yl=require("core-js/modules/es.regexp.exec.js"),ql=require("core-js/modules/es.array.push.js");function Bo(a){return a.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function Wo(a){let t=[],e=/(\([^()]*\))|([^()]*)/g,i=0,s;for(;(s=e.exec(a))!==null;)s.index>i&&t.push(a.substring(i,s.index)),t.push(s[0]),i=s.index+s[0].length;return i<a.length&&t.push(a.substring(i)),t}function Z(a,t,e){return new Promise((i,s)=>{let o=ke.genUniqueKey(),n=r=>{let{data:h}=r;h.type===""+t+"_result"&&h.key===o&&(ke.removeKey(o),self.removeEventListener("message",n),h.error?s(h.error):i(h.data))};a.addEventListener("message",n),a.postMessage({type:t,key:o,data:e})})}function oh(a){let t={};for(let i in a)i.startsWith("on")&&(t[Bo(i.slice(2))]=a[i],t[i]=a[i]);let e=i=>f(this,null,function*(){let{data:s}=i;if(t[s.type])try{let o=yield t[s.type](s.data);if(o!=null&&o.$transfer&&Array.isArray(o.$transfer)){let n=o.$transfer;delete o.$transfer,self.postMessage({type:""+s.type+"_result",key:s.key,data:o},n)}else self.postMessage({type:""+s.type+"_result",key:s.key,data:o})}catch(o){self.postMessage({type:""+s.type+"_result",key:s.key,error:o})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var Kt=require("three");function nh(a,t){t===void 0&&(t=16711680);let e=new Kt.LineBasicMaterial({color:t}),i=new Kt.BufferGeometry().setFromPoints(a);return new Kt.Line(i,e)}function rh(a,t){t===void 0&&(t=16711680);let e=new Kt.MeshBasicMaterial({color:t,depthTest:!1,transparent:!0}),i=new Kt.BoxGeometry(1,1,1),s=new Kt.Mesh(i,e);return s.position.copy(a),s.renderOrder=100100,s}var sp=require("core-js/modules/es.json.stringify.js"),op=require("core-js/modules/web.dom-collections.iterator.js");function Ii(a,t,e){e===void 0&&(e=0),a.forEach(i=>{if(i.geometry.coords=JSON.parse(JSON.stringify(i.geometry.cds)),i.geometry.type==="polygon"){var s;i.geometry.coords.map(o=>{Array.isArray(o)&&o.forEach(n=>{n[0]-=t[0],n[1]-=t[1]})}),i.geometry.otherCds&&(i.geometry.otherCoords=i.geometry.otherCds.map(o=>o.map(n=>je(n,t)))),(s=i.doors)!=null&&s.length&&i.doors.map(o=>{o.coord=je(o.coordinate,t)}),i.center&&(i.centerCoords=je(i.center,t))}else i.geometry.coords=je(i.geometry.cds,t),i.center&&(i.centerCoords=je(i.center,t));if(i.center_x&&i.center_y){let[o,n]=je([i.center_x,i.center_y],t);i.center_coord_x=o,i.center_coord_y=n}});for(let i=0;i<a.length;i++){let s=a[i];s.deltaHeight=1e-5*(e+i+1)}}function je(a,t){return[a[0]-t[0],a[1]-t[1]]}var rp=require("core-js/modules/es.set.difference.v2.js"),ap=require("core-js/modules/es.set.intersection.v2.js"),hp=require("core-js/modules/es.set.is-disjoint-from.v2.js"),cp=require("core-js/modules/es.set.is-subset-of.v2.js"),lp=require("core-js/modules/es.set.is-superset-of.v2.js"),pp=require("core-js/modules/es.set.symmetric-difference.v2.js"),dp=require("core-js/modules/es.set.union.v2.js"),up=require("core-js/modules/web.dom-collections.iterator.js"),cr=require("@tweenjs/tween.js"),_e=class{update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(t=>{this.tweenStore.add(t),t.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(t=>{t.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(t){this.group.remove(t)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(t=>t.stop()),this.group.removeAll()}dispose(){this.clear()}constructor(){this.pauseTween=!1,this.tweenStore=new Set,this.group=new cr.Group}};var lr=require("three"),Ri=class extends lr.EventDispatcher{registryEvent(){this.ctn.addEventListener("pointerdown",this._pointerDown),this.ctn.addEventListener("pointerup",this._pointerUp)}unRegistryEvent(){this.ctn.removeEventListener("pointerdown",this._pointerDown),this.ctn.removeEventListener("pointerup",this._pointerUp)}dispose(){this.unRegistryEvent()}constructor(t){super(),this.ctn=t,this._pointerDown=e=>{this.point={x:e.offsetX,y:e.offsetY}},this._pointerUp=e=>{if(!this.point)return;let{offsetX:i,offsetY:s}=e,{x:o,y:n}=this.point;Math.hypot(o-i+(n-s))>3||this.dispatchEvent({type:"click",e})},this.registryEvent()}};var yp=require("core-js/modules/web.dom-collections.iterator.js"),vp=require("core-js/modules/es.array.push.js"),xp=require("core-js/modules/es.string.replace.js"),wp=require("core-js/modules/es.regexp.exec.js"),pr=require("lodash"),dr=require("three");var Ve=class extends dr.EventDispatcher{_isEffectiveTask(t){return t&&typeof t.run=="function"}_getIndexByTid(t){return this._task.findIndex(e=>e.tid===t)}_createTask(t){return this._isEffectiveTask(t)?w({},t,{tid:++this._id,meta:t.meta||{}}):!1}get task(){return[...this._task]}getTasks(){return[...this._task]}add(t){if(this._isEffectiveTask(t)){let e=this._createTask(t);return this._task.push(e),this.started&&!this.activeTask&&this.start(),e.tid}return!1}replace(t,e){if(!this._isEffectiveTask(e))return console.warn("[TaskQueue] replace\u65B9\u6CD5\u4F20\u5165\u7684task\u53C2\u6570\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;let i=this._getIndexByTid(t);if(i===-1)return console.warn("[TaskQueue] \u6CA1\u6709\u627E\u5230id="+t+"\u7684\u4EFB\u52A1"),!1;let s=this._createTask(e);return this._task.splice(i,1,s),s.tid}replaceByMetaType(t){var e;let i=(e=t.meta)==null?void 0:e.type;if((0,pr.isNil)(i))return this.add(t);{let s=this._task.find(o=>o.meta.type===i);return s?this.replace(s.tid,t):this.add(t)}}remove(t){let e=this._getIndexByTid(t);return e===-1?(console.warn("[TaskQueue] remove\u65B9\u6CD5\u4F20\u5165\u7684id\uFF1A"+t+"\u627E\u4E0D\u5230\u5BF9\u5E94\u7684task"),!1):(this._task.splice(e,1),!0)}clear(){this._task.length=0}start(){this.started=!0,!this.activeTask&&this._task.length&&this.exec()}stop(){this.started=!1}exec(){return f(this,null,function*(){if(!this.started||!this._task.length)return!1;let t=this._task.shift();this.activeTask=t,this.dispatchEvent({type:"active-task-start",task:t});let e;try{e=yield t.run()}catch(i){console.warn("[task run err]",i,t)}return this.activeTask=null,this.dispatchEvent({type:"active-task-end",task:t,res:e}),this.exec()})}constructor(t=!0){super(),this._task=[],this.started=!1,this.activeTask=null,this._id=0,t&&this.start()}};var Pp=require("core-js/modules/es.array.push.js"),ur=require("three"),Gi=class extends ur.EventDispatcher{getWorker(){return new Promise(t=>{let e=this.pool.find(s=>s.state==="leisure");if(e){e.state="used",t(e.worker);return}if(this.pool.length<this.max&&this.workerConstructor){let s=this.workerConstructor();this.pool.push({worker:s,state:"used"}),t(s);return}let i=()=>{let s=this.pool.find(o=>o.state==="leisure");s&&(this.removeEventListener("release",i),s.state="used",t(s.worker))};this.addEventListener("release",i)})}releaseWorker(t){let e=this.pool.find(i=>i.worker===t);e&&(e.state="leisure",this.dispatchEvent({type:"release",worker:t}))}dispose(){this._listeners={},this.pool.forEach(t=>{t.worker.terminate()}),this.pool=[]}constructor(t=10,e){super(),this.max=10,this.pool=[],this.max=t,this.workerConstructor=e}};var mr=require("three"),st=class extends mr.EventDispatcher{dispose(){this._listeners={}}};var Fi=class{filter(t){let e=this.estimate,i=this.errorEstimate+this.processNoise,s=i/(i+this.measurementNoise);return this.estimate=e+s*(t-e),this.errorEstimate=(1-s)*i,this.estimate}constructor(t={}){this.estimate=0,this.errorEstimate=1,this.processNoise=.1,this.measurementNoise=1,this.measurementNoise=t.measurementNoise||1,this.processNoise=t.processNoise||.1,this.errorEstimate=t.errorEstimate||1}};var Lp=require("core-js/modules/es.typed-array.float32-array.js"),Cp=require("core-js/modules/es.typed-array.at.js"),Tp=require("core-js/modules/es.typed-array.fill.js"),kp=require("core-js/modules/es.typed-array.find-last.js"),Dp=require("core-js/modules/es.typed-array.find-last-index.js"),Ap=require("core-js/modules/es.typed-array.set.js"),Op=require("core-js/modules/es.typed-array.sort.js"),Ip=require("core-js/modules/es.typed-array.to-reversed.js"),Rp=require("core-js/modules/es.typed-array.to-sorted.js"),Gp=require("core-js/modules/es.typed-array.with.js"),Fp=require("core-js/modules/es.array-buffer.constructor.js"),zp=require("core-js/modules/es.array-buffer.slice.js"),Bp=require("core-js/modules/es.array-buffer.detached.js"),Wp=require("core-js/modules/es.array-buffer.transfer.js"),Up=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Hp=require("core-js/modules/es.array.push.js"),Np=require("core-js/modules/web.dom-collections.iterator.js"),V=require("three");var fr=require("three/examples/jsm/utils/BufferGeometryUtils.js");var Ds=require("@turf/turf");function ah(a,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let i=a.filter(r=>r.geometry.type==="polygon");if(!i.length)return null;let s=i.map(r=>{var h;let c=r.geometry.coords,l=Li(c[0],c.slice(1)),p=new V.ExtrudeGeometry(l,{steps:1,bevelEnabled:!1,depth:r.height,curveSegments:4});(h=r).deltaHeight||(h.deltaHeight=0),p.translate(0,0,r.airHeight+r.deltaHeight);let d=p.attributes.position.count,u=new Float32Array(d).fill(r.height+r.airHeight+r.deltaHeight);if(p.setAttribute("maxZ",new V.BufferAttribute(u,1)),p.setAttribute("opacity",new V.BufferAttribute(new Float32Array(d).fill(r.fillOpacity),1)),e){let g=new Float32Array(d).fill(r.airHeight+r.deltaHeight);p.setAttribute("minZ",new V.BufferAttribute(g,1))}let m=new V.Color(r.fillColor).convertLinearToSRGB(),v=new Float32Array(d*3);for(let g=0;g<d;g++)v[g*3]=m.r,v[g*3+1]=m.g,v[g*3+2]=m.b;return p.setAttribute("color",new V.BufferAttribute(v,3)),p}),o=(0,fr.mergeGeometries)(s);s.forEach(r=>r.dispose());let n={geometry:o};return o.dispose(),t&&(n.lineGeometry=gr(i)||void 0),n}function hh(a){let t=a.filter(h=>h.geometry.type==="polygon");if(!t.length)return null;let e=[],i=[],s=[],o=[],n=[],r=[];return t.map((h,c)=>{var l;(l=h).deltaHeight||(l.deltaHeight=0);let p=h.geometry.coords,d=O(p[0][0],p[0][1]),u=O(p[0][1],p[0][2]),m=p[0][1][0]-p[0][0][0],v=p[0][1][1]-p[0][0][1],g=Math.atan2(v,m),x=(0,Ds.center)((0,Ds.polygon)(p)),M=x.geometry.coordinates[0],P=x.geometry.coordinates[1],C=new V.Matrix4().compose(new V.Vector3(M,P,h.deltaHeight+h.airHeight+h.height/2),new V.Quaternion().setFromAxisAngle(new V.Vector3(0,0,1),g),new V.Vector3(d,u,h.height));e.push(...C.toArray()),i.push(...new V.Color(h.fillColor).convertLinearToSRGB().toArray());var S;s[c]=(S=h.fillOpacity)!=null?S:1;var G;o[c]=((G=h.deltaHeight)!=null?G:0)+h.airHeight+h.height,n[c]=h.id,r[c]=h.airHeight+h.deltaHeight}),{size:t.length,ids:n,matrixes:e,colors:i,opacities:s,maxZs:o,minZs:r}}function gr(a){let{points:t,colors:e,opacities:i}=As(a);if(!t.length)return null;let s=new V.BufferGeometry().setFromPoints(t);return s.setAttribute("color",new V.BufferAttribute(new Float32Array(e),3)),s.setAttribute("opacity",new V.BufferAttribute(new Float32Array(i),1)),s}function As(a){let t=[],e=[],i=[];return a.filter(s=>s.strokeOpacity>0).map(s=>{let o=s.height+(s.deltaHeight||0)+s.airHeight,{coords:n}=s.geometry,{strokeColor:r,strokeOpacity:h}=s,c=new V.Color(r).convertLinearToSRGB();for(let l=0;l<n.length;l++){let p=n[l];for(let d=0;d<p.length;d++){let u=p[d],m=d+1===p.length?p[0]:p[d+1];t.push(new V.Vector3(u[0],u[1],o)),t.push(new V.Vector3(m[0],m[1],o)),e.push(c.r,c.g,c.b),e.push(c.r,c.g,c.b),i.push(h),i.push(h)}}}),{points:t,colors:e,opacities:i}}function ch(a){if(a.length>1)return!1;let t=a[0];if(t.length!==5)return!1;let[e]=t,i=t[t.length-1];if(e[0]!==i[0]||e[1]!==i[1])return!1;let s=[Math.round(O(t[0],t[1])),Math.round(O(t[1],t[2])),Math.round(O(t[2],t[3])),Math.round(O(t[3],t[4]))];if(!(s[2]===s[0]&&s[3]===s[1]))return!1;let o=We(t[0],t[1],t[2]);return Math.abs(Math.abs(o)-90)<1}var z=require("three");var Xv=require("core-js/modules/web.dom-collections.iterator.js"),Yv=require("core-js/modules/es.set.difference.v2.js"),qv=require("core-js/modules/es.set.intersection.v2.js"),$v=require("core-js/modules/es.set.is-disjoint-from.v2.js"),Jv=require("core-js/modules/es.set.is-subset-of.v2.js"),Qv=require("core-js/modules/es.set.is-superset-of.v2.js"),tx=require("core-js/modules/es.set.symmetric-difference.v2.js"),ex=require("core-js/modules/es.set.union.v2.js"),ix=require("core-js/modules/es.array.push.js"),Jr=require("three");var Vu=require("core-js/modules/web.dom-collections.iterator.js"),Ku=require("core-js/modules/es.array.push.js"),k=require("three");var Kp=require("core-js/modules/web.dom-collections.iterator.js"),vr=require("three/examples/jsm/lines/LineMaterial.js"),Y=require("three");function yr(a){return a.x+"-"+a.y+"-"+a.z}var T=class{static generateLineMaterialKey(t){let{color:e,opacity:i}=t;return e+"-"+i}static createLineMaterial(t){let{color:e,opacity:i,vertexColors:s}=t,o=this.generateLineMaterialKey({color:e,opacity:i,vertexColors:s});if(this.lineMaterialMap.has(o))return this.lineMaterialMap.get(o);let n=new Y.LineBasicMaterial({color:new Y.Color(e).convertLinearToSRGB(),transparent:!0,opacity:i,vertexColors:s!=null?s:!1});return this.lineMaterialMap.set(o,n),n}static createMeshStandardMaterial(t){let{color:e,opacity:i}=t,s=e+"-"+i;if(this.meshStandardMaterialMap.has(s))return this.meshStandardMaterialMap.get(s);let o=new Y.MeshStandardMaterial({color:new Y.Color(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:i,depthWrite:!0});return this.meshStandardMaterialMap.set(s,o),o}static createMeshBasicMaterial(t){let{color:e,opacity:i,vertexColors:s}=t,o=e+"-"+i+"-"+s;if(this.meshBasicMaterialMap.has(o))return this.meshBasicMaterialMap.get(o);let n=new Y.MeshBasicMaterial({color:e,transparent:!0,opacity:i,depthWrite:!0,vertexColors:s!=null?s:!1});return this.meshBasicMaterialMap.set(o,n),n}static createShaderMaterial(t){let{gradualColor:e,center:i,maxValue:s,opacity:o,direction:n,max:r,min:h}=t,c=e.toString()+"-"+yr(i)+"-"+s+"-"+o+"-"+yr(n);if(this.shaderMaterialMap.has(c))return this.shaderMaterialMap.get(c);let l=`
|
|
2
2
|
uniform vec3 uColor;
|
|
3
3
|
uniform vec3 uGradualColor;
|
|
4
4
|
uniform vec3 center;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
void main() {
|
|
36
36
|
gl_FragColor = vec4(vColor.x, vColor.y, vColor.z, opacity);
|
|
37
37
|
}
|
|
38
|
-
`,d=new Y.ShaderMaterial({uniforms:{uColor:{value:new Y.Color(e[0]).convertLinearToSRGB()},uGradualColor:{value:new Y.Color(e[1]).convertLinearToSRGB()},center:{value:i},maxValue:{value:s},opacity:{value:o},uDirection:{value:n},uMax:{value:r},uMin:{value:h}},vertexShader:l,fragmentShader:p,side:Y.DoubleSide});return this.shaderMaterialMap.set(c,d),d}static createLine2MaterialMap(t){let{color:e,width:i,dashed:s,resolution:o,vertexColors:n}=t,r=e+"-"+i+"-"+s+"-"+o.x+"-"+o.y+"-"+n;if(this.line2MaterialMap.has(r))return this.line2MaterialMap.get(r);let h=new
|
|
38
|
+
`,d=new Y.ShaderMaterial({uniforms:{uColor:{value:new Y.Color(e[0]).convertLinearToSRGB()},uGradualColor:{value:new Y.Color(e[1]).convertLinearToSRGB()},center:{value:i},maxValue:{value:s},opacity:{value:o},uDirection:{value:n},uMax:{value:r},uMin:{value:h}},vertexShader:l,fragmentShader:p,side:Y.DoubleSide});return this.shaderMaterialMap.set(c,d),d}static createLine2MaterialMap(t){let{color:e,width:i,dashed:s,resolution:o,vertexColors:n}=t,r=e+"-"+i+"-"+s+"-"+o.x+"-"+o.y+"-"+n;if(this.line2MaterialMap.has(r))return this.line2MaterialMap.get(r);let h=new vr.LineMaterial({color:new Y.Color(e),dashed:s,linewidth:i,worldUnits:!0,dashSize:1,gapSize:3,dashScale:1,resolution:o,vertexColors:n!=null?n:!1});return this.line2MaterialMap.set(r,h),h}static createLineDashedMaterial(t){let e="dashed-"+t.color+"-"+t.opacity+"-"+t.dashSize+"-"+t.gapSize+"-"+t.scale;if(this.lineDashedMaterialMap.has(e))return this.lineDashedMaterialMap.get(e);let i=new Y.LineDashedMaterial({color:t.color,transparent:!0,opacity:t.opacity,dashSize:t.dashSize||.2,gapSize:t.gapSize||.1,scale:t.scale||1});return this.lineDashedMaterialMap.set(e,i),i}static GetMergeAttributeGraphicMaterial(){if(this.mergeAttributeGraphicMaterial)return this.mergeAttributeGraphicMaterial;let t=`
|
|
39
39
|
attribute float maxZ; // \u58F0\u660E\u4E00\u4E2Aattribute\u53D8\u91CF
|
|
40
40
|
attribute vec3 color; // \u58F0\u660E\u4E00\u4E2Aattribute\u53D8\u91CF
|
|
41
41
|
attribute float opacity; // \u58F0\u660E\u4E00\u4E2Aattribute\u53D8\u91CF
|
|
@@ -215,8 +215,8 @@
|
|
|
215
215
|
gl_FragColor = vec4(newColor, vOpacity);
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
`;return this.instancedWallMaterial=new Y.ShaderMaterial({vertexShader:t,fragmentShader:e,transparent:!0})}static dispose(){this.lineMaterialMap.forEach((t,e)=>{t.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((t,e)=>{t.dispose()}),this.shaderMaterialMap.clear(),this.line2MaterialMap.forEach((t,e)=>{t.dispose()}),this.line2MaterialMap.clear(),this.lineDashedMaterialMap.forEach(t=>{t.dispose()}),this.lineDashedMaterialMap.clear(),this.mergeAttributeGraphicMaterial&&(this.mergeAttributeGraphicMaterial.dispose(),this.mergeAttributeGraphicMaterial=null),this.mergeAttributeWallMaterial&&(this.mergeAttributeWallMaterial.dispose(),this.mergeAttributeWallMaterial=null),this.mergeAttributeGraphicLineMaterial&&(this.mergeAttributeGraphicLineMaterial.dispose(),this.mergeAttributeGraphicLineMaterial=null),this.instancedGraphicMaterial&&(this.instancedGraphicMaterial.dispose(),this.instancedGraphicMaterial=null),this.instancedWallMaterial&&(this.instancedWallMaterial.dispose(),this.instancedWallMaterial=null)}};T.lineMaterialMap=new Map;T.meshStandardMaterialMap=new Map;T.meshBasicMaterialMap=new Map;T.shaderMaterialMap=new Map;T.line2MaterialMap=new Map;T.mergeAttributeGraphicMaterial=null;T.mergeAttributeWallMaterial=null;T.mergeAttributeGraphicLineMaterial=null;T.instancedGraphicMaterial=null;T.instancedWallMaterial=null;T.lineDashedMaterialMap=new Map;var $p=require("core-js/modules/es.regexp.exec.js"),Jp=require("core-js/modules/web.dom-collections.iterator.js"),Qp=require("core-js/modules/es.array.push.js"),td=require("core-js/modules/es.typed-array.uint8-array.js"),ed=require("core-js/modules/es.typed-array.at.js"),id=require("core-js/modules/es.typed-array.fill.js"),sd=require("core-js/modules/es.typed-array.find-last.js"),od=require("core-js/modules/es.typed-array.find-last-index.js"),nd=require("core-js/modules/es.typed-array.set.js"),rd=require("core-js/modules/es.typed-array.sort.js"),ad=require("core-js/modules/es.typed-array.to-reversed.js"),hd=require("core-js/modules/es.typed-array.to-sorted.js"),cd=require("core-js/modules/es.typed-array.with.js"),ld=require("core-js/modules/es.array-buffer.constructor.js"),pd=require("core-js/modules/es.array-buffer.slice.js"),dd=require("core-js/modules/es.array-buffer.detached.js"),ud=require("core-js/modules/es.array-buffer.transfer.js"),md=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),fd=require("core-js/modules/es.set.difference.v2.js"),gd=require("core-js/modules/es.set.intersection.v2.js"),yd=require("core-js/modules/es.set.is-disjoint-from.v2.js"),vd=require("core-js/modules/es.set.is-subset-of.v2.js"),xd=require("core-js/modules/es.set.is-superset-of.v2.js"),wd=require("core-js/modules/es.set.symmetric-difference.v2.js"),Md=require("core-js/modules/es.set.union.v2.js"),_d=require("core-js/modules/es.typed-array.from.js"),R=require("three");var ah={};function Bo(){return new Worker(new URL("./worker/text-texture.worker-6IXOXREW.js",ah.url))}var hh={};function Wo(){return new Worker(new URL("./worker/lazy-indexdb-text-texture.worker-GTG7ASSH.js",hh.url))}var fe,xt=function(a){return a.MAP_VERSION="map_version",a.ROUTE_VERSION="route_version",a.FACILITY_VERSION="facility_version",a.MAP_DATA="map_data",a.ROAD_NETWORK_DATA="road_network_data",a.FACILITY_DATA="facility_data",a.POI_TEXT="poi_text_1",a.POI_TEXT_RECT="poi_text_rect",a.LAZY_TEXTURE="lazy_texture",a.LAZY_POI="lazy_poi",a}({});function Ds(a,t){return a===void 0&&(a="aibee_map"),t===void 0&&(t=9),new Promise((e,i)=>{if(fe)return e({db:fe,type:"success"});let s=indexedDB.open(a,t);s.onupgradeneeded=function(o){fe=o.target.result,console.log("[open db is onupgradeneeded]"),me("map_version"),me("route_version"),me("facility_version"),me("map_data"),me("road_network_data"),me("facility_data"),me("poi_text_1"),me("poi_text_rect"),me("lazy_texture"),me("lazy_poi")},s.onsuccess=o=>{fe=o.target.result,e({db:fe,type:"success"})},s.onerror=o=>{console.log("[open db is onerror]"),i(o)}})}function ei(a,t,e){return e===void 0&&(e=fe),new Promise((i,s)=>{e||s("\u6CA1\u6709db");let n=e.transaction([a],"readonly").objectStore(a).get(t);n.onsuccess=()=>{n.result?i(n.result.value):i(null)},n.onerror=r=>{console.log("[getVersionByKey]",r),i(null)}})}function Gi(a,t,e,i,s){return i===void 0&&(i=fe),s===void 0&&(s=!1),new Promise((o,n)=>f(this,null,function*(){if(!i){n("\u6CA1\u6709db");return}let r=s;s||(r=!!(yield ei(a,t)));let h=i.transaction([a],"readwrite").objectStore(a),c=r?h.put({key:t,value:e}):h.add({key:t,value:e});c.onsuccess=function(l){o(l)},c.onerror=function(l){n(l)}}))}function me(a,t){t===void 0&&(t=fe),t&&(t.objectStoreNames.contains(a)||t.createObjectStore(a,{keyPath:"key"}))}function yr(a){a===void 0&&(a=fe),a==null||a.close(),fe=null}var te=Math.max(window.devicePixelRatio,2);pe&&(te=1);var Q=class{static InitDb(){return Ds()}static getCanvas(){if(this.canvas)return this.canvas;{let t=document.createElement("canvas");return this.canvas=t,t}}static getCtx(){if(this.ctx)return this.ctx;let e=this.getCanvas().getContext("2d",{willReadFrequently:!0});return this.ctx=e,e}static getIdleCanvas(){if(this.idleCanvas)return this.idleCanvas;{let t=document.createElement("canvas");return this.idleCanvas=t,t}}static getIdleCtx(){if(this.idleCtx)return this.idleCtx;let e=this.getIdleCanvas().getContext("2d",{willReadFrequently:!0});return this.idleCtx=e,e}static getMergedOptions(t){return w({},this.options,t)}static setCtxStyle(t,e,i){e===void 0&&(e=this.getCanvas()),i===void 0&&(i=this.getCtx()),e.style.width=""+t.width+"px",e.style.height=""+t.height+"px",e.width=t.width*te,e.height=t.height*te,i.font=t.font,i.textBaseline=t.textBaseline,i.lineWidth=t.lineWidth,i.fillStyle=t.fillStyle,i.strokeStyle=t.strokeStyle,i.scale(te,te)}static getLazyIndexDbTextTextureWorker(){if(this.lazyIndexDbTextTextureWorker)return this.lazyIndexDbTextTextureWorker;{let t=Wo();return this.lazyIndexDbTextTextureWorker=t,t}}static getTextureRectByTexts(t,e){return f(this,null,function*(){let i=this.getMergedOptions(e),s=(e==null?void 0:e.maxWidth)||600,o=Te(w({},i,{text:t,maxWidth:s}));if(this.rectCacheMap.has(o))return this.rectCacheMap.get(o);let n=new Promise((r,h)=>f(this,null,function*(){var c;try{yield this.InitDb();let x=yield ei(xt.POI_TEXT_RECT,o);if(x){r({width:x.width,height:x.height,lines:x.lines,lineString:x.lineString});return}}catch(x){console.error("POI TEXT_RECT DB ERROR",x)}let l=this.getCanvas(),p=this.getCtx();p.clearRect(0,0,l.width,l.height),this.setCtxStyle(i);let d=this.splitText(t,p,s),u=+(((c=i.font.match(/(\d+)px/))==null?void 0:c[1])||54),v=Math.ceil(u+i.lineWidth+2)*d.length,g=Math.max(...d.map(x=>{let M=Math.ceil(p.measureText(x).width);return M%2===0?M:M+1}))+2;try{yield this.InitDb(),Gi(xt.POI_TEXT_RECT,o,{width:g,height:v,lines:d.length,lineString:d})}catch(x){console.error("POI TEXT_RECT DB ERROR",x)}r({width:g,height:v,lines:d.length,lineString:d})}));return this.rectCacheMap.set(o,n),n})}static splitText(t,e,i){let s=zo(t),o=[],n="";for(let r of s)if(r.startsWith("(")||r.startsWith("\uFF08"))o.push(r.slice(1,-1));else{let h=r.split(" ");for(let c of h){let l=n?n+" "+c:c,p=e.measureText(l);if(p.width>i)if(n&&o.push(n),p.width>i||Mo(c)){let d="",u=c.split("");for(let m of u){let v=d+m;e.measureText(v).width>i&&d?(o.push(d),d=m):d=v}d&&(n=d)}else n=c;else n=l}}return n&&o.push(n),o}static getTextureByText(t,e){return f(this,null,function*(){let i=this.getMergedOptions(e),s=(e==null?void 0:e.maxWidth)||600,o=Te(w({},i,{text:t,maxWidth:s}));if(this.cacheMap.has(o))return this.cacheMap.get(o);let n=new Promise((r,h)=>f(this,null,function*(){var c;try{yield this.InitDb();let S=yield ei(xt.POI_TEXT,o);if(S){let G=new R.DataTexture(new Uint8Array(S.data),S.width,S.height,R.RGBAFormat);G.flipY=!0,G.minFilter=R.LinearFilter,G.magFilter=R.LinearFilter;let E={texture:G,lines:S.lines};this.cacheMap.set(o,E),r(E);return}}catch(S){console.error("POI TEXT DB ERROR",S)}let l=this.getCanvas(),p=this.getCtx();p.clearRect(0,0,l.width,l.height),this.setCtxStyle(i);let{width:d,height:u,lineString:m}=yield this.getTextureRectByTexts(t),v=+(((c=i.font.match(/(\d+)px/))==null?void 0:c[1])||54),g=Math.ceil(v+i.lineWidth+2),x=u,M=d;m.forEach((S,G)=>{let E=p.measureText(S),nt=Math.ceil(E.width),Tt=Math.floor((M-nt)/2),gt=G*(2+g);i.lineWidth&&p.strokeText(S,Tt,gt),p.fillText(S,Tt,gt)});let P=p.getImageData(0,0,M*te,x*te),C=new R.DataTexture(P.data,M*te,x*te,R.RGBAFormat);C.flipY=!0,C.minFilter=R.LinearFilter,C.magFilter=R.LinearFilter,this.cacheMap.set(o,{texture:C,lines:m.length});try{Gi(xt.POI_TEXT,o,{data:Array.from(P.data),width:M*te,height:x*te,lines:m.length,lineString:m},void 0,!0)}catch(S){console.error("POI TEXT DB ERROR",S)}r({texture:C,lines:m.length})}));return this.cacheMap.set(o,n),n})}static lazyGetTextureByTexts(t,e){return f(this,null,function*(){let i=this.getMergedOptions(e),s=i.height;i.height=Math.min(s*t.length,2048);let o={},n=new Set;if(t.map(c=>{if(this.lazyPoiMap.has(c)){let l=this.lazyPoiMap.get(c),p=this.lazyTextureCacheMap.get(l.textureKey);if(p){o[c]={width:l.width,height:s,x:l.x,y:l.y,texture:p};return}}n.add(c)}),!n.size)return o;let r=Array.from(n);return new Promise((c,l)=>f(this,null,function*(){let p;window.OffscreenCanvas?(console.log("use webworker"),p=this.getTextsByWorker(r,i,s)):typeof window.requestIdleCallback=="function"?(console.log("use browser idle"),p=this.getTextsByBrowserIdle(r,i,s)):(console.log("use requestAnimation text textures"),p=Promise.resolve().then(()=>this.getTextsSync(r,i,s))),c(p)}))})}static getTextsByWorker(t,e,i){return f(this,null,function*(){return this.textTextureWorker||(this.textTextureWorker=Bo()),(yield Z(this.textTextureWorker,"get_texture_by_texts",{texts:t,options:e,originHeight:i})).data.map(o=>{let n=new R.DataTexture(o.data,e.width,o.height,R.RGBAFormat);return n.flipY=!0,n.minFilter=R.LinearFilter,n.magFilter=R.LinearFilter,{texture:n,offsetMap:o.offsetMap}}).reduce((o,n)=>(Object.keys(n.offsetMap).forEach(r=>{o[r]=n.offsetMap[r],o[r].texture=n.texture}),o),{})})}static getTextsByBrowserIdle(t,e,i){return f(this,null,function*(){let s=0,o=t.length;return new Promise(n=>{let r=this.getIdleCanvas(),h=this.getIdleCtx();h.clearRect(0,0,r.width,r.height),this.setCtxStyle(e,r,h);let c=[],l=0,p=0,d={},u=()=>f(this,null,function*(){let v=h.getImageData(0,0,e.width,i+p);c.push({imageData:v,offsetMap:d,height:i+p});let g=c.reduce((x,M)=>{let P=new R.DataTexture(M.imageData.data,e.width,M.height,R.RGBAFormat);return P.flipY=!0,P.minFilter=R.LinearFilter,P.magFilter=R.LinearFilter,Object.keys(M.offsetMap).forEach(C=>{x[C]=w({},M.offsetMap[C],{texture:P})}),x},{});n(g)}),m=v=>{if(s>=o)return u();if(v.timeRemaining()>0){let g=t[s],x=Math.ceil(h.measureText(g).width);if(x=x%2===0?x:x+1,x+=2,x+l>e.width&&(l=0,p+=i,i+p>e.height)){let P=h.getImageData(0,0,e.width,p);c.push({imageData:P,offsetMap:d,height:p}),p=0,h.clearRect(0,0,e.width,e.height),d={}}let M=8;if(e.lineWidth&&h.strokeText(g,2+l,M+p),h.fillText(g,2+l,M+p),d[g]={width:x,height:i,x:l,y:p},l+=x,++s>=o)return u();v.timeRemaining()>0?m(v):this.timer.requestIdleCallback(m)}else this.timer.requestIdleCallback(m)};this.timer.requestIdleCallback(m),this.timer.setTimeout(()=>{s===0&&(console.log("idle \u4E0D\u6267\u884C \u56DE\u9000\u5230\u540C\u6B65"),n(this.getTextsSync(t,e,i)))},1e3)})})}static getTextsByReqAniFrame(t,e,i){return f(this,null,function*(){let s=0,o=t.length;return new Promise(n=>{let r=this.getIdleCanvas(),h=this.getIdleCtx();h.clearRect(0,0,r.width,r.height),this.setCtxStyle(e,r,h);let c=[],l=0,p=0,d={},u=()=>f(this,null,function*(){let v=h.getImageData(0,0,e.width,i+p);c.push({imageData:v,offsetMap:d,height:i+p});let g=c.reduce((x,M)=>{let P=new R.DataTexture(M.imageData.data,e.width,M.height,R.RGBAFormat);return P.flipY=!0,P.minFilter=R.LinearFilter,P.magFilter=R.LinearFilter,Object.keys(M.offsetMap).forEach(C=>{x[C]=w({},M.offsetMap[C],{texture:P})}),x},{});n(g)}),m=()=>{if(s>=o)return u();let v=0;for(;v<30;){let g=t[s],x=Math.ceil(h.measureText(g).width);if(x=x%2===0?x:x+1,x+=2,x+l>e.width&&(l=0,p+=i,i+p>e.height)){let P=h.getImageData(0,0,e.width,p);c.push({imageData:P,offsetMap:d,height:p}),p=0,h.clearRect(0,0,e.width,e.height),d={}}let M=8;if(e.lineWidth&&h.strokeText(g,2+l,M+p),h.fillText(g,2+l,M+p),d[g]={width:x,height:i,x:l,y:p},l+=x,++s>=o)return u();v++}this.timer.requestAnimationFrame(m)};this.timer.requestAnimationFrame(m)})})}static getTextsSync(t,e,i){let s=this.getCanvas(),o=this.getCtx();o.clearRect(0,0,s.width,s.height),this.setCtxStyle(e);let n=[],r=0,h=0,c={};t.forEach(d=>{let u=Math.ceil(o.measureText(d).width);if(u=u%2===0?u:u+1,u+=2,u+r>e.width&&(r=0,h+=i,i+h>e.height)){let v=o.getImageData(0,0,e.width,h);n.push({data:v.data,offsetMap:c,height:h}),h=0,o.clearRect(0,0,e.width,e.height),c={}}let m=8;e.lineWidth&&o.strokeText(d,2+r,m+h),o.fillText(d,2+r,m+h),c[d]={width:u,height:i,x:r,y:h},r+=u});let l=o.getImageData(0,0,e.width,i+h);return n.push({data:l.data,offsetMap:c,height:h+i}),n.reduce((d,u)=>{let m=new R.DataTexture(u.data,e.width,u.height,R.RGBAFormat);return m.flipY=!0,m.minFilter=R.LinearFilter,m.magFilter=R.LinearFilter,Object.keys(u.offsetMap).forEach(v=>{d[v]=w({},u.offsetMap[v],{texture:m})}),d},{})}static getTextureByTexts(t,e){let i=this.getMergedOptions(e),s=i.height;i.height=Math.min(s*t.length,1e4);let o=this.getCanvas(),n=this.getCtx();n.clearRect(0,0,o.width,o.height),this.setCtxStyle(i);let r=0,h=0,c={};t.forEach(d=>{let u=Math.ceil(n.measureText(d).width);u=u%2===0?u:u+1,u+=2,u+r>i.width&&(r=0,h+=s);let m=8;i.lineWidth&&n.strokeText(d,2+r,m+h),n.fillText(d,2+r,m+h),c[d]={width:u,height:s,x:r,y:h},r+=u});let l=n.getImageData(0,0,i.width,s+h),p=new R.DataTexture(Uint8Array.from(l.data),i.width,s+h,R.RGBAFormat);return p.flipY=!0,p.minFilter=R.LinearFilter,p.magFilter=R.LinearFilter,{texture:p,offsetMap:c}}static dispose(){var t,e;this.ctx=null,this.canvas=null,this.idleCtx=null,this.idleCanvas=null,this.timer.dispose(),this.cacheMap.forEach(i=>{i instanceof Promise?i.then(s=>{s.texture.dispose()}):i.texture.dispose()}),this.cacheMap.clear(),(t=this.textTextureWorker)==null||t.terminate(),(e=this.lazyIndexDbTextTextureWorker)==null||e.terminate(),this.textTextureWorker=null,this.rectCacheMap.clear()}};Q.canvas=document.createElement("canvas");Q.ctx=Q.canvas.getContext("2d",{willReadFrequently:!0});Q.cacheMap=new Map;Q.rectCacheMap=new Map;Q.lazyTextureCacheMap=new Map;Q.lazyPoiMap=new Map;Q.textTextureWorker=null;Q.lazyIndexDbTextTextureWorker=null;Q.idleCanvas=null;Q.idleCtx=null;Q.timer=new j;Q.options={width:2048,height:512,font:"28px sans-serif",textBaseline:"top",lineWidth:2,fillStyle:"rgba(0,0,0,1)",strokeStyle:"white"};var Td=require("core-js/modules/web.dom-collections.iterator.js"),Yt=require("three"),ct=class{static getTextureByUrl(t){if(this.urlTextureMap.has(t))return Promise.resolve(this.urlTextureMap.get(t));let e=this.textureLoader.loadAsync(t);return e.then(i=>{i.format=Yt.RGBAFormat,i.magFilter=Yt.LinearFilter,i.minFilter=Yt.LinearFilter,i.colorSpace="srgb",this.urlTextureMap.set(t,i)}),this.urlTextureMap.set(t,e),e}static getUrlTextureBorder(t,e,i){let s=t+"-"+i.width+"-"+i.color;if(this.borderUrlTextureMap.has(s))return Promise.resolve(this.borderUrlTextureMap.get(s));let o=this.textureLoader.loadAsync(t).then(n=>{let r=this.ctx,h=this.canvas,c=e+i.width*2;h.width=c,h.height=c;let l=c/2;r.clearRect(0,0,c,c),r.beginPath(),r.arc(l,l,e/2+i.width,0,2*Math.PI),r.fillStyle=i.color,r.fill(),r.beginPath(),r.arc(l,l,e/2,0,2*Math.PI),r.closePath(),r.clip(),r.drawImage(n.image,i.width,i.width,e,e);let p=new Yt.Texture(h);return p.format=Yt.RGBAFormat,p.magFilter=Yt.LinearFilter,p.minFilter=Yt.LinearFilter,p.colorSpace="srgb",p.needsUpdate=!0,this.borderUrlTextureMap.set(s,p),p});return this.borderUrlTextureMap.set(s,o),o}static dispose(){this.urlTextureMap.forEach(t=>{t instanceof Promise?t.then(e=>e.dispose()):t.dispose()}),this.borderUrlTextureMap.forEach(t=>{t instanceof Promise?t.then(e=>e.dispose()):t.dispose()}),this.urlTextureMap.clear(),this.borderUrlTextureMap.clear(),this.ctx=null,this.canvas=null}};ct.textureLoader=new Yt.TextureLoader;ct.urlTextureMap=new Map;ct.borderUrlTextureMap=new Map;ct.canvas=document.createElement("canvas");ct.ctx=ct.canvas.getContext("2d",{willReadFrequently:!0});var Du=require("core-js/modules/web.dom-collections.iterator.js");var Sr=require("three/examples/jsm/loaders/GLTFLoader.js");var qd=require("core-js/modules/web.dom-collections.iterator.js"),$d=require("core-js/modules/es.json.stringify.js"),Jd=require("core-js/modules/es.error.cause.js"),Qd=require("core-js/modules/es.typed-array.float32-array.js"),tu=require("core-js/modules/es.typed-array.at.js"),eu=require("core-js/modules/es.typed-array.fill.js"),iu=require("core-js/modules/es.typed-array.find-last.js"),su=require("core-js/modules/es.typed-array.find-last-index.js"),ou=require("core-js/modules/es.typed-array.set.js"),nu=require("core-js/modules/es.typed-array.sort.js"),ru=require("core-js/modules/es.typed-array.to-reversed.js"),au=require("core-js/modules/es.typed-array.to-sorted.js"),hu=require("core-js/modules/es.typed-array.with.js"),cu=require("core-js/modules/es.array-buffer.constructor.js"),lu=require("core-js/modules/es.array-buffer.slice.js"),pu=require("core-js/modules/es.array-buffer.detached.js"),du=require("core-js/modules/es.array-buffer.transfer.js"),uu=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),mu=require("core-js/modules/es.array.push.js"),fu=require("core-js/modules/web.url.js"),gu=require("core-js/modules/web.url.to-json.js"),yu=require("core-js/modules/web.url-search-params.js"),vu=require("core-js/modules/web.url-search-params.delete.js"),xu=require("core-js/modules/web.url-search-params.has.js"),wu=require("core-js/modules/web.url-search-params.size.js"),Mu=require("core-js/modules/es.array.sort.js"),_u=require("core-js/modules/es.typed-array.int8-array.js"),Pu=require("core-js/modules/es.typed-array.uint32-array.js"),bu=require("core-js/modules/es.typed-array.int16-array.js"),Su=require("core-js/modules/es.typed-array.int32-array.js"),Eu=require("core-js/modules/es.typed-array.uint8-array.js"),Lu=require("core-js/modules/es.typed-array.uint16-array.js");var ch={},vr=new URL("./icon/parkingSpace/half.svg",ch.url).href;var lh={},xr=new URL("./icon/parkingSpace/power.svg",lh.url).href;var ph={},wr=new URL("./icon/parkingSpace/mechanical.svg",ph.url).href;var dh={},Mr=new URL("./icon/parkingSpace/vip.svg",dh.url).href;var uh={},_r=new URL("./glb/locate.glb",uh.url).href;var mh={},Pr=new URL("./icon/path/arrow.png",mh.url).href;var fh={},Uo=new URL("./draco/draco_decoder.js",fh.url).href;var gh={},Ho=new URL("./draco/draco_decoder.wasm",gh.url).href;var yh={},No=new URL("./draco/draco_wasm_wrapper.js",yh.url).href;var As={half:vr,power:xr,mechanical:wr,vip:Mr},br=_r,Os=Pr;var wt=require("three"),Zo=new WeakMap,Is=class extends wt.Loader{setDecoderPath(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,i,s){let o=new wt.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,n=>{this.parse(n,e,s)},i,s)}parse(t,e,i){i===void 0&&(i=()=>{}),this.decodeDracoFile(t,e,null,null,wt.SRGBColorSpace).catch(i)}decodeDracoFile(t,e,i,s,o,n){o===void 0&&(o=wt.LinearSRGBColorSpace),n===void 0&&(n=()=>{});let r={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:o};return this.decodeGeometry(t,r).then(e).catch(n)}decodeGeometry(t,e){let i=JSON.stringify(e);if(Zo.has(t)){let h=Zo.get(t);if(h.key===i)return h.promise;if(t.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s,o=this.workerNextTaskID++,n=t.byteLength,r=this._getWorker(o,n).then(h=>(s=h,new Promise((c,l)=>{s._callbacks[o]={resolve:c,reject:l},s.postMessage({type:"decode",id:o,taskConfig:e,buffer:t},[t])}))).then(h=>this._createGeometry(h.geometry));return r.catch(()=>!0).then(()=>{s&&o&&this._releaseTask(s,o)}),Zo.set(t,{key:i,promise:r}),r}_createGeometry(t){let e=new wt.BufferGeometry;t.index&&e.setIndex(new wt.BufferAttribute(t.index.array,1));for(let i=0;i<t.attributes.length;i++){let s=t.attributes[i],o=s.name,n=s.array,r=s.itemSize,h=new wt.BufferAttribute(n,r);o==="color"&&(this._assignVertexColorSpace(h,s.vertexColorSpace),h.normalized=!(n instanceof Float32Array)),e.setAttribute(o,h)}return e}_assignVertexColorSpace(t,e){if(e!==wt.SRGBColorSpace)return;let i=new wt.Color;for(let s=0,o=t.count;s<o;s++)i.fromBufferAttribute(t,s).convertSRGBToLinear(),t.setXYZ(s,i.r,i.g,i.b)}_loadLibrary(t,e){let i=new wt.FileLoader(this.manager);return i.setPath(this.decoderPath),i.setResponseType(e),i.setWithCredentials(this.withCredentials),new Promise((s,o)=>{i.load(t,s,void 0,o)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let t=typeof WebAssembly!="object"||this.decoderConfig.type==="js",e=[];return t?e.push(this._loadLibrary(Uo,"text")):(e.push(this._loadLibrary(No,"text")),e.push(this._loadLibrary(Ho,"arraybuffer"))),this.decoderPending=Promise.all(e).then(i=>{let s=i[0];t||(this.decoderConfig.wasmBinary=i[1]);let o=vh.toString(),n=["/* draco decoder */",s,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
|
|
219
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([n]))}),this.decoderPending}_getWorker(t,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let s=new Worker(this.workerSourceURL);s._callbacks={},s._taskCosts={},s._taskLoad=0,s.postMessage({type:"init",decoderConfig:this.decoderConfig}),s.onmessage=function(o){let n=o.data;switch(n.type){case"decode":s._callbacks[n.id].resolve(n);break;case"error":s._callbacks[n.id].reject(n);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+n.type+'"')}},this.workerPool.push(s)}else this.workerPool.sort(function(s,o){return s._taskLoad>o._taskLoad?-1:1});let i=this.workerPool[this.workerPool.length-1];return i._taskCosts[t]=e,i._taskLoad+=e,i})}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map(t=>t._taskLoad))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}constructor(t){super(t),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}};function vh(){let a,t;onmessage=function(n){let r=n.data;switch(r.type){case"init":a=r.decoderConfig,t=new Promise(function(l){a.onModuleLoaded=function(p){l({draco:p})},DracoDecoderModule(a)});break;case"decode":let h=r.buffer,c=r.taskConfig;t.then(l=>{let p=l.draco,d=new p.Decoder;try{let u=e(p,d,new Int8Array(h),c),m=u.attributes.map(v=>v.array.buffer);u.index&&m.push(u.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:u},m)}catch(u){console.error(u),self.postMessage({type:"error",id:r.id,error:u.message})}finally{p.destroy(d)}});break}};function e(n,r,h,c){let l=c.attributeIDs,p=c.attributeTypes,d,u,m=r.GetEncodedGeometryType(h);if(m===n.TRIANGULAR_MESH)d=new n.Mesh,u=r.DecodeArrayToMesh(h,h.byteLength,d);else if(m===n.POINT_CLOUD)d=new n.PointCloud,u=r.DecodeArrayToPointCloud(h,h.byteLength,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!u.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+u.error_msg());let v={index:null,attributes:[]};for(let g in l){let x=self[p[g]],M,P;if(c.useUniqueIDs)P=l[g],M=r.GetAttributeByUniqueId(d,P);else{if(P=r.GetAttributeId(d,n[l[g]]),P===-1)continue;M=r.GetAttribute(d,P)}let C=s(n,r,d,g,x,M);g==="color"&&(C.vertexColorSpace=c.vertexColorSpace),v.attributes.push(C)}return m===n.TRIANGULAR_MESH&&(v.index=i(n,r,d)),n.destroy(d),v}function i(n,r,h){let l=h.num_faces()*3,p=l*4,d=n._malloc(p);r.GetTrianglesUInt32Array(h,p,d);let u=new Uint32Array(n.HEAPF32.buffer,d,l).slice();return n._free(d),{array:u,itemSize:1}}function s(n,r,h,c,l,p){let d=p.num_components(),m=h.num_points()*d,v=m*l.BYTES_PER_ELEMENT,g=o(n,l),x=n._malloc(v);r.GetAttributeDataArrayForAllPoints(h,p,g,v,x);let M=new l(n.HEAPF32.buffer,x,m).slice();return n._free(x),{name:c,array:M,itemSize:d}}function o(n,r){switch(r){case Float32Array:return n.DT_FLOAT32;case Int8Array:return n.DT_INT8;case Int16Array:return n.DT_INT16;case Int32Array:return n.DT_INT32;case Uint8Array:return n.DT_UINT8;case Uint16Array:return n.DT_UINT16;case Uint32Array:return n.DT_UINT32}}}var St=class{static loadModel(t,e){return f(this,null,function*(){if(e===void 0&&(e=!0),e){if(this.modelMap.has(t)){let s=this.modelMap.get(t);if(s instanceof Promise)s.then(o=>w({},o,{scene:o.scene.clone()}));else return w({},s,{scene:s.scene.clone()})}let i=new Promise((s,o)=>{this.loader.load(t,n=>{this.modelMap.set(t,n),s(n)},void 0,o)});return this.modelMap.set(t,i),i.then(s=>w({},s,{scene:s.scene.clone()}))}else return new Promise((i,s)=>{this.loader.load(t,i,void 0,s)})})}static dispose(){this.modelMap.forEach(t=>{t instanceof Promise?t.then(e=>I(e.scene)):I(t.scene)}),this.modelMap.clear()}};St.dracoLoader=new Is;St.loader=new Sr.GLTFLoader().setDRACOLoader(St.dracoLoader);St.modelMap=new Map;var xh={};function jo(){return new Worker(new URL("./worker/merge-geometry.worker-5R2BBSOQ.js",xh.url))}var Fi=require("three");var ee=class{static GetMergeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Z(e,"get_merged_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedShapeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Z(e,"get_merged_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedTexture2dGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Z(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetBufferGeometryByData(t){let e=new Fi.BufferGeometry;return Object.keys(t.attributes).forEach(i=>{e.setAttribute(i,new Fi.BufferAttribute(t.attributes[i].array,t.attributes[i].itemSize))}),t.index&&e.setIndex(new Fi.BufferAttribute(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Z(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),i?w({},t[0],i):null})}static GetMergedGeometryLine(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Z(e,"get_merged_geometries_line_json",{data:t});return this.WorkerPool.releaseWorker(e),i?w({},t[0],i):null})}static dispose(){this.WorkerPool.dispose()}};ee.WorkerPool=new Ii(10,jo);var Er=require("lodash"),ge={id:"",height:.1,airHeight:0,area:0,group:"",fillColor:"#EFF4FB",strokeColor:"#ffffff",fillOpacity:1,strokeOpacity:1,strokeWidth:1,doors:[],visible:!0,geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},layerType:"",zIndex:0,stroke:!0,deltaHeight:0,userData:{},gradualColor:[],renderType:"single",colorFactor:.9,center_x:0,center_y:0,center_coord_x:0,center_coord_y:0,dashed:!1},lt=class extends k.Object3D{getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new k.Vector3,e=new k.Box3;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new k.Vector3(0,0,0);let t=new k.Box3,e=new k.Vector3;return t.setFromObject(this),t.getSize(e),e}getPosition(){let{center_coord_x:t,center_coord_y:e}=this.options,i=this.getCenter();return i.setZ(i.z+this.options.height/2),!t||!e?i:new k.Vector3(t,e,i.z+this.options.height/2)}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&this.options.strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initDoor(){var t;if((t=this.options.doors)!=null&&t.length&&this.options.geometry.type==="polygon"){let e=this.options.geometry.coords[0];this.options.doors.forEach(i=>{let s=i.type==="single"?.5:1,o=.5,n=ce(e,i.coord),r=new k.Vector2(...i.coord),h=new k.Vector2(...e[n]).sub(new k.Vector2(...i.coord)).normalize(),c=new k.Vector2().addVectors(r,h.clone().multiplyScalar(s)),l=new k.Vector2().addVectors(r,h.clone().multiplyScalar(-s)),p=new k.Vector2(-h.y,h.x),d=new k.Vector2().addVectors(c,p.clone().multiplyScalar(o));_o([d.x,d.y],e)||(p.multiplyScalar(-1),d=new k.Vector2().addVectors(c,p.clone().multiplyScalar(o)));let u=new k.Vector2().addVectors(l,p.clone().multiplyScalar(o)),m=[[c.x,c.y],[d.x,d.y],[u.x,u.y],[l.x,l.y]];e=this.options.geometry.coords[0]=[...e.slice(0,n+1),...m,...e.slice(n+1)]})}}initGeometry(){let t=Li(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new k.ExtrudeGeometry(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=T.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.secondUrl&&ct.getTextureByUrl(this.options.secondUrl).then(i=>{i.wrapS=k.RepeatWrapping,i.wrapT=k.RepeatWrapping,i.needsUpdate=!0,t.map=i,t.side=k.DoubleSide}),this.options.height<=.1)return this.material=t,t;let e=T.createMeshBasicMaterial({color:le(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let i=new k.Box3().setFromObject(this),s=t.clone().add(e.clone().multiplyScalar(1e3)),o=new k.Ray(s,e.clone().multiplyScalar(-1)),n=new k.Vector3;o.intersectBox(i,n);let r=t.clone().add(e.clone().multiplyScalar(-1e3)),h=new k.Ray(r,e.clone()),c=new k.Vector3;return h.intersectBox(i,c),{max:c,min:n}}initGradualMaterial(){let{max:t,min:e}=new k.Box3().setFromObject(this),i=t.clone().sub(e),s=Math.max(i.x,i.y,i.z)/2,o=this.getPosition(),n=new k.Vector3(-1,.2,0).normalize(),{max:r,min:h}=this.getMaxAndMin(o,n),c=T.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:s,opacity:this.options.fillOpacity,direction:new k.Vector3(-1,.2,0),max:r,min:h});if(this.options.height<=.1)return this.material=c,c;let l=this.getCenter(),p=new k.Vector3(-1,.2,1).normalize(),{max:d,min:u}=this.getMaxAndMin(l,p),m=T.createShaderMaterial({gradualColor:[le(this.options.gradualColor[0],this.options.colorFactor),le(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:s,opacity:this.options.fillOpacity,direction:new k.Vector3(-1,.2,1),max:d,min:u});return this.material=[c,m],[c,m]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){if(this.options.dashed){let t=T.createLineDashedMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}else{let t=T.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new k.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options.height+this.options.deltaHeight,{coords:i}=this.options.geometry;for(let s=0;s<i.length;s++){let o=i[s];for(let n=0;n<o.length;n++){let r=o[n],h=n+1===o.length?o[0]:o[n+1];t.push(new k.Vector3(r[0],r[1],e)),t.push(new k.Vector3(h[0],h[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new k.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new k.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=this.options.airHeight+.01,this.options.dashed&&t.computeLineDistances(),this.line=t,this.add(t),t}setOpacity(t,e){if(e===void 0&&(e=!1),e)this.options.fillOpacity=t,this.options.strokeOpacity=t;else{let{fillOpacity:i,strokeOpacity:s}=this.originOptions;this.options.fillOpacity=Math.min(i,t),this.options.strokeOpacity=Math.min(s,t)}}raycast(t){if(!this.visible||this.options.geometry.type==="point")return!1;this.mesh.updateMatrixWorld(!0);let e=t.intersectObject(this.mesh);if(e[0]){let{point:i,distance:s}=e[0];return{position:i,distance:s}}return!1}dispose(){var t,e;(t=this.geometry)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e){if(super(),this.context=t,this.line=null,this.options=Ue((0,Er.cloneDeep)(w({},ge,e)),this),this.originOptions={fillOpacity:this.options.fillOpacity,strokeOpacity:this.options.strokeOpacity},this.options.geometry.type==="point"){let[i,s]=this.options.geometry.coords;return this.position.set(i,s,this.options.height+this.options.airHeight),this}this.initDoor(),this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",i=>{let{value:s}=i;this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",i=>{let{value:s}=i;this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",i=>{let{value:s}=i;this.dispose(),this.init()}),this.addEventListener("change-strokeColor",i=>{let{value:s}=i;!this.options.stroke||!this.options.strokeOpacity||(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",i=>{let{value:s}=i;if(this.options.stroke)if(s)this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder();else{var o;this.line&&(this.remove(this.line),this.line=null),(o=this.lineGeometry)==null||o.dispose(),this.lineGeometry=void 0}}),this.addEventListener("change-airHeight",i=>{let{value:s}=i;this.position.z=s}),this.addEventListener("change-visible",i=>{let{value:s}=i;this.visible=s}),this.addEventListener("change-stroke",i=>{let{value:s}=i;if(s){if(this.line)return;this.initLineGeometry(),this.initLineMaterial(),this.createBorder()}else if(this.line){var o;this.remove(this.line),(o=this.lineGeometry)==null||o.dispose()}}),this.addEventListener("change-dashed",()=>{!this.options.stroke||!this.options.strokeOpacity||(this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-renderType",()=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-gradualColor",()=>{this.initMaterial(),this.initMesh()})}};var qt=require("three");var zi=class extends qt.Object3D{initLight(){let t=wo(16777215,.5);return t.position.set(0,0,100),this.add(t),t}changeLightCamera(t){let e=t.x,i=t.y;this.directionalLight.shadow.camera.left=-e,this.directionalLight.shadow.camera.right=e,this.directionalLight.shadow.camera.top=i,this.directionalLight.shadow.camera.bottom=-i,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(e,i)}changeLightColor(t){this.directionalLight.color=new qt.Color(t)}setPosition(t){this.position.copy(t),this.directionalLight.position.set(-t.x/2,-t.y/2,100)}initPlane(t,e){t===void 0&&(t=1e3),e===void 0&&(e=1e3);let i=new qt.PlaneGeometry(t,e),s=new qt.ShadowMaterial({transparent:!0,opacity:0,side:qt.DoubleSide}),o=new qt.Mesh(i,s);return o.receiveShadow=!0,o.position.z=-10,this.add(o),this.plane=o,o}setTarget(t){this.directionalLight.target=t}transformOpacity(t){return t*this.basicOpacity}setOpacity(t){this.plane.material.opacity=this.transformOpacity(t)}dispose(){I(this,!0)}constructor(){super(),this.basicOpacity=.07,this.directionalLight=this.initLight(),this.initPlane()}};var em=require("core-js/modules/web.dom-collections.iterator.js");var Rs=require("three");var K=require("three");var Lr=require("lodash");var wh={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},Ke=class extends st{initObserver(){let t=new MutationObserver((0,Lr.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){var t,e;if(this.element instanceof lt&&this.element.options.geometry.type==="polygon"){let{max:n,min:r}=new K.Box3().setFromObject(this.element),h=(n.x+r.x)/2,c=(n.y+r.y)/2;return{left:new K.Vector3(r.x,c,n.z),leftTop:new K.Vector3(r.x,n.y,n.z),top:new K.Vector3(h,n.y,n.z),rightTop:new K.Vector3(n.x,n.y,n.z),right:new K.Vector3(n.x,c,n.z),rightBottom:new K.Vector3(n.x,r.y,n.z),bottom:new K.Vector3(h,r.y,n.z),leftBottom:new K.Vector3(r.x,r.y,n.z),center:new K.Vector3(h,c,n.z)}}let{x:i,y:s,z:o}=((e=this.element)==null||(t=e.getPosition)==null?void 0:t.call(e))||this.position;return{left:new K.Vector3(i,s,o),leftTop:new K.Vector3(i,s,o),top:new K.Vector3(i,s,o),rightTop:new K.Vector3(i,s,o),right:new K.Vector3(i,s,o),rightBottom:new K.Vector3(i,s,o),bottom:new K.Vector3(i,s,o),leftBottom:new K.Vector3(i,s,o),center:new K.Vector3(i,s,o)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,i=this.getPlacementPosition();return Object.keys(i).reduce((s,o)=>{let{x:n,y:r}=D(i[o],this.context.camera,t,e);return s[o]={x:n,y:r},s},{})}checkOverflow(t,e){let{width:i,height:s}=this.context.clientSize;return e.x>0&&t.x<i&&e.y<s&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,i=this.getPlacementScreenPosition(),s=t/2,o=e/2,n=[{type:"center",getBox(r,h){return{max:{x:s+r,y:h-e},min:{x:r-s,y:h}}}},{type:"left",getBox(r,h){return{max:{x:r,y:h-o},min:{x:r-t,y:h+o}}}},{type:"leftTop",getBox(r,h){return{max:{x:r,y:h-e},min:{x:r-t,y:h}}}},{type:"top",getBox(r,h){return{max:{x:r+s,y:h-e},min:{x:r-s,y:h}}}},{type:"rightTop",getBox(r,h){return{max:{x:r+t,y:h-e},min:{x:r,y:h}}}},{type:"right",getBox(r,h){return{max:{x:r+t,y:h-o},min:{x:r,y:h+o}}}},{type:"rightBottom",getBox(r,h){return{max:{x:r+t,y:h},min:{x:r,y:h+e}}}},{type:"bottom",getBox(r,h){return{max:{x:r+s,y:h},min:{x:r-s,y:h+e}}}},{type:"leftBottom",getBox(r,h){return{max:{x:r,y:h},min:{x:r-t,y:h+o}}}}];for(let r=0;r<n.length;r++){let h=n[r],c=i[h.type],{max:l,min:p}=h.getBox(c.x,c.y);if(this.checkOverflow(l,p))return{type:h.type,position:c}}return{type:"center",position:i.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className="overlay_"+t.type,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,e){e===void 0&&(e="block"),t!==this.visible&&(this.div.style.display=t?e:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=""+t}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new K.Box3().setFromObject(this.element).getCenter(new K.Vector3):this.position}get withinDisplayRange(){let{x:t,y:e}=this.clientPos,{width:i,height:s}=this.context.clientSize;return t>=0&&t<=i&&e>=0&&e<=s}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:i,height:s,x:o,y:n}=this.context.clientSize;if(this.div){if(this.options.appendToBody){this.div.style.left=""+o+"px",this.div.style.top=""+(n+s)+"px";return}this.options.autoUpdate?(this.div.style.left=""+t+"px",this.div.style.bottom=""+(s-e)+"px"):this.dispatchEvent({type:"update-position",x:t,y:e,width:i,height:s})}}updatePosition(t){t===void 0&&(t=!1);let e=this.getPosition(),{width:i,height:s}=this.context.clientSize,{x:o,y:n}=D(e,this.context.camera,i,s);this.clientPos.x===o&&this.clientPos.y===n&&!t||this._updatePosition(o,n)}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){var t,e;super.dispose(),this.unRegistryEvent(),this.unBindElement(),(t=this.observer)==null||t.disconnect(),(e=this.div)==null||e.remove(),this.div=null}constructor(t,e={}){super(),this.context=t,this.position=new K.Vector3,this.clientPos={x:0,y:0},this.visible=!0,this.placement="top",this.observer=null,this.onUpdate=()=>{this.options.autoChangePlacement?this.usePlacement():this.updatePosition()},this.options=w({},wh,e),this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}};var Mh={texts:[{text:""}],level:1,icon_position:"bottom",collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},icon_opacity:1,icon_border:{color:"#586EE0",width:0},background:"",collision_hide_icon:!0,built_in:!1,box_only_icon:!1},De=class extends Rs.EventDispatcher{get withinDisplayRange(){return this.overlay.withinDisplayRange}resetSize(){return f(this,null,function*(){if(yield bo(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:e}=this.img.getBoundingClientRect();this.size={width:t+2,height:e+2}}else{let{width:t,height:e}=this.div.getBoundingClientRect();this.size={width:t+2,height:e+2}}})}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(e=>{let i=document.createElement("div");if(i.style.whiteSpace="nowrap",e.styles)for(let[s,o]of Object.entries(e.styles))i.style[s]=o;i.textContent=e.text,t.appendChild(i)}),t}initIcon(){var t,e;let i=document.createElement("img");return i.setAttribute("src",this.options.icon),i.style.width=""+(((t=this.options.icon_size)==null?void 0:t[0])||32)+"px",i.style.height=""+(((e=this.options.icon_size)==null?void 0:e[1])||32)+"px",i.style.opacity=""+this.options.icon_opacity+"px",i.style.borderRadius="50%",this.options.icon_border.width&&(i.style.border=this.options.icon_border.width+"px solid "+this.options.icon_border.color),i.onload=()=>{this.resetSize()},this.img=i,i}registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t){t===void 0&&(t=this.context.config.poi.boxScale);let{width:e,height:i}=this.size,s=e*t,o=i*t,{x:n,y:r}=this.overlay.clientPos;return{left:n-s/2,right:n+s/2,top:this.options.icon?r-o:r-o/2,bottom:this.options.icon?r:r+o/2}}getOriginBox(){return this.getBox(1)}isContain(t,e){if(!this.overlay.visible||!this.visible)return!1;let i=this.getOriginBox();return t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}constructor(t,e){var i,s,o;super(),this.context=t,this.visible=!0,this.size={width:0,height:0},this.position=new Rs.Vector3,this.userData={},this.showTextStatus=!0,this.disposed=!1,this._changePosition=()=>{this.overlay.updatePosition(!0)},this.options=Ue(w({},Mh,e),this),this.position.set(((i=e.position)==null?void 0:i.x)||0,((s=e.position)==null?void 0:s.y)||0,((o=e.position)==null?void 0:o.z)||0),this.overlay=new Ke(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",n=>{let{x:r,y:h,height:c}=n;this.overlay.div.style.transform="translate3d(calc("+r+"px - 50%), calc("+(-c+h)+"px - "+(this.options.icon&&this.options.icon_position!=="center"?"100%":"50%")+"), 0)"}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",n=>{let{value:r}=n;r?this.img?this.img.setAttribute("src",r):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",n=>{let{value:r}=n,h=this.textDiv;if(h){let c=this.initText();this.div.replaceChild(c,h)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",n=>{let{value:r}=n;this.overlay.setOpacity(r)}),this.addEventListener("change-icon_size",n=>{let{value:r}=n;this.img&&(this.img.style.width=""+((r==null?void 0:r[0])||32)+"px",this.img.style.height=""+((r==null?void 0:r[1])||32)+"px",this.resetSize())}),this.addEventListener("change-icon_opacity",n=>{let{value:r}=n;this.img&&(this.img.style.opacity=""+r)}),this.addEventListener("change-icon_border",n=>{let{value:r}=n;this.img&&(this.img.style.border=r.width+"px solid "+r.color)}),this.addEventListener("change-background",n=>{let{value:r}=n;this.div.style.background=r})}};var Af=require("core-js/modules/web.dom-collections.iterator.js"),Of=require("core-js/modules/es.set.difference.v2.js"),If=require("core-js/modules/es.set.intersection.v2.js"),Rf=require("core-js/modules/es.set.is-disjoint-from.v2.js"),Gf=require("core-js/modules/es.set.is-subset-of.v2.js"),Ff=require("core-js/modules/es.set.is-superset-of.v2.js"),zf=require("core-js/modules/es.set.symmetric-difference.v2.js"),Bf=require("core-js/modules/es.set.union.v2.js"),Bt=require("three");var Gs=require("three");var Bi=class extends Gs.Object3D{loadModel(){return f(this,null,function*(){let t=yield St.loadModel(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t})}dispose(){I(this),this.model=null}constructor(t,e){super(),this.context=t,this.options=e,this.model=null,this.position.copy(e.position||new Gs.Vector3(0,0,0)),this.loadModel()}};var um=require("core-js/modules/web.dom-collections.iterator.js");var Fs=require("three");var Cr=require("three");var q=class extends Cr.Object3D{setOpacity(t,e){e===void 0&&(e=!1),this.children.forEach(i=>{i.setOpacity==null||i.setOpacity.call(i,t,e)})}onAddToScene(t){this.active=!0,this.sceneType=t}onRemoveFromScene(){this.active=!1}dispose(){I(this),this.children.forEach(t=>t.dispose==null?void 0:t.dispose.call(t)),this.clear()}constructor(t){super(),this.context=t,this.active=!1,this.sceneType="scene"}};var Wi=class extends q{getCenter(){return new Fs.Box3().setFromObject(this).getCenter(new Fs.Vector3)}createGraphic(t){let e=new lt(this.context,t);return e.userData.data=t,this.add(e),this.graphicMap.set(t.id,e),e}removeGraphic(t){this.remove(t),this.graphicMap.delete(t.options.id),t.dispose()}removeGraphicById(t){this.graphicMap.has(t)&&this.removeGraphic(this.graphicMap.get(t))}getGraphicByNodeId(t){return this.graphicMap.get(t)||null}getGraphicByRaycaster(t){let e={distance:1e4,graphic:null,position:null},i=this.children.reduce((s,o)=>{if(o instanceof lt){let n=o.raycast(t);if(n){let{distance:r}=n;if(r<s.distance)return{distance:n.distance,position:n.position,graphic:o}}return s}else return s},e);return i===e?{graphics:[],position:null}:{graphics:[i.graphic],position:i.position}}setGraphicOptions(t,e){let i,s=this.graphicMap.get(t);s&&(typeof e=="function"?i=e(s.options):i=w({},s.options,e),Object.keys(i).forEach(o=>{s.options[o]=i[o]}))}getGraphicPosition(t){let e=this.graphicMap.get(t);return e?[e.options.center_x,e.options.center_y]:null}setOpacity(t,e){e===void 0&&(e=!1),this.graphicMap.forEach(i=>{i.setOpacity(t,e)})}constructor(t){super(t),this.graphicMap=new Map}};var ym=require("core-js/modules/es.array.unshift.js"),vm=require("core-js/modules/es.array.push.js");var Tr=require("lodash");var Ui=class extends q{clear(t){return t===void 0&&(t=!1),this.pois.forEach(e=>{e.options.built_in&&!t||e.dispose()}),this.pois=t?[]:this.pois.filter(e=>e.options.built_in),this}createPoi(t){let e=new De(this.context,t);return this.pushPoi(e),e.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(e)),e.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(e)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),e}changePoiLevelOrCollisionEnable(t){let e=this.pois.findIndex(i=>i===t);e!==-1&&(this.pois.splice(e,1),this.pushPoi(t))}removePoi(t){let e=this.pois.findIndex(i=>i===t);e!==-1&&(this.pois.splice(e,1),t.dispose())}removePoiById(t){let e=this.pois.find(i=>i.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(i=>i.options.id===t)||null}pushPoi(t){if(!t.options.collision_enable){this.pois.unshift(t);return}if(t.options.level===0){this.pois.push(t);return}for(let e=0;e<this.pois.length;e++){let i=this.pois[e];if(i.options.collision_enable&&i.options.level<=t.options.level){this.pois.splice(e,0,t);return}}this.pois.push(t)}getPoiByDeviceXy(t,e){return this.pois.filter(s=>s instanceof De&&s.isContain(t,e))}collisionDetection(){let t=[];this.pois.filter(i=>i.visible&&i.withinDisplayRange).forEach((i,s)=>{let{left:o,right:n,top:r,bottom:h}=i.getBox();if(s===0||!i.options.collision_enable){t.push({left:o,right:n,top:r,bottom:h}),i.parentSetVisible(!0);return}let c=t.some(l=>l.left<n&&l.right>o&&l.top<h&&l.bottom>r);i.parentSetVisible(!c),c||t.push({left:o,right:n,top:r,bottom:h})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(t=>t.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}constructor(t){super(t),this.pois=[],this.timer=new j,this.onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})},this.registryEvent(),this.debounceCollisionDetection=(0,Tr.debounce)(this.collisionDetection,10)}};var Pm=require("core-js/modules/es.array.push.js");var kr=require("three"),Hi=class extends q{clear(){return this.context.collisionSystem.removeObjects(this.pois),this.pois.forEach(t=>{t.dispose()}),this.pois=[],this}createPoi(t){let e=new tt(this.context,t);return this.pushPoi(e),e}removePoi(t){let e=this.pois.findIndex(i=>i===t);e!==-1&&(this.remove(t),this.pois.splice(e,1),this.context.collisionSystem.removeObject(t),t.dispose())}removePoiById(t){let e=this.pois.find(i=>i.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(i=>i.options.id===t)||null}pushPoi(t){this.pois.includes(t)||(t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("text-texture-rect-inited",()=>{this.active&&this.context.forceUpdate()}),t.parentSetVisible(!1),this.add(t),this.pois.push(t),this.sceneType==="mulFloors"&&(t.options.depth_test=!0),this.active&&this.context.collisionSystem.addObject(t))}changePoiLevelOrCollisionEnable(t){this.active&&(this.context.collisionSystem.removeObject(t),this.context.collisionSystem.addObject(t))}getPoiByDeviceXy(t,e){let i=new kr.Vector2(t,e);return this.pois.filter(o=>o instanceof tt&&o.canSelect&&o.box.containsPoint(i))}setOpacity(t){this.pois.forEach(e=>{e.options.icon_opacity=t,e.options.text_opacity=t})}onAddToScene(t){super.onAddToScene(t);let e=t==="mulFloors";this.pois.forEach(i=>{i.options.depth_test=e,this.context.collisionSystem.addObject(i)})}onRemoveFromScene(){super.onRemoveFromScene(),this.context.collisionSystem.removeObjects(this.pois)}dispose(){this.timer.dispose(),this.clear(),super.dispose()}constructor(t){super(t),this.pois=[],this.timer=new j}};var Cm=require("core-js/modules/es.regexp.exec.js"),Tm=require("core-js/modules/web.dom-collections.iterator.js");var zs=require("three"),Dr=require("lodash");var Ni=class extends q{createParkings(t,e,i){e===void 0&&(e=!0),this.parkingOptions=t,this.merged=e,e?(i?this.createMergedParkingByMergedElements(i):this.createMergedParking(t),t.map((s,o)=>{var n;(n=s.texts[0])==null||n.split(/[,,]/).map(r=>{this.parkingNoIndexMap.set(r,o)}),this.nodeIdIndexMap.set(s.id,o)})):this.createIndependentParking(t)}load(t,e){e===void 0&&(e=!0);var i;this.createParkings(t.elements,e,t.mergedElements),(i=t.mergedParkingTexture)!=null&&i.length?this.createMergedParkingTexture(t.mergedParkingTexture):this.createParkingTexture(t.elements)}createMergedParking(t){return f(this,null,function*(){let e=new ii(this.context,t);this.mergedParkingSpace=e,this.add(e)})}createMergedParkingByMergedElements(t){let e=new Xe(this.context,t);if(this.mergedParkingSpace=e,t.lineGeometry){let i=new Ie(this.context,t.lineGeometry);this.add(i)}this.add(e)}createIndependentParking(t){t.forEach(e=>{var i;let s=new lt(this.context,e);this.add(s),(i=e.texts[0])==null||i.split(/[,,]/).map(o=>{this.parkingNoGraphicMap.set(o,s)}),this.graphicMap.set(s.options.id,s)})}createParkingTexture(t){let e=t.filter(i=>As[i.parkingType]).map(i=>{let s=new zs.Vector2(...i.geometry.coords[0][0]),o=new zs.Vector2(...i.geometry.coords[0][1]),n=new zs.Vector2(...i.geometry.coords[0][2]),r=Math.min(s.distanceTo(o),o.distanceTo(n)),h=0;return r===s.distanceTo(o)?h=o.sub(s).angle()-Math.PI/2:h=n.sub(o).angle()-Math.PI/2,{uuid:i.id,iconUrl:As[i.parkingType],name:i.texts[0],deltaHeight:(i.deltaHeight||0)+.001,airHeight:i.airHeight,height:i.height,geometry:i.geometry,opacity:i.fillOpacity,visible:!0,secondWidth:r-1,secondHeight:r-1,secondRotate:h,centerCoords:[i.center_coord_x,i.center_coord_y]}});if(e.length){let i=new Ae(this.context,e);this.add(i)}}createMergedParkingTexture(t){t.map(e=>{e.iconUrl=As[e.iconUrl];let i=new Oe(this.context,e);this.add(i)})}changeParkingColor(t){this.merged?Object.keys(t).map(e=>{let i=this.parkingNoIndexMap.get(e);if(!(0,Dr.isNil)(i)){var s;(s=this.mergedParkingSpace)==null||s.setColorByIndex(i,t[e])}}):Object.keys(t).map(e=>{let i=this.parkingNoGraphicMap.get(e);i&&(i.options.fillColor=t[e])})}setOpacity(t,e){if(e===void 0&&(e=!1),this.parkingOptions.forEach(s=>{if(e)s.fillOpacity=t,s.strokeOpacity=t;else{let r=this.parkingOriginOptions.get(s.id);var o;s.fillOpacity=Math.min(t,(o=r==null?void 0:r.fillOpacity)!=null?o:1);var n;s.strokeOpacity=Math.min(t,(n=r==null?void 0:r.strokeOpacity)!=null?n:1)}}),this.merged)if(this.mergedParkingSpace instanceof ii)this.mergedParkingSpace.setOpacity(t,e);else{var i;(i=this.mergedParkingSpace)==null||i.setOpacity(t,e)}else this.graphicMap.forEach(s=>{s.setOpacity(t,e)});this.children.filter(s=>s instanceof Ae||s instanceof Oe).map(s=>s.setOpacity(t))}getParkingOptionsByParkingNo(t){return this.parkingOptions.find(i=>i.texts[0]===t)||null}getGraphicPosition(t){if(this.merged){let e=this.parkingOptions.find(i=>i.id===t);return e?[e.center_x,e.center_y]:null}}dispose(){var t;(t=this.mergedParkingSpace)==null||t.dispose(),this.mergedParkingSpace=null,I(this),this.graphicMap.clear(),this.parkingNoGraphicMap.clear(),this.parkingNoIndexMap.clear(),this.nodeIdIndexMap.clear(),this.parkingOptions=[],super.dispose()}constructor(t){super(t),this.graphicMap=new Map,this.parkingNoGraphicMap=new Map,this.parkingOriginOptions=new Map,this.parkingOptions=[],this.merged=!1,this.parkingNoIndexMap=new Map,this.nodeIdIndexMap=new Map,this.mergedParkingSpace=null}};var Gm=require("core-js/modules/es.array.push.js");var Zi=class extends q{addModels(t){let e=t.reduce((i,s)=>{let{url:o}=s;return i[o]?i[o].push(s):i[o]=[s],i},{});Object.values(e).forEach(i=>{let s=new ji(this.context,i);this.add(s)})}constructor(t){super(t)}};var of=require("core-js/modules/web.dom-collections.iterator.js");var zt=require("three");var Or=require("three/examples/jsm/lines/LineMaterial.js"),$=require("three");function Ar(a){return`${a.x}-${a.y}-${a.z}`}var Lt=class{static generateLineMaterialKey({color:t,opacity:e}){return`${t}-${e}`}static createLineMaterial({color:t,opacity:e,vertexColors:i}){let s=this.generateLineMaterialKey({color:t,opacity:e,vertexColors:i});if(this.lineMaterialMap.has(s))return this.lineMaterialMap.get(s);let o=new $.LineBasicMaterial({color:new $.Color(t).convertLinearToSRGB(),transparent:!0,opacity:e,vertexColors:i!=null?i:!1});return this.lineMaterialMap.set(s,o),o}static createMeshStandardMaterial({color:t,opacity:e}){let i=`${t}-${e}`;if(this.meshStandardMaterialMap.has(i))return this.meshStandardMaterialMap.get(i);let s=new $.MeshStandardMaterial({color:new $.Color(t).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:e,depthWrite:!0});return this.meshStandardMaterialMap.set(i,s),s}static createMeshBasicMaterial({color:t,opacity:e,vertexColors:i}){let s=`${t}-${e}-${i}`;if(this.meshBasicMaterialMap.has(s))return this.meshBasicMaterialMap.get(s);let o=new $.MeshBasicMaterial({color:t,transparent:!0,opacity:e,depthWrite:!0,vertexColors:i!=null?i:!1});return this.meshBasicMaterialMap.set(s,o),o}static createShaderMaterial({gradualColor:t,center:e,maxValue:i,opacity:s,direction:o,max:n,min:r}){let h=`${t.toString()}-${Ar(e)}-${i}-${s}-${Ar(o)}`;if(this.shaderMaterialMap.has(h))return this.shaderMaterialMap.get(h);let c=`
|
|
218
|
+
`;return this.instancedWallMaterial=new Y.ShaderMaterial({vertexShader:t,fragmentShader:e,transparent:!0})}static dispose(){this.lineMaterialMap.forEach((t,e)=>{t.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((t,e)=>{t.dispose()}),this.shaderMaterialMap.clear(),this.line2MaterialMap.forEach((t,e)=>{t.dispose()}),this.line2MaterialMap.clear(),this.lineDashedMaterialMap.forEach(t=>{t.dispose()}),this.lineDashedMaterialMap.clear(),this.mergeAttributeGraphicMaterial&&(this.mergeAttributeGraphicMaterial.dispose(),this.mergeAttributeGraphicMaterial=null),this.mergeAttributeWallMaterial&&(this.mergeAttributeWallMaterial.dispose(),this.mergeAttributeWallMaterial=null),this.mergeAttributeGraphicLineMaterial&&(this.mergeAttributeGraphicLineMaterial.dispose(),this.mergeAttributeGraphicLineMaterial=null),this.instancedGraphicMaterial&&(this.instancedGraphicMaterial.dispose(),this.instancedGraphicMaterial=null),this.instancedWallMaterial&&(this.instancedWallMaterial.dispose(),this.instancedWallMaterial=null)}};T.lineMaterialMap=new Map;T.meshStandardMaterialMap=new Map;T.meshBasicMaterialMap=new Map;T.shaderMaterialMap=new Map;T.line2MaterialMap=new Map;T.mergeAttributeGraphicMaterial=null;T.mergeAttributeWallMaterial=null;T.mergeAttributeGraphicLineMaterial=null;T.instancedGraphicMaterial=null;T.instancedWallMaterial=null;T.lineDashedMaterialMap=new Map;var td=require("core-js/modules/es.regexp.exec.js"),ed=require("core-js/modules/web.dom-collections.iterator.js"),id=require("core-js/modules/es.array.push.js"),sd=require("core-js/modules/es.typed-array.uint8-array.js"),od=require("core-js/modules/es.typed-array.at.js"),nd=require("core-js/modules/es.typed-array.fill.js"),rd=require("core-js/modules/es.typed-array.find-last.js"),ad=require("core-js/modules/es.typed-array.find-last-index.js"),hd=require("core-js/modules/es.typed-array.set.js"),cd=require("core-js/modules/es.typed-array.sort.js"),ld=require("core-js/modules/es.typed-array.to-reversed.js"),pd=require("core-js/modules/es.typed-array.to-sorted.js"),dd=require("core-js/modules/es.typed-array.with.js"),ud=require("core-js/modules/es.array-buffer.constructor.js"),md=require("core-js/modules/es.array-buffer.slice.js"),fd=require("core-js/modules/es.array-buffer.detached.js"),gd=require("core-js/modules/es.array-buffer.transfer.js"),yd=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),vd=require("core-js/modules/es.set.difference.v2.js"),xd=require("core-js/modules/es.set.intersection.v2.js"),wd=require("core-js/modules/es.set.is-disjoint-from.v2.js"),Md=require("core-js/modules/es.set.is-subset-of.v2.js"),_d=require("core-js/modules/es.set.is-superset-of.v2.js"),Pd=require("core-js/modules/es.set.symmetric-difference.v2.js"),bd=require("core-js/modules/es.set.union.v2.js"),Sd=require("core-js/modules/es.typed-array.from.js"),R=require("three");var lh={};function Uo(){return new Worker(new URL("./worker/text-texture.worker-6IXOXREW.js",lh.url))}var ph={};function Ho(){return new Worker(new URL("./worker/lazy-indexdb-text-texture.worker-GTG7ASSH.js",ph.url))}var me,xt=function(a){return a.MAP_VERSION="map_version",a.ROUTE_VERSION="route_version",a.FACILITY_VERSION="facility_version",a.MAP_DATA="map_data",a.ROAD_NETWORK_DATA="road_network_data",a.FACILITY_DATA="facility_data",a.POI_TEXT="poi_text_1",a.POI_TEXT_RECT="poi_text_rect",a.LAZY_TEXTURE="lazy_texture",a.LAZY_POI="lazy_poi",a}({});function Os(a,t){return a===void 0&&(a="aibee_map"),t===void 0&&(t=9),new Promise((e,i)=>{if(me)return e({db:me,type:"success"});let s=indexedDB.open(a,t);s.onupgradeneeded=function(o){me=o.target.result,console.log("[open db is onupgradeneeded]"),ue("map_version"),ue("route_version"),ue("facility_version"),ue("map_data"),ue("road_network_data"),ue("facility_data"),ue("poi_text_1"),ue("poi_text_rect"),ue("lazy_texture"),ue("lazy_poi")},s.onsuccess=o=>{me=o.target.result,e({db:me,type:"success"})},s.onerror=o=>{console.log("[open db is onerror]"),i(o)}})}function ei(a,t,e){return e===void 0&&(e=me),new Promise((i,s)=>{e||s("\u6CA1\u6709db");let n=e.transaction([a],"readonly").objectStore(a).get(t);n.onsuccess=()=>{n.result?i(n.result.value):i(null)},n.onerror=r=>{console.log("[getVersionByKey]",r),i(null)}})}function zi(a,t,e,i,s){return i===void 0&&(i=me),s===void 0&&(s=!1),new Promise((o,n)=>f(this,null,function*(){if(!i){n("\u6CA1\u6709db");return}let r=s;s||(r=!!(yield ei(a,t)));let h=i.transaction([a],"readwrite").objectStore(a),c=r?h.put({key:t,value:e}):h.add({key:t,value:e});c.onsuccess=function(l){o(l)},c.onerror=function(l){n(l)}}))}function ue(a,t){t===void 0&&(t=me),t&&(t.objectStoreNames.contains(a)||t.createObjectStore(a,{keyPath:"key"}))}function xr(a){a===void 0&&(a=me),a==null||a.close(),me=null}var Qt=Math.max(window.devicePixelRatio,2);le&&(Qt=1);var Q=class{static InitDb(){return Os()}static getCanvas(){if(this.canvas)return this.canvas;{let t=document.createElement("canvas");return this.canvas=t,t}}static getCtx(){if(this.ctx)return this.ctx;let e=this.getCanvas().getContext("2d",{willReadFrequently:!0});return this.ctx=e,e}static getIdleCanvas(){if(this.idleCanvas)return this.idleCanvas;{let t=document.createElement("canvas");return this.idleCanvas=t,t}}static getIdleCtx(){if(this.idleCtx)return this.idleCtx;let e=this.getIdleCanvas().getContext("2d",{willReadFrequently:!0});return this.idleCtx=e,e}static getMergedOptions(t){return w({},this.options,t)}static setCtxStyle(t,e,i){e===void 0&&(e=this.getCanvas()),i===void 0&&(i=this.getCtx()),e.style.width=""+t.width+"px",e.style.height=""+t.height+"px",e.width=t.width*Qt,e.height=t.height*Qt,i.font=t.font,i.textBaseline=t.textBaseline,i.lineWidth=t.lineWidth,i.fillStyle=t.fillStyle,i.strokeStyle=t.strokeStyle,i.scale(Qt,Qt)}static getLazyIndexDbTextTextureWorker(){if(this.lazyIndexDbTextTextureWorker)return this.lazyIndexDbTextTextureWorker;{let t=Ho();return this.lazyIndexDbTextTextureWorker=t,t}}static getTextureRectByTexts(t,e){return f(this,null,function*(){let i=this.getMergedOptions(e),s=(e==null?void 0:e.maxWidth)||600,o=Ce(w({},i,{text:t,maxWidth:s}));if(this.rectCacheMap.has(o))return this.rectCacheMap.get(o);let n=new Promise((r,h)=>f(this,null,function*(){var c;try{yield this.InitDb();let x=yield ei(xt.POI_TEXT_RECT,o);if(x){r({width:x.width,height:x.height,lines:x.lines,lineString:x.lineString});return}}catch(x){console.error("POI TEXT_RECT DB ERROR",x)}let l=this.getCanvas(),p=this.getCtx();p.clearRect(0,0,l.width,l.height),this.setCtxStyle(i);let d=this.splitText(t,p,s),u=+(((c=i.font.match(/(\d+)px/))==null?void 0:c[1])||54),v=Math.ceil(u+i.lineWidth+2)*d.length,g=Math.max(...d.map(x=>{let M=Math.ceil(p.measureText(x).width);return M%2===0?M:M+1}))+2;try{yield this.InitDb(),zi(xt.POI_TEXT_RECT,o,{width:g,height:v,lines:d.length,lineString:d})}catch(x){console.error("POI TEXT_RECT DB ERROR",x)}r({width:g,height:v,lines:d.length,lineString:d})}));return this.rectCacheMap.set(o,n),n})}static splitText(t,e,i){let s=Wo(t),o=[],n="";for(let r of s)if(r.startsWith("(")||r.startsWith("\uFF08"))o.push(r.slice(1,-1));else{let h=r.split(" ");for(let c of h){let l=n?n+" "+c:c,p=e.measureText(l);if(p.width>i)if(n&&o.push(n),p.width>i||Po(c)){let d="",u=c.split("");for(let m of u){let v=d+m;e.measureText(v).width>i&&d?(o.push(d),d=m):d=v}d&&(n=d)}else n=c;else n=l}}return n&&o.push(n),o}static getTextureByText(t,e){return f(this,null,function*(){let i=this.getMergedOptions(e),s=(e==null?void 0:e.maxWidth)||600,o=Ce(w({},i,{text:t,maxWidth:s}));if(this.cacheMap.has(o))return this.cacheMap.get(o);let n=new Promise((r,h)=>f(this,null,function*(){var c;try{yield this.InitDb();let S=yield ei(xt.POI_TEXT,o);if(S){let G=new R.DataTexture(new Uint8Array(S.data),S.width,S.height,R.RGBAFormat);G.flipY=!0,G.minFilter=R.LinearFilter,G.magFilter=R.LinearFilter;let E={texture:G,lines:S.lines};this.cacheMap.set(o,E),r(E);return}}catch(S){console.error("POI TEXT DB ERROR",S)}let l=this.getCanvas(),p=this.getCtx();p.clearRect(0,0,l.width,l.height),this.setCtxStyle(i);let{width:d,height:u,lineString:m}=yield this.getTextureRectByTexts(t),v=+(((c=i.font.match(/(\d+)px/))==null?void 0:c[1])||54),g=Math.ceil(v+i.lineWidth+2),x=u,M=d;m.forEach((S,G)=>{let E=p.measureText(S),nt=Math.ceil(E.width),Tt=Math.floor((M-nt)/2),gt=G*(2+g);i.lineWidth&&p.strokeText(S,Tt,gt),p.fillText(S,Tt,gt)});let P=p.getImageData(0,0,M*Qt,x*Qt),C=new R.DataTexture(P.data,M*Qt,x*Qt,R.RGBAFormat);C.flipY=!0,C.minFilter=R.LinearFilter,C.magFilter=R.LinearFilter,this.cacheMap.set(o,{texture:C,lines:m.length});try{zi(xt.POI_TEXT,o,{data:Array.from(P.data),width:M*Qt,height:x*Qt,lines:m.length,lineString:m},void 0,!0)}catch(S){console.error("POI TEXT DB ERROR",S)}r({texture:C,lines:m.length})}));return this.cacheMap.set(o,n),n})}static lazyGetTextureByTexts(t,e){return f(this,null,function*(){let i=this.getMergedOptions(e),s=i.height;i.height=Math.min(s*t.length,2048);let o={},n=new Set;if(t.map(c=>{if(this.lazyPoiMap.has(c)){let l=this.lazyPoiMap.get(c),p=this.lazyTextureCacheMap.get(l.textureKey);if(p){o[c]={width:l.width,height:s,x:l.x,y:l.y,texture:p};return}}n.add(c)}),!n.size)return o;let r=Array.from(n);return new Promise((c,l)=>f(this,null,function*(){let p;window.OffscreenCanvas?(console.log("use webworker"),p=this.getTextsByWorker(r,i,s)):typeof window.requestIdleCallback=="function"?(console.log("use browser idle"),p=this.getTextsByBrowserIdle(r,i,s)):(console.log("use requestAnimation text textures"),p=Promise.resolve().then(()=>this.getTextsSync(r,i,s))),c(p)}))})}static getTextsByWorker(t,e,i){return f(this,null,function*(){return this.textTextureWorker||(this.textTextureWorker=Uo()),(yield Z(this.textTextureWorker,"get_texture_by_texts",{texts:t,options:e,originHeight:i})).data.map(o=>{let n=new R.DataTexture(o.data,e.width,o.height,R.RGBAFormat);return n.flipY=!0,n.minFilter=R.LinearFilter,n.magFilter=R.LinearFilter,{texture:n,offsetMap:o.offsetMap}}).reduce((o,n)=>(Object.keys(n.offsetMap).forEach(r=>{o[r]=n.offsetMap[r],o[r].texture=n.texture}),o),{})})}static getTextsByBrowserIdle(t,e,i){return f(this,null,function*(){let s=0,o=t.length;return new Promise(n=>{let r=this.getIdleCanvas(),h=this.getIdleCtx();h.clearRect(0,0,r.width,r.height),this.setCtxStyle(e,r,h);let c=[],l=0,p=0,d={},u=()=>f(this,null,function*(){let v=h.getImageData(0,0,e.width,i+p);c.push({imageData:v,offsetMap:d,height:i+p});let g=c.reduce((x,M)=>{let P=new R.DataTexture(M.imageData.data,e.width,M.height,R.RGBAFormat);return P.flipY=!0,P.minFilter=R.LinearFilter,P.magFilter=R.LinearFilter,Object.keys(M.offsetMap).forEach(C=>{x[C]=w({},M.offsetMap[C],{texture:P})}),x},{});n(g)}),m=v=>{if(s>=o)return u();if(v.timeRemaining()>0){let g=t[s],x=Math.ceil(h.measureText(g).width);if(x=x%2===0?x:x+1,x+=2,x+l>e.width&&(l=0,p+=i,i+p>e.height)){let P=h.getImageData(0,0,e.width,p);c.push({imageData:P,offsetMap:d,height:p}),p=0,h.clearRect(0,0,e.width,e.height),d={}}let M=8;if(e.lineWidth&&h.strokeText(g,2+l,M+p),h.fillText(g,2+l,M+p),d[g]={width:x,height:i,x:l,y:p},l+=x,++s>=o)return u();v.timeRemaining()>0?m(v):this.timer.requestIdleCallback(m)}else this.timer.requestIdleCallback(m)};this.timer.requestIdleCallback(m),this.timer.setTimeout(()=>{s===0&&(console.log("idle \u4E0D\u6267\u884C \u56DE\u9000\u5230\u540C\u6B65"),n(this.getTextsSync(t,e,i)))},1e3)})})}static getTextsByReqAniFrame(t,e,i){return f(this,null,function*(){let s=0,o=t.length;return new Promise(n=>{let r=this.getIdleCanvas(),h=this.getIdleCtx();h.clearRect(0,0,r.width,r.height),this.setCtxStyle(e,r,h);let c=[],l=0,p=0,d={},u=()=>f(this,null,function*(){let v=h.getImageData(0,0,e.width,i+p);c.push({imageData:v,offsetMap:d,height:i+p});let g=c.reduce((x,M)=>{let P=new R.DataTexture(M.imageData.data,e.width,M.height,R.RGBAFormat);return P.flipY=!0,P.minFilter=R.LinearFilter,P.magFilter=R.LinearFilter,Object.keys(M.offsetMap).forEach(C=>{x[C]=w({},M.offsetMap[C],{texture:P})}),x},{});n(g)}),m=()=>{if(s>=o)return u();let v=0;for(;v<30;){let g=t[s],x=Math.ceil(h.measureText(g).width);if(x=x%2===0?x:x+1,x+=2,x+l>e.width&&(l=0,p+=i,i+p>e.height)){let P=h.getImageData(0,0,e.width,p);c.push({imageData:P,offsetMap:d,height:p}),p=0,h.clearRect(0,0,e.width,e.height),d={}}let M=8;if(e.lineWidth&&h.strokeText(g,2+l,M+p),h.fillText(g,2+l,M+p),d[g]={width:x,height:i,x:l,y:p},l+=x,++s>=o)return u();v++}this.timer.requestAnimationFrame(m)};this.timer.requestAnimationFrame(m)})})}static getTextsSync(t,e,i){let s=this.getCanvas(),o=this.getCtx();o.clearRect(0,0,s.width,s.height),this.setCtxStyle(e);let n=[],r=0,h=0,c={};t.forEach(d=>{let u=Math.ceil(o.measureText(d).width);if(u=u%2===0?u:u+1,u+=2,u+r>e.width&&(r=0,h+=i,i+h>e.height)){let v=o.getImageData(0,0,e.width,h);n.push({data:v.data,offsetMap:c,height:h}),h=0,o.clearRect(0,0,e.width,e.height),c={}}let m=8;e.lineWidth&&o.strokeText(d,2+r,m+h),o.fillText(d,2+r,m+h),c[d]={width:u,height:i,x:r,y:h},r+=u});let l=o.getImageData(0,0,e.width,i+h);return n.push({data:l.data,offsetMap:c,height:h+i}),n.reduce((d,u)=>{let m=new R.DataTexture(u.data,e.width,u.height,R.RGBAFormat);return m.flipY=!0,m.minFilter=R.LinearFilter,m.magFilter=R.LinearFilter,Object.keys(u.offsetMap).forEach(v=>{d[v]=w({},u.offsetMap[v],{texture:m})}),d},{})}static getTextureByTexts(t,e){let i=this.getMergedOptions(e),s=i.height;i.height=Math.min(s*t.length,1e4);let o=this.getCanvas(),n=this.getCtx();n.clearRect(0,0,o.width,o.height),this.setCtxStyle(i);let r=0,h=0,c={};t.forEach(d=>{let u=Math.ceil(n.measureText(d).width);u=u%2===0?u:u+1,u+=2,u+r>i.width&&(r=0,h+=s);let m=8;i.lineWidth&&n.strokeText(d,2+r,m+h),n.fillText(d,2+r,m+h),c[d]={width:u,height:s,x:r,y:h},r+=u});let l=n.getImageData(0,0,i.width,s+h),p=new R.DataTexture(Uint8Array.from(l.data),i.width,s+h,R.RGBAFormat);return p.flipY=!0,p.minFilter=R.LinearFilter,p.magFilter=R.LinearFilter,{texture:p,offsetMap:c}}static dispose(){var t,e;this.ctx=null,this.canvas=null,this.idleCtx=null,this.idleCanvas=null,this.timer.dispose(),this.cacheMap.forEach(i=>{i instanceof Promise?i.then(s=>{s.texture.dispose()}):i.texture.dispose()}),this.cacheMap.clear(),(t=this.textTextureWorker)==null||t.terminate(),(e=this.lazyIndexDbTextTextureWorker)==null||e.terminate(),this.textTextureWorker=null,this.rectCacheMap.clear()}};Q.canvas=document.createElement("canvas");Q.ctx=Q.canvas.getContext("2d",{willReadFrequently:!0});Q.cacheMap=new Map;Q.rectCacheMap=new Map;Q.lazyTextureCacheMap=new Map;Q.lazyPoiMap=new Map;Q.textTextureWorker=null;Q.lazyIndexDbTextTextureWorker=null;Q.idleCanvas=null;Q.idleCtx=null;Q.timer=new j;Q.options={width:2048,height:512,font:"28px sans-serif",textBaseline:"top",lineWidth:2,fillStyle:"rgba(0,0,0,1)",strokeStyle:"white"};var Ad=require("core-js/modules/web.dom-collections.iterator.js"),Xt=require("three"),ct=class{static getTextureByUrl(t){if(this.urlTextureMap.has(t))return Promise.resolve(this.urlTextureMap.get(t));let e=this.textureLoader.loadAsync(t);return e.then(i=>{i.format=Xt.RGBAFormat,i.magFilter=Xt.LinearFilter,i.minFilter=Xt.LinearFilter,i.colorSpace="srgb",this.urlTextureMap.set(t,i)}),this.urlTextureMap.set(t,e),e}static getUrlTextureBorder(t,e,i){let s=t+"-"+i.width+"-"+i.color;if(this.borderUrlTextureMap.has(s))return Promise.resolve(this.borderUrlTextureMap.get(s));let o=this.textureLoader.loadAsync(t).then(n=>{let r=this.ctx,h=this.canvas,c=e+i.width*2;h.width=c,h.height=c;let l=c/2;r.clearRect(0,0,c,c),r.beginPath(),r.arc(l,l,e/2+i.width,0,2*Math.PI),r.fillStyle=i.color,r.fill(),r.beginPath(),r.arc(l,l,e/2,0,2*Math.PI),r.closePath(),r.clip(),r.drawImage(n.image,i.width,i.width,e,e);let p=new Xt.Texture(h);return p.format=Xt.RGBAFormat,p.magFilter=Xt.LinearFilter,p.minFilter=Xt.LinearFilter,p.colorSpace="srgb",p.needsUpdate=!0,this.borderUrlTextureMap.set(s,p),p});return this.borderUrlTextureMap.set(s,o),o}static dispose(){this.urlTextureMap.forEach(t=>{t instanceof Promise?t.then(e=>e.dispose()):t.dispose()}),this.borderUrlTextureMap.forEach(t=>{t instanceof Promise?t.then(e=>e.dispose()):t.dispose()}),this.urlTextureMap.clear(),this.borderUrlTextureMap.clear(),this.ctx=null,this.canvas=null}};ct.textureLoader=new Xt.TextureLoader;ct.urlTextureMap=new Map;ct.borderUrlTextureMap=new Map;ct.canvas=document.createElement("canvas");ct.ctx=ct.canvas.getContext("2d",{willReadFrequently:!0});var Iu=require("core-js/modules/web.dom-collections.iterator.js");var Lr=require("three/examples/jsm/loaders/GLTFLoader.js");var Qd=require("core-js/modules/web.dom-collections.iterator.js"),tu=require("core-js/modules/es.json.stringify.js"),eu=require("core-js/modules/es.error.cause.js"),iu=require("core-js/modules/es.typed-array.float32-array.js"),su=require("core-js/modules/es.typed-array.at.js"),ou=require("core-js/modules/es.typed-array.fill.js"),nu=require("core-js/modules/es.typed-array.find-last.js"),ru=require("core-js/modules/es.typed-array.find-last-index.js"),au=require("core-js/modules/es.typed-array.set.js"),hu=require("core-js/modules/es.typed-array.sort.js"),cu=require("core-js/modules/es.typed-array.to-reversed.js"),lu=require("core-js/modules/es.typed-array.to-sorted.js"),pu=require("core-js/modules/es.typed-array.with.js"),du=require("core-js/modules/es.array-buffer.constructor.js"),uu=require("core-js/modules/es.array-buffer.slice.js"),mu=require("core-js/modules/es.array-buffer.detached.js"),fu=require("core-js/modules/es.array-buffer.transfer.js"),gu=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),yu=require("core-js/modules/es.array.push.js"),vu=require("core-js/modules/web.url.js"),xu=require("core-js/modules/web.url.to-json.js"),wu=require("core-js/modules/web.url-search-params.js"),Mu=require("core-js/modules/web.url-search-params.delete.js"),_u=require("core-js/modules/web.url-search-params.has.js"),Pu=require("core-js/modules/web.url-search-params.size.js"),bu=require("core-js/modules/es.array.sort.js"),Su=require("core-js/modules/es.typed-array.int8-array.js"),Eu=require("core-js/modules/es.typed-array.uint32-array.js"),Lu=require("core-js/modules/es.typed-array.int16-array.js"),Cu=require("core-js/modules/es.typed-array.int32-array.js"),Tu=require("core-js/modules/es.typed-array.uint8-array.js"),ku=require("core-js/modules/es.typed-array.uint16-array.js");var dh={},wr=new URL("./icon/parkingSpace/half.svg",dh.url).href;var uh={},Mr=new URL("./icon/parkingSpace/power.svg",uh.url).href;var mh={},_r=new URL("./icon/parkingSpace/mechanical.svg",mh.url).href;var fh={},Pr=new URL("./icon/parkingSpace/vip.svg",fh.url).href;var gh={},br=new URL("./glb/locate.glb",gh.url).href;var yh={},Sr=new URL("./icon/path/arrow.png",yh.url).href;var vh={},No=new URL("./draco/draco_decoder.js",vh.url).href;var xh={},Zo=new URL("./draco/draco_decoder.wasm",xh.url).href;var wh={},jo=new URL("./draco/draco_wasm_wrapper.js",wh.url).href;var Is={half:wr,power:Mr,mechanical:_r,vip:Pr},Er=br,Rs=Sr;var wt=require("three"),Vo=new WeakMap,Gs=class extends wt.Loader{setDecoderPath(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,i,s){let o=new wt.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,n=>{this.parse(n,e,s)},i,s)}parse(t,e,i){i===void 0&&(i=()=>{}),this.decodeDracoFile(t,e,null,null,wt.SRGBColorSpace).catch(i)}decodeDracoFile(t,e,i,s,o,n){o===void 0&&(o=wt.LinearSRGBColorSpace),n===void 0&&(n=()=>{});let r={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:o};return this.decodeGeometry(t,r).then(e).catch(n)}decodeGeometry(t,e){let i=JSON.stringify(e);if(Vo.has(t)){let h=Vo.get(t);if(h.key===i)return h.promise;if(t.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s,o=this.workerNextTaskID++,n=t.byteLength,r=this._getWorker(o,n).then(h=>(s=h,new Promise((c,l)=>{s._callbacks[o]={resolve:c,reject:l},s.postMessage({type:"decode",id:o,taskConfig:e,buffer:t},[t])}))).then(h=>this._createGeometry(h.geometry));return r.catch(()=>!0).then(()=>{s&&o&&this._releaseTask(s,o)}),Vo.set(t,{key:i,promise:r}),r}_createGeometry(t){let e=new wt.BufferGeometry;t.index&&e.setIndex(new wt.BufferAttribute(t.index.array,1));for(let i=0;i<t.attributes.length;i++){let s=t.attributes[i],o=s.name,n=s.array,r=s.itemSize,h=new wt.BufferAttribute(n,r);o==="color"&&(this._assignVertexColorSpace(h,s.vertexColorSpace),h.normalized=!(n instanceof Float32Array)),e.setAttribute(o,h)}return e}_assignVertexColorSpace(t,e){if(e!==wt.SRGBColorSpace)return;let i=new wt.Color;for(let s=0,o=t.count;s<o;s++)i.fromBufferAttribute(t,s).convertSRGBToLinear(),t.setXYZ(s,i.r,i.g,i.b)}_loadLibrary(t,e){let i=new wt.FileLoader(this.manager);return i.setPath(this.decoderPath),i.setResponseType(e),i.setWithCredentials(this.withCredentials),new Promise((s,o)=>{i.load(t,s,void 0,o)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let t=typeof WebAssembly!="object"||this.decoderConfig.type==="js",e=[];return t?e.push(this._loadLibrary(No,"text")):(e.push(this._loadLibrary(jo,"text")),e.push(this._loadLibrary(Zo,"arraybuffer"))),this.decoderPending=Promise.all(e).then(i=>{let s=i[0];t||(this.decoderConfig.wasmBinary=i[1]);let o=Mh.toString(),n=["/* draco decoder */",s,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
|
|
219
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([n]))}),this.decoderPending}_getWorker(t,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let s=new Worker(this.workerSourceURL);s._callbacks={},s._taskCosts={},s._taskLoad=0,s.postMessage({type:"init",decoderConfig:this.decoderConfig}),s.onmessage=function(o){let n=o.data;switch(n.type){case"decode":s._callbacks[n.id].resolve(n);break;case"error":s._callbacks[n.id].reject(n);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+n.type+'"')}},this.workerPool.push(s)}else this.workerPool.sort(function(s,o){return s._taskLoad>o._taskLoad?-1:1});let i=this.workerPool[this.workerPool.length-1];return i._taskCosts[t]=e,i._taskLoad+=e,i})}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map(t=>t._taskLoad))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}constructor(t){super(t),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}};function Mh(){let a,t;onmessage=function(n){let r=n.data;switch(r.type){case"init":a=r.decoderConfig,t=new Promise(function(l){a.onModuleLoaded=function(p){l({draco:p})},DracoDecoderModule(a)});break;case"decode":let h=r.buffer,c=r.taskConfig;t.then(l=>{let p=l.draco,d=new p.Decoder;try{let u=e(p,d,new Int8Array(h),c),m=u.attributes.map(v=>v.array.buffer);u.index&&m.push(u.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:u},m)}catch(u){console.error(u),self.postMessage({type:"error",id:r.id,error:u.message})}finally{p.destroy(d)}});break}};function e(n,r,h,c){let l=c.attributeIDs,p=c.attributeTypes,d,u,m=r.GetEncodedGeometryType(h);if(m===n.TRIANGULAR_MESH)d=new n.Mesh,u=r.DecodeArrayToMesh(h,h.byteLength,d);else if(m===n.POINT_CLOUD)d=new n.PointCloud,u=r.DecodeArrayToPointCloud(h,h.byteLength,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!u.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+u.error_msg());let v={index:null,attributes:[]};for(let g in l){let x=self[p[g]],M,P;if(c.useUniqueIDs)P=l[g],M=r.GetAttributeByUniqueId(d,P);else{if(P=r.GetAttributeId(d,n[l[g]]),P===-1)continue;M=r.GetAttribute(d,P)}let C=s(n,r,d,g,x,M);g==="color"&&(C.vertexColorSpace=c.vertexColorSpace),v.attributes.push(C)}return m===n.TRIANGULAR_MESH&&(v.index=i(n,r,d)),n.destroy(d),v}function i(n,r,h){let l=h.num_faces()*3,p=l*4,d=n._malloc(p);r.GetTrianglesUInt32Array(h,p,d);let u=new Uint32Array(n.HEAPF32.buffer,d,l).slice();return n._free(d),{array:u,itemSize:1}}function s(n,r,h,c,l,p){let d=p.num_components(),m=h.num_points()*d,v=m*l.BYTES_PER_ELEMENT,g=o(n,l),x=n._malloc(v);r.GetAttributeDataArrayForAllPoints(h,p,g,v,x);let M=new l(n.HEAPF32.buffer,x,m).slice();return n._free(x),{name:c,array:M,itemSize:d}}function o(n,r){switch(r){case Float32Array:return n.DT_FLOAT32;case Int8Array:return n.DT_INT8;case Int16Array:return n.DT_INT16;case Int32Array:return n.DT_INT32;case Uint8Array:return n.DT_UINT8;case Uint16Array:return n.DT_UINT16;case Uint32Array:return n.DT_UINT32}}}var St=class{static loadModel(t,e){return f(this,null,function*(){if(e===void 0&&(e=!0),e){if(this.modelMap.has(t)){let s=this.modelMap.get(t);if(s instanceof Promise)s.then(o=>w({},o,{scene:o.scene.clone()}));else return w({},s,{scene:s.scene.clone()})}let i=new Promise((s,o)=>{this.loader.load(t,n=>{this.modelMap.set(t,n),s(n)},void 0,o)});return this.modelMap.set(t,i),i.then(s=>w({},s,{scene:s.scene.clone()}))}else return new Promise((i,s)=>{this.loader.load(t,i,void 0,s)})})}static dispose(){this.modelMap.forEach(t=>{t instanceof Promise?t.then(e=>I(e.scene)):I(t.scene)}),this.modelMap.clear()}};St.dracoLoader=new Gs;St.loader=new Lr.GLTFLoader().setDRACOLoader(St.dracoLoader);St.modelMap=new Map;var _h={};function Ko(){return new Worker(new URL("./worker/merge-geometry.worker-5R2BBSOQ.js",_h.url))}var Bi=require("three");var te=class{static GetMergeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Z(e,"get_merged_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedShapeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Z(e,"get_merged_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedTexture2dGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Z(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetBufferGeometryByData(t){let e=new Bi.BufferGeometry;return Object.keys(t.attributes).forEach(i=>{e.setAttribute(i,new Bi.BufferAttribute(t.attributes[i].array,t.attributes[i].itemSize))}),t.index&&e.setIndex(new Bi.BufferAttribute(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Z(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),i?w({},t[0],i):null})}static GetMergedGeometryLine(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Z(e,"get_merged_geometries_line_json",{data:t});return this.WorkerPool.releaseWorker(e),i?w({},t[0],i):null})}static dispose(){this.WorkerPool.dispose()}};te.WorkerPool=new Gi(10,Ko);var Cr=require("lodash"),fe={id:"",height:.1,airHeight:0,area:0,group:"",fillColor:"#EFF4FB",strokeColor:"#ffffff",fillOpacity:1,strokeOpacity:1,strokeWidth:1,doors:[],visible:!0,geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},layerType:"",zIndex:0,stroke:!0,deltaHeight:0,userData:{},gradualColor:[],renderType:"single",colorFactor:.9,center_x:0,center_y:0,center_coord_x:0,center_coord_y:0,dashed:!1},lt=class extends k.Object3D{getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new k.Vector3,e=new k.Box3;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new k.Vector3(0,0,0);let t=new k.Box3,e=new k.Vector3;return t.setFromObject(this),t.getSize(e),e}getPosition(){let{center_coord_x:t,center_coord_y:e}=this.options,i=this.getCenter();return i.setZ(i.z+this.options.height/2),!t||!e?i:new k.Vector3(t,e,i.z+this.options.height/2)}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&this.options.strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initDoor(){var t;if((t=this.options.doors)!=null&&t.length&&this.options.geometry.type==="polygon"){let e=this.options.geometry.coords[0];this.options.doors.forEach(i=>{let s=i.type==="single"?.5:1,o=.5,n=he(e,i.coord),r=new k.Vector2(...i.coord),h=new k.Vector2(...e[n]).sub(new k.Vector2(...i.coord)).normalize(),c=new k.Vector2().addVectors(r,h.clone().multiplyScalar(s)),l=new k.Vector2().addVectors(r,h.clone().multiplyScalar(-s)),p=new k.Vector2(-h.y,h.x),d=new k.Vector2().addVectors(c,p.clone().multiplyScalar(o));bo([d.x,d.y],e)||(p.multiplyScalar(-1),d=new k.Vector2().addVectors(c,p.clone().multiplyScalar(o)));let u=new k.Vector2().addVectors(l,p.clone().multiplyScalar(o)),m=[[c.x,c.y],[d.x,d.y],[u.x,u.y],[l.x,l.y]];e=this.options.geometry.coords[0]=[...e.slice(0,n+1),...m,...e.slice(n+1)]})}}initGeometry(){let t=Li(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new k.ExtrudeGeometry(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=T.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.secondUrl&&ct.getTextureByUrl(this.options.secondUrl).then(i=>{i.wrapS=k.RepeatWrapping,i.wrapT=k.RepeatWrapping,i.needsUpdate=!0,t.map=i,t.side=k.DoubleSide}),this.options.height<=.1)return this.material=t,t;let e=T.createMeshBasicMaterial({color:ce(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let i=new k.Box3().setFromObject(this),s=t.clone().add(e.clone().multiplyScalar(1e3)),o=new k.Ray(s,e.clone().multiplyScalar(-1)),n=new k.Vector3;o.intersectBox(i,n);let r=t.clone().add(e.clone().multiplyScalar(-1e3)),h=new k.Ray(r,e.clone()),c=new k.Vector3;return h.intersectBox(i,c),{max:c,min:n}}initGradualMaterial(){let{max:t,min:e}=new k.Box3().setFromObject(this),i=t.clone().sub(e),s=Math.max(i.x,i.y,i.z)/2,o=this.getPosition(),n=new k.Vector3(-1,.2,0).normalize(),{max:r,min:h}=this.getMaxAndMin(o,n),c=T.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:s,opacity:this.options.fillOpacity,direction:new k.Vector3(-1,.2,0),max:r,min:h});if(this.options.height<=.1)return this.material=c,c;let l=this.getCenter(),p=new k.Vector3(-1,.2,1).normalize(),{max:d,min:u}=this.getMaxAndMin(l,p),m=T.createShaderMaterial({gradualColor:[ce(this.options.gradualColor[0],this.options.colorFactor),ce(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:s,opacity:this.options.fillOpacity,direction:new k.Vector3(-1,.2,1),max:d,min:u});return this.material=[c,m],[c,m]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){if(this.options.dashed){let t=T.createLineDashedMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}else{let t=T.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new k.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options.height+this.options.deltaHeight,{coords:i}=this.options.geometry;for(let s=0;s<i.length;s++){let o=i[s];for(let n=0;n<o.length;n++){let r=o[n],h=n+1===o.length?o[0]:o[n+1];t.push(new k.Vector3(r[0],r[1],e)),t.push(new k.Vector3(h[0],h[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new k.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new k.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=this.options.airHeight+.01,this.options.dashed&&t.computeLineDistances(),this.line=t,this.add(t),t}setOpacity(t,e){if(e===void 0&&(e=!1),e)this.options.fillOpacity=t,this.options.strokeOpacity=t;else{let{fillOpacity:i,strokeOpacity:s}=this.originOptions;this.options.fillOpacity=Math.min(i,t),this.options.strokeOpacity=Math.min(s,t)}}raycast(t){if(!this.visible||this.options.geometry.type==="point")return!1;this.mesh.updateMatrixWorld(!0);let e=t.intersectObject(this.mesh);if(e[0]){let{point:i,distance:s}=e[0];return{position:i,distance:s}}return!1}dispose(){var t,e;(t=this.geometry)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e){if(super(),this.context=t,this.line=null,this.options=Ue((0,Cr.cloneDeep)(w({},fe,e)),this),this.originOptions={fillOpacity:this.options.fillOpacity,strokeOpacity:this.options.strokeOpacity},this.options.geometry.type==="point"){let[i,s]=this.options.geometry.coords;return this.position.set(i,s,this.options.height+this.options.airHeight),this}this.initDoor(),this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",i=>{let{value:s}=i;this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",i=>{let{value:s}=i;this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",i=>{let{value:s}=i;this.dispose(),this.init()}),this.addEventListener("change-strokeColor",i=>{let{value:s}=i;!this.options.stroke||!this.options.strokeOpacity||(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",i=>{let{value:s}=i;if(this.options.stroke)if(s)this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder();else{var o;this.line&&(this.remove(this.line),this.line=null),(o=this.lineGeometry)==null||o.dispose(),this.lineGeometry=void 0}}),this.addEventListener("change-airHeight",i=>{let{value:s}=i;this.position.z=s}),this.addEventListener("change-visible",i=>{let{value:s}=i;this.visible=s}),this.addEventListener("change-stroke",i=>{let{value:s}=i;if(s){if(this.line)return;this.initLineGeometry(),this.initLineMaterial(),this.createBorder()}else if(this.line){var o;this.remove(this.line),(o=this.lineGeometry)==null||o.dispose()}}),this.addEventListener("change-dashed",()=>{!this.options.stroke||!this.options.strokeOpacity||(this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-renderType",()=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-gradualColor",()=>{this.initMaterial(),this.initMesh()})}};var Yt=require("three");var Wi=class extends Yt.Object3D{initLight(){let t=_o(16777215,.5);return t.position.set(0,0,100),this.add(t),t}changeLightCamera(t){let e=t.x,i=t.y;this.directionalLight.shadow.camera.left=-e,this.directionalLight.shadow.camera.right=e,this.directionalLight.shadow.camera.top=i,this.directionalLight.shadow.camera.bottom=-i,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(e,i)}changeLightColor(t){this.directionalLight.color=new Yt.Color(t)}setPosition(t){this.position.copy(t),this.directionalLight.position.set(-t.x/2,-t.y/2,100)}initPlane(t,e){t===void 0&&(t=1e3),e===void 0&&(e=1e3);let i=new Yt.PlaneGeometry(t,e),s=new Yt.ShadowMaterial({transparent:!0,opacity:0,side:Yt.DoubleSide}),o=new Yt.Mesh(i,s);return o.receiveShadow=!0,o.position.z=-10,this.add(o),this.plane=o,o}setTarget(t){this.directionalLight.target=t}transformOpacity(t){return t*this.basicOpacity}setOpacity(t){this.plane.material.opacity=this.transformOpacity(t)}dispose(){I(this,!0)}constructor(){super(),this.basicOpacity=.07,this.directionalLight=this.initLight(),this.initPlane()}};var om=require("core-js/modules/web.dom-collections.iterator.js");var Fs=require("three");var K=require("three");var Tr=require("lodash");var Ph={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},Ke=class extends st{initObserver(){let t=new MutationObserver((0,Tr.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){var t,e;if(this.element instanceof lt&&this.element.options.geometry.type==="polygon"){let{max:n,min:r}=new K.Box3().setFromObject(this.element),h=(n.x+r.x)/2,c=(n.y+r.y)/2;return{left:new K.Vector3(r.x,c,n.z),leftTop:new K.Vector3(r.x,n.y,n.z),top:new K.Vector3(h,n.y,n.z),rightTop:new K.Vector3(n.x,n.y,n.z),right:new K.Vector3(n.x,c,n.z),rightBottom:new K.Vector3(n.x,r.y,n.z),bottom:new K.Vector3(h,r.y,n.z),leftBottom:new K.Vector3(r.x,r.y,n.z),center:new K.Vector3(h,c,n.z)}}let{x:i,y:s,z:o}=((e=this.element)==null||(t=e.getPosition)==null?void 0:t.call(e))||this.position;return{left:new K.Vector3(i,s,o),leftTop:new K.Vector3(i,s,o),top:new K.Vector3(i,s,o),rightTop:new K.Vector3(i,s,o),right:new K.Vector3(i,s,o),rightBottom:new K.Vector3(i,s,o),bottom:new K.Vector3(i,s,o),leftBottom:new K.Vector3(i,s,o),center:new K.Vector3(i,s,o)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,i=this.getPlacementPosition();return Object.keys(i).reduce((s,o)=>{let{x:n,y:r}=D(i[o],this.context.camera,t,e);return s[o]={x:n,y:r},s},{})}checkOverflow(t,e){let{width:i,height:s}=this.context.clientSize;return e.x>0&&t.x<i&&e.y<s&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,i=this.getPlacementScreenPosition(),s=t/2,o=e/2,n=[{type:"center",getBox(r,h){return{max:{x:s+r,y:h-e},min:{x:r-s,y:h}}}},{type:"left",getBox(r,h){return{max:{x:r,y:h-o},min:{x:r-t,y:h+o}}}},{type:"leftTop",getBox(r,h){return{max:{x:r,y:h-e},min:{x:r-t,y:h}}}},{type:"top",getBox(r,h){return{max:{x:r+s,y:h-e},min:{x:r-s,y:h}}}},{type:"rightTop",getBox(r,h){return{max:{x:r+t,y:h-e},min:{x:r,y:h}}}},{type:"right",getBox(r,h){return{max:{x:r+t,y:h-o},min:{x:r,y:h+o}}}},{type:"rightBottom",getBox(r,h){return{max:{x:r+t,y:h},min:{x:r,y:h+e}}}},{type:"bottom",getBox(r,h){return{max:{x:r+s,y:h},min:{x:r-s,y:h+e}}}},{type:"leftBottom",getBox(r,h){return{max:{x:r,y:h},min:{x:r-t,y:h+o}}}}];for(let r=0;r<n.length;r++){let h=n[r],c=i[h.type],{max:l,min:p}=h.getBox(c.x,c.y);if(this.checkOverflow(l,p))return{type:h.type,position:c}}return{type:"center",position:i.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className="overlay_"+t.type,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,e){e===void 0&&(e="block"),t!==this.visible&&(this.div.style.display=t?e:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=""+t}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new K.Box3().setFromObject(this.element).getCenter(new K.Vector3):this.position}get withinDisplayRange(){let{x:t,y:e}=this.clientPos,{width:i,height:s}=this.context.clientSize;return t>=0&&t<=i&&e>=0&&e<=s}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:i,height:s,x:o,y:n}=this.context.clientSize;if(this.div){if(this.options.appendToBody){this.div.style.left=""+o+"px",this.div.style.top=""+(n+s)+"px";return}this.options.autoUpdate?(this.div.style.left=""+t+"px",this.div.style.bottom=""+(s-e)+"px"):this.dispatchEvent({type:"update-position",x:t,y:e,width:i,height:s})}}updatePosition(t){t===void 0&&(t=!1);let e=this.getPosition(),{width:i,height:s}=this.context.clientSize,{x:o,y:n}=D(e,this.context.camera,i,s);this.clientPos.x===o&&this.clientPos.y===n&&!t||this._updatePosition(o,n)}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){var t,e;super.dispose(),this.unRegistryEvent(),this.unBindElement(),(t=this.observer)==null||t.disconnect(),(e=this.div)==null||e.remove(),this.div=null}constructor(t,e={}){super(),this.context=t,this.position=new K.Vector3,this.clientPos={x:0,y:0},this.visible=!0,this.placement="top",this.observer=null,this.onUpdate=()=>{this.options.autoChangePlacement?this.usePlacement():this.updatePosition()},this.options=w({},Ph,e),this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}};var bh={texts:[{text:""}],level:1,icon_position:"bottom",collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},icon_opacity:1,icon_border:{color:"#586EE0",width:0},background:"",collision_hide_icon:!0,built_in:!1,box_only_icon:!1},De=class extends Fs.EventDispatcher{get withinDisplayRange(){return this.overlay.withinDisplayRange}resetSize(){return f(this,null,function*(){if(yield Eo(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:e}=this.img.getBoundingClientRect();this.size={width:t+2,height:e+2}}else{let{width:t,height:e}=this.div.getBoundingClientRect();this.size={width:t+2,height:e+2}}})}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(e=>{let i=document.createElement("div");if(i.style.whiteSpace="nowrap",e.styles)for(let[s,o]of Object.entries(e.styles))i.style[s]=o;i.textContent=e.text,t.appendChild(i)}),t}initIcon(){var t,e;let i=document.createElement("img");return i.setAttribute("src",this.options.icon),i.style.width=""+(((t=this.options.icon_size)==null?void 0:t[0])||32)+"px",i.style.height=""+(((e=this.options.icon_size)==null?void 0:e[1])||32)+"px",i.style.opacity=""+this.options.icon_opacity+"px",i.style.borderRadius="50%",this.options.icon_border.width&&(i.style.border=this.options.icon_border.width+"px solid "+this.options.icon_border.color),i.onload=()=>{this.resetSize()},this.img=i,i}registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t){t===void 0&&(t=this.context.config.poi.boxScale);let{width:e,height:i}=this.size,s=e*t,o=i*t,{x:n,y:r}=this.overlay.clientPos;return{left:n-s/2,right:n+s/2,top:this.options.icon?r-o:r-o/2,bottom:this.options.icon?r:r+o/2}}getOriginBox(){return this.getBox(1)}isContain(t,e){if(!this.overlay.visible||!this.visible)return!1;let i=this.getOriginBox();return t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}constructor(t,e){var i,s,o;super(),this.context=t,this.visible=!0,this.size={width:0,height:0},this.position=new Fs.Vector3,this.userData={},this.showTextStatus=!0,this.disposed=!1,this._changePosition=()=>{this.overlay.updatePosition(!0)},this.options=Ue(w({},bh,e),this),this.position.set(((i=e.position)==null?void 0:i.x)||0,((s=e.position)==null?void 0:s.y)||0,((o=e.position)==null?void 0:o.z)||0),this.overlay=new Ke(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",n=>{let{x:r,y:h,height:c}=n;this.overlay.div.style.transform="translate3d(calc("+r+"px - 50%), calc("+(-c+h)+"px - "+(this.options.icon&&this.options.icon_position!=="center"?"100%":"50%")+"), 0)"}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",n=>{let{value:r}=n;r?this.img?this.img.setAttribute("src",r):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",n=>{let{value:r}=n,h=this.textDiv;if(h){let c=this.initText();this.div.replaceChild(c,h)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",n=>{let{value:r}=n;this.overlay.setOpacity(r)}),this.addEventListener("change-icon_size",n=>{let{value:r}=n;this.img&&(this.img.style.width=""+((r==null?void 0:r[0])||32)+"px",this.img.style.height=""+((r==null?void 0:r[1])||32)+"px",this.resetSize())}),this.addEventListener("change-icon_opacity",n=>{let{value:r}=n;this.img&&(this.img.style.opacity=""+r)}),this.addEventListener("change-icon_border",n=>{let{value:r}=n;this.img&&(this.img.style.border=r.width+"px solid "+r.color)}),this.addEventListener("change-background",n=>{let{value:r}=n;this.div.style.background=r})}};var Rf=require("core-js/modules/web.dom-collections.iterator.js"),Gf=require("core-js/modules/es.set.difference.v2.js"),Ff=require("core-js/modules/es.set.intersection.v2.js"),zf=require("core-js/modules/es.set.is-disjoint-from.v2.js"),Bf=require("core-js/modules/es.set.is-subset-of.v2.js"),Wf=require("core-js/modules/es.set.is-superset-of.v2.js"),Uf=require("core-js/modules/es.set.symmetric-difference.v2.js"),Hf=require("core-js/modules/es.set.union.v2.js"),zt=require("three");var zs=require("three");var Ui=class extends zs.Object3D{loadModel(){return f(this,null,function*(){let t=yield St.loadModel(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t})}dispose(){I(this),this.model=null}constructor(t,e){super(),this.context=t,this.options=e,this.model=null,this.position.copy(e.position||new zs.Vector3(0,0,0)),this.loadModel()}};var gm=require("core-js/modules/web.dom-collections.iterator.js");var Bs=require("three");var kr=require("three");var q=class extends kr.Object3D{setOpacity(t,e){e===void 0&&(e=!1),this.children.forEach(i=>{i.setOpacity==null||i.setOpacity.call(i,t,e)})}onAddToScene(t){this.active=!0,this.sceneType=t}onRemoveFromScene(){this.active=!1}dispose(){I(this),this.children.forEach(t=>t.dispose==null?void 0:t.dispose.call(t)),this.clear()}constructor(t){super(),this.context=t,this.active=!1,this.sceneType="scene"}};var Hi=class extends q{getCenter(){return new Bs.Box3().setFromObject(this).getCenter(new Bs.Vector3)}createGraphic(t){let e=new lt(this.context,t);return e.userData.data=t,this.add(e),this.graphicMap.set(t.id,e),e}removeGraphic(t){this.remove(t),this.graphicMap.delete(t.options.id),t.dispose()}removeGraphicById(t){this.graphicMap.has(t)&&this.removeGraphic(this.graphicMap.get(t))}getGraphicByNodeId(t){return this.graphicMap.get(t)||null}getGraphicByRaycaster(t){let e={distance:1e4,graphic:null,position:null},i=this.children.reduce((s,o)=>{if(o instanceof lt){let n=o.raycast(t);if(n){let{distance:r}=n;if(r<s.distance)return{distance:n.distance,position:n.position,graphic:o}}return s}else return s},e);return i===e?{graphics:[],position:null}:{graphics:[i.graphic],position:i.position}}setGraphicOptions(t,e){let i,s=this.graphicMap.get(t);s&&(typeof e=="function"?i=e(s.options):i=w({},s.options,e),Object.keys(i).forEach(o=>{s.options[o]=i[o]}))}getGraphicPosition(t){let e=this.graphicMap.get(t);return e?[e.options.center_x,e.options.center_y]:null}setOpacity(t,e){e===void 0&&(e=!1),this.graphicMap.forEach(i=>{i.setOpacity(t,e)})}constructor(t){super(t),this.graphicMap=new Map}};var wm=require("core-js/modules/es.array.unshift.js"),Mm=require("core-js/modules/es.array.push.js");var Dr=require("lodash");var Ni=class extends q{clear(t){return t===void 0&&(t=!1),this.pois.forEach(e=>{e.options.built_in&&!t||e.dispose()}),this.pois=t?[]:this.pois.filter(e=>e.options.built_in),this}createPoi(t){let e=new De(this.context,t);return this.pushPoi(e),e.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(e)),e.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(e)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),e}changePoiLevelOrCollisionEnable(t){let e=this.pois.findIndex(i=>i===t);e!==-1&&(this.pois.splice(e,1),this.pushPoi(t))}removePoi(t){let e=this.pois.findIndex(i=>i===t);e!==-1&&(this.pois.splice(e,1),t.dispose())}removePoiById(t){let e=this.pois.find(i=>i.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(i=>i.options.id===t)||null}pushPoi(t){if(!t.options.collision_enable){this.pois.unshift(t);return}if(t.options.level===0){this.pois.push(t);return}for(let e=0;e<this.pois.length;e++){let i=this.pois[e];if(i.options.collision_enable&&i.options.level<=t.options.level){this.pois.splice(e,0,t);return}}this.pois.push(t)}getPoiByDeviceXy(t,e){return this.pois.filter(s=>s instanceof De&&s.isContain(t,e))}collisionDetection(){let t=[];this.pois.filter(i=>i.visible&&i.withinDisplayRange).forEach((i,s)=>{let{left:o,right:n,top:r,bottom:h}=i.getBox();if(s===0||!i.options.collision_enable){t.push({left:o,right:n,top:r,bottom:h}),i.parentSetVisible(!0);return}let c=t.some(l=>l.left<n&&l.right>o&&l.top<h&&l.bottom>r);i.parentSetVisible(!c),c||t.push({left:o,right:n,top:r,bottom:h})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(t=>t.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}constructor(t){super(t),this.pois=[],this.timer=new j,this.onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})},this.registryEvent(),this.debounceCollisionDetection=(0,Dr.debounce)(this.collisionDetection,10)}};var Em=require("core-js/modules/es.array.push.js");var Ar=require("three"),Zi=class extends q{clear(){return this.context.collisionSystem.removeObjects(this.pois),this.pois.forEach(t=>{t.dispose()}),this.pois=[],this}createPoi(t){let e=new tt(this.context,t);return this.pushPoi(e),e}removePoi(t){let e=this.pois.findIndex(i=>i===t);e!==-1&&(this.remove(t),this.pois.splice(e,1),this.context.collisionSystem.removeObject(t),t.dispose())}removePoiById(t){let e=this.pois.find(i=>i.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(i=>i.options.id===t)||null}pushPoi(t){this.pois.includes(t)||(t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("text-texture-rect-inited",()=>{this.active&&this.context.forceUpdate()}),t.parentSetVisible(!1),this.add(t),this.pois.push(t),this.sceneType==="mulFloors"&&(t.options.depth_test=!0),this.active&&this.context.collisionSystem.addObject(t))}changePoiLevelOrCollisionEnable(t){this.active&&(this.context.collisionSystem.removeObject(t),this.context.collisionSystem.addObject(t))}getPoiByDeviceXy(t,e){let i=new Ar.Vector2(t,e);return this.pois.filter(o=>o instanceof tt&&o.canSelect&&o.box.containsPoint(i))}setOpacity(t){this.pois.forEach(e=>{e.options.icon_opacity=t,e.options.text_opacity=t})}onAddToScene(t){super.onAddToScene(t);let e=t==="mulFloors";this.pois.forEach(i=>{i.options.depth_test=e,this.context.collisionSystem.addObject(i)})}onRemoveFromScene(){super.onRemoveFromScene(),this.context.collisionSystem.removeObjects(this.pois)}dispose(){this.timer.dispose(),this.clear(),super.dispose()}constructor(t){super(t),this.pois=[],this.timer=new j}};var Dm=require("core-js/modules/es.regexp.exec.js"),Am=require("core-js/modules/web.dom-collections.iterator.js");var Ws=require("three"),Or=require("lodash");var ji=class extends q{createParkings(t,e,i){e===void 0&&(e=!0),this.parkingOptions=t,this.merged=e,e?(i?this.createMergedParkingByMergedElements(i):this.createMergedParking(t),t.map((s,o)=>{var n;(n=s.texts[0])==null||n.split(/[,,]/).map(r=>{this.parkingNoIndexMap.set(r,o)}),this.nodeIdIndexMap.set(s.id,o)})):this.createIndependentParking(t)}load(t,e){e===void 0&&(e=!0);var i;this.createParkings(t.elements,e,t.mergedElements),(i=t.mergedParkingTexture)!=null&&i.length?this.createMergedParkingTexture(t.mergedParkingTexture):this.createParkingTexture(t.elements)}createMergedParking(t){return f(this,null,function*(){let e=new ii(this.context,t);this.mergedParkingSpace=e,this.add(e)})}createMergedParkingByMergedElements(t){let e=new Xe(this.context,t);if(this.mergedParkingSpace=e,t.lineGeometry){let i=new Ie(this.context,t.lineGeometry);this.add(i)}this.add(e)}createIndependentParking(t){t.forEach(e=>{var i;let s=new lt(this.context,e);this.add(s),(i=e.texts[0])==null||i.split(/[,,]/).map(o=>{this.parkingNoGraphicMap.set(o,s)}),this.graphicMap.set(s.options.id,s)})}createParkingTexture(t){let e=t.filter(i=>Is[i.parkingType]).map(i=>{let s=new Ws.Vector2(...i.geometry.coords[0][0]),o=new Ws.Vector2(...i.geometry.coords[0][1]),n=new Ws.Vector2(...i.geometry.coords[0][2]),r=Math.min(s.distanceTo(o),o.distanceTo(n)),h=0;return r===s.distanceTo(o)?h=o.sub(s).angle()-Math.PI/2:h=n.sub(o).angle()-Math.PI/2,{uuid:i.id,iconUrl:Is[i.parkingType],name:i.texts[0],deltaHeight:(i.deltaHeight||0)+.001,airHeight:i.airHeight,height:i.height,geometry:i.geometry,opacity:i.fillOpacity,visible:!0,secondWidth:r-1,secondHeight:r-1,secondRotate:h,centerCoords:[i.center_coord_x,i.center_coord_y]}});if(e.length){let i=new Ae(this.context,e);this.add(i)}}createMergedParkingTexture(t){t.map(e=>{e.iconUrl=Is[e.iconUrl];let i=new Oe(this.context,e);this.add(i)})}changeParkingColor(t){this.merged?Object.keys(t).map(e=>{let i=this.parkingNoIndexMap.get(e);if(!(0,Or.isNil)(i)){var s;(s=this.mergedParkingSpace)==null||s.setColorByIndex(i,t[e])}}):Object.keys(t).map(e=>{let i=this.parkingNoGraphicMap.get(e);i&&(i.options.fillColor=t[e])})}setOpacity(t,e){if(e===void 0&&(e=!1),this.parkingOptions.forEach(s=>{if(e)s.fillOpacity=t,s.strokeOpacity=t;else{let r=this.parkingOriginOptions.get(s.id);var o;s.fillOpacity=Math.min(t,(o=r==null?void 0:r.fillOpacity)!=null?o:1);var n;s.strokeOpacity=Math.min(t,(n=r==null?void 0:r.strokeOpacity)!=null?n:1)}}),this.merged)if(this.mergedParkingSpace instanceof ii)this.mergedParkingSpace.setOpacity(t,e);else{var i;(i=this.mergedParkingSpace)==null||i.setOpacity(t,e)}else this.graphicMap.forEach(s=>{s.setOpacity(t,e)});this.children.filter(s=>s instanceof Ae||s instanceof Oe).map(s=>s.setOpacity(t))}getParkingOptionsByParkingNo(t){return this.parkingOptions.find(i=>i.texts[0]===t)||null}getGraphicPosition(t){if(this.merged){let e=this.parkingOptions.find(i=>i.id===t);return e?[e.center_x,e.center_y]:null}}dispose(){var t;(t=this.mergedParkingSpace)==null||t.dispose(),this.mergedParkingSpace=null,I(this),this.graphicMap.clear(),this.parkingNoGraphicMap.clear(),this.parkingNoIndexMap.clear(),this.nodeIdIndexMap.clear(),this.parkingOptions=[],super.dispose()}constructor(t){super(t),this.graphicMap=new Map,this.parkingNoGraphicMap=new Map,this.parkingOriginOptions=new Map,this.parkingOptions=[],this.merged=!1,this.parkingNoIndexMap=new Map,this.nodeIdIndexMap=new Map,this.mergedParkingSpace=null}};var Bm=require("core-js/modules/es.array.push.js");var Vi=class extends q{addModels(t){let e=t.reduce((i,s)=>{let{url:o}=s;return i[o]?i[o].push(s):i[o]=[s],i},{});Object.values(e).forEach(i=>{let s=new Ki(this.context,i);this.add(s)})}constructor(t){super(t)}};var af=require("core-js/modules/web.dom-collections.iterator.js");var Ft=require("three");var Rr=require("three/examples/jsm/lines/LineMaterial.js"),$=require("three");function Ir(a){return`${a.x}-${a.y}-${a.z}`}var Lt=class{static generateLineMaterialKey({color:t,opacity:e}){return`${t}-${e}`}static createLineMaterial({color:t,opacity:e,vertexColors:i}){let s=this.generateLineMaterialKey({color:t,opacity:e,vertexColors:i});if(this.lineMaterialMap.has(s))return this.lineMaterialMap.get(s);let o=new $.LineBasicMaterial({color:new $.Color(t).convertLinearToSRGB(),transparent:!0,opacity:e,vertexColors:i!=null?i:!1});return this.lineMaterialMap.set(s,o),o}static createMeshStandardMaterial({color:t,opacity:e}){let i=`${t}-${e}`;if(this.meshStandardMaterialMap.has(i))return this.meshStandardMaterialMap.get(i);let s=new $.MeshStandardMaterial({color:new $.Color(t).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:e,depthWrite:!0});return this.meshStandardMaterialMap.set(i,s),s}static createMeshBasicMaterial({color:t,opacity:e,vertexColors:i}){let s=`${t}-${e}-${i}`;if(this.meshBasicMaterialMap.has(s))return this.meshBasicMaterialMap.get(s);let o=new $.MeshBasicMaterial({color:t,transparent:!0,opacity:e,depthWrite:!0,vertexColors:i!=null?i:!1});return this.meshBasicMaterialMap.set(s,o),o}static createShaderMaterial({gradualColor:t,center:e,maxValue:i,opacity:s,direction:o,max:n,min:r}){let h=`${t.toString()}-${Ir(e)}-${i}-${s}-${Ir(o)}`;if(this.shaderMaterialMap.has(h))return this.shaderMaterialMap.get(h);let c=`
|
|
220
220
|
uniform vec3 uColor;
|
|
221
221
|
uniform vec3 uGradualColor;
|
|
222
222
|
uniform vec3 center;
|
|
@@ -253,7 +253,7 @@
|
|
|
253
253
|
void main() {
|
|
254
254
|
gl_FragColor = vec4(vColor.x, vColor.y, vColor.z, opacity);
|
|
255
255
|
}
|
|
256
|
-
`,p=new $.ShaderMaterial({uniforms:{uColor:{value:new $.Color(t[0]).convertLinearToSRGB()},uGradualColor:{value:new $.Color(t[1]).convertLinearToSRGB()},center:{value:e},maxValue:{value:i},opacity:{value:s},uDirection:{value:o},uMax:{value:n},uMin:{value:r}},vertexShader:c,fragmentShader:l,side:$.DoubleSide});return this.shaderMaterialMap.set(h,p),p}static createLine2MaterialMap({color:t,width:e,dashed:i,resolution:s,vertexColors:o}){let n=`${t}-${e}-${i}-${s.x}-${s.y}-${o}`;if(this.line2MaterialMap.has(n))return this.line2MaterialMap.get(n);let r=new
|
|
256
|
+
`,p=new $.ShaderMaterial({uniforms:{uColor:{value:new $.Color(t[0]).convertLinearToSRGB()},uGradualColor:{value:new $.Color(t[1]).convertLinearToSRGB()},center:{value:e},maxValue:{value:i},opacity:{value:s},uDirection:{value:o},uMax:{value:n},uMin:{value:r}},vertexShader:c,fragmentShader:l,side:$.DoubleSide});return this.shaderMaterialMap.set(h,p),p}static createLine2MaterialMap({color:t,width:e,dashed:i,resolution:s,vertexColors:o}){let n=`${t}-${e}-${i}-${s.x}-${s.y}-${o}`;if(this.line2MaterialMap.has(n))return this.line2MaterialMap.get(n);let r=new Rr.LineMaterial({color:new $.Color(t),dashed:i,linewidth:e,worldUnits:!0,dashSize:1,gapSize:3,dashScale:1,resolution:s,vertexColors:o!=null?o:!1});return this.line2MaterialMap.set(n,r),r}static createLineDashedMaterial(t){let e=`dashed-${t.color}-${t.opacity}-${t.dashSize}-${t.gapSize}-${t.scale}`;if(this.lineDashedMaterialMap.has(e))return this.lineDashedMaterialMap.get(e);let i=new $.LineDashedMaterial({color:t.color,transparent:!0,opacity:t.opacity,dashSize:t.dashSize||.2,gapSize:t.gapSize||.1,scale:t.scale||1});return this.lineDashedMaterialMap.set(e,i),i}static GetMergeAttributeGraphicMaterial(){if(this.mergeAttributeGraphicMaterial)return this.mergeAttributeGraphicMaterial;let t=`
|
|
257
257
|
attribute float maxZ; // \u58F0\u660E\u4E00\u4E2Aattribute\u53D8\u91CF
|
|
258
258
|
attribute vec3 color; // \u58F0\u660E\u4E00\u4E2Aattribute\u53D8\u91CF
|
|
259
259
|
attribute float opacity; // \u58F0\u660E\u4E00\u4E2Aattribute\u53D8\u91CF
|
|
@@ -433,7 +433,7 @@
|
|
|
433
433
|
gl_FragColor = vec4(newColor, vOpacity);
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
|
-
`;return this.instancedWallMaterial=new $.ShaderMaterial({vertexShader:t,fragmentShader:e,transparent:!0})}static dispose(){this.lineMaterialMap.forEach((t,e)=>{t.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((t,e)=>{t.dispose()}),this.shaderMaterialMap.clear(),this.line2MaterialMap.forEach((t,e)=>{t.dispose()}),this.line2MaterialMap.clear(),this.lineDashedMaterialMap.forEach(t=>{t.dispose()}),this.lineDashedMaterialMap.clear(),this.mergeAttributeGraphicMaterial&&(this.mergeAttributeGraphicMaterial.dispose(),this.mergeAttributeGraphicMaterial=null),this.mergeAttributeWallMaterial&&(this.mergeAttributeWallMaterial.dispose(),this.mergeAttributeWallMaterial=null),this.mergeAttributeGraphicLineMaterial&&(this.mergeAttributeGraphicLineMaterial.dispose(),this.mergeAttributeGraphicLineMaterial=null),this.instancedGraphicMaterial&&(this.instancedGraphicMaterial.dispose(),this.instancedGraphicMaterial=null),this.instancedWallMaterial&&(this.instancedWallMaterial.dispose(),this.instancedWallMaterial=null)}};rt(Lt,"lineMaterialMap",new Map),rt(Lt,"meshStandardMaterialMap",new Map),rt(Lt,"meshBasicMaterialMap",new Map),rt(Lt,"shaderMaterialMap",new Map),rt(Lt,"line2MaterialMap",new Map),rt(Lt,"mergeAttributeGraphicMaterial",null),rt(Lt,"mergeAttributeWallMaterial",null),rt(Lt,"mergeAttributeGraphicLineMaterial",null),rt(Lt,"instancedGraphicMaterial",null),rt(Lt,"instancedWallMaterial",null),rt(Lt,"lineDashedMaterialMap",new Map);var si=class{static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let t=this.createKey();for(;this.keySet.has(t);)t=this.createKey();return t}static removeKey(t){this.keySet.delete(t)}static dispose(){this.keySet.clear()}};rt(si,"keySet",new Set);function oi(a,t,e){return new Promise((i,s)=>{let o=si.genUniqueKey(),n=({data:r})=>{r.type===`${t}_result`&&r.key===o&&(si.removeKey(o),self.removeEventListener("message",n),r.error?s(r.error):i(r.data))};a.addEventListener("message",n),a.postMessage({type:t,key:o,data:e})})}var Ir=require("three");var Bs=class extends Ir.EventDispatcher{constructor(e=10,i){super();rt(this,"max",10);rt(this,"workerConstructor");rt(this,"pool",[]);this.max=e,this.workerConstructor=i}getWorker(){return new Promise(e=>{let i=this.pool.find(o=>o.state==="leisure");if(i){i.state="used",e(i.worker);return}if(this.pool.length<this.max&&this.workerConstructor){let o=this.workerConstructor();this.pool.push({worker:o,state:"used"}),e(o);return}let s=()=>{let o=this.pool.find(n=>n.state==="leisure");o&&(this.removeEventListener("release",s),o.state="used",e(o.worker))};this.addEventListener("release",s)})}releaseWorker(e){let i=this.pool.find(s=>s.worker===e);i&&(i.state="leisure",this.dispatchEvent({type:"release",worker:e}))}dispose(){this._listeners={},this.pool.forEach(e=>{e.worker.terminate()}),this.pool=[]}};var _h={};function Vo(){return new Worker(new URL("./worker/merge-geometry.worker-S6YLXRL5.js",_h.url))}var Vi=require("three");var ni=class{static GetMergeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedShapeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedTexture2dGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetBufferGeometryByData(t){let e=new Vi.BufferGeometry;return Object.keys(t.attributes).forEach(i=>{e.setAttribute(i,new Vi.BufferAttribute(t.attributes[i].array,t.attributes[i].itemSize))}),t.index&&e.setIndex(new Vi.BufferAttribute(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),i?Ei(Ei({},t[0]),i):null})}static GetMergedGeometryLine(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_geometries_line_json",{data:t});return this.WorkerPool.releaseWorker(e),i?Ei(Ei({},t[0]),i):null})}static dispose(){this.WorkerPool.dispose()}};rt(ni,"WorkerPool",new Bs(10,Vo));var Ki=class extends q{getCenter(){return new zt.Box3().setFromObject(this).getCenter(new zt.Vector3)}addInstancedGraphic(t){this.instancedGraphicConfig?(this.instancedGraphicConfig.size+=t.size,this.instancedGraphicConfig.colors=[...this.instancedGraphicConfig.colors,...t.colors],this.instancedGraphicConfig.matrixes=[...this.instancedGraphicConfig.matrixes,...t.matrixes],this.instancedGraphicConfig.opacities=[...this.instancedGraphicConfig.opacities,...t.opacities],this.instancedGraphicConfig.maxZs=[...this.instancedGraphicConfig.maxZs,...t.maxZs],this.instancedGraphicConfig.ids=[...this.instancedGraphicConfig.ids,...t.ids]):this.instancedGraphicConfig=t,this.refeshInstancedGraphic()}refeshInstancedGraphic(){this.instancedGraphic&&(this.remove(this.instancedGraphic),I(this.instancedGraphic)),this.instancedGraphicConfig&&(this.instancedGraphic=new Xe(this.context,this.instancedGraphicConfig),this.add(this.instancedGraphic))}addGraphics(t,e){t.map(i=>{this.graphicDataMap.set(i.id,i),this.graphicOriginOptionMap.set(i.id,{fillOpacity:i.fillOpacity,strokeOpacity:i.strokeOpacity})}),e?e.map(i=>{if(i.instancedGeometry&&this.addInstancedGraphic(i.instancedGeometry),i.mergedGeometry){let s=new ri(this.context,w({},i,{lineGeometry:null}));this.mergedGraphicGroup.add(s)}if(i.lineGeometry){let s=new Ie(this.context,i.lineGeometry);this.mergedLineGroup.add(s)}}):(this.refreshMergeGraphic(),this.refreshLine())}createGraphic(t){return f(this,null,function*(){let e=yield ni.GetMergedGeometry(t);if(I(this.mergedGraphicGroup),this.mergedGraphicGroup.clear(),e){let i=new ri(this.context,e);this.mergedGraphicGroup.add(i)}})}createLine(t){return f(this,null,function*(){let e=yield ni.GetMergedGeometryLine(t);if(I(this.mergedLineGroup),this.mergedLineGroup.clear(),e){let i=new Ie(this.context,e.lineGeometry);this.mergedLineGroup.add(i)}})}refreshMergeGraphic(){let t=Array.from(this.graphicDataMap.values());this.instancedGraphicConfig&&(t=t.filter(e=>{var i;return!((i=this.instancedGraphicConfig)!=null&&i.ids.includes(e.id))})),this.createGraphic(t)}refreshLine(){let t=Array.from(this.graphicDataMap.values());this.createLine(t)}removeGraphicById(t){var e;if(this.graphicDataMap.delete(t),(e=this.instancedGraphicConfig)!=null&&e.ids.includes(t)){let i=this.instancedGraphicConfig.ids.findIndex(s=>s===t);this.instancedGraphicConfig.size--,this.instancedGraphicConfig.colors.splice(i*3,3),this.instancedGraphicConfig.matrixes.splice(i*16,16),this.instancedGraphicConfig.opacities.splice(i,1),this.instancedGraphicConfig.maxZs.splice(i,1),this.instancedGraphicConfig.ids.splice(i,1),this.refeshInstancedGraphic()}else this.refreshMergeGraphic();this.refreshLine()}getGraphicDataByNodeId(t){return this.graphicMap.get(t)||null}setGraphicOptions(t,e){var i;let s,o=this.graphicDataMap.get(t);if(o){if(typeof e=="function"?s=e(o):s=w({},o,e),this.graphicDataMap.set(t,s),(i=this.instancedGraphicConfig)!=null&&i.ids.includes(t)&&this.instancedGraphic){this.instancedGraphic.setColorById(t,s.fillColor),this.instancedGraphic.setOpacityById(t,s.fillOpacity),this.instancedGraphic.setMaxZById(t,s.deltaHeight+s.airHeight+s.height);let n=this.instancedGraphicConfig.ids.findIndex(d=>d===t),r=this.instancedGraphicConfig.matrixes.slice(n*16,(n+1)*16),h=new zt.Matrix4().fromArray(r),c=new zt.Vector3,l=new zt.Quaternion,p=new zt.Vector3;h.decompose(c,l,p),p.z=s.height,c.z=s.deltaHeight+s.airHeight+s.height/2,h.compose(c,l,p),this.instancedGraphic.setMatrixById(t,h)}else this.refreshMergeGraphic();this.refreshLine()}}getGraphicPosition(t){let e=this.graphicDataMap.get(t);return e?[e.center_x,e.center_y]:null}setOpacity(t,e){e===void 0&&(e=!1);var i;this.graphicDataMap.forEach((s,o)=>{if(e)s.fillOpacity=t,s.strokeOpacity=t;else{let h=this.graphicOriginOptionMap.get(o);var n;s.fillOpacity=Math.min(t,(n=h==null?void 0:h.fillOpacity)!=null?n:1);var r;s.strokeOpacity=Math.min(t,(r=h==null?void 0:h.strokeOpacity)!=null?r:1)}}),(i=this.instancedGraphic)==null||i.setOpacity(t,e),this.refeshInstancedGraphic(),this.refreshLine()}dispose(){super.dispose(),this.mergedGraphicGroup.clear(),this.mergedLineGroup.clear(),this.instancedGraphic=null,this.instancedGraphicConfig=null}constructor(t){super(t),this.graphicMap=new Map,this.mergedGraphicGroup=new zt.Group,this.mergedLineGroup=new zt.Group,this.graphicDataMap=new Map,this.graphicOriginOptionMap=new Map,this.instancedGraphic=null,this.instancedGraphicConfig=null,this.add(this.mergedGraphicGroup),this.add(this.mergedLineGroup)}};var vf=require("core-js/modules/web.dom-collections.iterator.js"),xf=require("core-js/modules/es.array.push.js");var pt=require("three");var pf=require("core-js/modules/es.string.replace.js"),df=require("core-js/modules/es.regexp.exec.js"),uf=require("core-js/modules/es.error.cause.js"),mf=require("core-js/modules/web.dom-collections.iterator.js"),Ws=require("three");var Xi=class{setBaseUrl(t){this.baseUrl=t.replace(/\/$/,"")}setConfig(t){this.config=t}loadConfig(){return f(this,null,function*(){if(this.config)return this.config;if(!this.baseUrl)throw new Error("Base URL is not set");try{let t=yield fetch(""+this.baseUrl+"/config.json");return this.config=yield t.json(),this.config}catch(t){return console.error("Failed to load tile config:",t),this.config={extent:[12276734621488994e-9,2.1183542845726013e6,12279646804065457e-9,2121524247761597e-9],maxZoom:21,minZoom:11},this.config}})}buildTileUrl(t,e,i){if(!this.baseUrl)throw new Error("Base URL is not set");return this.baseUrl+"/"+i+"/"+t+"/"+e+".png"}loadTileTexture(t,e,i){return f(this,null,function*(){if(!this.baseUrl)throw new Error("Base URL is not set");let s=this.buildTileUrl(t,e,i);if(this.textureCache.has(s)){let n=this.textureCache.get(s);return n instanceof Promise?n:Promise.resolve(n)}let o=this.textureLoader.loadAsync(s).then(n=>(n.flipY=!0,n.colorSpace=Ws.SRGBColorSpace,this.textureCache.set(s,n),n)).catch(n=>null);return this.textureCache.set(s,o),o})}clearCache(){this.textureCache.forEach(t=>{t instanceof Promise?t.then(e=>e==null?void 0:e.dispose()):t.dispose()}),this.textureCache.clear()}dispose(){this.clearCache()}constructor(t){this.baseUrl="",this.config=null,this.textureCache=new Map,this.textureLoader=new Ws.TextureLoader,t&&this.setBaseUrl(t)}};var Gr=require("lodash");var Rr={base_url:"https://robot-vr-public.aibee.cn/static_resource/tiles"},Re=class a extends q{loadTileConfig(){return f(this,null,function*(){return this.tileLoader.loadConfig()})}initEvents(){this.context.addEventListener("control-change",this.onUpdate),this.context.bmap.addEventListener("center-change",this.onCenterChange)}removeEvents(){this.context.removeEventListener("control-change",this.onUpdate),this.context.bmap.removeEventListener("center-change",this.onCenterChange)}getViewBounds(){let t=this.context.camera,e=new pt.Raycaster,i=new pt.Vector2,s=[],[o,n]=this.context.center||[0,0],r=[{x:-1,y:1},{x:1,y:1},{x:1,y:-1},{x:-1,y:-1}];for(let d of r){i.set(d.x,d.y),e.setFromCamera(i,t);let u=new pt.Vector3(0,0,1),m=new pt.Vector3(0,0,0),v=new pt.Plane().setFromNormalAndCoplanarPoint(u,m),g=new pt.Vector3;e.ray.intersectPlane(v,g)?s.push(g):(e.ray.direction.negate(),e.ray.intersectPlane(v,g)&&s.push(g))}if(s.length<4)return null;let h=1/0,c=1/0,l=-1/0,p=-1/0;return s.forEach(d=>{h=Math.min(h,d.x+o),c=Math.min(c,d.y+n),l=Math.max(l,d.x+o),p=Math.max(p,d.y+n)}),{minX:h,minY:c,maxX:l,maxY:p}}getTileZoomLevel(t,e){let{minZoom:i,maxZoom:s}=e,o=this.context.camera,n=(o.right-o.left)/o.zoom,r=this.context.clientSize.width,h=n/r,c=a.WORLD_WIDTH,l=Math.log2(c/(h*this.tileSize));return Math.min(s,Math.max(i,Math.round(l)))}getTilesInView(t,e,i){let[s,o,n,r]=i.extent,h=Math.max(t.minX,s),c=Math.max(t.minY,o),l=Math.min(t.maxX,n),p=Math.min(t.maxY,r);if(h>=l||c>=p)return[];let d=Math.pow(2,e),u=a.WORLD_WIDTH/d,m=a.WORLD_WIDTH_HALF,v=Math.max(0,Math.floor((h+m)/u)),g=Math.floor((l+m)/u),x=Math.max(0,Math.floor((m-p)/u)),M=Math.floor((m-c)/u),P=[];for(let C=v;C<=g;C++)for(let S=x;S<=M;S++)P.push({x:C,y:S,z:e});return P}renderTiles(t,e){return f(this,null,function*(){let i=t,s=[];if(this.currentLevel!==e)s=[...this.tileGroup.children];else{let r=this.tileGroup.children,h=r.map(l=>l.userData.key),c=t.map(l=>l.z+"/"+l.x+"/"+l.y);i=t.filter(l=>!h.includes(l.z+"/"+l.x+"/"+l.y)),s=r.filter(l=>!c.includes(l.userData.key))}let o=Math.pow(2,e),n=a.WORLD_WIDTH/o;yield Promise.all(i.map(r=>f(this,null,function*(){let h=r.z+"/"+r.x+"/"+r.y,c=yield this.tileLoader.loadTileTexture(r.x,r.y,r.z);if(c){let l=new pt.MeshBasicMaterial({map:c,transparent:!0}),p=new pt.Mesh(this.baseGeometry,l);p.scale.setX(n).setY(n),p.position.set((r.x-o/2)*n+n/2,-((r.y-o/2)*n)-n/2,0),p.userData.key=h,this.tileGroup.add(p)}}))),this.tileGroup.children.forEach(r=>{s.includes(r)&&(r.material.dispose(),this.tileGroup.remove(r))})})}setVisibility(t){this.visible=t,t&&this.onUpdate()}setOpacity(t){super.setOpacity(t)}clearTiles(){this.tileGroup.children.forEach(t=>{t.material.dispose()}),this.tileGroup.clear()}dispose(){this.removeEvents(),this.clearTiles(),this.baseGeometry.dispose(),this.tileLoader.dispose(),super.dispose()}constructor(t,e){super(t),this.loadedTiles=new Map,this.currentLevel=0,this.tileSize=256,this.baseGeometry=new pt.PlaneGeometry(1,1),this.options=Rr,this.onUpdate=()=>{this.updateTiles()},this.onCenterChange=()=>{let{center:s}=this.context;this.tileGroup.position.set(-s[0],-s[1],0),this.updateTiles()},this.updateTiles=(0,Gr.debounce)(()=>f(this,null,function*(){if(!this.visible)return;let s=yield this.loadTileConfig(),o=this.context.camera,n=this.getViewBounds();if(!n)return;let r=this.getTileZoomLevel(o.zoom,s),h=this.getTilesInView(n,r,s);this.renderTiles(h,r)}),100),this.options=w({},Rr,e),this.tileGroup=new pt.Group;let{center:i}=t;this.tileGroup.position.set(-i[0],-i[1],0),this.add(this.tileGroup),this.tileLoader=new Xi(this.options.base_url),this.initEvents(),this.updateTiles()}};Re.WORLD_WIDTH=4007501668e-2;Re.WORLD_WIDTH_HALF=Re.WORLD_WIDTH/2;var Sf=require("core-js/modules/es.array.push.js"),Ef=require("core-js/modules/web.dom-collections.iterator.js"),Lf=require("core-js/modules/es.string.trim.js");var Mt=require("three");var ie=require("lodash");var Ph={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1,text_opacity:1,icon_opacity:1},tt=class extends Mt.Object3D{get textTexture(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureMap[e])==null?void 0:t.texture)!=null?i:null}get textTextureRect(){let t=this.options.text;var e;return t&&(e=this.textTextureRectMap[t])!=null?e:null}get textureLines(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureRectMap[e])==null?void 0:t.lines)!=null?i:1}get textAspect(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureRectMap[e])==null?void 0:t.aspect)!=null?i:1}get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:i,text_texture_offset_x:s,text_texture_offset_y:o}=this.options;return!(0,ie.isNil)(t)&&!(0,ie.isNil)(e)&&!(0,ie.isNil)(i)&&!(0,ie.isNil)(s)&&!(0,ie.isNil)(o)}get initedTextRect(){return!this.options.text||this.options.text&&this.textTextureRect}get deltaZ(){return this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:this.hasText?.1+.5*this.textHeight/this.context.camera.zoom:.1}get canSelect(){return this.visible&&this._shouldShow}show(){return f(this,null,function*(){if(this._shouldShow)return;this._shouldShow=!0;let t=[];if(!this.spriteIcon&&this.options.icon&&t.push(this.initIcon()),!this.spriteText&&this.hasText&&t.push(this.initText()),yield Promise.all(t),!this._shouldShow){this.hide();return}this.initSize(),this._initScale({zoom:this.context.camera.zoom}),this.spriteIcon&&(this.spriteIcon.visible=!0),this.spriteText&&(this.spriteText.visible=!0)})}hide(){this._shouldShow=!1,this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon.material.dispose(),this.spriteIcon=void 0),this.spriteText&&(this.remove(this.spriteText),this.spriteText.material.dispose(),this.spriteText=void 0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>f(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show()),this.context.forceUpdate()})),this.addEventListener("change-text",t=>f(this,null,function*(){let{value:e}=t;this.initTextTexture=(0,ie.once)(this._initTextTexture),this.initTextTextureRect=(0,ie.once)(this._initTextTextureRect),this._shouldShow&&(this.hide(),yield this.show()),this.context.forceUpdate()})),this.addEventListener("change-text_font_size",t=>f(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show()),this.options.text&&this.context.forceUpdate()})),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this._initScale({zoom:this.context.camera.zoom}),this.initSize(),this.options.icon&&this.context.forceUpdate()}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)}),this.addEventListener("change-icon_opacity",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.opacity=e)}),this.addEventListener("change-text_opacity",t=>{let{value:e}=t;this.spriteText&&(this.spriteText.material.opacity=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return f(this,null,function*(){if(this.options.icon)return new Promise(t=>f(this,null,function*(){let e;if(this.options.icon_border){let{icon:s,icon_size:o,icon_border:n}=this.options;e=yield ct.getUrlTextureBorder(s,o[0]-n.width*2,n)}else e=yield ct.getTextureByUrl(this.options.icon);let i=new Mt.Sprite(new Mt.SpriteMaterial({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI,opacity:this.options.icon_opacity}));i.visible=!1,i.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(i),this.spriteIcon=i,t(i)}))})}initText(){return f(this,null,function*(){if(this.hasText){let t=this.textTexture;t||(yield this.initTextTexture()),t=this.textTexture;let e=new Mt.Sprite(new Mt.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,opacity:this.options.text_opacity}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}})}initSize(){var t,e;let i=0,s=0,{icon:o}=this.options;o?this.hasText?(i=0,s=i*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(i=.5,s=0):this.hasText?(s=.5,i=0):(i=0,s=0),(t=this.spriteIcon)==null||t.center.set(.5,i),(e=this.spriteText)==null||e.center.set(.5,s)}init(){return f(this,null,function*(){yield Promise.all([this.initIcon(),this.initText()]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){if(!this.initedTextRect)return this.initTextTextureRect(),null;let{clientSize:{width:e,height:i}}=this.context,s=e*(t.x+1)/2,o=i*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let n=this.iconWidth/2,r=new Mt.Box2(new Mt.Vector2(s-n,o-this.iconHeight),new Mt.Vector2(s+n,o)),h=this.textWidth/2,c=new Mt.Box2(new Mt.Vector2(s-h,o-this.textHeight-this.durIconAndText-this.iconHeight),new Mt.Vector2(s+h,o-this.iconHeight-this.durIconAndText));return this.box=c.union(r),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let i=document.createElement("div");i.style.position="absolute",i.style.zIndex="999",i.style.border="1px solid red",i.style.pointerEvents="none",this.boxHelper=i,this.context.container.appendChild(i)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px")}setVisible(t){this.visible=t,this.context.forceUpdate()}parentSetVisible(t){t?this.show():this.hide(),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.hide(),this.textTextureMap={},this.unRegistryEvent(),this._listeners={}}constructor(t,e){var i;super(),this.context=t,this.box=new Mt.Box2,this._shouldShow=!1,this.textTextureMap={},this.textTextureRectMap={},this._initTextTexture=()=>f(this,null,function*(){if(!this.options.text||this.textTextureMap[this.options.text])return;let o;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:r,text_texture_height:h,text_texture_offset_x:c,text_texture_offset_y:l}=this.options;o=this.options.text_texture.clone(),o.uuid=n.uuid,o.offset.set(c/o.image.width,1-(h+l)/o.image.height),o.repeat.set(r/o.image.width,h/o.image.height),this.textTextureMap[this.options.text]={texture:o,lines:1,textAspect:r/h}}else{let n=yield Q.getTextureByText(this.options.text);this.textTextureMap[this.options.text]=w({},n,{textAspect:n.texture.image.width/n.texture.image.height})}this.dispatchEvent({type:"text-texture-inited"})}),this.initTextTexture=(0,ie.once)(this._initTextTexture),this._initTextTextureRect=()=>f(this,null,function*(){if(!this.options.text||this.textTextureRectMap[this.options.text])return;let o=yield Q.getTextureRectByTexts(this.options.text);this.textTextureRectMap[this.options.text]=w({},o,{aspect:o.width/o.height}),this.dispatchEvent({type:"text-texture-rect-inited"})}),this.initTextTextureRect=(0,ie.once)(this._initTextTextureRect),this._initScale=o=>{let{zoom:n}=o;if(this.spriteText){let h=this.textHeight/n;this.spriteText.scale.set(this.textAspect*h,h,.1)}if(this.spriteIcon){var r;(r=this.spriteIcon)==null||r.scale.set(this.options.icon_size[0]/n,this.options.icon_size[1]/n,.1)}this.resetZ()};var s;this.options=Ue(w({},Ph,e,{text:(s=(i=e.text)==null?void 0:i.trim())!=null?s:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent()}};var se=class extends Bt.Object3D{getPosition(){return this.box.getCenter(new Bt.Vector3)}onAddToScene(t){this.poiLayer2.onAddToScene(t)}onRemoveFromScene(){this.poiLayer2.onRemoveFromScene()}createGround(t){let e=new lt(this.context,t);e.userData.data=t,this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight+.01}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new Bt.Box3().setFromObject(this).getCenter(new Bt.Vector3)}addModel(t){let e=new Bi(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new Bt.Box3().setFromObject(this.groundUpper),e=t.getCenter(new Bt.Vector3),i=t.getSize(new Bt.Vector3);this.shadow.setPosition(e),this.shadow.changeLightCamera(i)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addPoi2(t){let e=new tt(this.context,t);return this.poiLayer2.pushPoi(e),e}removePoi2(t){return this.poiLayer2.removePoi(t)}removePoi2ById(t){return this.poiLayer2.removePoiById(t)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}setGraphicOptions(t,e){this.graphicLayer.graphicMap.has(t)?this.graphicLayer.setGraphicOptions(t,e):this.mergeGraphicLayer.setGraphicOptions(t,e)}getGraphicPosition(t){return this.graphicLayer.getGraphicPosition(t)||this.mergeGraphicLayer.getGraphicPosition(t)||this.parkingSpaceLayer.getGraphicPosition(t)}changeParkingColor(t){this.parkingSpaceLayer.changeParkingColor(t)}getParkingOptionsByParkingNo(t){return this.parkingSpaceLayer.getParkingOptionsByParkingNo(t)}updateBox(){this.box.setFromObject(this.groundLayer)}getGraphics(){return this.graphicLayer.children.filter(t=>t instanceof lt)}setOpacity(t,e){e===void 0&&(e=!1),this.groundLayer.setOpacity(t,e),this.graphicLayer.setOpacity(t,e),this.mergeGraphicLayer.setOpacity(t,e),this.poiLayer2.setOpacity(t),this.parkingSpaceLayer.setOpacity(t,e),this.laneLayer.setOpacity(t,e),this.wallLayer.setOpacity(t,e),this.textureLayer.setOpacity(t),this.textTextureLayer.setOpacity(t),this.glbModelLayer.setOpacity(t,e),this.userData.opacity=t}dispose(){console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.parkingSpaceLayer.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(t=>t.dispose()),this.groundUpper.clear(),this.models.children.forEach(t=>t.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}constructor(t){super(),this.context=t,this.grounds=new Set,this.shadow=new zi,this.groundUpper=new Bt.Object3D,this.models=new Bt.Object3D,this.modelMap=new Map,this.groundMaxHeight=0,this.name="",this.key="",this.box=new Bt.Box3,this.groundLayer=new q(this.context),this.graphicLayer=new Wi(this.context),this.poiLayer=new Ui(this.context),this.poiLayer2=new Hi(this.context),this.parkingSpaceLayer=new Ni(this.context),this.wallLayer=new q(this.context),this.textureLayer=new q(this.context),this.glbModelLayer=new Zi(this.context),this.laneLayer=new q(this.context),this.mergeGraphicLayer=new Ki(this.context),this.textTextureLayer=new q(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.parkingSpaceLayer),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}};var _t=require("three"),Fr=require("@mars3d/heatmap.js"),Us=require("@turf/turf");var Yi=class extends _t.Object3D{clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){var e;this.clearHeatmap();let{width:i,height:s,leftTop:o,center:n,scale:r}=this.box,h=((e=this.context.config.heatMap)==null?void 0:e.radius)||1,c=w({width:i,height:s,container:this.div},this.context.config.heatMap,{radius:h});this.heatmap=(0,Fr.create)(c);let l=this.transformData(t,o,r);t.maxValue!==void 0&&(l.max=t.maxValue),t.minValue!==void 0&&(l.min=t.minValue),this.heatmap.setData(l),this.initPlane(i/r,s/r);let p=this.context.center;this.position.set(n[0]-p[0],n[1]-p[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let i=new _t.PlaneGeometry(t,e),s=new _t.Texture(this.div.firstChild);s.needsUpdate=!0;let o=new _t.MeshBasicMaterial({transparent:!0,side:_t.FrontSide,map:s});o.needsUpdate=!0,this.plane=new _t.Mesh(i,o),this.plane.renderOrder=1e5,this.add(this.plane)}getTransMatrix(t){let{x:e,y:i}=t;return new _t.Matrix3().makeScale(this.box.scale,-this.box.scale).multiply(new _t.Matrix3().makeTranslation(-e,-i))}transformData(t,e,i){var s,o;let n=this.getTransMatrix(e);var r;let h=(r=(s=t.data[0])==null?void 0:s.value)!=null?r:0;var c;let l=(c=(o=t.data[0])==null?void 0:o.value)!=null?c:0;return{data:t.data.map(d=>{let u=new _t.Vector2(d.x,d.y).applyMatrix3(n);return d.value>h&&(h=d.value),d.value<l&&(l=d.value),{x:Math.ceil(u.x),y:Math.ceil(u.y),value:d.value}}),max:h,min:l}}getBox(){let t=this.context.range,e=(0,Us.bbox)(t),i=Math.ceil(e[2]-e[0]),s=Math.ceil(e[3]-e[1]),o=4e3,n=4e3,r=o/i,h=n/s,c=Math.min(r,h);this.scaleRatio=c;let l=i*c,p=s*c,d={x:Math.ceil(e[0]),y:Math.ceil(e[3])},u=(0,Us.center)(t).geometry.coordinates;return{width:l,height:p,leftTop:d,center:u,scale:c}}dispose(){this.clearHeatmap(),this.div.remove(),this.div=null,this.plane&&(this.remove(this.plane),I(this.plane))}constructor(t){super(),this.context=t,this.scaleRatio=1,this.div=document.createElement("div"),this.box=this.getBox()}};var $f=require("core-js/modules/es.array.push.js"),Jf=require("core-js/modules/web.dom-collections.iterator.js");var Hs=require("three");var Wt=class extends Hs.EventDispatcher{_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:i}=this.context,{offsetX:s,offsetY:o}=t,{clientWidth:n,clientHeight:r}=i.domElement,h=s/n*2-1,c=1-o/r*2;return new Hs.Vector3(h,c,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:i}=this.context;return D(t,e,i.clientWidth,i.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}constructor(t){super(),this.context=t,this.points=[],this.enable=!0,this._onResize=e=>{let{width:i,height:s}=e;this.svg&&(this.svg.setAttribute("width",""+i),this.svg.setAttribute("height",""+s))},this.svg=Po(""+t.container.clientWidth,""+t.container.clientHeight),t.container.appendChild(this.svg),this._registryEvent()}};var qi=class extends Wt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:i,y:s}]=this.points;return Math.sqrt((i-t)**2+(s-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}constructor(t){super(t),this.context=t,this.onUpdate=()=>{if(this.points[0]){let s=this.getSvgCoordinate(this.points[0]);Ce(this.circles[0],s.x,s.y),Vt(this.line,s)}if(this.points[1]){let s=this.getSvgCoordinate(this.points[1]);Ce(this.circles[1],s.x,s.y),Vt(this.line,void 0,s)}},this.onPointermove=s=>{this.points.length===1&&(this.line.style.display="block",Vt(this.line,void 0,{x:s.offsetX,y:s.offsetY}))},this.onPointerleave=()=>{this.points[1]||(this.line.style.display="none")},this.onPointerdown=s=>{if(this.points[1])return;let o=this.getIntersectByPointerEvent(s);if(o){let{offsetX:n,offsetY:r}=s,h=this.circles[this.points.length];Ce(h,n,r),this.points.length||Vt(this.line,{x:n,y:r},{x:n,y:r}),this.addPoint(o)}};let{config:{svg:{circle:e,line:i}}}=t;this.circles=[Qe(e.radius,e.fill),Qe(e.radius,e.fill)],this.line=ki(i.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}};var ig=require("core-js/modules/es.array.push.js");var $i=class extends Wt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(t){this.circles.push(t),this.svg.appendChild(t)}addLine(t){this.lines.push(t),this.svg.appendChild(t)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}checkAdsorb(t,e){if(this.points.length<3)return!1;let i=this.circles[0],s=+i.getAttribute("cx"),o=+i.getAttribute("cy");return Math.sqrt((t-s)**2+(e-o)**2)<=5}addPoint(t){if(this.points.push(t),this.isClose){let e=this.calculatedArea();this.dispatchEvent({type:"area",area:e})}}calculatedArea(){let t=this.points.map(s=>[s.x,s.y]),e=0,i=t.length;for(let s=0;s<i;s++){let o=(s+1)%i;e+=t[s][0]*t[o][1]-t[o][0]*t[s][1]}return Math.abs(e/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}constructor(t){super(t),this.circles=[],this.lines=[],this.isClose=!1,this.onUpdate=()=>{this.points.length&&this.points.forEach((e,i)=>{let s=this.getSvgCoordinate(e);this.circles[i]&&Ce(this.circles[i],s.x,s.y),i!==0&&Vt(this.lines[i-1],void 0,s),this.lines[i]&&Vt(this.lines[i],s)})},this.onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",Vt(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))},this.onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")},this.onPointerdown=e=>{if(this.isClose)return;let i=this.getIntersectByPointerEvent(e);if(i){let{offsetX:s,offsetY:o}=e;this.checkAdsorb(s,o)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(i);let{circle:{fill:n,radius:r},line:{stroke:h}}=this.context.config.svg;if(!this.isClose){let c=Qe(r,n);Ce(c,s,o),this.addCircle(c)}if(this.lines.length&&Vt(this.lastLine,void 0,{x:s,y:o}),!this.isClose){let c=ki(h);Vt(c,{x:s,y:o},{x:s,y:o}),this.addLine(c)}}},this.registryEvent()}};var zr=require("three");var Ko=class extends Wt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}constructor(t){super(t),this.context=t,this.cornerRect=[],this.centerRect=[],this.onUpdate=()=>{if(this.graphic){let i=new zr.Box3().setFromObject(this.graphic),{camera:s,container:{clientWidth:o,clientHeight:n}}=this.context,{min:r,max:h}=i,c=D(r,s,o,n),l=D(h,s,o,n);bt(this.rect,c.x,l.y,Math.abs(l.x-c.x),Math.abs(l.y-c.y));let{x:p,y:d}=c,{x:u,y:m}=l,v=5,g=[{x:p-v,y:m-v},{x:u-v,y:m-v},{x:p-v,y:d-v},{x:u-v,y:d-v}];for(let S=0;S<g.length;S++)bt(this.cornerRect[S],g[S].x,g[S].y,v*2,v*2);let x=4,M=(p+u)/2,P=(d+m)/2,C=[{x:M-x,y:m-x},{x:p-x,y:P-x},{x:u-x,y:P-x},{x:M-x,y:d-x}];for(let S=0;S<C.length;S++)bt(this.centerRect[S],C[S].x,C[S].y,x*2,x*2)}else{bt(this.rect,0,0,0,0);for(let i=0;i<this.cornerRect.length;i++)bt(this.cornerRect[i],0,0,0,0),bt(this.centerRect[i],0,0,0,0)}};let{config:{svg:{line:e}}}=t;this.rect=_e(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let i=0;i<4;i++)this.cornerRect[i]=_e(e.stroke,"#ffffff"),this.centerRect[i]=_e(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[i]),this.svg.appendChild(this.centerRect[i]);this.registryEvent()}};var cg=require("core-js/modules/es.array.push.js"),Pt=require("three");var Br=require("three/examples/jsm/utils/BufferGeometryUtils.js");var Ji=class extends Pt.Object3D{initGeometry(){return f(this,null,function*(){let t=yield ee.GetMergeGeometry(this.options);this.geometry=t})}initMaterial(){let t=`
|
|
436
|
+
`;return this.instancedWallMaterial=new $.ShaderMaterial({vertexShader:t,fragmentShader:e,transparent:!0})}static dispose(){this.lineMaterialMap.forEach((t,e)=>{t.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((t,e)=>{t.dispose()}),this.shaderMaterialMap.clear(),this.line2MaterialMap.forEach((t,e)=>{t.dispose()}),this.line2MaterialMap.clear(),this.lineDashedMaterialMap.forEach(t=>{t.dispose()}),this.lineDashedMaterialMap.clear(),this.mergeAttributeGraphicMaterial&&(this.mergeAttributeGraphicMaterial.dispose(),this.mergeAttributeGraphicMaterial=null),this.mergeAttributeWallMaterial&&(this.mergeAttributeWallMaterial.dispose(),this.mergeAttributeWallMaterial=null),this.mergeAttributeGraphicLineMaterial&&(this.mergeAttributeGraphicLineMaterial.dispose(),this.mergeAttributeGraphicLineMaterial=null),this.instancedGraphicMaterial&&(this.instancedGraphicMaterial.dispose(),this.instancedGraphicMaterial=null),this.instancedWallMaterial&&(this.instancedWallMaterial.dispose(),this.instancedWallMaterial=null)}};rt(Lt,"lineMaterialMap",new Map),rt(Lt,"meshStandardMaterialMap",new Map),rt(Lt,"meshBasicMaterialMap",new Map),rt(Lt,"shaderMaterialMap",new Map),rt(Lt,"line2MaterialMap",new Map),rt(Lt,"mergeAttributeGraphicMaterial",null),rt(Lt,"mergeAttributeWallMaterial",null),rt(Lt,"mergeAttributeGraphicLineMaterial",null),rt(Lt,"instancedGraphicMaterial",null),rt(Lt,"instancedWallMaterial",null),rt(Lt,"lineDashedMaterialMap",new Map);var si=class{static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let t=this.createKey();for(;this.keySet.has(t);)t=this.createKey();return t}static removeKey(t){this.keySet.delete(t)}static dispose(){this.keySet.clear()}};rt(si,"keySet",new Set);function oi(a,t,e){return new Promise((i,s)=>{let o=si.genUniqueKey(),n=({data:r})=>{r.type===`${t}_result`&&r.key===o&&(si.removeKey(o),self.removeEventListener("message",n),r.error?s(r.error):i(r.data))};a.addEventListener("message",n),a.postMessage({type:t,key:o,data:e})})}var Gr=require("three");var Us=class extends Gr.EventDispatcher{constructor(e=10,i){super();rt(this,"max",10);rt(this,"workerConstructor");rt(this,"pool",[]);this.max=e,this.workerConstructor=i}getWorker(){return new Promise(e=>{let i=this.pool.find(o=>o.state==="leisure");if(i){i.state="used",e(i.worker);return}if(this.pool.length<this.max&&this.workerConstructor){let o=this.workerConstructor();this.pool.push({worker:o,state:"used"}),e(o);return}let s=()=>{let o=this.pool.find(n=>n.state==="leisure");o&&(this.removeEventListener("release",s),o.state="used",e(o.worker))};this.addEventListener("release",s)})}releaseWorker(e){let i=this.pool.find(s=>s.worker===e);i&&(i.state="leisure",this.dispatchEvent({type:"release",worker:e}))}dispose(){this._listeners={},this.pool.forEach(e=>{e.worker.terminate()}),this.pool=[]}};var Sh={};function Xo(){return new Worker(new URL("./worker/merge-geometry.worker-S6YLXRL5.js",Sh.url))}var Xi=require("three");var ni=class{static GetMergeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedShapeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedTexture2dGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetBufferGeometryByData(t){let e=new Xi.BufferGeometry;return Object.keys(t.attributes).forEach(i=>{e.setAttribute(i,new Xi.BufferAttribute(t.attributes[i].array,t.attributes[i].itemSize))}),t.index&&e.setIndex(new Xi.BufferAttribute(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),i?Ei(Ei({},t[0]),i):null})}static GetMergedGeometryLine(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_geometries_line_json",{data:t});return this.WorkerPool.releaseWorker(e),i?Ei(Ei({},t[0]),i):null})}static dispose(){this.WorkerPool.dispose()}};rt(ni,"WorkerPool",new Us(10,Xo));var Yi=class extends q{getCenter(){return new Ft.Box3().setFromObject(this).getCenter(new Ft.Vector3)}addInstancedGraphic(t){this.instancedGraphicConfig?(this.instancedGraphicConfig.size+=t.size,this.instancedGraphicConfig.colors=[...this.instancedGraphicConfig.colors,...t.colors],this.instancedGraphicConfig.matrixes=[...this.instancedGraphicConfig.matrixes,...t.matrixes],this.instancedGraphicConfig.opacities=[...this.instancedGraphicConfig.opacities,...t.opacities],this.instancedGraphicConfig.maxZs=[...this.instancedGraphicConfig.maxZs,...t.maxZs],this.instancedGraphicConfig.ids=[...this.instancedGraphicConfig.ids,...t.ids]):this.instancedGraphicConfig=t,this.refeshInstancedGraphic()}refeshInstancedGraphic(){this.instancedGraphic&&(this.remove(this.instancedGraphic),I(this.instancedGraphic)),this.instancedGraphicConfig&&(this.instancedGraphic=new Xe(this.context,this.instancedGraphicConfig),this.add(this.instancedGraphic))}addGraphics(t,e){t.map(i=>{this.graphicDataMap.set(i.id,i),this.graphicOriginOptionMap.set(i.id,{fillOpacity:i.fillOpacity,strokeOpacity:i.strokeOpacity})}),e?e.map(i=>{if(i.instancedGeometry&&this.addInstancedGraphic(i.instancedGeometry),i.mergedGeometry){let s=new ri(this.context,w({},i,{lineGeometry:null}));this.mergedGraphicGroup.add(s)}if(i.lineGeometry){let s=new Ie(this.context,i.lineGeometry);this.mergedLineGroup.add(s)}}):(this.refreshMergeGraphic(),this.refreshLine())}createGraphic(t){return f(this,null,function*(){let e=yield ni.GetMergedGeometry(t);if(I(this.mergedGraphicGroup),this.mergedGraphicGroup.clear(),e){let i=new ri(this.context,e);this.mergedGraphicGroup.add(i)}})}createLine(t){return f(this,null,function*(){let e=yield ni.GetMergedGeometryLine(t);if(I(this.mergedLineGroup),this.mergedLineGroup.clear(),e){let i=new Ie(this.context,e.lineGeometry);this.mergedLineGroup.add(i)}})}refreshMergeGraphic(){let t=Array.from(this.graphicDataMap.values());this.instancedGraphicConfig&&(t=t.filter(e=>{var i;return!((i=this.instancedGraphicConfig)!=null&&i.ids.includes(e.id))})),this.createGraphic(t)}refreshLine(){let t=Array.from(this.graphicDataMap.values());this.createLine(t)}removeGraphicById(t){var e;if(this.graphicDataMap.delete(t),(e=this.instancedGraphicConfig)!=null&&e.ids.includes(t)){let i=this.instancedGraphicConfig.ids.findIndex(s=>s===t);this.instancedGraphicConfig.size--,this.instancedGraphicConfig.colors.splice(i*3,3),this.instancedGraphicConfig.matrixes.splice(i*16,16),this.instancedGraphicConfig.opacities.splice(i,1),this.instancedGraphicConfig.maxZs.splice(i,1),this.instancedGraphicConfig.ids.splice(i,1),this.refeshInstancedGraphic()}else this.refreshMergeGraphic();this.refreshLine()}getGraphicDataByNodeId(t){return this.graphicMap.get(t)||null}setGraphicOptions(t,e){var i;let s,o=this.graphicDataMap.get(t);if(o){if(typeof e=="function"?s=e(o):s=w({},o,e),this.graphicDataMap.set(t,s),(i=this.instancedGraphicConfig)!=null&&i.ids.includes(t)&&this.instancedGraphic){this.instancedGraphic.setColorById(t,s.fillColor),this.instancedGraphic.setOpacityById(t,s.fillOpacity),this.instancedGraphic.setMaxZById(t,s.deltaHeight+s.airHeight+s.height);let n=this.instancedGraphicConfig.ids.findIndex(d=>d===t),r=this.instancedGraphicConfig.matrixes.slice(n*16,(n+1)*16),h=new Ft.Matrix4().fromArray(r),c=new Ft.Vector3,l=new Ft.Quaternion,p=new Ft.Vector3;h.decompose(c,l,p),p.z=s.height,c.z=s.deltaHeight+s.airHeight+s.height/2,h.compose(c,l,p),this.instancedGraphic.setMatrixById(t,h)}else this.refreshMergeGraphic();this.refreshLine()}}getGraphicPosition(t){let e=this.graphicDataMap.get(t);return e?[e.center_x,e.center_y]:null}setOpacity(t,e){e===void 0&&(e=!1);var i;this.graphicDataMap.forEach((s,o)=>{if(e)s.fillOpacity=t,s.strokeOpacity=t;else{let h=this.graphicOriginOptionMap.get(o);var n;s.fillOpacity=Math.min(t,(n=h==null?void 0:h.fillOpacity)!=null?n:1);var r;s.strokeOpacity=Math.min(t,(r=h==null?void 0:h.strokeOpacity)!=null?r:1)}}),(i=this.instancedGraphic)==null||i.setOpacity(t,e),this.refeshInstancedGraphic(),this.refreshLine()}dispose(){super.dispose(),this.mergedGraphicGroup.clear(),this.mergedLineGroup.clear(),this.instancedGraphic=null,this.instancedGraphicConfig=null}constructor(t){super(t),this.graphicMap=new Map,this.mergedGraphicGroup=new Ft.Group,this.mergedLineGroup=new Ft.Group,this.graphicDataMap=new Map,this.graphicOriginOptionMap=new Map,this.instancedGraphic=null,this.instancedGraphicConfig=null,this.add(this.mergedGraphicGroup),this.add(this.mergedLineGroup)}};var Mf=require("core-js/modules/web.dom-collections.iterator.js"),_f=require("core-js/modules/es.array.push.js");var pt=require("three");var mf=require("core-js/modules/es.string.replace.js"),ff=require("core-js/modules/es.regexp.exec.js"),gf=require("core-js/modules/es.error.cause.js"),yf=require("core-js/modules/web.dom-collections.iterator.js"),Hs=require("three");var qi=class{setBaseUrl(t){this.baseUrl=t.replace(/\/$/,"")}setConfig(t){this.config=t}loadConfig(){return f(this,null,function*(){if(this.config)return this.config;if(!this.baseUrl)throw new Error("Base URL is not set");try{let t=yield fetch(""+this.baseUrl+"/config.json");return this.config=yield t.json(),this.config}catch(t){return console.error("Failed to load tile config:",t),this.config={extent:[12276734621488994e-9,2.1183542845726013e6,12279646804065457e-9,2121524247761597e-9],maxZoom:21,minZoom:11},this.config}})}buildTileUrl(t,e,i){if(!this.baseUrl)throw new Error("Base URL is not set");return this.baseUrl+"/"+i+"/"+t+"/"+e+".png"}loadTileTexture(t,e,i){return f(this,null,function*(){if(!this.baseUrl)throw new Error("Base URL is not set");let s=this.buildTileUrl(t,e,i);if(this.textureCache.has(s)){let n=this.textureCache.get(s);return n instanceof Promise?n:Promise.resolve(n)}let o=this.textureLoader.loadAsync(s).then(n=>(n.flipY=!0,n.colorSpace=Hs.SRGBColorSpace,this.textureCache.set(s,n),n)).catch(n=>null);return this.textureCache.set(s,o),o})}clearCache(){this.textureCache.forEach(t=>{t instanceof Promise?t.then(e=>e==null?void 0:e.dispose()):t.dispose()}),this.textureCache.clear()}dispose(){this.clearCache()}constructor(t){this.baseUrl="",this.config=null,this.textureCache=new Map,this.textureLoader=new Hs.TextureLoader,t&&this.setBaseUrl(t)}};var zr=require("lodash");var Fr={base_url:"https://robot-vr-public.aibee.cn/static_resource/tiles"},Re=class a extends q{loadTileConfig(){return f(this,null,function*(){return this.tileLoader.loadConfig()})}initEvents(){this.context.addEventListener("control-change",this.onUpdate),this.context.bmap.addEventListener("center-change",this.onCenterChange)}removeEvents(){this.context.removeEventListener("control-change",this.onUpdate),this.context.bmap.removeEventListener("center-change",this.onCenterChange)}getViewBounds(){let t=this.context.camera,e=new pt.Raycaster,i=new pt.Vector2,s=[],[o,n]=this.context.center||[0,0],r=[{x:-1,y:1},{x:1,y:1},{x:1,y:-1},{x:-1,y:-1}];for(let d of r){i.set(d.x,d.y),e.setFromCamera(i,t);let u=new pt.Vector3(0,0,1),m=new pt.Vector3(0,0,0),v=new pt.Plane().setFromNormalAndCoplanarPoint(u,m),g=new pt.Vector3;e.ray.intersectPlane(v,g)?s.push(g):(e.ray.direction.negate(),e.ray.intersectPlane(v,g)&&s.push(g))}if(s.length<4)return null;let h=1/0,c=1/0,l=-1/0,p=-1/0;return s.forEach(d=>{h=Math.min(h,d.x+o),c=Math.min(c,d.y+n),l=Math.max(l,d.x+o),p=Math.max(p,d.y+n)}),{minX:h,minY:c,maxX:l,maxY:p}}getTileZoomLevel(t,e){let{minZoom:i,maxZoom:s}=e,o=this.context.camera,n=(o.right-o.left)/o.zoom,r=this.context.clientSize.width,h=n/r,c=a.WORLD_WIDTH,l=Math.log2(c/(h*this.tileSize));return Math.min(s,Math.max(i,Math.round(l)))}getTilesInView(t,e,i){let[s,o,n,r]=i.extent,h=Math.max(t.minX,s),c=Math.max(t.minY,o),l=Math.min(t.maxX,n),p=Math.min(t.maxY,r);if(h>=l||c>=p)return[];let d=Math.pow(2,e),u=a.WORLD_WIDTH/d,m=a.WORLD_WIDTH_HALF,v=Math.max(0,Math.floor((h+m)/u)),g=Math.floor((l+m)/u),x=Math.max(0,Math.floor((m-p)/u)),M=Math.floor((m-c)/u),P=[];for(let C=v;C<=g;C++)for(let S=x;S<=M;S++)P.push({x:C,y:S,z:e});return P}renderTiles(t,e){return f(this,null,function*(){let i=t,s=[];if(this.currentLevel!==e)s=[...this.tileGroup.children];else{let r=this.tileGroup.children,h=r.map(l=>l.userData.key),c=t.map(l=>l.z+"/"+l.x+"/"+l.y);i=t.filter(l=>!h.includes(l.z+"/"+l.x+"/"+l.y)),s=r.filter(l=>!c.includes(l.userData.key))}let o=Math.pow(2,e),n=a.WORLD_WIDTH/o;yield Promise.all(i.map(r=>f(this,null,function*(){let h=r.z+"/"+r.x+"/"+r.y,c=yield this.tileLoader.loadTileTexture(r.x,r.y,r.z);if(c){let l=new pt.MeshBasicMaterial({map:c,transparent:!0}),p=new pt.Mesh(this.baseGeometry,l);p.scale.setX(n).setY(n),p.position.set((r.x-o/2)*n+n/2,-((r.y-o/2)*n)-n/2,0),p.userData.key=h,this.tileGroup.add(p)}}))),this.tileGroup.children.forEach(r=>{s.includes(r)&&(r.material.dispose(),this.tileGroup.remove(r))})})}setVisibility(t){this.visible=t,t&&this.onUpdate()}setOpacity(t){super.setOpacity(t)}clearTiles(){this.tileGroup.children.forEach(t=>{t.material.dispose()}),this.tileGroup.clear()}dispose(){this.removeEvents(),this.clearTiles(),this.baseGeometry.dispose(),this.tileLoader.dispose(),super.dispose()}constructor(t,e){super(t),this.loadedTiles=new Map,this.currentLevel=0,this.tileSize=256,this.baseGeometry=new pt.PlaneGeometry(1,1),this.options=Fr,this.onUpdate=()=>{this.updateTiles()},this.onCenterChange=()=>{let{center:s}=this.context;this.tileGroup.position.set(-s[0],-s[1],0),this.updateTiles()},this.updateTiles=(0,zr.debounce)(()=>f(this,null,function*(){if(!this.visible)return;let s=yield this.loadTileConfig(),o=this.context.camera,n=this.getViewBounds();if(!n)return;let r=this.getTileZoomLevel(o.zoom,s),h=this.getTilesInView(n,r,s);this.renderTiles(h,r)}),100),this.options=w({},Fr,e),this.tileGroup=new pt.Group;let{center:i}=t;this.tileGroup.position.set(-i[0],-i[1],0),this.add(this.tileGroup),this.tileLoader=new qi(this.options.base_url),this.initEvents(),this.updateTiles()}};Re.WORLD_WIDTH=4007501668e-2;Re.WORLD_WIDTH_HALF=Re.WORLD_WIDTH/2;var Cf=require("core-js/modules/es.array.push.js"),Tf=require("core-js/modules/web.dom-collections.iterator.js"),kf=require("core-js/modules/es.string.trim.js");var Mt=require("three");var ee=require("lodash");var Eh={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1,text_opacity:1,icon_opacity:1},tt=class extends Mt.Object3D{get textTexture(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureMap[e])==null?void 0:t.texture)!=null?i:null}get textTextureRect(){let t=this.options.text;var e;return t&&(e=this.textTextureRectMap[t])!=null?e:null}get textureLines(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureRectMap[e])==null?void 0:t.lines)!=null?i:1}get textAspect(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureRectMap[e])==null?void 0:t.aspect)!=null?i:1}get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:i,text_texture_offset_x:s,text_texture_offset_y:o}=this.options;return!(0,ee.isNil)(t)&&!(0,ee.isNil)(e)&&!(0,ee.isNil)(i)&&!(0,ee.isNil)(s)&&!(0,ee.isNil)(o)}get initedTextRect(){return!this.options.text||this.options.text&&this.textTextureRect}get deltaZ(){return this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:this.hasText?.1+.5*this.textHeight/this.context.camera.zoom:.1}get canSelect(){return this.visible&&this._shouldShow}show(){return f(this,null,function*(){if(this._shouldShow)return;this._shouldShow=!0;let t=[];if(!this.spriteIcon&&this.options.icon&&t.push(this.initIcon()),!this.spriteText&&this.hasText&&t.push(this.initText()),yield Promise.all(t),!this._shouldShow){this.hide();return}this.initSize(),this._initScale({zoom:this.context.camera.zoom}),this.spriteIcon&&(this.spriteIcon.visible=!0),this.spriteText&&(this.spriteText.visible=!0)})}hide(){this._shouldShow=!1,this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon.material.dispose(),this.spriteIcon=void 0),this.spriteText&&(this.remove(this.spriteText),this.spriteText.material.dispose(),this.spriteText=void 0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>f(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show()),this.context.forceUpdate()})),this.addEventListener("change-text",t=>f(this,null,function*(){let{value:e}=t;this.initTextTexture=(0,ee.once)(this._initTextTexture),this.initTextTextureRect=(0,ee.once)(this._initTextTextureRect),this._shouldShow&&(this.hide(),yield this.show()),this.context.forceUpdate()})),this.addEventListener("change-text_font_size",t=>f(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show()),this.options.text&&this.context.forceUpdate()})),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this._initScale({zoom:this.context.camera.zoom}),this.initSize(),this.options.icon&&this.context.forceUpdate()}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)}),this.addEventListener("change-icon_opacity",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.opacity=e)}),this.addEventListener("change-text_opacity",t=>{let{value:e}=t;this.spriteText&&(this.spriteText.material.opacity=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return f(this,null,function*(){if(this.options.icon)return new Promise(t=>f(this,null,function*(){let e;if(this.options.icon_border){let{icon:s,icon_size:o,icon_border:n}=this.options;e=yield ct.getUrlTextureBorder(s,o[0]-n.width*2,n)}else e=yield ct.getTextureByUrl(this.options.icon);let i=new Mt.Sprite(new Mt.SpriteMaterial({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI,opacity:this.options.icon_opacity}));i.visible=!1,i.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(i),this.spriteIcon=i,t(i)}))})}initText(){return f(this,null,function*(){if(this.hasText){let t=this.textTexture;t||(yield this.initTextTexture()),t=this.textTexture;let e=new Mt.Sprite(new Mt.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,opacity:this.options.text_opacity}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}})}initSize(){var t,e;let i=0,s=0,{icon:o}=this.options;o?this.hasText?(i=0,s=i*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(i=.5,s=0):this.hasText?(s=.5,i=0):(i=0,s=0),(t=this.spriteIcon)==null||t.center.set(.5,i),(e=this.spriteText)==null||e.center.set(.5,s)}init(){return f(this,null,function*(){yield Promise.all([this.initIcon(),this.initText()]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){if(!this.initedTextRect)return this.initTextTextureRect(),null;let{clientSize:{width:e,height:i}}=this.context,s=e*(t.x+1)/2,o=i*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let n=this.iconWidth/2,r=new Mt.Box2(new Mt.Vector2(s-n,o-this.iconHeight),new Mt.Vector2(s+n,o)),h=this.textWidth/2,c=new Mt.Box2(new Mt.Vector2(s-h,o-this.textHeight-this.durIconAndText-this.iconHeight),new Mt.Vector2(s+h,o-this.iconHeight-this.durIconAndText));return this.box=c.union(r),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let i=document.createElement("div");i.style.position="absolute",i.style.zIndex="999",i.style.border="1px solid red",i.style.pointerEvents="none",this.boxHelper=i,this.context.container.appendChild(i)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px")}setVisible(t){this.visible=t,this.context.forceUpdate()}parentSetVisible(t){t?this.show():this.hide(),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.hide(),this.textTextureMap={},this.unRegistryEvent(),this._listeners={}}constructor(t,e){var i;super(),this.context=t,this.box=new Mt.Box2,this._shouldShow=!1,this.textTextureMap={},this.textTextureRectMap={},this._initTextTexture=()=>f(this,null,function*(){if(!this.options.text||this.textTextureMap[this.options.text])return;let o;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:r,text_texture_height:h,text_texture_offset_x:c,text_texture_offset_y:l}=this.options;o=this.options.text_texture.clone(),o.uuid=n.uuid,o.offset.set(c/o.image.width,1-(h+l)/o.image.height),o.repeat.set(r/o.image.width,h/o.image.height),this.textTextureMap[this.options.text]={texture:o,lines:1,textAspect:r/h}}else{let n=yield Q.getTextureByText(this.options.text);this.textTextureMap[this.options.text]=w({},n,{textAspect:n.texture.image.width/n.texture.image.height})}this.dispatchEvent({type:"text-texture-inited"})}),this.initTextTexture=(0,ee.once)(this._initTextTexture),this._initTextTextureRect=()=>f(this,null,function*(){if(!this.options.text||this.textTextureRectMap[this.options.text])return;let o=yield Q.getTextureRectByTexts(this.options.text);this.textTextureRectMap[this.options.text]=w({},o,{aspect:o.width/o.height}),this.dispatchEvent({type:"text-texture-rect-inited"})}),this.initTextTextureRect=(0,ee.once)(this._initTextTextureRect),this._initScale=o=>{let{zoom:n}=o;if(this.spriteText){let h=this.textHeight/n;this.spriteText.scale.set(this.textAspect*h,h,.1)}if(this.spriteIcon){var r;(r=this.spriteIcon)==null||r.scale.set(this.options.icon_size[0]/n,this.options.icon_size[1]/n,.1)}this.resetZ()};var s;this.options=Ue(w({},Eh,e,{text:(s=(i=e.text)==null?void 0:i.trim())!=null?s:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent()}};var ie=class extends zt.Object3D{getPosition(){return this.box.getCenter(new zt.Vector3)}onAddToScene(t){this.poiLayer2.onAddToScene(t)}onRemoveFromScene(){this.poiLayer2.onRemoveFromScene()}createGround(t){let e=new lt(this.context,t);e.userData.data=t,this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight+.01}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new zt.Box3().setFromObject(this).getCenter(new zt.Vector3)}addModel(t){let e=new Ui(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new zt.Box3().setFromObject(this.groundUpper),e=t.getCenter(new zt.Vector3),i=t.getSize(new zt.Vector3);this.shadow.setPosition(e),this.shadow.changeLightCamera(i)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addPoi2(t){let e=new tt(this.context,t);return this.poiLayer2.pushPoi(e),e}removePoi2(t){return this.poiLayer2.removePoi(t)}removePoi2ById(t){return this.poiLayer2.removePoiById(t)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}setGraphicOptions(t,e){this.graphicLayer.graphicMap.has(t)?this.graphicLayer.setGraphicOptions(t,e):this.mergeGraphicLayer.setGraphicOptions(t,e)}getGraphicPosition(t){return this.graphicLayer.getGraphicPosition(t)||this.mergeGraphicLayer.getGraphicPosition(t)||this.parkingSpaceLayer.getGraphicPosition(t)}changeParkingColor(t){this.parkingSpaceLayer.changeParkingColor(t)}getParkingOptionsByParkingNo(t){return this.parkingSpaceLayer.getParkingOptionsByParkingNo(t)}updateBox(){this.box.setFromObject(this.groundLayer)}getGraphics(){return this.graphicLayer.children.filter(t=>t instanceof lt)}setOpacity(t,e){e===void 0&&(e=!1),this.groundLayer.setOpacity(t,e),this.graphicLayer.setOpacity(t,e),this.mergeGraphicLayer.setOpacity(t,e),this.poiLayer2.setOpacity(t),this.parkingSpaceLayer.setOpacity(t,e),this.laneLayer.setOpacity(t,e),this.wallLayer.setOpacity(t,e),this.textureLayer.setOpacity(t),this.textTextureLayer.setOpacity(t),this.glbModelLayer.setOpacity(t,e),this.userData.opacity=t}dispose(){console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.parkingSpaceLayer.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(t=>t.dispose()),this.groundUpper.clear(),this.models.children.forEach(t=>t.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}constructor(t){super(),this.context=t,this.grounds=new Set,this.shadow=new Wi,this.groundUpper=new zt.Object3D,this.models=new zt.Object3D,this.modelMap=new Map,this.groundMaxHeight=0,this.name="",this.key="",this.box=new zt.Box3,this.groundLayer=new q(this.context),this.graphicLayer=new Hi(this.context),this.poiLayer=new Ni(this.context),this.poiLayer2=new Zi(this.context),this.parkingSpaceLayer=new ji(this.context),this.wallLayer=new q(this.context),this.textureLayer=new q(this.context),this.glbModelLayer=new Vi(this.context),this.laneLayer=new q(this.context),this.mergeGraphicLayer=new Yi(this.context),this.textTextureLayer=new q(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.parkingSpaceLayer),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}};var _t=require("three"),Br=require("@mars3d/heatmap.js"),Ns=require("@turf/turf");var $i=class extends _t.Object3D{clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){var e;this.clearHeatmap();let{width:i,height:s,leftTop:o,center:n,scale:r}=this.box,h=((e=this.context.config.heatMap)==null?void 0:e.radius)||1,c=w({width:i,height:s,container:this.div},this.context.config.heatMap,{radius:h});this.heatmap=(0,Br.create)(c);let l=this.transformData(t,o,r);t.maxValue!==void 0&&(l.max=t.maxValue),t.minValue!==void 0&&(l.min=t.minValue),this.heatmap.setData(l),this.initPlane(i/r,s/r);let p=this.context.center;this.position.set(n[0]-p[0],n[1]-p[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let i=new _t.PlaneGeometry(t,e),s=new _t.Texture(this.div.firstChild);s.needsUpdate=!0;let o=new _t.MeshBasicMaterial({transparent:!0,side:_t.FrontSide,map:s});o.needsUpdate=!0,this.plane=new _t.Mesh(i,o),this.plane.renderOrder=1e5,this.add(this.plane)}getTransMatrix(t){let{x:e,y:i}=t;return new _t.Matrix3().makeScale(this.box.scale,-this.box.scale).multiply(new _t.Matrix3().makeTranslation(-e,-i))}transformData(t,e,i){var s,o;let n=this.getTransMatrix(e);var r;let h=(r=(s=t.data[0])==null?void 0:s.value)!=null?r:0;var c;let l=(c=(o=t.data[0])==null?void 0:o.value)!=null?c:0;return{data:t.data.map(d=>{let u=new _t.Vector2(d.x,d.y).applyMatrix3(n);return d.value>h&&(h=d.value),d.value<l&&(l=d.value),{x:Math.ceil(u.x),y:Math.ceil(u.y),value:d.value}}),max:h,min:l}}getBox(){let t=this.context.range,e=(0,Ns.bbox)(t),i=Math.ceil(e[2]-e[0]),s=Math.ceil(e[3]-e[1]),o=4e3,n=4e3,r=o/i,h=n/s,c=Math.min(r,h);this.scaleRatio=c;let l=i*c,p=s*c,d={x:Math.ceil(e[0]),y:Math.ceil(e[3])},u=(0,Ns.center)(t).geometry.coordinates;return{width:l,height:p,leftTop:d,center:u,scale:c}}dispose(){this.clearHeatmap(),this.div.remove(),this.div=null,this.plane&&(this.remove(this.plane),I(this.plane))}constructor(t){super(),this.context=t,this.scaleRatio=1,this.div=document.createElement("div"),this.box=this.getBox()}};var tg=require("core-js/modules/es.array.push.js"),eg=require("core-js/modules/web.dom-collections.iterator.js");var Zs=require("three");var Bt=class extends Zs.EventDispatcher{_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:i}=this.context,{offsetX:s,offsetY:o}=t,{clientWidth:n,clientHeight:r}=i.domElement,h=s/n*2-1,c=1-o/r*2;return new Zs.Vector3(h,c,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:i}=this.context;return D(t,e,i.clientWidth,i.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}constructor(t){super(),this.context=t,this.points=[],this.enable=!0,this._onResize=e=>{let{width:i,height:s}=e;this.svg&&(this.svg.setAttribute("width",""+i),this.svg.setAttribute("height",""+s))},this.svg=So(""+t.container.clientWidth,""+t.container.clientHeight),t.container.appendChild(this.svg),this._registryEvent()}};var Ji=class extends Bt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:i,y:s}]=this.points;return Math.sqrt((i-t)**2+(s-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}constructor(t){super(t),this.context=t,this.onUpdate=()=>{if(this.points[0]){let s=this.getSvgCoordinate(this.points[0]);Le(this.circles[0],s.x,s.y),jt(this.line,s)}if(this.points[1]){let s=this.getSvgCoordinate(this.points[1]);Le(this.circles[1],s.x,s.y),jt(this.line,void 0,s)}},this.onPointermove=s=>{this.points.length===1&&(this.line.style.display="block",jt(this.line,void 0,{x:s.offsetX,y:s.offsetY}))},this.onPointerleave=()=>{this.points[1]||(this.line.style.display="none")},this.onPointerdown=s=>{if(this.points[1])return;let o=this.getIntersectByPointerEvent(s);if(o){let{offsetX:n,offsetY:r}=s,h=this.circles[this.points.length];Le(h,n,r),this.points.length||jt(this.line,{x:n,y:r},{x:n,y:r}),this.addPoint(o)}};let{config:{svg:{circle:e,line:i}}}=t;this.circles=[Qe(e.radius,e.fill),Qe(e.radius,e.fill)],this.line=ki(i.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}};var ng=require("core-js/modules/es.array.push.js");var Qi=class extends Bt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(t){this.circles.push(t),this.svg.appendChild(t)}addLine(t){this.lines.push(t),this.svg.appendChild(t)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}checkAdsorb(t,e){if(this.points.length<3)return!1;let i=this.circles[0],s=+i.getAttribute("cx"),o=+i.getAttribute("cy");return Math.sqrt((t-s)**2+(e-o)**2)<=5}addPoint(t){if(this.points.push(t),this.isClose){let e=this.calculatedArea();this.dispatchEvent({type:"area",area:e})}}calculatedArea(){let t=this.points.map(s=>[s.x,s.y]),e=0,i=t.length;for(let s=0;s<i;s++){let o=(s+1)%i;e+=t[s][0]*t[o][1]-t[o][0]*t[s][1]}return Math.abs(e/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}constructor(t){super(t),this.circles=[],this.lines=[],this.isClose=!1,this.onUpdate=()=>{this.points.length&&this.points.forEach((e,i)=>{let s=this.getSvgCoordinate(e);this.circles[i]&&Le(this.circles[i],s.x,s.y),i!==0&&jt(this.lines[i-1],void 0,s),this.lines[i]&&jt(this.lines[i],s)})},this.onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",jt(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))},this.onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")},this.onPointerdown=e=>{if(this.isClose)return;let i=this.getIntersectByPointerEvent(e);if(i){let{offsetX:s,offsetY:o}=e;this.checkAdsorb(s,o)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(i);let{circle:{fill:n,radius:r},line:{stroke:h}}=this.context.config.svg;if(!this.isClose){let c=Qe(r,n);Le(c,s,o),this.addCircle(c)}if(this.lines.length&&jt(this.lastLine,void 0,{x:s,y:o}),!this.isClose){let c=ki(h);jt(c,{x:s,y:o},{x:s,y:o}),this.addLine(c)}}},this.registryEvent()}};var Wr=require("three");var Yo=class extends Bt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}constructor(t){super(t),this.context=t,this.cornerRect=[],this.centerRect=[],this.onUpdate=()=>{if(this.graphic){let i=new Wr.Box3().setFromObject(this.graphic),{camera:s,container:{clientWidth:o,clientHeight:n}}=this.context,{min:r,max:h}=i,c=D(r,s,o,n),l=D(h,s,o,n);bt(this.rect,c.x,l.y,Math.abs(l.x-c.x),Math.abs(l.y-c.y));let{x:p,y:d}=c,{x:u,y:m}=l,v=5,g=[{x:p-v,y:m-v},{x:u-v,y:m-v},{x:p-v,y:d-v},{x:u-v,y:d-v}];for(let S=0;S<g.length;S++)bt(this.cornerRect[S],g[S].x,g[S].y,v*2,v*2);let x=4,M=(p+u)/2,P=(d+m)/2,C=[{x:M-x,y:m-x},{x:p-x,y:P-x},{x:u-x,y:P-x},{x:M-x,y:d-x}];for(let S=0;S<C.length;S++)bt(this.centerRect[S],C[S].x,C[S].y,x*2,x*2)}else{bt(this.rect,0,0,0,0);for(let i=0;i<this.cornerRect.length;i++)bt(this.cornerRect[i],0,0,0,0),bt(this.centerRect[i],0,0,0,0)}};let{config:{svg:{line:e}}}=t;this.rect=Me(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let i=0;i<4;i++)this.cornerRect[i]=Me(e.stroke,"#ffffff"),this.centerRect[i]=Me(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[i]),this.svg.appendChild(this.centerRect[i]);this.registryEvent()}};var dg=require("core-js/modules/es.array.push.js"),Pt=require("three");var Ur=require("three/examples/jsm/utils/BufferGeometryUtils.js");var ts=class extends Pt.Object3D{initGeometry(){return f(this,null,function*(){let t=yield te.GetMergeGeometry(this.options);this.geometry=t})}initMaterial(){let t=`
|
|
437
437
|
varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
|
|
438
438
|
uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
|
|
439
439
|
uniform vec3 uColor;
|
|
@@ -472,7 +472,7 @@
|
|
|
472
472
|
gl_FragColor = vec4(vColor, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
`,i=-1/0,s=1/0,o=this.geometry.getAttribute("position");if(o)for(let r=0;r<o.count;r++){let h=o.getZ(r);h>i&&(i=h),h<s&&(s=h)}let n=new Pt.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new Pt.Color(this.options[0].fillColor)},uGradualColor1:{value:new Pt.Color(
|
|
475
|
+
`,i=-1/0,s=1/0,o=this.geometry.getAttribute("position");if(o)for(let r=0;r<o.count;r++){let h=o.getZ(r);h>i&&(i=h),h<s&&(s=h)}let n=new Pt.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new Pt.Color(this.options[0].fillColor)},uGradualColor1:{value:new Pt.Color(ce(this.options[0].fillColor,.99))},uGradualColor2:{value:new Pt.Color(ce(this.options[0].fillColor,.9))},uOpacity:{value:this.options[0].fillOpacity},minZ:{value:s}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=n}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],i=T.createLineMaterial({color:t,opacity:e});return this.lineMaterial=i,i}getBorderPoints(t){let{height:e,deltaHeight:i,geometry:s}=t,o=[],n=e+(i||0),{coords:r}=s;for(let h=0;h<r.length;h++){let c=r[h];for(let l=0;l<c.length;l++){let p=c[l],d=l+1===c.length?c[0]:c[l+1];o.push(new Pt.Vector3(p[0],p[1],n)),o.push(new Pt.Vector3(d[0],d[1],n))}}return o}initLineGeometry(){let t=this.options.map(e=>{let i=this.getBorderPoints(e);return new Pt.BufferGeometry().setFromPoints(i)});this.lineGeometry=(0,Ur.mergeGeometries)(t)}createBorder(){let t=new Pt.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}setOpacity(t,e){e===void 0&&(e=!1),e?this.material.uniforms.uOpacity.value=t:this.material.uniforms.uOpacity.value=Math.min(t,this.originFillOpacity),this.material.needsUpdate=!0}init(){return f(this,null,function*(){yield this.initGeometry(),this.initMaterial();let t=new Pt.Mesh(this.geometry,this.material);this.add(t),this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry())})}dispose(){var t,e,i;(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(i=this.lineGeometry)==null||i.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.originFillOpacity=1,e.length&&(this.originFillOpacity=e[0].fillOpacity,this.init())}};var vg=require("core-js/modules/es.array.push.js"),xg=require("core-js/modules/web.dom-collections.iterator.js");var B=require("three");var js={id:"",uuid:"",iconUrl:"",name:"",airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},opacity:1,visible:!0,centerCoords:[0,0],secondWidth:0,secondHeight:0,secondRotate:0},Ae=class extends B.Object3D{init(){return f(this,null,function*(){let t=this.options.reduce((s,o)=>{let{iconUrl:n}=o;return s.has(n)||s.set(n,[]),s.get(n).push(o),s},new Map),e=Array.from(t.values());(yield Promise.all(e.map(s=>f(this,null,function*(){let o=s[0].iconUrl,n=yield ct.getTextureByUrl(o);return new B.MeshBasicMaterial({map:n,transparent:!0,alphaTest:.2,side:B.FrontSide})})))).forEach((s,o)=>{let n=new B.InstancedMesh(this.geometry,s,e[o].length);e[o].forEach((r,h)=>{let c=new B.Matrix4().compose(new B.Vector3(r.centerCoords[0],r.centerCoords[1],r.deltaHeight+r.airHeight+r.height),new B.Quaternion().setFromAxisAngle(new B.Vector3(0,0,1),r.secondRotate),new B.Vector3(r.secondWidth,r.secondHeight,1));n.setMatrixAt(h,c)}),this.add(n)}),this.position.z+=.004})}setOpacity(t){this.children.forEach(e=>{e.material.opacity=t,e.material.needsUpdate=!0})}dispose(){I(this),this.clear()}constructor(t,e){super(),this.context=t,this.geometry=new B.ShapeGeometry(new B.Shape([new B.Vector2(-.5,-.5),new B.Vector2(-.5,.5),new B.Vector2(.5,.5),new B.Vector2(.5,-.5)])),this.options=e.map(s=>w({},js,s));let i=new B.Float32BufferAttribute([0,0,0,1,1,1,1,0],2);this.geometry.setAttribute("uv",i),this.init()}};var Ge=require("three");var Lh={url:"",geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},id:"",width:0,rotate:1,airHeight:1,deltaHeight:0,center_x:0,center_y:0},qo=class extends Ge.Object3D{loadModel(){return f(this,null,function*(){let t=yield St.loadModel(this.options.url);t.scene.updateMatrixWorld(),t.scene.rotation.set(Math.PI/2,0,0);let i=new Ge.Box3().setFromObject(t.scene).getSize(new Ge.Vector3),s=Math.max(i.x,i.y),o=this.options.width/s;this.scale.set(o,o,o),this.meshSetMaterial(t.scene),this.add(t.scene),this.position.set(this.options.center_x,this.options.center_y,0),this.position.z+=this.options.airHeight+this.options.deltaHeight,this.model=t,this.rotateZ(this.options.rotate),this.dispatchEvent({type:"load-model-end",object:t})})}meshSetMaterial(t){t instanceof Ge.Mesh&&(t.material.emissiveIntensity=.5,t.material.shininess=0,t.material.emissive=t.material.color,t.material.emissiveMap=t.material.map),t.children.forEach(i=>{this.meshSetMaterial(i)})}dispose(){I(this),this.model=null,this._listeners={}}constructor(t,e){super(),this.context=t,this.model=null,this.options=Object.assign({},Lh,e),this.loadModel()}};var Cg=require("core-js/modules/es.array.push.js"),Ct=require("three"),Hr=require("three/examples/jsm/utils/BufferGeometryUtils.js");var Nr=require("three/examples/jsm/lines/LineSegments2.js"),Zr=require("three/examples/jsm/lines/LineSegmentsGeometry.js");var es=class extends Ct.Object3D{initGeometry(){return f(this,null,function*(){this.geometry=yield te.GetMergedShapeGeometry(this.options)})}initMaterial(){let t=T.createMeshBasicMaterial({color:"#ffffff",opacity:1,vertexColors:!0});return this.material=t,t}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],i=T.createLineMaterial({color:t,opacity:e,vertexColors:!0});return this.lineMaterial=i,i}getBorderPoints(t){let{deltaHeight:e,geometry:i}=t,s=[],o=e||0,{coords:n}=i;for(let r=0;r<n.length;r++){let h=n[r];for(let c=0;c<h.length;c++){let l=h[c],p=c+1===h.length?h[0]:h[c+1];s.push(new Ct.Vector3(l[0],l[1],o)),s.push(new Ct.Vector3(p[0],p[1],o))}}return s}initDoubleLine(){let t=this.options.filter(e=>{var i,s;return e.double&&((s=e.geometry.otherCoords)==null||(i=s[1])==null?void 0:i.length)});t.length&&[!0,!1].forEach(e=>{let i=t.filter(c=>c.dashed===e);if(!i.length)return;let s=T.createLine2MaterialMap({color:"#ffffff",width:.2,dashed:e,resolution:new Ct.Vector2(this.context.clientSize.width,this.context.clientSize.height),vertexColors:!0}),o=[],n=[];i.forEach(c=>{let l=c.geometry.otherCoords[1],p=c.airHeight+(c.deltaHeight||0)+.01,d=new Ct.Color(c.secondColor);for(let u=0;u<l.length-1;u++){let m=l[u],v=l[u+1];o.push(m[0],m[1],p,v[0],v[1],p),n.push(d.r,d.g,d.b,d.r,d.g,d.b)}});let r=new Zr.LineSegmentsGeometry;r.setPositions(o),r.setColors(n);let h=new Nr.LineSegments2(r,s);h.computeLineDistances(),h.position.z+=.01,this.add(h),this.doubleLines.push(h)})}initLineGeometry(){let t=this.options.map(e=>{let i=this.getBorderPoints(e);return new Ct.BufferGeometry().setFromPoints(i)});this.lineGeometry=(0,Hr.mergeGeometries)(t)}createBorder(){let t=new Ct.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){return f(this,null,function*(){yield this.initGeometry(),this.initMaterial();let t=new Ct.Mesh(this.geometry,this.material);this.add(t),this.initDoubleLine(),this.position.z+=.02+(this.options[0].deltaHeight||0)})}dispose(){var t,e;(t=this.geometry)==null||t.dispose(),(e=this.lineGeometry)==null||e.dispose(),this.doubleLines.map(i=>i.geometry.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.doubleLines=[],e.length&&this.init()}};var Og=require("core-js/modules/es.array.push.js"),dt=require("three");var $o=class extends dt.Object3D{initMergedElement(){let t=new dt.ObjectLoader,e=t.parseGeometries([this.mergedElement.mergedGeometry]);if(this.geometry=e[this.mergedElement.mergedGeometry.uuid],this.initMaterial(),this.initMesh(),this.mesh.position.z=(this.mergedElement.deltaHeight||0)+this.mergedElement.airHeight,this.mergedElement.lineGeometry){let i=t.parseGeometries([this.mergedElement.lineGeometry]);this.lineGeometry=i[this.mergedElement.lineGeometry.uuid],this.initLineMaterial(),this.createBorder()}}init(){return f(this,null,function*(){this.geometry=yield this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options[0].deltaHeight+this.options[0].airHeight,this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())})}initGeometry(){return f(this,null,function*(){let t=yield te.GetMergeGeometry(this.options);return this.dispatchEvent({type:"init-geometry",geometry:t}),t})}initMaterial(){let t=`
|
|
476
476
|
varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
|
|
477
477
|
uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
|
|
478
478
|
uniform vec3 uColor;
|
|
@@ -498,14 +498,14 @@
|
|
|
498
498
|
gl_FragColor = vec4(uColor2, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
|
-
`,i=-1/0,s=this.geometry.getAttribute("position");if(s)for(let n=0;n<s.count;n++){let r=s.getZ(n);r>i&&(i=r)}let o=new dt.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new dt.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new dt.Color(le(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=T.createLineMaterial({color:this.options[0].strokeColor,opacity:this.options[0].strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new dt.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(i=>{let{coords:s}=i.geometry;for(let o=0;o<s.length;o++){let n=s[o];for(let r=0;r<n.length;r++){let h=n[r],c=r+1===n.length?n[0]:n[r+1];t.push(new dt.Vector3(h[0],h[1],e)),t.push(new dt.Vector3(c[0],c[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new dt.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new dt.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t,e;this.geometry?(this.geometry.dispose(),this._listeners={}):this.addEventListener("init-geometry",()=>{var i;(i=this.geometry)==null||i.dispose(),this._listeners={}}),(t=this.material)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e,i){super(),this.context=t,this.mergedElement=i,this.options=[],i?(this.options=[i],this.initMergedElement()):(this.options=e.map(s=>w({},ge,s)),this.init())}};var Fg=require("core-js/modules/web.dom-collections.iterator.js"),zg=require("core-js/modules/es.string.trim.js");var Ut=require("three"),Nr=require("three/examples/jsm/utils/BufferGeometryUtils.js");var Zr={airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},texts:[],fillColor:"#ffffff",fillOpacity:0,strokeColor:"#ffffff",strokeOpacity:0,secondHeight:0,secondRotate:0,center_x:0,center_y:0},ts=class extends Ut.Object3D{init(){return f(this,null,function*(){let t=yield Promise.all(this.options.map(n=>Q.getTextureByText(n.texts[0],{fillStyle:Ss(n.fillColor,n.fillOpacity),strokeStyle:Ss(n.strokeColor,n.strokeOpacity),lineWidth:2,font:"bold 28px sans-serif",maxWidth:2048}))),e=t.map((n,r)=>{let h=this.options[r],{width:c,height:l}=n.texture.image,p=c/l,d=h.secondHeight*p,u=new Ut.PlaneGeometry(d,h.secondHeight),m=new Ut.Matrix4().makeTranslation(h.center_x,h.center_y,h.airHeight+h.deltaHeight+h.height).multiply(new Ut.Matrix4().makeRotationZ(h.secondRotate));return u.applyMatrix4(m),u}),i=(0,Nr.mergeGeometries)(e,!0);e.forEach(n=>n.dispose());let s=t.map(n=>{let{texture:r}=n,h=new Ut.MeshBasicMaterial({map:r,alphaTest:.9,side:Ut.DoubleSide});return r.needsUpdate=!0,h}),o=new Ut.Mesh(i,s);this.mesh=o,this.position.z+=.04,this.add(o)})}setOpacity(t){var e,i;(i=this.mesh)==null||(e=i.material)==null||e.forEach(s=>{s.opacity=t,s.needsUpdate=!0})}dispose(){var t,e,i;(t=this.mesh)==null||t.geometry.dispose(),(i=this.mesh)==null||(e=i.material)==null||e.forEach(s=>s.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(i=>w({},Zr,i)).filter(i=>i.texts[0].trim()),this.options.length&&this.init()}};var jr=require("three"),Vr=require("three/examples/jsm/lines/Line2.js"),Kr=require("three/examples/jsm/lines/LineGeometry.js"),Xr=require("three/examples/jsm/lines/LineMaterial.js"),ai=class extends jr.Object3D{registryEvent(){this.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.context.removeEventListener("resize",this.onResize)}setPosition(t,e){this.lineGeometry.setPositions([t.x,t.y,t.z,e.x,e.y,e.z]),this.line||this.createLine()}createLine(){this.line=new Vr.Line2(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&I(this.line),this.lineGeometry=null,this.lineMaterial=null,this.clear(),(t=this.line)==null||t.clear(),this.line=null}constructor(t,e,i){super(),this.context=t,this.lineGeometry=new Kr.LineGeometry,this.lineMaterial=new Xr.LineMaterial({color:0,transparent:!0,depthTest:!1,linewidth:2}),this.line=null,this.onResize=()=>{let{width:s,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(s,o)},this.onResize(),this.registryEvent(),e&&i&&this.setPosition(e,i)}};var jg=require("core-js/modules/es.array.push.js"),Vg=require("core-js/modules/web.dom-collections.iterator.js"),Fe=require("three");var hi=require("three");var ji=class extends Fe.Object3D{loadModel(){return f(this,null,function*(){let t=yield St.loadModel(this.options[0].url);t.scene.updateMatrixWorld(!0);let e=t.scene.matrixWorld.clone().invert();t.scene.traverse(h=>{if(h.isMesh){let c=e.clone().multiply(h.matrixWorld),l=h.material;this.subMeshes.push({geometry:h.geometry,material:h.material,initialMatrix:c}),Array.isArray(l)?l.forEach(p=>{p.transparent=!0,this.materialOriginParams.set(p,{opacity:p.opacity})}):(l.transparent=!0,this.materialOriginParams.set(l,{opacity:l.opacity}))}});let i=this.subMeshes.map(h=>{let{geometry:c,material:l}=h;return new Fe.InstancedMesh(c,l,this.options.length)});t.scene.rotation.set(Math.PI/2,0,0);let o=new Fe.Box3().setFromObject(t.scene).getSize(new Fe.Vector3),n=Math.max(o.x,o.y);this.options.map(h=>{let c=new hi.Matrix4,l=h.width/n;return c.multiply(new hi.Matrix4().makeTranslation(h.center_x,h.center_y,h.airHeight+h.deltaHeight)).multiply(new hi.Matrix4().makeScale(l,l,l)).multiply(new hi.Matrix4().makeRotationZ(h.rotate)).multiply(new hi.Matrix4().makeRotationX(Math.PI/2)),h.url==="https://robot-vr-public.cdn.bcebos.com/ai-map-resource/757/1865371442288267264/smzsdrc.glb"&&console.log(h,c),c}).forEach((h,c)=>{i.forEach((l,p)=>{let d=h.clone().multiply(this.subMeshes[p].initialMatrix);l.setMatrixAt(c,d)})}),i.forEach(h=>{h.instanceMatrix.needsUpdate=!0,this.meshSetMaterial(h),this.add(h)})})}meshSetMaterial(t){t.isMesh&&(t.frustumCulled=!1,t.castShadow=!0,Array.isArray(t.material)?t.material.map(e=>{e.emissiveIntensity*=.95}):(t.material.emissiveIntensity*=.95,t.material.emissive=t.material.color,t.material.emissiveMap=t.material.map))}setOpacity(t,e){e===void 0&&(e=!1),this.subMeshes.forEach(i=>{let{material:s}=i;if(Array.isArray(s))s.forEach(o=>{if(e)o.opacity=t;else{let n=this.materialOriginParams.get(o)||{opacity:1};t>n.opacity?o.opacity=n.opacity:o.opacity=t}o.needsUpdate=!0});else{let o=this.materialOriginParams.get(s)||{opacity:1};t>o.opacity?s.opacity=o.opacity:s.opacity=t,s.needsUpdate=!0}}),this.children.forEach(i=>{i.instanceMatrix.needsUpdate=!0})}dispose(){this.children.forEach(t=>t.dispose()),I(this),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.subMeshes=[],this.materialOriginParams=new Map,this.loadModel()}};var ze=require("three");var ri=class extends ze.Object3D{init(){return f(this,null,function*(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.deltaHeight+this.options.airHeight,this.options.lineGeometry&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())})}initGeometry(){return this.loader.parseGeometries([this.options.mergedGeometry])[this.options.mergedGeometry.uuid]}initMaterial(){this.material=T.GetMergeAttributeGraphicMaterial()}initLineMaterial(){return this.lineMaterial=T.GetMergeAttributeGraphicLineMaterial()}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new ze.Mesh(this.geometry,this.material),this.add(this.mesh)}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.loader.parseGeometries([this.options.lineGeometry]);this.lineGeometry=t[this.options.lineGeometry.uuid]}createBorder(){this.line&&this.remove(this.line);let t=new ze.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t;this.geometry&&this.geometry.dispose(),(t=this.line)==null||t.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.loader=new ze.ObjectLoader,this.options=w({},ge,e),this.init()}};var ci=require("three");var es=class extends ci.Object3D{initGeometry(){return f(this,null,function*(){let t=new ci.ObjectLoader().parseGeometries([this.options.mergedGeometry]);this.geometry=t[this.options.mergedGeometry.uuid]})}init(){return f(this,null,function*(){var t;yield this.initGeometry();let e=new ci.Mesh(this.geometry,Lt.GetMergeAttributeWallMaterial());this.add(e);let i=(t=this.geometry)==null?void 0:t.getAttribute("opacity");i&&(this.originOpacities=Array.from(i.array))})}setOpacity(t,e){e===void 0&&(e=!1);var i;let s=(i=this.geometry)==null?void 0:i.getAttribute("opacity");if(s){for(let n=0;n<s.count;n++)if(e)s.setX(n,t);else{var o;s.setX(n,Math.min(t,(o=this.originOpacities[n])!=null?o:1))}s.needsUpdate=!0}}dispose(){var t;(t=this.geometry)==null||t.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.originOpacities=[],this.init()}};var ry=require("core-js/modules/es.typed-array.float32-array.js"),ay=require("core-js/modules/es.typed-array.at.js"),hy=require("core-js/modules/es.typed-array.fill.js"),cy=require("core-js/modules/es.typed-array.find-last.js"),ly=require("core-js/modules/es.typed-array.find-last-index.js"),py=require("core-js/modules/es.typed-array.set.js"),dy=require("core-js/modules/es.typed-array.sort.js"),uy=require("core-js/modules/es.typed-array.to-reversed.js"),my=require("core-js/modules/es.typed-array.to-sorted.js"),fy=require("core-js/modules/es.typed-array.with.js"),gy=require("core-js/modules/es.array-buffer.constructor.js"),yy=require("core-js/modules/es.array-buffer.slice.js"),vy=require("core-js/modules/es.array-buffer.detached.js"),xy=require("core-js/modules/es.array-buffer.transfer.js"),wy=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js");var ot=require("three");var Oe=class extends ot.Object3D{init(){return f(this,null,function*(){let t=this.options.iconUrl,e=yield ct.getTextureByUrl(t),i=new ot.MeshBasicMaterial({map:e,transparent:!0,alphaTest:.2,side:ot.FrontSide}),s=new ot.InstancedMesh(this.geometry,i,this.options.mergedMatrixes.size);s.instanceMatrix=new ot.InstancedBufferAttribute(new Float32Array(this.options.mergedMatrixes.array),16),this.add(s),this.mesh=s,this.position.z+=.004})}setOpacity(t){this.mesh&&(this.mesh.material.opacity=t,this.mesh.material.needsUpdate=!0,this.mesh.instanceMatrix.needsUpdate=!0)}dispose(){var t;this.mesh&&I(this.mesh),(t=this.mesh)==null||t.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.geometry=new ot.ShapeGeometry(new ot.Shape([new ot.Vector2(-.5,-.5),new ot.Vector2(-.5,.5),new ot.Vector2(.5,.5),new ot.Vector2(.5,-.5)])),this.options=w({},Ns,e);let i=new ot.Float32BufferAttribute([0,0,0,1,1,1,1,0],2);this.geometry.setAttribute("uv",i),this.init()}};var Ey=require("core-js/modules/es.array.push.js"),be=require("three");var qo=require("three/examples/jsm/lines/LineSegments2.js"),$o=require("three/examples/jsm/lines/LineSegmentsGeometry.js");var is=class extends be.Object3D{initGeometry(){return f(this,null,function*(){let t=this.loader.parseGeometries([this.options.mergedGeometry]);this.geometry=t[this.options.mergedGeometry.uuid]})}initMaterial(){let t=T.createMeshBasicMaterial({color:"#ffffff",opacity:1,vertexColors:!0});return this.material=t,t}initDoubleLine(){if(this.options.dashedLineGeometry){let t=T.createLine2MaterialMap({color:"#ffffff",width:.2,dashed:!0,resolution:new be.Vector2(this.context.clientSize.width,this.context.clientSize.height),vertexColors:!0});t.transparent=!0,t.needsUpdate=!0;let e=new $o.LineSegmentsGeometry;e.setPositions(this.options.dashedLineGeometry.positions),e.setColors(this.options.dashedLineGeometry.colors);let i=new qo.LineSegments2(e,t);i.computeLineDistances(),i.position.z+=.01,this.add(i),this.doubleLines.push(i)}if(this.options.lineGeometry){let t=T.createLine2MaterialMap({color:"#ffffff",width:.2,dashed:!1,resolution:new be.Vector2(this.context.clientSize.width,this.context.clientSize.height),vertexColors:!0}),e=new $o.LineSegmentsGeometry;e.setPositions(this.options.lineGeometry.positions),e.setColors(this.options.lineGeometry.colors);let i=new qo.LineSegments2(e,t);i.position.z+=.01,this.add(i),this.doubleLines.push(i)}}init(){return f(this,null,function*(){yield this.initGeometry(),this.initMaterial();let t=new be.Mesh(this.geometry,this.material);this.add(t),this.initDoubleLine(),this.position.z+=.02})}setOpacity(t){this.material.opacity=t,this.material.needsUpdate=!0,this.doubleLines.forEach(e=>{e.material.opacity=t,e.material.needsUpdate=!0})}dispose(){var t,e;(t=this.geometry)==null||t.dispose(),(e=this.lineGeometry)==null||e.dispose(),this.doubleLines.map(i=>i.geometry.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.doubleLines=[],this.loader=new be.ObjectLoader,this.init()}};var Dy=require("core-js/modules/es.typed-array.float32-array.js"),Ay=require("core-js/modules/es.typed-array.at.js"),Oy=require("core-js/modules/es.typed-array.fill.js"),Iy=require("core-js/modules/es.typed-array.find-last.js"),Ry=require("core-js/modules/es.typed-array.find-last-index.js"),Gy=require("core-js/modules/es.typed-array.set.js"),Fy=require("core-js/modules/es.typed-array.sort.js"),zy=require("core-js/modules/es.typed-array.to-reversed.js"),By=require("core-js/modules/es.typed-array.to-sorted.js"),Wy=require("core-js/modules/es.typed-array.with.js"),Uy=require("core-js/modules/es.array-buffer.constructor.js"),Hy=require("core-js/modules/es.array-buffer.slice.js"),Ny=require("core-js/modules/es.array-buffer.detached.js"),Zy=require("core-js/modules/es.array-buffer.transfer.js"),jy=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Vy=require("core-js/modules/web.dom-collections.iterator.js"),W=require("three");var ii=class extends W.Object3D{setColorByIndex(t,e){this.mesh&&(this.mesh.setColorAt(t,new W.Color(e).convertLinearToSRGB()),this.mesh.instanceColor.needsUpdate=!0)}init(){return f(this,null,function*(){this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options[0].deltaHeight+this.options[0].airHeight,this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())})}initMaterial(){this.material=T.GetInstancedGraphicMaterial()}initLineMaterial(){let t=T.GetMergeAttributeGraphicLineMaterial();this.lineMaterial=t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new W.InstancedMesh(this.geometry,this.material,this.options.length);let t=new W.InstancedBufferAttribute(new Float32Array(this.options.length),1),e=new W.InstancedBufferAttribute(new Float32Array(this.options.length),1);this.options.forEach((i,s)=>{let o=i.geometry.coords[0],[n,r,h]=o.slice(0,3),c=Math.sqrt((r[0]-n[0])**2+(r[1]-n[1])**2),l=Math.sqrt((h[0]-r[0])**2+(h[1]-r[1])**2),p=[c,l],d=Math.max(...p),u=Math.min(...p),m;d===c?m=[r[0]-n[0],r[1]-n[1]]:m=[h[0]-r[0],h[1]-r[1]];let[v,g]=m,x=Math.atan2(g,v)-Math.PI/2,M=new W.Matrix4().compose(new W.Vector3(i.center_coord_x,i.center_coord_y,(i.deltaHeight||0)+i.airHeight+i.height/2),new W.Quaternion().setFromAxisAngle(new W.Vector3(0,0,1),x),new W.Vector3(u,d,i.height));this.mesh.setMatrixAt(s,M),this.mesh.setColorAt(s,new W.Color(i.fillColor).convertLinearToSRGB());var P;t.array[s]=(P=i.fillOpacity)!=null?P:1;var C;e.array[s]=((C=i.deltaHeight)!=null?C:0)+i.airHeight+i.height}),this.originOpacity=[...t.array],this.geometry.setAttribute("opacity",t),this.geometry.setAttribute("maxZ",e),this.add(this.mesh),this.mesh.instanceMatrix.needsUpdate=!0}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let{points:t,colors:e,opacities:i}=ks(this.options),s=new W.BufferGeometry().setFromPoints(t);s.setAttribute("color",new W.BufferAttribute(new Float32Array(e),3)),s.setAttribute("opacity",new W.BufferAttribute(new Float32Array(i),1)),this.lineOriginOpacity=[...i],this.lineGeometry=s}createBorder(){this.line&&this.remove(this.line);let t=new W.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}setOpacity(t,e){e===void 0&&(e=!1);let i=this.geometry.getAttribute("opacity");for(let n=0;n<i.count;n++)if(e)i.array[n]=t;else{var s;i.array[n]=Math.min(t,(s=this.originOpacity[n])!=null?s:1)}if(i.needsUpdate=!0,this.lineGeometry){let n=this.lineGeometry.getAttribute("opacity");for(let r=0;r<n.count;r++)if(e)n.array[r]=t;else{var o;n.array[r]=Math.min(t,(o=this.lineOriginOpacity[r])!=null?o:1)}n.needsUpdate=!0}}dispose(){var t,e;this.geometry.dispose(),(t=this.mesh)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.geometry=new W.BoxGeometry(1,1,1),this.options=[],this.originOpacity=[],this.lineOriginOpacity=[],this.options=e.map(i=>w({},ge,i)),this.init()}};var Jy=require("core-js/modules/es.typed-array.float32-array.js"),Qy=require("core-js/modules/es.typed-array.at.js"),tv=require("core-js/modules/es.typed-array.fill.js"),ev=require("core-js/modules/es.typed-array.find-last.js"),iv=require("core-js/modules/es.typed-array.find-last-index.js"),sv=require("core-js/modules/es.typed-array.set.js"),ov=require("core-js/modules/es.typed-array.sort.js"),nv=require("core-js/modules/es.typed-array.to-reversed.js"),rv=require("core-js/modules/es.typed-array.to-sorted.js"),av=require("core-js/modules/es.typed-array.with.js"),hv=require("core-js/modules/es.array-buffer.constructor.js"),cv=require("core-js/modules/es.array-buffer.slice.js"),lv=require("core-js/modules/es.array-buffer.detached.js"),pv=require("core-js/modules/es.array-buffer.transfer.js"),dv=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),uv=require("core-js/modules/web.dom-collections.iterator.js"),$t=require("three");var Xe=class extends $t.Object3D{init(){return f(this,null,function*(){this.initMaterial(),this.initMesh()})}initMaterial(){this.material=T.GetInstancedGraphicMaterial()}initMesh(){if(this.mesh&&this.remove(this.mesh),!this.elements)return;this.mesh=new $t.InstancedMesh(this.geometry,this.material,this.elements.size);let t=new $t.InstancedBufferAttribute(new Float32Array(this.elements.opacities),1),e=new $t.InstancedBufferAttribute(new Float32Array(this.elements.maxZs),1);this.originOpacities=[...t.array],this.geometry.setAttribute("opacity",t),this.geometry.setAttribute("maxZ",e),this.mesh.instanceMatrix.set(this.elements.matrixes),this.mesh.instanceColor=new $t.InstancedBufferAttribute(new Float32Array(this.elements.colors),3),this.add(this.mesh),this.mesh.instanceMatrix.needsUpdate=!0}setColorByIndex(t,e){this.mesh&&(this.mesh.setColorAt(t,new $t.Color(e).convertLinearToSRGB()),this.mesh.instanceColor.needsUpdate=!0)}setOpacityByIndex(t,e){if(this.mesh){let i=this.geometry.getAttribute("opacity");i.setX(t,e),i.needsUpdate=!0}}setMatrixByIndex(t,e){this.mesh&&(this.mesh.setMatrixAt(t,e),this.mesh.instanceMatrix.needsUpdate=!0)}setMaxZByIndex(t,e){if(this.mesh){let i=this.geometry.getAttribute("maxZ");i.setX(t,e),i.needsUpdate=!0}}setColorById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setColorByIndex(i,e)}setOpacityById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setOpacityByIndex(i,e)}setMatrixById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setMatrixByIndex(i,e)}setMaxZById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setMaxZByIndex(i,e)}setOpacity(t,e){if(e===void 0&&(e=!1),!this.geometry)return;let i=this.geometry.getAttribute("opacity");for(let o=0;o<i.count;o++)if(e)i.array[o]=t;else{var s;i.array[o]=Math.min(t,(s=this.originOpacities[o])!=null?s:1)}i.needsUpdate=!0}pushElements(t){this.elements?(this.elements.size+=t.size,this.elements.colors=[...this.elements.colors,...t.colors],this.elements.matrixes=[...this.elements.matrixes,...t.matrixes],this.elements.opacities=[...this.elements.opacities,...t.opacities],this.elements.maxZs=[...this.elements.maxZs,...t.maxZs],this.elements.ids=[...this.elements.ids,...t.ids],this.originOpacities=[...this.originOpacities,...t.opacities]):this.elements=t,this.refesh()}removeInstanceById(t){if(this.elements){if(this.mesh){let e=this.elements.ids.indexOf(t);e!==-1&&(this.elements.size--,this.elements.colors.splice(e*3,3),this.elements.matrixes.splice(e*16,16),this.elements.opacities.splice(e,1),this.elements.maxZs.splice(e,1),this.elements.ids.splice(e,1),this.originOpacities.splice(e,1))}this.refesh()}}refesh(){this.mesh&&(this.mesh.dispose(),this.remove(this.mesh)),this.init()}dispose(){var t;this.material=null,this.originOpacities.length=0,this.geometry.dispose(),(t=this.mesh)==null||t.dispose(),this.clear()}constructor(t,e){super(),this.geometry=new $t.BoxGeometry(1,1,1),this.material=null,this.elements=null,this.originOpacities=[],this.elements=e,this.init()}};var yv=require("core-js/modules/es.typed-array.float32-array.js"),vv=require("core-js/modules/es.typed-array.at.js"),xv=require("core-js/modules/es.typed-array.fill.js"),wv=require("core-js/modules/es.typed-array.find-last.js"),Mv=require("core-js/modules/es.typed-array.find-last-index.js"),_v=require("core-js/modules/es.typed-array.set.js"),Pv=require("core-js/modules/es.typed-array.sort.js"),bv=require("core-js/modules/es.typed-array.to-reversed.js"),Sv=require("core-js/modules/es.typed-array.to-sorted.js"),Ev=require("core-js/modules/es.typed-array.with.js"),Lv=require("core-js/modules/es.array-buffer.constructor.js"),Cv=require("core-js/modules/es.array-buffer.slice.js"),Tv=require("core-js/modules/es.array-buffer.detached.js"),kv=require("core-js/modules/es.array-buffer.transfer.js"),Dv=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Av=require("core-js/modules/web.dom-collections.iterator.js"),oe=require("three");var ss=class extends oe.Object3D{init(){return f(this,null,function*(){this.initMaterial(),this.initMesh()})}initMaterial(){this.material=T.GetInstancedWallMaterial()}initMesh(){if(this.mesh&&this.remove(this.mesh),!this.elements)return;this.mesh=new oe.InstancedMesh(this.geometry,this.material,this.elements.size);let t=new oe.InstancedBufferAttribute(new Float32Array(this.elements.opacities),1),e=new oe.InstancedBufferAttribute(new Float32Array(this.elements.maxZs),1),i=new oe.InstancedBufferAttribute(new Float32Array(this.elements.minZs),1);this.originOpacities=[...t.array],this.geometry.setAttribute("opacity",t),this.geometry.setAttribute("maxZ",e),this.geometry.setAttribute("minZ",i),this.mesh.instanceMatrix.set(this.elements.matrixes),this.mesh.instanceColor=new oe.InstancedBufferAttribute(new Float32Array(this.elements.colors),3),this.add(this.mesh),this.mesh.instanceMatrix.needsUpdate=!0}setOpacityByIndex(t,e){if(this.mesh){let i=this.geometry.getAttribute("opacity");i.setX(t,e),i.needsUpdate=!0}}setOpacity(t,e){e===void 0&&(e=!1),this.elements&&this.elements.opacities.forEach((i,s)=>{let o=e?t:Math.min(t,this.originOpacities[s]);this.setOpacityByIndex(s,o)})}dispose(){this.mesh&&(this.mesh.dispose(),this.remove(this.mesh)),this.material=null,this.geometry&&this.geometry.dispose(),this.elements=null}constructor(t,e){super(),this.geometry=new oe.BoxGeometry(1,1,1),this.material=null,this.elements=null,this.originOpacities=[],this.elements=e,this.init()}};var li=require("three");var Ie=class extends li.Object3D{init(){return f(this,null,function*(){this.initLineGeometry(),this.initLineMaterial(),this.createBorder()})}initLineMaterial(){return this.lineMaterial=T.GetMergeAttributeGraphicLineMaterial()}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.loader.parseGeometries([this.options]);this.lineGeometry=t[this.options.uuid]}createBorder(){this.line&&this.remove(this.line);let t=new li.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t;(t=this.lineGeometry)==null||t.dispose(),this.lineMaterial=null,this.clear()}constructor(t,e){super(),this.context=t,this.lineMaterial=null,this.loader=new li.ObjectLoader,this.options=w({},ge,e),this.init()}};var Yr=require("three"),Zs=class extends Wt{setEnable(t){super.setEnable(t),bt(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:i,clientHeight:s}}}=this,o=D(this.startPoint,e,i,s),n=D(this.endPoint,e,i,s),r={x:Math.min(o.x,n.x),y:Math.min(o.y,n.y)},h={x:Math.max(o.x,n.x),y:Math.max(o.y,n.y)},c=this.searchMapInFrustum(r,h);this.dispatchEvent({type:"selected",list:c})}}searchMapInFrustum(t,e){var i;let{context:s}=this;return((i=s.currentFloor)==null?void 0:i.graphicLayer.children.filter(o=>o instanceof lt&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,i){let{context:{camera:s,container:{clientWidth:o,clientHeight:n}}}=this;if(!t)return!1;if(!t.mesh){let d=t.getPosition();if(d){let u=D(d,s,o,n);return Me(u,e,i)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let r=t.mesh.geometry.boundingBox;if(!r)return!1;let{min:h,max:c}=r,l=D(h,s,o,n),p=D(c,s,o,n);return!(!Me(l,e,i)||!Me(p,e,i))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new Yr.Frustum,this.onPointerDown=s=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(s);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=s=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(s);o&&(this.endPoint=o)},this.onPointerUp=s=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(s);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let s=this.getSvgCoordinate(this.startPoint),o=w({},s);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let n={x:Math.min(s.x,o.x),y:Math.min(s.y,o.y)},r=Math.abs(o.x-s.x),h=Math.abs(o.y-s.y);bt(this.rect,n.x,n.y,r,h)}else bt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:i}}}=t;this.rect=_e(i,e),this.svg.appendChild(this.rect),this.registryEvent()}};var os=class extends qr.EventDispatcher{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.context.config.enableBoxSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}constructor(t){super(),this.context=t,this._list=new Set,this.downPoint=null,this.downTime=0,this.isMultipleSelect=!1,this.onPointerDown=e=>{Date.now()-this.downTime<200||(this.downPoint={x:e.offsetX,y:e.offsetY},this.downTime=Date.now())},this.onPointerUp=e=>{if(!this.downPoint)return;let{offsetX:i,offsetY:s}=e,{x:o,y:n}=this.downPoint;if(Math.sqrt((o-i)**2+(n-s)**2)>3)return;let{graphics:r}=this.context.getGraphicsByDeviceXy(i,s),h=new Set(r.map(l=>l.options.id));this.context.getPoisByDeviceXy(i,s).forEach(l=>{if(!h.has(l.options.id)){var p;let d=((p=this.context.currentFloor)==null?void 0:p.graphicLayer.graphicMap.get(l.options.id))||null;d&&d.options.geometry.type==="point"&&(r.push(d),h.add(l.options.id))}}),(He?e.metaKey:e.ctrlKey)||this._list.clear(),r.forEach(l=>this._list.add(l)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{Ne(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Ne(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:i}=e;this._list.clear(),i.forEach(s=>{this._list.add(s)}),this.selectEnd()},this.boxSelection=new Zs(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var sx=require("core-js/modules/es.set.difference.v2.js"),ox=require("core-js/modules/es.set.intersection.v2.js"),nx=require("core-js/modules/es.set.is-disjoint-from.v2.js"),rx=require("core-js/modules/es.set.is-subset-of.v2.js"),ax=require("core-js/modules/es.set.is-superset-of.v2.js"),hx=require("core-js/modules/es.set.symmetric-difference.v2.js"),cx=require("core-js/modules/es.set.union.v2.js"),lx=require("core-js/modules/web.dom-collections.iterator.js");var js=require("three");var ns=class extends js.EventDispatcher{handleHoverGraphicsChange(t){t===void 0&&(t=this.curGraphics),this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}constructor(t){super(),this.context=t,this.curGraphics=new Set,this.timer=new j,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:i,pois:s,e:o}=e,n=s.map(l=>{var p;return(p=this.context.currentFloor)==null?void 0:p.graphicLayer.graphicMap.get(l.options.id)}).filter(l=>l&&l.options.geometry.type==="point");if(!i.length&&!n.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:r}=this.context.config.hover,h=new Set;if(n.length){let l,p=1e4;n.forEach(d=>{let u=s.find(m=>m.options.id===d.options.id);if(u instanceof De){let{x:m,y:v}=u.clientPos,g=Math.sqrt((m-o.offsetX)**2+(v-o.offsetY)**2);g<p&&(p=g,l=d)}else if(u instanceof tt){let{x:m,y:v}=u.box.getCenter(new js.Vector2),g=Math.sqrt((m-o.offsetX)**2+(v-o.offsetY)**2);g<p&&(p=g,l=d)}}),h.add(l)}h.size||i.forEach(l=>h.add(l)),h.forEach(l=>{if(this.graphicTimerMap.get(l)||this.curGraphics.has(l))return;let p=this.timer.setTimeout(()=>{this.curGraphics.add(l),this.graphicTimerMap.delete(l),this.timer.clearTimeout(p),this.handleHoverGraphicsChange()},r);this.graphicTimerMap.set(l,p)}),this.graphicTimerMap.forEach((l,p)=>{h.has(p)||(this.timer.clearTimeout(l),this.graphicTimerMap.delete(p))});let c=this.curGraphics.size;this.curGraphics.forEach(l=>{h.has(l)||this.curGraphics.delete(l)}),c!==this.curGraphics.size&&this.handleHoverGraphicsChange()},this.onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()},this.onBodyPointerMove=e=>{if(this.curGraphics.size){let i=this.context.container.getBoundingClientRect();(e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom)&&this.onPointerLevel()}},this.registryEvent()}};var mx=require("core-js/modules/web.dom-collections.iterator.js"),Ht=require("three");var rs=require("@turf/turf"),Vs=class{updateBox(){this.box.setFromObject(this.context.scene)}setEnable(t){this.enable=t,t?this.registryEvent():this.unRegistryEvent()}changePrevCamera(){this.prevCamera={position:this.context.camera.position.clone(),zoom:this.context.camera.zoom,target:this.context.control.target.clone()}}backToPrevCamera(){this.setEnable(!1),this.context.camera.position.copy(this.prevCamera.position),this.context.camera.zoom=this.prevCamera.zoom,this.context.control.target.copy(this.prevCamera.target),this.context.control.update(),this.setEnable(!0)}registryEvent(){this.context.addEventListener("control-change",this.onCameraChange)}unRegistryEvent(){this.context.removeEventListener("control-change",this.onCameraChange)}getCurFloorScreenPosition(){if(!this.context.scene.children.filter(m=>m instanceof se).length)return null;let e=this.box,{camera:i,clientSize:{width:s,height:o}}=this.context,{min:n,max:r}=e,c=[new Ht.Vector3(n.x,n.y,n.z),new Ht.Vector3(r.x,n.y,n.z),new Ht.Vector3(n.x,r.y,n.z),new Ht.Vector3(r.x,r.y,n.z),new Ht.Vector3(n.x,n.y,r.z),new Ht.Vector3(r.x,n.y,r.z),new Ht.Vector3(n.x,r.y,r.z),new Ht.Vector3(r.x,r.y,r.z)].map(m=>D(m,i,s,o)),l=Math.min(...c.map(m=>m.x)),p=Math.max(...c.map(m=>m.x)),d=Math.min(...c.map(m=>m.y)),u=Math.max(...c.map(m=>m.y));return{left:l,right:p,top:d,bottom:u}}checkDistanceToScreenEdge(t){let{left:e,right:i,top:s,bottom:o}=t,{width:n,height:r}=this.context.clientSize,[h,c,l,p]=this.context.config.cameraBound.padding,d=(0,rs.polygon)([[[e,s],[i,s],[i,o],[e,o],[e,s]]]),u=(0,rs.polygon)([[[p,h],[n-c,h],[n-c,r-l],[p,r-l],[p,h]]]);try{return(0,rs.intersect)(d,u)!==null}catch(m){return console.warn("\u8BA1\u7B97\u4EA4\u96C6\u51FA\u9519:",m),!1}}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new Ht.Vector3,zoom:1,target:new Ht.Vector3},this.enable=!0,this.box=new Ht.Box3,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:i,right:s,top:o,bottom:n}=e;if([i,s,o,n].every(h=>!h))return;this.checkDistanceToScreenEdge({left:i,right:s,top:o,bottom:n})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var Mx=require("core-js/modules/es.promise.finally.js"),Jo=require("three"),Ye=require("@tweenjs/tween.js");var vx=require("core-js/modules/web.dom-collections.iterator.js"),xx=require("core-js/modules/es.array.push.js"),b=require("three"),Ks=new b.Ray,$r=new b.Plane,Sh=Math.cos(70*b.MathUtils.DEG2RAD),Xs=class extends b.EventDispatcher{dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerUp),this.domElement.removeEventListener("wheel",this.onMouseWheel),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp),this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null)}constructor(t,e){super(),this.rotateLineStart=new b.Vector2,this.rotateLineEnd=new b.Vector2,this.spherical=new b.Spherical,this.sphericalDelta=new b.Spherical,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new b.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.screenSpacePanning=!1,this.mouseButtons={LEFT:b.MOUSE.PAN,MIDDLE:b.MOUSE.DOLLY,RIGHT:b.MOUSE.ROTATE},this.touches={ONE:b.TOUCH.PAN,TWO:b.TOUCH.DOLLY_ROTATE},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return r.phi},this.getAzimuthalAngle=function(){return r.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(y){y.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=y},this.stopListenToKeyEvents=function(){var y;(y=this._domElementKeyEvents)==null||y.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent({type:"change"}),i.update(),o=s.NONE},this.update=function(){let y=new b.Vector3,_=new b.Quaternion().setFromUnitVectors(t.up,new b.Vector3(0,1,0)),N=_.clone().invert(),it=new b.Vector3,Rt=new b.Quaternion,he=new b.Vector3,Qt=2*Math.PI;return function(_i){_i===void 0&&(_i=null);let ve=i.object.position;y.copy(ve).sub(i.target),y.applyQuaternion(_),r.setFromVector3(y),i.autoRotate&&o===s.NONE&&It(Tt(_i)),i.enableDamping?(r.theta+=h.theta*i.dampingFactor,r.phi+=h.phi*i.dampingFactor):(r.theta+=h.theta,r.phi+=h.phi);let xe=i.minAzimuthAngle,we=i.maxAzimuthAngle;isFinite(xe)&&isFinite(we)&&(xe<-Math.PI?xe+=Qt:xe>Math.PI&&(xe-=Qt),we<-Math.PI?we+=Qt:we>Math.PI&&(we-=Qt),xe<=we?r.theta=Math.max(xe,Math.min(we,r.theta)):r.theta=r.theta>(xe+we)/2?Math.max(xe,r.theta):Math.min(we,r.theta)),r.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,r.phi)),r.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(l,i.dampingFactor):i.target.add(l),i.zoomToCursor&&G||i.object.isOrthographicCamera?r.radius=H(r.radius):r.radius=H(r.radius*c),y.setFromSpherical(r),y.applyQuaternion(N),ve.copy(i.target).add(y),i.object.lookAt(i.target),i.enableDamping===!0?(h.theta*=1-i.dampingFactor,h.phi*=1-i.dampingFactor,l.multiplyScalar(1-i.dampingFactor)):(h.set(0,0,0),l.set(0,0,0));let _s=!1;if(i.zoomToCursor&&G){let Pi=null;if(i.object.isPerspectiveCamera){let bi=y.length();Pi=H(bi*c);let Ps=bi-Pi;i.object.position.addScaledVector(C,Ps),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){let bi=new b.Vector3(S.x,S.y,0);bi.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),_s=!0;let Ps=new b.Vector3(S.x,S.y,0);Ps.unproject(i.object),i.object.position.sub(Ps).add(bi),i.object.updateMatrixWorld(),Pi=y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;Pi!==null&&(i.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(Pi).add(i.object.position):(Ks.origin.copy(i.object.position),Ks.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(Ks.direction))<Sh?t.lookAt(i.target):($r.setFromNormalAndCoplanarPoint(i.object.up,i.target),Ks.intersectPlane($r,i.target))))}else i.object.isOrthographicCamera&&(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),_s=!0);return c=1,G=!1,_s||it.distanceToSquared(i.object.position)>n||8*(1-Rt.dot(i.object.quaternion))>n||he.distanceToSquared(i.target)>0?(i.dispatchEvent({type:"change"}),it.copy(i.object.position),Rt.copy(i.object.quaternion),he.copy(i.target),_s=!1,!0):!1}}();let i=this,s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=s.NONE,n=1e-6,r=new b.Spherical,h=new b.Spherical,c=1,l=new b.Vector3,p=new b.Vector2,d=new b.Vector2,u=new b.Vector2,m=new b.Vector2,v=new b.Vector2,g=new b.Vector2,x=new b.Vector2,M=new b.Vector2,P=new b.Vector2,C=new b.Vector3,S=new b.Vector2,G=!1,E=[],nt={};function Tt(y){return y!==null?2*Math.PI/60*i.autoRotateSpeed*y:2*Math.PI/60/60*i.autoRotateSpeed}function gt(){return Math.pow(.95,i.zoomSpeed)}function It(y){h.theta-=y}function kt(y){h.phi-=y}let ne=function(){let y=new b.Vector3;return function(N,it){y.setFromMatrixColumn(it,0),y.multiplyScalar(-N),l.add(y)}}(),Ee=function(){let y=new b.Vector3;return function(N,it){i.screenSpacePanning===!0?y.setFromMatrixColumn(it,1):(y.setFromMatrixColumn(it,0),y.crossVectors(i.object.up,y)),y.multiplyScalar(N),l.add(y)}}(),ht=function(){let y=new b.Vector3;return function(N,it){let Rt=i.domElement;if(i.object.isPerspectiveCamera){let he=i.object.position;y.copy(he).sub(i.target);let Qt=y.length();Qt*=Math.tan(i.object.fov/2*Math.PI/180),ne(2*N*Qt/Rt.clientHeight,i.object.matrix),Ee(2*it*Qt/Rt.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(ne(N*(i.object.right-i.object.left)/i.object.zoom/Rt.clientWidth,i.object.matrix),Ee(it*(i.object.top-i.object.bottom)/i.object.zoom/Rt.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function $e(y){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c/=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function wi(y){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c*=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function U(y){if(!i.zoomToCursor)return;G=!0;let _=i.domElement.getBoundingClientRect(),N=y.clientX-_.left,it=y.clientY-_.top,Rt=_.width,he=_.height;S.x=N/Rt*2-1,S.y=-(it/he)*2+1,C.set(S.x,S.y,1).unproject(i.object).sub(i.object.position).normalize()}function H(y){return Math.max(i.minDistance,Math.min(i.maxDistance,y))}function et(y){p.set(y.clientX,y.clientY)}function J(y){U(y),x.set(y.clientX,y.clientY)}function re(y){m.set(y.clientX,y.clientY)}function ae(y){d.set(y.clientX,y.clientY),u.subVectors(d,p).multiplyScalar(i.rotateSpeed);let _=i.domElement;It(2*Math.PI*u.x/_.clientHeight),kt(2*Math.PI*u.y/_.clientHeight),p.copy(d),i.update()}function Le(y){M.set(y.clientX,y.clientY),P.subVectors(M,x),P.y>0?$e(gt()):P.y<0&&wi(gt()),x.copy(M),i.update()}function ye(y){v.set(y.clientX,y.clientY),g.subVectors(v,m).multiplyScalar(i.panSpeed),ht(g.x,g.y),m.copy(v),i.update()}function Mi(y){U(y),y.deltaY<0?wi(gt()):y.deltaY>0&&$e(gt()),i.update()}function Pa(y){let _=!1;switch(y.code){case i.keys.UP:y.ctrlKey||y.metaKey||y.shiftKey?kt(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(0,i.keyPanSpeed),_=!0;break;case i.keys.BOTTOM:y.ctrlKey||y.metaKey||y.shiftKey?kt(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(0,-i.keyPanSpeed),_=!0;break;case i.keys.LEFT:y.ctrlKey||y.metaKey||y.shiftKey?It(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(i.keyPanSpeed,0),_=!0;break;case i.keys.RIGHT:y.ctrlKey||y.metaKey||y.shiftKey?It(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(-i.keyPanSpeed,0),_=!0;break}_&&(y.preventDefault(),i.update())}function Tn(){if(E.length===1)p.set(E[0].pageX,E[0].pageY);else{let y=(E[0].pageX-E[0].pageY)/(E[1].pageX-E[1].pageY),_=E[0].pageY-y*E[0].pageX;i.rotateLineStart.set(y,_);let N=.5*(E[0].pageX+E[1].pageX),it=.5*(E[0].pageY+E[1].pageY);p.set(N,it)}}function kn(){if(E.length===1)m.set(E[0].pageX,E[0].pageY);else{let y=.5*(E[0].pageX+E[1].pageX),_=.5*(E[0].pageY+E[1].pageY);m.set(y,_)}}function Dn(){let y=E[0].pageX-E[1].pageX,_=E[0].pageY-E[1].pageY,N=Math.sqrt(y*y+_*_);x.set(0,N)}function ba(){i.enableZoom&&Dn(),i.enablePan&&kn()}function Sa(){i.enableZoom&&Dn(),i.enableRotate&&Tn()}function An(y){if(E.length==1)d.set(y.pageX,y.pageY);else{let N=fo(y),it=.5*(y.pageX+N.x),Rt=.5*(y.pageY+N.y);d.set(it,Rt);let he=(y.pageY-N.y)/(y.pageX-N.x),Qt=N.y-he*N.x;if(i.rotateLineEnd.set(he,Qt),Number.isFinite(i.rotateLineEnd.x)&&Number.isFinite(i.rotateLineStart.x)){let go=(i.rotateLineStart.y-i.rotateLineEnd.y)/(i.rotateLineEnd.x-i.rotateLineStart.x),_i=he*go+Qt;if(Number.isFinite(go)&&Number.isFinite(_i)){let ve=Math.atan(i.rotateLineEnd.x)-Math.atan(i.rotateLineStart.x);Math.PI-Math.abs(ve)<.5&&(ve=-Math.sign(ve)*(Math.PI-Math.abs(ve))),Math.abs(ve)<.1&&(h.theta+=ve)}}i.rotateLineStart.copy(i.rotateLineEnd)}u.subVectors(d,p).multiplyScalar(i.rotateSpeed);let _=i.domElement;kt(2*Math.PI*u.y/_.clientHeight),p.copy(d)}function On(y){if(E.length===1)v.set(y.pageX,y.pageY);else{let _=fo(y),N=.5*(y.pageX+_.x),it=.5*(y.pageY+_.y);v.set(N,it)}g.subVectors(v,m).multiplyScalar(i.panSpeed),ht(g.x,g.y),m.copy(v)}function In(y){let _=fo(y),N=y.pageX-_.x,it=y.pageY-_.y,Rt=Math.sqrt(N*N+it*it);M.set(0,Rt),P.set(0,Math.pow(M.y/x.y,i.zoomSpeed)),$e(P.y),x.copy(M)}function Ea(y){i.enableZoom&&In(y),i.enablePan&&On(y)}function La(y){i.enableZoom&&In(y),i.enableRotate&&An(y)}this.onPointerDown=function(_){i.enabled!==!1&&(E.length===0&&(i.domElement.setPointerCapture(_.pointerId),i.domElement.addEventListener("pointermove",i.onPointerMove),i.domElement.addEventListener("pointerup",i.onPointerUp)),Aa(_),_.pointerType==="touch"?ka(_):Ca(_))},this.onPointerMove=function(_){i.enabled!==!1&&(_.pointerType==="touch"?Da(_):Ta(_))},this.onPointerUp=function(_){Oa(_),E.length===0&&(i.domElement.releasePointerCapture(_.pointerId),i.domElement.removeEventListener("pointermove",i.onPointerMove),i.domElement.removeEventListener("pointerup",i.onPointerUp)),i.dispatchEvent({type:"end"}),o=s.NONE};function Ca(y){let _;switch(y.button){case 0:_=i.mouseButtons.LEFT;break;case 1:_=i.mouseButtons.MIDDLE;break;case 2:_=i.mouseButtons.RIGHT;break;default:_=-1}switch(_){case b.MOUSE.DOLLY:if(i.enableZoom===!1)return;J(y),o=s.DOLLY;break;case b.MOUSE.ROTATE:if(y.ctrlKey||y.metaKey||y.shiftKey){if(i.enablePan===!1)return;re(y),o=s.PAN}else{if(i.enableRotate===!1)return;et(y),o=s.ROTATE}break;case b.MOUSE.PAN:if(y.ctrlKey||y.metaKey||y.shiftKey){if(i.enableRotate===!1)return;et(y),o=s.ROTATE}else{if(i.enablePan===!1)return;re(y),o=s.PAN}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent({type:"start"})}function Ta(y){switch(o){case s.ROTATE:if(i.enableRotate===!1)return;ae(y);break;case s.DOLLY:if(i.enableZoom===!1)return;Le(y);break;case s.PAN:if(i.enablePan===!1)return;ye(y);break}}this.onMouseWheel=function(_){i.enabled===!1||i.enableZoom===!1||o!==s.NONE||(_.preventDefault(),i.dispatchEvent({type:"start"}),Mi(_),i.dispatchEvent({type:"end"}))},this.onKeyDown=function(_){i.enabled===!1||i.enablePan===!1||Pa(_)};function ka(y){switch(Rn(y),E.length){case 1:switch(i.touches.ONE){case b.TOUCH.ROTATE:if(i.enableRotate===!1)return;Tn(),o=s.TOUCH_ROTATE;break;case b.TOUCH.PAN:if(i.enablePan===!1)return;kn(),o=s.TOUCH_PAN;break;default:o=s.NONE}break;case 2:switch(i.touches.TWO){case b.TOUCH.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;ba(),o=s.TOUCH_DOLLY_PAN;break;case b.TOUCH.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Sa(),o=s.TOUCH_DOLLY_ROTATE;break;default:o=s.NONE}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent({type:"start"})}function Da(y){switch(Rn(y),o){case s.TOUCH_ROTATE:if(i.enableRotate===!1)return;An(y),i.update();break;case s.TOUCH_PAN:if(i.enablePan===!1)return;On(y),i.update();break;case s.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Ea(y),i.update();break;case s.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;La(y),i.update();break;default:o=s.NONE}}this.onContextMenu=function(_){i.enabled!==!1&&_.preventDefault()};function Aa(y){E.push(y)}function Oa(y){delete nt[y.pointerId];for(let _=0;_<E.length;_++)if(E[_].pointerId==y.pointerId){E.splice(_,1);return}}function Rn(y){let _=nt[y.pointerId];_===void 0&&(_=new b.Vector2,nt[y.pointerId]=_),_.set(y.pageX,y.pageY)}function fo(y){let _=y.pointerId===E[0].pointerId?E[1]:E[0];return nt[_.pointerId]}i.domElement.addEventListener("contextmenu",this.onContextMenu),i.domElement.addEventListener("pointerdown",this.onPointerDown),i.domElement.addEventListener("pointercancel",this.onPointerUp),i.domElement.addEventListener("wheel",this.onMouseWheel,{passive:!1}),this.update()}};var as=class extends Xs{registryEvent(){this.addEventListener("change",this.onChange),this.context.addEventListener("update",this.tweenUpdate)}unRegistryEvent(){this.removeEventListener("change",this.onChange),this.context.removeEventListener("update",this.tweenUpdate)}setPolarAngle(t,e){e===void 0&&(e=!1);let{maxPolarAngle:i,minPolarAngle:s}=this,o=i===s;(e||t<=i&&t>=s)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=i,this.minPolarAngle=s)}setPolarAngleByDuration(t,e,i){return f(this,null,function*(){return e===void 0&&(e=!1),i===void 0&&(i=500),i<=0?this.setPolarAngle(t,e):Ft(new Promise(s=>{let o={polar:this.getPolarAngle()},n={polar:t},r=new Ye.Tween(o,this.tweenGroup).to(n,i).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(r),s(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:i,minAzimuthAngle:s}=this,o=i===s;(e||t<=i&&t>=s)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=i,this.minAzimuthAngle=s)}setAzimuthalAngleDuration(t,e,i){return e===void 0&&(e=!1),i===void 0&&(i=500),i<=0?this.setAzimuthalAngle(t,e):Ft(new Promise(s=>{let o={azimuthal:this.getAzimuthalAngle()},n={azimuthal:t},r=new Ye.Tween(o,this.tweenGroup).to(n,i).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(r),s(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500)}getCameraLookAt(){return new Jo.Vector3().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return f(this,null,function*(){let i=this.target.clone(),s=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(s)),this.target.copy(t.clone()),this.update();return}return Ft(new Promise(o=>{let n=new Ye.Tween(i,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(i.clone().sub(s)),this.target.copy(i.clone()),this.update()}).onComplete(()=>{this.tweenGroup.remove(n),this.enabled=!0,o(!0)}).onStart(()=>{this.enabled=!1}).start()}),e+500)})}setZoom(t,e,i){i===void 0&&(i=!1);let{minZoom:s,maxZoom:o}=this;(i||t>=s&&t<=o)&&(this.camera.position.copy(e.clone().sub(this.getCameraLookAt())),this.target.copy(e),this.camera.zoom=t,this.update())}setZoomByDuration(t,e,i,s){return f(this,null,function*(){i===void 0&&(i=!1),s===void 0&&(s=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return s?Ft(new Promise(n=>{let r=new Ye.Tween(o,this.tweenGroup).to({zoom:t,target:e},s).onUpdate(()=>{this.setZoom(o.zoom,o.target,i)}).onComplete(()=>{this.tweenGroup.remove(r),this.enabled=!0,n(!0)}).onStart(()=>{this.enabled=!1}).start()}),s+500).finally(()=>{this.enabled=!0}):this.setZoom(t,e,i)})}setTargetByOffset(t,e){if(e===void 0&&(e=this.target.clone()),this.camera.updateMatrix(),t){let i=new Jo.Vector3;i.setFromMatrixColumn(this.camera.matrix,1),i.normalize(),i.multiplyScalar(t/this.camera.zoom),e.add(i)}this.setCameraPositionByTarget(e,0)}clearTween(){this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll()}dispose(){super.dispose(),this.unRegistryEvent(),this.clearTween()}constructor(t,e,i){super(e,i),this.context=t,this.camera=e,this.domElement=i,this.prevCameraZoom=1,this.tweenGroup=new Ye.Group,this.offsetY=0,this.onChange=()=>{let s=this.camera.zoom;s!==this.prevCameraZoom&&(this.prevCameraZoom=s,this.dispatchEvent({type:"change-zoom",zoom:s}))},this.tweenUpdate=()=>{this.tweenGroup.update()},this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=e.zoom,this.registryEvent()}};var pi=require("three");var hs=class extends pi.WebGLRenderer{setCameraAndScene(t,e){this.scene=t,this.camera=e}autoRender(){if(this.scene&&this.camera&&this.enable&&(this.event.dispatchEvent({type:"update"}),this.render(this.scene,this.camera)),this.context.config.renderAnimation==="requestAnimationFrame")this.timer.requestAnimationFrame(()=>{this.autoRender()});else{let t=1e3/this.context.config.fps;this.timer.setTimeout(()=>{this.autoRender()},t)}}pauseRender(){this.enable=!1}continueRender(){this.enable=!0}addEventListener(t,e){this.event.addEventListener(t,e)}removeEventListener(t,e){this.event.removeEventListener(t,e)}constructor(t,e){super(w({antialias:!0,alpha:!0},e)),this.context=t,this.event=new pi.EventDispatcher,this.enable=!0,this.timer=new j,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.toneMapping=pi.LinearToneMapping,this.toneMappingExposure=1;let i=this.dispose;this.dispose=()=>{this.timer.dispose(),this.enable=!1,i.call(this),this.domElement.remove(),this.domElement=null,this.shadowMap=null,this.info.programs&&(this.info.programs.length=0),this.info=null}}};var ea=require("three");var Jr=require("three"),Qr=require("three/examples/jsm/environments/RoomEnvironment.js");function ta(a,t){t===void 0&&(t=.85);let e=new Jr.PMREMGenerator(a);return e.compileEquirectangularShader(),e.fromScene(new Qr.RoomEnvironment).texture}var cs=class extends ea.Scene{dispose(){var t;(t=this.environment)==null||t.dispose(),this.environment=null,I(this),this.clear()}constructor(t){super(),this.environment=ta(t)}};var ia=require("three"),ls=class extends ia.OrthographicCamera{constructor(t,e){super(-t/2,t/2,e/2,-e/2,-1e4,5e4),this.up.set(0,0,1),this.position.set(0,0,100),this.lookAt(0,0,0)}};var Qo=require("@turf/turf");var Ix=require("core-js/modules/es.array.unshift.js"),Rx=require("core-js/modules/es.array.push.js"),sa=require("three"),Ys=class{registryEvent(){this.context.addEventListener("update",this.onUpdate),this.context.addEventListener("control-change",this.onControlChange),this.context.addEventListener("resize",this.onControlChange)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate),this.context.removeEventListener("control-change",this.onControlChange),this.context.removeEventListener("resize",this.onControlChange)}changePoiLevelOrCollisionEnable(t){let e=this.objects.findIndex(i=>i===t);e!==-1&&(this.objects.splice(e,1),this.addObject(t))}addObject(t){if(!this.objects.includes(t)){if(this.needsUpdate=!0,!t.options.collision_enable){this.objects.unshift(t);return}if(t.options.level===0){this.objects.push(t);return}for(let e=0;e<this.objects.length;e++){let i=this.objects[e];if(i.options.collision_enable&&i.options.level<=t.options.level){this.objects.splice(e,0,t);return}}this.objects.push(t)}}removeObject(t){let e=this.objects.indexOf(t);e!==-1&&(this.objects.splice(e,1),this.needsUpdate=!0)}removeObjects(t){this.objects=this.objects.filter(e=>!t.includes(e)),this.needsUpdate=!0}getObjectById(t){return this.objects.find(e=>e.options.id===t)||null}validShowParkingSpace(t){t===void 0&&(t=60);let{clientSize:{width:e,height:i},control:s,camera:o}=this.context,n=Math.min(e/t,i/t,s.maxZoom-1);return o.zoom>=n}detectCollisions(){if(!this.needsUpdate)return;let t=[],{camera:e}=this.context;e.updateMatrixWorld();let i=l=>l<=1&&l>=-1,s=e.projectionMatrix.clone();s.multiply(e.matrixWorldInverse);let o=e.zoom/this.context.basicZoom,n=25/30,r=Math.min(25,Math.max(1,o*n)),h=this.validShowParkingSpace();this.objects.filter(l=>{if(l.visible){if(!(r<=l.options.maxWeight&&r>=l.options.minWeight)||!h&&l.userData.type==="parkingSpace")return l.parentSetVisible(!1),!1;let p=l.getWorldPosition(new sa.Vector3);return p.applyMatrix4(s),l.screenPosition=p,i(p.x)&&i(p.y)&&i(p.z)?!0:(l.parentSetVisible(!1),!1)}return!1}).forEach((l,p)=>{let d=l.getBox(l.screenPosition);if(d===null){l.parentSetVisible(!1);return}if(p===0||!l.options.collision_enable){t.push(d),l.parentSetVisible(!0);return}let u=t.some(m=>m.intersectsBox(d));l.parentSetVisible(!u),u||t.push(d)}),this.needsUpdate=!1}markForUpdate(){this.needsUpdate=!0}clear(){this.objects=[],this.needsUpdate=!0}dispose(){this.objects=[],this.unRegistryEvent()}constructor(t){this.context=t,this.objects=[],this.needsUpdate=!0,this.onUpdate=()=>{this.detectCollisions()},this.onControlChange=()=>{this.needsUpdate=!0},this.registryEvent()}};var ps=class extends z.EventDispatcher{get config(){return this.bmap.config}get center(){return this.bmap.buildingCenter}setRange(t){this.range=(0,Qo.polygon)([t])}resizeClientSize(){let{x:t,y:e,width:i,height:s}=this.container.getBoundingClientRect();this.clientSize={width:i||this.container.clientWidth,height:s||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new ls(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new as(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 Vs(this)}getRatio(t,e){t===void 0&&(t=new z.Vector3(0,0,0)),e===void 0&&(e=new z.Vector3(100,0,0));let{clientWidth:i,clientHeight:s}=this.container,o=D(t,this.camera,i,s),n=D(e,this.camera,i,s);return Math.ceil(Math.sqrt((n.x-o.x)**2+(n.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof z.AmbientLight&&(e.color=new z.Color(t))})}switchFloor(t,e){e===void 0&&(e=!0),console.log("switchFloor",e),this.currentFloor&&(this.scene.remove(this.currentFloor),e?this.currentFloor.dispose():this.currentFloor.onRemoveFromScene()),this.currentFloor=t,this.setRange(t.userData.range||[]),this.scene.add(t),t.onAddToScene("scene"),this.cameraBound.updateBox()}getGraphicsByDeviceXy(t,e){var i;let s=new z.Vector2;s.x=t/this.clientSize.width*2-1,s.y=e/this.clientSize.height*-2+1;let o=new z.Raycaster;return o.setFromCamera(s,this.camera),o.ray.origin.sub(o.ray.direction.clone().multiplyScalar(100)),((i=this.currentFloor)==null?void 0:i.graphicLayer.getGraphicByRaycaster(o))||{graphics:[],position:null}}getPoisByDeviceXy(t,e){var i,s;let o=(i=this.currentFloor)==null?void 0:i.poiLayer.getPoiByDeviceXy(t,e),n=(s=this.currentFloor)==null?void 0:s.poiLayer2.getPoiByDeviceXy(t,e);return(o||[]).concat(n||[])}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,i){return i===void 0&&(i=500),this.control.setZoomByDuration(t,e,!0,i)}getFitCameraToObjectZoom(t,e,i){return e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=!0),this.getFitCameraToBoxZoom(new z.Box3().setFromObject(t),e,i)}getFitCameraToBoxZoom(t,e,i){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=!0);let[s,o,n,r]=e,{clientSize:{width:h,height:c}}=this,l=this.control.getPolarAngle();i&&this.setPolarAngle(0,0),this.setPolarAngle(l,0),this.camera.updateMatrixWorld(),this.camera.updateProjectionMatrix();let{max:p,min:d}=t,u=new z.Vector3(d.x,p.y,p.z),m=new z.Vector3(p.x,p.y,p.z),v=new z.Vector3(p.x,d.y,d.z),g=new z.Vector3(d.x,d.y,d.z),x=D(u,this.camera,h,c),M=D(m,this.camera,h,c),P=D(g,this.camera,h,c),C=D(v,this.camera,h,c),G=new z.Box2().setFromPoints([new z.Vector2(x.x,x.y),new z.Vector2(M.x,M.y),new z.Vector2(P.x,P.y),new z.Vector2(C.x,C.y)]).getSize(new z.Vector2),E=(h-o-r)/G.x,nt=(c-s-n)/G.y,Tt=Math.min(E,nt),gt=new z.Vector3((p.x+d.x)/2,(p.y+d.y)/2,(p.z+d.z)/2),It=Tt*this.camera.zoom,kt=this.camera.clone();kt.zoom=It,kt.updateMatrix();let ne=(o-r)/2,Ee=(s-n)/2;if(ne){let ht=new z.Vector3;ht.setFromMatrixColumn(kt.matrix,0),ht.normalize(),ht.multiplyScalar(ne/It),gt.add(ht)}if(Ee){let ht=new z.Vector3;ht.setFromMatrixColumn(kt.matrix,1),ht.normalize(),ht.multiplyScalar(Ee/It),gt.add(ht)}return{zoom:Tt*this.camera.zoom,center:gt}}fitCameraToObject(t,e,i,s){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500),s===void 0&&(s=!0);let{zoom:o,center:n}=this.getFitCameraToObjectZoom(t,e,s);return this.setZoom(o,n,i)}fitCameraToBox(t,e,i,s){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500),s===void 0&&(s=!0);let{zoom:o,center:n}=this.getFitCameraToBoxZoom(t,e,s);return this.setZoom(o,n,i)}getFitCameraToGroundZoom(t,e,i){if(t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),i===void 0&&(i=!0),this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,i).zoom}fitCameraToGround(t,e,i){return t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),i===void 0&&(i=!0),this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundLayer,t,e,i):Promise.resolve(!1)}setCameraPosition(t,e){return f(this,null,function*(){return this.control.setCameraPositionByTarget(t,e)})}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}forceUpdate(){this.collisionSystem.needsUpdate=!0}dispose(){var t;this.collisionSystem.dispose(),(t=this.currentFloor)==null||t.dispose(),this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.dispose(),this.lights.children.forEach(e=>e.dispose()),this.scene.dispose(),this.container=null,this.renderer=null}constructor(t,e){super(),this.container=t,this.lights=xo(),this.range=(0,Qo.polygon)([]),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=i=>{let{zoom:s}=i;this.dispatchEvent({type:"control-zoom-change",zoom:s})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:i,camera:s,renderer:o}=this,{clientWidth:n,clientHeight:r}=i;n=Math.max(1,n),r=Math.max(1,r),s.left=-n/2,s.right=n/2,s.top=r/2,s.bottom=-r/2,s.updateProjectionMatrix(),o.setSize(n,r),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:n,height:r})},this.onClick=i=>{let{graphics:s,position:o}=this.getGraphicsByDeviceXy(i.offsetX,i.offsetY);s.length&&this.dispatchEvent({type:"graphic-click",graphics:s,position:o});let n=this.getPoisByDeviceXy(i.offsetX,i.offsetY);n.length&&this.dispatchEvent({type:"poi-click",pois:n})},this.onPointerover=i=>{let{graphics:s,position:o}=this.getGraphicsByDeviceXy(i.offsetX,i.offsetY),n=this.getPoisByDeviceXy(i.offsetX,i.offsetY);this.dispatchEvent({type:"pointer-over",e:i,graphics:s,pois:n,position:o})},this.onPointermove=i=>{let{graphics:s,position:o}=this.getGraphicsByDeviceXy(i.offsetX,i.offsetY),n=this.getPoisByDeviceXy(i.offsetX,i.offsetY);this.dispatchEvent({type:"pointer-move",e:i,graphics:s,pois:n,position:o})},this.onPointerleave=i=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=i=>{let{graphics:s,isMultipleSelect:o}=i;this.dispatchEvent({type:"select-graphic",graphics:s,isMultipleSelect:o})},this.onHoverChange=i=>{let{graphics:s}=i;this.dispatchEvent({type:"hover",graphics:s})},this.bmap=e,this.container.style.position="relative",this.container.style.overflow="hidden",this.renderer=new hs(this),this.scene=new cs(this.renderer),this.collisionSystem=new Ys(this),this.init(),this.selection=new os(this),this.hoverHelper=new ns(this),this.resizeClientSize(),this.registryEvent()}};var oa=require("lodash"),na={placeId:0,fps:30,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:{enable:!1,debounceTime:5},initTransToMark:!1,heatMap:{radius:50,minOpacity:.1,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0,maxZoomScale:30},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},renderAnimation:"setTimeout"};function tn(a){return typeof a.resizeObserver=="boolean"&&(a.resizeObserver={enable:a.resizeObserver}),(0,oa.merge)({},na,a)}var ca=require("lodash");var h0=require("core-js/modules/web.dom-collections.iterator.js");var Js=require("three");var t0=require("core-js/modules/es.array.push.js"),e0=require("core-js/modules/web.dom-collections.iterator.js");var qx=require("core-js/modules/es.array.sort.js");var di=function(a){return a.LAYERED_RENDER_VERSION="layeredRender",a.MERGED_RENDER_VERSION="mergedRender",a}({});function qs(a,t){let e=a.poi_info.showName||a.store_name||a.poi_info.text;switch(t){case"zh-cn":return e;case"en":var i;return((i=a.store_info_ext)==null?void 0:i.poi_name)||e;case"zh-hk":var s;return((s=a.store_info_ext)==null?void 0:s.traditional_name)||e}}function $s(a,t){let e=a.poi_info.showName||a.store_name||a.poi_info.text;switch(t){case"zh-cn":return e;case"en":var i;return((i=a.infra_info_ext)==null?void 0:i.poi_name)||e;case"zh-hk":var s;return((s=a.infra_info_ext)==null?void 0:s.traditional_name)||e}}var en=["range","ground","store","facility","parkingSpace"];function ra(a){return en.indexOf(a.l_type)===-1?en.length:en.indexOf(a.l_type)}function Eh(a){a.layers.sort((t,e)=>ra(t)-ra(e))}function Lh(a){let t=a.layers.find(i=>i.l_type==="range"),e=[t.elements[0].center_x,t.elements[0].center_y];a.layers.map(i=>{if(i.l_type!=="range")return Ai(i.elements,e)})}function ds(a){Eh(a),Lh(a)}function ui(a,t){return t===void 0&&(t=6),a.floor_id+"_"+a.version_id+(t?"_"+t:"")}function aa(a,t,e){switch(a.l_type){case"ground":return sn(a,t);case"graph":return Ch(a,t,e);case"wall":return Th(a,t);case"lane":return kh(a,t);case"texture2d":case"texture3d":return Dh(a,t);case"glb":return Ah(a,t);case"store":return Oh(a,t,e);case"facility":return Rh(a,t,e);case"parkingSpace":return Fh(a,t,e);case"text":return Bh(a,t)}}function ha(a,t,e,i,s){switch(a.l_type){case"store":return Ih(a,t,e,i,s);case"facility":return Gh(a,t,e,i,s);case"parkingSpace":return zh(a,t,i,s)}}function Ch(a,t,e){e.mergeGraphic?t.mergeGraphicLayer.addGraphics(a.elements,a.mergedElements):a.elements.map(i=>{let s=t.addGraphic(w({},i,{dashed:!1}));t.userData.graphics.push(s),t.userData.graphicMap.set(i.id,s)})}function sn(a,t){let e=a.elements.map(i=>new lt(t.context,w({},i,{dashed:!1})));t.addGrounds(e)}function Th(a,t){if(a.mergedElements)a.mergedElements.map(e=>{if(e.instancedGeometry){let i=new ss(t.context,e.instancedGeometry);t.wallLayer.add(i)}if(e.mergedGeometry){let i=new es(t.context,e);t.wallLayer.add(i)}});else{let e=a.elements.reduce((i,s)=>{let{fillColor:o,fillOpacity:n,strokeColor:r,strokeOpacity:h,height:c}=s,l=o.toLowerCase()+"-"+n+"-"+r.toLowerCase()+"-"+h+"-"+c;return h===0&&(l=o.toLowerCase()+"-"+n+"-"+c),i[l]?i[l].push(s):i[l]=[s],i},{});Object.values(e).forEach(i=>{let s=new Ji(t.context,i);t.wallLayer.add(s)})}}function kh(a,t){if(a.mergedElements){let e=new is(t.context,a.mergedElements);t.laneLayer.add(e)}else{let e=new Qi(t.context,a.elements);t.laneLayer.add(e)}}function Dh(a,t){if(a.mergedMatrixes)a.mergedMatrixes.map(e=>{let i=new Oe(t.context,e);t.textureLayer.add(i)});else if(a.elements.length){let e=new Ae(t.context,a.elements);t.textureLayer.add(e)}}function Ah(a,t){t.glbModelLayer.addModels(a.elements.map(e=>w({},e,{url:e.secondUrl,rotate:e.secondRotate,width:e.secondWidth,center_x:e.center_coord_x,center_y:e.center_coord_y,deltaHeight:0})))}function Oh(a,t,e){e.mergeGraphic?t.mergeGraphicLayer.addGraphics(a.elements,a.mergedElements):a.elements.map(i=>{let s=t.addGraphic(w({},i,{dashed:!1}));t.userData.graphics.push(s),t.userData.graphicMap.set(i.id,s)})}function Ih(a,t,e,i,s){a.elements.filter(o=>s.filterPoi(o)).map(o=>{try{let n=qs(o,e),r=new tt(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:n,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:!i.showStoreName,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1,text_font_size:i.textFontSize});t.poiLayer2.pushPoi(r),r&&(r.userData.type="store",r.userData.data=o,r.userData.floor=t.name)}catch(n){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",n,o)}})}function Rh(a,t,e){e.mergeGraphic?t.mergeGraphicLayer.addGraphics(a.elements,a.mergedElements):a.elements.map(i=>{let s=t.addGraphic(w({},i,{dashed:!1}));t.userData.graphics.push(s),t.userData.graphicMap.set(i.id,s)})}function Gh(a,t,e,i,s){a.elements.filter(o=>o.poi_info).filter(o=>s.filterPoi(o)).map(o=>{try{let n=$s(o,e),r=new tt(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:n,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:!i.showFacilityName,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1,text_font_size:i.textFontSize});t.poiLayer2.pushPoi(r),r.userData.type="facility",r.userData.data=o,r.userData.floor=t.name}catch(n){console.log("\u6DFB\u52A0facility\u5931\u8D25",n,o)}})}function Fh(a,t,e){t.parkingSpaceLayer.load(a,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function zh(a,t,e,i){return f(this,null,function*(){a.elements.filter(o=>o.texts[0]).filter(o=>i.filterPoi(o)).forEach(o=>{try{let n=o.displayName||o.texts[0],r=new tt(t.context,{id:o.id,text:n,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},text_font_size:e.textFontSize});r&&(r.userData.type="parkingSpace",r.userData.data=o,r.userData.floor=t.name),t.poiLayer2.pushPoi(r)}catch(n){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",n,o)}})})}function Bh(a,t){let e=new ts(t.context,a.elements.map(i=>w({},i,{center_x:i.center_coord_x,center_y:i.center_coord_y})));t.textTextureLayer.add(e)}var Wh={};function on(){return new Worker(new URL("./worker/loader.worker-XI4MI7KE.js",Wh.url))}var Uh={mergeParkingSpace:!0,mergeGraphic:!0,renderVersion:di.MERGED_RENDER_VERSION,layers:["graph","wall","lane","texture2d","texture3d","glb","store","facility","parkingSpace","text"],filterPoi:()=>!0},qe=class extends st{initDb(){return f(this,null,function*(){try{let{db:t}=yield Ds();this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return f(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=w({},this.placeConfig,e));else if(typeof t=="string"){let i=yield fetch(t).then(s=>s.json());i.code===200&&(this.floors=i.data.list,this.placeConfig=w({},this.placeConfig,JSON.parse(i.data.config||"{}"),e))}else return this.load("https://screen.aibee.cn/ai-map/map/get-floor-map?place_id="+t,e);this.getOtherDataByFreeTime()})}setCacheData(t,e,i){return f(this,null,function*(){return this.initDbPromise.then(()=>Gi(t,""+e,i))})}getCacheData(t,e){return f(this,null,function*(){return this.initDbPromise.then(()=>ei(t,""+e))})}getFloorData(t){return f(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return f(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=qs(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=$s(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return f(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(i=>f(this,null,function*(){let s=ui(t),o=yield fetch(t.map_url).then(n=>n.json());o.floor=t.floor,ds(o),this.setCacheData(xt.MAP_DATA,s,o),this.setCacheData(xt.MAP_VERSION,s,t.version_id),i(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return f(this,null,function*(){let e=this.floors.find(i=>i.floor===t);return e?new Promise(i=>f(this,null,function*(){let s=ui(e,this.options.renderVersion===di.LAYERED_RENDER_VERSION?1:void 0);try{let o=ui(e),n=yield this.getCacheData(xt.MAP_DATA,o);if(n&&n.transformed){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u5408\u5E76\u540E\u7684\u6570\u636E"),i(n);return}if(this.options.renderVersion===di.LAYERED_RENDER_VERSION){let r=yield this.getCacheData(xt.MAP_DATA,s);if(r){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u6570\u636E"),i(r);return}}if(console.log("\u7F13\u5B58\u4E2D\u6CA1\u6709\u6570\u636E"),this.loadWorker){Z(this.loadWorker,"adjust_floor_priority",{floor:t});let r=h=>{if(h.data.type==="floor_success"&&h.data.data.floor===t){var c;(c=this.loadWorker)==null||c.removeEventListener("message",r),i(this.getFloorJsonData(t))}};this.loadWorker.addEventListener("message",r)}else i(this.getFloorJsonDataByFloorInfo(e))}catch(o){console.log("[get floor data error]",o),i(this.getFloorJsonDataByFloorInfo(e))}})):null})}getRoadNetworkData(){return f(this,null,function*(){return(yield Promise.all(this.floors.map(e=>f(this,null,function*(){let i=ui(e,0);try{let s=yield this.getCacheData(xt.ROAD_NETWORK_DATA,i);if(s)return s;let o=yield fetch(e.route_url).then(n=>n.json());return this.setCacheData(xt.ROAD_NETWORK_DATA,i,o),this.setCacheData(xt.ROUTE_VERSION,i,e.version_id),o}catch(s){let o=yield fetch(e.route_url).then(n=>n.json());return this.setCacheData(xt.ROAD_NETWORK_DATA,i,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return f(this,null,function*(){let t=this.floors.reduce((s,o)=>s.updated_at>o.updated_at?s:o,this.floors[0]);if(!t)return null;let e=ui(t,0),i=()=>f(this,null,function*(){let s=yield fetch(t.entry_infra_url).then(o=>o.json());return s&&(this.setCacheData(xt.FACILITY_DATA,e,s),this.setCacheData(xt.FACILITY_VERSION,e,t.version_id)),s});try{let s=yield this.getCacheData(xt.FACILITY_DATA,e);return s||i()}catch(s){return console.log("[get facility error]",s),i()}})}getOtherDataByFreeTime(){return f(this,null,function*(){yield this.initDbPromise,this.loadWorker&&(yield Z(this.loadWorker,"load",{floors:this.floors,version:this.options.renderVersion})),this.closeWorker()})}getMulFloorsData(t){return f(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(i=>i))})}getDataByUrl(t){return f(this,null,function*(){let e=yield fetch(t).then(i=>i.json());return this.getDataByJson(e)})}getDataByJson(t,e,i){return f(this,null,function*(){ds(t),e=this.getFloorBaseLayer(t,e);let s=w({},this.placeConfig,i);return yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,s),this.changeFloorBox(t,e),e})}getDataByJsonStep(t,e,i){return f(this,null,function*(){ds(t),e=this.getFloorBaseLayer(t,e);let s=w({},this.placeConfig,i);return this.changeFloorBox(t,e),requestAnimationFrame(()=>f(this,null,function*(){yield this.getFloorContentLayer(t,e),this.changeFloorBox(t,e),requestAnimationFrame(()=>f(this,null,function*(){yield this.getFloorPoi(t,e,s),this.changeFloorBox(t,e)}))})),e})}changeFloorBox(t,e){e.updateBox();let i=e.box.getSize(new Js.Vector3),s=Math.max(i.x,i.y,i.z);e.userData.height=s/4+t.floorHeight}switchFloor(t,e){return f(this,null,function*(){return new Promise(i=>{let s={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(s),n=r=>{let{task:h,res:c}=r;h.tid===o&&(this.taskQueue.removeEventListener("active-task-end",n),i(c))};this.taskQueue.addEventListener("active-task-end",n)})})}_switchFloor(t,e){return f(this,null,function*(){var i;let s=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)s=l;else return null}else ds(t);let o=w({},this.placeConfig,e),n=new se(this.bmap.context);n.userData.data=t;let r=this.floors.find(l=>l.floor===s.floor);var h;let c=(h=r==null?void 0:r.map_angle)!=null?h:0;return this.bmap.dispatchEvent({type:yt.SWITCH_FLOOR_BEFORE,data:{curFloor:n,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:n,graphics:[],floorData:s}}),this.bmap.context.scene.background=new Js.Color(o.backgroundColor),this.getFloorBaseLayer(s,n),this.changeFloorBox(s,n),this.bmap.buildingCenter=n.userData.center,this.bmap.currentBuildGround=(i=n.userData.data.layers.find(l=>l.l_type==="range"))==null?void 0:i.elements[0],this.bmap.context.switchFloor(n),this.bmap.config.control.defaultAzimuthal=c/180*Math.PI,this.bmap.initialFloorCamera(),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:n,graphics:[]}}),this.bmap.dispatchEvent({type:yt.SWITCH_FLOOR_GROUND,data:{curFloor:n}}),yield bs(),yield this.getFloorContentLayer(s,n),this.changeFloorBox(s,n),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:n,graphics:[]}}),yield So(2),yield this.getFloorPoi(s,n,o),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:n,graphics:n.graphicLayer.children}}),this.bmap.dispatchEvent({type:yt.SWITCH_FLOOR_AFTER,data:{curFloor:n,graphics:n.graphicLayer.children}}),n})}getFloorBaseLayer(t,e){e||(e=new se(this.bmap.context));let i=[0,0];return t.layers.forEach(s=>{switch(s.l_type){case"range":let o=s.elements[0];i=[o.center_x,o.center_y],e.userData.range=o.geometry.cds[0],e.userData.rangeGraphic=o;break;case"ground":sn(s,e);break;default:break}}),e.userData.center=i,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return f(this,null,function*(){e||(e=new se(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let i=Date.now();for(let s=0;s<t.layers.length;s++){let o=t.layers[s];["range","ground"].includes(o.l_type)||this.options.layers.includes(o.l_type)&&(aa(o,e,this.options),console.log("time",Date.now()-i,o.l_type),i=Date.now())}return e})}getFloorPoi(t,e,i){return f(this,null,function*(){i===void 0&&(i=this.placeConfig);let s=Date.now();yield Promise.all(t.layers.map(n=>{if(this.options.layers.includes(n.l_type))return ha(n,e,this.locale,i,this.options)})),console.log("poi time",Date.now()-s);let o=Date.now();bs().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return f(this,null,function*(){yr(),this.db=null})}closeWorker(){this.loadWorker&&(this.loadWorker.terminate(),this.loadWorker=null)}dispose(){super.dispose(),this.clear(),this.closeWorker(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new Ve,this.loadWorker=on(),this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=w({},Uh,e),this.placeConfig=w({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var M0=require("core-js/modules/web.dom-collections.iterator.js");function nn(a,t){return f(this,null,function*(){let{brand:e,project:i}=a,{apiDomain:s,apiPath:{floorRange:o},apiInfo:n}=t,r=""+s+o+"?brand="+e+"&project="+i+"&phase="+i+"&building="+i;return yield fetch(r,n).then(c=>c.json()).then(c=>c.data).then(c=>{let l=(c||[])[0];return l&&(l.info=JSON.parse(l.info)),l})})}function rn(a,t){return f(this,null,function*(){let{brand:e,project:i,floor:s,ts:o,resource_type_list:n}=a,{apiDomain:r,apiPath:{floorGraphic:h},apiInfo:c}=t,l=""+r+h+"?brand="+e+"&project="+i+"&phase="+i+"&building="+i+"&floor="+s+"&ts="+o+"&resource_type_list="+n;return yield fetch(l,c).then(d=>d.json()).then(d=>d.data).then(d=>((d||[]).map(u=>u.info=JSON.parse(u.info)),d||[]))})}function Hh(a,t){return f(this,null,function*(){let{project:e,floor:i}=a,{apiDomain:s,apiInfo:o}=t,n=s+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+i;return yield fetch(n,o).then(h=>h.json()).then(h=>h.data).then(h=>JSON.parse(h[0].streetInfo||"{}")).then(h=>h.fileId?Nh(h.fileId,t):null)})}function Nh(a,t){return f(this,null,function*(){let{apiDomain:e,apiInfo:i}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+a,i).then(s=>s.arrayBuffer()).then(s=>{let n=new TextDecoder("utf-8").decode(s);return n?JSON.parse(n):null})})}var an=class{load(t){return f(this,null,function*(){let e=Te(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,i]=yield Promise.all([this.loadBuildGround(t),rn(t,this.bmap.config)]),s=Te({floor:t.floor,ts:t.ts});Ai(i.map(n=>n.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(s)||0),i.forEach(n=>n.info.transformToBuildingGround=!1),this.cacheData.set(e,i);let o=this.floorDataLengthMap.get(s)||0;return this.floorDataLengthMap.set(s,o+i.length),this.loadExternalStreet(t),i})}loadExternalStreet(t){return f(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let i=e.userData.legacyToGraphicMap||new Map,s=e.userData.graphicMap||new Map,{ground:o,markGraphic:n,graphic:r}=this.bmap.config;for(let h=0;h<t.length;h++){let c=t[h],l=w({},c,{info:w({},c.info)});if(c.info.group==="ground"){l.info.fillColor=o.color,l.info.fillOpacity=o.opacity,l.info.height=o.height,l.info.stroke=o.stroke,l.info.strokeColor=o.strokeColor,l.info.strokeOpacity=o.strokeOpacity,e.createGround(l.info);continue}else c.info.userData.mark?(l.info.height=n.height,l.info.fillColor=n.color,l.info.fillOpacity=n.opacity,l.info.stroke=n.stroke,l.info.strokeColor=n.strokeColor,l.info.strokeOpacity=n.strokeOpacity):(l.info.fillOpacity=r.fillOpacity,this.bmap.config.initTransToMark&&(l.info.height=n.height,l.info.fillColor=n.color,l.info.stroke=n.stroke,l.info.strokeColor=n.strokeColor,l.info.strokeOpacity=n.strokeOpacity));let p=e.addGraphic(l.info);p.userData.data=c,i.set(c.legacy_id,p),s.set(c.element_uuid,c)}e.userData.legacyToGraphicMap=i,e.userData.graphicMap=s,e.userData.rangeGraphic=this.bmap.currentBuildGround,e.userData.range=this.bmap.currentBuildGround.geometry.cds[0],e.userData.center=this.bmap.buildingCenter,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(yt.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(yt.SWITCH_FLOOR_AFTER,{curFloor:e,graphics:e.graphicLayer.children})):this.bmap.switchFloorByFloor(e)}filterData(t,e){let i=e.userData.graphicMap||new Map;return t.filter(s=>!i.has(s.element_uuid))}switchFloorByStoreData(t,e){return f(this,null,function*(){let i=yield this.load(w({},t,{resource_type_list:"6"})),s=this.filterData(i,e);this.switchFloorByData(s,e)})}switchFloorByOtherData(t,e){return f(this,null,function*(){let i=yield this.load(w({},t,{resource_type_list:"1,2,3,4"})),s=this.filterData(i,e);this.switchFloorByData(s,e)})}loadBuildGround(t){return f(this,null,function*(){let{brand:e,project:i}=t,s=yield this.loadBuildingGround({brand:e,project:i});var o;return this.bmap.currentBuildGround=(o=s==null?void 0:s.info)!=null?o:null,this.bmap.changeBuildingCenter(s,{brand:e,project:i}),this.bmap.currentBuildGround})}loadBuildingGround(t){return f(this,null,function*(){let{brand:e,project:i}=t,s=Te({brand:e,project:i});if(this.buildingGroundMap.has(s))return this.buildingGroundMap.get(s);let o=nn({brand:e,project:i},this.bmap.config).then(n=>(this.buildingGroundMap.set(s,n),n));return this.buildingGroundMap.set(s,o),o})}switchFloor(t){return f(this,null,function*(){let e=new se(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(i){console.log(i)}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 Zh=function(a){return a[a.D2=0]="D2",a[a.D3=1.1]="D3",a}({}),hn=class extends Nt.EventDispatcher{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:i,project:s}=e,o=t?Ci(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:s,brand:i})}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 f(this,null,function*(){return this.loader||(this.loader=new qe(this),this.loader.placeConfig=w({},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,i){e===void 0&&(e=!0),i===void 0&&(i=t.graphicLayer.children),this.triggerHooks(yt.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:i}),this.buildingCenter=t.userData.center,this.currentBuildGround=t.userData.rangeGraphic,this.context.switchFloor(t,e),this.initialFloorCamera(),this.triggerHooks(yt.SWITCH_FLOOR_AFTER,{curFloor:t,graphics:i})}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*this.config.control.maxZoomScale,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 i;let s=(i=this.context.currentFloor)==null?void 0:i.addModel(w({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(s){let{facilityAngle:o=0,facilityXScale:n=1,facilityYScale:r=1}=t.options.userData;s.rotateZ((180-o)/180*Math.PI),s.scale.set(n,r,1)}}}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.getGraphics())||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let i=t.options.centerCoords,s=t.getCenter(),o=(i==null?void 0:i[0])||s.x,n=(i==null?void 0:i[1])||s.y;return console.log(o,n,i,s),this.context.currentFloor.addPoi(w({},e,{position:{x:o,y:n,z:s.z+t.options.height/2}}))}return null}createPoi2ByPosition(t,e){if(this.context.currentFloor){let i=this.mercatorToWorld([t.x,t.y]),s=new tt(this.context,w({},e,{position:{x:i.x,y:i.y,z:t.z}}));return this.context.currentFloor.poiLayer2.pushPoi(s),s}return null}translateElementToCenter(t,e,i,s){e===void 0&&(e=500),i===void 0&&(i=0),s===void 0&&(s=0);let o=t.getPosition().clone(),{context:{camera:n}}=this;if(n.updateMatrix(),s){let r=new Nt.Vector3;r.setFromMatrixColumn(n.matrix,1),r.normalize(),r.multiplyScalar(s/n.zoom),o.add(r)}if(i){let r=new Nt.Vector3;r.setFromMatrixColumn(n.matrix,0),r.normalize(),r.multiplyScalar(i/n.zoom),o.add(r)}return this.context.setCameraPosition(o,e)}translateElementToCenterX(t,e){return f(this,null,function*(){return e===void 0&&(e=500),Ft(new Promise(i=>{let s=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:n,height:r},camera:h}=this.context,l=D(o,h,n,r).x-n/2,p=new Nt.Vector3;p.setFromMatrixColumn(this.context.camera.matrix,0),p.normalize(),p.multiplyScalar(l/this.context.camera.zoom),s.add(p),this.context.setCameraPosition(s,e).then(i)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:i,clientHeight:s}=this.container;return D(e,this.context.camera,i,s)}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 f(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 i=this.context.camera.zoom;return this.context.setZoom(i-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let i=this.context.camera.zoom;return this.context.setZoom(i+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver.enable){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,e){t===void 0&&(t=.1),e===void 0&&(e=500);let i=this.context.control.getAzimuthalAngle();return this.context.setAzimuthalAngle(i+t,e)}measureDistance(){return f(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new qi(this.context);let i=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){i(),e("cancel")},this.svgLine.addEventListener("distance",s=>{let{distance:o}=s;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 $i(this.context);let i=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){i(),e("cancel")},this.svgPolygon.addEventListener("area",s=>{let{area:o}=s;t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}fitCameraByPois(t,e,i){return f(this,null,function*(){if(e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500),!t.length)return;let s=new Nt.Box3;return t.forEach(o=>{let{position:n}=o;s.expandByPoint(n)}),this.context.fitCameraToBox(s,e,i,!1)})}fitCameraByPoiNodeIds(t,e,i){return f(this,null,function*(){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500);let s=t.map(o=>this.getPoiById(o)).filter(o=>!!o);if(s.length)return this.fitCameraByPois(s,e,i)})}getGraphicByNodeId(t){var e,i;return((e=this.context.currentFloor)==null?void 0:e.graphicLayer.getGraphicByNodeId(t))||((i=this.context.currentFloor)==null?void 0:i.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 i=Ci(this.currentBuildGround.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(s=>{Array.isArray(s)&&s.forEach(o=>{o[0]-=i[0],o[1]-=i[1]})});else{let[s,o]=t.geometry.cds;t.geometry.coords=[s-i[0],o-i[1]]}}return(e=this.context.currentFloor)==null?void 0:e.graphicLayer.createGraphic(t)}mercatorToWorld(t){let e=this.buildingCenter;return new Nt.Vector3(t[0]-e[0],t[1]-e[1],0)}removePoiById(t){var e,i;(e=this.context.currentFloor)==null||e.poiLayer.removePoiById(t),(i=this.context.currentFloor)==null||i.poiLayer2.removePoiById(t)}getPoiById(t){var e;let i=this.context.collisionSystem.objects;return((e=this.context.currentFloor)==null?void 0:e.poiLayer.getPoiById(t))||i.find(s=>s.options.id===t)}getPois(){var t;return[...(((t=this.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).filter(e=>!e.options.built_in),...this.context.collisionSystem.objects||[]]}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,Q.dispose(),ct.dispose(),ke.dispose(),St.dispose(),T.dispose(),ee.dispose(),this.debounceResize=null,Nt.Sprite.Dispose==null||Nt.Sprite.Dispose.call(Nt.Sprite)}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 j,this.plugins=[],this.loader=null,this.onControlChange=()=>{let{camera:{zoom:i}}=this.context;i!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=i)},this.onKeydown=i=>{this.polarKeys.includes(i.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(i.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=i=>{if(this.polarKeys.includes(i.code)){let s=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=s,this.context.control.minPolarAngle=s}if(this.azimuthalKeys.includes(i.code)){let s=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=s,this.context.control.minAzimuthAngle=s}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let i=this.context.control.getAzimuthalAngle(),s=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=s,this.context.control.minZoom=o,this.context.control.maxZoom=o*this.config.control.maxZoomScale,this.basicZoom=s,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(i,0),this.context.cameraBound.setEnable(!0)},this.config=tn(e),this.context=new ps(t,this),this.debounceResize=(0,ca.debounce)(this.resize,this.config.resizeObserver.debounceTime),this.registryEvent()}};var jh=function(a){return a.HALF="half",a.POWER="power",a.MECHANICAL="mechanical",a.NORMAL="normal",a.VIP="vip",a}({});var N0=require("core-js/modules/web.dom-collections.iterator.js");var X=class extends st{dispose(){let t=this.bmap.plugins.findIndex(e=>e===this);t!==-1&&this.bmap.plugins.splice(t,1),this.bmap=null,super.dispose()}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var cn=class extends X{fetchEquipment(){return f(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:i}=this.bmap.config,s=""+t+e;yield fetch(s,i).then(o=>o.json()).then(o=>o.data).then(o=>{this.equipmentList=o,this.equipmentMap=new Map(o.map(n=>[n.equipment_id,n]))}),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 i=this.getGraphicEquipment(e);return i&&this.equipmentMap.has(i)}).forEach(e=>{let i=this.equipmentMap.get(this.getGraphicEquipment(e)),s=this.bmap.createGraphicPoi(e,{icon:i==null?void 0:i.equipment_icon,built_in:!0,icon_size:[14,14]});s&&(s.userData.data=i,s.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(yt.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 i;(i=this.bmap.context.currentFloor)==null||i.poiLayer.removePoi(e)}}),super.dispose()}constructor(t){super(t),this.equipmentList=[],this.equipmentMap=new Map,this.onSwitchFloor=e=>{let{data:{graphics:i}}=e;this.equipmentList.length&&this.changeGraphicToEquipment(i)},this.fetchEquipment(),this.bmap.addEventListener(yt.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var Vw=require("core-js/modules/es.string.replace.js"),Kw=require("core-js/modules/es.regexp.exec.js"),Xw=require("core-js/modules/web.dom-collections.iterator.js"),Yw=require("core-js/modules/es.promise.finally.js");var dw=require("core-js/modules/web.dom-collections.iterator.js"),uw=require("core-js/modules/es.array.push.js"),ut=require("three");var X0=require("core-js/modules/es.typed-array.float32-array.js"),Y0=require("core-js/modules/es.typed-array.at.js"),q0=require("core-js/modules/es.typed-array.fill.js"),$0=require("core-js/modules/es.typed-array.find-last.js"),J0=require("core-js/modules/es.typed-array.find-last-index.js"),Q0=require("core-js/modules/es.typed-array.set.js"),tw=require("core-js/modules/es.typed-array.sort.js"),ew=require("core-js/modules/es.typed-array.to-reversed.js"),iw=require("core-js/modules/es.typed-array.to-sorted.js"),sw=require("core-js/modules/es.typed-array.with.js"),ow=require("core-js/modules/es.array-buffer.constructor.js"),nw=require("core-js/modules/es.array-buffer.slice.js"),rw=require("core-js/modules/es.array-buffer.detached.js"),aw=require("core-js/modules/es.array-buffer.transfer.js"),hw=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),cw=require("core-js/modules/es.array.push.js"),lw=require("core-js/modules/es.typed-array.uint16-array.js"),L=require("three"),Zt=class extends L.BufferGeometry{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new L.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}})}};Zt.prototype.setMatrixWorld=function(a){this.matrixWorld=a};Zt.prototype.setGeometry=function(a,t){this._geometry=a,this.setPoints(a.getAttribute("position").array,t)};Zt.prototype.setPoints=function(a,t){if(!(a instanceof Float32Array)&&!(a instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=a,this.widthCallback=t,this.positions=[],this.counters=[],a.length&&a[0]instanceof L.Vector3)for(var e=0;e<a.length;e++){var i=a[e],s=e/a.length;this.positions.push(i.x,i.y,i.z),this.positions.push(i.x,i.y,i.z),this.counters.push(s),this.counters.push(s)}else for(var e=0;e<a.length;e+=3){var s=e/a.length;this.positions.push(a[e],a[e+1],a[e+2]),this.positions.push(a[e],a[e+1],a[e+2]),this.counters.push(s),this.counters.push(s)}this.process()};function Vh(a,t){var e=new L.Matrix4,i=new L.Ray,s=new L.Sphere,o=new L.Vector3,n=this.geometry;if(n.boundingSphere||n.computeBoundingSphere(),s.copy(n.boundingSphere),s.applyMatrix4(this.matrixWorld),a.ray.intersectSphere(s,o)!==!1){e.copy(this.matrixWorld).invert(),i.copy(a.ray).applyMatrix4(e);var r=new L.Vector3,h=new L.Vector3,c=new L.Vector3,l=this instanceof L.LineSegments?2:1,p=n.index,d=n.attributes;if(p!==null)for(var u=p.array,m=d.position.array,v=d.width.array,g=0,x=u.length-1;g<x;g+=l){var M=u[g],P=u[g+1];r.fromArray(m,M*3),h.fromArray(m,P*3);var C=v[Math.floor(g/3)]!==void 0?v[Math.floor(g/3)]:1,S=a.params.Line.threshold+this.material.lineWidth*C/2,G=S*S,E=i.distanceSqToSegment(r,h,o,c);if(!(E>G)){o.applyMatrix4(this.matrixWorld);var nt=a.ray.origin.distanceTo(o);nt<a.near||nt>a.far||(t.push({distance:nt,point:c.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}),g=x)}}}}Zt.prototype.raycast=Vh;Zt.prototype.compareV3=function(a,t){var e=a*6,i=t*6;return this.positions[e]===this.positions[i]&&this.positions[e+1]===this.positions[i+1]&&this.positions[e+2]===this.positions[i+2]};Zt.prototype.copyV3=function(a){var t=a*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};Zt.prototype.getDistance=function(a){let t=0;for(let e=0;e<a;e++){let i=6*e,s=new L.Vector3(this.positions[i],this.positions[i+1],this.positions[i+2]),o=new L.Vector3(this.positions[i+6],this.positions[i+7],this.positions[i+8]),n=s.distanceTo(o);t+=n}return t};Zt.prototype.process=function(){var a=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(a-1);var i;this.compareV3(0,a-1)?i=this.copyV3(a-2):i=this.copyV3(0),this.previous.push(i[0],i[1],i[2]),this.previous.push(i[0],i[1],i[2]);for(var s=0;s<a;s++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(s/(a-1)):t=1,this.width.push(t),this.width.push(t),s===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(s===a-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let n=this.getDistance(s)/e;this.uvs.push(n,0),this.uvs.push(n,1)}if(s<a-1){i=this.copyV3(s),this.previous.push(i[0],i[1],i[2]),this.previous.push(i[0],i[1],i[2]);var o=s*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}s>0&&(i=this.copyV3(s),this.next.push(i[0],i[1],i[2]),this.next.push(i[0],i[1],i[2]))}this.compareV3(a-1,0)?i=this.copyV3(1):i=this.copyV3(a-1),this.next.push(i[0],i[1],i[2]),this.next.push(i[0],i[1],i[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new L.BufferAttribute(new Float32Array(this.positions),3),previous:new L.BufferAttribute(new Float32Array(this.previous),3),next:new L.BufferAttribute(new Float32Array(this.next),3),side:new L.BufferAttribute(new Float32Array(this.side),1),width:new L.BufferAttribute(new Float32Array(this.width),1),uv:new L.BufferAttribute(new Float32Array(this.uvs),2),index:new L.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new L.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function ln(a,t,e,i,s){var o;if(a=a.subarray||a.slice?a:a.buffer,e=e.subarray||e.slice?e:e.buffer,a=t?a.subarray?a.subarray(t,s&&t+s):a.slice(t,s&&t+s):a,e.set)e.set(a,i);else for(o=0;o<a.length;o++)e[o+i]=a[o];return e}Zt.prototype.advance=function(a){var t=this._attributes.position.array,e=this._attributes.previous.array,i=this._attributes.next.array,s=t.length;ln(t,0,e,0,s),ln(t,6,t,0,s-6),t[s-6]=a.x,t[s-5]=a.y,t[s-4]=a.z,t[s-3]=a.x,t[s-2]=a.y,t[s-1]=a.z,ln(t,6,i,0,s-6),i[s-6]=a.x,i[s-5]=a.y,i[s-4]=a.z,i[s-3]=a.x,i[s-2]=a.y,i[s-1]=a.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};L.ShaderChunk.meshline_vert=["",L.ShaderChunk.logdepthbuf_pars_vertex,L.ShaderChunk.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",L.ShaderChunk.logdepthbuf_vertex,L.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",L.ShaderChunk.fog_vertex,"}"].join(`
|
|
501
|
+
`,i=-1/0,s=this.geometry.getAttribute("position");if(s)for(let n=0;n<s.count;n++){let r=s.getZ(n);r>i&&(i=r)}let o=new dt.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new dt.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new dt.Color(ce(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=T.createLineMaterial({color:this.options[0].strokeColor,opacity:this.options[0].strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new dt.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(i=>{let{coords:s}=i.geometry;for(let o=0;o<s.length;o++){let n=s[o];for(let r=0;r<n.length;r++){let h=n[r],c=r+1===n.length?n[0]:n[r+1];t.push(new dt.Vector3(h[0],h[1],e)),t.push(new dt.Vector3(c[0],c[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new dt.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new dt.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t,e;this.geometry?(this.geometry.dispose(),this._listeners={}):this.addEventListener("init-geometry",()=>{var i;(i=this.geometry)==null||i.dispose(),this._listeners={}}),(t=this.material)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e,i){super(),this.context=t,this.mergedElement=i,this.options=[],i?(this.options=[i],this.initMergedElement()):(this.options=e.map(s=>w({},fe,s)),this.init())}};var Wg=require("core-js/modules/web.dom-collections.iterator.js"),Ug=require("core-js/modules/es.string.trim.js");var Wt=require("three"),jr=require("three/examples/jsm/utils/BufferGeometryUtils.js");var Vr={airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},texts:[],fillColor:"#ffffff",fillOpacity:0,strokeColor:"#ffffff",strokeOpacity:0,secondHeight:0,secondRotate:0,center_x:0,center_y:0},is=class extends Wt.Object3D{init(){return f(this,null,function*(){let t=yield Promise.all(this.options.map(n=>Q.getTextureByText(n.texts[0],{fillStyle:Ls(n.fillColor,n.fillOpacity),strokeStyle:Ls(n.strokeColor,n.strokeOpacity),lineWidth:2,font:"bold 28px sans-serif",maxWidth:2048}))),e=t.map((n,r)=>{let h=this.options[r],{width:c,height:l}=n.texture.image,p=c/l,d=h.secondHeight*p,u=new Wt.PlaneGeometry(d,h.secondHeight),m=new Wt.Matrix4().makeTranslation(h.center_x,h.center_y,h.airHeight+h.deltaHeight+h.height).multiply(new Wt.Matrix4().makeRotationZ(h.secondRotate));return u.applyMatrix4(m),u}),i=(0,jr.mergeGeometries)(e,!0);e.forEach(n=>n.dispose());let s=t.map(n=>{let{texture:r}=n,h=new Wt.MeshBasicMaterial({map:r,alphaTest:.9,side:Wt.DoubleSide});return r.needsUpdate=!0,h}),o=new Wt.Mesh(i,s);this.mesh=o,this.position.z+=.04,this.add(o)})}setOpacity(t){var e,i;(i=this.mesh)==null||(e=i.material)==null||e.forEach(s=>{s.opacity=t,s.needsUpdate=!0})}dispose(){var t,e,i;(t=this.mesh)==null||t.geometry.dispose(),(i=this.mesh)==null||(e=i.material)==null||e.forEach(s=>s.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(i=>w({},Vr,i)).filter(i=>i.texts[0].trim()),this.options.length&&this.init()}};var Kr=require("three"),Xr=require("three/examples/jsm/lines/Line2.js"),Yr=require("three/examples/jsm/lines/LineGeometry.js"),qr=require("three/examples/jsm/lines/LineMaterial.js"),ai=class extends Kr.Object3D{registryEvent(){this.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.context.removeEventListener("resize",this.onResize)}setPosition(t,e){this.lineGeometry.setPositions([t.x,t.y,t.z,e.x,e.y,e.z]),this.line||this.createLine()}createLine(){this.line=new Xr.Line2(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&I(this.line),this.lineGeometry=null,this.lineMaterial=null,this.clear(),(t=this.line)==null||t.clear(),this.line=null}constructor(t,e,i){super(),this.context=t,this.lineGeometry=new Yr.LineGeometry,this.lineMaterial=new qr.LineMaterial({color:0,transparent:!0,depthTest:!1,linewidth:2}),this.line=null,this.onResize=()=>{let{width:s,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(s,o)},this.onResize(),this.registryEvent(),e&&i&&this.setPosition(e,i)}};var Xg=require("core-js/modules/es.array.push.js"),Yg=require("core-js/modules/web.dom-collections.iterator.js"),Fe=require("three");var hi=require("three");var Ki=class extends Fe.Object3D{loadModel(){return f(this,null,function*(){let t=yield St.loadModel(this.options[0].url);t.scene.updateMatrixWorld(!0);let e=t.scene.matrixWorld.clone().invert();t.scene.traverse(h=>{if(h.isMesh){let c=e.clone().multiply(h.matrixWorld),l=h.material;this.subMeshes.push({geometry:h.geometry,material:h.material,initialMatrix:c}),Array.isArray(l)?l.forEach(p=>{p.transparent=!0,this.materialOriginParams.set(p,{opacity:p.opacity})}):(l.transparent=!0,this.materialOriginParams.set(l,{opacity:l.opacity}))}});let i=this.subMeshes.map(h=>{let{geometry:c,material:l}=h;return new Fe.InstancedMesh(c,l,this.options.length)});t.scene.rotation.set(Math.PI/2,0,0);let o=new Fe.Box3().setFromObject(t.scene).getSize(new Fe.Vector3),n=Math.max(o.x,o.y);this.options.map(h=>{let c=new hi.Matrix4,l=h.width/n;return c.multiply(new hi.Matrix4().makeTranslation(h.center_x,h.center_y,h.airHeight+h.deltaHeight)).multiply(new hi.Matrix4().makeScale(l,l,l)).multiply(new hi.Matrix4().makeRotationZ(h.rotate)).multiply(new hi.Matrix4().makeRotationX(Math.PI/2)),h.url==="https://robot-vr-public.cdn.bcebos.com/ai-map-resource/757/1865371442288267264/smzsdrc.glb"&&console.log(h,c),c}).forEach((h,c)=>{i.forEach((l,p)=>{let d=h.clone().multiply(this.subMeshes[p].initialMatrix);l.setMatrixAt(c,d)})}),i.forEach(h=>{h.instanceMatrix.needsUpdate=!0,this.meshSetMaterial(h),this.add(h)})})}meshSetMaterial(t){t.isMesh&&(t.frustumCulled=!1,t.castShadow=!0,Array.isArray(t.material)?t.material.map(e=>{e.emissiveIntensity*=.95}):(t.material.emissiveIntensity*=.95,t.material.emissive=t.material.color,t.material.emissiveMap=t.material.map))}setOpacity(t,e){e===void 0&&(e=!1),this.subMeshes.forEach(i=>{let{material:s}=i;if(Array.isArray(s))s.forEach(o=>{if(e)o.opacity=t;else{let n=this.materialOriginParams.get(o)||{opacity:1};t>n.opacity?o.opacity=n.opacity:o.opacity=t}o.needsUpdate=!0});else{let o=this.materialOriginParams.get(s)||{opacity:1};t>o.opacity?s.opacity=o.opacity:s.opacity=t,s.needsUpdate=!0}}),this.children.forEach(i=>{i.instanceMatrix.needsUpdate=!0})}dispose(){this.children.forEach(t=>t.dispose()),I(this),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.subMeshes=[],this.materialOriginParams=new Map,this.loadModel()}};var ze=require("three");var ri=class extends ze.Object3D{init(){return f(this,null,function*(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.deltaHeight+this.options.airHeight,this.options.lineGeometry&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())})}initGeometry(){return this.loader.parseGeometries([this.options.mergedGeometry])[this.options.mergedGeometry.uuid]}initMaterial(){this.material=T.GetMergeAttributeGraphicMaterial()}initLineMaterial(){return this.lineMaterial=T.GetMergeAttributeGraphicLineMaterial()}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new ze.Mesh(this.geometry,this.material),this.add(this.mesh)}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.loader.parseGeometries([this.options.lineGeometry]);this.lineGeometry=t[this.options.lineGeometry.uuid]}createBorder(){this.line&&this.remove(this.line);let t=new ze.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t;this.geometry&&this.geometry.dispose(),(t=this.line)==null||t.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.loader=new ze.ObjectLoader,this.options=w({},fe,e),this.init()}};var ci=require("three");var ss=class extends ci.Object3D{initGeometry(){return f(this,null,function*(){let t=new ci.ObjectLoader().parseGeometries([this.options.mergedGeometry]);this.geometry=t[this.options.mergedGeometry.uuid]})}init(){return f(this,null,function*(){var t;yield this.initGeometry();let e=new ci.Mesh(this.geometry,Lt.GetMergeAttributeWallMaterial());this.add(e);let i=(t=this.geometry)==null?void 0:t.getAttribute("opacity");i&&(this.originOpacities=Array.from(i.array))})}setOpacity(t,e){e===void 0&&(e=!1);var i;let s=(i=this.geometry)==null?void 0:i.getAttribute("opacity");if(s){for(let n=0;n<s.count;n++)if(e)s.setX(n,t);else{var o;s.setX(n,Math.min(t,(o=this.originOpacities[n])!=null?o:1))}s.needsUpdate=!0}}dispose(){var t;(t=this.geometry)==null||t.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.originOpacities=[],this.init()}};var cy=require("core-js/modules/es.typed-array.float32-array.js"),ly=require("core-js/modules/es.typed-array.at.js"),py=require("core-js/modules/es.typed-array.fill.js"),dy=require("core-js/modules/es.typed-array.find-last.js"),uy=require("core-js/modules/es.typed-array.find-last-index.js"),my=require("core-js/modules/es.typed-array.set.js"),fy=require("core-js/modules/es.typed-array.sort.js"),gy=require("core-js/modules/es.typed-array.to-reversed.js"),yy=require("core-js/modules/es.typed-array.to-sorted.js"),vy=require("core-js/modules/es.typed-array.with.js"),xy=require("core-js/modules/es.array-buffer.constructor.js"),wy=require("core-js/modules/es.array-buffer.slice.js"),My=require("core-js/modules/es.array-buffer.detached.js"),_y=require("core-js/modules/es.array-buffer.transfer.js"),Py=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js");var ot=require("three");var Oe=class extends ot.Object3D{init(){return f(this,null,function*(){let t=this.options.iconUrl,e=yield ct.getTextureByUrl(t),i=new ot.MeshBasicMaterial({map:e,transparent:!0,alphaTest:.2,side:ot.FrontSide}),s=new ot.InstancedMesh(this.geometry,i,this.options.mergedMatrixes.size);s.instanceMatrix=new ot.InstancedBufferAttribute(new Float32Array(this.options.mergedMatrixes.array),16),this.add(s),this.mesh=s,this.position.z+=.004})}setOpacity(t){this.mesh&&(this.mesh.material.opacity=t,this.mesh.material.needsUpdate=!0,this.mesh.instanceMatrix.needsUpdate=!0)}dispose(){var t;this.mesh&&I(this.mesh),(t=this.mesh)==null||t.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.geometry=new ot.ShapeGeometry(new ot.Shape([new ot.Vector2(-.5,-.5),new ot.Vector2(-.5,.5),new ot.Vector2(.5,.5),new ot.Vector2(.5,-.5)])),this.options=w({},js,e);let i=new ot.Float32BufferAttribute([0,0,0,1,1,1,1,0],2);this.geometry.setAttribute("uv",i),this.init()}};var Ty=require("core-js/modules/es.array.push.js"),Pe=require("three");var Jo=require("three/examples/jsm/lines/LineSegments2.js"),Qo=require("three/examples/jsm/lines/LineSegmentsGeometry.js");var os=class extends Pe.Object3D{initGeometry(){return f(this,null,function*(){let t=this.loader.parseGeometries([this.options.mergedGeometry]);this.geometry=t[this.options.mergedGeometry.uuid]})}initMaterial(){let t=T.createMeshBasicMaterial({color:"#ffffff",opacity:1,vertexColors:!0});return this.material=t,t}initDoubleLine(){if(this.options.dashedLineGeometry){let t=T.createLine2MaterialMap({color:"#ffffff",width:.2,dashed:!0,resolution:new Pe.Vector2(this.context.clientSize.width,this.context.clientSize.height),vertexColors:!0});t.transparent=!0,t.needsUpdate=!0;let e=new Qo.LineSegmentsGeometry;e.setPositions(this.options.dashedLineGeometry.positions),e.setColors(this.options.dashedLineGeometry.colors);let i=new Jo.LineSegments2(e,t);i.computeLineDistances(),i.position.z+=.01,this.add(i),this.doubleLines.push(i)}if(this.options.lineGeometry){let t=T.createLine2MaterialMap({color:"#ffffff",width:.2,dashed:!1,resolution:new Pe.Vector2(this.context.clientSize.width,this.context.clientSize.height),vertexColors:!0}),e=new Qo.LineSegmentsGeometry;e.setPositions(this.options.lineGeometry.positions),e.setColors(this.options.lineGeometry.colors);let i=new Jo.LineSegments2(e,t);i.position.z+=.01,this.add(i),this.doubleLines.push(i)}}init(){return f(this,null,function*(){yield this.initGeometry(),this.initMaterial();let t=new Pe.Mesh(this.geometry,this.material);this.add(t),this.initDoubleLine(),this.position.z+=.02})}setOpacity(t){this.material.opacity=t,this.material.needsUpdate=!0,this.doubleLines.forEach(e=>{e.material.opacity=t,e.material.needsUpdate=!0})}dispose(){var t,e;(t=this.geometry)==null||t.dispose(),(e=this.lineGeometry)==null||e.dispose(),this.doubleLines.map(i=>i.geometry.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.doubleLines=[],this.loader=new Pe.ObjectLoader,this.init()}};var Iy=require("core-js/modules/es.typed-array.float32-array.js"),Ry=require("core-js/modules/es.typed-array.at.js"),Gy=require("core-js/modules/es.typed-array.fill.js"),Fy=require("core-js/modules/es.typed-array.find-last.js"),zy=require("core-js/modules/es.typed-array.find-last-index.js"),By=require("core-js/modules/es.typed-array.set.js"),Wy=require("core-js/modules/es.typed-array.sort.js"),Uy=require("core-js/modules/es.typed-array.to-reversed.js"),Hy=require("core-js/modules/es.typed-array.to-sorted.js"),Ny=require("core-js/modules/es.typed-array.with.js"),Zy=require("core-js/modules/es.array-buffer.constructor.js"),jy=require("core-js/modules/es.array-buffer.slice.js"),Vy=require("core-js/modules/es.array-buffer.detached.js"),Ky=require("core-js/modules/es.array-buffer.transfer.js"),Xy=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Yy=require("core-js/modules/web.dom-collections.iterator.js"),W=require("three");var ii=class extends W.Object3D{setColorByIndex(t,e){this.mesh&&(this.mesh.setColorAt(t,new W.Color(e).convertLinearToSRGB()),this.mesh.instanceColor.needsUpdate=!0)}init(){return f(this,null,function*(){this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options[0].deltaHeight+this.options[0].airHeight,this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())})}initMaterial(){this.material=T.GetInstancedGraphicMaterial()}initLineMaterial(){let t=T.GetMergeAttributeGraphicLineMaterial();this.lineMaterial=t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new W.InstancedMesh(this.geometry,this.material,this.options.length);let t=new W.InstancedBufferAttribute(new Float32Array(this.options.length),1),e=new W.InstancedBufferAttribute(new Float32Array(this.options.length),1);this.options.forEach((i,s)=>{let o=i.geometry.coords[0],[n,r,h]=o.slice(0,3),c=Math.sqrt((r[0]-n[0])**2+(r[1]-n[1])**2),l=Math.sqrt((h[0]-r[0])**2+(h[1]-r[1])**2),p=[c,l],d=Math.max(...p),u=Math.min(...p),m;d===c?m=[r[0]-n[0],r[1]-n[1]]:m=[h[0]-r[0],h[1]-r[1]];let[v,g]=m,x=Math.atan2(g,v)-Math.PI/2,M=new W.Matrix4().compose(new W.Vector3(i.center_coord_x,i.center_coord_y,(i.deltaHeight||0)+i.airHeight+i.height/2),new W.Quaternion().setFromAxisAngle(new W.Vector3(0,0,1),x),new W.Vector3(u,d,i.height));this.mesh.setMatrixAt(s,M),this.mesh.setColorAt(s,new W.Color(i.fillColor).convertLinearToSRGB());var P;t.array[s]=(P=i.fillOpacity)!=null?P:1;var C;e.array[s]=((C=i.deltaHeight)!=null?C:0)+i.airHeight+i.height}),this.originOpacity=[...t.array],this.geometry.setAttribute("opacity",t),this.geometry.setAttribute("maxZ",e),this.add(this.mesh),this.mesh.instanceMatrix.needsUpdate=!0}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let{points:t,colors:e,opacities:i}=As(this.options),s=new W.BufferGeometry().setFromPoints(t);s.setAttribute("color",new W.BufferAttribute(new Float32Array(e),3)),s.setAttribute("opacity",new W.BufferAttribute(new Float32Array(i),1)),this.lineOriginOpacity=[...i],this.lineGeometry=s}createBorder(){this.line&&this.remove(this.line);let t=new W.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}setOpacity(t,e){e===void 0&&(e=!1);let i=this.geometry.getAttribute("opacity");for(let n=0;n<i.count;n++)if(e)i.array[n]=t;else{var s;i.array[n]=Math.min(t,(s=this.originOpacity[n])!=null?s:1)}if(i.needsUpdate=!0,this.lineGeometry){let n=this.lineGeometry.getAttribute("opacity");for(let r=0;r<n.count;r++)if(e)n.array[r]=t;else{var o;n.array[r]=Math.min(t,(o=this.lineOriginOpacity[r])!=null?o:1)}n.needsUpdate=!0}}dispose(){var t,e;this.geometry.dispose(),(t=this.mesh)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.geometry=new W.BoxGeometry(1,1,1),this.options=[],this.originOpacity=[],this.lineOriginOpacity=[],this.options=e.map(i=>w({},fe,i)),this.init()}};var ev=require("core-js/modules/es.typed-array.float32-array.js"),iv=require("core-js/modules/es.typed-array.at.js"),sv=require("core-js/modules/es.typed-array.fill.js"),ov=require("core-js/modules/es.typed-array.find-last.js"),nv=require("core-js/modules/es.typed-array.find-last-index.js"),rv=require("core-js/modules/es.typed-array.set.js"),av=require("core-js/modules/es.typed-array.sort.js"),hv=require("core-js/modules/es.typed-array.to-reversed.js"),cv=require("core-js/modules/es.typed-array.to-sorted.js"),lv=require("core-js/modules/es.typed-array.with.js"),pv=require("core-js/modules/es.array-buffer.constructor.js"),dv=require("core-js/modules/es.array-buffer.slice.js"),uv=require("core-js/modules/es.array-buffer.detached.js"),mv=require("core-js/modules/es.array-buffer.transfer.js"),fv=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),gv=require("core-js/modules/web.dom-collections.iterator.js"),qt=require("three");var Xe=class extends qt.Object3D{init(){return f(this,null,function*(){this.initMaterial(),this.initMesh()})}initMaterial(){this.material=T.GetInstancedGraphicMaterial()}initMesh(){if(this.mesh&&this.remove(this.mesh),!this.elements)return;this.mesh=new qt.InstancedMesh(this.geometry,this.material,this.elements.size);let t=new qt.InstancedBufferAttribute(new Float32Array(this.elements.opacities),1),e=new qt.InstancedBufferAttribute(new Float32Array(this.elements.maxZs),1);this.originOpacities=[...t.array],this.geometry.setAttribute("opacity",t),this.geometry.setAttribute("maxZ",e),this.mesh.instanceMatrix.set(this.elements.matrixes),this.mesh.instanceColor=new qt.InstancedBufferAttribute(new Float32Array(this.elements.colors),3),this.add(this.mesh),this.mesh.instanceMatrix.needsUpdate=!0}setColorByIndex(t,e){this.mesh&&(this.mesh.setColorAt(t,new qt.Color(e).convertLinearToSRGB()),this.mesh.instanceColor.needsUpdate=!0)}setOpacityByIndex(t,e){if(this.mesh){let i=this.geometry.getAttribute("opacity");i.setX(t,e),i.needsUpdate=!0}}setMatrixByIndex(t,e){this.mesh&&(this.mesh.setMatrixAt(t,e),this.mesh.instanceMatrix.needsUpdate=!0)}setMaxZByIndex(t,e){if(this.mesh){let i=this.geometry.getAttribute("maxZ");i.setX(t,e),i.needsUpdate=!0}}setColorById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setColorByIndex(i,e)}setOpacityById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setOpacityByIndex(i,e)}setMatrixById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setMatrixByIndex(i,e)}setMaxZById(t,e){if(!this.elements)return;let i=this.elements.ids.findIndex(s=>s===t);i!==-1&&this.setMaxZByIndex(i,e)}setOpacity(t,e){if(e===void 0&&(e=!1),!this.geometry)return;let i=this.geometry.getAttribute("opacity");for(let o=0;o<i.count;o++)if(e)i.array[o]=t;else{var s;i.array[o]=Math.min(t,(s=this.originOpacities[o])!=null?s:1)}i.needsUpdate=!0}pushElements(t){this.elements?(this.elements.size+=t.size,this.elements.colors=[...this.elements.colors,...t.colors],this.elements.matrixes=[...this.elements.matrixes,...t.matrixes],this.elements.opacities=[...this.elements.opacities,...t.opacities],this.elements.maxZs=[...this.elements.maxZs,...t.maxZs],this.elements.ids=[...this.elements.ids,...t.ids],this.originOpacities=[...this.originOpacities,...t.opacities]):this.elements=t,this.refesh()}removeInstanceById(t){if(this.elements){if(this.mesh){let e=this.elements.ids.indexOf(t);e!==-1&&(this.elements.size--,this.elements.colors.splice(e*3,3),this.elements.matrixes.splice(e*16,16),this.elements.opacities.splice(e,1),this.elements.maxZs.splice(e,1),this.elements.ids.splice(e,1),this.originOpacities.splice(e,1))}this.refesh()}}refesh(){this.mesh&&(this.mesh.dispose(),this.remove(this.mesh)),this.init()}dispose(){var t;this.material=null,this.originOpacities.length=0,this.geometry.dispose(),(t=this.mesh)==null||t.dispose(),this.clear()}constructor(t,e){super(),this.geometry=new qt.BoxGeometry(1,1,1),this.material=null,this.elements=null,this.originOpacities=[],this.elements=e,this.init()}};var wv=require("core-js/modules/es.typed-array.float32-array.js"),Mv=require("core-js/modules/es.typed-array.at.js"),_v=require("core-js/modules/es.typed-array.fill.js"),Pv=require("core-js/modules/es.typed-array.find-last.js"),bv=require("core-js/modules/es.typed-array.find-last-index.js"),Sv=require("core-js/modules/es.typed-array.set.js"),Ev=require("core-js/modules/es.typed-array.sort.js"),Lv=require("core-js/modules/es.typed-array.to-reversed.js"),Cv=require("core-js/modules/es.typed-array.to-sorted.js"),Tv=require("core-js/modules/es.typed-array.with.js"),kv=require("core-js/modules/es.array-buffer.constructor.js"),Dv=require("core-js/modules/es.array-buffer.slice.js"),Av=require("core-js/modules/es.array-buffer.detached.js"),Ov=require("core-js/modules/es.array-buffer.transfer.js"),Iv=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Rv=require("core-js/modules/web.dom-collections.iterator.js"),se=require("three");var ns=class extends se.Object3D{init(){return f(this,null,function*(){this.initMaterial(),this.initMesh()})}initMaterial(){this.material=T.GetInstancedWallMaterial()}initMesh(){if(this.mesh&&this.remove(this.mesh),!this.elements)return;this.mesh=new se.InstancedMesh(this.geometry,this.material,this.elements.size);let t=new se.InstancedBufferAttribute(new Float32Array(this.elements.opacities),1),e=new se.InstancedBufferAttribute(new Float32Array(this.elements.maxZs),1),i=new se.InstancedBufferAttribute(new Float32Array(this.elements.minZs),1);this.originOpacities=[...t.array],this.geometry.setAttribute("opacity",t),this.geometry.setAttribute("maxZ",e),this.geometry.setAttribute("minZ",i),this.mesh.instanceMatrix.set(this.elements.matrixes),this.mesh.instanceColor=new se.InstancedBufferAttribute(new Float32Array(this.elements.colors),3),this.add(this.mesh),this.mesh.instanceMatrix.needsUpdate=!0}setOpacityByIndex(t,e){if(this.mesh){let i=this.geometry.getAttribute("opacity");i.setX(t,e),i.needsUpdate=!0}}setOpacity(t,e){e===void 0&&(e=!1),this.elements&&this.elements.opacities.forEach((i,s)=>{let o=e?t:Math.min(t,this.originOpacities[s]);this.setOpacityByIndex(s,o)})}dispose(){this.mesh&&(this.mesh.dispose(),this.remove(this.mesh)),this.material=null,this.geometry&&this.geometry.dispose(),this.elements=null}constructor(t,e){super(),this.geometry=new se.BoxGeometry(1,1,1),this.material=null,this.elements=null,this.originOpacities=[],this.elements=e,this.init()}};var li=require("three");var Ie=class extends li.Object3D{init(){return f(this,null,function*(){this.initLineGeometry(),this.initLineMaterial(),this.createBorder()})}initLineMaterial(){return this.lineMaterial=T.GetMergeAttributeGraphicLineMaterial()}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.loader.parseGeometries([this.options]);this.lineGeometry=t[this.options.uuid]}createBorder(){this.line&&this.remove(this.line);let t=new li.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t;(t=this.lineGeometry)==null||t.dispose(),this.lineMaterial=null,this.clear()}constructor(t,e){super(),this.context=t,this.lineMaterial=null,this.loader=new li.ObjectLoader,this.options=w({},fe,e),this.init()}};var $r=require("three"),Vs=class extends Bt{setEnable(t){super.setEnable(t),bt(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:i,clientHeight:s}}}=this,o=D(this.startPoint,e,i,s),n=D(this.endPoint,e,i,s),r={x:Math.min(o.x,n.x),y:Math.min(o.y,n.y)},h={x:Math.max(o.x,n.x),y:Math.max(o.y,n.y)},c=this.searchMapInFrustum(r,h);this.dispatchEvent({type:"selected",list:c})}}searchMapInFrustum(t,e){var i;let{context:s}=this;return((i=s.currentFloor)==null?void 0:i.graphicLayer.children.filter(o=>o instanceof lt&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,i){let{context:{camera:s,container:{clientWidth:o,clientHeight:n}}}=this;if(!t)return!1;if(!t.mesh){let d=t.getPosition();if(d){let u=D(d,s,o,n);return we(u,e,i)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let r=t.mesh.geometry.boundingBox;if(!r)return!1;let{min:h,max:c}=r,l=D(h,s,o,n),p=D(c,s,o,n);return!(!we(l,e,i)||!we(p,e,i))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new $r.Frustum,this.onPointerDown=s=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(s);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=s=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(s);o&&(this.endPoint=o)},this.onPointerUp=s=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(s);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let s=this.getSvgCoordinate(this.startPoint),o=w({},s);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let n={x:Math.min(s.x,o.x),y:Math.min(s.y,o.y)},r=Math.abs(o.x-s.x),h=Math.abs(o.y-s.y);bt(this.rect,n.x,n.y,r,h)}else bt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:i}}}=t;this.rect=Me(i,e),this.svg.appendChild(this.rect),this.registryEvent()}};var rs=class extends Jr.EventDispatcher{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.context.config.enableBoxSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}constructor(t){super(),this.context=t,this._list=new Set,this.downPoint=null,this.downTime=0,this.isMultipleSelect=!1,this.onPointerDown=e=>{Date.now()-this.downTime<200||(this.downPoint={x:e.offsetX,y:e.offsetY},this.downTime=Date.now())},this.onPointerUp=e=>{if(!this.downPoint)return;let{offsetX:i,offsetY:s}=e,{x:o,y:n}=this.downPoint;if(Math.sqrt((o-i)**2+(n-s)**2)>3)return;let{graphics:r}=this.context.getGraphicsByDeviceXy(i,s),h=new Set(r.map(l=>l.options.id));this.context.getPoisByDeviceXy(i,s).forEach(l=>{if(!h.has(l.options.id)){var p;let d=((p=this.context.currentFloor)==null?void 0:p.graphicLayer.graphicMap.get(l.options.id))||null;d&&d.options.geometry.type==="point"&&(r.push(d),h.add(l.options.id))}}),(He?e.metaKey:e.ctrlKey)||this._list.clear(),r.forEach(l=>this._list.add(l)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{Ne(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Ne(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:i}=e;this._list.clear(),i.forEach(s=>{this._list.add(s)}),this.selectEnd()},this.boxSelection=new Vs(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var rx=require("core-js/modules/es.set.difference.v2.js"),ax=require("core-js/modules/es.set.intersection.v2.js"),hx=require("core-js/modules/es.set.is-disjoint-from.v2.js"),cx=require("core-js/modules/es.set.is-subset-of.v2.js"),lx=require("core-js/modules/es.set.is-superset-of.v2.js"),px=require("core-js/modules/es.set.symmetric-difference.v2.js"),dx=require("core-js/modules/es.set.union.v2.js"),ux=require("core-js/modules/web.dom-collections.iterator.js");var Ks=require("three");var as=class extends Ks.EventDispatcher{handleHoverGraphicsChange(t){t===void 0&&(t=this.curGraphics),this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}constructor(t){super(),this.context=t,this.curGraphics=new Set,this.timer=new j,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:i,pois:s,e:o}=e,n=s.map(l=>{var p;return(p=this.context.currentFloor)==null?void 0:p.graphicLayer.graphicMap.get(l.options.id)}).filter(l=>l&&l.options.geometry.type==="point");if(!i.length&&!n.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:r}=this.context.config.hover,h=new Set;if(n.length){let l,p=1e4;n.forEach(d=>{let u=s.find(m=>m.options.id===d.options.id);if(u instanceof De){let{x:m,y:v}=u.clientPos,g=Math.sqrt((m-o.offsetX)**2+(v-o.offsetY)**2);g<p&&(p=g,l=d)}else if(u instanceof tt){let{x:m,y:v}=u.box.getCenter(new Ks.Vector2),g=Math.sqrt((m-o.offsetX)**2+(v-o.offsetY)**2);g<p&&(p=g,l=d)}}),h.add(l)}h.size||i.forEach(l=>h.add(l)),h.forEach(l=>{if(this.graphicTimerMap.get(l)||this.curGraphics.has(l))return;let p=this.timer.setTimeout(()=>{this.curGraphics.add(l),this.graphicTimerMap.delete(l),this.timer.clearTimeout(p),this.handleHoverGraphicsChange()},r);this.graphicTimerMap.set(l,p)}),this.graphicTimerMap.forEach((l,p)=>{h.has(p)||(this.timer.clearTimeout(l),this.graphicTimerMap.delete(p))});let c=this.curGraphics.size;this.curGraphics.forEach(l=>{h.has(l)||this.curGraphics.delete(l)}),c!==this.curGraphics.size&&this.handleHoverGraphicsChange()},this.onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()},this.onBodyPointerMove=e=>{if(this.curGraphics.size){let i=this.context.container.getBoundingClientRect();(e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom)&&this.onPointerLevel()}},this.registryEvent()}};var yx=require("core-js/modules/web.dom-collections.iterator.js"),Ut=require("three");var hs=require("@turf/turf"),Xs=class{updateBox(){this.box.setFromObject(this.context.scene)}setEnable(t){this.enable=t,t?this.registryEvent():this.unRegistryEvent()}changePrevCamera(){this.prevCamera={position:this.context.camera.position.clone(),zoom:this.context.camera.zoom,target:this.context.control.target.clone()}}backToPrevCamera(){this.setEnable(!1),this.context.camera.position.copy(this.prevCamera.position),this.context.camera.zoom=this.prevCamera.zoom,this.context.control.target.copy(this.prevCamera.target),this.context.control.update(),this.setEnable(!0)}registryEvent(){this.context.addEventListener("control-change",this.onCameraChange)}unRegistryEvent(){this.context.removeEventListener("control-change",this.onCameraChange)}getCurFloorScreenPosition(){if(!this.context.scene.children.filter(m=>m instanceof ie).length)return null;let e=this.box,{camera:i,clientSize:{width:s,height:o}}=this.context,{min:n,max:r}=e,c=[new Ut.Vector3(n.x,n.y,n.z),new Ut.Vector3(r.x,n.y,n.z),new Ut.Vector3(n.x,r.y,n.z),new Ut.Vector3(r.x,r.y,n.z),new Ut.Vector3(n.x,n.y,r.z),new Ut.Vector3(r.x,n.y,r.z),new Ut.Vector3(n.x,r.y,r.z),new Ut.Vector3(r.x,r.y,r.z)].map(m=>D(m,i,s,o)),l=Math.min(...c.map(m=>m.x)),p=Math.max(...c.map(m=>m.x)),d=Math.min(...c.map(m=>m.y)),u=Math.max(...c.map(m=>m.y));return{left:l,right:p,top:d,bottom:u}}checkDistanceToScreenEdge(t){let{left:e,right:i,top:s,bottom:o}=t,{width:n,height:r}=this.context.clientSize,[h,c,l,p]=this.context.config.cameraBound.padding,d=(0,hs.polygon)([[[e,s],[i,s],[i,o],[e,o],[e,s]]]),u=(0,hs.polygon)([[[p,h],[n-c,h],[n-c,r-l],[p,r-l],[p,h]]]);try{return(0,hs.intersect)(d,u)!==null}catch(m){return console.warn("\u8BA1\u7B97\u4EA4\u96C6\u51FA\u9519:",m),!1}}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new Ut.Vector3,zoom:1,target:new Ut.Vector3},this.enable=!0,this.box=new Ut.Box3,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:i,right:s,top:o,bottom:n}=e;if([i,s,o,n].every(h=>!h))return;this.checkDistanceToScreenEdge({left:i,right:s,top:o,bottom:n})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var bx=require("core-js/modules/es.promise.finally.js"),tn=require("three"),Ye=require("@tweenjs/tween.js");var Mx=require("core-js/modules/web.dom-collections.iterator.js"),_x=require("core-js/modules/es.array.push.js"),b=require("three"),Ys=new b.Ray,Qr=new b.Plane,Ch=Math.cos(70*b.MathUtils.DEG2RAD),qs=class extends b.EventDispatcher{dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerUp),this.domElement.removeEventListener("wheel",this.onMouseWheel),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp),this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null)}constructor(t,e){super(),this.rotateLineStart=new b.Vector2,this.rotateLineEnd=new b.Vector2,this.spherical=new b.Spherical,this.sphericalDelta=new b.Spherical,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new b.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.screenSpacePanning=!1,this.mouseButtons={LEFT:b.MOUSE.PAN,MIDDLE:b.MOUSE.DOLLY,RIGHT:b.MOUSE.ROTATE},this.touches={ONE:b.TOUCH.PAN,TWO:b.TOUCH.DOLLY_ROTATE},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return r.phi},this.getAzimuthalAngle=function(){return r.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(y){y.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=y},this.stopListenToKeyEvents=function(){var y;(y=this._domElementKeyEvents)==null||y.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent({type:"change"}),i.update(),o=s.NONE},this.update=function(){let y=new b.Vector3,_=new b.Quaternion().setFromUnitVectors(t.up,new b.Vector3(0,1,0)),N=_.clone().invert(),it=new b.Vector3,It=new b.Quaternion,ae=new b.Vector3,Jt=2*Math.PI;return function(_i){_i===void 0&&(_i=null);let ye=i.object.position;y.copy(ye).sub(i.target),y.applyQuaternion(_),r.setFromVector3(y),i.autoRotate&&o===s.NONE&&Ot(Tt(_i)),i.enableDamping?(r.theta+=h.theta*i.dampingFactor,r.phi+=h.phi*i.dampingFactor):(r.theta+=h.theta,r.phi+=h.phi);let ve=i.minAzimuthAngle,xe=i.maxAzimuthAngle;isFinite(ve)&&isFinite(xe)&&(ve<-Math.PI?ve+=Jt:ve>Math.PI&&(ve-=Jt),xe<-Math.PI?xe+=Jt:xe>Math.PI&&(xe-=Jt),ve<=xe?r.theta=Math.max(ve,Math.min(xe,r.theta)):r.theta=r.theta>(ve+xe)/2?Math.max(ve,r.theta):Math.min(xe,r.theta)),r.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,r.phi)),r.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(l,i.dampingFactor):i.target.add(l),i.zoomToCursor&&G||i.object.isOrthographicCamera?r.radius=H(r.radius):r.radius=H(r.radius*c),y.setFromSpherical(r),y.applyQuaternion(N),ye.copy(i.target).add(y),i.object.lookAt(i.target),i.enableDamping===!0?(h.theta*=1-i.dampingFactor,h.phi*=1-i.dampingFactor,l.multiplyScalar(1-i.dampingFactor)):(h.set(0,0,0),l.set(0,0,0));let bs=!1;if(i.zoomToCursor&&G){let Pi=null;if(i.object.isPerspectiveCamera){let bi=y.length();Pi=H(bi*c);let Ss=bi-Pi;i.object.position.addScaledVector(C,Ss),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){let bi=new b.Vector3(S.x,S.y,0);bi.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),bs=!0;let Ss=new b.Vector3(S.x,S.y,0);Ss.unproject(i.object),i.object.position.sub(Ss).add(bi),i.object.updateMatrixWorld(),Pi=y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;Pi!==null&&(i.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(Pi).add(i.object.position):(Ys.origin.copy(i.object.position),Ys.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(Ys.direction))<Ch?t.lookAt(i.target):(Qr.setFromNormalAndCoplanarPoint(i.object.up,i.target),Ys.intersectPlane(Qr,i.target))))}else i.object.isOrthographicCamera&&(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),bs=!0);return c=1,G=!1,bs||it.distanceToSquared(i.object.position)>n||8*(1-It.dot(i.object.quaternion))>n||ae.distanceToSquared(i.target)>0?(i.dispatchEvent({type:"change"}),it.copy(i.object.position),It.copy(i.object.quaternion),ae.copy(i.target),bs=!1,!0):!1}}();let i=this,s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=s.NONE,n=1e-6,r=new b.Spherical,h=new b.Spherical,c=1,l=new b.Vector3,p=new b.Vector2,d=new b.Vector2,u=new b.Vector2,m=new b.Vector2,v=new b.Vector2,g=new b.Vector2,x=new b.Vector2,M=new b.Vector2,P=new b.Vector2,C=new b.Vector3,S=new b.Vector2,G=!1,E=[],nt={};function Tt(y){return y!==null?2*Math.PI/60*i.autoRotateSpeed*y:2*Math.PI/60/60*i.autoRotateSpeed}function gt(){return Math.pow(.95,i.zoomSpeed)}function Ot(y){h.theta-=y}function kt(y){h.phi-=y}let oe=function(){let y=new b.Vector3;return function(N,it){y.setFromMatrixColumn(it,0),y.multiplyScalar(-N),l.add(y)}}(),Se=function(){let y=new b.Vector3;return function(N,it){i.screenSpacePanning===!0?y.setFromMatrixColumn(it,1):(y.setFromMatrixColumn(it,0),y.crossVectors(i.object.up,y)),y.multiplyScalar(N),l.add(y)}}(),ht=function(){let y=new b.Vector3;return function(N,it){let It=i.domElement;if(i.object.isPerspectiveCamera){let ae=i.object.position;y.copy(ae).sub(i.target);let Jt=y.length();Jt*=Math.tan(i.object.fov/2*Math.PI/180),oe(2*N*Jt/It.clientHeight,i.object.matrix),Se(2*it*Jt/It.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(oe(N*(i.object.right-i.object.left)/i.object.zoom/It.clientWidth,i.object.matrix),Se(it*(i.object.top-i.object.bottom)/i.object.zoom/It.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function $e(y){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c/=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function wi(y){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c*=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function U(y){if(!i.zoomToCursor)return;G=!0;let _=i.domElement.getBoundingClientRect(),N=y.clientX-_.left,it=y.clientY-_.top,It=_.width,ae=_.height;S.x=N/It*2-1,S.y=-(it/ae)*2+1,C.set(S.x,S.y,1).unproject(i.object).sub(i.object.position).normalize()}function H(y){return Math.max(i.minDistance,Math.min(i.maxDistance,y))}function et(y){p.set(y.clientX,y.clientY)}function J(y){U(y),x.set(y.clientX,y.clientY)}function ne(y){m.set(y.clientX,y.clientY)}function re(y){d.set(y.clientX,y.clientY),u.subVectors(d,p).multiplyScalar(i.rotateSpeed);let _=i.domElement;Ot(2*Math.PI*u.x/_.clientHeight),kt(2*Math.PI*u.y/_.clientHeight),p.copy(d),i.update()}function Ee(y){M.set(y.clientX,y.clientY),P.subVectors(M,x),P.y>0?$e(gt()):P.y<0&&wi(gt()),x.copy(M),i.update()}function ge(y){v.set(y.clientX,y.clientY),g.subVectors(v,m).multiplyScalar(i.panSpeed),ht(g.x,g.y),m.copy(v),i.update()}function Mi(y){U(y),y.deltaY<0?wi(gt()):y.deltaY>0&&$e(gt()),i.update()}function La(y){let _=!1;switch(y.code){case i.keys.UP:y.ctrlKey||y.metaKey||y.shiftKey?kt(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(0,i.keyPanSpeed),_=!0;break;case i.keys.BOTTOM:y.ctrlKey||y.metaKey||y.shiftKey?kt(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(0,-i.keyPanSpeed),_=!0;break;case i.keys.LEFT:y.ctrlKey||y.metaKey||y.shiftKey?Ot(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(i.keyPanSpeed,0),_=!0;break;case i.keys.RIGHT:y.ctrlKey||y.metaKey||y.shiftKey?Ot(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):ht(-i.keyPanSpeed,0),_=!0;break}_&&(y.preventDefault(),i.update())}function Dn(){if(E.length===1)p.set(E[0].pageX,E[0].pageY);else{let y=(E[0].pageX-E[0].pageY)/(E[1].pageX-E[1].pageY),_=E[0].pageY-y*E[0].pageX;i.rotateLineStart.set(y,_);let N=.5*(E[0].pageX+E[1].pageX),it=.5*(E[0].pageY+E[1].pageY);p.set(N,it)}}function An(){if(E.length===1)m.set(E[0].pageX,E[0].pageY);else{let y=.5*(E[0].pageX+E[1].pageX),_=.5*(E[0].pageY+E[1].pageY);m.set(y,_)}}function On(){let y=E[0].pageX-E[1].pageX,_=E[0].pageY-E[1].pageY,N=Math.sqrt(y*y+_*_);x.set(0,N)}function Ca(){i.enableZoom&&On(),i.enablePan&&An()}function Ta(){i.enableZoom&&On(),i.enableRotate&&Dn()}function In(y){if(E.length==1)d.set(y.pageX,y.pageY);else{let N=yo(y),it=.5*(y.pageX+N.x),It=.5*(y.pageY+N.y);d.set(it,It);let ae=(y.pageY-N.y)/(y.pageX-N.x),Jt=N.y-ae*N.x;if(i.rotateLineEnd.set(ae,Jt),Number.isFinite(i.rotateLineEnd.x)&&Number.isFinite(i.rotateLineStart.x)){let vo=(i.rotateLineStart.y-i.rotateLineEnd.y)/(i.rotateLineEnd.x-i.rotateLineStart.x),_i=ae*vo+Jt;if(Number.isFinite(vo)&&Number.isFinite(_i)){let ye=Math.atan(i.rotateLineEnd.x)-Math.atan(i.rotateLineStart.x);Math.PI-Math.abs(ye)<.5&&(ye=-Math.sign(ye)*(Math.PI-Math.abs(ye))),Math.abs(ye)<.1&&(h.theta+=ye)}}i.rotateLineStart.copy(i.rotateLineEnd)}u.subVectors(d,p).multiplyScalar(i.rotateSpeed);let _=i.domElement;kt(2*Math.PI*u.y/_.clientHeight),p.copy(d)}function Rn(y){if(E.length===1)v.set(y.pageX,y.pageY);else{let _=yo(y),N=.5*(y.pageX+_.x),it=.5*(y.pageY+_.y);v.set(N,it)}g.subVectors(v,m).multiplyScalar(i.panSpeed),ht(g.x,g.y),m.copy(v)}function Gn(y){let _=yo(y),N=y.pageX-_.x,it=y.pageY-_.y,It=Math.sqrt(N*N+it*it);M.set(0,It),P.set(0,Math.pow(M.y/x.y,i.zoomSpeed)),$e(P.y),x.copy(M)}function ka(y){i.enableZoom&&Gn(y),i.enablePan&&Rn(y)}function Da(y){i.enableZoom&&Gn(y),i.enableRotate&&In(y)}this.onPointerDown=function(_){i.enabled!==!1&&(E.length===0&&(i.domElement.setPointerCapture(_.pointerId),i.domElement.addEventListener("pointermove",i.onPointerMove),i.domElement.addEventListener("pointerup",i.onPointerUp)),Ga(_),_.pointerType==="touch"?Ia(_):Aa(_))},this.onPointerMove=function(_){i.enabled!==!1&&(_.pointerType==="touch"?Ra(_):Oa(_))},this.onPointerUp=function(_){Fa(_),E.length===0&&(i.domElement.releasePointerCapture(_.pointerId),i.domElement.removeEventListener("pointermove",i.onPointerMove),i.domElement.removeEventListener("pointerup",i.onPointerUp)),i.dispatchEvent({type:"end"}),o=s.NONE};function Aa(y){let _;switch(y.button){case 0:_=i.mouseButtons.LEFT;break;case 1:_=i.mouseButtons.MIDDLE;break;case 2:_=i.mouseButtons.RIGHT;break;default:_=-1}switch(_){case b.MOUSE.DOLLY:if(i.enableZoom===!1)return;J(y),o=s.DOLLY;break;case b.MOUSE.ROTATE:if(y.ctrlKey||y.metaKey||y.shiftKey){if(i.enablePan===!1)return;ne(y),o=s.PAN}else{if(i.enableRotate===!1)return;et(y),o=s.ROTATE}break;case b.MOUSE.PAN:if(y.ctrlKey||y.metaKey||y.shiftKey){if(i.enableRotate===!1)return;et(y),o=s.ROTATE}else{if(i.enablePan===!1)return;ne(y),o=s.PAN}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent({type:"start"})}function Oa(y){switch(o){case s.ROTATE:if(i.enableRotate===!1)return;re(y);break;case s.DOLLY:if(i.enableZoom===!1)return;Ee(y);break;case s.PAN:if(i.enablePan===!1)return;ge(y);break}}this.onMouseWheel=function(_){i.enabled===!1||i.enableZoom===!1||o!==s.NONE||(_.preventDefault(),i.dispatchEvent({type:"start"}),Mi(_),i.dispatchEvent({type:"end"}))},this.onKeyDown=function(_){i.enabled===!1||i.enablePan===!1||La(_)};function Ia(y){switch(Fn(y),E.length){case 1:switch(i.touches.ONE){case b.TOUCH.ROTATE:if(i.enableRotate===!1)return;Dn(),o=s.TOUCH_ROTATE;break;case b.TOUCH.PAN:if(i.enablePan===!1)return;An(),o=s.TOUCH_PAN;break;default:o=s.NONE}break;case 2:switch(i.touches.TWO){case b.TOUCH.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Ca(),o=s.TOUCH_DOLLY_PAN;break;case b.TOUCH.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Ta(),o=s.TOUCH_DOLLY_ROTATE;break;default:o=s.NONE}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent({type:"start"})}function Ra(y){switch(Fn(y),o){case s.TOUCH_ROTATE:if(i.enableRotate===!1)return;In(y),i.update();break;case s.TOUCH_PAN:if(i.enablePan===!1)return;Rn(y),i.update();break;case s.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;ka(y),i.update();break;case s.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Da(y),i.update();break;default:o=s.NONE}}this.onContextMenu=function(_){i.enabled!==!1&&_.preventDefault()};function Ga(y){E.push(y)}function Fa(y){delete nt[y.pointerId];for(let _=0;_<E.length;_++)if(E[_].pointerId==y.pointerId){E.splice(_,1);return}}function Fn(y){let _=nt[y.pointerId];_===void 0&&(_=new b.Vector2,nt[y.pointerId]=_),_.set(y.pageX,y.pageY)}function yo(y){let _=y.pointerId===E[0].pointerId?E[1]:E[0];return nt[_.pointerId]}i.domElement.addEventListener("contextmenu",this.onContextMenu),i.domElement.addEventListener("pointerdown",this.onPointerDown),i.domElement.addEventListener("pointercancel",this.onPointerUp),i.domElement.addEventListener("wheel",this.onMouseWheel,{passive:!1}),this.update()}};var cs=class extends qs{registryEvent(){this.addEventListener("change",this.onChange),this.context.addEventListener("update",this.tweenUpdate)}unRegistryEvent(){this.removeEventListener("change",this.onChange),this.context.removeEventListener("update",this.tweenUpdate)}setPolarAngle(t,e){e===void 0&&(e=!1);let{maxPolarAngle:i,minPolarAngle:s}=this,o=i===s;(e||t<=i&&t>=s)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=i,this.minPolarAngle=s)}setPolarAngleByDuration(t,e,i){return f(this,null,function*(){return e===void 0&&(e=!1),i===void 0&&(i=500),i<=0?this.setPolarAngle(t,e):Gt(new Promise(s=>{let o={polar:this.getPolarAngle()},n={polar:t},r=new Ye.Tween(o,this.tweenGroup).to(n,i).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(r),s(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:i,minAzimuthAngle:s}=this,o=i===s;(e||t<=i&&t>=s)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=i,this.minAzimuthAngle=s)}setAzimuthalAngleDuration(t,e,i){return e===void 0&&(e=!1),i===void 0&&(i=500),i<=0?this.setAzimuthalAngle(t,e):Gt(new Promise(s=>{let o={azimuthal:this.getAzimuthalAngle()},n={azimuthal:t},r=new Ye.Tween(o,this.tweenGroup).to(n,i).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(r),s(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500)}getCameraLookAt(){return new tn.Vector3().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return f(this,null,function*(){let i=this.target.clone(),s=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(s)),this.target.copy(t.clone()),this.update();return}return Gt(new Promise(o=>{let n=new Ye.Tween(i,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(i.clone().sub(s)),this.target.copy(i.clone()),this.update()}).onComplete(()=>{this.tweenGroup.remove(n),this.enabled=!0,o(!0)}).onStart(()=>{this.enabled=!1}).start()}),e+500)})}setZoom(t,e,i){i===void 0&&(i=!1);let{minZoom:s,maxZoom:o}=this;(i||t>=s&&t<=o)&&(this.camera.position.copy(e.clone().sub(this.getCameraLookAt())),this.target.copy(e),this.camera.zoom=t,this.update())}setZoomByDuration(t,e,i,s){return f(this,null,function*(){i===void 0&&(i=!1),s===void 0&&(s=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return s?Gt(new Promise(n=>{let r=new Ye.Tween(o,this.tweenGroup).to({zoom:t,target:e},s).onUpdate(()=>{this.setZoom(o.zoom,o.target,i)}).onComplete(()=>{this.tweenGroup.remove(r),this.enabled=!0,n(!0)}).onStart(()=>{this.enabled=!1}).start()}),s+500).finally(()=>{this.enabled=!0}):this.setZoom(t,e,i)})}setTargetByOffset(t,e){if(e===void 0&&(e=this.target.clone()),this.camera.updateMatrix(),t){let i=new tn.Vector3;i.setFromMatrixColumn(this.camera.matrix,1),i.normalize(),i.multiplyScalar(t/this.camera.zoom),e.add(i)}this.setCameraPositionByTarget(e,0)}clearTween(){this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll()}dispose(){super.dispose(),this.unRegistryEvent(),this.clearTween()}constructor(t,e,i){super(e,i),this.context=t,this.camera=e,this.domElement=i,this.prevCameraZoom=1,this.tweenGroup=new Ye.Group,this.offsetY=0,this.onChange=()=>{let s=this.camera.zoom;s!==this.prevCameraZoom&&(this.prevCameraZoom=s,this.dispatchEvent({type:"change-zoom",zoom:s}))},this.tweenUpdate=()=>{this.tweenGroup.update()},this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=e.zoom,this.registryEvent()}};var pi=require("three");var ls=class extends pi.WebGLRenderer{setCameraAndScene(t,e){this.scene=t,this.camera=e}autoRender(){if(this.scene&&this.camera&&this.enable&&(this.event.dispatchEvent({type:"update"}),this.render(this.scene,this.camera)),this.context.config.renderAnimation==="requestAnimationFrame")this.timer.requestAnimationFrame(()=>{this.autoRender()});else{let t=1e3/this.context.config.fps;this.timer.setTimeout(()=>{this.autoRender()},t)}}pauseRender(){this.enable=!1}continueRender(){this.enable=!0}addEventListener(t,e){this.event.addEventListener(t,e)}removeEventListener(t,e){this.event.removeEventListener(t,e)}constructor(t,e){super(w({antialias:!0,alpha:!0},e)),this.context=t,this.event=new pi.EventDispatcher,this.enable=!0,this.timer=new j,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.toneMapping=pi.LinearToneMapping,this.toneMappingExposure=1;let i=this.dispose;this.dispose=()=>{this.timer.dispose(),this.enable=!1,i.call(this),this.domElement.remove(),this.domElement=null,this.shadowMap=null,this.info.programs&&(this.info.programs.length=0),this.info=null}}};var sa=require("three");var ta=require("three"),ea=require("three/examples/jsm/environments/RoomEnvironment.js");function ia(a,t){t===void 0&&(t=.85);let e=new ta.PMREMGenerator(a);return e.compileEquirectangularShader(),e.fromScene(new ea.RoomEnvironment).texture}var ps=class extends sa.Scene{dispose(){var t;(t=this.environment)==null||t.dispose(),this.environment=null,I(this),this.clear()}constructor(t){super(),this.environment=ia(t)}};var oa=require("three"),ds=class extends oa.OrthographicCamera{constructor(t,e){super(-t/2,t/2,e/2,-e/2,-1e4,5e4),this.up.set(0,0,1),this.position.set(0,0,100),this.lookAt(0,0,0)}};var en=require("@turf/turf");var Fx=require("core-js/modules/es.array.unshift.js"),zx=require("core-js/modules/es.array.push.js"),na=require("three"),$s=class{registryEvent(){this.context.addEventListener("update",this.onUpdate),this.context.addEventListener("control-change",this.onControlChange),this.context.addEventListener("resize",this.onControlChange)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate),this.context.removeEventListener("control-change",this.onControlChange),this.context.removeEventListener("resize",this.onControlChange)}changePoiLevelOrCollisionEnable(t){let e=this.objects.findIndex(i=>i===t);e!==-1&&(this.objects.splice(e,1),this.addObject(t))}addObject(t){if(!this.objects.includes(t)){if(this.needsUpdate=!0,!t.options.collision_enable){this.objects.unshift(t);return}if(t.options.level===0){this.objects.push(t);return}for(let e=0;e<this.objects.length;e++){let i=this.objects[e];if(i.options.collision_enable&&i.options.level<=t.options.level){this.objects.splice(e,0,t);return}}this.objects.push(t)}}removeObject(t){let e=this.objects.indexOf(t);e!==-1&&(this.objects.splice(e,1),this.needsUpdate=!0)}removeObjects(t){this.objects=this.objects.filter(e=>!t.includes(e)),this.needsUpdate=!0}getObjectById(t){return this.objects.find(e=>e.options.id===t)||null}validShowParkingSpace(t){t===void 0&&(t=60);let{clientSize:{width:e,height:i},control:s,camera:o}=this.context,n=Math.min(e/t,i/t,s.maxZoom-1);return o.zoom>=n}detectCollisions(){if(!this.needsUpdate)return;let t=[],{camera:e}=this.context;e.updateMatrixWorld();let i=l=>l<=1&&l>=-1,s=e.projectionMatrix.clone();s.multiply(e.matrixWorldInverse);let o=e.zoom/this.context.basicZoom,n=25/30,r=Math.min(25,Math.max(1,o*n)),h=this.validShowParkingSpace();this.objects.filter(l=>{if(l.visible){if(!(r<=l.options.maxWeight&&r>=l.options.minWeight)||!h&&l.userData.type==="parkingSpace")return l.parentSetVisible(!1),!1;let p=l.getWorldPosition(new na.Vector3);return p.applyMatrix4(s),l.screenPosition=p,i(p.x)&&i(p.y)&&i(p.z)?!0:(l.parentSetVisible(!1),!1)}return!1}).forEach((l,p)=>{let d=l.getBox(l.screenPosition);if(d===null){l.parentSetVisible(!1);return}if(p===0||!l.options.collision_enable){t.push(d),l.parentSetVisible(!0);return}let u=t.some(m=>m.intersectsBox(d));l.parentSetVisible(!u),u||t.push(d)}),this.needsUpdate=!1}markForUpdate(){this.needsUpdate=!0}clear(){this.objects=[],this.needsUpdate=!0}dispose(){this.objects=[],this.unRegistryEvent()}constructor(t){this.context=t,this.objects=[],this.needsUpdate=!0,this.onUpdate=()=>{this.detectCollisions()},this.onControlChange=()=>{this.needsUpdate=!0},this.registryEvent()}};var us=class extends z.EventDispatcher{get config(){return this.bmap.config}get center(){return this.bmap.buildingCenter}setRange(t){this.range=(0,en.polygon)([t])}resizeClientSize(){let{x:t,y:e,width:i,height:s}=this.container.getBoundingClientRect();this.clientSize={width:i||this.container.clientWidth,height:s||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new ds(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new cs(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 Xs(this)}getRatio(t,e){t===void 0&&(t=new z.Vector3(0,0,0)),e===void 0&&(e=new z.Vector3(100,0,0));let{clientWidth:i,clientHeight:s}=this.container,o=D(t,this.camera,i,s),n=D(e,this.camera,i,s);return Math.ceil(Math.sqrt((n.x-o.x)**2+(n.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof z.AmbientLight&&(e.color=new z.Color(t))})}switchFloor(t,e){e===void 0&&(e=!0),console.log("switchFloor",e),this.currentFloor&&(this.scene.remove(this.currentFloor),e?this.currentFloor.dispose():this.currentFloor.onRemoveFromScene()),this.currentFloor=t,this.setRange(t.userData.range||[]),this.scene.add(t),t.onAddToScene("scene"),this.cameraBound.updateBox()}getGraphicsByDeviceXy(t,e){var i;let s=new z.Vector2;s.x=t/this.clientSize.width*2-1,s.y=e/this.clientSize.height*-2+1;let o=new z.Raycaster;return o.setFromCamera(s,this.camera),o.ray.origin.sub(o.ray.direction.clone().multiplyScalar(100)),((i=this.currentFloor)==null?void 0:i.graphicLayer.getGraphicByRaycaster(o))||{graphics:[],position:null}}getPoisByDeviceXy(t,e){var i,s;let o=(i=this.currentFloor)==null?void 0:i.poiLayer.getPoiByDeviceXy(t,e),n=(s=this.currentFloor)==null?void 0:s.poiLayer2.getPoiByDeviceXy(t,e);return(o||[]).concat(n||[])}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,i){return i===void 0&&(i=500),this.control.setZoomByDuration(t,e,!0,i)}getFitCameraToObjectZoom(t,e,i){return e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=!0),this.getFitCameraToBoxZoom(new z.Box3().setFromObject(t),e,i)}getFitCameraToBoxZoom(t,e,i){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=!0);let[s,o,n,r]=e,{clientSize:{width:h,height:c}}=this,l=this.control.getPolarAngle();i&&this.setPolarAngle(0,0),this.setPolarAngle(l,0),this.camera.updateMatrixWorld(),this.camera.updateProjectionMatrix();let{max:p,min:d}=t,u=new z.Vector3(d.x,p.y,p.z),m=new z.Vector3(p.x,p.y,p.z),v=new z.Vector3(p.x,d.y,d.z),g=new z.Vector3(d.x,d.y,d.z),x=D(u,this.camera,h,c),M=D(m,this.camera,h,c),P=D(g,this.camera,h,c),C=D(v,this.camera,h,c),G=new z.Box2().setFromPoints([new z.Vector2(x.x,x.y),new z.Vector2(M.x,M.y),new z.Vector2(P.x,P.y),new z.Vector2(C.x,C.y)]).getSize(new z.Vector2),E=(h-o-r)/G.x,nt=(c-s-n)/G.y,Tt=Math.min(E,nt),gt=new z.Vector3((p.x+d.x)/2,(p.y+d.y)/2,(p.z+d.z)/2),Ot=Tt*this.camera.zoom,kt=this.camera.clone();kt.zoom=Ot,kt.updateMatrix();let oe=(o-r)/2,Se=(s-n)/2;if(oe){let ht=new z.Vector3;ht.setFromMatrixColumn(kt.matrix,0),ht.normalize(),ht.multiplyScalar(oe/Ot),gt.add(ht)}if(Se){let ht=new z.Vector3;ht.setFromMatrixColumn(kt.matrix,1),ht.normalize(),ht.multiplyScalar(Se/Ot),gt.add(ht)}return{zoom:Tt*this.camera.zoom,center:gt}}fitCameraToObject(t,e,i,s){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500),s===void 0&&(s=!0);let{zoom:o,center:n}=this.getFitCameraToObjectZoom(t,e,s);return this.setZoom(o,n,i)}fitCameraToBox(t,e,i,s){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500),s===void 0&&(s=!0);let{zoom:o,center:n}=this.getFitCameraToBoxZoom(t,e,s);return this.setZoom(o,n,i)}getFitCameraToGroundZoom(t,e,i){if(t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),i===void 0&&(i=!0),this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,i).zoom}fitCameraToGround(t,e,i){return t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),i===void 0&&(i=!0),this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundLayer,t,e,i):Promise.resolve(!1)}setCameraPosition(t,e){return f(this,null,function*(){return this.control.setCameraPositionByTarget(t,e)})}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}forceUpdate(){this.collisionSystem.needsUpdate=!0}dispose(){var t;this.collisionSystem.dispose(),(t=this.currentFloor)==null||t.dispose(),this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.dispose(),this.lights.children.forEach(e=>e.dispose()),this.scene.dispose(),this.container=null,this.renderer=null}constructor(t,e){super(),this.container=t,this.lights=Mo(),this.range=(0,en.polygon)([]),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=i=>{let{zoom:s}=i;this.dispatchEvent({type:"control-zoom-change",zoom:s})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:i,camera:s,renderer:o}=this,{clientWidth:n,clientHeight:r}=i;n=Math.max(1,n),r=Math.max(1,r),s.left=-n/2,s.right=n/2,s.top=r/2,s.bottom=-r/2,s.updateProjectionMatrix(),o.setSize(n,r),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:n,height:r})},this.onClick=i=>{let{graphics:s,position:o}=this.getGraphicsByDeviceXy(i.offsetX,i.offsetY);s.length&&this.dispatchEvent({type:"graphic-click",graphics:s,position:o});let n=this.getPoisByDeviceXy(i.offsetX,i.offsetY);n.length&&this.dispatchEvent({type:"poi-click",pois:n})},this.onPointerover=i=>{let{graphics:s,position:o}=this.getGraphicsByDeviceXy(i.offsetX,i.offsetY),n=this.getPoisByDeviceXy(i.offsetX,i.offsetY);this.dispatchEvent({type:"pointer-over",e:i,graphics:s,pois:n,position:o})},this.onPointermove=i=>{let{graphics:s,position:o}=this.getGraphicsByDeviceXy(i.offsetX,i.offsetY),n=this.getPoisByDeviceXy(i.offsetX,i.offsetY);this.dispatchEvent({type:"pointer-move",e:i,graphics:s,pois:n,position:o})},this.onPointerleave=i=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=i=>{let{graphics:s,isMultipleSelect:o}=i;this.dispatchEvent({type:"select-graphic",graphics:s,isMultipleSelect:o})},this.onHoverChange=i=>{let{graphics:s}=i;this.dispatchEvent({type:"hover",graphics:s})},this.bmap=e,this.container.style.position="relative",this.container.style.overflow="hidden",this.renderer=new ls(this),this.scene=new ps(this.renderer),this.collisionSystem=new $s(this),this.init(),this.selection=new rs(this),this.hoverHelper=new as(this),this.resizeClientSize(),this.registryEvent()}};var ra=require("lodash"),aa={placeId:0,fps:30,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:{enable:!1,debounceTime:5},initTransToMark:!1,heatMap:{radius:50,minOpacity:.1,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0,maxZoomScale:30},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},renderAnimation:"setTimeout"};function sn(a){return typeof a.resizeObserver=="boolean"&&(a.resizeObserver={enable:a.resizeObserver}),(0,ra.merge)({},aa,a)}var pa=require("lodash");var p0=require("core-js/modules/web.dom-collections.iterator.js");var to=require("three");var s0=require("core-js/modules/es.array.push.js"),o0=require("core-js/modules/web.dom-collections.iterator.js");var Qx=require("core-js/modules/es.array.sort.js");var di=function(a){return a.LAYERED_RENDER_VERSION="layeredRender",a.MERGED_RENDER_VERSION="mergedRender",a}({});function Js(a,t){let e=a.poi_info.showName||a.store_name||a.poi_info.text;switch(t){case"zh-cn":return e;case"en":var i;return((i=a.store_info_ext)==null?void 0:i.poi_name)||e;case"zh-hk":var s;return((s=a.store_info_ext)==null?void 0:s.traditional_name)||e}}function Qs(a,t){let e=a.poi_info.showName||a.store_name||a.poi_info.text;switch(t){case"zh-cn":return e;case"en":var i;return((i=a.infra_info_ext)==null?void 0:i.poi_name)||e;case"zh-hk":var s;return((s=a.infra_info_ext)==null?void 0:s.traditional_name)||e}}var on=["range","ground","store","facility","parkingSpace"];function ha(a){return on.indexOf(a.l_type)===-1?on.length:on.indexOf(a.l_type)}function Th(a){a.layers.sort((t,e)=>ha(t)-ha(e))}function kh(a){let t=a.layers.find(i=>i.l_type==="range"),e=[t.elements[0].center_x,t.elements[0].center_y];a.layers.map(i=>{if(i.l_type!=="range")return Ii(i.elements,e)})}function ms(a){Th(a),kh(a)}function ui(a,t){return t===void 0&&(t=6),a.floor_id+"_"+a.version_id+(t?"_"+t:"")}function ca(a,t,e){switch(a.l_type){case"ground":return nn(a,t);case"graph":return Dh(a,t,e);case"wall":return Ah(a,t);case"lane":return Oh(a,t);case"texture2d":case"texture3d":return Ih(a,t);case"glb":return Rh(a,t);case"store":return Gh(a,t,e);case"facility":return zh(a,t,e);case"parkingSpace":return Wh(a,t,e);case"text":return Hh(a,t)}}function la(a,t,e,i,s){switch(a.l_type){case"store":return Fh(a,t,e,i,s);case"facility":return Bh(a,t,e,i,s);case"parkingSpace":return Uh(a,t,i,s)}}function Dh(a,t,e){e.mergeGraphic?t.mergeGraphicLayer.addGraphics(a.elements,a.mergedElements):a.elements.map(i=>{let s=t.addGraphic(w({},i,{dashed:!1}));t.userData.graphics.push(s),t.userData.graphicMap.set(i.id,s)})}function nn(a,t){let e=a.elements.map(i=>new lt(t.context,w({},i,{dashed:!1})));t.addGrounds(e)}function Ah(a,t){if(a.mergedElements)a.mergedElements.map(e=>{if(e.instancedGeometry){let i=new ns(t.context,e.instancedGeometry);t.wallLayer.add(i)}if(e.mergedGeometry){let i=new ss(t.context,e);t.wallLayer.add(i)}});else{let e=a.elements.reduce((i,s)=>{let{fillColor:o,fillOpacity:n,strokeColor:r,strokeOpacity:h,height:c}=s,l=o.toLowerCase()+"-"+n+"-"+r.toLowerCase()+"-"+h+"-"+c;return h===0&&(l=o.toLowerCase()+"-"+n+"-"+c),i[l]?i[l].push(s):i[l]=[s],i},{});Object.values(e).forEach(i=>{let s=new ts(t.context,i);t.wallLayer.add(s)})}}function Oh(a,t){if(a.mergedElements){let e=new os(t.context,a.mergedElements);t.laneLayer.add(e)}else{let e=new es(t.context,a.elements);t.laneLayer.add(e)}}function Ih(a,t){if(a.mergedMatrixes)a.mergedMatrixes.map(e=>{let i=new Oe(t.context,e);t.textureLayer.add(i)});else if(a.elements.length){let e=new Ae(t.context,a.elements);t.textureLayer.add(e)}}function Rh(a,t){t.glbModelLayer.addModels(a.elements.map(e=>w({},e,{url:e.secondUrl,rotate:e.secondRotate,width:e.secondWidth,center_x:e.center_coord_x,center_y:e.center_coord_y,deltaHeight:0})))}function Gh(a,t,e){e.mergeGraphic?t.mergeGraphicLayer.addGraphics(a.elements,a.mergedElements):a.elements.map(i=>{let s=t.addGraphic(w({},i,{dashed:!1}));t.userData.graphics.push(s),t.userData.graphicMap.set(i.id,s)})}function Fh(a,t,e,i,s){a.elements.filter(o=>s.filterPoi(o)).map(o=>{try{let n=Js(o,e),r=new tt(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:n,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:!i.showStoreName,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1,text_font_size:i.textFontSize});t.poiLayer2.pushPoi(r),r&&(r.userData.type="store",r.userData.data=o,r.userData.floor=t.name)}catch(n){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",n,o)}})}function zh(a,t,e){e.mergeGraphic?t.mergeGraphicLayer.addGraphics(a.elements,a.mergedElements):a.elements.map(i=>{let s=t.addGraphic(w({},i,{dashed:!1}));t.userData.graphics.push(s),t.userData.graphicMap.set(i.id,s)})}function Bh(a,t,e,i,s){a.elements.filter(o=>o.poi_info).filter(o=>s.filterPoi(o)).map(o=>{try{let n=Qs(o,e),r=new tt(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:n,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:!i.showFacilityName,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1,text_font_size:i.textFontSize});t.poiLayer2.pushPoi(r),r.userData.type="facility",r.userData.data=o,r.userData.floor=t.name}catch(n){console.log("\u6DFB\u52A0facility\u5931\u8D25",n,o)}})}function Wh(a,t,e){t.parkingSpaceLayer.load(a,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function Uh(a,t,e,i){return f(this,null,function*(){a.elements.filter(o=>o.texts[0]).filter(o=>i.filterPoi(o)).forEach(o=>{try{let n=o.displayName||o.texts[0],r=new tt(t.context,{id:o.id,text:n,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},text_font_size:e.textFontSize});r&&(r.userData.type="parkingSpace",r.userData.data=o,r.userData.floor=t.name),t.poiLayer2.pushPoi(r)}catch(n){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",n,o)}})})}function Hh(a,t){let e=new is(t.context,a.elements.map(i=>w({},i,{center_x:i.center_coord_x,center_y:i.center_coord_y})));t.textTextureLayer.add(e)}var Nh={};function rn(){return new Worker(new URL("./worker/loader.worker-XI4MI7KE.js",Nh.url))}var Zh={mergeParkingSpace:!0,mergeGraphic:!0,renderVersion:di.MERGED_RENDER_VERSION,layers:["graph","wall","lane","texture2d","texture3d","glb","store","facility","parkingSpace","text"],filterPoi:()=>!0},qe=class extends st{initDb(){return f(this,null,function*(){try{let{db:t}=yield Os();this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return f(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=w({},this.placeConfig,e));else if(typeof t=="string"){let i=yield fetch(t).then(s=>s.json());i.code===200&&(this.floors=i.data.list,this.placeConfig=w({},this.placeConfig,JSON.parse(i.data.config||"{}"),e))}else return this.load("https://screen.aibee.cn/ai-map/map/get-floor-map?place_id="+t,e);this.getOtherDataByFreeTime()})}setCacheData(t,e,i){return f(this,null,function*(){return this.initDbPromise.then(()=>zi(t,""+e,i))})}getCacheData(t,e){return f(this,null,function*(){return this.initDbPromise.then(()=>ei(t,""+e))})}getFloorData(t){return f(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return f(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=Js(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=Qs(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return f(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(i=>f(this,null,function*(){let s=ui(t),o=yield fetch(t.map_url).then(n=>n.json());o.floor=t.floor,ms(o),this.setCacheData(xt.MAP_DATA,s,o),this.setCacheData(xt.MAP_VERSION,s,t.version_id),i(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return f(this,null,function*(){let e=this.floors.find(i=>i.floor===t);return e?new Promise(i=>f(this,null,function*(){let s=ui(e,this.options.renderVersion===di.LAYERED_RENDER_VERSION?1:void 0);try{let o=ui(e),n=yield this.getCacheData(xt.MAP_DATA,o);if(n&&n.transformed){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u5408\u5E76\u540E\u7684\u6570\u636E"),i(n);return}if(this.options.renderVersion===di.LAYERED_RENDER_VERSION){let r=yield this.getCacheData(xt.MAP_DATA,s);if(r){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u6570\u636E"),i(r);return}}if(console.log("\u7F13\u5B58\u4E2D\u6CA1\u6709\u6570\u636E"),this.loadWorker){Z(this.loadWorker,"adjust_floor_priority",{floor:t});let r=h=>{if(h.data.type==="floor_success"&&h.data.data.floor===t){var c;(c=this.loadWorker)==null||c.removeEventListener("message",r),i(this.getFloorJsonData(t))}};this.loadWorker.addEventListener("message",r)}else i(this.getFloorJsonDataByFloorInfo(e))}catch(o){console.log("[get floor data error]",o),i(this.getFloorJsonDataByFloorInfo(e))}})):null})}getRoadNetworkData(){return f(this,null,function*(){return(yield Promise.all(this.floors.map(e=>f(this,null,function*(){let i=ui(e,0);try{let s=yield this.getCacheData(xt.ROAD_NETWORK_DATA,i);if(s)return s;let o=yield fetch(e.route_url).then(n=>n.json());return this.setCacheData(xt.ROAD_NETWORK_DATA,i,o),this.setCacheData(xt.ROUTE_VERSION,i,e.version_id),o}catch(s){let o=yield fetch(e.route_url).then(n=>n.json());return this.setCacheData(xt.ROAD_NETWORK_DATA,i,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return f(this,null,function*(){let t=this.floors.reduce((s,o)=>s.updated_at>o.updated_at?s:o,this.floors[0]);if(!t)return null;let e=ui(t,0),i=()=>f(this,null,function*(){let s=yield fetch(t.entry_infra_url).then(o=>o.json());return s&&(this.setCacheData(xt.FACILITY_DATA,e,s),this.setCacheData(xt.FACILITY_VERSION,e,t.version_id)),s});try{let s=yield this.getCacheData(xt.FACILITY_DATA,e);return s||i()}catch(s){return console.log("[get facility error]",s),i()}})}getOtherDataByFreeTime(){return f(this,null,function*(){yield this.initDbPromise,this.loadWorker&&(yield Z(this.loadWorker,"load",{floors:this.floors,version:this.options.renderVersion})),this.closeWorker()})}getMulFloorsData(t){return f(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(i=>i))})}getDataByUrl(t){return f(this,null,function*(){let e=yield fetch(t).then(i=>i.json());return this.getDataByJson(e)})}getDataByJson(t,e,i){return f(this,null,function*(){ms(t),e=this.getFloorBaseLayer(t,e);let s=w({},this.placeConfig,i);return yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,s),this.changeFloorBox(t,e),e})}getDataByJsonStep(t,e,i){return f(this,null,function*(){ms(t),e=this.getFloorBaseLayer(t,e);let s=w({},this.placeConfig,i);return this.changeFloorBox(t,e),requestAnimationFrame(()=>f(this,null,function*(){yield this.getFloorContentLayer(t,e),this.changeFloorBox(t,e),requestAnimationFrame(()=>f(this,null,function*(){yield this.getFloorPoi(t,e,s),this.changeFloorBox(t,e)}))})),e})}changeFloorBox(t,e){e.updateBox();let i=e.box.getSize(new to.Vector3),s=Math.max(i.x,i.y,i.z);e.userData.height=s/4+t.floorHeight}switchFloor(t,e){return f(this,null,function*(){return new Promise(i=>{let s={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(s),n=r=>{let{task:h,res:c}=r;h.tid===o&&(this.taskQueue.removeEventListener("active-task-end",n),i(c))};this.taskQueue.addEventListener("active-task-end",n)})})}_switchFloor(t,e){return f(this,null,function*(){var i;let s=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)s=l;else return null}else ms(t);let o=w({},this.placeConfig,e),n=new ie(this.bmap.context);n.userData.data=t;let r=this.floors.find(l=>l.floor===s.floor);var h;let c=(h=r==null?void 0:r.map_angle)!=null?h:0;return this.bmap.dispatchEvent({type:yt.SWITCH_FLOOR_BEFORE,data:{curFloor:n,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:n,graphics:[],floorData:s}}),this.bmap.context.scene.background=new to.Color(o.backgroundColor),this.getFloorBaseLayer(s,n),this.changeFloorBox(s,n),this.bmap.buildingCenter=n.userData.center,this.bmap.currentBuildGround=(i=n.userData.data.layers.find(l=>l.l_type==="range"))==null?void 0:i.elements[0],this.bmap.context.switchFloor(n),this.bmap.config.control.defaultAzimuthal=c/180*Math.PI,this.bmap.initialFloorCamera(),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:n,graphics:[]}}),this.bmap.dispatchEvent({type:yt.SWITCH_FLOOR_GROUND,data:{curFloor:n}}),yield Es(),yield this.getFloorContentLayer(s,n),this.changeFloorBox(s,n),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:n,graphics:[]}}),yield Lo(2),yield this.getFloorPoi(s,n,o),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:n,graphics:n.graphicLayer.children}}),this.bmap.dispatchEvent({type:yt.SWITCH_FLOOR_AFTER,data:{curFloor:n,graphics:n.graphicLayer.children}}),n})}getFloorBaseLayer(t,e){e||(e=new ie(this.bmap.context));let i=[0,0];return t.layers.forEach(s=>{switch(s.l_type){case"range":let o=s.elements[0];i=[o.center_x,o.center_y],e.userData.range=o.geometry.cds[0],e.userData.rangeGraphic=o;break;case"ground":nn(s,e);break;default:break}}),e.userData.center=i,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return f(this,null,function*(){e||(e=new ie(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let i=Date.now();for(let s=0;s<t.layers.length;s++){let o=t.layers[s];["range","ground"].includes(o.l_type)||this.options.layers.includes(o.l_type)&&(ca(o,e,this.options),console.log("time",Date.now()-i,o.l_type),i=Date.now())}return e})}getFloorPoi(t,e,i){return f(this,null,function*(){i===void 0&&(i=this.placeConfig);let s=Date.now();yield Promise.all(t.layers.map(n=>{if(this.options.layers.includes(n.l_type))return la(n,e,this.locale,i,this.options)})),console.log("poi time",Date.now()-s);let o=Date.now();Es().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return f(this,null,function*(){xr(),this.db=null})}closeWorker(){this.loadWorker&&(this.loadWorker.terminate(),this.loadWorker=null)}dispose(){super.dispose(),this.clear(),this.closeWorker(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new Ve,this.loadWorker=rn(),this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=w({},Zh,e),this.placeConfig=w({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var b0=require("core-js/modules/web.dom-collections.iterator.js");function an(a,t){return f(this,null,function*(){let{brand:e,project:i}=a,{apiDomain:s,apiPath:{floorRange:o},apiInfo:n}=t,r=""+s+o+"?brand="+e+"&project="+i+"&phase="+i+"&building="+i;return yield fetch(r,n).then(c=>c.json()).then(c=>c.data).then(c=>{let l=(c||[])[0];return l&&(l.info=JSON.parse(l.info)),l})})}function hn(a,t){return f(this,null,function*(){let{brand:e,project:i,floor:s,ts:o,resource_type_list:n}=a,{apiDomain:r,apiPath:{floorGraphic:h},apiInfo:c}=t,l=""+r+h+"?brand="+e+"&project="+i+"&phase="+i+"&building="+i+"&floor="+s+"&ts="+o+"&resource_type_list="+n;return yield fetch(l,c).then(d=>d.json()).then(d=>d.data).then(d=>((d||[]).map(u=>u.info=JSON.parse(u.info)),d||[]))})}function jh(a,t){return f(this,null,function*(){let{project:e,floor:i}=a,{apiDomain:s,apiInfo:o}=t,n=s+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+i;return yield fetch(n,o).then(h=>h.json()).then(h=>h.data).then(h=>JSON.parse(h[0].streetInfo||"{}")).then(h=>h.fileId?Vh(h.fileId,t):null)})}function Vh(a,t){return f(this,null,function*(){let{apiDomain:e,apiInfo:i}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+a,i).then(s=>s.arrayBuffer()).then(s=>{let n=new TextDecoder("utf-8").decode(s);return n?JSON.parse(n):null})})}var cn=class{load(t){return f(this,null,function*(){let e=Ce(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,i]=yield Promise.all([this.loadBuildGround(t),hn(t,this.bmap.config)]),s=Ce({floor:t.floor,ts:t.ts});Ii(i.map(n=>n.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(s)||0),i.forEach(n=>n.info.transformToBuildingGround=!1),this.cacheData.set(e,i);let o=this.floorDataLengthMap.get(s)||0;return this.floorDataLengthMap.set(s,o+i.length),this.loadExternalStreet(t),i})}loadExternalStreet(t){return f(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let i=e.userData.legacyToGraphicMap||new Map,s=e.userData.graphicMap||new Map,{ground:o,markGraphic:n,graphic:r}=this.bmap.config;for(let h=0;h<t.length;h++){let c=t[h],l=w({},c,{info:w({},c.info)});if(c.info.group==="ground"){l.info.fillColor=o.color,l.info.fillOpacity=o.opacity,l.info.height=o.height,l.info.stroke=o.stroke,l.info.strokeColor=o.strokeColor,l.info.strokeOpacity=o.strokeOpacity,e.createGround(l.info);continue}else c.info.userData.mark?(l.info.height=n.height,l.info.fillColor=n.color,l.info.fillOpacity=n.opacity,l.info.stroke=n.stroke,l.info.strokeColor=n.strokeColor,l.info.strokeOpacity=n.strokeOpacity):(l.info.fillOpacity=r.fillOpacity,this.bmap.config.initTransToMark&&(l.info.height=n.height,l.info.fillColor=n.color,l.info.stroke=n.stroke,l.info.strokeColor=n.strokeColor,l.info.strokeOpacity=n.strokeOpacity));let p=e.addGraphic(l.info);p.userData.data=c,i.set(c.legacy_id,p),s.set(c.element_uuid,c)}e.userData.legacyToGraphicMap=i,e.userData.graphicMap=s,e.userData.rangeGraphic=this.bmap.currentBuildGround,e.userData.range=this.bmap.currentBuildGround.geometry.cds[0],e.userData.center=this.bmap.buildingCenter,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(yt.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(yt.SWITCH_FLOOR_AFTER,{curFloor:e,graphics:e.graphicLayer.children})):this.bmap.switchFloorByFloor(e)}filterData(t,e){let i=e.userData.graphicMap||new Map;return t.filter(s=>!i.has(s.element_uuid))}switchFloorByStoreData(t,e){return f(this,null,function*(){let i=yield this.load(w({},t,{resource_type_list:"6"})),s=this.filterData(i,e);this.switchFloorByData(s,e)})}switchFloorByOtherData(t,e){return f(this,null,function*(){let i=yield this.load(w({},t,{resource_type_list:"1,2,3,4"})),s=this.filterData(i,e);this.switchFloorByData(s,e)})}loadBuildGround(t){return f(this,null,function*(){let{brand:e,project:i}=t,s=yield this.loadBuildingGround({brand:e,project:i});var o;return this.bmap.currentBuildGround=(o=s==null?void 0:s.info)!=null?o:null,this.bmap.changeBuildingCenter(s,{brand:e,project:i}),this.bmap.currentBuildGround})}loadBuildingGround(t){return f(this,null,function*(){let{brand:e,project:i}=t,s=Ce({brand:e,project:i});if(this.buildingGroundMap.has(s))return this.buildingGroundMap.get(s);let o=an({brand:e,project:i},this.bmap.config).then(n=>(this.buildingGroundMap.set(s,n),n));return this.buildingGroundMap.set(s,o),o})}switchFloor(t){return f(this,null,function*(){let e=new ie(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(i){console.log(i)}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 Kh=function(a){return a[a.D2=0]="D2",a[a.D3=1.1]="D3",a}({}),ln=class extends Ht.EventDispatcher{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:i,project:s}=e,o=t?Ci(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:s,brand:i})}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 f(this,null,function*(){return this.loader||(this.loader=new qe(this),this.loader.placeConfig=w({},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,i){e===void 0&&(e=!0),i===void 0&&(i=t.graphicLayer.children),this.triggerHooks(yt.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:i}),this.buildingCenter=t.userData.center,this.currentBuildGround=t.userData.rangeGraphic,this.context.switchFloor(t,e),this.initialFloorCamera(),this.triggerHooks(yt.SWITCH_FLOOR_AFTER,{curFloor:t,graphics:i})}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*this.config.control.maxZoomScale,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 i;let s=(i=this.context.currentFloor)==null?void 0:i.addModel(w({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(s){let{facilityAngle:o=0,facilityXScale:n=1,facilityYScale:r=1}=t.options.userData;s.rotateZ((180-o)/180*Math.PI),s.scale.set(n,r,1)}}}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.getGraphics())||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let i=t.options.centerCoords,s=t.getCenter(),o=(i==null?void 0:i[0])||s.x,n=(i==null?void 0:i[1])||s.y;return console.log(o,n,i,s),this.context.currentFloor.addPoi(w({},e,{position:{x:o,y:n,z:s.z+t.options.height/2}}))}return null}createPoi2ByPosition(t,e){if(this.context.currentFloor){let i=this.mercatorToWorld([t.x,t.y]),s=new tt(this.context,w({},e,{position:{x:i.x,y:i.y,z:t.z}}));return this.context.currentFloor.poiLayer2.pushPoi(s),s}return null}translateElementToCenter(t,e,i,s){e===void 0&&(e=500),i===void 0&&(i=0),s===void 0&&(s=0);let o=t.getPosition().clone(),{context:{camera:n}}=this;if(n.updateMatrix(),s){let r=new Ht.Vector3;r.setFromMatrixColumn(n.matrix,1),r.normalize(),r.multiplyScalar(s/n.zoom),o.add(r)}if(i){let r=new Ht.Vector3;r.setFromMatrixColumn(n.matrix,0),r.normalize(),r.multiplyScalar(i/n.zoom),o.add(r)}return this.context.setCameraPosition(o,e)}translateElementToCenterX(t,e){return f(this,null,function*(){return e===void 0&&(e=500),Gt(new Promise(i=>{let s=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:n,height:r},camera:h}=this.context,l=D(o,h,n,r).x-n/2,p=new Ht.Vector3;p.setFromMatrixColumn(this.context.camera.matrix,0),p.normalize(),p.multiplyScalar(l/this.context.camera.zoom),s.add(p),this.context.setCameraPosition(s,e).then(i)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:i,clientHeight:s}=this.container;return D(e,this.context.camera,i,s)}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 f(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 i=this.context.camera.zoom;return this.context.setZoom(i-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let i=this.context.camera.zoom;return this.context.setZoom(i+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver.enable){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,e){t===void 0&&(t=.1),e===void 0&&(e=500);let i=this.context.control.getAzimuthalAngle();return this.context.setAzimuthalAngle(i+t,e)}measureDistance(){return f(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Ji(this.context);let i=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){i(),e("cancel")},this.svgLine.addEventListener("distance",s=>{let{distance:o}=s;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 Qi(this.context);let i=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){i(),e("cancel")},this.svgPolygon.addEventListener("area",s=>{let{area:o}=s;t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}fitCameraByPois(t,e,i){return f(this,null,function*(){if(e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500),!t.length)return;let s=new Ht.Box3;return t.forEach(o=>{let{position:n}=o;s.expandByPoint(n)}),this.context.fitCameraToBox(s,e,i,!1)})}fitCameraByPoiNodeIds(t,e,i){return f(this,null,function*(){e===void 0&&(e=[20,20,20,20]),i===void 0&&(i=500);let s=t.map(o=>this.getPoiById(o)).filter(o=>!!o);if(s.length)return this.fitCameraByPois(s,e,i)})}getGraphicByNodeId(t){var e,i;return((e=this.context.currentFloor)==null?void 0:e.graphicLayer.getGraphicByNodeId(t))||((i=this.context.currentFloor)==null?void 0:i.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 i=Ci(this.currentBuildGround.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(s=>{Array.isArray(s)&&s.forEach(o=>{o[0]-=i[0],o[1]-=i[1]})});else{let[s,o]=t.geometry.cds;t.geometry.coords=[s-i[0],o-i[1]]}}return(e=this.context.currentFloor)==null?void 0:e.graphicLayer.createGraphic(t)}mercatorToWorld(t){let e=this.buildingCenter;return new Ht.Vector3(t[0]-e[0],t[1]-e[1],0)}removePoiById(t){var e,i;(e=this.context.currentFloor)==null||e.poiLayer.removePoiById(t),(i=this.context.currentFloor)==null||i.poiLayer2.removePoiById(t)}getPoiById(t){var e;let i=this.context.collisionSystem.objects;return((e=this.context.currentFloor)==null?void 0:e.poiLayer.getPoiById(t))||i.find(s=>s.options.id===t)}getPois(){var t;return[...(((t=this.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).filter(e=>!e.options.built_in),...this.context.collisionSystem.objects||[]]}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,Q.dispose(),ct.dispose(),ke.dispose(),St.dispose(),T.dispose(),te.dispose(),this.debounceResize=null,Ht.Sprite.Dispose==null||Ht.Sprite.Dispose.call(Ht.Sprite)}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 j,this.plugins=[],this.loader=null,this.onControlChange=()=>{let{camera:{zoom:i}}=this.context;i!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=i)},this.onKeydown=i=>{this.polarKeys.includes(i.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(i.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=i=>{if(this.polarKeys.includes(i.code)){let s=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=s,this.context.control.minPolarAngle=s}if(this.azimuthalKeys.includes(i.code)){let s=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=s,this.context.control.minAzimuthAngle=s}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let i=this.context.control.getAzimuthalAngle(),s=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=s,this.context.control.minZoom=o,this.context.control.maxZoom=o*this.config.control.maxZoomScale,this.basicZoom=s,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(i,0),this.context.cameraBound.setEnable(!0)},this.config=sn(e),this.context=new us(t,this),this.debounceResize=(0,pa.debounce)(this.resize,this.config.resizeObserver.debounceTime),this.registryEvent()}};var Xh=function(a){return a.HALF="half",a.POWER="power",a.MECHANICAL="mechanical",a.NORMAL="normal",a.VIP="vip",a}({});var V0=require("core-js/modules/web.dom-collections.iterator.js");var X=class extends st{dispose(){let t=this.bmap.plugins.findIndex(e=>e===this);t!==-1&&this.bmap.plugins.splice(t,1),this.bmap=null,super.dispose()}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var pn=class extends X{fetchEquipment(){return f(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:i}=this.bmap.config,s=""+t+e;yield fetch(s,i).then(o=>o.json()).then(o=>o.data).then(o=>{this.equipmentList=o,this.equipmentMap=new Map(o.map(n=>[n.equipment_id,n]))}),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 i=this.getGraphicEquipment(e);return i&&this.equipmentMap.has(i)}).forEach(e=>{let i=this.equipmentMap.get(this.getGraphicEquipment(e)),s=this.bmap.createGraphicPoi(e,{icon:i==null?void 0:i.equipment_icon,built_in:!0,icon_size:[14,14]});s&&(s.userData.data=i,s.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(yt.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 i;(i=this.bmap.context.currentFloor)==null||i.poiLayer.removePoi(e)}}),super.dispose()}constructor(t){super(t),this.equipmentList=[],this.equipmentMap=new Map,this.onSwitchFloor=e=>{let{data:{graphics:i}}=e;this.equipmentList.length&&this.changeGraphicToEquipment(i)},this.fetchEquipment(),this.bmap.addEventListener(yt.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var Yw=require("core-js/modules/es.string.replace.js"),qw=require("core-js/modules/es.regexp.exec.js"),$w=require("core-js/modules/web.dom-collections.iterator.js"),Jw=require("core-js/modules/es.promise.finally.js");var fw=require("core-js/modules/web.dom-collections.iterator.js"),gw=require("core-js/modules/es.array.push.js"),ut=require("three");var $0=require("core-js/modules/es.typed-array.float32-array.js"),J0=require("core-js/modules/es.typed-array.at.js"),Q0=require("core-js/modules/es.typed-array.fill.js"),tw=require("core-js/modules/es.typed-array.find-last.js"),ew=require("core-js/modules/es.typed-array.find-last-index.js"),iw=require("core-js/modules/es.typed-array.set.js"),sw=require("core-js/modules/es.typed-array.sort.js"),ow=require("core-js/modules/es.typed-array.to-reversed.js"),nw=require("core-js/modules/es.typed-array.to-sorted.js"),rw=require("core-js/modules/es.typed-array.with.js"),aw=require("core-js/modules/es.array-buffer.constructor.js"),hw=require("core-js/modules/es.array-buffer.slice.js"),cw=require("core-js/modules/es.array-buffer.detached.js"),lw=require("core-js/modules/es.array-buffer.transfer.js"),pw=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),dw=require("core-js/modules/es.array.push.js"),uw=require("core-js/modules/es.typed-array.uint16-array.js"),L=require("three"),Nt=class extends L.BufferGeometry{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new L.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}})}};Nt.prototype.setMatrixWorld=function(a){this.matrixWorld=a};Nt.prototype.setGeometry=function(a,t){this._geometry=a,this.setPoints(a.getAttribute("position").array,t)};Nt.prototype.setPoints=function(a,t){if(!(a instanceof Float32Array)&&!(a instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=a,this.widthCallback=t,this.positions=[],this.counters=[],a.length&&a[0]instanceof L.Vector3)for(var e=0;e<a.length;e++){var i=a[e],s=e/a.length;this.positions.push(i.x,i.y,i.z),this.positions.push(i.x,i.y,i.z),this.counters.push(s),this.counters.push(s)}else for(var e=0;e<a.length;e+=3){var s=e/a.length;this.positions.push(a[e],a[e+1],a[e+2]),this.positions.push(a[e],a[e+1],a[e+2]),this.counters.push(s),this.counters.push(s)}this.process()};function Yh(a,t){var e=new L.Matrix4,i=new L.Ray,s=new L.Sphere,o=new L.Vector3,n=this.geometry;if(n.boundingSphere||n.computeBoundingSphere(),s.copy(n.boundingSphere),s.applyMatrix4(this.matrixWorld),a.ray.intersectSphere(s,o)!==!1){e.copy(this.matrixWorld).invert(),i.copy(a.ray).applyMatrix4(e);var r=new L.Vector3,h=new L.Vector3,c=new L.Vector3,l=this instanceof L.LineSegments?2:1,p=n.index,d=n.attributes;if(p!==null)for(var u=p.array,m=d.position.array,v=d.width.array,g=0,x=u.length-1;g<x;g+=l){var M=u[g],P=u[g+1];r.fromArray(m,M*3),h.fromArray(m,P*3);var C=v[Math.floor(g/3)]!==void 0?v[Math.floor(g/3)]:1,S=a.params.Line.threshold+this.material.lineWidth*C/2,G=S*S,E=i.distanceSqToSegment(r,h,o,c);if(!(E>G)){o.applyMatrix4(this.matrixWorld);var nt=a.ray.origin.distanceTo(o);nt<a.near||nt>a.far||(t.push({distance:nt,point:c.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}),g=x)}}}}Nt.prototype.raycast=Yh;Nt.prototype.compareV3=function(a,t){var e=a*6,i=t*6;return this.positions[e]===this.positions[i]&&this.positions[e+1]===this.positions[i+1]&&this.positions[e+2]===this.positions[i+2]};Nt.prototype.copyV3=function(a){var t=a*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};Nt.prototype.getDistance=function(a){let t=0;for(let e=0;e<a;e++){let i=6*e,s=new L.Vector3(this.positions[i],this.positions[i+1],this.positions[i+2]),o=new L.Vector3(this.positions[i+6],this.positions[i+7],this.positions[i+8]),n=s.distanceTo(o);t+=n}return t};Nt.prototype.process=function(){var a=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(a-1);var i;this.compareV3(0,a-1)?i=this.copyV3(a-2):i=this.copyV3(0),this.previous.push(i[0],i[1],i[2]),this.previous.push(i[0],i[1],i[2]);for(var s=0;s<a;s++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(s/(a-1)):t=1,this.width.push(t),this.width.push(t),s===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(s===a-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let n=this.getDistance(s)/e;this.uvs.push(n,0),this.uvs.push(n,1)}if(s<a-1){i=this.copyV3(s),this.previous.push(i[0],i[1],i[2]),this.previous.push(i[0],i[1],i[2]);var o=s*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}s>0&&(i=this.copyV3(s),this.next.push(i[0],i[1],i[2]),this.next.push(i[0],i[1],i[2]))}this.compareV3(a-1,0)?i=this.copyV3(1):i=this.copyV3(a-1),this.next.push(i[0],i[1],i[2]),this.next.push(i[0],i[1],i[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new L.BufferAttribute(new Float32Array(this.positions),3),previous:new L.BufferAttribute(new Float32Array(this.previous),3),next:new L.BufferAttribute(new Float32Array(this.next),3),side:new L.BufferAttribute(new Float32Array(this.side),1),width:new L.BufferAttribute(new Float32Array(this.width),1),uv:new L.BufferAttribute(new Float32Array(this.uvs),2),index:new L.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new L.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function dn(a,t,e,i,s){var o;if(a=a.subarray||a.slice?a:a.buffer,e=e.subarray||e.slice?e:e.buffer,a=t?a.subarray?a.subarray(t,s&&t+s):a.slice(t,s&&t+s):a,e.set)e.set(a,i);else for(o=0;o<a.length;o++)e[o+i]=a[o];return e}Nt.prototype.advance=function(a){var t=this._attributes.position.array,e=this._attributes.previous.array,i=this._attributes.next.array,s=t.length;dn(t,0,e,0,s),dn(t,6,t,0,s-6),t[s-6]=a.x,t[s-5]=a.y,t[s-4]=a.z,t[s-3]=a.x,t[s-2]=a.y,t[s-1]=a.z,dn(t,6,i,0,s-6),i[s-6]=a.x,i[s-5]=a.y,i[s-4]=a.z,i[s-3]=a.x,i[s-2]=a.y,i[s-1]=a.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};L.ShaderChunk.meshline_vert=["",L.ShaderChunk.logdepthbuf_pars_vertex,L.ShaderChunk.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",L.ShaderChunk.logdepthbuf_vertex,L.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",L.ShaderChunk.fog_vertex,"}"].join(`
|
|
502
502
|
`);L.ShaderChunk.meshline_frag=["",L.ShaderChunk.fog_pars_fragment,L.ShaderChunk.logdepthbuf_pars_fragment,"","uniform sampler2D map;","uniform sampler2D alphaMap;","uniform float useMap;","uniform float useAlphaMap;","uniform float useDash;","uniform float dashArray;","uniform float dashOffset;","uniform float dashRatio;","uniform float visibility;","uniform float alphaTest;","uniform vec2 repeat;","uniform float thresholdRatio;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","void main() {",""," if (vUV.x <= thresholdRatio) {"," discard;"," }",L.ShaderChunk.logdepthbuf_fragment,""," vec4 c = vColor;"," if( useMap == 1. ) c *= texture2D( map, vUV * repeat );"," if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;"," if( c.a < alphaTest ) discard;"," if( useDash == 1. ){"," c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));"," }"," gl_FragColor = c;"," gl_FragColor.a *= step(vCounters, visibility);","",L.ShaderChunk.fog_fragment,"}"].join(`
|
|
503
|
-
`);var us=class extends L.ShaderMaterial{constructor(t){super({uniforms:Object.assign({},L.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new L.Color(16777215)},opacity:{value:1},resolution:{value:new L.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new L.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:L.ShaderChunk.meshline_vert,fragmentShader:L.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};us.prototype.copy=function(a){return L.ShaderMaterial.prototype.copy.call(this,a),this.lineWidth=a.lineWidth,this.map=a.map,this.useMap=a.useMap,this.alphaMap=a.alphaMap,this.useAlphaMap=a.useAlphaMap,this.color.copy(a.color),this.opacity=a.opacity,this.resolution.copy(a.resolution),this.sizeAttenuation=a.sizeAttenuation,this.dashArray.copy(a.dashArray),this.dashOffset.copy(a.dashOffset),this.dashRatio.copy(a.dashRatio),this.useDash=a.useDash,this.visibility=a.visibility,this.alphaTest=a.alphaTest,this.repeat.copy(a.repeat),this};var la={texture_url:Os,lineWidth:10,color:16777215},Qs=class extends ut.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:i,height:s}}}}}=this,o=t.map(r=>{let[h,c]=r;return D(new ut.Vector3(h,c,0),e,i,s)}).map(r=>{let{x:h,y:c}=r;return[h,c]});return Et(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new ut.Vector2(t,1)}loadTexture(t){return new Promise((e,i)=>{new ut.TextureLoader().load(t,e,void 0,i)})}transformPoints(t){let e=[];for(let i=0;i<t.length;i++)e.push(...t[i],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 f(this,null,function*(){let e=this.geometry=new Zt;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=ut.RepeatWrapping}let i=this.material=new us({useMap:!0,color:new ut.Color(this.config.color),transparent:!0,resolution:new ut.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:ut.NormalBlending,repeat:new ut.Vector2(this.getRepeat(),1)}),s=this.mesh=new ut.Mesh(e,i);return s.renderOrder=99999,this.add(s),s})}dispose(){var t,e,i;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(i=this.texture)==null||i.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=la,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let i=this.navigation.bmap.context.camera.zoom;i!==this.prevCameraZoom&&(this.prevCameraZoom=i,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:i,height:s}=this.navigation.bmap.context.clientSize;this.material.resolution.set(i,s)}},this.config=Object.assign({},la,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var fi=require("@tweenjs/tween.js"),At=require("three");var ww=require("core-js/modules/es.array.unshift.js"),Mw=require("core-js/modules/web.dom-collections.iterator.js"),_w=require("core-js/modules/es.array.push.js"),pa=require("three");var da=require("@tweenjs/tween.js"),ua=require("lodash"),mi=require("@turf/turf");var Kh={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1,destinationDistanceThreshold:10},to=class extends st{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.offsetDistance=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:i,position:s,curRoutePath:o,paths:n,routeIndex:r}=this;if(!i.length)return null;let h=i,c=this.paths[this.routeIndex].floor,l=this.getCurRouteRemainDistance();if(s){let g=ce(i,s);h=h.slice(g+1),h.unshift(s)}let p=[{floor:o==null?void 0:o.floor,points:h},...n.slice(r+1)],{distance:d,closestPoint:u,index:m,i:v}=p.reduce((g,x,M)=>{if(x.floor!==t)return g;let{distance:P,closestPoint:C,index:S}=x.points.reduce((G,E,nt,Tt)=>{if(!Tt[nt+1])return w({},G,{distance:G.distance===1/0?O(E,e):G.distance});let{distance:gt,closestPoint:It}=ko(e,E,Tt[nt+1]);if(!this.navigation.options.canBack&&c===t){let kt=[e,...Tt.slice(nt+1)],ne=Et(kt);if(l-ne>10)return G}return gt<G.distance?{distance:gt,closestPoint:It,index:nt}:G},{distance:1/0,closestPoint:x.points[0],index:0});return P<g.distance?{distance:P,closestPoint:C,index:M,i:S}:g},{distance:1/0,closestPoint:h[0],index:0,i:0});return{distance:d,closestPoint:u,routeIndex:m+r,pointIndex:m===0?v+this.pointIndex:v}}toPosition(t,e){let i=this.adsorb(t,e);if(!i)return;let{distance:s,closestPoint:o,routeIndex:n,pointIndex:r}=i;this.offsetDistance=s,s>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=n,this.pointIndex=r,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 f(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(i=>{let s=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),n=o/this.options.simulationSpeed,r=this.throttleUpdatePosition=(0,ua.throttle)(c=>{let l=Ze(s,c.distance);l&&(e.push({floor:t.floor,pos:l}),this.toPosition(t.floor,l))},100),h=this.simulationTween=new da.Tween({distance:0},this.tweenUtil.group).to({distance:o},n*1e3).onUpdate(r).onComplete(()=>{this.tweenUtil.remove(h),r.flush(),r.cancel(),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,setTimeout(()=>{i(this.startCurRouteSimulation())},3e3)):(i(!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:i}=this;if(!t.length)return 0;let s=[i,...t.slice(e+1)];return Et(s)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:i}=this;if(!t.length)return 0;let s=[...t.slice(0,e+1),i];return Et(s)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((s,o)=>s+o.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:i,position:s,curRoutePath:o}=this,n=e,r=de.FRONT,h=(o==null||(t=o.pointInfos[n])==null?void 0:t.crossName)||"",c=0,l=0,p=0;for(;r===de.FRONT&&n<=i.length;){let v=i[n],g=i[n+1],x=i[n+2];if(!v||!g)r=de.END;else if(c+=O(v,g),!x)r=de.END;else{r=Es(v,g,x),l=We(v,g,x),p=(new pa.Vector2(x[0]-g[0],x[1]-g[1]).angle()*180/Math.PI-90+360)%360;var d;h=(d=o==null?void 0:o.pointInfos[n+1].crossName)!=null?d:"",n+=1}}i[n]&&(c=O(s,i[n]));let u=Ls(l);if(r===de.END&&c<=this.options.directionEmitThreshold)return{dir:r,distance:c,crossName:h,angle:l,nextAngle:p,nextDir:u};let m=this.getCurRouteToStartDistance();return e===0&&m<=5?{dir:de.START,distance:c,crossName:h,angle:l,nextAngle:p,nextDir:u}:(c>=this.options.directionEmitThreshold&&(r=de.FRONT),{dir:r,distance:c,crossName:h,angle:l,nextAngle:p,nextDir:u})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(i=>{let s=(0,mi.polygon)(i.cds),o=(0,mi.point)(this.position);return(0,mi.booleanPointInPolygon)(o,s)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),i=this.getNextDirDistance();if(!i)return null;let{dir:s,distance:o,crossName:n,angle:r,nextAngle:h,nextDir:c}=i;e<=this.options.destinationDistanceThreshold&&(s=de.END);let{imageUrl:l}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:o,dir:s,angle:r,nextAngle:h,pos:this.position,routeIndex:this.routeIndex,crossName:n,offset:this.offset,reset:this.reset,imageUrl:l,nextDir:c,offsetDistance:this.offsetDistance}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear(),this.navigation=null}constructor(t,e,i){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 j,this.resetTimer=null,this.tweenUtil=new Pe,this.paused=!1,this.offsetDistance=0,this.onAddPaths=s=>{let{paths:o}=s;this.paths=o,this.resetStatus(o),this.simulationTween&&!this.paused&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},Kh,e),this.roadData=i,this.registryEvent()}};var Ew=require("core-js/modules/es.typed-array.uint8-array.js"),Lw=require("core-js/modules/es.typed-array.at.js"),Cw=require("core-js/modules/es.typed-array.fill.js"),Tw=require("core-js/modules/es.typed-array.find-last.js"),kw=require("core-js/modules/es.typed-array.find-last-index.js"),Dw=require("core-js/modules/es.typed-array.set.js"),Aw=require("core-js/modules/es.typed-array.sort.js"),Ow=require("core-js/modules/es.typed-array.to-reversed.js"),Iw=require("core-js/modules/es.typed-array.to-sorted.js"),Rw=require("core-js/modules/es.typed-array.with.js"),Gw=require("core-js/modules/es.array-buffer.constructor.js"),Fw=require("core-js/modules/es.array-buffer.slice.js"),zw=require("core-js/modules/es.array-buffer.detached.js"),Bw=require("core-js/modules/es.array-buffer.transfer.js"),Ww=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Uw=require("core-js/modules/es.typed-array.from.js"),Hw=require("core-js/modules/web.dom-collections.iterator.js"),Jt=require("three");var Se=class a extends tt{addDebug(){a.canvas.style.cssText=`
|
|
503
|
+
`);var fs=class extends L.ShaderMaterial{constructor(t){super({uniforms:Object.assign({},L.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new L.Color(16777215)},opacity:{value:1},resolution:{value:new L.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new L.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:L.ShaderChunk.meshline_vert,fragmentShader:L.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};fs.prototype.copy=function(a){return L.ShaderMaterial.prototype.copy.call(this,a),this.lineWidth=a.lineWidth,this.map=a.map,this.useMap=a.useMap,this.alphaMap=a.alphaMap,this.useAlphaMap=a.useAlphaMap,this.color.copy(a.color),this.opacity=a.opacity,this.resolution.copy(a.resolution),this.sizeAttenuation=a.sizeAttenuation,this.dashArray.copy(a.dashArray),this.dashOffset.copy(a.dashOffset),this.dashRatio.copy(a.dashRatio),this.useDash=a.useDash,this.visibility=a.visibility,this.alphaTest=a.alphaTest,this.repeat.copy(a.repeat),this};var da={texture_url:Rs,lineWidth:10,color:16777215},eo=class extends ut.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:i,height:s}}}}}=this,o=t.map(r=>{let[h,c]=r;return D(new ut.Vector3(h,c,0),e,i,s)}).map(r=>{let{x:h,y:c}=r;return[h,c]});return Et(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new ut.Vector2(t,1)}loadTexture(t){return new Promise((e,i)=>{new ut.TextureLoader().load(t,e,void 0,i)})}transformPoints(t){let e=[];for(let i=0;i<t.length;i++)e.push(...t[i],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 f(this,null,function*(){let e=this.geometry=new Nt;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=ut.RepeatWrapping}let i=this.material=new fs({useMap:!0,color:new ut.Color(this.config.color),transparent:!0,resolution:new ut.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:ut.NormalBlending,repeat:new ut.Vector2(this.getRepeat(),1)}),s=this.mesh=new ut.Mesh(e,i);return s.renderOrder=99999,this.add(s),s})}dispose(){var t,e,i;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(i=this.texture)==null||i.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=da,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let i=this.navigation.bmap.context.camera.zoom;i!==this.prevCameraZoom&&(this.prevCameraZoom=i,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:i,height:s}=this.navigation.bmap.context.clientSize;this.material.resolution.set(i,s)}},this.config=Object.assign({},da,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var fi=require("@tweenjs/tween.js"),Dt=require("three");var Pw=require("core-js/modules/es.array.unshift.js"),bw=require("core-js/modules/web.dom-collections.iterator.js"),Sw=require("core-js/modules/es.array.push.js"),ua=require("three");var ma=require("@tweenjs/tween.js"),fa=require("lodash"),mi=require("@turf/turf");var qh={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1,destinationDistanceThreshold:10},io=class extends st{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.offsetDistance=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:i,position:s,curRoutePath:o,paths:n,routeIndex:r}=this;if(!i.length)return null;let h=i,c=this.paths[this.routeIndex].floor,l=this.getCurRouteRemainDistance();if(s){let g=he(i,s);h=h.slice(g+1),h.unshift(s)}let p=[{floor:o==null?void 0:o.floor,points:h},...n.slice(r+1)],{distance:d,closestPoint:u,index:m,i:v}=p.reduce((g,x,M)=>{if(x.floor!==t)return g;let{distance:P,closestPoint:C,index:S}=x.points.reduce((G,E,nt,Tt)=>{if(!Tt[nt+1])return w({},G,{distance:G.distance===1/0?O(E,e):G.distance});let{distance:gt,closestPoint:Ot}=Ao(e,E,Tt[nt+1]);if(!this.navigation.options.canBack&&c===t){let kt=[e,...Tt.slice(nt+1)],oe=Et(kt);if(l-oe>10)return G}return gt<G.distance?{distance:gt,closestPoint:Ot,index:nt}:G},{distance:1/0,closestPoint:x.points[0],index:0});return P<g.distance?{distance:P,closestPoint:C,index:M,i:S}:g},{distance:1/0,closestPoint:h[0],index:0,i:0});return{distance:d,closestPoint:u,routeIndex:m+r,pointIndex:m===0?v+this.pointIndex:v}}toPosition(t,e){let i=this.adsorb(t,e);if(!i)return;let{distance:s,closestPoint:o,routeIndex:n,pointIndex:r}=i;this.offsetDistance=s,s>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=n,this.pointIndex=r,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 f(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(i=>{let s=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),n=o/this.options.simulationSpeed,r=this.throttleUpdatePosition=(0,fa.throttle)(c=>{let l=Ze(s,c.distance);l&&(e.push({floor:t.floor,pos:l}),this.toPosition(t.floor,l))},100),h=this.simulationTween=new ma.Tween({distance:0},this.tweenUtil.group).to({distance:o},n*1e3).onUpdate(r).onComplete(()=>{this.tweenUtil.remove(h),r.flush(),r.cancel(),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,setTimeout(()=>{i(this.startCurRouteSimulation())},3e3)):(i(!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:i}=this;if(!t.length)return 0;let s=[i,...t.slice(e+1)];return Et(s)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:i}=this;if(!t.length)return 0;let s=[...t.slice(0,e+1),i];return Et(s)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((s,o)=>s+o.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:i,position:s,curRoutePath:o}=this,n=e,r=pe.FRONT,h=(o==null||(t=o.pointInfos[n])==null?void 0:t.crossName)||"",c=0,l=0,p=0;for(;r===pe.FRONT&&n<=i.length;){let v=i[n],g=i[n+1],x=i[n+2];if(!v||!g)r=pe.END;else if(c+=O(v,g),!x)r=pe.END;else{r=Cs(v,g,x),l=We(v,g,x),p=(new ua.Vector2(x[0]-g[0],x[1]-g[1]).angle()*180/Math.PI-90+360)%360;var d;h=(d=o==null?void 0:o.pointInfos[n+1].crossName)!=null?d:"",n+=1}}i[n]&&(c=O(s,i[n]));let u=Ts(l);if(r===pe.END&&c<=this.options.directionEmitThreshold)return{dir:r,distance:c,crossName:h,angle:l,nextAngle:p,nextDir:u};let m=this.getCurRouteToStartDistance();return e===0&&m<=5?{dir:pe.START,distance:c,crossName:h,angle:l,nextAngle:p,nextDir:u}:(c>=this.options.directionEmitThreshold&&(r=pe.FRONT),{dir:r,distance:c,crossName:h,angle:l,nextAngle:p,nextDir:u})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(i=>{let s=(0,mi.polygon)(i.cds),o=(0,mi.point)(this.position);return(0,mi.booleanPointInPolygon)(o,s)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),i=this.getNextDirDistance();if(!i)return null;let{dir:s,distance:o,crossName:n,angle:r,nextAngle:h,nextDir:c}=i;e<=this.options.destinationDistanceThreshold&&(s=pe.END);let{imageUrl:l}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:o,dir:s,angle:r,nextAngle:h,pos:this.position,routeIndex:this.routeIndex,crossName:n,offset:this.offset,reset:this.reset,imageUrl:l,nextDir:c,offsetDistance:this.offsetDistance}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear(),this.navigation=null}constructor(t,e,i){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 j,this.resetTimer=null,this.tweenUtil=new _e,this.paused=!1,this.offsetDistance=0,this.onAddPaths=s=>{let{paths:o}=s;this.paths=o,this.resetStatus(o),this.simulationTween&&!this.paused&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},qh,e),this.roadData=i,this.registryEvent()}};var Tw=require("core-js/modules/es.typed-array.uint8-array.js"),kw=require("core-js/modules/es.typed-array.at.js"),Dw=require("core-js/modules/es.typed-array.fill.js"),Aw=require("core-js/modules/es.typed-array.find-last.js"),Ow=require("core-js/modules/es.typed-array.find-last-index.js"),Iw=require("core-js/modules/es.typed-array.set.js"),Rw=require("core-js/modules/es.typed-array.sort.js"),Gw=require("core-js/modules/es.typed-array.to-reversed.js"),Fw=require("core-js/modules/es.typed-array.to-sorted.js"),zw=require("core-js/modules/es.typed-array.with.js"),Bw=require("core-js/modules/es.array-buffer.constructor.js"),Ww=require("core-js/modules/es.array-buffer.slice.js"),Uw=require("core-js/modules/es.array-buffer.detached.js"),Hw=require("core-js/modules/es.array-buffer.transfer.js"),Nw=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Zw=require("core-js/modules/es.typed-array.from.js"),jw=require("core-js/modules/web.dom-collections.iterator.js"),$t=require("three");var be=class a extends tt{addDebug(){a.canvas.style.cssText=`
|
|
504
504
|
position: fixed;
|
|
505
505
|
top: 0;
|
|
506
506
|
left: 0;
|
|
507
507
|
z-index: 9999;
|
|
508
|
-
`,document.body.appendChild(a.canvas)}setAngle(t){if(console.log("angle",t),a.textureMap.has(t))this._initIcon(a.textureMap.get(t));else{this.draw(t);let e=this.getTexture(this.getImageData());a.textureMap.set(t,e),this._initIcon(e),this._initScale({zoom:this.bmap.context.camera.zoom})}}_initIcon(t){if(this.spriteIcon)this.spriteIcon.material.map=t,t.needsUpdate=!0;else{let e=new Jt.Sprite(new Jt.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI}));e.renderOrder=1e5+this.options.level,t.needsUpdate=!0,this.add(e),e.center.set(.5,.5),this.spriteIcon=e}}initSize(){this.spriteIcon&&this.spriteIcon.center.set(.5,.5)}draw(t){let{ctx:e}=a,{config:{size:i}}=this,s=i[0]/2,o=i[1]/2,n=4,r=1,h=n+r;if(e.clearRect(0,0,i[0],i[1]),e.setLineDash([10,10]),e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),e.arc(s,o,o-h,-Math.PI/2,Math.PI*2-Math.PI/2,t<Math.PI),e.stroke(),e.strokeStyle="#0A7AFF",t<Math.PI){let c=-Math.PI/2,l=c-t;e.beginPath(),e.arc(s,o,o-h,c,l,!0)}else{let c=-Math.PI/2,l=c+Math.PI*2-t;e.beginPath(),e.arc(s,o,o-h,c,l,!1)}e.stroke(),e.clearRect(s-h*2,0,h*4,h*4),e.beginPath(),e.arc(s,h,n,0,Math.PI*2),e.fillStyle="#0A7AFF",e.fill(),e.setLineDash([10,0]),e.strokeStyle="#fff",e.lineWidth=r,e.stroke(),e.clearRect(0,o-5,10,10),e.clearRect(s-5,i[1]-10,10,10),e.clearRect(i[0]-10,o-5,10,10),t>Math.PI/2&&t<Math.PI?e.fillStyle="#0A7AFF":e.fillStyle="#fff",e.fillRect(0,o-1,10,2),e.fillStyle="#fff",e.fillRect(s-1,i[1]-10,2,10),t>Math.PI&&t<Math.PI/2*3?e.fillStyle="#0A7AFF":e.fillStyle="#fff",e.fillRect(i[0]-10,o-1,10,2)}getImageData(){let{ctx:t}=a,{config:{size:e}}=this;return t.getImageData(0,0,e[0],e[1])}getTexture(t){let{config:{size:e}}=this,i=new Jt.DataTexture(Uint8Array.from(t.data),e[0],e[1],Jt.RGBAFormat);return i.format=Jt.RGBAFormat,i.magFilter=Jt.LinearFilter,i.minFilter=Jt.LinearFilter,i.colorSpace="srgb",i.flipY=!0,i}dispose(){var t;super.dispose(),(t=this.spriteIcon)==null||t.material.dispose()}static dispose(){this.textureMap.forEach(t=>{t.dispose()}),this.textureMap.clear(),this.ctx=null,this.canvas=null}constructor(t,e){super(t.context,{icon_size:e.size,collision_enable:!1,level:2}),this.bmap=t,this.config=e,a.canvas.width=e.size[0],a.canvas.height=e.size[1]}};Se.canvas=document.createElement("canvas");Se.ctx=Se.canvas.getContext("2d",{willReadFrequently:!0});Se.textureMap=new Map;var Xh={path:{},cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},positionNavigation:{},offsetY:150,directionEmitThreshold:5,disablePathAnimation:!1,disablePathRotate:!1,disablePathShorten:!1,speed:1,roadData:[],runAnimationMaxTime:1,navigationCameraBasic:45,canBack:!1},pn=class extends X{get curFloorPathLength(){var t,e;return(e=(t=this.curFloorPath)==null?void 0:t.distance)!=null?e:0}get curFloorPathPoints(){var t,e;return(e=(t=this.curFloorPath)==null?void 0:t.points)!=null?e:[]}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener(yt.SWITCH_FLOOR_GROUND,this.onSwitchFloor),this.positionNavigation.addEventListener("navigation-info",this.onNavigationInfo),this.bmap.context.addEventListener("control-change",this.onControlChangeForStartPoi)}setRoadData(t){this.options.roadData=t,this.positionNavigation.setRoadData(t)}showStartRotateHelperPoi(){var t;if(this.needStartRotateHelperPoi=!0,!this.startPoi||this.startRotateHelperPoi)return;let e=this.startPoi.options.icon_size;this.startRotateHelperPoi=new Se(this.bmap,{size:[e[0]+20,e[1]+20]}),this.startRotateHelperPoi.setAngle(0),this.startRotateHelperPoi.position.setZ(.51),(t=this.bmap.context.currentFloor)==null||t.poiLayer2.pushPoi(this.startRotateHelperPoi)}hideStartRotateHelperPoi(){if(this.needStartRotateHelperPoi=!1,this.startRotateHelperPoi){var t;(t=this.bmap.context.currentFloor)==null||t.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}setStartPoiPosition(t,e){this.startPoi&&(this.startPoi.position.setX(t).setY(e),this.startRotateHelperPoi&&this.startRotateHelperPoi.position.setX(t).setY(e),this.detachLine&&this.detachLine.setPosition(this.startPoi.position,this.detachStartPoi.position))}resetStatus(){this.pauseAnimation(),this.positionNavigation.resetStatus(this.paths),this.movedDistance=0,this.startPoi&&this.translatePath&&this.setStartPoiPosition(this.translatePath[0][0],this.translatePath[0][1])}toPositionByTask(t){var e;let s=(e=this.taskQueue.getTasks().find(n=>n.meta.type==="toPosition"))==null?void 0:e.tid,o={run:()=>this.toPositionBySpeed(t,this.options.speed),meta:{type:"toPosition"}};s?this.taskQueue.replace(s,o):this.taskQueue.add(o)}pauseAnimation(){this.taskQueue.clear(),this.positionNavigation.pause(),this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue(),this.positionNavigation.continue()}clearTween(){this.tweenUtil.clear(),this.taskQueue.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener(yt.SWITCH_FLOOR_GROUND,this.onSwitchFloor),this.positionNavigation.removeEventListener("navigation-info",this.onNavigationInfo),this.bmap.context.removeEventListener("control-change",this.onControlChangeForStartPoi)}clearPath(){if(this.resetStatus(),this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.clearTween()),this.startPoi){var t;if((t=this.bmap.context.currentFloor)==null||t.poiLayer2.removePoi(this.startPoi),this.startPoi=null,this.startRotateHelperPoi){var e;(e=this.bmap.context.currentFloor)==null||e.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}if(this.detachStartPoi){var i;(i=this.bmap.context.currentFloor)==null||i.removePoi2(this.detachStartPoi),this.detachStartPoi=null}this.detachLine&&(this.bmap.context.scene.remove(this.detachLine),this.detachLine.dispose(),this.detachLine=null),this.translatePath=null}setCurFloorPath(t){t===null?(this.curFloorPath=null,this.currentPathPosition=null,this.toPointPosition=null):(this.curFloorPath=t,this.currentPathPosition=t.points[0],this.toPointPosition=t.points[0]),this.movedDistance=0,this.clearTween()}setCurPathIndex(t){var e,i;this.curPathIndex=t,((e=this.paths[t])==null?void 0:e.floor)===((i=this.bmap.context.currentFloor)==null?void 0:i.name)?(this.setCurFloorPath(this.paths[t]),this.renderPath(this.translatePoints(this.curFloorPathPoints))):this.clearPath()}addPath(t,e){e===void 0&&(e=0);var i;this.paths=t,this.curPathIndex=e,this.clearTween(),this.clearPath();let s=(i=this.bmap.context.currentFloor)==null?void 0:i.name,o=t[e];if(s&&(o==null?void 0:o.floor)===s)if(this.setCurFloorPath(o),this.bmap.currentBuildGround)this.renderPath(this.translatePoints(o.points));else{let n=()=>{this.bmap.removeEventListener("center-change",n),this.renderPath(this.translatePoints(o.points))};this.bmap.addEventListener("center-change",n)}this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,i]=this.bmap.buildingCenter;return t.map(s=>[s[0]-e,s[1]-i])}renderPath(t){this.translatePath=t;let e=this.catmullRomCurve3(t);if(this.cPath=e,this.animationPathOptions={cPathIndex:0},this.pathStart=e[0],this.path?this.path.updatePoints(e):(this.path=new Qs(this,this.options.path),this.path.create(e),this.path.position.z=this.bmap.context.currentFloor.groundMaxHeight+.5,this.bmap.context.scene.add(this.path)),this.path.movePath(0),this.startPoi){var i;if((i=this.bmap.context.currentFloor)==null||i.poiLayer2.removePoi(this.startPoi),this.startPoi=null,this.startRotateHelperPoi){var s;(s=this.bmap.context.currentFloor)==null||s.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}if(this.removeDetachStart(),this.showDetachStartState&&this.options.detachStartPoi){var o;this.detachStartPoi=new tt(this.bmap.context,w({},this.options.detachStartPoi,{id:"navigation_detach_start_poi",position:{x:e[0][0],y:e[0][1],z:.51},collision_enable:!1}))||null,(o=this.bmap.context.currentFloor)==null||o.poiLayer2.pushPoi(this.detachStartPoi),this.detachLine=new ai(this.bmap.context,new At.Vector3(e[0][0],e[0][1],.51),new At.Vector3(e[0][0],e[0][1],.51)),this.bmap.context.scene.add(this.detachLine)}if(this.options.needStartPoi){var n;this.startPoi=new tt(this.bmap.context,w({},this.options.startPoi,{id:"navigation_start_poi",position:{x:e[0][0],y:e[0][1],z:.51},collision_enable:!1}))||null,(n=this.bmap.context.currentFloor)==null||n.poiLayer2.pushPoi(this.startPoi),this.needStartRotateHelperPoi&&this.showStartRotateHelperPoi(),console.log(this.startRotateHelperPoi)}this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(t){return Di(t,!1,!0,.1,170,2.5)}getPathDirection(){if(!this.curFloorPath||!this.currentPathPosition||this.curFloorPathPoints.length<2)return null;let t=ce(this.curFloorPathPoints,this.currentPathPosition),e=this.curFloorPathPoints[t],i=this.curFloorPathPoints[t+1],s=new At.Vector3(i[0]-e[0],i[1]-e[1],0).normalize(),o=new At.Vector3(0,1,0).normalize(),n=s.angleTo(o),r=new At.Vector3().crossVectors(o,s);return(Object.is(r.y,0)?-1:1)*n}getPathDirection2(){if(!this.curFloorPath||!this.toPointPosition||this.curFloorPathPoints.length<2)return null;let t=ce(this.curFloorPathPoints,this.toPointPosition),e=this.curFloorPathPoints[t],i=this.curFloorPathPoints[t+1];return(new At.Vector2(i[0]-e[0],i[1]-e[1]).normalize().angle()*180/Math.PI-90+360)%360}changeCameraToPathUp(t){return f(this,null,function*(){t===void 0&&(t=100);let e=this.getPathDirection();if(e===null)return;let i=this.bmap.context.control.getAzimuthalAngle();Math.abs(i-e)>Math.PI&&(i>0?e=Math.PI*2+e:e=e-Math.PI*2);let s=Math.abs(e-this.bmap.context.control.getAzimuthalAngle());if(s<.01)return;let{control:o}=this.bmap.context,n=t/Math.PI*6*s;return Ft(new Promise(r=>{let h={azimuthal:o.getAzimuthalAngle()},c={azimuthal:e},l=o.getPolarAngle(),{maxPolarAngle:p,minPolarAngle:d}=o;o.maxPolarAngle=l,o.minPolarAngle=l;let u=new fi.Tween(h,this.tweenUtil.group).to(c,n).easing(fi.Easing.Quadratic.InOut).onUpdate(()=>f(this,null,function*(){this.startPoi&&o.target.copy(this.startPoi.position),o.setAzimuthalAngle(h.azimuthal,!0),o.setTargetByOffset(this.options.offsetY)})).onComplete(()=>{o.enabled=!0,this.tweenUtil.remove(u),o.maxPolarAngle=p,o.minPolarAngle=d,r(!0)}).onStart(()=>{o.enabled=!1}).start()}),n+500).finally(()=>{this.bmap.context.control.enabled=!0})})}initNavigationCamera(t){return f(this,null,function*(){t===void 0&&(t=1e3);var e;let s=(e=this.taskQueue.getTasks().find(n=>n.meta.type==="initNavigationCamera"))==null?void 0:e.tid,o={run:()=>Ft(f(this,null,function*(){yield this.initCameraZoom(t/2),this.options.disablePathRotate||(yield this.changeCameraToPathUp(t/4)),yield this.translateCameraToStartPoi(t/(this.options.disablePathRotate?2:4))}),t+500).finally(()=>{this.bmap.context.control.enabled=!0}),meta:{type:"initNavigationCamera"}};s?this.taskQueue.replace(s,o):this.taskQueue.add(o)})}translateCameraToStartPoi(t){return f(this,null,function*(){if(t===void 0&&(t=100),!this.startPoi)return;let{clientSize:{width:e,height:i},camera:s,control:o}=this.bmap.context,n=Math.round(e/2),r=Math.round(i/2),h=o.target.clone(),c=D(this.startPoi.position,s,e,i),l=c.x-n,p=r-c.y+this.options.offsetY;if(!(Math.abs(l)<=1&&Math.abs(p)<=1)){if(Math.abs(l)>=1){let d=new At.Vector3;d.setFromMatrixColumn(s.matrix,0),d.normalize(),d.multiplyScalar(l/s.zoom),h.add(new At.Vector3(d.x,d.y,0))}if(Math.abs(p)>=1){let d=new At.Vector3;d.setFromMatrixColumn(s.matrix,1),d.normalize(),d.multiplyScalar(p/s.zoom),h.add(new At.Vector3(d.x,d.y,0))}return Ft(new Promise(d=>{let u=o.target.clone();console.log(u,h,t);let m=new fi.Tween(u,this.tweenUtil.group).to(h,t).onUpdate(()=>{this.bmap.context.control.setCameraPositionByTarget(u,0)}).onComplete(()=>{this.bmap.context.control.setCameraPositionByTarget(h,0),this.tweenUtil.remove(m),this.bmap.context.control.enabled=!0,d(!0)}).onStart(()=>{this.bmap.context.control.enabled=!1}).start()}),t+500).then(()=>{this.bmap.context.control.enabled=!0})}})}initCameraZoom(t){return f(this,null,function*(){if(t===void 0&&(t=100),!this.startPoi)return;let{clientSize:{width:e,height:i},currentFloor:s}=this.bmap.context,{max:o,min:n}=s.box,h=Math.min(e/(o.x-n.x),i/(o.y-n.y))*(o.x-n.x)/this.options.navigationCameraBasic;return this.bmap.context.setZoom(h,this.startPoi.position,t).finally(()=>{this.bmap.context.control.enabled=!0})})}toPosition(t,e){if(this.paths[this.curPathIndex]&&this.paths[this.curPathIndex].floor===t&&this.detachStartPoi){let i=this.translatePoints([e]);this.detachStartPoi.position.setX(i[0][0]),this.detachStartPoi.position.setY(i[0][1]),this.detachLine&&this.startPoi&&this.detachLine.setPosition(this.startPoi.position,this.detachStartPoi.position)}this.options.canBack&&(this.positionNavigation.pointIndex=0,this.positionNavigation.position=this.paths[this.curPathIndex].points[0]),this.positionNavigation.toPosition(t,e)}startSimulation(){this.positionNavigation.startSimulation()}setSimulationSpeed(t){this.positionNavigation.changeSimulationSpeed(t)}toPositionBySpeed(t,e){return f(this,null,function*(){let{currentPathPosition:i,curFloorPath:s,curFloorPathPoints:o}=this;if(!s||!i)return null;let n=this.movedDistance,r=Do(o,t);if(n===-1||r===-1||!this.options.canBack&&r<=n)return null;let h=r-n;if(!h)return;let c=Math.min(Math.abs(h)/e,this.options.runAnimationMaxTime);return this.pathTween&&this.clearTween(),Ft(new Promise(l=>{let p=this.pathTween=new fi.Tween({distance:0},this.tweenUtil.group).to({distance:h},c*1e3).onUpdate(d=>f(this,null,function*(){this.moveDistance(d.distance+n,p)})).onComplete(()=>{this.tweenUtil.remove(p),l(!0)}).start()}),c*1e3+500).finally(()=>{this.bmap.context.control.enabled=!0})})}moveDistance(t,e){return f(this,null,function*(){if(this.movedDistance=t,!this.options.disablePathShorten){var i;(i=this.path)==null||i.movePath(this.movedDistance/this.curFloorPathLength)}let s=Ze(this.curFloorPathPoints,this.movedDistance);if(s===null)return;this.currentPathPosition=s;let o=this.translatePoints([s])[0];this.startPoi&&(this.setStartPoiPosition(o[0],o[1]),this.options.disablePathAnimation||this.bmap.context.control.setTargetByOffset(this.options.offsetY,this.startPoi.position.clone())),!this.options.disablePathAnimation&&!this.options.disablePathRotate&&(e==null||e.pause(),yield this.changeCameraToPathUp(500/this.options.speed),e==null||e.resume())})}removeDetachStart(){if(this.detachLine&&(this.bmap.context.scene.remove(this.detachLine),this.detachLine.dispose(),this.detachLine=null),this.detachStartPoi){var t;(t=this.bmap.context.currentFloor)==null||t.poiLayer2.removePoi(this.detachStartPoi),this.detachStartPoi=null}}hideDetachStart(){this.showDetachStartState=!1,this.removeDetachStart()}showDetachStart(){if(!this.detachStartPoi&&(this.showDetachStartState=!0,this.path&&this.startPoi&&this.options.detachStartPoi)){var t;let e=this.startPoi.position;this.detachStartPoi=new tt(this.bmap.context,w({},this.options.detachStartPoi,{id:"navigation_detach_start_poi",position:e,collision_enable:!1}))||null,(t=this.bmap.context.currentFloor)==null||t.poiLayer2.pushPoi(this.detachStartPoi),this.detachLine=new ai(this.bmap.context,new At.Vector3(e.x,e.y,.51),new At.Vector3(e.x,e.y,.51)),this.bmap.context.scene.add(this.detachLine)}}setStartPoiRotate(t){this.startPoiRotate=t;let i=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360,s=(360-t-i)%360;this.detachStartPoi&&(this.detachStartPoi.options.icon_rotate=s),this.startPoi&&(this.startPoi.options.icon_rotate=s,this.startRotateHelperPoi&&this.startRotateHelperPoi.setAngle(s))}dispose(){var t;if(this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.hideDetachStart(),this.startPoi){var e;(e=this.bmap.context.currentFloor)==null||e.poiLayer2.removePoi(this.startPoi),this.startPoi=null}this.tweenUtil.dispose(),this.unRegistryEvent(),(t=this.startRotateHelperPoi)==null||t.dispose(),Se.dispose(),this.positionNavigation.dispose(),this.startRotateHelperPoi=null,super.dispose()}constructor(t,e={},i){super(t),this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curPathIndex=0,this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.toPointPosition=null,this.pathTween=null,this.startPoi=null,this.detachStartPoi=null,this.detachLine=null,this.startPoiRotate=null,this.startRotateHelperPoi=null,this.needStartRotateHelperPoi=!1,this.showDetachStartState=!0,this.movedDistance=0,this.pathStart=[0,0],this.tweenUtil=new Pe,this.taskQueue=new Ve,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onNavigationInfo=s=>{let{info:o}=s;if(this.dispatchEvent({type:"navigation-info",info:o}),!o.offset){if(o.routeIndex!==this.curPathIndex)return;this.toPointPosition=o.pos,this.toPositionByTask(o.pos)}},this.onUpdate=()=>{this.tweenUtil.update()},this.onSwitchFloor=s=>{let{data:{curFloor:o}}=s;if(this.clearTween(),this.paths[this.curPathIndex]){let n=this.paths[this.curPathIndex];this.setCurFloorPath(n!=null?n:null),n?this.renderPath(this.translatePoints(n.points)):this.clearPath()}else this.clearPath()},this.onControlChangeForStartPoi=()=>{this.startPoi&&this.startPoiRotate!==null&&this.setStartPoiRotate(this.startPoiRotate)},!i&&typeof e=="object"&&(i=e),this.options=Object.assign({},Xh,i),this.positionNavigation=new to(this,w({simulationSpeed:this.options.speed},this.options.positionNavigation),this.options.roadData),this.registryEvent()}};var rM=require("core-js/modules/web.dom-collections.iterator.js");var ms=require("three"),dn=class extends X{show(t,e){let i=0;t.forEach(n=>{n.onAddToScene("mulFloors"),n.position.z=i,i+=n.userData.height,n.poiLayer2.pois.forEach(r=>{r.options.depth_test=!0})});let{scene:s,currentFloor:o}=this.bmap.context;s.background=new ms.Color((e==null?void 0:e.backgroundColor)||"#f1f7f6"),o&&(s.remove(o),o.dispose()),this.group.add(...t),s.add(this.group),this.floors=t,this.fitCamera(),this.bmap.context.cameraBound.updateBox(),this.showStatus=!0,this.bmap.context.forceUpdate()}showStep(t,e){return this.show(t,e)}hide(){let{scene:t}=this.bmap.context;t.remove(this.group),this.floors.forEach(e=>{e.dispose()}),this.floors=[],this.group.clear(),this.showStatus=!1}showByNotDispose(t,e,i){i===void 0&&(i=()=>!0);let s=0;t.forEach(r=>{[...r.poiLayer2.pois].forEach(h=>{if(!i(h)){h.visible=!1;return}h.options.depth_test=!0}),r.position.z=s,s+=r.userData.height,r.onAddToScene("mulFloors")});let{scene:o,currentFloor:n}=this.bmap.context;o.background=new ms.Color((e==null?void 0:e.backgroundColor)||"#f1f7f6"),n&&o.remove(n),this.group.add(...t),o.add(this.group),this.floors=t,this.fitCamera(),this.bmap.context.cameraBound.updateBox(),this.showStatus=!0,this.bmap.context.forceUpdate()}hideByNotDispose(){let{scene:t}=this.bmap.context;t.remove(this.group),this.floors.forEach(e=>{e.poiLayer2.pois.forEach(i=>{i.visible=!0,i.options.depth_test=!1})}),this.floors.forEach(e=>{e.position.z=0,e.onRemoveFromScene()}),this.group.clear(),this.showStatus=!1}fitCamera(){let{context:t,config:e}=this.bmap;t.cameraBound.setEnable(!1),t.control.minZoom=0,t.control.maxZoom=1/0,t.camera.zoom=1,t.setAzimuthalAngle(e.control.defaultAzimuthal,0),t.setPolarAngle(e.control.defaultPolar,0),t.fitCameraToObject(this.group,e.defaultPadding,0,!1);let i=t.camera.zoom;t.control.minZoom=i,t.control.maxZoom=i*e.control.maxZoomScale,this.bmap.basicZoom=t.camera.zoom,t.control.addEventListener("change",this.bmap.onControlChange),this.bmap.onControlChange(),t.cameraBound.setEnable(!0)}dispose(){this.floors.forEach(t=>t.dispose()),this.floors=[],super.dispose()}constructor(t){super(t),this.floors=[],this.group=new ms.Group,this.showStatus=!1,this.group.name="mul-floor-group"}};var ma=require("three");var Yh={};function un(){return new Worker(new URL("./worker/path.worker-C7N3AIZ3.js",Yh.url))}var fs=class extends ma.EventDispatcher{setLiftPriority(t){return Z(this.worker,"onSetLiftPriority",t)}loaded(){return new Promise(t=>{if(this.initRoadStatus)t(!0);else{let e=i=>{let{status:s}=i;s&&(this.removeEventListener("init-road-status",e),t(!0))};this.addEventListener("init-road-status",e)}})}setRoadData(t,e){return f(this,null,function*(){this.initRoadStatus=!1,this.dispatchEvent({type:"init-road-status",status:!1}),yield Z(this.worker,"set_road_info",{roadData:t,facilities:e}),this.initRoadStatus=!0,this.dispatchEvent({type:"init-road-status",status:!0})})}getPath(t,e,i,s,o,n){return f(this,null,function*(){return i===void 0&&(i=""),new Promise((r,h)=>{let c=()=>{Z(this.worker,"get_path",{start:t,end:e,type:i,permission:s,travelDirection:o,options:n}).then(l=>{l?typeof l=="string"?h(l):r(l):h("no-path")})};if(this.initRoadStatus)c();else{let l=p=>{let{status:d}=p;d&&(this.removeEventListener("init-road-status",l),c())};this.addEventListener("init-road-status",l)}})})}getDirectionPath(t){return Z(this.worker,"get_direction_path",t)}dispose(){return f(this,null,function*(){Z(this.worker,"clear",""),this.worker.terminate()})}constructor(){super(),this.worker=un(),this.initRoadStatus=!1}};var fa=require("three");var qh={};function mn(){return new Worker(new URL("./worker/cr-path.worker-RCWZ3ILJ.js",qh.url))}var fn=class extends fa.EventDispatcher{setRoadData(t){return f(this,null,function*(){this.initRoadStatus=!1,this.dispatchEvent({type:"init-road-status",status:!1}),yield Z(this.worker,"set_road_info",{roadData:t}),this.initRoadStatus=!0,this.dispatchEvent({type:"init-road-status",status:!0})})}getPath(t,e,i){return f(this,null,function*(){return i===void 0&&(i=""),new Promise((s,o)=>{let n=()=>{Z(this.worker,"get_path",{start:t,end:e,type:i}).then(r=>{r?typeof r=="string"?o(r):s(r):o("no-path")})};if(this.initRoadStatus)n();else{let r=h=>{let{status:c}=h;c&&(this.removeEventListener("init-road-status",r),n())};this.addEventListener("init-road-status",r)}})})}getDirectionPath(t){return Z(this.worker,"get_direction_path",t)}dispose(){return f(this,null,function*(){Z(this.worker,"clear",""),this.worker.terminate()})}constructor(){super(),this.worker=mn(),this.initRoadStatus=!1}};var bM=require("core-js/modules/web.dom-collections.iterator.js"),SM=require("core-js/modules/es.set.difference.v2.js"),EM=require("core-js/modules/es.set.intersection.v2.js"),LM=require("core-js/modules/es.set.is-disjoint-from.v2.js"),CM=require("core-js/modules/es.set.is-subset-of.v2.js"),TM=require("core-js/modules/es.set.is-superset-of.v2.js"),kM=require("core-js/modules/es.set.symmetric-difference.v2.js"),DM=require("core-js/modules/es.set.union.v2.js"),AM=require("core-js/modules/es.array.push.js");var ga=require("three"),eo=class extends Wt{setEnable(t){super.setEnable(t),bt(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:i,clientHeight:s}}}=this,o=D(this.startPoint,e,i,s),n=D(this.endPoint,e,i,s),r={x:Math.min(o.x,n.x),y:Math.min(o.y,n.y)},h={x:Math.max(o.x,n.x),y:Math.max(o.y,n.y)},c=this.searchMapInFrustum(r,h);this.dispatchEvent({type:"selected",list:c})}}searchMapInFrustum(t,e){var i;let{context:s}=this;return((i=s.currentFloor)==null?void 0:i.graphicLayer.children.filter(o=>o instanceof lt&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,i){let{context:{camera:s,container:{clientWidth:o,clientHeight:n}}}=this;if(!t)return!1;if(!t.mesh){let d=t.getPosition();if(d){let u=D(d,s,o,n);return Me(u,e,i)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let r=t.mesh.geometry.boundingBox;if(!r)return!1;let{min:h,max:c}=r,l=D(h,s,o,n),p=D(c,s,o,n);return!(!Me(l,e,i)||!Me(p,e,i))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new ga.Frustum,this.onPointerDown=s=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(s);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=s=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(s);o&&(this.endPoint=o)},this.onPointerUp=s=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(s);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let s=this.getSvgCoordinate(this.startPoint),o=w({},s);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let n={x:Math.min(s.x,o.x),y:Math.min(s.y,o.y)},r=Math.abs(o.x-s.x),h=Math.abs(o.y-s.y);bt(this.rect,n.x,n.y,r,h)}else bt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:i}}}=t;this.rect=_e(i,e),this.svg.appendChild(this.rect),this.registryEvent()}};var $h={boxSelection:!1,elements:["graphic","poi"]},gn=class extends X{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.options.boxSelection||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.bmap.context.control.enablePan,this.prevRotateStatus=this.bmap.context.control.enableRotate,this.bmap.context.control.enablePan=!1,this.bmap.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.bmap.context.control.enablePan=!!this.prevPanStatus,this.bmap.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],pois:[...this._poiList],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.bmap.context.container.addEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.addEventListener("pointerup",this.onPointerUp),this.bmap.context.container.addEventListener("pointerout",this.onPointerOut),this.bmap.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.bmap.context.container.removeEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.removeEventListener("pointerup",this.onPointerUp),this.bmap.context.container.removeEventListener("pointerout",this.onPointerOut),this.bmap.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent(),super.dispose()}constructor(t,e={}){super(t),this._list=new Set,this._poiList=new Set,this.downPoint=null,this.isMultipleSelect=!1,this.onPointerDown=i=>{this.downPoint={x:i.offsetX,y:i.offsetY}},this.onPointerUp=i=>{if(!this.downPoint)return;let{offsetX:s,offsetY:o}=i,{x:n,y:r}=this.downPoint;if(Math.sqrt((n-s)**2+(r-o)**2)>3)return;let h=new Set,c=[],l=[];if(this.options.elements.includes("graphic")){let{graphics:p}=this.bmap.context.getGraphicsByDeviceXy(s,o);p.map(d=>h.add(d.options.id)),c.push(...p)}if(this.options.elements.includes("poi")){let p=this.bmap.context.getPoisByDeviceXy(s,o);l.push(...p),p.forEach(d=>{if(!h.has(d.options.id)){var u;let m=((u=this.bmap.context.currentFloor)==null?void 0:u.graphicLayer.graphicMap.get(d.options.id))||null;m&&(h.add(d.options.id),c.push(m))}})}(!this.options.boxSelection||!(He?i.metaKey:i.ctrlKey))&&(this._list.clear(),this._poiList.clear()),c.forEach(p=>this._list.add(p)),l.forEach(p=>this._poiList.add(p)),this.selectEnd(),this.downPoint=null},this.onPointerOut=i=>{this.disableBoxSelection()},this.onKeyDown=i=>{Ne(i.key)&&this.enableBoxSelection()},this.onKeyUp=i=>{Ne(i.key)&&this.disableBoxSelection()},this.onBoxSelected=i=>{let{list:s}=i;this._list.clear(),this._poiList.clear(),s.forEach(o=>{if(this.options.elements.includes("graphic")&&this._list.add(o),this.options.elements.includes("poi")){let n=this.bmap.getPoiById(o.options.id);n&&this._poiList.add(n)}}),this.selectEnd()},this.options=w({},$h,e),this.boxSelection=new eo(this.bmap.context),this.boxSelection.setEnable(!1),this.registryEvent()}};var BM=require("core-js/modules/es.array.push.js"),Ot=require("lodash");var F=function(a){return a.COMPASS="compass",a.DEVICE_MOTION="deviceMotion",a.ACCELERATION="acceleration",a.GPS="gps",a}({});var Jh={time:1e3,elements:[F.COMPASS,F.DEVICE_MOTION,F.ACCELERATION,F.GPS]},gs=class extends st{start(){this.options.elements.some(t=>[F.DEVICE_MOTION,F.COMPASS].includes(t))&&this.listenDeviceOrientation(),this.options.elements.includes(F.ACCELERATION)&&this.listenAcceleration(),this.options.elements.includes(F.GPS)&&this.listenGps(),this.dispatchEvent({type:"start"}),this.dispatchTimer=this.timer.setInterval(()=>{this.dispatchEvent({type:"sensor-data",data:(0,Ot.cloneDeep)(this.data)}),this.data=[]},this.options.time)}addDataItem(t){this.data.push(t),this.dispatchEvent({type:"add-data-item",item:t})}listenDeviceOrientation(){pe?window.addEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.addEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0})}listenAcceleration(){window.addEventListener("devicemotion",this.handleAcceleration,!1)}listenGps(){this.gpsTimer=navigator.geolocation.watchPosition(t=>{console.log("watch gps",t.coords),this.addDataItem({type:F.GPS,timestamp:Date.now(),res:[t.coords.longitude,t.coords.latitude,t.coords.accuracy]})},t=>{console.log("\u83B7\u53D6gps\u5931\u8D25",t)},{enableHighAccuracy:!0})}checkSensor(){return f(this,null,function*(){return{deviceOrientation:yield this.checkDeviceOrientation()}})}checkDeviceOrientation(){return f(this,null,function*(){var t;if(!pe)return!0;if(typeof window.DeviceOrientationEvent!="undefined"&&typeof((t=window.DeviceOrientationEvent)==null?void 0:t.requestPermission)=="function")try{var e;return(yield(e=window.DeviceOrientationEvent)==null?void 0:e.requestPermission())==="granted"}catch(i){return!1}return!1})}stop(){window.removeEventListener("devicemotion",this.handleAcceleration,!1),pe?window.removeEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.removeEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0}),(0,Ot.isNil)(this.gpsTimer)||navigator.geolocation.clearWatch(this.gpsTimer),this.dispatchTimer&&this.timer.clearInterval(this.dispatchTimer),this.data=[],this.dispatchEvent({type:"stop"})}constructor(t={}){super(),this.gpsTimer=null,this.data=[],this.timer=new j,this.dispatchTimer=null,this.addAcceleration=(0,Ot.throttle)(e=>{this.addDataItem(e)},20),this.deviceOrientationAbsHandler=(0,Ot.throttle)(e=>{let i=Date.now(),{alpha:s,beta:o,gamma:n}=e;if((0,Ot.isNil)(s)||(0,Ot.isNil)(o)||(0,Ot.isNil)(n))return;let r;pe?r=e.webkitCompassHeading:r=360-s,this.options.elements.includes(F.DEVICE_MOTION)&&this.addDataItem({type:F.DEVICE_MOTION,timestamp:i,res:[s,o,n]}),this.options.elements.includes(F.COMPASS)&&this.addDataItem({type:F.COMPASS,timestamp:i,res:r})},200),this.handleAcceleration=e=>{let i=e.accelerationIncludingGravity;(0,Ot.isNil)(i)||(0,Ot.isNil)(i.x)||(0,Ot.isNil)(i.y)||(0,Ot.isNil)(i.z)||this.addAcceleration({type:F.ACCELERATION,timestamp:Date.now(),res:[i.x,i.y,i.z]})},this.options=w({},Jh,t)}};var n_=require("core-js/modules/web.dom-collections.iterator.js");var QM=require("core-js/modules/es.array.push.js");var jM=require("core-js/modules/es.array.push.js"),VM=require("core-js/modules/web.dom-collections.iterator.js");function io(a,t){return 1/Math.sqrt(2*Math.PI*Math.pow(t,2))*Math.exp(-Math.pow(a,2)/(2*Math.pow(t,2)))}function ys(a){return(a+360)%360}function ya(a,t){let i=6378137*a*Math.PI/180,s=6378137*Math.log(Math.tan(Math.PI/4+t*Math.PI/180/2));return{x:i,y:s}}function gi(a,t,e,i){return Math.sqrt(Math.pow(Math.abs(a-e),2)+Math.pow(Math.abs(t-i),2))}var so=class{motionModelRotYaw(t){if(!(Math.abs(t)<.001)){this.last_yaw_compass=ys(this.last_yaw_compass+t);for(let e=0;e<this.NumParticle;e++){let i=Math.random()*this.yaw_noise_sigma;this.particleX[2][e]=this.particleX[2][e]+t+i,this.particleX[2][e]=ys(this.particleX[2][e])}}}motionModelStepLength(t,e){if(t===0)return;for(let s=0;s<this.NumParticle;s++){let o=Math.random()*this.step_noise_sigma;this.particleX[0][s]+=(.65+o)*Math.sin(-this.particleX[2][s]/180*Math.PI),this.particleX[1][s]+=(.65+o)*Math.cos(this.particleX[2][s]/180*Math.PI),e(this.particleX[0][s],this.particleX[1][s])||(this.particleWeight[0][s]*=this.unaccess_weight)}let i=this.particleWeight[0].reduce((s,o)=>s+o,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/i)}motionModelCompassYaw(t,e){if(e-this.last_compass_time>this.compass_update_interval){let i=360-t;i+=this.delta_yaw,i=ys(i),Math.abs(i-this.last_yaw_compass)>60?this.compass_consecutive_offset_count++:this.compass_consecutive_offset_count=0;for(let o=0;o<this.NumParticle;o++){let n=Math.abs(this.particleX[2][o]-i);n>180&&(n=360-n),this.particleWeight[0][o]*=io(n,this.sigmaCompass)}let s=this.particleWeight[0].reduce((o,n)=>o+n,0);this.particleWeight[0]=this.particleWeight[0].map(o=>o/s),this.setLastCompassTime(e)}}resampling(){if(1/this.particleWeight[0].reduce((e,i)=>e+i*i,0)<this.reSampNumParticle){let e=this.particleWeight[0].reduce((r,h,c)=>r.concat(r[c]+h),[0]),s=this.particleWeight[0].map(()=>1/this.NumParticle).map((r,h)=>r+Math.random()/this.NumParticle),o=[],n=0;for(let r=0;r<this.NumParticle;r++){for(;s[r]>e[n];)n++;o.push(n)}this.particleX=this.particleX.map((r,h)=>o.map(c=>r[c])),this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle)}}update(t,e){for(let s=0;s<this.NumParticle;s++){let o=gi(this.particleX[0][s],this.particleX[1][s],t.x,t.y);this.particleWeight[0][s]=Math.max(1e-7,this.particleWeight[0][s]*io(o,e))}let i=this.particleWeight[0].reduce((s,o)=>s+o,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/i)}updateCar(t,e){let i=t.x-this.xEst[0][0],s=t.y-this.xEst[1][0];for(let n=0;n<this.NumParticle;n++){let r=gi(this.particleX[0][n],this.particleX[1][n],t.x,t.y);this.particleWeight[0][n]=Math.max(1e-7,this.particleWeight[0][n]*io(r,e)),this.particleX[0][n]+=i,this.particleX[1][n]+=s}let o=this.particleWeight[0].reduce((n,r)=>n+r,0);this.particleWeight[0]=this.particleWeight[0].map(n=>n/o)}getPosInitFlag(){return this.particle_PosInitFlag}getYawInitFlag(){return this.particle_yawInitFlag}setPosInitFlag(t){this.particle_PosInitFlag=t}setYawInitFlag(t){this.particle_yawInitFlag=t}getResultX(){let t=[0,0,0];for(let e=0;e<3;e++)for(let i=0;i<this.NumParticle;i++)t[e]+=this.particleX[e][i]*this.particleWeight[0][i];return this.xEst=t.map(e=>[e]),this.xEst[0][0]}getResultY(){return this.xEst[1][0]}getResultYaw(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0]));return this.particleX[2][t]}getEstConfidence(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0])),e=this.particleWeight[0].indexOf(Math.min(...this.particleWeight[0])),i=[this.particleX[0][t],this.particleX[1][t]],s=[this.particleX[0][e],this.particleX[1][e]],o=gi(i[0],i[1],s[0],s[1]),n=o*.67;return console.log(o,n),n}getParticleNum(){return this.NumParticle}getParticleX(){return this.particleX}setLastCompassTime(t){this.last_compass_time=t}getLastCompassTime(){return this.last_compass_time}initParticlesByPos(t,e,i){if(!this.particle_PosInitFlag){this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle);let s=0;for(;s<this.NumParticle;){let n=(2*Math.random()-1)*this.initial_xy_uncertainty,r=(2*Math.random()-1)*this.initial_xy_uncertainty;i(t+n,e+r)||(this.particleWeight[0][s]*=this.unaccess_weight),this.particleX[0][s]=t+n,this.particleX[1][s]=e+r,s++}let o=this.particleWeight[0].reduce((n,r)=>n+r,0);this.particleWeight[0]=this.particleWeight[0].map(n=>n/o),this.particle_PosInitFlag=!0,this.xEst[0][0]=t,this.xEst[1][0]=e,this.xEst[2][0]=0}}initParticlesByCompass(t){console.log("Init compass: "+t);let e=360-t;e+=this.delta_yaw,e=ys(e),console.log("Init Yaw: "+e);for(let i=0;i<this.NumParticle;i++){let s=(2*Math.random()-1)*this.initial_yaw_uncertainty;this.particleX[2][i]=e+s}this.particle_yawInitFlag=!0,this.xEst[2][0]=e,this.last_yaw_compass=e,this.compass_consecutive_offset_count=0}constructor(t){this.last_yaw_compass=0,this.compass_consecutive_offset_count=0,this.NumParticle=t.NumParticle,this.reSampNumParticle=t.reSampNumParticle,this.initial_xy_uncertainty=t.initial_xy_uncertainty,this.initial_yaw_uncertainty=t.initial_yaw_uncertainty,this.step_noise_sigma=t.step_noise_sigma,this.yaw_noise_sigma=t.yaw_noise_sigma,this.compass_update_interval=t.compass_update_interval,this.sigmaCompass=t.sigmaCompass,this.delta_yaw=t.delta_yaw,this.sigmaBeacon=t.sigmaBeacon,this.unaccess_weight=t.unaccess_weight,this.particle_PosInitFlag=!1,this.particle_yawInitFlag=!1,this.xEst=[[0],[0],[0]],this.particleX=Array.from({length:3},()=>Array(this.NumParticle).fill(0)),this.particleWeight=Array.from({length:1},()=>Array(this.NumParticle).fill(1/this.NumParticle)),this.last_compass_time=0}};var YM=require("core-js/modules/es.array.push.js"),qM=require("core-js/modules/web.dom-collections.iterator.js");var oo=class{init(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10+.5,this.max_valley=10-.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.65,this.last_rot=[0,0,0],this.delta_rot=[0,0,0],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0,this.is_moving=!1,this.currentMotionState="UNKNOWN",this.previousMotionState="UNKNOWN",this.acc_variance_buffer=[],this.rot_variance_buffer=[],this.acc_buffer=[],this.walkingCount=0,this.stationaryCount=0,this.phoneUseCount=0,this.stateCounter=0}reset(){this.init()}setInitPose(t){t===void 0&&(t=[0,0]),this.last_px=t[0],this.last_py=t[1],console.info("pdr init pos: "+this.last_px+", "+this.last_py)}setInitYaw(t){t===void 0&&(t=0),this.last_yaw=t}getPos(t,e,i){let s=0;return i.length===3&&(this.delta_yaw=this.getDeltaYawFromRot(t,i)),e.length===3&&(s=this.getStepLength(t,e)),s!==0&&(this.last_px+=this.delta_px,this.last_py+=this.delta_py),[this.last_px,this.last_py]}getDeltaPose(){return[this.delta_px,this.delta_py]}getMotionState(){return this.currentMotionState}getStepLength(t,e){if(e.length<3)return console.warn("acc data less than 3"),0;let i=!1,s=Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2));if(this.accH_fifo.push(s),this.accH_time_fifo.push(t),this.imuFreUpdate(),!this.isMoving(e,this.last_rot))return 0;if(this.accH_fifo.length<this.accH_fifo_len+1)i=!1;else{for(;this.accH_fifo.length>=this.accH_fifo_len+1;)this.accH_fifo.shift(),this.accH_time_fifo.shift();let n=this.PVStepDetec(),r=this.FFTStepDetec(),h=this.recheckState(),c=this.accH_time_fifo[Math.floor(this.accH_time_fifo.length*3/4)];Math.abs(this.abnor_start_time)<.001&&this.abnor_fft_detected?this.abnor_start_time=c:this.abnor_fft_detected||(this.abnor_start_time=0),n&&r&&h?(this.step_count+=1,this.last_step_time=c,i=!0):Math.abs(this.abnor_start_time)>.001&&this.abnor_peak_time-this.abnor_start_time>this.abnor_time_threshold&&this.step_count>1&&this.abnor_peak_time-this.last_step_time>1?(this.step_count+=1,this.last_step_time=c,i=!0):(c-this.last_step_time>2&&(this.state_count=0),i=!1)}if(i){let n=this.last_yaw/180*Math.PI;return this.delta_px=this.const_step_length*Math.cos(n),this.delta_py=this.const_step_length*Math.sin(n),this.const_step_length}else return 0}imuFreUpdate(){if(this.accH_time_fifo.length>2&&(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]<0||this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]>10||this.accH_time_fifo[this.accH_time_fifo.length-1]===this.accH_time_fifo[0])&&(console.warn("pdr reset last one time "+this.accH_time_fifo[this.accH_time_fifo.length-1]+" last two time "+this.accH_time_fifo[this.accH_time_fifo.length-2]),this.reset()),this.accH_fifo.length>9||this.fre<15){let t=(this.accH_fifo.length-1)/(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[0]);Math.abs(this.fre-t)>8&&(this.fre=Math.round((t-3)/10)*10,(this.fre<=10||this.fre>=100)&&(console.warn("Frequency Error "+this.fre),this.fre=100),console.debug("Frequency change to "+this.fre),this.accH_fifo_len=Math.floor(1*this.fre)+1)}}recheckState(){return!0}PVStepDetec(){let t=!1,e=this.accH_fifo.slice(Math.floor(this.accH_fifo_len/2)),i=this.accH_time_fifo.slice(Math.floor(this.accH_fifo_len/2)),s=e[Math.floor(e.length/2)],o=i[Math.floor(i.length/2)],n=Math.max(...e),r=Math.min(...e),h=!1,c=!1;return Math.abs(s-r)<.01&&s<this.max_valley&&this.valley_num<=this.peak_num&&(this.last_valley_time===0?c=!0:c=o-this.last_valley_time>this.min_step_time,c&&(this.last_valley_time=o,this.valley_num+=1)),Math.abs(s-n)<.01&&s>this.min_peak&&this.peak_num<=this.valley_num&&(this.last_peak_time===0?h=!0:h=o-this.last_peak_time>this.min_step_time,h&&(this.last_peak_time=o,this.peak_num+=1)),s===n&&s>this.min_peak&&(this.abnor_peak_time=o,this.abnor_peak_accH=s),this.peak_num===this.valley_num&&(h||c)&&(t=!0),t}FFTStepDetec(){return!0}isMoving(t,e){if(t.length<3||e.length<3)return!1;this.acc_buffer.push([...t]),this.acc_buffer.length>this.static_window_size&&this.acc_buffer.shift();let i=Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2));this.acc_variance_buffer.push(i),this.acc_variance_buffer.length>this.static_window_size&&this.acc_variance_buffer.shift();let s=Math.abs(e[0])+Math.abs(e[1])+Math.abs(e[2]);if(this.rot_variance_buffer.push(s),this.rot_variance_buffer.length>this.static_window_size&&this.rot_variance_buffer.shift(),this.acc_variance_buffer.length<10)return this.is_moving;let o=this.acc_variance_buffer.slice(-10),n=this.rot_variance_buffer.slice(-10),r=this.calculateMean(o),h=this.calculateStdDeviation(o),c=this.calculateMean(n),l=this.calculateStdDeviation(n),p;return r>this.walkingThreshold&&h>.5?(this.walkingCount++,this.stationaryCount=0,this.phoneUseCount=0,p="WALKING"):r<this.phoneUseThreshold&&c>this.rotationThreshold?(this.phoneUseCount++,this.walkingCount=0,this.stationaryCount=0,p="USING_PHONE"):c<.5?(this.stationaryCount++,this.walkingCount=0,this.phoneUseCount=0,p="STATIONARY"):p="UNKNOWN",p!==this.currentMotionState?(this.stateCounter++,this.stateCounter>=this.stateChangeThreshold&&(this.previousMotionState=this.currentMotionState,this.currentMotionState=p,this.stateCounter=0,console.debug("Motion state changed: "+this.previousMotionState+" -> "+this.currentMotionState),console.debug("Stats: avgAcc="+r.toFixed(2)+", accStdDev="+h.toFixed(2)+", avgRot="+c.toFixed(2)+", rotStdDev="+l.toFixed(2)))):this.stateCounter=0,this.is_moving=this.currentMotionState==="WALKING",this.is_moving}calculateMean(t){return t.length===0?0:t.reduce((e,i)=>e+i,0)/t.length}calculateStdDeviation(t){if(t.length<2)return 0;let e=this.calculateMean(t),s=t.map(o=>{let n=o-e;return n*n}).reduce((o,n)=>o+n,0)/t.length;return Math.sqrt(s)}getMotionStatistics(){let t=this.acc_variance_buffer.slice(-10),e=this.rot_variance_buffer.slice(-10),i=this.calculateMean(t),s=this.calculateMean(e),o=this.calculateStdDeviation(t),n=this.calculateStdDeviation(e);return console.debug("\u8FD0\u52A8\u68C0\u6D4B: avgAcc="+i.toFixed(2)+", accStdDev="+o.toFixed(2)+", avgRot="+s.toFixed(2)+", rotStdDev="+n.toFixed(2)),console.debug("\u72B6\u6001\u5224\u65AD\u6761\u4EF6: \u884C\u8D70(avgAcc>"+this.walkingThreshold+", accStdDev>0.5), \u9759\u6B62(avgRot<0.5), \u624B\u673A(avgAcc<"+this.phoneUseThreshold+", avgRot>"+this.rotationThreshold+")"),console.debug("\u5F53\u524D\u72B6\u6001: "+this.currentMotionState+", \u8BA1\u6570: \u884C\u8D70="+this.walkingCount+", \u9759\u6B62="+this.stationaryCount+", \u624B\u673A="+this.phoneUseCount),{currentState:this.currentMotionState,avgAcceleration:i,avgRotation:s,accStdDeviation:o,rotStdDeviation:n,walkingCount:this.walkingCount,stationaryCount:this.stationaryCount,phoneUseCount:this.phoneUseCount,dataPoints:this.acc_variance_buffer.length,isMoving:this.is_moving}}getDeltaYawFromRot(t,e){if(e.length<3)return console.warn("rot data less than 3"),0;let i=[0,0,0];this.last_rot.length===3&&(i=e.map((r,h)=>r-this.last_rot[h]));for(let r=0;r<e.length;r++)i[r]<-180?i[r]+=360:i[r]>180&&(i[r]-=360);let s=.2;this.delta_rot.length===3?this.delta_rot=this.delta_rot.map((r,h)=>s*r+(1-s)*i[h]):this.delta_rot=i,this.last_rot=e,this.delta_yaw=this.delta_rot[0],this.last_yaw+=this.delta_yaw,this.last_yaw=this.limitYaw(this.last_yaw);let o=this.delta_rot.reduce((r,h)=>r+Math.abs(h),0);this.delta_rot_sum_fifo.push(o),this.delta_rot_sum_time_fifo.push(t),Math.abs(this.delta_rot_sum_time_fifo[this.delta_rot_sum_time_fifo.length-1]-this.delta_rot_sum_time_fifo[0])>1&&(this.delta_rot_sum_fifo.shift(),this.delta_rot_sum_time_fifo.shift()),this.delta_yaw_accum+=this.delta_yaw;let n=0;return Math.abs(this.delta_yaw_accum_timestamp-t)>this.delta_yaw_time_threshold?(n=this.delta_yaw_accum,this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=t,n):null}limitYaw(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}constructor(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10.5,this.max_valley=9.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_time_threshold=4,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.85,this.last_rot=[],this.delta_rot=[],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0,this.is_moving=!1,this.currentMotionState="UNKNOWN",this.previousMotionState="UNKNOWN",this.walkingThreshold=1,this.stationaryThreshold=.6,this.phoneUseThreshold=.7,this.rotationThreshold=.8,this.walkingCount=0,this.stationaryCount=0,this.phoneUseCount=0,this.stateCounter=0,this.stateChangeThreshold=3,this.static_window_size=20,this.acc_variance_buffer=[],this.rot_variance_buffer=[],this.acc_buffer=[]}};var Qh={using_gps:!0,gps_max_horizontalAccuracy:20,initial_gps_delay_time:3e3},no=class{pfFusionPDRiBeacon(t){let{type:e,timestamp:i,res:s}=t,o=!1;if(this.cacheSensorData.push(t),this.particleFilter.getPosInitFlag()&&this.particleFilter.getYawInitFlag()){if(e===F.ACCELERATION){let n=s,r=this.pdr.getStepLength(i/1e3,n);r!==0&&(this.particleFilter.motionModelStepLength(r,()=>!0),this.particleFilter.resampling(),this.position_count+=1,o=!0)}if(this.using_gps&&e===F.GPS)if(this.last_beacon_time===null||i-this.last_beacon_time>5e3){let n=this.getGpsPosition(s);o=n!==null,n&&(this.particleFilter.update(n,this.gps_horizontalAccuracy),this.resetParticleFilterDist(n,"gps",s[2]),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0)}else return[!1,0,0];if(e===F.DEVICE_MOTION){let n=this.pdr.getDeltaYawFromRot(i/1e3,s);n!==null&&this.particleFilter.motionModelRotYaw(n)}e===F.COMPASS&&this.particleFilter.motionModelCompassYaw(s,i),this.last_pos_time&&i-this.last_pos_time>500&&(this.position_count+=1,o=!0)}else if(!this.particleFilter.getPosInitFlag()&&this.using_gps&&e===F.GPS)if(this.startTime&&Date.now()-this.startTime>this.options.initial_gps_delay_time){let n=this.getGpsPosition(s);o=n!==null,console.log("gps_pos",n,s),n?(this.particleFilter.initParticlesByPos(n.x,n.y,()=>!0),this.last_pos_time=i,console.log("init Pos by gps success time "+i),this.cacheSensorData.length=0):console.log("init Pos by gps fail time "+i)}else this.startTime||(this.startTime=i);else if(!this.particleFilter.getYawInitFlag()&&e===F.COMPASS){let n=s;this.particleFilter.initParticlesByCompass(n),this.particleFilter.setLastCompassTime(i),console.log("init yaw by compass success time "+i)}return o&&(this.last_pos_time=i),[o,this.particleFilter.getResultX(),this.particleFilter.getResultY()]}setBeaconPosition(t,e){if(this.last_beacon_time=e,this.particleFilter.getPosInitFlag())this.particleFilter.update(t,this.sigmaBeacon);else{this.particleFilter.initParticlesByPos(t.x,t.y,()=>!0);let i=this.cacheSensorData.filter(s=>s.timestamp>e);console.log("\u521D\u59CBsensorData",i),i.map(s=>this.pfFusionPDRiBeacon(s))}return this.resetParticleFilterDist(t),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0,[this.particleFilter.getResultX(),this.particleFilter.getResultY()]}getGpsPosition(t){return t[2]>this.gps_max_horizontalAccuracy?null:ya(t[0],t[1])}resetParticleFilterDist(t,e,i){let s=this.particleFilter.getResultX(),o=this.particleFilter.getResultY(),n=gi(s,o,t.x,t.y);(e==="gps"?i&&n>i||n>this.GpsMaxEstimateErr:n>this.MaxEstimateErr)?(this.outTrustRegionNum+=1,this.outTrustRegionNum>=this.TrustNum&&(console.info("\u8D85\u51FA\u53EF\u4FE1\u533A\u57DF\uFF0C\u91CD\u7F6E\u7C92\u5B50\u8FC7\u6EE4\u5668\u5230: "+t.x+", "+t.y),this.particleFilter.setPosInitFlag(!1),this.particleFilter.setYawInitFlag(!1),this.outTrustRegionNum=0,this.startTime=Date.now())):this.outTrustRegionNum=0}constructor(t){this.sigmaBeacon=5,this.gps_horizontalAccuracy=10,this.using_gps=!0,this.last_beacon_time=Date.now(),this.position_count=0,this.gps_max_horizontalAccuracy=20,this.MaxEstimateErr=5,this.GpsMaxEstimateErr=30,this.outTrustRegionNum=0,this.TrustNum=1,this.cacheSensorData=[],this.startTime=null;let e=w({},Qh,t);this.options=e,this.using_gps=e.using_gps,this.gps_max_horizontalAccuracy=e.gps_max_horizontalAccuracy,this.particleFilter=new so({NumParticle:200,reSampNumParticle:.65,initial_xy_uncertainty:12,initial_yaw_uncertainty:100,step_noise_sigma:.5,yaw_noise_sigma:2,compass_update_interval:3e3,sigmaCompass:80,delta_yaw:2,sigmaBeacon:5,unaccess_weight:.7}),this.pdr=new oo}};var ro=require("@turf/turf"),vs=class extends st{checkSensor(){return this.sensor.checkSensor()}setSensor(t){this.sensor=t}start(){this.sensor.start(),this.pdr.startTime=Date.now(),this.sensor.addEventListener("add-data-item",t=>{let{item:e}=t;this.getPositionBySensorItem(e,!this._pause)})}pause(){this._pause=!0}continue(){this._pause=!1}getPositionBySensorItem(t,e){e===void 0&&(e=!0);let[i,s,o]=this.pdr.pfFusionPDRiBeacon(t);return i&&e&&(0,ro.booleanPointInPolygon)((0,ro.point)([s,o]),this.bmap.context.range)&&this.dispatchEvent({type:"position",x:s,y:o,_type:t.type===F.GPS?"gps":"pdr"}),[i,s,o]}setBeaconPosition(t,e){let[i,s]=this.pdr.setBeaconPosition(t,e);this.dispatchEvent({type:"position",x:i,y:s,_type:"beacon"})}dispose(){this.sensor.stop()}constructor(t,e={}){super(),this.bmap=t,this._pause=!1,this.sensor=new gs(e.sensor),this.pdr=new no(e.pdr||{})}};var E_=require("core-js/modules/web.dom-collections.iterator.js"),L_=require("core-js/modules/es.array.push.js");var d_=require("core-js/modules/web.dom-collections.iterator.js"),u_=require("core-js/modules/es.array.push.js"),m_=require("core-js/modules/es.array.flat.js"),f_=require("core-js/modules/es.array.unscopables.flat.js"),ft=require("three");var mt=require("three");mt.UniformsLib["custom-line"]={linewidth:{value:1},resolution:{value:new mt.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},repeat:{value:new mt.Vector2(1,1)},allDistance:{value:1}};mt.ShaderLib["custom-line"]={uniforms:mt.UniformsUtils.merge([mt.UniformsLib.common,mt.UniformsLib.fog,mt.UniformsLib["custom-line"]]),vertexShader:`
|
|
508
|
+
`,document.body.appendChild(a.canvas)}setAngle(t){if(console.log("angle",t),a.textureMap.has(t))this._initIcon(a.textureMap.get(t));else{this.draw(t);let e=this.getTexture(this.getImageData());a.textureMap.set(t,e),this._initIcon(e),this._initScale({zoom:this.bmap.context.camera.zoom})}}_initIcon(t){if(this.spriteIcon)this.spriteIcon.material.map=t,t.needsUpdate=!0;else{let e=new $t.Sprite(new $t.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI}));e.renderOrder=1e5+this.options.level,t.needsUpdate=!0,this.add(e),e.center.set(.5,.5),this.spriteIcon=e}}initSize(){this.spriteIcon&&this.spriteIcon.center.set(.5,.5)}draw(t){let{ctx:e}=a,{config:{size:i}}=this,s=i[0]/2,o=i[1]/2,n=4,r=1,h=n+r;if(e.clearRect(0,0,i[0],i[1]),e.setLineDash([10,10]),e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),e.arc(s,o,o-h,-Math.PI/2,Math.PI*2-Math.PI/2,t<Math.PI),e.stroke(),e.strokeStyle="#0A7AFF",t<Math.PI){let c=-Math.PI/2,l=c-t;e.beginPath(),e.arc(s,o,o-h,c,l,!0)}else{let c=-Math.PI/2,l=c+Math.PI*2-t;e.beginPath(),e.arc(s,o,o-h,c,l,!1)}e.stroke(),e.clearRect(s-h*2,0,h*4,h*4),e.beginPath(),e.arc(s,h,n,0,Math.PI*2),e.fillStyle="#0A7AFF",e.fill(),e.setLineDash([10,0]),e.strokeStyle="#fff",e.lineWidth=r,e.stroke(),e.clearRect(0,o-5,10,10),e.clearRect(s-5,i[1]-10,10,10),e.clearRect(i[0]-10,o-5,10,10),t>Math.PI/2&&t<Math.PI?e.fillStyle="#0A7AFF":e.fillStyle="#fff",e.fillRect(0,o-1,10,2),e.fillStyle="#fff",e.fillRect(s-1,i[1]-10,2,10),t>Math.PI&&t<Math.PI/2*3?e.fillStyle="#0A7AFF":e.fillStyle="#fff",e.fillRect(i[0]-10,o-1,10,2)}getImageData(){let{ctx:t}=a,{config:{size:e}}=this;return t.getImageData(0,0,e[0],e[1])}getTexture(t){let{config:{size:e}}=this,i=new $t.DataTexture(Uint8Array.from(t.data),e[0],e[1],$t.RGBAFormat);return i.format=$t.RGBAFormat,i.magFilter=$t.LinearFilter,i.minFilter=$t.LinearFilter,i.colorSpace="srgb",i.flipY=!0,i}dispose(){var t;super.dispose(),(t=this.spriteIcon)==null||t.material.dispose()}static dispose(){this.textureMap.forEach(t=>{t.dispose()}),this.textureMap.clear(),this.ctx=null,this.canvas=null}constructor(t,e){super(t.context,{icon_size:e.size,collision_enable:!1,level:2}),this.bmap=t,this.config=e,a.canvas.width=e.size[0],a.canvas.height=e.size[1]}};be.canvas=document.createElement("canvas");be.ctx=be.canvas.getContext("2d",{willReadFrequently:!0});be.textureMap=new Map;var $h={path:{},cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},positionNavigation:{},offsetY:150,directionEmitThreshold:5,disablePathAnimation:!1,disablePathRotate:!1,disablePathShorten:!1,speed:1,roadData:[],runAnimationMaxTime:1,navigationCameraBasic:45,canBack:!1},un=class extends X{get curFloorPathLength(){var t,e;return(e=(t=this.curFloorPath)==null?void 0:t.distance)!=null?e:0}get curFloorPathPoints(){var t,e;return(e=(t=this.curFloorPath)==null?void 0:t.points)!=null?e:[]}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener(yt.SWITCH_FLOOR_GROUND,this.onSwitchFloor),this.positionNavigation.addEventListener("navigation-info",this.onNavigationInfo),this.bmap.context.addEventListener("control-change",this.onControlChangeForStartPoi)}setRoadData(t){this.options.roadData=t,this.positionNavigation.setRoadData(t)}showStartRotateHelperPoi(){var t;if(this.needStartRotateHelperPoi=!0,!this.startPoi||this.startRotateHelperPoi)return;let e=this.startPoi.options.icon_size;this.startRotateHelperPoi=new be(this.bmap,{size:[e[0]+20,e[1]+20]}),this.startRotateHelperPoi.setAngle(0),this.startRotateHelperPoi.position.setZ(.51),(t=this.bmap.context.currentFloor)==null||t.poiLayer2.pushPoi(this.startRotateHelperPoi)}hideStartRotateHelperPoi(){if(this.needStartRotateHelperPoi=!1,this.startRotateHelperPoi){var t;(t=this.bmap.context.currentFloor)==null||t.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}setStartPoiPosition(t,e){this.startPoi&&(this.startPoi.position.setX(t).setY(e),this.startRotateHelperPoi&&this.startRotateHelperPoi.position.setX(t).setY(e),this.detachLine&&this.detachLine.setPosition(this.startPoi.position,this.detachStartPoi.position))}resetStatus(){this.pauseAnimation(),this.positionNavigation.resetStatus(this.paths),this.movedDistance=0,this.startPoi&&this.translatePath&&this.setStartPoiPosition(this.translatePath[0][0],this.translatePath[0][1])}toPositionByTask(t){var e;let s=(e=this.taskQueue.getTasks().find(n=>n.meta.type==="toPosition"))==null?void 0:e.tid,o={run:()=>this.toPositionBySpeed(t,this.options.speed),meta:{type:"toPosition"}};s?this.taskQueue.replace(s,o):this.taskQueue.add(o)}pauseAnimation(){this.taskQueue.clear(),this.positionNavigation.pause(),this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue(),this.positionNavigation.continue()}clearTween(){this.tweenUtil.clear(),this.taskQueue.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener(yt.SWITCH_FLOOR_GROUND,this.onSwitchFloor),this.positionNavigation.removeEventListener("navigation-info",this.onNavigationInfo),this.bmap.context.removeEventListener("control-change",this.onControlChangeForStartPoi)}clearPath(){if(this.resetStatus(),this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.clearTween()),this.startPoi){var t;if((t=this.bmap.context.currentFloor)==null||t.poiLayer2.removePoi(this.startPoi),this.startPoi=null,this.startRotateHelperPoi){var e;(e=this.bmap.context.currentFloor)==null||e.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}if(this.detachStartPoi){var i;(i=this.bmap.context.currentFloor)==null||i.removePoi2(this.detachStartPoi),this.detachStartPoi=null}this.detachLine&&(this.bmap.context.scene.remove(this.detachLine),this.detachLine.dispose(),this.detachLine=null),this.translatePath=null}setCurFloorPath(t){t===null?(this.curFloorPath=null,this.currentPathPosition=null,this.toPointPosition=null):(this.curFloorPath=t,this.currentPathPosition=t.points[0],this.toPointPosition=t.points[0]),this.movedDistance=0,this.clearTween()}setCurPathIndex(t){var e,i;this.curPathIndex=t,((e=this.paths[t])==null?void 0:e.floor)===((i=this.bmap.context.currentFloor)==null?void 0:i.name)?(this.setCurFloorPath(this.paths[t]),this.renderPath(this.translatePoints(this.curFloorPathPoints))):this.clearPath()}addPath(t,e){e===void 0&&(e=0);var i;this.paths=t,this.curPathIndex=e,this.clearTween(),this.clearPath();let s=(i=this.bmap.context.currentFloor)==null?void 0:i.name,o=t[e];if(s&&(o==null?void 0:o.floor)===s)if(this.setCurFloorPath(o),this.bmap.currentBuildGround)this.renderPath(this.translatePoints(o.points));else{let n=()=>{this.bmap.removeEventListener("center-change",n),this.renderPath(this.translatePoints(o.points))};this.bmap.addEventListener("center-change",n)}this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,i]=this.bmap.buildingCenter;return t.map(s=>[s[0]-e,s[1]-i])}renderPath(t){this.translatePath=t;let e=this.catmullRomCurve3(t);if(this.cPath=e,this.animationPathOptions={cPathIndex:0},this.pathStart=e[0],this.path?this.path.updatePoints(e):(this.path=new eo(this,this.options.path),this.path.create(e),this.path.position.z=this.bmap.context.currentFloor.groundMaxHeight+.5,this.bmap.context.scene.add(this.path)),this.path.movePath(0),this.startPoi){var i;if((i=this.bmap.context.currentFloor)==null||i.poiLayer2.removePoi(this.startPoi),this.startPoi=null,this.startRotateHelperPoi){var s;(s=this.bmap.context.currentFloor)==null||s.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}if(this.removeDetachStart(),this.showDetachStartState&&this.options.detachStartPoi){var o;this.detachStartPoi=new tt(this.bmap.context,w({},this.options.detachStartPoi,{id:"navigation_detach_start_poi",position:{x:e[0][0],y:e[0][1],z:.51},collision_enable:!1}))||null,(o=this.bmap.context.currentFloor)==null||o.poiLayer2.pushPoi(this.detachStartPoi),this.detachLine=new ai(this.bmap.context,new Dt.Vector3(e[0][0],e[0][1],.51),new Dt.Vector3(e[0][0],e[0][1],.51)),this.bmap.context.scene.add(this.detachLine)}if(this.options.needStartPoi){var n;this.startPoi=new tt(this.bmap.context,w({},this.options.startPoi,{id:"navigation_start_poi",position:{x:e[0][0],y:e[0][1],z:.51},collision_enable:!1}))||null,(n=this.bmap.context.currentFloor)==null||n.poiLayer2.pushPoi(this.startPoi),this.needStartRotateHelperPoi&&this.showStartRotateHelperPoi(),console.log(this.startRotateHelperPoi)}this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(t){return Di(t,!1,!0,.1,170,2.5)}getPathDirection(){if(!this.curFloorPath||!this.currentPathPosition||this.curFloorPathPoints.length<2)return null;let t=he(this.curFloorPathPoints,this.currentPathPosition),e=this.curFloorPathPoints[t],i=this.curFloorPathPoints[t+1],s=new Dt.Vector3(i[0]-e[0],i[1]-e[1],0).normalize(),o=new Dt.Vector3(0,1,0).normalize(),n=s.angleTo(o),r=new Dt.Vector3().crossVectors(o,s);return(Object.is(r.y,0)?-1:1)*n}getPathDirection2(){if(!this.curFloorPath||!this.toPointPosition||this.curFloorPathPoints.length<2)return null;let t=he(this.curFloorPathPoints,this.toPointPosition),e=this.curFloorPathPoints[t],i=this.curFloorPathPoints[t+1];return(new Dt.Vector2(i[0]-e[0],i[1]-e[1]).normalize().angle()*180/Math.PI-90+360)%360}changeCameraToPathUp(t){return f(this,null,function*(){t===void 0&&(t=100);let e=this.getPathDirection();if(e===null)return;let i=this.bmap.context.control.getAzimuthalAngle();Math.abs(i-e)>Math.PI&&(i>0?e=Math.PI*2+e:e=e-Math.PI*2);let s=Math.abs(e-this.bmap.context.control.getAzimuthalAngle());if(s<.01)return;let{control:o}=this.bmap.context,n=t/Math.PI*6*s;return Gt(new Promise(r=>{let h={azimuthal:o.getAzimuthalAngle()},c={azimuthal:e},l=o.getPolarAngle(),{maxPolarAngle:p,minPolarAngle:d}=o;o.maxPolarAngle=l,o.minPolarAngle=l;let u=new fi.Tween(h,this.tweenUtil.group).to(c,n).easing(fi.Easing.Quadratic.InOut).onUpdate(()=>f(this,null,function*(){this.startPoi&&o.target.copy(this.startPoi.position),o.setAzimuthalAngle(h.azimuthal,!0),o.setTargetByOffset(this.options.offsetY)})).onComplete(()=>{o.enabled=!0,this.tweenUtil.remove(u),o.maxPolarAngle=p,o.minPolarAngle=d,r(!0)}).onStart(()=>{o.enabled=!1}).start()}),n+500).finally(()=>{this.bmap.context.control.enabled=!0})})}initNavigationCamera(t){return f(this,null,function*(){t===void 0&&(t=1e3);var e;let s=(e=this.taskQueue.getTasks().find(n=>n.meta.type==="initNavigationCamera"))==null?void 0:e.tid,o={run:()=>Gt(f(this,null,function*(){yield this.initCameraZoom(t/2),this.options.disablePathRotate||(yield this.changeCameraToPathUp(t/4)),yield this.translateCameraToStartPoi(t/(this.options.disablePathRotate?2:4))}),t+500).finally(()=>{this.bmap.context.control.enabled=!0}),meta:{type:"initNavigationCamera"}};s?this.taskQueue.replace(s,o):this.taskQueue.add(o)})}translateCameraToStartPoi(t){return f(this,null,function*(){if(t===void 0&&(t=100),!this.startPoi)return;let{clientSize:{width:e,height:i},camera:s,control:o}=this.bmap.context,n=Math.round(e/2),r=Math.round(i/2),h=o.target.clone(),c=D(this.startPoi.position,s,e,i),l=c.x-n,p=r-c.y+this.options.offsetY;if(!(Math.abs(l)<=1&&Math.abs(p)<=1)){if(Math.abs(l)>=1){let d=new Dt.Vector3;d.setFromMatrixColumn(s.matrix,0),d.normalize(),d.multiplyScalar(l/s.zoom),h.add(new Dt.Vector3(d.x,d.y,0))}if(Math.abs(p)>=1){let d=new Dt.Vector3;d.setFromMatrixColumn(s.matrix,1),d.normalize(),d.multiplyScalar(p/s.zoom),h.add(new Dt.Vector3(d.x,d.y,0))}return Gt(new Promise(d=>{let u=o.target.clone();console.log(u,h,t);let m=new fi.Tween(u,this.tweenUtil.group).to(h,t).onUpdate(()=>{this.bmap.context.control.setCameraPositionByTarget(u,0)}).onComplete(()=>{this.bmap.context.control.setCameraPositionByTarget(h,0),this.tweenUtil.remove(m),this.bmap.context.control.enabled=!0,d(!0)}).onStart(()=>{this.bmap.context.control.enabled=!1}).start()}),t+500).then(()=>{this.bmap.context.control.enabled=!0})}})}initCameraZoom(t){return f(this,null,function*(){if(t===void 0&&(t=100),!this.startPoi)return;let{clientSize:{width:e,height:i},currentFloor:s}=this.bmap.context,{max:o,min:n}=s.box,h=Math.min(e/(o.x-n.x),i/(o.y-n.y))*(o.x-n.x)/this.options.navigationCameraBasic;return this.bmap.context.setZoom(h,this.startPoi.position,t).finally(()=>{this.bmap.context.control.enabled=!0})})}toPosition(t,e){if(this.paths[this.curPathIndex]&&this.paths[this.curPathIndex].floor===t&&this.detachStartPoi){let i=this.translatePoints([e]);this.detachStartPoi.position.setX(i[0][0]),this.detachStartPoi.position.setY(i[0][1]),this.detachLine&&this.startPoi&&this.detachLine.setPosition(this.startPoi.position,this.detachStartPoi.position)}this.options.canBack&&(this.positionNavigation.pointIndex=0,this.positionNavigation.position=this.paths[this.curPathIndex].points[0]),this.positionNavigation.toPosition(t,e)}startSimulation(){this.positionNavigation.startSimulation()}setSimulationSpeed(t){this.positionNavigation.changeSimulationSpeed(t)}toPositionBySpeed(t,e){return f(this,null,function*(){let{currentPathPosition:i,curFloorPath:s,curFloorPathPoints:o}=this;if(!s||!i)return null;let n=this.movedDistance,r=Io(o,t);if(n===-1||r===-1||!this.options.canBack&&r<=n)return null;let h=r-n;if(!h)return;let c=Math.min(Math.abs(h)/e,this.options.runAnimationMaxTime);return this.pathTween&&this.clearTween(),Gt(new Promise(l=>{let p=this.pathTween=new fi.Tween({distance:0},this.tweenUtil.group).to({distance:h},c*1e3).onUpdate(d=>f(this,null,function*(){this.moveDistance(d.distance+n,p)})).onComplete(()=>{this.tweenUtil.remove(p),l(!0)}).start()}),c*1e3+500).finally(()=>{this.bmap.context.control.enabled=!0})})}moveDistance(t,e){return f(this,null,function*(){if(this.movedDistance=t,!this.options.disablePathShorten){var i;(i=this.path)==null||i.movePath(this.movedDistance/this.curFloorPathLength)}let s=Ze(this.curFloorPathPoints,this.movedDistance);if(s===null)return;this.currentPathPosition=s;let o=this.translatePoints([s])[0];this.startPoi&&(this.setStartPoiPosition(o[0],o[1]),this.options.disablePathAnimation||this.bmap.context.control.setTargetByOffset(this.options.offsetY,this.startPoi.position.clone())),!this.options.disablePathAnimation&&!this.options.disablePathRotate&&(e==null||e.pause(),yield this.changeCameraToPathUp(500/this.options.speed),e==null||e.resume())})}removeDetachStart(){if(this.detachLine&&(this.bmap.context.scene.remove(this.detachLine),this.detachLine.dispose(),this.detachLine=null),this.detachStartPoi){var t;(t=this.bmap.context.currentFloor)==null||t.poiLayer2.removePoi(this.detachStartPoi),this.detachStartPoi=null}}hideDetachStart(){this.showDetachStartState=!1,this.removeDetachStart()}showDetachStart(){if(!this.detachStartPoi&&(this.showDetachStartState=!0,this.path&&this.startPoi&&this.options.detachStartPoi)){var t;let e=this.startPoi.position;this.detachStartPoi=new tt(this.bmap.context,w({},this.options.detachStartPoi,{id:"navigation_detach_start_poi",position:e,collision_enable:!1}))||null,(t=this.bmap.context.currentFloor)==null||t.poiLayer2.pushPoi(this.detachStartPoi),this.detachLine=new ai(this.bmap.context,new Dt.Vector3(e.x,e.y,.51),new Dt.Vector3(e.x,e.y,.51)),this.bmap.context.scene.add(this.detachLine)}}setStartPoiRotate(t){this.startPoiRotate=t;let i=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360,s=(360-t-i)%360;this.detachStartPoi&&(this.detachStartPoi.options.icon_rotate=s),this.startPoi&&(this.startPoi.options.icon_rotate=s,this.startRotateHelperPoi&&this.startRotateHelperPoi.setAngle(s))}dispose(){var t;if(this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.hideDetachStart(),this.startPoi){var e;(e=this.bmap.context.currentFloor)==null||e.poiLayer2.removePoi(this.startPoi),this.startPoi=null}this.tweenUtil.dispose(),this.unRegistryEvent(),(t=this.startRotateHelperPoi)==null||t.dispose(),be.dispose(),this.positionNavigation.dispose(),this.startRotateHelperPoi=null,super.dispose()}constructor(t,e={},i){super(t),this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curPathIndex=0,this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.toPointPosition=null,this.pathTween=null,this.startPoi=null,this.detachStartPoi=null,this.detachLine=null,this.startPoiRotate=null,this.startRotateHelperPoi=null,this.needStartRotateHelperPoi=!1,this.showDetachStartState=!0,this.movedDistance=0,this.pathStart=[0,0],this.tweenUtil=new _e,this.taskQueue=new Ve,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onNavigationInfo=s=>{let{info:o}=s;if(this.dispatchEvent({type:"navigation-info",info:o}),!o.offset){if(o.routeIndex!==this.curPathIndex)return;this.toPointPosition=o.pos,this.toPositionByTask(o.pos)}},this.onUpdate=()=>{this.tweenUtil.update()},this.onSwitchFloor=s=>{let{data:{curFloor:o}}=s;if(this.clearTween(),this.paths[this.curPathIndex]){let n=this.paths[this.curPathIndex];this.setCurFloorPath(n!=null?n:null),n?this.renderPath(this.translatePoints(n.points)):this.clearPath()}else this.clearPath()},this.onControlChangeForStartPoi=()=>{this.startPoi&&this.startPoiRotate!==null&&this.setStartPoiRotate(this.startPoiRotate)},!i&&typeof e=="object"&&(i=e),this.options=Object.assign({},$h,i),this.positionNavigation=new io(this,w({simulationSpeed:this.options.speed},this.options.positionNavigation),this.options.roadData),this.registryEvent()}};var cM=require("core-js/modules/web.dom-collections.iterator.js");var gs=require("three"),mn=class extends X{show(t,e){let i=0;t.forEach(n=>{n.onAddToScene("mulFloors"),n.position.z=i,i+=n.userData.height,n.poiLayer2.pois.forEach(r=>{r.options.depth_test=!0})});let{scene:s,currentFloor:o}=this.bmap.context;s.background=new gs.Color((e==null?void 0:e.backgroundColor)||"#f1f7f6"),o&&(s.remove(o),o.dispose()),this.group.add(...t),s.add(this.group),this.floors=t,this.fitCamera(),this.bmap.context.cameraBound.updateBox(),this.showStatus=!0,this.bmap.context.forceUpdate()}showStep(t,e){return this.show(t,e)}hide(){let{scene:t}=this.bmap.context;t.remove(this.group),this.floors.forEach(e=>{e.dispose()}),this.floors=[],this.group.clear(),this.showStatus=!1}showByNotDispose(t,e,i){i===void 0&&(i=()=>!0);let s=0;t.forEach(r=>{[...r.poiLayer2.pois].forEach(h=>{if(!i(h)){h.visible=!1;return}h.options.depth_test=!0}),r.position.z=s,s+=r.userData.height,r.onAddToScene("mulFloors")});let{scene:o,currentFloor:n}=this.bmap.context;o.background=new gs.Color((e==null?void 0:e.backgroundColor)||"#f1f7f6"),n&&o.remove(n),this.group.add(...t),o.add(this.group),this.floors=t,this.fitCamera(),this.bmap.context.cameraBound.updateBox(),this.showStatus=!0,this.bmap.context.forceUpdate()}hideByNotDispose(){let{scene:t}=this.bmap.context;t.remove(this.group),this.floors.forEach(e=>{e.poiLayer2.pois.forEach(i=>{i.visible=!0,i.options.depth_test=!1})}),this.floors.forEach(e=>{e.position.z=0,e.onRemoveFromScene()}),this.group.clear(),this.showStatus=!1}fitCamera(){let{context:t,config:e}=this.bmap;t.cameraBound.setEnable(!1),t.control.minZoom=0,t.control.maxZoom=1/0,t.camera.zoom=1,t.setAzimuthalAngle(e.control.defaultAzimuthal,0),t.setPolarAngle(e.control.defaultPolar,0),t.fitCameraToObject(this.group,e.defaultPadding,0,!1);let i=t.camera.zoom;t.control.minZoom=i,t.control.maxZoom=i*e.control.maxZoomScale,this.bmap.basicZoom=t.camera.zoom,t.control.addEventListener("change",this.bmap.onControlChange),this.bmap.onControlChange(),t.cameraBound.setEnable(!0)}dispose(){this.floors.forEach(t=>t.dispose()),this.floors=[],super.dispose()}constructor(t){super(t),this.floors=[],this.group=new gs.Group,this.showStatus=!1,this.group.name="mul-floor-group"}};var ya=require("three");var va=require("lodash");var Jh={};function fn(){return new Worker(new URL("./worker/path.worker-Q34IHRMK.js",Jh.url))}var ga={useWorker:!1},ys=class extends ya.EventDispatcher{setLiftPriority(t){return f(this,null,function*(){var e;(e=this.roadNetwork)==null||e.setLiftPriority(t),this.worker&&(yield Z(this.worker,"onSetLiftPriority",t))})}loaded(){return new Promise(t=>{if(this.initRoadStatus)t(!0);else{let e=i=>{let{status:s}=i;s&&(this.removeEventListener("init-road-status",e),t(!0))};this.addEventListener("init-road-status",e)}})}setRoadData(t,e){return f(this,null,function*(){this.initRoadStatus=!1,this.dispatchEvent({type:"init-road-status",status:!1}),this.roadNetwork&&this.roadNetwork.initRoute(t,e),this.worker&&(yield Z(this.worker,"set_road_info",{roadData:t,facilities:e})),this.initRoadStatus=!0,this.dispatchEvent({type:"init-road-status",status:!0})})}getPath(t,e,i,s,o,n){return f(this,null,function*(){return i===void 0&&(i=""),new Promise((r,h)=>f(this,null,function*(){yield this.loaded();function c(l){l?typeof l=="string"?h(l):r(l):h("no-path")}if(this.roadNetwork){let l=this.roadNetwork.getPath(t,e,i,s,o,n);c(l)}else if(this.worker){let l=yield Z(this.worker,"get_path",{start:t,end:e,type:i,permission:s,travelDirection:o,options:n});c(l)}else console.log("\u6CA1\u6709\u521D\u59CB\u5316\u8DEF\u7F51"),h("no-road-network")}))})}getDirectionPath(t){return f(this,null,function*(){return this.worker?Z(this.worker,"get_direction_path",t):Oo(t)})}dispose(){return f(this,null,function*(){this.roadNetwork&&this.roadNetwork.clear(),this.worker&&(yield Z(this.worker,"clear",""),this.worker.terminate())})}constructor(t=ga){super(),this.worker=null,this.initRoadStatus=!1,this.roadNetwork=null,this.options=(0,va.merge)({},ga,t),this.options.useWorker?this.worker=fn():this.roadNetwork=new Oi}};var xa=require("three");var Qh={};function gn(){return new Worker(new URL("./worker/cr-path.worker-RCWZ3ILJ.js",Qh.url))}var yn=class extends xa.EventDispatcher{setRoadData(t){return f(this,null,function*(){this.initRoadStatus=!1,this.dispatchEvent({type:"init-road-status",status:!1}),yield Z(this.worker,"set_road_info",{roadData:t}),this.initRoadStatus=!0,this.dispatchEvent({type:"init-road-status",status:!0})})}getPath(t,e,i){return f(this,null,function*(){return i===void 0&&(i=""),new Promise((s,o)=>{let n=()=>{Z(this.worker,"get_path",{start:t,end:e,type:i}).then(r=>{r?typeof r=="string"?o(r):s(r):o("no-path")})};if(this.initRoadStatus)n();else{let r=h=>{let{status:c}=h;c&&(this.removeEventListener("init-road-status",r),n())};this.addEventListener("init-road-status",r)}})})}getDirectionPath(t){return Z(this.worker,"get_direction_path",t)}dispose(){return f(this,null,function*(){Z(this.worker,"clear",""),this.worker.terminate()})}constructor(){super(),this.worker=gn(),this.initRoadStatus=!1}};var CM=require("core-js/modules/web.dom-collections.iterator.js"),TM=require("core-js/modules/es.set.difference.v2.js"),kM=require("core-js/modules/es.set.intersection.v2.js"),DM=require("core-js/modules/es.set.is-disjoint-from.v2.js"),AM=require("core-js/modules/es.set.is-subset-of.v2.js"),OM=require("core-js/modules/es.set.is-superset-of.v2.js"),IM=require("core-js/modules/es.set.symmetric-difference.v2.js"),RM=require("core-js/modules/es.set.union.v2.js"),GM=require("core-js/modules/es.array.push.js");var wa=require("three"),so=class extends Bt{setEnable(t){super.setEnable(t),bt(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:i,clientHeight:s}}}=this,o=D(this.startPoint,e,i,s),n=D(this.endPoint,e,i,s),r={x:Math.min(o.x,n.x),y:Math.min(o.y,n.y)},h={x:Math.max(o.x,n.x),y:Math.max(o.y,n.y)},c=this.searchMapInFrustum(r,h);this.dispatchEvent({type:"selected",list:c})}}searchMapInFrustum(t,e){var i;let{context:s}=this;return((i=s.currentFloor)==null?void 0:i.graphicLayer.children.filter(o=>o instanceof lt&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,i){let{context:{camera:s,container:{clientWidth:o,clientHeight:n}}}=this;if(!t)return!1;if(!t.mesh){let d=t.getPosition();if(d){let u=D(d,s,o,n);return we(u,e,i)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let r=t.mesh.geometry.boundingBox;if(!r)return!1;let{min:h,max:c}=r,l=D(h,s,o,n),p=D(c,s,o,n);return!(!we(l,e,i)||!we(p,e,i))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new wa.Frustum,this.onPointerDown=s=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(s);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=s=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(s);o&&(this.endPoint=o)},this.onPointerUp=s=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(s);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let s=this.getSvgCoordinate(this.startPoint),o=w({},s);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let n={x:Math.min(s.x,o.x),y:Math.min(s.y,o.y)},r=Math.abs(o.x-s.x),h=Math.abs(o.y-s.y);bt(this.rect,n.x,n.y,r,h)}else bt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:i}}}=t;this.rect=Me(i,e),this.svg.appendChild(this.rect),this.registryEvent()}};var tc={boxSelection:!1,elements:["graphic","poi"]},vn=class extends X{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.options.boxSelection||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.bmap.context.control.enablePan,this.prevRotateStatus=this.bmap.context.control.enableRotate,this.bmap.context.control.enablePan=!1,this.bmap.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.bmap.context.control.enablePan=!!this.prevPanStatus,this.bmap.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],pois:[...this._poiList],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.bmap.context.container.addEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.addEventListener("pointerup",this.onPointerUp),this.bmap.context.container.addEventListener("pointerout",this.onPointerOut),this.bmap.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.bmap.context.container.removeEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.removeEventListener("pointerup",this.onPointerUp),this.bmap.context.container.removeEventListener("pointerout",this.onPointerOut),this.bmap.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent(),super.dispose()}constructor(t,e={}){super(t),this._list=new Set,this._poiList=new Set,this.downPoint=null,this.isMultipleSelect=!1,this.onPointerDown=i=>{this.downPoint={x:i.offsetX,y:i.offsetY}},this.onPointerUp=i=>{if(!this.downPoint)return;let{offsetX:s,offsetY:o}=i,{x:n,y:r}=this.downPoint;if(Math.sqrt((n-s)**2+(r-o)**2)>3)return;let h=new Set,c=[],l=[];if(this.options.elements.includes("graphic")){let{graphics:p}=this.bmap.context.getGraphicsByDeviceXy(s,o);p.map(d=>h.add(d.options.id)),c.push(...p)}if(this.options.elements.includes("poi")){let p=this.bmap.context.getPoisByDeviceXy(s,o);l.push(...p),p.forEach(d=>{if(!h.has(d.options.id)){var u;let m=((u=this.bmap.context.currentFloor)==null?void 0:u.graphicLayer.graphicMap.get(d.options.id))||null;m&&(h.add(d.options.id),c.push(m))}})}(!this.options.boxSelection||!(He?i.metaKey:i.ctrlKey))&&(this._list.clear(),this._poiList.clear()),c.forEach(p=>this._list.add(p)),l.forEach(p=>this._poiList.add(p)),this.selectEnd(),this.downPoint=null},this.onPointerOut=i=>{this.disableBoxSelection()},this.onKeyDown=i=>{Ne(i.key)&&this.enableBoxSelection()},this.onKeyUp=i=>{Ne(i.key)&&this.disableBoxSelection()},this.onBoxSelected=i=>{let{list:s}=i;this._list.clear(),this._poiList.clear(),s.forEach(o=>{if(this.options.elements.includes("graphic")&&this._list.add(o),this.options.elements.includes("poi")){let n=this.bmap.getPoiById(o.options.id);n&&this._poiList.add(n)}}),this.selectEnd()},this.options=w({},tc,e),this.boxSelection=new so(this.bmap.context),this.boxSelection.setEnable(!1),this.registryEvent()}};var NM=require("core-js/modules/es.array.push.js"),At=require("lodash");var F=function(a){return a.COMPASS="compass",a.DEVICE_MOTION="deviceMotion",a.ACCELERATION="acceleration",a.GPS="gps",a}({});var ec={time:1e3,elements:[F.COMPASS,F.DEVICE_MOTION,F.ACCELERATION,F.GPS]},vs=class extends st{start(){this.options.elements.some(t=>[F.DEVICE_MOTION,F.COMPASS].includes(t))&&this.listenDeviceOrientation(),this.options.elements.includes(F.ACCELERATION)&&this.listenAcceleration(),this.options.elements.includes(F.GPS)&&this.listenGps(),this.dispatchEvent({type:"start"}),this.dispatchTimer=this.timer.setInterval(()=>{this.dispatchEvent({type:"sensor-data",data:(0,At.cloneDeep)(this.data)}),this.data=[]},this.options.time)}addDataItem(t){this.data.push(t),this.dispatchEvent({type:"add-data-item",item:t})}listenDeviceOrientation(){le?window.addEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.addEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0})}listenAcceleration(){window.addEventListener("devicemotion",this.handleAcceleration,!1)}listenGps(){this.gpsTimer=navigator.geolocation.watchPosition(t=>{console.log("watch gps",t.coords),this.addDataItem({type:F.GPS,timestamp:Date.now(),res:[t.coords.longitude,t.coords.latitude,t.coords.accuracy]})},t=>{console.log("\u83B7\u53D6gps\u5931\u8D25",t)},{enableHighAccuracy:!0})}checkSensor(){return f(this,null,function*(){return{deviceOrientation:yield this.checkDeviceOrientation()}})}checkDeviceOrientation(){return f(this,null,function*(){var t;if(!le)return!0;if(typeof window.DeviceOrientationEvent!="undefined"&&typeof((t=window.DeviceOrientationEvent)==null?void 0:t.requestPermission)=="function")try{var e;return(yield(e=window.DeviceOrientationEvent)==null?void 0:e.requestPermission())==="granted"}catch(i){return!1}return!1})}stop(){window.removeEventListener("devicemotion",this.handleAcceleration,!1),le?window.removeEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.removeEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0}),(0,At.isNil)(this.gpsTimer)||navigator.geolocation.clearWatch(this.gpsTimer),this.dispatchTimer&&this.timer.clearInterval(this.dispatchTimer),this.data=[],this.dispatchEvent({type:"stop"})}constructor(t={}){super(),this.gpsTimer=null,this.data=[],this.timer=new j,this.dispatchTimer=null,this.addAcceleration=(0,At.throttle)(e=>{this.addDataItem(e)},20),this.deviceOrientationAbsHandler=(0,At.throttle)(e=>{let i=Date.now(),{alpha:s,beta:o,gamma:n}=e;if((0,At.isNil)(s)||(0,At.isNil)(o)||(0,At.isNil)(n))return;let r;le?r=e.webkitCompassHeading:r=360-s,this.options.elements.includes(F.DEVICE_MOTION)&&this.addDataItem({type:F.DEVICE_MOTION,timestamp:i,res:[s,o,n]}),this.options.elements.includes(F.COMPASS)&&this.addDataItem({type:F.COMPASS,timestamp:i,res:r})},200),this.handleAcceleration=e=>{let i=e.accelerationIncludingGravity;(0,At.isNil)(i)||(0,At.isNil)(i.x)||(0,At.isNil)(i.y)||(0,At.isNil)(i.z)||this.addAcceleration({type:F.ACCELERATION,timestamp:Date.now(),res:[i.x,i.y,i.z]})},this.options=w({},ec,t)}};var c_=require("core-js/modules/web.dom-collections.iterator.js");var s_=require("core-js/modules/es.array.push.js");var YM=require("core-js/modules/es.array.push.js"),qM=require("core-js/modules/web.dom-collections.iterator.js");function oo(a,t){return 1/Math.sqrt(2*Math.PI*Math.pow(t,2))*Math.exp(-Math.pow(a,2)/(2*Math.pow(t,2)))}function xs(a){return(a+360)%360}function Ma(a,t){let i=6378137*a*Math.PI/180,s=6378137*Math.log(Math.tan(Math.PI/4+t*Math.PI/180/2));return{x:i,y:s}}function gi(a,t,e,i){return Math.sqrt(Math.pow(Math.abs(a-e),2)+Math.pow(Math.abs(t-i),2))}var no=class{motionModelRotYaw(t){if(!(Math.abs(t)<.001)){this.last_yaw_compass=xs(this.last_yaw_compass+t);for(let e=0;e<this.NumParticle;e++){let i=Math.random()*this.yaw_noise_sigma;this.particleX[2][e]=this.particleX[2][e]+t+i,this.particleX[2][e]=xs(this.particleX[2][e])}}}motionModelStepLength(t,e){if(t===0)return;for(let s=0;s<this.NumParticle;s++){let o=Math.random()*this.step_noise_sigma;this.particleX[0][s]+=(.65+o)*Math.sin(-this.particleX[2][s]/180*Math.PI),this.particleX[1][s]+=(.65+o)*Math.cos(this.particleX[2][s]/180*Math.PI),e(this.particleX[0][s],this.particleX[1][s])||(this.particleWeight[0][s]*=this.unaccess_weight)}let i=this.particleWeight[0].reduce((s,o)=>s+o,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/i)}motionModelCompassYaw(t,e){if(e-this.last_compass_time>this.compass_update_interval){let i=360-t;i+=this.delta_yaw,i=xs(i),Math.abs(i-this.last_yaw_compass)>60?this.compass_consecutive_offset_count++:this.compass_consecutive_offset_count=0;for(let o=0;o<this.NumParticle;o++){let n=Math.abs(this.particleX[2][o]-i);n>180&&(n=360-n),this.particleWeight[0][o]*=oo(n,this.sigmaCompass)}let s=this.particleWeight[0].reduce((o,n)=>o+n,0);this.particleWeight[0]=this.particleWeight[0].map(o=>o/s),this.setLastCompassTime(e)}}resampling(){if(1/this.particleWeight[0].reduce((e,i)=>e+i*i,0)<this.reSampNumParticle){let e=this.particleWeight[0].reduce((r,h,c)=>r.concat(r[c]+h),[0]),s=this.particleWeight[0].map(()=>1/this.NumParticle).map((r,h)=>r+Math.random()/this.NumParticle),o=[],n=0;for(let r=0;r<this.NumParticle;r++){for(;s[r]>e[n];)n++;o.push(n)}this.particleX=this.particleX.map((r,h)=>o.map(c=>r[c])),this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle)}}update(t,e){for(let s=0;s<this.NumParticle;s++){let o=gi(this.particleX[0][s],this.particleX[1][s],t.x,t.y);this.particleWeight[0][s]=Math.max(1e-7,this.particleWeight[0][s]*oo(o,e))}let i=this.particleWeight[0].reduce((s,o)=>s+o,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/i)}updateCar(t,e){let i=t.x-this.xEst[0][0],s=t.y-this.xEst[1][0];for(let n=0;n<this.NumParticle;n++){let r=gi(this.particleX[0][n],this.particleX[1][n],t.x,t.y);this.particleWeight[0][n]=Math.max(1e-7,this.particleWeight[0][n]*oo(r,e)),this.particleX[0][n]+=i,this.particleX[1][n]+=s}let o=this.particleWeight[0].reduce((n,r)=>n+r,0);this.particleWeight[0]=this.particleWeight[0].map(n=>n/o)}getPosInitFlag(){return this.particle_PosInitFlag}getYawInitFlag(){return this.particle_yawInitFlag}setPosInitFlag(t){this.particle_PosInitFlag=t}setYawInitFlag(t){this.particle_yawInitFlag=t}getResultX(){let t=[0,0,0];for(let e=0;e<3;e++)for(let i=0;i<this.NumParticle;i++)t[e]+=this.particleX[e][i]*this.particleWeight[0][i];return this.xEst=t.map(e=>[e]),this.xEst[0][0]}getResultY(){return this.xEst[1][0]}getResultYaw(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0]));return this.particleX[2][t]}getEstConfidence(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0])),e=this.particleWeight[0].indexOf(Math.min(...this.particleWeight[0])),i=[this.particleX[0][t],this.particleX[1][t]],s=[this.particleX[0][e],this.particleX[1][e]],o=gi(i[0],i[1],s[0],s[1]),n=o*.67;return console.log(o,n),n}getParticleNum(){return this.NumParticle}getParticleX(){return this.particleX}setLastCompassTime(t){this.last_compass_time=t}getLastCompassTime(){return this.last_compass_time}initParticlesByPos(t,e,i){if(!this.particle_PosInitFlag){this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle);let s=0;for(;s<this.NumParticle;){let n=(2*Math.random()-1)*this.initial_xy_uncertainty,r=(2*Math.random()-1)*this.initial_xy_uncertainty;i(t+n,e+r)||(this.particleWeight[0][s]*=this.unaccess_weight),this.particleX[0][s]=t+n,this.particleX[1][s]=e+r,s++}let o=this.particleWeight[0].reduce((n,r)=>n+r,0);this.particleWeight[0]=this.particleWeight[0].map(n=>n/o),this.particle_PosInitFlag=!0,this.xEst[0][0]=t,this.xEst[1][0]=e,this.xEst[2][0]=0}}initParticlesByCompass(t){console.log("Init compass: "+t);let e=360-t;e+=this.delta_yaw,e=xs(e),console.log("Init Yaw: "+e);for(let i=0;i<this.NumParticle;i++){let s=(2*Math.random()-1)*this.initial_yaw_uncertainty;this.particleX[2][i]=e+s}this.particle_yawInitFlag=!0,this.xEst[2][0]=e,this.last_yaw_compass=e,this.compass_consecutive_offset_count=0}constructor(t){this.last_yaw_compass=0,this.compass_consecutive_offset_count=0,this.NumParticle=t.NumParticle,this.reSampNumParticle=t.reSampNumParticle,this.initial_xy_uncertainty=t.initial_xy_uncertainty,this.initial_yaw_uncertainty=t.initial_yaw_uncertainty,this.step_noise_sigma=t.step_noise_sigma,this.yaw_noise_sigma=t.yaw_noise_sigma,this.compass_update_interval=t.compass_update_interval,this.sigmaCompass=t.sigmaCompass,this.delta_yaw=t.delta_yaw,this.sigmaBeacon=t.sigmaBeacon,this.unaccess_weight=t.unaccess_weight,this.particle_PosInitFlag=!1,this.particle_yawInitFlag=!1,this.xEst=[[0],[0],[0]],this.particleX=Array.from({length:3},()=>Array(this.NumParticle).fill(0)),this.particleWeight=Array.from({length:1},()=>Array(this.NumParticle).fill(1/this.NumParticle)),this.last_compass_time=0}};var QM=require("core-js/modules/es.array.push.js"),t_=require("core-js/modules/web.dom-collections.iterator.js");var ro=class{init(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10+.5,this.max_valley=10-.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.65,this.last_rot=[0,0,0],this.delta_rot=[0,0,0],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0,this.is_moving=!1,this.currentMotionState="UNKNOWN",this.previousMotionState="UNKNOWN",this.acc_variance_buffer=[],this.rot_variance_buffer=[],this.acc_buffer=[],this.walkingCount=0,this.stationaryCount=0,this.phoneUseCount=0,this.stateCounter=0}reset(){this.init()}setInitPose(t){t===void 0&&(t=[0,0]),this.last_px=t[0],this.last_py=t[1],console.info("pdr init pos: "+this.last_px+", "+this.last_py)}setInitYaw(t){t===void 0&&(t=0),this.last_yaw=t}getPos(t,e,i){let s=0;return i.length===3&&(this.delta_yaw=this.getDeltaYawFromRot(t,i)),e.length===3&&(s=this.getStepLength(t,e)),s!==0&&(this.last_px+=this.delta_px,this.last_py+=this.delta_py),[this.last_px,this.last_py]}getDeltaPose(){return[this.delta_px,this.delta_py]}getMotionState(){return this.currentMotionState}getStepLength(t,e){if(e.length<3)return console.warn("acc data less than 3"),0;let i=!1,s=Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2));if(this.accH_fifo.push(s),this.accH_time_fifo.push(t),this.imuFreUpdate(),!this.isMoving(e,this.last_rot))return 0;if(this.accH_fifo.length<this.accH_fifo_len+1)i=!1;else{for(;this.accH_fifo.length>=this.accH_fifo_len+1;)this.accH_fifo.shift(),this.accH_time_fifo.shift();let n=this.PVStepDetec(),r=this.FFTStepDetec(),h=this.recheckState(),c=this.accH_time_fifo[Math.floor(this.accH_time_fifo.length*3/4)];Math.abs(this.abnor_start_time)<.001&&this.abnor_fft_detected?this.abnor_start_time=c:this.abnor_fft_detected||(this.abnor_start_time=0),n&&r&&h?(this.step_count+=1,this.last_step_time=c,i=!0):Math.abs(this.abnor_start_time)>.001&&this.abnor_peak_time-this.abnor_start_time>this.abnor_time_threshold&&this.step_count>1&&this.abnor_peak_time-this.last_step_time>1?(this.step_count+=1,this.last_step_time=c,i=!0):(c-this.last_step_time>2&&(this.state_count=0),i=!1)}if(i){let n=this.last_yaw/180*Math.PI;return this.delta_px=this.const_step_length*Math.cos(n),this.delta_py=this.const_step_length*Math.sin(n),this.const_step_length}else return 0}imuFreUpdate(){if(this.accH_time_fifo.length>2&&(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]<0||this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]>10||this.accH_time_fifo[this.accH_time_fifo.length-1]===this.accH_time_fifo[0])&&(console.warn("pdr reset last one time "+this.accH_time_fifo[this.accH_time_fifo.length-1]+" last two time "+this.accH_time_fifo[this.accH_time_fifo.length-2]),this.reset()),this.accH_fifo.length>9||this.fre<15){let t=(this.accH_fifo.length-1)/(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[0]);Math.abs(this.fre-t)>8&&(this.fre=Math.round((t-3)/10)*10,(this.fre<=10||this.fre>=100)&&(console.warn("Frequency Error "+this.fre),this.fre=100),console.debug("Frequency change to "+this.fre),this.accH_fifo_len=Math.floor(1*this.fre)+1)}}recheckState(){return!0}PVStepDetec(){let t=!1,e=this.accH_fifo.slice(Math.floor(this.accH_fifo_len/2)),i=this.accH_time_fifo.slice(Math.floor(this.accH_fifo_len/2)),s=e[Math.floor(e.length/2)],o=i[Math.floor(i.length/2)],n=Math.max(...e),r=Math.min(...e),h=!1,c=!1;return Math.abs(s-r)<.01&&s<this.max_valley&&this.valley_num<=this.peak_num&&(this.last_valley_time===0?c=!0:c=o-this.last_valley_time>this.min_step_time,c&&(this.last_valley_time=o,this.valley_num+=1)),Math.abs(s-n)<.01&&s>this.min_peak&&this.peak_num<=this.valley_num&&(this.last_peak_time===0?h=!0:h=o-this.last_peak_time>this.min_step_time,h&&(this.last_peak_time=o,this.peak_num+=1)),s===n&&s>this.min_peak&&(this.abnor_peak_time=o,this.abnor_peak_accH=s),this.peak_num===this.valley_num&&(h||c)&&(t=!0),t}FFTStepDetec(){return!0}isMoving(t,e){if(t.length<3||e.length<3)return!1;this.acc_buffer.push([...t]),this.acc_buffer.length>this.static_window_size&&this.acc_buffer.shift();let i=Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2));this.acc_variance_buffer.push(i),this.acc_variance_buffer.length>this.static_window_size&&this.acc_variance_buffer.shift();let s=Math.abs(e[0])+Math.abs(e[1])+Math.abs(e[2]);if(this.rot_variance_buffer.push(s),this.rot_variance_buffer.length>this.static_window_size&&this.rot_variance_buffer.shift(),this.acc_variance_buffer.length<10)return this.is_moving;let o=this.acc_variance_buffer.slice(-10),n=this.rot_variance_buffer.slice(-10),r=this.calculateMean(o),h=this.calculateStdDeviation(o),c=this.calculateMean(n),l=this.calculateStdDeviation(n),p;return r>this.walkingThreshold&&h>.5?(this.walkingCount++,this.stationaryCount=0,this.phoneUseCount=0,p="WALKING"):r<this.phoneUseThreshold&&c>this.rotationThreshold?(this.phoneUseCount++,this.walkingCount=0,this.stationaryCount=0,p="USING_PHONE"):c<.5?(this.stationaryCount++,this.walkingCount=0,this.phoneUseCount=0,p="STATIONARY"):p="UNKNOWN",p!==this.currentMotionState?(this.stateCounter++,this.stateCounter>=this.stateChangeThreshold&&(this.previousMotionState=this.currentMotionState,this.currentMotionState=p,this.stateCounter=0,console.debug("Motion state changed: "+this.previousMotionState+" -> "+this.currentMotionState),console.debug("Stats: avgAcc="+r.toFixed(2)+", accStdDev="+h.toFixed(2)+", avgRot="+c.toFixed(2)+", rotStdDev="+l.toFixed(2)))):this.stateCounter=0,this.is_moving=this.currentMotionState==="WALKING",this.is_moving}calculateMean(t){return t.length===0?0:t.reduce((e,i)=>e+i,0)/t.length}calculateStdDeviation(t){if(t.length<2)return 0;let e=this.calculateMean(t),s=t.map(o=>{let n=o-e;return n*n}).reduce((o,n)=>o+n,0)/t.length;return Math.sqrt(s)}getMotionStatistics(){let t=this.acc_variance_buffer.slice(-10),e=this.rot_variance_buffer.slice(-10),i=this.calculateMean(t),s=this.calculateMean(e),o=this.calculateStdDeviation(t),n=this.calculateStdDeviation(e);return console.debug("\u8FD0\u52A8\u68C0\u6D4B: avgAcc="+i.toFixed(2)+", accStdDev="+o.toFixed(2)+", avgRot="+s.toFixed(2)+", rotStdDev="+n.toFixed(2)),console.debug("\u72B6\u6001\u5224\u65AD\u6761\u4EF6: \u884C\u8D70(avgAcc>"+this.walkingThreshold+", accStdDev>0.5), \u9759\u6B62(avgRot<0.5), \u624B\u673A(avgAcc<"+this.phoneUseThreshold+", avgRot>"+this.rotationThreshold+")"),console.debug("\u5F53\u524D\u72B6\u6001: "+this.currentMotionState+", \u8BA1\u6570: \u884C\u8D70="+this.walkingCount+", \u9759\u6B62="+this.stationaryCount+", \u624B\u673A="+this.phoneUseCount),{currentState:this.currentMotionState,avgAcceleration:i,avgRotation:s,accStdDeviation:o,rotStdDeviation:n,walkingCount:this.walkingCount,stationaryCount:this.stationaryCount,phoneUseCount:this.phoneUseCount,dataPoints:this.acc_variance_buffer.length,isMoving:this.is_moving}}getDeltaYawFromRot(t,e){if(e.length<3)return console.warn("rot data less than 3"),0;let i=[0,0,0];this.last_rot.length===3&&(i=e.map((r,h)=>r-this.last_rot[h]));for(let r=0;r<e.length;r++)i[r]<-180?i[r]+=360:i[r]>180&&(i[r]-=360);let s=.2;this.delta_rot.length===3?this.delta_rot=this.delta_rot.map((r,h)=>s*r+(1-s)*i[h]):this.delta_rot=i,this.last_rot=e,this.delta_yaw=this.delta_rot[0],this.last_yaw+=this.delta_yaw,this.last_yaw=this.limitYaw(this.last_yaw);let o=this.delta_rot.reduce((r,h)=>r+Math.abs(h),0);this.delta_rot_sum_fifo.push(o),this.delta_rot_sum_time_fifo.push(t),Math.abs(this.delta_rot_sum_time_fifo[this.delta_rot_sum_time_fifo.length-1]-this.delta_rot_sum_time_fifo[0])>1&&(this.delta_rot_sum_fifo.shift(),this.delta_rot_sum_time_fifo.shift()),this.delta_yaw_accum+=this.delta_yaw;let n=0;return Math.abs(this.delta_yaw_accum_timestamp-t)>this.delta_yaw_time_threshold?(n=this.delta_yaw_accum,this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=t,n):null}limitYaw(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}constructor(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10.5,this.max_valley=9.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_time_threshold=4,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.85,this.last_rot=[],this.delta_rot=[],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0,this.is_moving=!1,this.currentMotionState="UNKNOWN",this.previousMotionState="UNKNOWN",this.walkingThreshold=1,this.stationaryThreshold=.6,this.phoneUseThreshold=.7,this.rotationThreshold=.8,this.walkingCount=0,this.stationaryCount=0,this.phoneUseCount=0,this.stateCounter=0,this.stateChangeThreshold=3,this.static_window_size=20,this.acc_variance_buffer=[],this.rot_variance_buffer=[],this.acc_buffer=[]}};var ic={using_gps:!0,gps_max_horizontalAccuracy:20,initial_gps_delay_time:3e3},ao=class{pfFusionPDRiBeacon(t){let{type:e,timestamp:i,res:s}=t,o=!1;if(this.cacheSensorData.push(t),this.particleFilter.getPosInitFlag()&&this.particleFilter.getYawInitFlag()){if(e===F.ACCELERATION){let n=s,r=this.pdr.getStepLength(i/1e3,n);r!==0&&(this.particleFilter.motionModelStepLength(r,()=>!0),this.particleFilter.resampling(),this.position_count+=1,o=!0)}if(this.using_gps&&e===F.GPS)if(this.last_beacon_time===null||i-this.last_beacon_time>5e3){let n=this.getGpsPosition(s);o=n!==null,n&&(this.particleFilter.update(n,this.gps_horizontalAccuracy),this.resetParticleFilterDist(n,"gps",s[2]),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0)}else return[!1,0,0];if(e===F.DEVICE_MOTION){let n=this.pdr.getDeltaYawFromRot(i/1e3,s);n!==null&&this.particleFilter.motionModelRotYaw(n)}e===F.COMPASS&&this.particleFilter.motionModelCompassYaw(s,i),this.last_pos_time&&i-this.last_pos_time>500&&(this.position_count+=1,o=!0)}else if(!this.particleFilter.getPosInitFlag()&&this.using_gps&&e===F.GPS)if(this.startTime&&Date.now()-this.startTime>this.options.initial_gps_delay_time){let n=this.getGpsPosition(s);o=n!==null,console.log("gps_pos",n,s),n?(this.particleFilter.initParticlesByPos(n.x,n.y,()=>!0),this.last_pos_time=i,console.log("init Pos by gps success time "+i),this.cacheSensorData.length=0):console.log("init Pos by gps fail time "+i)}else this.startTime||(this.startTime=i);else if(!this.particleFilter.getYawInitFlag()&&e===F.COMPASS){let n=s;this.particleFilter.initParticlesByCompass(n),this.particleFilter.setLastCompassTime(i),console.log("init yaw by compass success time "+i)}return o&&(this.last_pos_time=i),[o,this.particleFilter.getResultX(),this.particleFilter.getResultY()]}setBeaconPosition(t,e){if(this.last_beacon_time=e,this.particleFilter.getPosInitFlag())this.particleFilter.update(t,this.sigmaBeacon);else{this.particleFilter.initParticlesByPos(t.x,t.y,()=>!0);let i=this.cacheSensorData.filter(s=>s.timestamp>e);console.log("\u521D\u59CBsensorData",i),i.map(s=>this.pfFusionPDRiBeacon(s))}return this.resetParticleFilterDist(t),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0,[this.particleFilter.getResultX(),this.particleFilter.getResultY()]}getGpsPosition(t){return t[2]>this.gps_max_horizontalAccuracy?null:Ma(t[0],t[1])}resetParticleFilterDist(t,e,i){let s=this.particleFilter.getResultX(),o=this.particleFilter.getResultY(),n=gi(s,o,t.x,t.y);(e==="gps"?i&&n>i||n>this.GpsMaxEstimateErr:n>this.MaxEstimateErr)?(this.outTrustRegionNum+=1,this.outTrustRegionNum>=this.TrustNum&&(console.info("\u8D85\u51FA\u53EF\u4FE1\u533A\u57DF\uFF0C\u91CD\u7F6E\u7C92\u5B50\u8FC7\u6EE4\u5668\u5230: "+t.x+", "+t.y),this.particleFilter.setPosInitFlag(!1),this.particleFilter.setYawInitFlag(!1),this.outTrustRegionNum=0,this.startTime=Date.now())):this.outTrustRegionNum=0}constructor(t){this.sigmaBeacon=5,this.gps_horizontalAccuracy=10,this.using_gps=!0,this.last_beacon_time=Date.now(),this.position_count=0,this.gps_max_horizontalAccuracy=20,this.MaxEstimateErr=5,this.GpsMaxEstimateErr=30,this.outTrustRegionNum=0,this.TrustNum=1,this.cacheSensorData=[],this.startTime=null;let e=w({},ic,t);this.options=e,this.using_gps=e.using_gps,this.gps_max_horizontalAccuracy=e.gps_max_horizontalAccuracy,this.particleFilter=new no({NumParticle:200,reSampNumParticle:.65,initial_xy_uncertainty:12,initial_yaw_uncertainty:100,step_noise_sigma:.5,yaw_noise_sigma:2,compass_update_interval:3e3,sigmaCompass:80,delta_yaw:2,sigmaBeacon:5,unaccess_weight:.7}),this.pdr=new ro}};var ho=require("@turf/turf"),ws=class extends st{checkSensor(){return this.sensor.checkSensor()}setSensor(t){this.sensor=t}start(){this.sensor.start(),this.pdr.startTime=Date.now(),this.sensor.addEventListener("add-data-item",t=>{let{item:e}=t;this.getPositionBySensorItem(e,!this._pause)})}pause(){this._pause=!0}continue(){this._pause=!1}getPositionBySensorItem(t,e){e===void 0&&(e=!0);let[i,s,o]=this.pdr.pfFusionPDRiBeacon(t);return i&&e&&(0,ho.booleanPointInPolygon)((0,ho.point)([s,o]),this.bmap.context.range)&&this.dispatchEvent({type:"position",x:s,y:o,_type:t.type===F.GPS?"gps":"pdr"}),[i,s,o]}setBeaconPosition(t,e){let[i,s]=this.pdr.setBeaconPosition(t,e);this.dispatchEvent({type:"position",x:i,y:s,_type:"beacon"})}dispose(){this.sensor.stop()}constructor(t,e={}){super(),this.bmap=t,this._pause=!1,this.sensor=new vs(e.sensor),this.pdr=new ao(e.pdr||{})}};var k_=require("core-js/modules/web.dom-collections.iterator.js"),D_=require("core-js/modules/es.array.push.js");var g_=require("core-js/modules/web.dom-collections.iterator.js"),y_=require("core-js/modules/es.array.push.js"),v_=require("core-js/modules/es.array.flat.js"),x_=require("core-js/modules/es.array.unscopables.flat.js"),ft=require("three");var mt=require("three");mt.UniformsLib["custom-line"]={linewidth:{value:1},resolution:{value:new mt.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},repeat:{value:new mt.Vector2(1,1)},allDistance:{value:1}};mt.ShaderLib["custom-line"]={uniforms:mt.UniformsUtils.merge([mt.UniformsLib.common,mt.UniformsLib.fog,mt.UniformsLib["custom-line"]]),vertexShader:`
|
|
509
509
|
#include <common>
|
|
510
510
|
#include <color_pars_vertex>
|
|
511
511
|
#include <fog_pars_vertex>
|
|
@@ -698,4 +698,4 @@
|
|
|
698
698
|
float uvx = prevUv + (vUv.y + 1.0) / 2.0 * vCustomUv;
|
|
699
699
|
gl_FragColor = diffuseColor * texture2D(map, vec2(uvx, (vUv.x + 1.0) / 2.0) * repeat);
|
|
700
700
|
}
|
|
701
|
-
`};var ao=class extends mt.ShaderMaterial{constructor(t){super({type:"ArrowLineMaterial",uniforms:Object.assign({},mt.UniformsUtils.clone(mt.ShaderLib["custom-line"].uniforms),{map:{value:null}}),vertexShader:mt.ShaderLib["custom-line"].vertexShader,fragmentShader:mt.ShaderLib["custom-line"].fragmentShader,clipping:!0}),this.dashed=!1,Object.defineProperties(this,{map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},allDistance:{enumerable:!0,get:function(){return this.uniforms.allDistance.value},set:function(e){this.uniforms.allDistance.value=e}}}),this.setValues(t),this.isLineMaterial=!0}};var xa=require("three/examples/jsm/lines/LineGeometry.js"),wa=require("three/examples/jsm/lines/Line2.js");var va={texture_url:Os,lineWidth:8,color:16777215},ho=class extends ft.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:i,height:s}}}}}=this,o=t.map(r=>{let[h,c,l]=r;return D(new ft.Vector3(h,c,l),e,i,s)}).map(r=>{let{x:h,y:c}=r;return[h,c]});return Et(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new ft.Vector2(t,1)}loadTexture(t){return new Promise((e,i)=>{new ft.TextureLoader().load(t,e,void 0,i)})}transformPoints(t){let e=[];for(let i=0;i<t.length;i++)e.push(...t[i]);return e}updatePoints(t){if(this.points=t,this.mesh){var e,i;this.remove(this.mesh),(e=this.material)==null||e.dispose(),(i=this.geometry)==null||i.dispose()}this.geometry=new xa.LineGeometry,this.geometry.setPositions(t.flat(2));let s=Et(t.map(r=>{let[h,c]=r;return[h,c]})),o=this.material=new ao({color:new ft.Color(this.config.color),transparent:!0,resolution:new ft.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!0,depthWrite:!0,linewidth:this.config.lineWidth,map:this.texture,blending:ft.NormalBlending,repeat:new ft.Vector2(this.getRepeat(),1),allDistance:s}),n=this.mesh=new wa.Line2(this.geometry,o);return n.computeLineDistances(),n.renderOrder=9,this.add(n),n}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return f(this,null,function*(){if(!this.texture){let e=this.texture=yield this.loadTexture(this.config.texture_url);e.wrapS=e.wrapT=ft.RepeatWrapping}return this.updatePoints(t)})}getBoundingBox(){return this.mesh?(this.mesh.geometry.computeBoundingBox(),new ft.Box3().copy(this.mesh.geometry.boundingBox).applyMatrix4(this.mesh.matrixWorld)):null}dispose(){var t,e,i;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(i=this.texture)==null||i.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=va,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let i=this.navigation.bmap.context.camera.zoom;i!==this.prevCameraZoom&&(this.prevCameraZoom=i,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:i,height:s}=this.navigation.bmap.context.clientSize;this.material.resolution.set(i,s)}},this.config=Object.assign({},va,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var Ma=require("@tweenjs/tween.js");var jt=require("three"),co=class extends jt.Object3D{meshSetMaterial(t){t instanceof jt.Mesh&&(t.material.emissiveIntensity=.5,t.material.shininess=0,t.material.emissive=t.material.color,t.material.emissiveMap=t.material.map,t.material.transparent=!0,t.material.depthTest=!1,t.renderOrder=1e6),t.children.forEach(i=>{this.meshSetMaterial(i)})}getBaseScale(t){let{clientSize:{height:e},camera:i}=this.bmap.context,o=(i.top-i.bottom)/i.zoom/e;return this.options.size*o/this.modelMaxLength}registryEvent(){this.bmap.context.addEventListener("update",this._update),this.bmap.context.addEventListener("control-zoom-change",this._onChangeZoom)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this._update),this.bmap.context.removeEventListener("control-zoom-change",this._onChangeZoom)}lookAtCamera(){if(this.model&&this.bmap&&this.bmap.context){let t=this.bmap.context.camera,e=new jt.Euler;e.setFromQuaternion(t.quaternion,"ZYX"),this.group.rotation.copy(e)}}setClips(t){this.clearClips(),t.length&&(this.mixer=new jt.AnimationMixer(this.model.scene),t.forEach(e=>this.mixer.clipAction(e).play()))}startClips(){var t;this.setClips(((t=this.model)==null?void 0:t.animations)||[])}clearClips(){this.mixer&&(this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.mixer.getRoot()),this.mixer=null)}dispose(){this.unRegistryEvent(),this.clearClips(),this.clear(),this.model&&I(this.model.scene),this.bmap=null}constructor(t,e,i={}){super(),this.bmap=t,this.group=new jt.Object3D,this.mixer=null,this.previewTime=0,this.modelMaxLength=0,this.options={size:40},this._update=()=>{let s=Date.now();if(!this.previewTime)this.previewTime=s;else{var o;let n=s-this.previewTime;this.previewTime=s,(o=this.mixer)==null||o.update(n/1e3)}this.lookAtCamera()},this._onChangeZoom=s=>{let{zoom:o}=s;var n;if(!this.model)return;let r=this.getBaseScale(this.model.scene);(n=this.model)==null||n.scene.scale.set(r,r,r)},this.options=w({},this.options,i),this.add(this.group),St.loadModel(e,!1).then(s=>{this.model=s;let n=new jt.Box3().setFromObject(s.scene).getSize(new jt.Vector3),r=Math.max(n.x,n.y,n.z);this.modelMaxLength=r;let h=this.getBaseScale(s.scene);s.scene.scale.set(h,h,h),this.meshSetMaterial(s.scene),this.group.add(s.scene),this.setClips(s.animations),this.group.rotation.set(Math.PI/2,Math.PI,0),this.dispatchEvent({type:"loaded"})}),this.registryEvent()}};var lo=require("three");var yn=class extends X{registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate)}pauseAnimation(){this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue()}clearTween(){this.tweenUtil.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate)}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.movedDistance=0,this.clearTween()),this.startModel&&(this.startModel.visible=!1),this.translatePath=null}addPath(t){this.paths=t;let e=t.map(i=>w({},i,{points:this.translatePoints(i.points)}));if(this.clearTween(),this.movedDistance=0,this.bmap.currentBuildGround)this.renderPath(e);else{let i=()=>{this.bmap.removeEventListener("center-change",i),this.renderPath(e)};this.bmap.addEventListener("center-change",i)}this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,i]=this.bmap.buildingCenter;return t.map(s=>[s[0]-e,s[1]-i])}renderPath(t){return f(this,null,function*(){if(!t.length)return this.clearPath();let e=[];t.forEach((i,s,o)=>{let n=this.mulFloor.floors.find(r=>r.name===i.floor);e.push(...i.points.map(r=>{let[h,c]=r;return[h,c,n.position.z+n.groundMaxHeight]}))}),this.cPath=e,this.animationPathOptions={cPathIndex:0},this.path?this.path.updatePoints(e):(this.path=new ho(this),yield this.path.create(e),this.path.position.z=.5,this.bmap.context.scene.add(this.path)),this.startModel&&(this.startModel.position.set(e[0][0],e[0][1],e[0][2]),this.startModel.visible=!0),this.dispatchEvent({type:"render-path",path:this.path})})}catmullRomCurve3(t){return Di(t,!1,!0,.1,170,2.5)}getPathDirection(t,e){if(t.length<2)return null;let i=ce(t,e),s=t[i],o=t[i+1],n=new lo.Vector3(o[0]-s[0],o[1]-s[1],0).normalize(),r=new lo.Vector3(0,1,0).normalize(),h=n.angleTo(r),c=new lo.Vector3().crossVectors(r,n);return(Object.is(c.y,0)?-1:1)*h}startSimulation(t){return f(this,null,function*(){t===void 0&&(t=1);let{paths:e,movedDistance:i}=this;if(!e.length)return;let s=e.reduce((n,r)=>n+r.distance,0);if(!s||i>=s)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let o=s/t;return this.startModel.startClips(),new Promise(n=>{let r=this.simulationTween=new Ma.Tween({distance:this.movedDistance},this.tweenUtil.group).to({distance:s},o*1e3).onUpdate(h=>{var c;this.movedDistance=h.distance;let l=h.distance,p=0;for(let g=0;g<e.length;g++)if(e[g].distance>=l){p=g;break}else l-=e[g].distance;let d=Ze(e[p].points,l);if(d===null)return;this.currentPathPosition=d;let u=this.translatePoints([d])[0],m=this.mulFloor.floors.find(g=>g.name===e[p].floor),v=m?m.position.z+m.groundMaxHeight:(c=this.startModel)==null?void 0:c.position.z;this.startModel&&this.startModel.position.set(u[0],u[1],v)}).onComplete(()=>{if(this.tweenUtil.remove(r),this.startModel.clearClips(),this.startModel){var h,c,l,p;let d=(l=e.slice(-1)[0])==null||(c=l.points)==null||(h=c.slice(-1))==null?void 0:h[0];if(!d)return;let u=this.mulFloor.floors.find(g=>{var x;return g.name===((x=e.slice(-1)[0])==null?void 0:x.floor)});if(!u)return;let m=u?u.position.z+u.groundMaxHeight:(p=this.startModel)==null?void 0:p.position.z,v=this.translatePoints([d])[0];this.startModel.position.set(v[0],v[1],m)}n(!0)}).start()})})}setStartPoiRotate(t){if(this.startPoi){let i=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(360-t-i)%360}}dispose(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.startModel&&(this.bmap.context.scene.remove(this.startModel),this.startModel.dispose()),this.tweenUtil.dispose(),this.unRegistryEvent(),super.dispose()}constructor(t,e,i={}){super(t),this.mulFloor=e,this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.pathTween=null,this.startPoi=null,this.movedDistance=0,this.tweenUtil=new Pe,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onUpdate=()=>{this.tweenUtil.update()},this.startModel=new co(t,br,i.startModel),this.startModel.visible=!1,this.bmap.context.scene.add(this.startModel),this.registryEvent()}};var G_=require("core-js/modules/es.array.flat.js"),F_=require("core-js/modules/es.array.unscopables.flat.js"),po=require("three");var vn=class extends X{registryEvent(){this.clickHelper.addEventListener("click",this._click)}unRegistryEvent(){this.clickHelper.removeEventListener("click",this._click)}dispose(){this.unRegistryEvent(),this.clickHelper.dispose(),this.mulFloors=null,super.dispose()}constructor(t,e){super(t),this.mulFloors=e,this._click=i=>{let{e:s}=i;if(!this.mulFloors.showStatus)return;let o=new po.Vector2,{offsetX:n,offsetY:r}=s,h=this.mulFloors.floors.map(d=>d.poiLayer2.getPoiByDeviceXy(n,r)).flat(2),{clientSize:c}=this.bmap.context;o.x=n/c.width*2-1,o.y=r/c.height*-2+1;let l=new po.Raycaster;l.setFromCamera(o,this.bmap.context.camera),l.ray.origin.sub(l.ray.direction.clone().multiplyScalar(1e4));let p=this.mulFloors.floors.map(d=>d.graphicLayer.getGraphicByRaycaster(l).graphics).flat();this.dispatchEvent({type:"select",pois:h,graphics:p})},this.clickHelper=new Oi(this.bmap.context.container),this.registryEvent()}};var K_=require("core-js/modules/es.array.find-last-index.js"),X_=require("core-js/modules/es.array.find-last.js"),Y_=require("core-js/modules/es.array.push.js");var U_=require("core-js/modules/web.dom-collections.iterator.js"),H_=require("core-js/modules/es.array.push.js"),N_=require("core-js/modules/es.array.sort.js"),yi=require("three");function tc(a){let t=a.length,e=0,i=0,s=0,o=0;a.forEach(h=>{e+=h[0],i+=h[1],s+=h[0]*h[1],o+=h[0]*h[0]});let n=(t*s-e*i)/(t*o-e*e),r=(i-n*e)/t;return{m:n,b:r}}function ec(a,t,e){let i=e[0][0],s=e.slice(-1)[0][0],o=a*i+t,n=a*s+t;return{start:[i,o],end:[s,n]}}function xs(a){if(a.length<2)return null;let t=a.filter((h,c)=>{let l=[...a];return l.splice(c,1),l.every(p=>p[0]!==h[0]&&p[1]!==h[1])});if(t.length<2)return null;let{m:e,b:i}=tc(t),{start:s,end:o}=ec(e,i,t),r=360-(new yi.Vector2().subVectors(new yi.Vector2(o[0],o[1]),new yi.Vector2(s[0],s[1])).angle()/Math.PI*180-90+360)%360;return Number.isNaN(r)?null:r}function ic(a){let t=[];for(let e=1;e<a.length;e++){let i=a[e-1],s=a[e],o=s.position[0]-i.position[0],n=s.position[1]-i.position[1],r=Math.sqrt(o**2+n**2),h=s.time-i.time;if(h>0){let c=r/h;console.log("speedDelta",i.type,s.type,uo(c),r,h),t.push(c)}else t.push(0)}return t}function sc(a,t){let e=a[0],i=a.slice(-1)[0],s=O(i.position,e.position),o=i.time-e.time;return o<100||s<3?null:s/o}function uo(a){return a*60*60}function vi(a,t,e,i){let s=(e+90)%360*(Math.PI/180),o=t*i,n=new yi.Vector2(a[0],a[1]),r=Math.cos(s),h=Math.sin(s),c=new yi.Vector2(r,h);return n.add(c.normalize().multiplyScalar(o)),[n.x,n.y]}function oc(a){let t=[...a].sort((c,l)=>c-l),e=_a(t,25),i=_a(t,75),s=i-e,o=e-1.5*s,n=i+1.5*s,r=t.filter(c=>c>=o&&c<=n);return a.filter(c=>r.includes(c))}function _a(a,t){let e=t/100*(a.length-1),i=Math.floor(e),s=Math.ceil(e);if(i===s)return a[i];let o=e-i;return a[i]*(1-o)+a[s]*o}var ws=require("lodash"),Ms=class extends st{setPathAngle(t){this.pathAngle=t,this.dispatchEvent({type:"change-compass",value:this.pathAngle}),(0,ws.isNil)(this.angle)&&(this.angle=t)}changeSpeed(){let t=this.history.filter(h=>["vision"].includes(h.type));if(t.length<2){this.speedFilter.filter(0),this.speed=0;return}let e=t[0],i=t.slice(-1)[0],s=O(i.position,e.position),o=i.time-e.time,n=o>0?s/o:0,r=this.speedFilter.filter(n);this.speed=r}changeAngle(t){t===void 0&&(t=this.visionHistory),t.length<2&&(this.angle=null);let e=xs(t.map(i=>i.position));e!==null&&this.setAngle(e)}setAngle(t,e){e===void 0&&(e=!0),this.angle=t,e&&this.dispatchEvent({type:"change-position-compass",value:t})}setPosition(t,e,i){let s={position:t,time:e,clientTime:Date.now()-i,type:"vision"};if(this._setVisionHistoryForAngle(s),(0,ws.isNil)(this.angle)||!this.speed){this.addHistory(s);return}let o=this.history.findLastIndex(r=>r.type==="vision"),n=this.history[o];if(n){if(n.time>e)return;let r=xs([this.history.slice(-1)[0].position,t]);if(r&&Math.abs(r-this.angle)<60){this.addHistory(s);return}let h=vi(t,this.speed,360-this.pathAngle,i);O(h,this.history.slice(-1)[0].position)>5?this.visionExcessesCount++:this.visionExcessesCount=0,this.visionExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21\u89C6\u89C9\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528\u89C6\u89C9\u6821\u51C6"),this.addHistory(s),this.visionExcessesCount=0)}}resetPdrPosition(){let t=this.history.findLast(e=>e.type==="vision");if(t&&this.speed){let e=vi(t.position,this.speed,360-this.pathAngle,Date.now()-t.clientTime);e&&this.history.push({position:e,time:Date.now(),clientTime:Date.now(),type:"pdr"})}}getLastVisionPdrPos(){let t=this.history.findLastIndex(i=>i.type==="vision");if(t!==-1){var e;return(e=this.history[t+1])!=null?e:this.history[t]}return null}_setVisionHistoryForAngle(t){if(!this.visionHistory.length){this.visionHistory.push(t);return}let e=xs([this.visionHistory.slice(-1)[0].position,t.position]);if(e!==null&&(this.angle&&Math.abs(this.angle-e)>60?this.angleExcessesCount++:(this.angleExcessesCount=0,this.visionHistory.push(t))),this.angleExcessesCount>3)console.warn("\u8FDE\u7EED\u4E09\u6B21\u89D2\u5EA6\u6BD4\u8F83\u6B6A\uFF0C\u91CD\u65B0\u77EB\u6B63"),this.visionHistory=[t],this.angleExcessesCount=0;else{let i=O(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position);for(;i>5&&this.visionHistory.length>15;)this.visionHistory.shift(),i=O(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position)}this.changeAngle()}addHistory(t){this.history.push(t);let e=this.history.filter(r=>r.type==="vision"),i=e.length?Date.now()-e.slice(-1)[0].clientTime:0,s=O(this.history[0].position,this.history.slice(-1)[0].position),o=i>5e3?10:3,n=i>5e3?0:5;for(i>5e3&&console.warn("\u89C6\u89C9\u7ED3\u679C\u8D85\u51FA5s\u4E0D\u53EF\u7528\uFF0C\u5168\u90E8\u6E05\u7A7A");e.length>n&&s>o;)this.history.shift(),e=this.history.filter(r=>r.type==="vision"),s=O(this.history[0].position,this.history.slice(-1)[0].position);n===0?this.changeSpeed():t.type==="vision"&&this.changeSpeed(),this.changePosition(t.type)}setBeaconPosition(t,e,i){let s=Date.now()-i,o={position:t,time:e,clientTime:s,type:"beacon"},n=this.history.findLastIndex(l=>l.type!=="pdr"),r=this.history[n];if(!r){this.addHistory(o);return}if((0,ws.isNil)(this.pathAngle)||!this.speed){this.addHistory(o);return}if(r&&r.time>e)return;let h=vi(t,this.speed,360-this.pathAngle,i);O(h,this.history.slice(-1)[0].position)>5?this.beaconExcessesCount++:this.beaconExcessesCount=0,this.beaconExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21beacon\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528beacon\u6821\u51C6"),this.addHistory(o),this.beaconExcessesCount=0)}startPositionTimer(){this.positionTimer&&this.timer.clearInterval(this.positionTimer),this.positionTimer=this.timer.setInterval(()=>{this.changePosition()},20)}stopPositionTimer(){this.positionTimer&&(this.timer.clearInterval(this.positionTimer),this.positionTimer=null)}changePosition(t){t===void 0&&(t="pdr");let e=this.getPosition(t);e.success&&(this.history.push({position:e.pos,time:Date.now(),clientTime:Date.now(),type:"pdr"}),this.speed?this.dispatchEvent({type:"change-pos",value:w({},e)}):this.dispatchEvent({type:"change-pos",value:e}))}getPosition(t){if(this.history.length===0)return{success:!1,pos:[0,0],compass:null,speed:0};let e=this.history.slice(-1)[0];if(this.history.length<2)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};if((0,ws.isNil)(this.pathAngle)||!this.speed)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};let i=e.clientTime,s=Date.now()-i;return{success:!0,pos:this.pathAngle?vi(e.position,this.speed,360-this.pathAngle,s):e.position,compass:this.pathAngle,speed:uo(this.speed)}}dispose(){this.timer.dispose()}constructor(){super(),this.history=[],this.visionHistory=[],this.speed=0,this.angle=null,this.timer=new j,this.positionTimer=null,this.speedFilter=new Ri,this.visionExcessesCount=0,this.beaconExcessesCount=0,this.angleExcessesCount=0,this.pathAngle=0,this.startPositionTimer()}};var iP=require("core-js/modules/es.json.stringify.js");var nc={};function xn(){return new Worker(new URL("./worker/recommend.worker-SNFR5ZXU.js",nc.url))}var rc={placeId:0,catLotStatusApi:"https://vrapi.aibee.cn/parking/cat-lot-status"},wn=class{setRoadData(t,e){return Z(this.worker,"set_road_info",{roadData:t,facilities:e})}recommend(t){return f(this,null,function*(){let e=yield fetch(this.options.catLotStatusApi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({place_id:+this.options.placeId})}).then(i=>i.json()).then(i=>i.data.filter(s=>s.status===0)).then(i=>{var s;return i.filter((s=this.options.filterCarLotStatus)!=null?s:()=>!0)});return Z(this.worker,"recommend",w({},t,{carLotStatus:e}))})}dispose(){this.worker.terminate()}constructor(t={}){this.worker=xn(),this.options=w({},rc,t)}};var uP=require("core-js/modules/es.json.stringify.js"),mP=require("core-js/modules/web.dom-collections.iterator.js"),fP=require("core-js/modules/es.array.sort.js"),gP=require("core-js/modules/es.array.push.js"),yP=require("core-js/modules/es.regexp.exec.js"),vP=require("core-js/modules/web.url-search-params.js"),xP=require("core-js/modules/web.url-search-params.delete.js"),wP=require("core-js/modules/web.url-search-params.has.js"),MP=require("core-js/modules/web.url-search-params.size.js");var hP=require("core-js/modules/es.json.stringify.js");var ac={url:"",reconnect:!0,heartBeat:2e3,heartMsg:JSON.stringify({command:"PING"}),reconnectTime:3e3,reconnectMaxCount:1e6,noMessageTime:6e3},xi=class extends st{initWebsocket(){this.ws=new WebSocket(this.options.url),this.ws.onopen=()=>{this.alive=!0,this.startHeart(),this.startOnMessageTimer(),this.stopReconnect(),this.dispatchEvent({type:"open"})},this.ws.onerror=()=>{this.alive=!1,this.ws=null,this.stopHeart(),this.stopOnMessageTimer(),this.startReconnect(),this.registryEvent()},this.ws.onclose=()=>{this.alive=!1,this.ws=null,this.stopHeart(),this.stopOnMessageTimer(),this.startReconnect()},this.ws.onmessage=t=>{this.startOnMessageTimer(),this.dispatchEvent({type:"message",message:t})}}startHeart(){this.stopHeart(),this.heartTimer=this.timer.setInterval(()=>{this.send(this.options.heartMsg)&&this.dispatchEvent({type:"send-heart"})},this.options.heartBeat)}stopHeart(){this.heartTimer&&(this.timer.clearInterval(this.heartTimer),this.heartTimer=null)}startReconnect(t){t===void 0&&(t=this.options.reconnectTime),this.stopReconnect(),this.options.reconnect&&(this.options.reconnectMaxCount--,this.options.reconnectMaxCount>=0&&(this.reconnectTimer=this.timer.setTimeout(()=>{this.initWebsocket()},t)))}stopReconnect(){this.reconnectTimer&&(this.timer.clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}startOnMessageTimer(){this.stopOnMessageTimer(),this.noMessageTimer=this.timer.setTimeout(()=>{var t;(t=this.ws)==null||t.close(),this.dispatchEvent({type:"no-message-timeout"})},this.options.noMessageTime)}stopOnMessageTimer(){this.noMessageTimer&&(this.timer.clearTimeout(this.noMessageTimer),this.noMessageTimer=null)}send(t){var e;let i=typeof t=="string"?t:JSON.stringify(t);return this.alive&&((e=this.ws)==null?void 0:e.readyState)===1?(this.ws.send(i),this.dispatchEvent({type:"send-success",msg:i}),!0):(this.dispatchEvent({type:"send-fail",msg:i}),!1)}registryEvent(){window.addEventListener("online",this.onOnline)}unRegistryEvent(){window.removeEventListener("online",this.onOnline)}close(){var t;this.unRegistryEvent(),this.options.reconnect=!1,this.alive=!1,this.stopHeart(),this.stopReconnect(),this.stopOnMessageTimer(),(t=this.ws)==null||t.close(),this.ws=null,this.dispatchEvent({type:"close"})}dispose(){this.close(),this.timer.dispose(),super.dispose()}constructor(t){super(),this.ws=null,this.alive=!1,this.timer=new j,this.heartTimer=null,this.reconnectTimer=null,this.noMessageTimer=null,this.onOnline=()=>{this.startReconnect()},this.options=w({},ac,t||{}),this.options.url&&this.initWebsocket()}};var _n=require("lodash");var Mn=a=>{let t=a.toString(2),e=""+Array(16-t.length+1).join("0")+t,i=parseInt(e.slice(0,4),2)*10,s=parseInt(e.slice(4,16),2);return[i,s]};var Pn=class extends st{initPositionWebSocket(){let t=w({},this.options.ext_position_params,{place_id:this.options.place_id,token:this.options.access_token}),e=Object.keys(t).filter(i=>!(0,_n.isNil)(t[i])).map(i=>i+"="+t[i]).join("&");this.positionWebSocket=new xi({url:this.options.wss_position_url+"?"+e}),this.positionWebSocket.addEventListener("message",i=>{let{message:s}=i,o=(()=>{try{return JSON.parse(s.data)}catch(U){return s.data}})();if(this.dispatchEvent({type:"ws-message",data:o}),o.command==="POSITION_RESULT"&&o.data.success)if(["POSITION","FLOOR","PARK_POSITION","AOA"].includes(o.data.success_type)&&this.useGpsFloorTimer&&(this.positionFloor=o.data.floor,this.timer.clearTimeout(this.useGpsFloorTimer),this.useGpsFloorTimer=null),o.data.success_type==="AOA"){let{x:U,y:H,time:et,floor:J,ts:re}=o.data,ae=this.positionFloor!==J;if(this.positionFloor=J,this.dispatchEvent({type:"ws-position",floor:J,x:U,y:H,time:et,_type:"aoa"}),this.options.upload_position){var n;(n=this.positionWebSocket)==null||n.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:U,y:H,floor:J,type:"aoa"}),serverData:JSON.stringify(o)})}if(!this.options.use_pdr){this.dispatchEvent({type:"position",floor:J,x:U,y:H,time:new Date(re).getTime()-o.lag-o.duration});return}if(this.options.type!==1){var r;if(ae){var h,c,l;(l=this.pdrPosition)==null||(c=l.pdr)==null||(h=c.particleFilter)==null||h.setPosInitFlag(!1)}(r=this.pdrPosition)==null||r.setBeaconPosition({x:U,y:H},new Date(re).getTime()-o.lag-o.duration)}else if(ae){var p;if(this.resetPdr(),(p=this.carInertialPosition)==null||p.stopPositionTimer(),this.path){let Le=this.path.findIndex(Mi=>Mi.floor===J),ye=this.path[Le];if(ye){var d;this.resetPdr(),(d=this.carInertialPosition)==null||d.setBeaconPosition(ye.points[0],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}else{var u;(u=this.carInertialPosition)==null||u.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var m;(m=this.carInertialPosition)==null||m.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var v;(v=this.carInertialPosition)==null||v.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else if(o.data.success_type==="POSITION"){let{x:U,y:H,time:et,floor:J,ts:re}=o.data,ae=this.positionFloor!==J;if(this.positionFloor=J,this.dispatchEvent({type:"ws-position",floor:J,x:U,y:H,time:et,_type:"beacon"}),console.log("positionFloor",J,ae),this.options.upload_position){var g;(g=this.positionWebSocket)==null||g.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:U,y:H,floor:J,type:"originBeacon"}),serverData:JSON.stringify(o)})}if(!this.options.use_pdr){this.dispatchEvent({type:"position",floor:J,x:U,y:H,time:new Date(re).getTime()-o.lag-o.duration});return}if(this.options.type!==1){var x;if(ae){var M,P,C;(C=this.pdrPosition)==null||(P=C.pdr)==null||(M=P.particleFilter)==null||M.setPosInitFlag(!1)}(x=this.pdrPosition)==null||x.setBeaconPosition({x:U,y:H},new Date(re).getTime()-o.lag-o.duration)}else if(ae){var S;if(this.resetPdr(),(S=this.carInertialPosition)==null||S.stopPositionTimer(),this.path){let Le=this.path.findIndex(Mi=>Mi.floor===J),ye=this.path[Le];if(ye){var G;this.resetPdr(),(G=this.carInertialPosition)==null||G.setBeaconPosition(ye.points[0],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}else{var E;(E=this.carInertialPosition)==null||E.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var nt;(nt=this.carInertialPosition)==null||nt.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var Tt;(Tt=this.carInertialPosition)==null||Tt.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else if(o.data.success_type==="PARK_POSITION"&&o.data.success){if(this.options.type===1){let{x:U,y:H,time:et,floor:J}=o.data,re=this.positionFloor!==J;if(this.positionFloor=o.data.floor,this.dispatchEvent({type:"ws-position",floor:J,x:U,y:H,time:et,_type:"vision"}),!this.options.use_pdr){this.dispatchEvent({type:"position",floor:J,x:U,y:H,time:new Date(et).getTime()});return}if(re){var gt;if(this.resetPdr(),(gt=this.carInertialPosition)==null||gt.stopPositionTimer(),this.path){let ae=this.path.findIndex(ye=>ye.floor===J),Le=this.path[ae];if(Le){var It;this.resetPdr(),(It=this.carInertialPosition)==null||It.setPosition(Le.points[0],new Date(et).getTime(),o.duration)}else{var kt;(kt=this.carInertialPosition)==null||kt.setPosition([U,H],new Date(et).getTime(),o.duration)}}else{var ne;(ne=this.carInertialPosition)==null||ne.setPosition([U,H],new Date(et).getTime(),o.duration)}}else{var Ee,ht;if((Ee=this.carInertialPosition)==null||Ee.setPosition([U,H],new Date(et).getTime(),o.duration),!((ht=this.carInertialPosition)!=null&&ht.positionTimer)){var $e;($e=this.carInertialPosition)==null||$e.startPositionTimer()}}if(this.options.upload_position){var wi;(wi=this.positionWebSocket)==null||wi.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:U,y:H,floor:J,type:"vision"}),serverData:JSON.stringify(o)})}}}else this.dispatchEvent({type:"floor",floor:o.data.floor,time:o.data.time})})}initSensorWebSocket(){let t=w({},this.options.ext_sensor_params,{token:this.options.access_token,place_id:this.options.place_id,record_sensor:1}),e=Object.keys(t).filter(i=>!(0,_n.isNil)(t[i])).map(i=>i+"="+t[i]).join("&");this.sensorWebSocket=new xi({url:this.options.wss_sensor_url+"?"+e})}initPdr(){this.options.type===1?(this.carInertialPosition=new Ms,this.carInertialPosition.addEventListener("change-pos",t=>{let{value:e}=t,{pos:i,success:s,speed:o}=e;if(s&&(this.dispatchEvent({type:"position",floor:this.positionFloor,x:i[0],y:i[1],time:Date.now(),speed:o}),this.options.upload_position)){var n;(n=this.positionWebSocket)==null||n.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:i[0],y:i[1],floor:this.positionFloor,type:"vision_pdr"})})}}),this.carInertialPosition.addEventListener("change-compass",t=>{let{value:e}=t;this.dispatchEvent({type:"compass",value:e})})):(this.pdrPosition=new vs(this.bmap,{pdr:{using_gps:this.options.use_gps},sensor:{elements:[F.COMPASS,F.ACCELERATION,F.DEVICE_MOTION].concat(this.options.use_gps?[F.GPS]:[])}}),this.requestDeviceOrientationPermission(),this.options.upload_position&&this.pdrPosition.sensor.addEventListener("sensor-data",t=>{let{data:e}=t;var i;(i=this.positionWebSocket)==null||i.send({command:"UPLOAD_SENSOR",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify(e)})}),this.pdrPosition.sensor.addEventListener("add-data-item",t=>{t.item.type==="compass"&&this.dispatchEvent({type:"compass",value:t.item.res})}),this.pdrPosition.addEventListener("position",t=>{let{x:e,y:i,_type:s}=t;if(console.log("_type",s,e,i,this.positionFloor,this.gpsFloor),s==="gps"&&!this.useGpsFloorTimer){let n=()=>{this.useGpsFloorTimer=this.timer.setTimeout(()=>{this.gpsFloor?this.positionFloor=this.gpsFloor:n()},5e3)};n()}if(this.positionFloor&&(this.dispatchEvent({type:"position",floor:this.positionFloor,x:e,y:i,time:Date.now()}),this.options.upload_position)){var o;(o=this.positionWebSocket)==null||o.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:e,y:i,floor:this.positionFloor,type:s})})}}))}setSensor(t){this.pdrPosition&&this.pdrPosition.setSensor(t)}requestDeviceOrientationPermission(){return f(this,null,function*(){if(this.pdrPosition){let t=yield this.pdrPosition.checkSensor();return t.deviceOrientation?this.pdrPosition.start():(this.dispatchEvent(w({type:"check-sensor"},t)),!t.deviceOrientation&&this.options.use_default_permission),t}else return null})}getGpsFloor(){return f(this,null,function*(){if(this.options.use_gps&&this.options.get_gps_floor_url){let t=yield fetch(this.options.get_gps_floor_url+"/"+this.options.place_id).then(e=>e.json());t.code===200&&(this.gpsFloor=t.data.gps_floor)}})}pausePdr(){if(this.options.type===1){var t;(t=this.carInertialPosition)==null||t.stopPositionTimer()}else{var e;(e=this.pdrPosition)==null||e.pause()}}continuePdr(){if(this.options.type===1)this.carInertialPosition&&(this.carInertialPosition.positionTimer||this.carInertialPosition.startPositionTimer());else{var t;(t=this.pdrPosition)==null||t.continue()}}setPathAngle(t){if(this.options.type===1){var e;(e=this.carInertialPosition)==null||e.setPathAngle(t)}}getForwardAngle(){if(this.options.type===1){var t,e;return(e=(t=this.carInertialPosition)==null?void 0:t.angle)!=null?e:null}else return null}resetPdr(){this.carInertialPosition&&(this.carInertialPosition.history=[],this.carInertialPosition.setPathAngle(0),this.carInertialPosition.speed=0),this.pdrPosition&&this.pdrPosition.pdr.particleFilter.setPosInitFlag(!1)}setPath(t){this.path=t}sendBeacon(t){var e;let i=[];if(pe)i=t.map(o=>{let[n,r]=Mn(o.major);return[o.uuid,r,o.minor,o.rssi,o.accuracy,n]}).filter(o=>o[3]!==0).sort((o,n)=>n[3]-o[3]);else{let o=t.reduce((n,r)=>{var h,c;let[l,p]=Mn(r.major),d=""+p+r.minor;return(h=n)[c=d]||(h[c]=[]),n[d].push(w({},r,{battery:l,major:p})),n},{});Object.entries(o).forEach(n=>{let[r,h]=n,{uuid:c,major:l,minor:p,accuracy:d,battery:u}=h[0];if(h.length>1){let m=h.filter(g=>g.rssi<0),v=m.reduce((g,x)=>g+x.rssi,0);i.push([c,l,p,v/m.length,d,u])}else i.push([c,l,p,h[0].rssi,d,u])})}let s={command:"POSITION",index:this.uploadIndex++,ts:Date.now(),beacons:JSON.stringify([{type:"ibeacon",timestamp:Date.now()/1e3,res:i}]),ext_sensors:JSON.stringify({})};(e=this.sensorWebSocket)==null||e.send(s)}dispose(){var t,e,i,s;this.timer.dispose(),(t=this.positionWebSocket)==null||t.dispose(),this.positionWebSocket=null,(e=this.sensorWebSocket)==null||e.dispose(),this.sensorWebSocket=null,(i=this.pdrPosition)==null||i.dispose(),this.pdrPosition=null,(s=this.carInertialPosition)==null||s.dispose(),this.carInertialPosition=null,super.dispose()}constructor(t,e){super(),this.bmap=t,this.positionWebSocket=null,this.sensorWebSocket=null,this.pdrPosition=null,this.carInertialPosition=null,this.gpsFloor="",this.positionFloor="",this.useGpsFloorTimer=null,this.uploadIndex=0,this.path=null,this.timer=new j;let i=location.href.indexOf("?"),s=i!==-1?location.href.slice(i):location.search,o=new URLSearchParams(s),n=o.get("server_env")||"prod",r={test:"nav-test.aibee.cn",prod:"nav.aibee.cn"},h="wss://"+r[n]+"/aether-walker/indoor/position",c="wss://"+r[n]+"/aether-walker/indoor/sensor";this.options=w({place_id:o.get("place_id"),access_token:o.get("access_token"),env:n,wss_position_url:h,wss_sensor_url:c,get_gps_floor_url:"https://"+r[n]+"/aether-walker/indoor/conf",use_sensor:!1,type:-1,use_gps:!0,use_pdr:!0,upload_position:!0,use_default_permission:!0,ext_position_params:{},ext_sensor_params:{}},e),this.initPositionWebSocket(),this.options.use_sensor&&this.initSensorWebSocket(),this.options.use_pdr&&this.initPdr(),this.options.use_gps&&this.getGpsFloor()}};var kP=require("core-js/modules/web.dom-collections.iterator.js");var bn=class extends X{showMyPosition(t,e){var i;let s=(i=this.bmap.context.currentFloor)==null?void 0:i.getGraphicPosition(t);if(s){let o=new Ke(this.bmap.context,{autoUpdate:!0,appendToBody:!1});o.div.appendChild(e),o.position.copy(this.bmap.mercatorToWorld(s)),this.myPositionOverlay=o,console.log("graphicPos",s,this)}else console.warn("[showMyPosition] \u6CA1\u6709\u627E\u5230\u56FE\u5143\u6240\u5728\u7684\u4F4D\u7F6E")}hideMyPosition(){this.myPositionOverlay&&(this.myPositionOverlay.dispose(),this.myPositionOverlay=null)}dispose(){this.hideMyPosition()}constructor(...t){super(...t),this.myPositionOverlay=null}};var Sn=class extends X{highlightPoi(t,e){e===void 0&&(e={icon_size:[40,40],collision_enable:!1}),t.map(s=>this.bmap.getPoiById(s)).filter(s=>!!s).forEach(s=>{var o;(o=s.userData).restore||(o.restore={});for(let h in e)if(h in s.options){var n,r;(n=s.userData.restore)[r=h]||(n[r]=s.options[h]),s.options[h]=e[h]}})}restorePoi(t){t.map(i=>this.bmap.getPoiById(i)).filter(i=>!!i).forEach(i=>{console.log("poi.userData.restore",i.userData.restore);for(let s in i.userData.restore)s in i.options&&(i.options[s]=i.userData.restore[s]);i.userData.restore={}})}};var GP=require("core-js/modules/web.dom-collections.iterator.js"),FP=require("core-js/modules/es.array.sort.js");var En=class extends X{sortByDistance(t,e,i){return f(this,null,function*(){i===void 0&&(i=!1);let s=[...e];if(i||e.length<20)return yield Promise.all(s.map(o=>f(this,null,function*(){o.distance=yield this._getDistance(t,{floor:o.floor,x:o.center_x,y:o.center_y})}))),s.sort((o,n)=>o.distance-n.distance);{let o=s.sort((r,h)=>{let c=Math.sqrt((r.center_x-t.x)**2+(r.center_y-t.y)**2)+(t.floor===r.floor?0:100),l=Math.sqrt((h.center_x-t.x)**2+(h.center_y-t.y)**2)+(t.floor===h.floor?0:100);return c-l});return[...(yield Promise.all(o.slice(0,20).map(r=>f(this,null,function*(){return r.distance=yield this._getDistance(t,{floor:r.floor,x:r.center_x,y:r.center_y}),r})))).sort((r,h)=>r.distance-h.distance),...o.slice(20)]}})}_getDistance(t,e){return f(this,null,function*(){return this.navPath.getPath({floor:t.floor,coord:[t.x,t.y]},{floor:e.floor,coord:[e.x,e.y]},"",0).then(i=>i.reduce((s,o,n)=>{if(s+=o.distance,n!==i.length-1)switch(o.endType){case"escalator":case"straightLadder":case"staircase":case"ramp":s+=100;break}return s},0)).catch(i=>i==="near"?0:1/0)})}dispose(){super.dispose(),this.needDisposeNavPath&&this.navPath.dispose()}constructor(t,e){if(super(t),this.needDisposeNavPath=!1,e)this.navPath=e;else{this.navPath=new fs;let i=new qe(t);this.needDisposeNavPath=!0,i.load(t.config.apiPath.loadPlaceInfo+"?place_id="+t.config.placeId+"&env=prod").then(s=>f(this,null,function*(){let[o,n]=yield Promise.all([i.getRoadNetworkData(),i.getFacilitiesData()]);this.navPath.setRoadData(o,n.infrastructures)}))}}};var hc="https://robot-vr-public.bj.bcebos.com/v1/static_resource/satellite_tiles",cc={base_url:hc},Ln=class extends X{setVisible(t){this.tileLayer.setVisibility(t)}dispose(){this.bmap.context.scene.remove(this.tileLayer),this.tileLayer.dispose(),super.dispose()}constructor(t,e){super(t),this.options=w({},cc,e),this.tileLayer=new Re(t.context,this.options),this.tileLayer.position.z=-1,this.bmap.context.scene.add(this.tileLayer)}};var mo=require("three");var Cn=class extends X{addHeatmap(t,e){this.heatmap||(this.heatmap=new Yi(this.bmap.context),this.group.add(this.heatmap)),this.heatmap.loadData(t);let i=new mo.Box3().setFromObject(e.graphicLayer);return this.heatmap.position.setZ(i.max.z+.1),this.heatmap}removeHeatMap(){this.heatmap&&(this.group.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=null)}dispose(){this.removeHeatMap(),this.bmap.context.scene.remove(this.group)}constructor(t){super(t),this.heatmap=null,this.group=new mo.Group,this.bmap.context.scene.add(this.group)}};
|
|
701
|
+
`};var co=class extends mt.ShaderMaterial{constructor(t){super({type:"ArrowLineMaterial",uniforms:Object.assign({},mt.UniformsUtils.clone(mt.ShaderLib["custom-line"].uniforms),{map:{value:null}}),vertexShader:mt.ShaderLib["custom-line"].vertexShader,fragmentShader:mt.ShaderLib["custom-line"].fragmentShader,clipping:!0}),this.dashed=!1,Object.defineProperties(this,{map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},allDistance:{enumerable:!0,get:function(){return this.uniforms.allDistance.value},set:function(e){this.uniforms.allDistance.value=e}}}),this.setValues(t),this.isLineMaterial=!0}};var Pa=require("three/examples/jsm/lines/LineGeometry.js"),ba=require("three/examples/jsm/lines/Line2.js");var _a={texture_url:Rs,lineWidth:8,color:16777215},lo=class extends ft.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:i,height:s}}}}}=this,o=t.map(r=>{let[h,c,l]=r;return D(new ft.Vector3(h,c,l),e,i,s)}).map(r=>{let{x:h,y:c}=r;return[h,c]});return Et(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new ft.Vector2(t,1)}loadTexture(t){return new Promise((e,i)=>{new ft.TextureLoader().load(t,e,void 0,i)})}transformPoints(t){let e=[];for(let i=0;i<t.length;i++)e.push(...t[i]);return e}updatePoints(t){if(this.points=t,this.mesh){var e,i;this.remove(this.mesh),(e=this.material)==null||e.dispose(),(i=this.geometry)==null||i.dispose()}this.geometry=new Pa.LineGeometry,this.geometry.setPositions(t.flat(2));let s=Et(t.map(r=>{let[h,c]=r;return[h,c]})),o=this.material=new co({color:new ft.Color(this.config.color),transparent:!0,resolution:new ft.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!0,depthWrite:!0,linewidth:this.config.lineWidth,map:this.texture,blending:ft.NormalBlending,repeat:new ft.Vector2(this.getRepeat(),1),allDistance:s}),n=this.mesh=new ba.Line2(this.geometry,o);return n.computeLineDistances(),n.renderOrder=9,this.add(n),n}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return f(this,null,function*(){if(!this.texture){let e=this.texture=yield this.loadTexture(this.config.texture_url);e.wrapS=e.wrapT=ft.RepeatWrapping}return this.updatePoints(t)})}getBoundingBox(){return this.mesh?(this.mesh.geometry.computeBoundingBox(),new ft.Box3().copy(this.mesh.geometry.boundingBox).applyMatrix4(this.mesh.matrixWorld)):null}dispose(){var t,e,i;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(i=this.texture)==null||i.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=_a,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let i=this.navigation.bmap.context.camera.zoom;i!==this.prevCameraZoom&&(this.prevCameraZoom=i,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:i,height:s}=this.navigation.bmap.context.clientSize;this.material.resolution.set(i,s)}},this.config=Object.assign({},_a,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var Sa=require("@tweenjs/tween.js");var Zt=require("three"),po=class extends Zt.Object3D{meshSetMaterial(t){t instanceof Zt.Mesh&&(t.material.emissiveIntensity=.5,t.material.shininess=0,t.material.emissive=t.material.color,t.material.emissiveMap=t.material.map,t.material.transparent=!0,t.material.depthTest=!1,t.renderOrder=1e6),t.children.forEach(i=>{this.meshSetMaterial(i)})}getBaseScale(t){let{clientSize:{height:e},camera:i}=this.bmap.context,o=(i.top-i.bottom)/i.zoom/e;return this.options.size*o/this.modelMaxLength}registryEvent(){this.bmap.context.addEventListener("update",this._update),this.bmap.context.addEventListener("control-zoom-change",this._onChangeZoom)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this._update),this.bmap.context.removeEventListener("control-zoom-change",this._onChangeZoom)}lookAtCamera(){if(this.model&&this.bmap&&this.bmap.context){let t=this.bmap.context.camera,e=new Zt.Euler;e.setFromQuaternion(t.quaternion,"ZYX"),this.group.rotation.copy(e)}}setClips(t){this.clearClips(),t.length&&(this.mixer=new Zt.AnimationMixer(this.model.scene),t.forEach(e=>this.mixer.clipAction(e).play()))}startClips(){var t;this.setClips(((t=this.model)==null?void 0:t.animations)||[])}clearClips(){this.mixer&&(this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.mixer.getRoot()),this.mixer=null)}dispose(){this.unRegistryEvent(),this.clearClips(),this.clear(),this.model&&I(this.model.scene),this.bmap=null}constructor(t,e,i={}){super(),this.bmap=t,this.group=new Zt.Object3D,this.mixer=null,this.previewTime=0,this.modelMaxLength=0,this.options={size:40},this._update=()=>{let s=Date.now();if(!this.previewTime)this.previewTime=s;else{var o;let n=s-this.previewTime;this.previewTime=s,(o=this.mixer)==null||o.update(n/1e3)}this.lookAtCamera()},this._onChangeZoom=s=>{let{zoom:o}=s;var n;if(!this.model)return;let r=this.getBaseScale(this.model.scene);(n=this.model)==null||n.scene.scale.set(r,r,r)},this.options=w({},this.options,i),this.add(this.group),St.loadModel(e,!1).then(s=>{this.model=s;let n=new Zt.Box3().setFromObject(s.scene).getSize(new Zt.Vector3),r=Math.max(n.x,n.y,n.z);this.modelMaxLength=r;let h=this.getBaseScale(s.scene);s.scene.scale.set(h,h,h),this.meshSetMaterial(s.scene),this.group.add(s.scene),this.setClips(s.animations),this.group.rotation.set(Math.PI/2,Math.PI,0),this.dispatchEvent({type:"loaded"})}),this.registryEvent()}};var uo=require("three");var xn=class extends X{registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate)}pauseAnimation(){this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue()}clearTween(){this.tweenUtil.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate)}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.movedDistance=0,this.clearTween()),this.startModel&&(this.startModel.visible=!1),this.translatePath=null}addPath(t){this.paths=t;let e=t.map(i=>w({},i,{points:this.translatePoints(i.points)}));if(this.clearTween(),this.movedDistance=0,this.bmap.currentBuildGround)this.renderPath(e);else{let i=()=>{this.bmap.removeEventListener("center-change",i),this.renderPath(e)};this.bmap.addEventListener("center-change",i)}this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,i]=this.bmap.buildingCenter;return t.map(s=>[s[0]-e,s[1]-i])}renderPath(t){return f(this,null,function*(){if(!t.length)return this.clearPath();let e=[];t.forEach((i,s,o)=>{let n=this.mulFloor.floors.find(r=>r.name===i.floor);e.push(...i.points.map(r=>{let[h,c]=r;return[h,c,n.position.z+n.groundMaxHeight]}))}),this.cPath=e,this.animationPathOptions={cPathIndex:0},this.path?this.path.updatePoints(e):(this.path=new lo(this),yield this.path.create(e),this.path.position.z=.5,this.bmap.context.scene.add(this.path)),this.startModel&&(this.startModel.position.set(e[0][0],e[0][1],e[0][2]),this.startModel.visible=!0),this.dispatchEvent({type:"render-path",path:this.path})})}catmullRomCurve3(t){return Di(t,!1,!0,.1,170,2.5)}getPathDirection(t,e){if(t.length<2)return null;let i=he(t,e),s=t[i],o=t[i+1],n=new uo.Vector3(o[0]-s[0],o[1]-s[1],0).normalize(),r=new uo.Vector3(0,1,0).normalize(),h=n.angleTo(r),c=new uo.Vector3().crossVectors(r,n);return(Object.is(c.y,0)?-1:1)*h}startSimulation(t){return f(this,null,function*(){t===void 0&&(t=1);let{paths:e,movedDistance:i}=this;if(!e.length)return;let s=e.reduce((n,r)=>n+r.distance,0);if(!s||i>=s)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let o=s/t;return this.startModel.startClips(),new Promise(n=>{let r=this.simulationTween=new Sa.Tween({distance:this.movedDistance},this.tweenUtil.group).to({distance:s},o*1e3).onUpdate(h=>{var c;this.movedDistance=h.distance;let l=h.distance,p=0;for(let g=0;g<e.length;g++)if(e[g].distance>=l){p=g;break}else l-=e[g].distance;let d=Ze(e[p].points,l);if(d===null)return;this.currentPathPosition=d;let u=this.translatePoints([d])[0],m=this.mulFloor.floors.find(g=>g.name===e[p].floor),v=m?m.position.z+m.groundMaxHeight:(c=this.startModel)==null?void 0:c.position.z;this.startModel&&this.startModel.position.set(u[0],u[1],v)}).onComplete(()=>{if(this.tweenUtil.remove(r),this.startModel.clearClips(),this.startModel){var h,c,l,p;let d=(l=e.slice(-1)[0])==null||(c=l.points)==null||(h=c.slice(-1))==null?void 0:h[0];if(!d)return;let u=this.mulFloor.floors.find(g=>{var x;return g.name===((x=e.slice(-1)[0])==null?void 0:x.floor)});if(!u)return;let m=u?u.position.z+u.groundMaxHeight:(p=this.startModel)==null?void 0:p.position.z,v=this.translatePoints([d])[0];this.startModel.position.set(v[0],v[1],m)}n(!0)}).start()})})}setStartPoiRotate(t){if(this.startPoi){let i=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(360-t-i)%360}}dispose(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.startModel&&(this.bmap.context.scene.remove(this.startModel),this.startModel.dispose()),this.tweenUtil.dispose(),this.unRegistryEvent(),super.dispose()}constructor(t,e,i={}){super(t),this.mulFloor=e,this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.pathTween=null,this.startPoi=null,this.movedDistance=0,this.tweenUtil=new _e,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onUpdate=()=>{this.tweenUtil.update()},this.startModel=new po(t,Er,i.startModel),this.startModel.visible=!1,this.bmap.context.scene.add(this.startModel),this.registryEvent()}};var W_=require("core-js/modules/es.array.flat.js"),U_=require("core-js/modules/es.array.unscopables.flat.js"),mo=require("three");var wn=class extends X{registryEvent(){this.clickHelper.addEventListener("click",this._click)}unRegistryEvent(){this.clickHelper.removeEventListener("click",this._click)}dispose(){this.unRegistryEvent(),this.clickHelper.dispose(),this.mulFloors=null,super.dispose()}constructor(t,e){super(t),this.mulFloors=e,this._click=i=>{let{e:s}=i;if(!this.mulFloors.showStatus)return;let o=new mo.Vector2,{offsetX:n,offsetY:r}=s,h=this.mulFloors.floors.map(d=>d.poiLayer2.getPoiByDeviceXy(n,r)).flat(2),{clientSize:c}=this.bmap.context;o.x=n/c.width*2-1,o.y=r/c.height*-2+1;let l=new mo.Raycaster;l.setFromCamera(o,this.bmap.context.camera),l.ray.origin.sub(l.ray.direction.clone().multiplyScalar(1e4));let p=this.mulFloors.floors.map(d=>d.graphicLayer.getGraphicByRaycaster(l).graphics).flat();this.dispatchEvent({type:"select",pois:h,graphics:p})},this.clickHelper=new Ri(this.bmap.context.container),this.registryEvent()}};var $_=require("core-js/modules/es.array.find-last-index.js"),J_=require("core-js/modules/es.array.find-last.js"),Q_=require("core-js/modules/es.array.push.js");var j_=require("core-js/modules/web.dom-collections.iterator.js"),V_=require("core-js/modules/es.array.push.js"),K_=require("core-js/modules/es.array.sort.js"),yi=require("three");function sc(a){let t=a.length,e=0,i=0,s=0,o=0;a.forEach(h=>{e+=h[0],i+=h[1],s+=h[0]*h[1],o+=h[0]*h[0]});let n=(t*s-e*i)/(t*o-e*e),r=(i-n*e)/t;return{m:n,b:r}}function oc(a,t,e){let i=e[0][0],s=e.slice(-1)[0][0],o=a*i+t,n=a*s+t;return{start:[i,o],end:[s,n]}}function Ms(a){if(a.length<2)return null;let t=a.filter((h,c)=>{let l=[...a];return l.splice(c,1),l.every(p=>p[0]!==h[0]&&p[1]!==h[1])});if(t.length<2)return null;let{m:e,b:i}=sc(t),{start:s,end:o}=oc(e,i,t),r=360-(new yi.Vector2().subVectors(new yi.Vector2(o[0],o[1]),new yi.Vector2(s[0],s[1])).angle()/Math.PI*180-90+360)%360;return Number.isNaN(r)?null:r}function nc(a){let t=[];for(let e=1;e<a.length;e++){let i=a[e-1],s=a[e],o=s.position[0]-i.position[0],n=s.position[1]-i.position[1],r=Math.sqrt(o**2+n**2),h=s.time-i.time;if(h>0){let c=r/h;console.log("speedDelta",i.type,s.type,fo(c),r,h),t.push(c)}else t.push(0)}return t}function rc(a,t){let e=a[0],i=a.slice(-1)[0],s=O(i.position,e.position),o=i.time-e.time;return o<100||s<3?null:s/o}function fo(a){return a*60*60}function vi(a,t,e,i){let s=(e+90)%360*(Math.PI/180),o=t*i,n=new yi.Vector2(a[0],a[1]),r=Math.cos(s),h=Math.sin(s),c=new yi.Vector2(r,h);return n.add(c.normalize().multiplyScalar(o)),[n.x,n.y]}function ac(a){let t=[...a].sort((c,l)=>c-l),e=Ea(t,25),i=Ea(t,75),s=i-e,o=e-1.5*s,n=i+1.5*s,r=t.filter(c=>c>=o&&c<=n);return a.filter(c=>r.includes(c))}function Ea(a,t){let e=t/100*(a.length-1),i=Math.floor(e),s=Math.ceil(e);if(i===s)return a[i];let o=e-i;return a[i]*(1-o)+a[s]*o}var _s=require("lodash"),Ps=class extends st{setPathAngle(t){this.pathAngle=t,this.dispatchEvent({type:"change-compass",value:this.pathAngle}),(0,_s.isNil)(this.angle)&&(this.angle=t)}changeSpeed(){let t=this.history.filter(h=>["vision"].includes(h.type));if(t.length<2){this.speedFilter.filter(0),this.speed=0;return}let e=t[0],i=t.slice(-1)[0],s=O(i.position,e.position),o=i.time-e.time,n=o>0?s/o:0,r=this.speedFilter.filter(n);this.speed=r}changeAngle(t){t===void 0&&(t=this.visionHistory),t.length<2&&(this.angle=null);let e=Ms(t.map(i=>i.position));e!==null&&this.setAngle(e)}setAngle(t,e){e===void 0&&(e=!0),this.angle=t,e&&this.dispatchEvent({type:"change-position-compass",value:t})}setPosition(t,e,i){let s={position:t,time:e,clientTime:Date.now()-i,type:"vision"};if(this._setVisionHistoryForAngle(s),(0,_s.isNil)(this.angle)||!this.speed){this.addHistory(s);return}let o=this.history.findLastIndex(r=>r.type==="vision"),n=this.history[o];if(n){if(n.time>e)return;let r=Ms([this.history.slice(-1)[0].position,t]);if(r&&Math.abs(r-this.angle)<60){this.addHistory(s);return}let h=vi(t,this.speed,360-this.pathAngle,i);O(h,this.history.slice(-1)[0].position)>5?this.visionExcessesCount++:this.visionExcessesCount=0,this.visionExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21\u89C6\u89C9\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528\u89C6\u89C9\u6821\u51C6"),this.addHistory(s),this.visionExcessesCount=0)}}resetPdrPosition(){let t=this.history.findLast(e=>e.type==="vision");if(t&&this.speed){let e=vi(t.position,this.speed,360-this.pathAngle,Date.now()-t.clientTime);e&&this.history.push({position:e,time:Date.now(),clientTime:Date.now(),type:"pdr"})}}getLastVisionPdrPos(){let t=this.history.findLastIndex(i=>i.type==="vision");if(t!==-1){var e;return(e=this.history[t+1])!=null?e:this.history[t]}return null}_setVisionHistoryForAngle(t){if(!this.visionHistory.length){this.visionHistory.push(t);return}let e=Ms([this.visionHistory.slice(-1)[0].position,t.position]);if(e!==null&&(this.angle&&Math.abs(this.angle-e)>60?this.angleExcessesCount++:(this.angleExcessesCount=0,this.visionHistory.push(t))),this.angleExcessesCount>3)console.warn("\u8FDE\u7EED\u4E09\u6B21\u89D2\u5EA6\u6BD4\u8F83\u6B6A\uFF0C\u91CD\u65B0\u77EB\u6B63"),this.visionHistory=[t],this.angleExcessesCount=0;else{let i=O(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position);for(;i>5&&this.visionHistory.length>15;)this.visionHistory.shift(),i=O(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position)}this.changeAngle()}addHistory(t){this.history.push(t);let e=this.history.filter(r=>r.type==="vision"),i=e.length?Date.now()-e.slice(-1)[0].clientTime:0,s=O(this.history[0].position,this.history.slice(-1)[0].position),o=i>5e3?10:3,n=i>5e3?0:5;for(i>5e3&&console.warn("\u89C6\u89C9\u7ED3\u679C\u8D85\u51FA5s\u4E0D\u53EF\u7528\uFF0C\u5168\u90E8\u6E05\u7A7A");e.length>n&&s>o;)this.history.shift(),e=this.history.filter(r=>r.type==="vision"),s=O(this.history[0].position,this.history.slice(-1)[0].position);n===0?this.changeSpeed():t.type==="vision"&&this.changeSpeed(),this.changePosition(t.type)}setBeaconPosition(t,e,i){let s=Date.now()-i,o={position:t,time:e,clientTime:s,type:"beacon"},n=this.history.findLastIndex(l=>l.type!=="pdr"),r=this.history[n];if(!r){this.addHistory(o);return}if((0,_s.isNil)(this.pathAngle)||!this.speed){this.addHistory(o);return}if(r&&r.time>e)return;let h=vi(t,this.speed,360-this.pathAngle,i);O(h,this.history.slice(-1)[0].position)>5?this.beaconExcessesCount++:this.beaconExcessesCount=0,this.beaconExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21beacon\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528beacon\u6821\u51C6"),this.addHistory(o),this.beaconExcessesCount=0)}startPositionTimer(){this.positionTimer&&this.timer.clearInterval(this.positionTimer),this.positionTimer=this.timer.setInterval(()=>{this.changePosition()},20)}stopPositionTimer(){this.positionTimer&&(this.timer.clearInterval(this.positionTimer),this.positionTimer=null)}changePosition(t){t===void 0&&(t="pdr");let e=this.getPosition(t);e.success&&(this.history.push({position:e.pos,time:Date.now(),clientTime:Date.now(),type:"pdr"}),this.speed?this.dispatchEvent({type:"change-pos",value:w({},e)}):this.dispatchEvent({type:"change-pos",value:e}))}getPosition(t){if(this.history.length===0)return{success:!1,pos:[0,0],compass:null,speed:0};let e=this.history.slice(-1)[0];if(this.history.length<2)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};if((0,_s.isNil)(this.pathAngle)||!this.speed)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};let i=e.clientTime,s=Date.now()-i;return{success:!0,pos:this.pathAngle?vi(e.position,this.speed,360-this.pathAngle,s):e.position,compass:this.pathAngle,speed:fo(this.speed)}}dispose(){this.timer.dispose()}constructor(){super(),this.history=[],this.visionHistory=[],this.speed=0,this.angle=null,this.timer=new j,this.positionTimer=null,this.speedFilter=new Fi,this.visionExcessesCount=0,this.beaconExcessesCount=0,this.angleExcessesCount=0,this.pathAngle=0,this.startPositionTimer()}};var rP=require("core-js/modules/es.json.stringify.js");var hc={};function Mn(){return new Worker(new URL("./worker/recommend.worker-2H6IQKNB.js",hc.url))}var cc={placeId:0,catLotStatusApi:"https://vrapi.aibee.cn/parking/cat-lot-status"},_n=class{setRoadData(t,e){return Z(this.worker,"set_road_info",{roadData:t,facilities:e})}recommend(t){return f(this,null,function*(){let e=yield fetch(this.options.catLotStatusApi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({place_id:+this.options.placeId})}).then(i=>i.json()).then(i=>i.data.filter(s=>s.status===0)).then(i=>{var s;return i.filter((s=this.options.filterCarLotStatus)!=null?s:()=>!0)});return Z(this.worker,"recommend",w({},t,{carLotStatus:e}))})}dispose(){this.worker.terminate()}constructor(t={}){this.worker=Mn(),this.options=w({},cc,t)}};var yP=require("core-js/modules/es.json.stringify.js"),vP=require("core-js/modules/web.dom-collections.iterator.js"),xP=require("core-js/modules/es.array.sort.js"),wP=require("core-js/modules/es.array.push.js"),MP=require("core-js/modules/es.regexp.exec.js"),_P=require("core-js/modules/web.url-search-params.js"),PP=require("core-js/modules/web.url-search-params.delete.js"),bP=require("core-js/modules/web.url-search-params.has.js"),SP=require("core-js/modules/web.url-search-params.size.js");var dP=require("core-js/modules/es.json.stringify.js");var lc={url:"",reconnect:!0,heartBeat:2e3,heartMsg:JSON.stringify({command:"PING"}),reconnectTime:3e3,reconnectMaxCount:1e6,noMessageTime:6e3},xi=class extends st{initWebsocket(){this.ws=new WebSocket(this.options.url),this.ws.onopen=()=>{this.alive=!0,this.startHeart(),this.startOnMessageTimer(),this.stopReconnect(),this.dispatchEvent({type:"open"})},this.ws.onerror=()=>{this.alive=!1,this.ws=null,this.stopHeart(),this.stopOnMessageTimer(),this.startReconnect(),this.registryEvent()},this.ws.onclose=()=>{this.alive=!1,this.ws=null,this.stopHeart(),this.stopOnMessageTimer(),this.startReconnect()},this.ws.onmessage=t=>{this.startOnMessageTimer(),this.dispatchEvent({type:"message",message:t})}}startHeart(){this.stopHeart(),this.heartTimer=this.timer.setInterval(()=>{this.send(this.options.heartMsg)&&this.dispatchEvent({type:"send-heart"})},this.options.heartBeat)}stopHeart(){this.heartTimer&&(this.timer.clearInterval(this.heartTimer),this.heartTimer=null)}startReconnect(t){t===void 0&&(t=this.options.reconnectTime),this.stopReconnect(),this.options.reconnect&&(this.options.reconnectMaxCount--,this.options.reconnectMaxCount>=0&&(this.reconnectTimer=this.timer.setTimeout(()=>{this.initWebsocket()},t)))}stopReconnect(){this.reconnectTimer&&(this.timer.clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}startOnMessageTimer(){this.stopOnMessageTimer(),this.noMessageTimer=this.timer.setTimeout(()=>{var t;(t=this.ws)==null||t.close(),this.dispatchEvent({type:"no-message-timeout"})},this.options.noMessageTime)}stopOnMessageTimer(){this.noMessageTimer&&(this.timer.clearTimeout(this.noMessageTimer),this.noMessageTimer=null)}send(t){var e;let i=typeof t=="string"?t:JSON.stringify(t);return this.alive&&((e=this.ws)==null?void 0:e.readyState)===1?(this.ws.send(i),this.dispatchEvent({type:"send-success",msg:i}),!0):(this.dispatchEvent({type:"send-fail",msg:i}),!1)}registryEvent(){window.addEventListener("online",this.onOnline)}unRegistryEvent(){window.removeEventListener("online",this.onOnline)}close(){var t;this.unRegistryEvent(),this.options.reconnect=!1,this.alive=!1,this.stopHeart(),this.stopReconnect(),this.stopOnMessageTimer(),(t=this.ws)==null||t.close(),this.ws=null,this.dispatchEvent({type:"close"})}dispose(){this.close(),this.timer.dispose(),super.dispose()}constructor(t){super(),this.ws=null,this.alive=!1,this.timer=new j,this.heartTimer=null,this.reconnectTimer=null,this.noMessageTimer=null,this.onOnline=()=>{this.startReconnect()},this.options=w({},lc,t||{}),this.options.url&&this.initWebsocket()}};var bn=require("lodash");var Pn=a=>{let t=a.toString(2),e=""+Array(16-t.length+1).join("0")+t,i=parseInt(e.slice(0,4),2)*10,s=parseInt(e.slice(4,16),2);return[i,s]};var Sn=class extends st{initPositionWebSocket(){let t=w({},this.options.ext_position_params,{place_id:this.options.place_id,token:this.options.access_token}),e=Object.keys(t).filter(i=>!(0,bn.isNil)(t[i])).map(i=>i+"="+t[i]).join("&");this.positionWebSocket=new xi({url:this.options.wss_position_url+"?"+e}),this.positionWebSocket.addEventListener("message",i=>{let{message:s}=i,o=(()=>{try{return JSON.parse(s.data)}catch(U){return s.data}})();if(this.dispatchEvent({type:"ws-message",data:o}),o.command==="POSITION_RESULT"&&o.data.success)if(["POSITION","FLOOR","PARK_POSITION","AOA"].includes(o.data.success_type)&&this.useGpsFloorTimer&&(this.positionFloor=o.data.floor,this.timer.clearTimeout(this.useGpsFloorTimer),this.useGpsFloorTimer=null),o.data.success_type==="AOA"){let{x:U,y:H,time:et,floor:J,ts:ne}=o.data,re=this.positionFloor!==J;if(this.positionFloor=J,this.dispatchEvent({type:"ws-position",floor:J,x:U,y:H,time:et,_type:"aoa"}),this.options.upload_position){var n;(n=this.positionWebSocket)==null||n.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:U,y:H,floor:J,type:"aoa"}),serverData:JSON.stringify(o)})}if(!this.options.use_pdr){this.dispatchEvent({type:"position",floor:J,x:U,y:H,time:new Date(ne).getTime()-o.lag-o.duration});return}if(this.options.type!==1){var r;if(re){var h,c,l;(l=this.pdrPosition)==null||(c=l.pdr)==null||(h=c.particleFilter)==null||h.setPosInitFlag(!1)}(r=this.pdrPosition)==null||r.setBeaconPosition({x:U,y:H},new Date(ne).getTime()-o.lag-o.duration)}else if(re){var p;if(this.resetPdr(),(p=this.carInertialPosition)==null||p.stopPositionTimer(),this.path){let Ee=this.path.findIndex(Mi=>Mi.floor===J),ge=this.path[Ee];if(ge){var d;this.resetPdr(),(d=this.carInertialPosition)==null||d.setBeaconPosition(ge.points[0],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}else{var u;(u=this.carInertialPosition)==null||u.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var m;(m=this.carInertialPosition)==null||m.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var v;(v=this.carInertialPosition)==null||v.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else if(o.data.success_type==="POSITION"){let{x:U,y:H,time:et,floor:J,ts:ne}=o.data,re=this.positionFloor!==J;if(this.positionFloor=J,this.dispatchEvent({type:"ws-position",floor:J,x:U,y:H,time:et,_type:"beacon"}),console.log("positionFloor",J,re),this.options.upload_position){var g;(g=this.positionWebSocket)==null||g.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:U,y:H,floor:J,type:"originBeacon"}),serverData:JSON.stringify(o)})}if(!this.options.use_pdr){this.dispatchEvent({type:"position",floor:J,x:U,y:H,time:new Date(ne).getTime()-o.lag-o.duration});return}if(this.options.type!==1){var x;if(re){var M,P,C;(C=this.pdrPosition)==null||(P=C.pdr)==null||(M=P.particleFilter)==null||M.setPosInitFlag(!1)}(x=this.pdrPosition)==null||x.setBeaconPosition({x:U,y:H},new Date(ne).getTime()-o.lag-o.duration)}else if(re){var S;if(this.resetPdr(),(S=this.carInertialPosition)==null||S.stopPositionTimer(),this.path){let Ee=this.path.findIndex(Mi=>Mi.floor===J),ge=this.path[Ee];if(ge){var G;this.resetPdr(),(G=this.carInertialPosition)==null||G.setBeaconPosition(ge.points[0],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}else{var E;(E=this.carInertialPosition)==null||E.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var nt;(nt=this.carInertialPosition)==null||nt.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else{var Tt;(Tt=this.carInertialPosition)==null||Tt.setBeaconPosition([U,H],new Date(et).getTime()-o.lag-o.duration,o.lag+o.duration)}}else if(o.data.success_type==="PARK_POSITION"&&o.data.success){if(this.options.type===1){let{x:U,y:H,time:et,floor:J}=o.data,ne=this.positionFloor!==J;if(this.positionFloor=o.data.floor,this.dispatchEvent({type:"ws-position",floor:J,x:U,y:H,time:et,_type:"vision"}),!this.options.use_pdr){this.dispatchEvent({type:"position",floor:J,x:U,y:H,time:new Date(et).getTime()});return}if(ne){var gt;if(this.resetPdr(),(gt=this.carInertialPosition)==null||gt.stopPositionTimer(),this.path){let re=this.path.findIndex(ge=>ge.floor===J),Ee=this.path[re];if(Ee){var Ot;this.resetPdr(),(Ot=this.carInertialPosition)==null||Ot.setPosition(Ee.points[0],new Date(et).getTime(),o.duration)}else{var kt;(kt=this.carInertialPosition)==null||kt.setPosition([U,H],new Date(et).getTime(),o.duration)}}else{var oe;(oe=this.carInertialPosition)==null||oe.setPosition([U,H],new Date(et).getTime(),o.duration)}}else{var Se,ht;if((Se=this.carInertialPosition)==null||Se.setPosition([U,H],new Date(et).getTime(),o.duration),!((ht=this.carInertialPosition)!=null&&ht.positionTimer)){var $e;($e=this.carInertialPosition)==null||$e.startPositionTimer()}}if(this.options.upload_position){var wi;(wi=this.positionWebSocket)==null||wi.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:U,y:H,floor:J,type:"vision"}),serverData:JSON.stringify(o)})}}}else this.dispatchEvent({type:"floor",floor:o.data.floor,time:o.data.time})})}initSensorWebSocket(){let t=w({},this.options.ext_sensor_params,{token:this.options.access_token,place_id:this.options.place_id,record_sensor:1}),e=Object.keys(t).filter(i=>!(0,bn.isNil)(t[i])).map(i=>i+"="+t[i]).join("&");this.sensorWebSocket=new xi({url:this.options.wss_sensor_url+"?"+e})}initPdr(){this.options.type===1?(this.carInertialPosition=new Ps,this.carInertialPosition.addEventListener("change-pos",t=>{let{value:e}=t,{pos:i,success:s,speed:o}=e;if(s&&(this.dispatchEvent({type:"position",floor:this.positionFloor,x:i[0],y:i[1],time:Date.now(),speed:o}),this.options.upload_position)){var n;(n=this.positionWebSocket)==null||n.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:i[0],y:i[1],floor:this.positionFloor,type:"vision_pdr"})})}}),this.carInertialPosition.addEventListener("change-compass",t=>{let{value:e}=t;this.dispatchEvent({type:"compass",value:e})})):(this.pdrPosition=new ws(this.bmap,{pdr:{using_gps:this.options.use_gps},sensor:{elements:[F.COMPASS,F.ACCELERATION,F.DEVICE_MOTION].concat(this.options.use_gps?[F.GPS]:[])}}),this.requestDeviceOrientationPermission(),this.options.upload_position&&this.pdrPosition.sensor.addEventListener("sensor-data",t=>{let{data:e}=t;var i;(i=this.positionWebSocket)==null||i.send({command:"UPLOAD_SENSOR",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify(e)})}),this.pdrPosition.sensor.addEventListener("add-data-item",t=>{t.item.type==="compass"&&this.dispatchEvent({type:"compass",value:t.item.res})}),this.pdrPosition.addEventListener("position",t=>{let{x:e,y:i,_type:s}=t;if(console.log("_type",s,e,i,this.positionFloor,this.gpsFloor),s==="gps"&&!this.useGpsFloorTimer){let n=()=>{this.useGpsFloorTimer=this.timer.setTimeout(()=>{this.gpsFloor?this.positionFloor=this.gpsFloor:n()},5e3)};n()}if(this.positionFloor&&(this.dispatchEvent({type:"position",floor:this.positionFloor,x:e,y:i,time:Date.now()}),this.options.upload_position)){var o;(o=this.positionWebSocket)==null||o.send({command:"UPLOAD_POSITION",ts:Date.now(),index:this.uploadIndex++,data:JSON.stringify({x:e,y:i,floor:this.positionFloor,type:s})})}}))}setSensor(t){this.pdrPosition&&this.pdrPosition.setSensor(t)}requestDeviceOrientationPermission(){return f(this,null,function*(){if(this.pdrPosition){let t=yield this.pdrPosition.checkSensor();return t.deviceOrientation?this.pdrPosition.start():(this.dispatchEvent(w({type:"check-sensor"},t)),!t.deviceOrientation&&this.options.use_default_permission),t}else return null})}getGpsFloor(){return f(this,null,function*(){if(this.options.use_gps&&this.options.get_gps_floor_url){let t=yield fetch(this.options.get_gps_floor_url+"/"+this.options.place_id).then(e=>e.json());t.code===200&&(this.gpsFloor=t.data.gps_floor)}})}pausePdr(){if(this.options.type===1){var t;(t=this.carInertialPosition)==null||t.stopPositionTimer()}else{var e;(e=this.pdrPosition)==null||e.pause()}}continuePdr(){if(this.options.type===1)this.carInertialPosition&&(this.carInertialPosition.positionTimer||this.carInertialPosition.startPositionTimer());else{var t;(t=this.pdrPosition)==null||t.continue()}}setPathAngle(t){if(this.options.type===1){var e;(e=this.carInertialPosition)==null||e.setPathAngle(t)}}getForwardAngle(){if(this.options.type===1){var t,e;return(e=(t=this.carInertialPosition)==null?void 0:t.angle)!=null?e:null}else return null}resetPdr(){this.carInertialPosition&&(this.carInertialPosition.history=[],this.carInertialPosition.setPathAngle(0),this.carInertialPosition.speed=0),this.pdrPosition&&this.pdrPosition.pdr.particleFilter.setPosInitFlag(!1)}setPath(t){this.path=t}sendBeacon(t){var e;let i=[];if(le)i=t.map(o=>{let[n,r]=Pn(o.major);return[o.uuid,r,o.minor,o.rssi,o.accuracy,n]}).filter(o=>o[3]!==0).sort((o,n)=>n[3]-o[3]);else{let o=t.reduce((n,r)=>{var h,c;let[l,p]=Pn(r.major),d=""+p+r.minor;return(h=n)[c=d]||(h[c]=[]),n[d].push(w({},r,{battery:l,major:p})),n},{});Object.entries(o).forEach(n=>{let[r,h]=n,{uuid:c,major:l,minor:p,accuracy:d,battery:u}=h[0];if(h.length>1){let m=h.filter(g=>g.rssi<0),v=m.reduce((g,x)=>g+x.rssi,0);i.push([c,l,p,v/m.length,d,u])}else i.push([c,l,p,h[0].rssi,d,u])})}let s={command:"POSITION",index:this.uploadIndex++,ts:Date.now(),beacons:JSON.stringify([{type:"ibeacon",timestamp:Date.now()/1e3,res:i}]),ext_sensors:JSON.stringify({})};(e=this.sensorWebSocket)==null||e.send(s)}dispose(){var t,e,i,s;this.timer.dispose(),(t=this.positionWebSocket)==null||t.dispose(),this.positionWebSocket=null,(e=this.sensorWebSocket)==null||e.dispose(),this.sensorWebSocket=null,(i=this.pdrPosition)==null||i.dispose(),this.pdrPosition=null,(s=this.carInertialPosition)==null||s.dispose(),this.carInertialPosition=null,super.dispose()}constructor(t,e){super(),this.bmap=t,this.positionWebSocket=null,this.sensorWebSocket=null,this.pdrPosition=null,this.carInertialPosition=null,this.gpsFloor="",this.positionFloor="",this.useGpsFloorTimer=null,this.uploadIndex=0,this.path=null,this.timer=new j;let i=location.href.indexOf("?"),s=i!==-1?location.href.slice(i):location.search,o=new URLSearchParams(s),n=o.get("server_env")||"prod",r={test:"nav-test.aibee.cn",prod:"nav.aibee.cn"},h="wss://"+r[n]+"/aether-walker/indoor/position",c="wss://"+r[n]+"/aether-walker/indoor/sensor";this.options=w({place_id:o.get("place_id"),access_token:o.get("access_token"),env:n,wss_position_url:h,wss_sensor_url:c,get_gps_floor_url:"https://"+r[n]+"/aether-walker/indoor/conf",use_sensor:!1,type:-1,use_gps:!0,use_pdr:!0,upload_position:!0,use_default_permission:!0,ext_position_params:{},ext_sensor_params:{}},e),this.initPositionWebSocket(),this.options.use_sensor&&this.initSensorWebSocket(),this.options.use_pdr&&this.initPdr(),this.options.use_gps&&this.getGpsFloor()}};var IP=require("core-js/modules/web.dom-collections.iterator.js");var En=class extends X{showMyPosition(t,e){var i;let s=(i=this.bmap.context.currentFloor)==null?void 0:i.getGraphicPosition(t);if(s){let o=new Ke(this.bmap.context,{autoUpdate:!0,appendToBody:!1});o.div.appendChild(e),o.position.copy(this.bmap.mercatorToWorld(s)),this.myPositionOverlay=o,console.log("graphicPos",s,this)}else console.warn("[showMyPosition] \u6CA1\u6709\u627E\u5230\u56FE\u5143\u6240\u5728\u7684\u4F4D\u7F6E")}hideMyPosition(){this.myPositionOverlay&&(this.myPositionOverlay.dispose(),this.myPositionOverlay=null)}dispose(){this.hideMyPosition()}constructor(...t){super(...t),this.myPositionOverlay=null}};var Ln=class extends X{highlightPoi(t,e){e===void 0&&(e={icon_size:[40,40],collision_enable:!1}),t.map(s=>this.bmap.getPoiById(s)).filter(s=>!!s).forEach(s=>{var o;(o=s.userData).restore||(o.restore={});for(let h in e)if(h in s.options){var n,r;(n=s.userData.restore)[r=h]||(n[r]=s.options[h]),s.options[h]=e[h]}})}restorePoi(t){t.map(i=>this.bmap.getPoiById(i)).filter(i=>!!i).forEach(i=>{console.log("poi.userData.restore",i.userData.restore);for(let s in i.userData.restore)s in i.options&&(i.options[s]=i.userData.restore[s]);i.userData.restore={}})}};var WP=require("core-js/modules/web.dom-collections.iterator.js"),UP=require("core-js/modules/es.array.sort.js");var Cn=class extends X{sortByDistance(t,e,i){return f(this,null,function*(){i===void 0&&(i=!1);let s=[...e];if(i||e.length<20)return yield Promise.all(s.map(o=>f(this,null,function*(){o.distance=yield this._getDistance(t,{floor:o.floor,x:o.center_x,y:o.center_y})}))),s.sort((o,n)=>o.distance-n.distance);{let o=s.sort((r,h)=>{let c=Math.sqrt((r.center_x-t.x)**2+(r.center_y-t.y)**2)+(t.floor===r.floor?0:100),l=Math.sqrt((h.center_x-t.x)**2+(h.center_y-t.y)**2)+(t.floor===h.floor?0:100);return c-l});return[...(yield Promise.all(o.slice(0,20).map(r=>f(this,null,function*(){return r.distance=yield this._getDistance(t,{floor:r.floor,x:r.center_x,y:r.center_y}),r})))).sort((r,h)=>r.distance-h.distance),...o.slice(20)]}})}_getDistance(t,e){return f(this,null,function*(){return this.navPath.getPath({floor:t.floor,coord:[t.x,t.y]},{floor:e.floor,coord:[e.x,e.y]},"",0).then(i=>i.reduce((s,o,n)=>{if(s+=o.distance,n!==i.length-1)switch(o.endType){case"escalator":case"straightLadder":case"staircase":case"ramp":s+=100;break}return s},0)).catch(i=>i==="near"?0:1/0)})}dispose(){super.dispose(),this.needDisposeNavPath&&this.navPath.dispose()}constructor(t,e){if(super(t),this.needDisposeNavPath=!1,e)this.navPath=e;else{this.navPath=new ys;let i=new qe(t);this.needDisposeNavPath=!0,i.load(t.config.apiPath.loadPlaceInfo+"?place_id="+t.config.placeId+"&env=prod").then(s=>f(this,null,function*(){let[o,n]=yield Promise.all([i.getRoadNetworkData(),i.getFacilitiesData()]);this.navPath.setRoadData(o,n.infrastructures)}))}}};var pc="https://robot-vr-public.bj.bcebos.com/v1/static_resource/satellite_tiles",dc={base_url:pc},Tn=class extends X{setVisible(t){this.tileLayer.setVisibility(t)}dispose(){this.bmap.context.scene.remove(this.tileLayer),this.tileLayer.dispose(),super.dispose()}constructor(t,e){super(t),this.options=w({},dc,e),this.tileLayer=new Re(t.context,this.options),this.tileLayer.position.z=-1,this.bmap.context.scene.add(this.tileLayer)}};var go=require("three");var kn=class extends X{addHeatmap(t,e){this.heatmap||(this.heatmap=new $i(this.bmap.context),this.group.add(this.heatmap)),this.heatmap.loadData(t);let i=new go.Box3().setFromObject(e.graphicLayer);return this.heatmap.position.setZ(i.max.z+.1),this.heatmap}removeHeatMap(){this.heatmap&&(this.group.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=null)}dispose(){this.removeHeatMap(),this.bmap.context.scene.remove(this.group)}constructor(t){super(t),this.heatmap=null,this.group=new go.Group,this.bmap.context.scene.add(this.group)}};
|